Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
8 values
p02812
n=int(input()) s=input() print(sum(s[i:i+3]=="ABC" for i in range(n-3)))
n=int(input()) s=input() print(sum(s[i:i+3]=="ABC" for i in range(n-2)))
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,180
615,181
u941438707
python
p02812
N=int(input()) S=input() ans=0 for i in range(N-3): if "ABC"==S[i:i+3]: ans+=1 print(ans)
N=int(input()) S=input() ans=0 for i in range(N-2): if "ABC"==S[i:i+3]: ans+=1 print(ans)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,184
615,185
u919025034
python
p02812
N=int(input()) s=input() cnt=0 for i in range(0,N-3): if s[i]+s[i+1]+s[i+2]=="ABC": cnt+=1 print(cnt)
N=int(input()) s=input() cnt=0 for i in range(0,N-2): if s[i]+s[i+1]+s[i+2]=="ABC": cnt+=1 print(cnt)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,192
615,193
u109133010
python
p02812
N=int(input()) s=input() cnt=0 for i in range(0,N-3): if s[i]+s[i+1]+s[i+2]=="abc": cnt+=1 print(cnt)
N=int(input()) s=input() cnt=0 for i in range(0,N-2): if s[i]+s[i+1]+s[i+2]=="ABC": cnt+=1 print(cnt)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change", "literal.string.change", "literal.string.case.change", "control_flow.branch.if.condition.change" ]
615,194
615,193
u109133010
python
p02812
n = int(input()) s = input() count = 0 for i in range(n - 3): if s[i:i+3] == "ABC": count += 1 print(count)
n = int(input()) s = input() count = 0 for i in range(n - 2): if s[i:i+3] == "ABC": count += 1 print(count)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,209
615,210
u614063956
python
p02812
n = int(input()) s = input() cnt = 0 for i in range(n-3): # print(s[i:i+3]) if s[i:i+3] == 'ABC': cnt += 1 print(cnt)
n = int(input()) s = input() cnt = 0 for i in range(n-2): #print(s[i:i+3]) if s[i:i+3] == 'ABC': cnt += 1 print(cnt)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,235
615,236
u593934357
python
p02812
n = int(input()) s = input() ans = 0 i = 0 while i < n - 3: if s[i:i + 3] == 'ABC': ans += 1 i += 3 else: i += 1 print(ans)
n = int(input()) s = input() ans = 0 i = 0 while i < n - 2: if s[i:i + 3] == 'ABC': ans += 1 i += 3 else: i += 1 print(ans)
[ "literal.number.integer.change", "control_flow.loop.condition.change" ]
615,249
615,250
u533039576
python
p02812
n = int(input()) s = str(input()) ans = 0 for i in range(len(s) - 3): if s[i:i+3] == "ABC": ans += 1 print(ans)
n = int(input()) s = str(input()) ans = 0 for i in range(len(s) - 2): if s[i:i+3] == "ABC": ans += 1 print(ans)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,257
615,258
u652057333
python
p02812
#import sys MOD = 10 ** 9 + 7 #input = sys.stdin.readline import math import itertools #import bisect def sosuhante(n): for k in range(2, int(math.sqrt(n))+1): if n% k ==0: return False return True def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2,r+1): pivot = denominator[p - 1] if pivot > 1: offset = (n - r) % p for k in range(p-1,r,p): numerator[k - offset] /= pivot denominator[k] /= pivot result = 1 for k in range(r): if numerator[k] > 1: result *= int(numerator[k]) return result def kingaku(a,b,n): keta=len(str(n)) return a*n+b*keta def my_index(l, x, default=False): if x in l: return l.index(x) else: return default # h,w,a,b = map(int, input().split()) # c = [[0 for j in range(n)] for i in range(n)] def main(): n=int(input()) s=list(map(str,input())) temp=0 count=0 for i in range(n): if temp==0 and s[i]=="A": temp+=1 elif temp==1 and s[i]=="B": temp+=1 elif temp==2 and s[i]=="C": temp=0 count+=1 else: temp=0 print(count) if __name__ == "__main__": main()
#import sys MOD = 10 ** 9 + 7 #input = sys.stdin.readline import math import itertools #import bisect def sosuhante(n): for k in range(2, int(math.sqrt(n))+1): if n% k ==0: return False return True def cmb(n, r): if n - r < r: r = n - r if r == 0: return 1 if r == 1: return n numerator = [n - r + k + 1 for k in range(r)] denominator = [k + 1 for k in range(r)] for p in range(2,r+1): pivot = denominator[p - 1] if pivot > 1: offset = (n - r) % p for k in range(p-1,r,p): numerator[k - offset] /= pivot denominator[k] /= pivot result = 1 for k in range(r): if numerator[k] > 1: result *= int(numerator[k]) return result def kingaku(a,b,n): keta=len(str(n)) return a*n+b*keta def my_index(l, x, default=False): if x in l: return l.index(x) else: return default # h,w,a,b = map(int, input().split()) # c = [[0 for j in range(n)] for i in range(n)] def main(): n=int(input()) s=list(map(str,input())) temp=0 count=0 for i in range(n): if s[i]=="A": temp=1 elif temp==1 and s[i]=="B": temp+=1 elif temp==2 and s[i]=="C": temp=0 count+=1 else: temp=0 print(count) if __name__ == "__main__": main()
[ "control_flow.loop.for.condition.change", "assignment.value.change" ]
615,285
615,284
u366482170
python
p02812
n = int(input()) s = input() count = 0 for i in range(n): if s[i]!="A": pass else: if s[i+1]!="B": pass else: if s[i+2]!="C": pass else: count += 1 print(count)
n = int(input()) s = input() count = 0 for i in range(n-2): if s[i]!="A": pass else: if s[i+1]!="B": pass else: if s[i+2]!="C": pass else: count += 1 print(count)
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
615,304
615,305
u255673886
python
p02812
N=int(input()) S=input() ans=0 for i in range(N-3): if S[i:i+3]=='ABC': ans+=1 print(ans)
N=int(input()) S=input() ans=0 for i in range(N-2): if S[i:i+3]=='ABC': ans+=1 print(ans)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,306
615,307
u204616996
python
p02812
N = int(input()) S = input() ret = 0 for i in range(N): if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C': ret += 1 print(ret)
N = int(input()) S = input() ret = 0 for i in range(0, N-2): if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C': ret += 1 print(ret)
[ "call.arguments.add" ]
615,322
615,323
u113310313
python
p02812
n=int(input()) s=input() ans=0 for i in range(n-3): if s[i:i+3]=='ABC': ans+=1 print(ans)
n=int(input()) s=input() ans=0 for i in range(n-2): if s[i:i+3]=='ABC': ans+=1 print(ans)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,341
615,342
u480130675
python
p02812
N=int(input()) S=input() ANS=0 for i in range(N-3): if S[i:i+3] == "ABC": ANS+=1 print(ANS)
N=int(input()) S=input() ANS=0 for i in range(N-2): if S[i:i+3] == "ABC": ANS+=1 print(ANS)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,349
615,350
u578953945
python
p02812
n = int(input()) S=input() c=0 for i in range(n): if S[i]=="A": if S[i+1]=="B": if S[i+2]=="C": c+=1 print(c)
n = int(input()) S=input() c=0 for i in range(n-2): if S[i]=="A": if S[i+1]=="B": if S[i+2]=="C": c+=1 print(c)
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
615,351
615,352
u821432765
python
p02812
N = int(input()) S = input().strip() ans = 0 for i in range(N-3): if S[i:i+3] == 'ABC': ans += 1 print(ans)
N = int(input()) S = input().strip() ans = 0 for i in range(N-2): if S[i:i+3] == 'ABC': ans += 1 print(ans)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,357
615,358
u970308980
python
p02813
import itertools n = int(input()) p = map(int, input().split()) q = map(int, input().split()) d = dict() for i, v in enumerate(itertools.permutations([x for x in range(1, n+1, 1)]), 1): d[str(v)] = i print(d[str(tuple(p))] - d[str(tuple(q))])
import itertools n = int(input()) p = map(int, input().split()) q = map(int, input().split()) d = dict() for i, v in enumerate(itertools.permutations([x for x in range(1, n+1, 1)]), 1): d[str(v)] = i print(abs(d[str(tuple(p))] - d[str(tuple(q))]))
[ "call.arguments.add", "call.arguments.change" ]
615,373
615,374
u521919054
python
p02813
from itertools import permutations N = int(input()) P = tuple(list(map(int,input().split()))) Q = tuple(list(map(int,input().split()))) cnt = 0 for x in permutations(range(1,N+1),N): if P==x: indP = cnt elif Q==x: indQ = cnt cnt += 1 print(abs(indP-indQ))
from itertools import permutations N = int(input()) P = tuple(list(map(int,input().split()))) Q = tuple(list(map(int,input().split()))) cnt = 0 for x in permutations(range(1,N+1),N): if P==x: indP = cnt if Q==x: indQ = cnt cnt += 1 print(abs(indP-indQ))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,377
615,378
u644907318
python
p02813
def main(): number = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) num_list = list(range(1, number+1)) permu = list(itertools.permutations(num_list, number)) where_p = permu.index(p) where_q = permu.index(q) print(abs(where_p-where_q)) if __name__ == '__main__': main()
import itertools def main(): number = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) num_list = list(range(1, number+1)) permu = list(itertools.permutations(num_list, number)) where_p = permu.index(p) where_q = permu.index(q) print(abs(where_p-where_q)) if __name__ == '__main__': main()
[]
615,385
615,386
u884244819
python
p02813
from math import factorial from itertools import permutations n = int(input()) p = tuple(map(str, input().split())) q = tuple(map(str, input().split())) num = [str(i) for i in range(1, n+1)] allnum = list(i for i in permutations(num, n)) print(allnum) print(abs(allnum.index(p) - allnum.index(q)))
from math import factorial from itertools import permutations n = int(input()) p = tuple(map(str, input().split())) q = tuple(map(str, input().split())) num = [str(i) for i in range(1, n+1)] allnum = list(i for i in permutations(num, n)) print(abs(allnum.index(p) - allnum.index(q)))
[ "call.remove" ]
615,389
615,390
u800058906
python
p02813
#C - Count Order #DFS N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) a = 0 b = 0 cnt = 0 def dfs(A): global cnt global a global b if len(A) == N: cnt += 1 if A == P: a = cnt elif A == Q: b = cnt return for v in range(1,N+1): if v in A: continue A.append(v) dfs(A) A.pop() dfs([]) print(abs(a-b))
#C - Count Order #DFS N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) a = 0 b = 0 cnt = 0 def dfs(A): global cnt global a global b if len(A) == N: cnt += 1 if A == P: a = cnt if A == Q: b = cnt return for v in range(1,N+1): if v in A: continue A.append(v) dfs(A) A.pop() dfs([]) print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,393
615,392
u411923565
python
p02813
#C - Count Order #DFS N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) a = 0 b = 0 cnt = 0 def dfs(A): global cnt global a global b if len(A) == N: cnt += 1 if A == P: a = cnt elif A == Q: b = cnt print(b) return for v in range(1,N+1): if v in A: continue A.append(v) dfs(A) A.pop() dfs([]) print(abs(a-b))
#C - Count Order #DFS N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) a = 0 b = 0 cnt = 0 def dfs(A): global cnt global a global b if len(A) == N: cnt += 1 if A == P: a = cnt if A == Q: b = cnt return for v in range(1,N+1): if v in A: continue A.append(v) dfs(A) A.pop() dfs([]) print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove", "call.remove" ]
615,394
615,392
u411923565
python
p02813
N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) cnt, a, b = 0, 0, 0 for i in itertools.permutations(range(1, N+1)): if P == i: a = cnt if b != 0: break if Q == i: b = cnt if a != 0: break cnt += 1 print(abs(a-b))
import itertools N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) cnt, a, b = 0, 0, 0 for i in itertools.permutations(range(1, N+1)): if P == i: a = cnt if b != 0: break if Q == i: b = cnt if a != 0: break cnt += 1 print(abs(a-b))
[]
615,395
615,396
u105608888
python
p02813
n = int(input()) def pos_num(l): l_sort = l.copy() l_len = len(l) l_sort.sort() if l_len == 1: an = 0 else: #print(l_sort.index(l[0])+1) an = (l_sort.index(l[0]))*math.factorial(l_len-1) #print(an) return an ls = list(map(int, input().split())) an = 0 for i in range(n-1): b = pos_num(ls[i:]) an += b #print(an) print() ll = list(map(int, input().split())) bn = 0 for i in range(n-1): b = pos_num(ll[i:]) bn += b #print(bn) print(abs(an-bn))
import math n = int(input()) def pos_num(l): l_sort = l.copy() l_len = len(l) l_sort.sort() if l_len == 1: an = 0 else: #print(l_sort.index(l[0])+1) an = (l_sort.index(l[0]))*math.factorial(l_len-1) #print(an) return an ls = list(map(int, input().split())) an = 0 for i in range(n-1): b = pos_num(ls[i:]) an += b #print(an) ll = list(map(int, input().split())) bn = 0 for i in range(n-1): b = pos_num(ll[i:]) bn += b #print(bn) print(abs(an-bn))
[ "call.remove" ]
615,397
615,398
u224554402
python
p02813
import itertools n=int(input()) a=[] for i in range(n): a.append(i+1) b=[] for per in itertools.permutatiton(a): b.append(list(per)) c=b.index(list(map(int,input().split()))) d=b.index(list(map(int,input().split()))) print(abs(c-d))
import itertools n=int(input()) a=[] for i in range(n): a.append(i+1) b=[] for per in itertools.permutations(a): b.append(list(per)) c=b.index(list(map(int,input().split()))) d=b.index(list(map(int,input().split()))) print(abs(c-d))
[ "identifier.change" ]
615,399
615,400
u910632349
python
p02812
N = int(input()) S = input() ans = 0 for i in range(N-3): if (S[i:i+3] == "ABC"): ans += 1 print(ans)
N = int(input()) S = input() ans = 0 for i in range(N-2): if (S[i:i+3] == "ABC"): ans += 1 print(ans)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
615,406
615,407
u202634017
python
p02813
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) ls = list(itertools.parmutations(range(1,n+1))) print(abs(ls.index(p)-ls.index(q)))
import itertools n=int(input()) p=tuple(map(int,input().split())) q=tuple(map(int,input().split())) dict=list(itertools.permutations(range(1,n+1))) print(abs(dict.index(p)-dict.index(q)))
[ "assignment.variable.change", "identifier.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
615,433
615,434
u556594202
python
p02813
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) ls = list(itertools.permutations(range(1,n+1))) print(abs(ls.index(p)-ls.index(q))) print(ls)
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) ls = list(itertools.permutations(range(1,n+1))) print(abs(ls.index(p)-ls.index(q)))
[ "call.remove" ]
615,435
615,436
u556594202
python
p02813
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) ls = list(itertools.parmutations(range(1,n+1))) print(abs(ls.index(p)-ls.index(q)))
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) ls = list(itertools.permutations(range(1,n+1))) print(abs(ls.index(p)-ls.index(q)))
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
615,433
615,436
u556594202
python
p02813
from itertools import permutations n = int(input()) p = list(map(int,input().split())) q = list(map(int,input().split())) a = -1 b = -1 count = 0 for per in permutations(range(1,n+1)): count += 1 arr = [i for i in per] if arr==p: a = count elif arr==q: b = count print(abs(a-b))
from itertools import permutations n = int(input()) p = list(map(int,input().split())) q = list(map(int,input().split())) a = -1 b = -1 count = 0 for per in permutations(range(1,n+1)): count += 1 arr = [i for i in per] if arr==p: a = count if arr==q: b = count print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,437
615,438
u911449886
python
p02813
n = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) from itertools import permutations lst = permutations(range(1,n+1)) lst.sort() print(abs(lst.index(P) - lst.index(Q)))
n = int(input()) P = tuple(map(int,input().split())) Q = tuple(map(int,input().split())) from itertools import permutations lst = list(permutations(range(1,n+1))) lst.sort() print(abs(lst.index(P) - lst.index(Q)))
[ "assignment.value.change", "identifier.change", "call.function.change", "call.add", "call.arguments.change" ]
615,439
615,440
u103902792
python
p02813
import itertools N = int(input()) P = tuple((int(i) for i in input().split())) Q = tuple((int(i) for i in input().split())) f = list(itertools.permutations(range(1, N+1))) print(f.index(P) - f.index(Q))
import itertools N = int(input()) P = tuple((int(i) for i in input().split())) Q = tuple((int(i) for i in input().split())) f = list(itertools.permutations(range(1, N+1))) print(abs(f.index(P) - f.index(Q)))
[ "call.arguments.add", "call.arguments.change" ]
615,450
615,451
u724428568
python
p02813
N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) def dfs(x, d, res): if len(x) == N + 1: d[0] += 1 if x[1:] == P: res["P"] = d[0] elif x[1:] == Q: res["Q"] = d[0] return for v in range(1, N + 1): if v not in x: x.append(v) dfs(x, d, res) x.pop() res = {"P": 0, "Q": 0} dfs([0], [0], res) print(abs(res["P"] - res["Q"]))
N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) def dfs(x, d, res): if len(x) == N + 1: d[0] += 1 if x[1:] == P: res["P"] = d[0] if x[1:] == Q: res["Q"] = d[0] return for v in range(1, N + 1): if v not in x: x.append(v) dfs(x, d, res) x.pop() res = {"P": 0, "Q": 0} dfs([0], [0], res) print(abs(res["P"] - res["Q"]))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,462
615,463
u057109575
python
p02813
import itertools N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) permutations = list(itertools.permutations(range(1, N+1))) p = permutations.index(P) q = permutations.index(Q) print(abs(p-q))
import itertools N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) permutations = list(itertools.permutations(range(1, N+1))) p = permutations.index(P) q = permutations.index(Q) print(abs(p-q))
[ "assignment.value.change", "identifier.change", "call.function.change" ]
615,475
615,476
u566297428
python
p02813
from itertools import permutations as pe INT = lambda: int(input()) INTM = lambda: map(int,input().split()) STRM = lambda: map(str,input().split()) STR = lambda: str(input()) LIST = lambda: list(map(int,input().split())) LISTS = lambda: list(map(str,input().split())) def do(): n=INT() ns=[] for i in range(1,n+1): ns.append(str(i)) p=LISTS() q=LISTS() ct=0 for v in pe(ns,n): v=list(v) #print(v,p,q) ct+=1 if p==v: a=ct elif q==v: b=ct print(abs(a-b)) if __name__=='__main__': do()
from itertools import permutations as pe INT = lambda: int(input()) INTM = lambda: map(int,input().split()) STRM = lambda: map(str,input().split()) STR = lambda: str(input()) LIST = lambda: list(map(int,input().split())) LISTS = lambda: list(map(str,input().split())) def do(): n=INT() ns=[] for i in range(1,n+1): ns.append(str(i)) p=LISTS() q=LISTS() ct=0 for v in pe(ns,n): v=list(v) #print(v,p,q) ct+=1 if p==v: a=ct if q==v: b=ct print(abs(a-b)) if __name__=='__main__': do()
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,481
615,482
u779170803
python
p02813
import itertools import math n = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) A = list(itertools.permutations(list(range(1, n+1)))) A.sort() p = None q = None for i in range(math.factorial(n)): if P == list(A[i]): p = i+1 elif Q == list(A[i]): q = i+1 if p and q: print(abs(p - q)) exit()
import itertools import math n = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) A = list(itertools.permutations(list(range(1, n+1)))) A.sort() p = None q = None for i in range(math.factorial(n)): if P == list(A[i]): p = i+1 if Q == list(A[i]): q = i+1 if p and q: print(abs(p - q)) exit()
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,483
615,484
u441175813
python
p02813
import itertools n=int(input()) a=tuple(map(int,input().split())) b=tuple(map(int,input().split())) lst=[i for i in itertools.permutations(range(1,n+1))] cnt=0 for i in lst: if a==i: a=cnt elif b==i: b=cnt cnt+=1 print(abs(a-b))
import itertools n=int(input()) a=tuple(map(int,input().split())) b=tuple(map(int,input().split())) lst=[i for i in itertools.permutations(range(1,n+1))] cnt=0 for i in lst: if a==i: a=cnt if b==i: b=cnt cnt+=1 print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,485
615,486
u350093546
python
p02813
import itertools N=int(input()) P=list(map(int,input().split())) Q=list(map(int,input().split())) a=0 b=0 for i,v in enumerate(itertools.permutations(range(1,N+1),3)): if tuple(P)==v: a=i if tuple(Q)==v: b=i print(abs(a-b))
import itertools N=int(input()) P=list(map(int,input().split())) Q=list(map(int,input().split())) a=0 b=0 for i,v in enumerate(itertools.permutations(range(1,N+1),N)): if tuple(P)==v: a=i if tuple(Q)==v: b=i print(abs(a-b))
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
615,487
615,488
u075303794
python
p02813
from itertools import permutations N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) l = permutations(range(1,N+1)) print(abs(l.index(P)-l.index(Q)))
from itertools import permutations N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) l = list(permutations(range(1,N+1))) print(abs(l.index(P)-l.index(Q)))
[ "call.add", "call.arguments.change" ]
615,493
615,494
u377834804
python
p02813
import sys import math import itertools import statistics n=int(input()) p=tuple(map(int,input().split())) q=tuple(map(int,input().split())) per_lis = itertools.permutations(list(range(1,n+1))) a=0 b=0 i=0 for elem in per_lis: i+=1 if elem==p: a=i elif elem==q: b=i print(abs(a-b))
import sys import math import itertools import statistics n=int(input()) p=tuple(map(int,input().split())) q=tuple(map(int,input().split())) per_lis = itertools.permutations(list(range(1,n+1))) a=0 b=0 i=0 for elem in per_lis: i+=1 if elem==p: a=i if elem==q: b=i print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,517
615,518
u524534026
python
p02813
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) l = [] a, b,num = 0,0,0 for m in range(1,n+1): l.append(m) for i in itertools.permutations(l): num += 1 if i == p: a = num elif i == q: b = num print(abs(a-b))
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) l = [] a, b,num = 0,0,0 for m in range(1,n+1): l.append(m) for i in itertools.permutations(l): num += 1 if i == p: a = num if i == q: b = num print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,521
615,522
u626228246
python
p02813
import itertools N = int(input()) a = [i for i in range(1,N+1)] P = [int(x) for x in input().split()] Q = [int(x) for x in input().split()] kaijo = 1 for i in range(N): kaijo *= (N - i) A = list(itertools.permutations(a, N)) ansP = 0 for i in range(kaijo): if(list(A[i]) == P): ansP = i ansQ = 0 for i in range(kaijo): if(list(A[i]) == Q): ansQ = i print(ansQ-ansP)
import itertools N = int(input()) a = [i for i in range(1,N+1)] P = [int(x) for x in input().split()] Q = [int(x) for x in input().split()] kaijo = 1 for i in range(N): kaijo *= (N - i) A = list(itertools.permutations(a, N)) ansP = 0 for i in range(kaijo): if(list(A[i]) == P): ansP = i ansQ = 0 for i in range(kaijo): if(list(A[i]) == Q): ansQ = i print(abs(ansQ-ansP))
[ "call.arguments.add", "call.arguments.change" ]
615,525
615,526
u805011545
python
p02813
import math import itertools #k,x = list(list(map(int, input().split()))) n = int(input()) a = list(list(map(int, input().split()))) b = list(list(map(int, input().split()))) ans = 0 for i in itertools.permutations(range(1,n+1,1),n): ans +=1 if list(i) == a: ansa = ans elif list(i) == b: ansb = ans print(abs(ansa-ansb))
import math import itertools #k,x = list(list(map(int, input().split()))) n = int(input()) a = list(list(map(int, input().split()))) b = list(list(map(int, input().split()))) ans = 0 for i in itertools.permutations(range(1,n+1,1),n): ans +=1 if list(i) == a: ansa = ans if list(i) == b: ansb = ans print(abs(ansa-ansb))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,527
615,528
u881675205
python
p02813
N = int(input()) P = tuple(map(int,input().split())) Q = tuple(map(int,input().split())) ls = [i for i in range(1,N+1)] A = list(permutations(ls)) print(abs(A.index(P) - A.index(Q)))
import itertools N = int(input()) P = tuple(map(int,input().split())) Q = tuple(map(int,input().split())) ls = [i for i in range(1,N+1)] A = list(itertools.permutations(ls)) print(abs(A.index(P) - A.index(Q)))
[]
615,538
615,539
u634046173
python
p02813
from itertools import permutations N = int(input()) o = {} for i, p in enumerate(permutation(range(1,N+1))): o[p] = i P = tuple(int(x) for x in input().split()) Q = tuple(int(x) for x in input().split()) print(abs(o[P] - o[Q]))
from itertools import permutations N = int(input()) o = {} for i, p in enumerate(permutations(range(1,N+1))): o[p] = i P = tuple(int(x) for x in input().split()) Q = tuple(int(x) for x in input().split()) print(abs(o[P] - o[Q]))
[ "identifier.change", "call.function.change", "call.arguments.change" ]
615,542
615,543
u736729525
python
p02813
import itertools n = sorted([x+1 for x in range(int(input()))]) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) count = 0 pv = 0 qv = 0 for i in itertools.permutations(n,len(n)): count += 1 if i == p: pv = count elif i == q: qv = count print(abs(pv-qv))
import itertools n = sorted([x+1 for x in range(int(input()))]) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) count = 0 pv = 0 qv = 0 for i in itertools.permutations(n,len(n)): count += 1 if i == p: pv = count if i == q: qv = count print(abs(pv-qv))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,546
615,547
u537722973
python
p02813
import itertools n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) count = 0 for i in itertools.permutations([i + 1 for i in range(n)], n): if i == p: a = count elif i == q: b = count count += 1 print(abs(a - b))
import itertools n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) count = 0 for i in itertools.permutations([i + 1 for i in range(n)], n): if i == p: a = count if i == q: b = count count += 1 print(abs(a - b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,548
615,549
u201660334
python
p02813
import itertools N = int(input()) P=tuple(map(int,input().split())) Q=tuple(map(int,input().split())) for v_idx,v in enumerate(itertools.permutations(range(1,N+1))): if v==P: a=v_idx elif v==Q: b=v_idx print(abs(a-b))
import itertools N = int(input()) P=tuple(map(int,input().split())) Q=tuple(map(int,input().split())) for v_idx,v in enumerate(itertools.permutations(range(1,N+1))): if v==P: a=v_idx if v==Q: b=v_idx print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,557
615,558
u465101448
python
p02813
import math N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) def check(A): L = [j+1 for j in range(N)] ans = 0 for i in range(N): a = L.index(A[i]) ans += a*math.factorial(N-1-i) L.pop(a) return ans p = check(P) q = check(Q) print(math.abs(P-Q))
import math N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) def check(A): L = [j+1 for j in range(N)] ans = 0 for i in range(N): a = L.index(A[i]) ans += a*math.factorial(N-1-i) L.pop(a) return ans p = check(P) q = check(Q) print(abs(p-q))
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
615,563
615,562
u548684908
python
p02813
import itertools N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) lis = [i for i in range(1, N+1)] m = [] for i in itertools.permutations(lis, len(lis)): m.append(i) print(m) print(abs(m.index(P) - m.index(Q)))
import itertools N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) lis = [i for i in range(1, N+1)] m = [] for i in itertools.permutations(lis, len(lis)): m.append(i) print(abs(m.index(P) - m.index(Q)))
[ "call.remove" ]
615,564
615,565
u131453093
python
p02813
import itertools N = int(input()) P = list(map(int, (input().split()))) Q = list(map(int, (input().split()))) a = 0 b = 0 cnt = 0 tmp = sorted(P) print(P) for x in itertools.permutations(tmp): cnt += 1 if P == list(x): a = cnt if Q == list(x): b = cnt print(abs(a - b))
import itertools N = int(input()) P = list(map(int, (input().split()))) Q = list(map(int, (input().split()))) a = 0 b = 0 cnt = 0 tmp = sorted(P) for x in itertools.permutations(tmp): cnt += 1 if P == list(x): a = cnt if Q == list(x): b = cnt print(abs(a - b))
[ "call.remove" ]
615,578
615,579
u278057806
python
p02813
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) # 多分1~4で3!の順列になる ls = list(itertools.permutations(range(1,n))) #順列生成 # 絶対値absで辞書順のpからqをひく print(abs(ls.index(p)-ls.index(q)))
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) # 多分1~4で3!の順列になる ls = list(itertools.permutations(range(1,n+1))) #順列生成 # 絶対値absで辞書順のpからqをひく print(abs(ls.index(p)-ls.index(q)))
[ "control_flow.loop.range.bounds.upper.change", "assignment.change" ]
615,580
615,581
u294542073
python
p02813
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) ls = list(itertools.permutations(range(n))) #順列生成 # 絶対値absで辞書順のpからqをひく print(abs(ls.index(p)-ls.index(q)))
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) # 多分1~4で3!の順列になる ls = list(itertools.permutations(range(1,n+1))) #順列生成 # 絶対値absで辞書順のpからqをひく print(abs(ls.index(p)-ls.index(q)))
[ "call.arguments.add" ]
615,582
615,581
u294542073
python
p02813
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) L = list(itertools.permutations(P)) print(abs(L.index(tuple(Q))-L.index(tuple(P))))
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) L = sorted(list(itertools.permutations(P))) print(abs(L.index(tuple(Q))-L.index(tuple(P))))
[ "call.add", "call.arguments.change" ]
615,585
615,586
u425762225
python
p02813
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) per_list = [list(i) for i in itertools.permutations(range(1,N + 1))] print(abs(per_list.index(P) - per_list(Q)))
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) per_list = [list(i) for i in itertools.permutations(range(1,N + 1))] print(abs(per_list.index(P) - per_list.index(Q)))
[]
615,593
615,594
u883866798
python
p02813
import itertools import math n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) ans = list(itertools.permutations(range(1,n+1))) a = 0 b = 0 for i in range(len(ans)) : if ans[i] == p: a = i+1 elif ans[i]== q: b = i+1 print(abs(a-b))
import itertools import math n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) ans = list(itertools.permutations(range(1,n+1))) a = 0 b = 0 for i in range(len(ans)) : if ans[i] == p: a = i+1 if ans[i]== q: b = i+1 print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,602
615,603
u843073153
python
p02813
import itertools import math N=int(input()) P=tuple(map(int,input().split())) Q=tuple(map(int,input().split())) l=[ i+1 for i in range(N) ] Per=itertools.permutations(l,N) Per=list(Per) num=[-1,-1] for i in range(math.factorial(N)): if Per[i]==P: num[0]=i elif Per[i]==Q: num[1]=i print(abs(num[0]-num[1]))
import itertools import math N=int(input()) P=tuple(map(int,input().split())) Q=tuple(map(int,input().split())) l=[ i+1 for i in range(N) ] Per=itertools.permutations(l,N) Per=list(Per) num=[-1,-1] for i in range(math.factorial(N)): if Per[i]==P: num[0]=i if Per[i]==Q: num[1]=i print(abs(num[0]-num[1]))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,604
615,605
u636684559
python
p02813
import itertools N = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) a = 0 b = 0 for i, x in enumerate(itertools.permutations(range(1, N + 1))): print(i, x) if x == p: a = i if x == q: b = i print(abs(a - b))
import itertools N = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) a = 0 b = 0 for i, x in enumerate(itertools.permutations(range(1, N + 1))): #print(i, x) if x == p: a = i if x == q: b = i print(abs(a - b))
[ "call.remove" ]
615,608
615,609
u382639013
python
p02813
import itertools N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) num_p = 0 num_q = 0 num = [0]*N for i in range(N): num[i] = i+1 seq = list(itertools.permutations(num)) for j in range(len(seq)): if list(seq[j]) == P: num_p = j+1 elif list(seq[j]) == Q: num_q = j+1 print(abs(num_p - num_q))
import itertools N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) num_p = 0 num_q = 0 num = [0]*N for i in range(N): num[i] = i+1 seq = list(itertools.permutations(num)) for j in range(len(seq)): if list(seq[j]) == P: num_p = j+1 if list(seq[j]) == Q: num_q = j+1 print(abs(num_p - num_q))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,610
615,611
u720124072
python
p02813
import itertools N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) A = [i for i in range(1, N)] B = list(itertools.permutations(A)) ans = abs(B.find(P)-B.find(Q)) print(ans)
import itertools N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) A = [i for i in range(1, N+1)] B = list(itertools.permutations(A)) ans = abs(B.index(P)-B.index(Q)) print(ans)
[ "assignment.value.change", "identifier.change", "call.function.change", "call.arguments.change", "expression.operation.binary.change" ]
615,614
615,615
u991134049
python
p02813
n = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) import itertools A = list(itertools.permutations(list(range(1, n+1)))) a = A.index(P) b = A.index(Q) print(abs(a-b))
n = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) import itertools A = list(itertools.permutations(list(range(1, n+1)))) a = A.index(tuple(P)) b = A.index(tuple(Q)) print(abs(a-b))
[ "call.add", "call.arguments.change" ]
615,632
615,633
u555767343
python
p02813
import permutations n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) a = [i+1 for i in range(n)] for i,per in enumerate(list(permutations(a))): if per == p: x = i if per == q: y = i print(abs(x-y))
from itertools import * n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) a = [i+1 for i in range(n)] for i,per in enumerate(list(permutations(a))): if per == p: x = i if per == q: y = i print(abs(x-y))
[]
615,650
615,651
u652656291
python
p02813
import permutations n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) a = [i+1 for i in range(n)] for i,per in enumerate(list(permutations(a))): if per == p: x = i if per == q: y = i print(abs(x-y))
from itertools import permutations n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) a = [i+1 for i in range(n)] for i,per in enumerate(list(permutations(a))): if per == p: x = i if per == q: y = i print(abs(x-y))
[]
615,650
615,652
u652656291
python
p02813
n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) def fun(x): count=0 for k in range(len(x)-1): count+=math.factorial(len(x)-1)*sum(i<x[0] for i in x) del x[0] return count+1 a=fun(p) b=fun(q) print(abs(a-b))
import math n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) def fun(x): count=0 for k in range(len(x)-1): count+=math.factorial(len(x)-1)*sum(i<x[0] for i in x) del x[0] return count+1 a=fun(p) b=fun(q) print(int(abs(a-b)))
[ "call.add", "call.arguments.change" ]
615,664
615,665
u086624329
python
p02813
n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) def fun(x): count=0 for k in range(len(x)-1): count+=math.factorial(len(x)-1)*sum(i<x[0] for i in x) del x[0] return count+1 a=fun(p) b=fun(q) print(abs(a-b))
import math n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) def fun(x): count=0 for k in range(len(x)-1): count+=math.factorial(len(x)-1)*sum(i<x[0] for i in x) del x[0] return count+1 a=fun(p) b=fun(q) print(abs(a-b))
[]
615,664
615,667
u086624329
python
p02813
import itertools n=int(input()) pp=input().split() qq=input().split() p=[] q=[] p.append(pp) q.append(qq) a=[] for v in itertools.permutations(pp,n): a.append(v) a=sorted(a) for j in range(len(a)): a[j]=list(a[j]) b=0 c=0 for i in range(len(a)): if a[i]==pp: b+=i for k in range(len(a)): if a[k]==qq: c+=i print(max(b-c,c-b))
import itertools n=int(input()) pp=input().split() qq=input().split() p=[] q=[] p.append(pp) q.append(qq) a=[] for v in itertools.permutations(pp,n): a.append(v) a=sorted(a) for j in range(len(a)): a[j]=list(a[j]) b=0 c=0 for i in range(len(a)): if a[i]==pp: b+=i for k in range(len(a)): if a[k]==qq: c+=k print(max(b-c,c-b))
[ "identifier.change" ]
615,672
615,673
u798093965
python
p02813
n = int(input()) p = list(map(int, input().split())) q = list(map(int, input().split())) import itertools a = list(itertools.permutations([i for i in range(1, n+1)])) print(abs(a.index(p)-a.index(q)))
n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) import itertools a = list(itertools.permutations([i for i in range(1, n+1)])) print(abs(a.index(p)-a.index(q)))
[ "assignment.value.change", "identifier.change", "call.function.change" ]
615,674
615,675
u626881915
python
p02813
import sys from itertools import permutations input = sys.stdin.readline def readstr(): return input().strip() def readint(): return int(input()) def readnums(): return map(int, input().split()) def readstrs(): return input().split() def main(): N = readint() P = tuple(readnums()) Q = tuple(readnums()) a = b = 0 for i, v in enumerate(permutations(range(1, N + 1))): if v == P: a = i + 1 elif v == Q: b = i + 1 print(abs(a - b)) if __name__ == "__main__": main()
import sys from itertools import permutations input = sys.stdin.readline def readstr(): return input().strip() def readint(): return int(input()) def readnums(): return map(int, input().split()) def readstrs(): return input().split() def main(): N = readint() P = tuple(readnums()) Q = tuple(readnums()) a = b = 0 for i, v in enumerate(permutations(range(1, N + 1))): if v == P: a = i if v == Q: b = i print(abs(a - b)) if __name__ == "__main__": main()
[ "expression.operation.binary.change", "expression.operation.binary.remove" ]
615,678
615,679
u371385198
python
p02813
N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) Nl =[] for i in range(N): Nl.append(i+1) P_answer = 0 Q_answer = 0 for i, permu in enumerate(itertools.permutations(Nl)): if list(permu) == P: P_answer = i+1 if list(permu) == Q: Q_answer = i+1 print(abs(P_answer-Q_answer))
import itertools N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) Nl =[] for i in range(N): Nl.append(i+1) P_answer = 0 Q_answer = 0 for i, permu in enumerate(itertools.permutations(Nl)): if list(permu) == P: P_answer = i+1 if list(permu) == Q: Q_answer = i+1 print(abs(P_answer-Q_answer))
[]
615,707
615,708
u211236379
python
p02813
from itertools import permutations n = int(input()) p_list = list(map(int,input().split())) q_list = list(map(int,input().split())) dum_list = [i for i in range(1,n+1)] count = 0 ans = 0 for i in permutations(dum_list,n): count += 1 if p_list == list(i): ans += count elif q_list == list(i): ans -= count print(abs(ans))
from itertools import permutations n = int(input()) p_list = list(map(int,input().split())) q_list = list(map(int,input().split())) dum_list = [i for i in range(1,n+1)] count = 0 ans = 0 for i in permutations(dum_list,n): count += 1 if p_list == list(i): ans += count if q_list == list(i): ans -= count print(abs(ans))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,726
615,727
u482157295
python
p02813
N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) def calculate(n,p,q): x = 0 y = 0 for index,ar in enumerate(itertools.permutations([i for i in range(1,n+1)],n)): if list(ar) == list(p): x = index if list(ar) == list(q): y = index if x >= y: print(x-y) else: print(y-x) calculate(N,P,Q)
import itertools # N = 3 # P = [1, 3, 2] # Q = [3, 1, 2] # # N = 8 # P = [7, 3, 5, 4, 2, 1, 6, 8] # Q = [3, 8, 2, 5, 4, 6, 7, 1] # # # N = 3 # P = [1, 2, 3] # Q = [1, 2, 3] N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) def calculate(n,p,q): x = 0 y = 0 for index,ar in enumerate(itertools.permutations([i for i in range(1,n+1)],n)): if list(ar) == list(p): x = index if list(ar) == list(q): y = index if x >= y: print(x-y) else: print(y-x) calculate(N,P,Q)
[]
615,728
615,729
u788068140
python
p02813
import itertools N = int(input()) P = [int(x) for x in input().split()] P = tuple(P) Q = [int(x) for x in input().split()] Q = tuple(Q) N_ = list(range(1, N+1)) R = list(itertools.permutations(N_)) Pflg = Qflg = False Pcnt = Qcnt = -1 for i, r in enumerate(R): print(r) if P==r: Pflg = True Pcnt = i if Q==r: Qflg = True Qcnt = i if Pflg and Qflg: break print(abs(Pcnt - Qcnt))
import itertools N = int(input()) P = [int(x) for x in input().split()] P = tuple(P) Q = [int(x) for x in input().split()] Q = tuple(Q) N_ = list(range(1, N+1)) R = list(itertools.permutations(N_)) Pflg = Qflg = False Pcnt = Qcnt = -1 for i, r in enumerate(R): if P==r: Pflg = True Pcnt = i if Q==r: Qflg = True Qcnt = i if Pflg and Qflg: break print(abs(Pcnt - Qcnt))
[ "call.remove" ]
615,742
615,743
u461833298
python
p02813
from itertools import permutations n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) l=[] for i in range(n): l.append(i+1) dic= sorted(list(permutations(l,n))) r=len(dic) dicp=0 dicq=0 for x in range(r): dic[x]=list(dic[x]) if dic[x]==p: dicp=x+1 elif dic[x]==q: dicq=x+1 print(max(dicp-dicq,dicq-dicp))
from itertools import permutations n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) l=[] for i in range(n): l.append(i+1) dic= sorted(list(permutations(l,n))) r=len(dic) dicp=0 dicq=0 for x in range(r): dic[x]=list(dic[x]) if dic[x]==p: dicp=x+1 if dic[x]==q: dicq=x+1 print(max(dicp-dicq,dicq-dicp))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,745
615,746
u518064858
python
p02813
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) L = [i for i in range(1, N+1)] a = 0 b = 0 #順列作成 L_list = list(itertools.permutations(L)) for i in range(len(L_list)): if list(L_list[i]) == P: a = i+1 elif list(L_list[i]) == Q: b = i+1 else: continue print(abs(a-b))
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) L = [i for i in range(1, N+1)] a = 0 b = 0 #順列作成 L_list = list(itertools.permutations(L)) for i in range(len(L_list)): if list(L_list[i]) == P: a = i+1 if list(L_list[i]) == Q: b = i+1 print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,768
615,769
u692453235
python
p02813
n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) l = list(range(1,n+1)) dic = {} for i,j in enumerate(itertools.permutations(l)): dic[j] = i+1 print(abs(dic[p]-dic[q]))
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) l = list(range(1,n+1)) dic = {} for i,j in enumerate(itertools.permutations(l)): dic[j] = i+1 print(abs(dic[p]-dic[q]))
[]
615,772
615,773
u969211566
python
p02813
from itertools import permutations n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) for i, pi in enumerate(permutations(range(1, n+1))): if pi == p: a = i elif pi == q: b = i print(abs(a - b))
from itertools import permutations n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) for i, pi in enumerate(permutations(range(1, n+1))): if pi == p: a = i if pi == q: b = i print(abs(a - b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,776
615,777
u540631540
python
p02813
import itertools n=int(input()) p=list(map(int, input().split())) q=list(map(int, input().split())) cnt=0 for v in itertools.permutations(range(1,n+1), n): cnt +=1 if(p==v): a = cnt if(q==v): b = cnt print(abs(a-b))
import itertools n=int(input()) p=tuple(map(int, input().split())) q=tuple(map(int, input().split())) cnt=0 for v in itertools.permutations(range(1,n+1), n): cnt +=1 if(p==v): a = cnt if(q==v): b = cnt print(abs(a-b))
[ "assignment.value.change", "identifier.change", "call.function.change" ]
615,782
615,783
u100665987
python
p02813
from itertools import permutations n = int(input()) p = list(map(int,input().split())) q = list(map(int,input().split())) res = list(permutations(range(1,n+1))) ans = abs(res.index(p) - res.index(q)) print(ans)
from itertools import permutations n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) res = list(permutations(range(1,n+1))) ans = abs(res.index(p) - res.index(q)) print(ans)
[ "assignment.value.change", "identifier.change", "call.function.change" ]
615,794
615,795
u519939795
python
p02813
n = int(input()) p = list(map(int,input().split())) q = list(map(int,input().split())) res = list(permutations(range(1,n+1))) ans = abs(res.index(p) - res.index(q)) print(ans)
from itertools import permutations n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) res = list(permutations(range(1,n+1))) ans = abs(res.index(p) - res.index(q)) print(ans)
[ "assignment.value.change", "identifier.change", "call.function.change" ]
615,796
615,795
u519939795
python
p02813
import itertools n = int(input()) pl = tuple([int(i) for i in input().split()]) ql = tuple([int(i) for i in input().split()]) all_list = list(itertools.permutations(range(1,n+1))) print(all_list.index(pl) - all_list.index(ql))
import itertools n = int(input()) pl = tuple([int(i) for i in input().split()]) ql = tuple([int(i) for i in input().split()]) all_list = list(itertools.permutations(range(1,n+1))) print(abs(all_list.index(pl) - all_list.index(ql)))
[ "call.arguments.add", "call.arguments.change" ]
615,797
615,798
u183840468
python
p02813
n = int(input()) l = sorted(list(itertools.permutations([i for i in range(1,n+1)]))) al = tuple([int(i) for i in input().split()]) bl = tuple([int(i) for i in input().split()]) a,b = 0,0 if al == bl: print(0) else: for idx,i in enumerate(l): if i == al: a = idx elif i == bl: b = idx else: pass print(abs(a-b))
import itertools n = int(input()) l = sorted(list(itertools.permutations([i for i in range(1,n+1)]))) al = tuple([int(i) for i in input().split()]) bl = tuple([int(i) for i in input().split()]) a,b = 0,0 if al == bl: print(0) else: for idx,i in enumerate(l): if i == al: a = idx elif i == bl: b = idx else: pass print(abs(a-b))
[]
615,799
615,800
u183840468
python
p02813
n = int(input()) a = tuple(map(int,input().split())) b = tuple(map(int,input().split())) l = tuple(x+1 for x in range(n)) #print(a,b,l) c,d = 0,0 cnt = 0 from itertools import permutations for k in permutations(l): #print(k) cnt += 1 if a ==k: c = cnt elif b ==k: d = cnt print(abs(c-d))
n = int(input()) a = tuple(map(int,input().split())) b = tuple(map(int,input().split())) l = tuple(x+1 for x in range(n)) #print(a,b,l) c,d = 0,0 cnt = 0 from itertools import permutations for k in permutations(l): #print(k) cnt += 1 if a ==k: c = cnt if b ==k: d = cnt print(abs(c-d))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,807
615,808
u252828980
python
p02813
#16 AtCoder Beginner Contest 150 C - Count Order import itertools n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) ans = 0 j = 0 for i in itertools.permutations(range(1, n+1)): j += 1 if p == i: ans += j elif q == i: ans -= j print(abs(ans))
#16 AtCoder Beginner Contest 150 C - Count Order import itertools n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) ans = 0 j = 0 for i in itertools.permutations(range(1, n+1)): j += 1 if p == i: ans += j if q == i: ans -= j print(abs(ans))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,813
615,814
u700805562
python
p02813
import math n = int(input()) p = [int(s) for s in input().split()] q = [int(s) for s in input().split()] num_p = 1 for i in range(n): cnt = 0 for j in range(i+1,n): if(p[i] > p[j]): cnt += 1 num_p += math.factorial(n-i-1)*cnt num_q = 1 for i in range(n): cnt = 0 for j in range(i+1,n): if(q[i] > q[j]): cnt += 1 #print(cnt) num_q += math.factorial(n-i-1)*cnt #print(num_p) #print(num_q) print(num_p-num_q)
import math n = int(input()) p = [int(s) for s in input().split()] q = [int(s) for s in input().split()] num_p = 1 for i in range(n): cnt = 0 for j in range(i+1,n): if(p[i] > p[j]): cnt += 1 num_p += math.factorial(n-i-1)*cnt num_q = 1 for i in range(n): cnt = 0 for j in range(i+1,n): if(q[i] > q[j]): cnt += 1 #print(cnt) num_q += math.factorial(n-i-1)*cnt #print(num_p) #print(num_q) print(abs(num_p-num_q))
[ "call.arguments.add", "call.arguments.change" ]
615,831
615,832
u797572808
python
p02813
import itertools N = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) junretu = [i + 1 for i in range(N)] cnt = 0 for i in itertools.permutations(junretu, N): cnt += 1 if i == p: a = cnt #cnt += 1 elif i == q: b = cnt #cnt += 1 #cnt += 1 print(abs(a - b))
import itertools N = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) junretu = [i + 1 for i in range(N)] cnt = 0 for i in itertools.permutations(junretu, N): cnt += 1 if i == p: a = cnt #cnt += 1 if i == q: b = cnt #cnt += 1 #cnt += 1 print(abs(a - b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,837
615,838
u038408819
python
p02813
from itertools import permutations n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) if p == q: print(0) exit() base = sorted(p) pi = 0 qi = 0 for i, v in enumerate(permutations(base, n)): print(v) if p == v: pi = i + 1 elif q == v: qi = i + 1 if pi * qi != 0: break print(abs(pi-qi))
from itertools import permutations n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) if p == q: print(0) exit() base = sorted(p) pi = 0 qi = 0 for i, v in enumerate(permutations(base, n)): if p == v: pi = i + 1 elif q == v: qi = i + 1 if pi * qi != 0: break # print(f"{pi} {qi}") print(abs(pi-qi))
[ "call.remove" ]
615,841
615,842
u770077083
python
p02813
import itertools n = int(input()) A = tuple(map(int,input().split())) B = tuple(map(int,input().split())) Z = list(itertools.permutations(range(1,n+1))) a = 0 b = 0 for i,z in enumerate(Z): #print(z,A) if(z == A): a = i+1 elif(z == B): b = i+1 print(abs(a-b))
import itertools n = int(input()) A = tuple(map(int,input().split())) B = tuple(map(int,input().split())) Z = list(itertools.permutations(range(1,n+1))) a = 0 b = 0 for i,z in enumerate(Z): #print(z,A) if(z == A): a = i+1 if(z == B): b = i+1 print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,845
615,846
u101442050
python
p02813
import sys import math import itertools stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().rstrip() # ignore trailing spaces n = ni() p = na() q = na() l = list(itertools.permutations(list(range(1, n+1)))) print(abs(l.index(tuple(p))) - abs(l.index(tuple(q))))
import sys import math import itertools stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().rstrip() # ignore trailing spaces n = ni() p = na() q = na() l = list(itertools.permutations(list(range(1, n+1)))) print(abs(l.index(tuple(p)) - l.index(tuple(q))))
[ "call.arguments.change", "call.remove" ]
615,852
615,853
u177411511
python
p02813
def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) N = INT() P = LIST() Q = LIST() import itertools for i, l in enumerate(itertools.permutations(range(1, N+1), N)): if list(l) == P: a = i+1 elif list(l) == Q: b = i+1 print(abs(a-b))
def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) N = INT() P = LIST() Q = LIST() import itertools for i, l in enumerate(itertools.permutations(range(1, N+1), N)): if list(l) == P: a = i+1 if list(l) == Q: b = i+1 print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,854
615,855
u417220101
python
p02813
import itertools def AllPatern(n, all): numbers = [] all = [] for i in range(n): numbers.append(i+1) for i in itertools.permutations(numbers): all.append(list(i)) return all def WhichNumber(p, q, all): val_p = 0 val_q = 0 for i in range(len(all)): val_p += 1 if p == all[i]: break for i in range(len(all)): val_q += 1 if q == all[i]: break return val_p, val_q def main(): n = int(input()) p = [int(i) for i in input().split()] q = [int(i) for i in input().split()] all_numbers=[] all_numbers = AllPatern(n, all_numbers) val_p, val_q = WhichNumber(p, q, all) print(abs(val_p - val_q)) if __name__ == '__main__': main()
import itertools def AllPatern(n, all): numbers = [] all = [] for i in range(n): numbers.append(i+1) for i in itertools.permutations(numbers): all.append(list(i)) return all def WhichNumber(p, q, all): val_p = 0 val_q = 0 for i in range(len(all)): val_p += 1 if p == all[i]: break for i in range(len(all)): val_q += 1 if q == all[i]: break return val_p, val_q def main(): n = int(input()) p = [int(i) for i in input().split()] q = [int(i) for i in input().split()] all = [] all = AllPatern(n, all) val_p, val_q = WhichNumber(p, q, all) print(abs(val_p - val_q)) if __name__ == '__main__': main()
[ "assignment.variable.change", "identifier.change", "assignment.value.change", "call.arguments.change" ]
615,875
615,876
u750120744
python
p02813
import math n=int(input()) s=list(map(int,input().split())) t=list(map(int,input().split())) lists=[] listt=[] sums=0 sumt=0 def rank(n,l): for i in range(len(l)): if n==l[i]: l.remove(l[i]) return i+1 for i in range(n): lists.append(i+1) listt.append(i+1) for i in range(n): sums+=(rank(s[i],lists)-1)*(math.factorial(7-i)) sumt+=(rank(t[i],listt)-1)*(math.factorial(7-i)) if sums<sumt: tmp=sums sums=sumt sumt=tmp print(sums-sumt)
import math n=int(input()) s=list(map(int,input().split())) t=list(map(int,input().split())) lists=[] listt=[] sums=0 sumt=0 def rank(n,l): for i in range(len(l)): if n==l[i]: l.remove(l[i]) return i+1 for i in range(n): lists.append(i+1) listt.append(i+1) for i in range(n): sums+=(rank(s[i],lists)-1)*(math.factorial(n-1-i)) sumt+=(rank(t[i],listt)-1)*(math.factorial(n-1-i)) if sums<sumt: tmp=sums sums=sumt sumt=tmp print(sums-sumt)
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "expression.operation.binary.change" ]
615,902
615,903
u857330600
python
p02813
import itertools N = int(input()) LN = [] for i in range(N): LN.append(i+1) LLN=list(itertools.permutations(LN)) P = list(map(int, input().split())) Q = list(map(int, input().split())) print(LLN.index(tuple(P))-LLN.index(tuple(Q)))
import itertools N = int(input()) LN = [] for i in range(N): LN.append(i+1) LLN=list(itertools.permutations(LN)) P = list(map(int, input().split())) Q = list(map(int, input().split())) print(abs(LLN.index(tuple(P))-LLN.index(tuple(Q))))
[ "call.arguments.add", "call.arguments.change" ]
615,904
615,905
u686713618
python
p02813
import numpy as np import interpools N = int(input()) P = [int(i) for i in input().split()] Q = [int(i) for i in input().split()] Num = range(1,N+1) Number = str(''.join(map(str,Num))) per_num=list(itertools.permutations(Number)) pernum_arr = np.ones(len(per_num)) for i in range(len(per_num)): pernum_arr[i] = int(''.join(map(str,per_num[i]))) P = int(''.join(map(str,P))) Q = int(''.join(map(str,Q))) print(P) ans = abs(np.where(pernum_arr==P)[0]-np.where(pernum_arr==Q)[0]) print(ans[0])
import numpy as np import itertools N = int(input()) P = [int(i) for i in input().split()] Q = [int(i) for i in input().split()] Num = range(1,N+1) Number = str(''.join(map(str,Num))) per_num=list(itertools.permutations(Number)) pernum_arr = np.ones(len(per_num)) for i in range(len(per_num)): pernum_arr[i] = int(''.join(map(str,per_num[i]))) P = int(''.join(map(str,P))) Q = int(''.join(map(str,Q))) ans = abs(np.where(pernum_arr==P)[0]-np.where(pernum_arr==Q)[0]) print(ans[0])
[ "identifier.change", "call.remove" ]
615,912
615,913
u478266845
python
p02813
import itertools N=int(input()) I=[str(i) for i in range(1,N+1)] P=''.join(input().split()) Q=''.join(input().split()) li=list(itertools.permutations(I,N)) a=0 b=0 for i in range(len(li)): if(''.join(li[i])==P): a=i+1 elif(''.join(li[i])==Q): b=i+1 print(abs(b-a))
import itertools N=int(input()) I=[str(i) for i in range(1,N+1)] P=''.join(input().split()) Q=''.join(input().split()) li=list(itertools.permutations(I,N)) a=0 b=0 for i in range(len(li)): if(''.join(li[i])==P): a=i+1 if(''.join(li[i])==Q): b=i+1 print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove", "expression.operation.binary.remove" ]
615,916
615,917
u930705402
python
p02813
import sys import itertools input = sys.stdin.readline n = int(input()) p = list(map(int, input().split())) q = list(map(int, input().split())) l = list(itertools.permutations([i for i in range(1, n+1)], 3)) x = sorted([l.index(p)+1, l.index(q)+1], reverse=True) print(x[0] - x[1])
import sys import itertools input = sys.stdin.readline n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) l = list(itertools.permutations([i for i in range(1, n+1)], n)) x = sorted([l.index(p)+1, l.index(q)+1], reverse=True) print(x[0] - x[1])
[ "assignment.value.change", "identifier.change", "call.function.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
615,918
615,919
u337820403
python
p02813
import itertools N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) N_list = [i for i in range(1,N)] conbination = list(itertools.permutations(N_list, N)) a = conbination.index(tuple(P)) b = conbination.index(tuple(Q)) print(abs(a-b))
import itertools N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) N_list = [i for i in range(1,N+1)] conbination = list(itertools.permutations(N_list, N)) a = conbination.index(tuple(P)) b = conbination.index(tuple(Q)) print(abs(a-b))
[ "control_flow.loop.range.bounds.upper.change", "assignment.change" ]
615,928
615,929
u509392332
python
p02813
import itertools N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) N_list = [i for i in range(1,N)] conbination = list(itertools.permutations(N_list, 8)) a = conbination.index(tuple(P)) b = conbination.index(tuple(Q)) print(abs(a-b))
import itertools N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) N_list = [i for i in range(1,N+1)] conbination = list(itertools.permutations(N_list, N)) a = conbination.index(tuple(P)) b = conbination.index(tuple(Q)) print(abs(a-b))
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
615,930
615,929
u509392332
python
p02813
import math N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) lis1 = [i for i in range(1,N+1)] lis2 = [i for i in range(1,N+1)] def number(a, lis): total_order = 1 for i in range(N): tmp_order = lis.index(a[i]) lis.pop(a[i]) total_order += tmp_order * math.factorial(len(lis)) return total_order print(abs(number(P, lis1) - number(Q, lis2)))
import math N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) lis1 = [i for i in range(1,N+1)] lis2 = [i for i in range(1,N+1)] def number(a, lis): total_order = 1 for i in range(N): tmp_order = lis.index(a[i]) lis.remove(a[i]) total_order += tmp_order * math.factorial(len(lis)) return total_order print(abs(number(P, lis1) - number(Q, lis2)))
[ "identifier.change" ]
615,935
615,934
u944643608
python
p02813
from itertools import permutations N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) left = 0 r = 0 gen = [x for x in range(1, N+1)] i = 1 for perm in permutations(gen): if perm == P: left = i elif perm == Q: r = i i += 1 print(abs(left-r))
from itertools import permutations N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) left = 0 r = 0 gen = [x for x in range(1, N+1)] i = 1 for perm in permutations(gen): if perm == P: left = i if perm == Q: r = i i += 1 print(abs(left-r))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,942
615,943
u411302151
python
p02813
import itertools n = int(input()) p =[int(i) for i in input().split()] q =[int(i) for i in input().split()] a = 0 b = 0 cnt = 0 p1= p.copy() p1.sort() n_list = list(itertools.permutations(p1)) for i in n_list: if list(i)==p: a = cnt +1 elif list(i)==q: b = cnt +1 cnt += 1 print(abs(a-b))
import itertools n = int(input()) p =[int(i) for i in input().split()] q =[int(i) for i in input().split()] a = 0 b = 0 cnt = 0 p1= p.copy() p1.sort() n_list = list(itertools.permutations(p1)) for i in n_list: if list(i)==p: a = cnt +1 if list(i)==q: b = cnt +1 cnt += 1 print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
615,965
615,966
u293198424
python