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 |
|---|---|---|---|---|---|---|---|
p02820 | n,k = (int(i) for i in input().split())
r,s,p = (int(i) for i in input().split())
t = input()
ans = 0
x = []
for i in range(n):
if i<k:
if t[i] == "r":
x.append(0)
ans += p
elif t[i] == "s":
x.append("r")
ans += r
elif t[i] == "p":
x.append("s")
ans += s
else:
if ... | n,k = (int(i) for i in input().split())
r,s,p = (int(i) for i in input().split())
t = input()
ans = 0
x = []
for i in range(n):
if i<k:
if t[i] == "r":
x.append("p")
ans += p
elif t[i] == "s":
x.append("r")
ans += r
elif t[i] == "p":
x.append("s")
ans += s
else:
i... | [
"call.arguments.change"
] | 625,494 | 625,495 | u620755070 | python |
p02820 | *t,s=open(0).read().split()
n,k,r,s,p=map(int,t)
d={'r':p,'s':r,'p':s}
b=['']*n*2
a=0
for i,c in enumerate(s[:n]):
if c!=b[i-k]:
b[i]=c
a+=d[c]
print(a) | *n,t=open(0).read().split()
n,k,r,s,p=map(int,n)
d={'r':p,'s':r,'p':s}
b=['']*n*2
a=0
for i,c in enumerate(t[:n]):
if c!=b[i-k]:
b[i]=c
a+=d[c]
print(a) | [
"assignment.variable.change",
"identifier.change",
"assignment.value.change",
"call.arguments.change"
] | 625,507 | 625,508 | u729133443 | python |
p02820 | n,k = map(int,input().split())
r,s,p = map(int,input().split())
S = input()
ans = 0
hand = ""
dic = {"r":"p","p":"s","s":"r"}
for i in range(n):
if i < k:
if S[i] == "r":
ans += p
hand += "p"
elif S[i] == "p":
ans += s
hand += "s"
else:
... | n,k = map(int,input().split())
r,s,p = map(int,input().split())
S = input()
ans = 0
hand = ""
dic = {"r":"p","p":"s","s":"r"}
for i in range(n):
if i < k:
if S[i] == "r":
ans += p
hand += "p"
elif S[i] == "p":
ans += s
hand += "s"
else:
... | [] | 625,518 | 625,519 | u350836088 | python |
p02820 | N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
if x=="r":
c+=P
elif x=="s":
c+=R
else:
c+=S
return c
n=len(T)
for i in range(n):
if i<=K-1:
c=get(T[i],c)
else:
if T[i-K]!=T[i]:
c=get(T[i],c)
if T[i-K]!="o" and T[i-K]==T[i]:
... | N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
if x=="r":
c+=P
elif x=="s":
c+=R
else:
c+=S
return c
n=len(T)
for i in range(n):
if i<=K-1:
c=get(T[i],c)
else:
if T[i-K]!=T[i]:
c=get(T[i],c)
if T[i-K]!="o" and T[i-K]==T[i]:
... | [
"expression.operation.binary.remove"
] | 625,522 | 625,523 | u692311686 | python |
p02820 | def A():
temp = input().split()
print(''.join(temp[::-1]))
def B():
temp = [int(n) for n in input().split()]
A = temp[0]
B = temp[1]
K = temp[2]
to_minus = min(A, K)
A -= to_minus
K -= to_minus
if K > 0:
B -= min(B, K)
print (A, B)
import math
def C():
X = int(i... | def A():
temp = input().split()
print(''.join(temp[::-1]))
def B():
temp = [int(n) for n in input().split()]
A = temp[0]
B = temp[1]
K = temp[2]
to_minus = min(A, K)
A -= to_minus
K -= to_minus
if K > 0:
B -= min(B, K)
print (A, B)
import math
def C():
X = int(i... | [
"assignment.value.change"
] | 625,528 | 625,529 | u151285327 | python |
p02820 | def f(x):
if x == "r":
return "p"
elif x == "s":
return "r"
else:
return "s"
def g(x):
if x == "r":
return r
elif x == "s":
return s
else:
return p
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = str(input())
ssssppr
m = n
... | def f(x):
if x == "r":
return "p"
elif x == "s":
return "r"
else:
return "s"
def g(x):
if x == "r":
return r
elif x == "s":
return s
else:
return p
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = str(input())
m = n
a = 0
s... | [] | 625,538 | 625,539 | u865119809 | python |
p02820 | def f(x):
if x == "r":
return "p"
elif x == "s":
return "r"
else:
return "s"
def g(x):
if x == "r":
return r
elif x == "s":
return s
else:
return p
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = str(input())
ssssppr
m = ... | def f(x):
if x == "r":
return "p"
elif x == "s":
return "r"
else:
return "s"
def g(x):
if x == "r":
return r
elif x == "s":
return s
else:
return p
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = str(input())
m = n
a = 0
s... | [
"assignment.value.change",
"expression.operation.binary.change"
] | 625,540 | 625,539 | u865119809 | python |
p02820 | def f(x):
if x == "r":
return "p"
elif x == "s":
return "r"
else:
return "s"
def g(x):
if x == "r":
return r
elif x == "s":
return s
else:
return p
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = str(input())
ssssppr
m = n
a... | def f(x):
if x == "r":
return "p"
elif x == "s":
return "r"
else:
return "s"
def g(x):
if x == "r":
return r
elif x == "s":
return s
else:
return p
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = str(input())
m = n
a = 0
s... | [
"assignment.value.change",
"expression.operation.binary.change"
] | 625,541 | 625,539 | u865119809 | python |
p02820 | import sys
bbn=1000000007
#+++++
def main():
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
dd={'s':r, 'p':s, 'r':p}
point = lambda c : dd[c]
max_p=sum([point(c) for c in t])
same_k={'s':0, 'p':0, 'r':0}
tn=t
for i in range(k,n):
if tn[i]==tn[i-k] and tn[i]!='_':
... | import sys
bbn=1000000007
#+++++
def main():
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
dd={'s':r, 'p':s, 'r':p}
point = lambda c : dd[c]
max_p=sum([point(c) for c in t])
same_k={'s':0, 'p':0, 'r':0}
tn=list(t)
for i in range(k,n):
if tn[i]==tn[i-k] and tn[i]!='_... | [
"call.add",
"call.arguments.change"
] | 625,568 | 625,569 | u505830998 | python |
p02820 | N,K = list(map(int, input().split()))
R,S,P = list(map(int, input().split()))
T = list(map(str, input()))
res = 0
def change(hand):
if hand == 'r':
return 'p'
if hand == 's':
return 'r'
if hand == 'p':
return 's'
memo = []
for (i,t) in enumerate(T):
if i >= K:
if mem... | N,K = list(map(int, input().split()))
R,S,P = list(map(int, input().split()))
T = list(map(str, input()))
res = 0
def change(hand):
if hand == 'r':
return 'p'
if hand == 's':
return 'r'
if hand == 'p':
return 's'
memo = []
for (i,t) in enumerate(T):
if i > K-1:
if me... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one",
"call.arguments.change"
] | 625,576 | 625,577 | u545221414 | python |
p02820 | N,K = list(map(int, input().split()))
R,S,P = list(map(int, input().split()))
T = list(map(str, input()))
res = 0
def change(hand):
if hand == 'r':
return 'p'
if hand == 's':
return 'r'
if hand == 'p':
return 's'
memo = []
for (i,t) in enumerate(T):
if i > K:
if memo... | N,K = list(map(int, input().split()))
R,S,P = list(map(int, input().split()))
T = list(map(str, input()))
res = 0
def change(hand):
if hand == 'r':
return 'p'
if hand == 's':
return 'r'
if hand == 'p':
return 's'
memo = []
for (i,t) in enumerate(T):
if i > K-1:
if me... | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one",
"call.arguments.change"
] | 625,578 | 625,577 | u545221414 | python |
p02820 | N,K = list(map(int, input().split()))
R,S,P = list(map(int, input().split()))
T = list(map(str, input()))
res = 0
def change(hand):
if hand == 'r':
return 'p'
if hand == 's':
return 'r'
if hand == 'p':
return 's'
memo = []
for (i,t) in enumerate(T):
if i > K-1:
if me... | N,K = list(map(int, input().split()))
R,S,P = list(map(int, input().split()))
T = list(map(str, input()))
res = 0
def change(hand):
if hand == 'r':
return 'p'
if hand == 's':
return 'r'
if hand == 'p':
return 's'
memo = []
for (i,t) in enumerate(T):
if i > K-1:
if me... | [
"call.arguments.change"
] | 625,579 | 625,577 | u545221414 | python |
p02820 | N,K = list(map(int, input().split()))
R,S,P = list(map(int, input().split()))
T = list(map(str, input()))
res = 0
def change(hand):
if hand == 'r':
return 'p'
if hand == 's':
return 'r'
if hand == 'p':
return 's'
memo = []
for (i,t) in enumerate(T):
if i > K-1:
if me... | N,K = list(map(int, input().split()))
R,S,P = list(map(int, input().split()))
T = list(map(str, input()))
res = 0
def change(hand):
if hand == 'r':
return 'p'
if hand == 's':
return 'r'
if hand == 'p':
return 's'
memo = []
for (i,t) in enumerate(T):
if i > K-1:
if me... | [
"call.arguments.change"
] | 625,580 | 625,577 | u545221414 | python |
p02820 | N,K = list(map(int, input().split()))
R,S,P = list(map(int, input().split()))
T = list(map(str, input()))
res = 0
def change(hand):
if hand == 'r':
return 'p'
if hand == 's':
return 'r'
if hand == 'p':
return 's'
memo = []
for (i,t) in enumerate(T):
if i > K-1:
if me... | N,K = list(map(int, input().split()))
R,S,P = list(map(int, input().split()))
T = list(map(str, input()))
res = 0
def change(hand):
if hand == 'r':
return 'p'
if hand == 's':
return 'r'
if hand == 'p':
return 's'
memo = []
for (i,t) in enumerate(T):
if i > K-1:
if me... | [
"call.arguments.change"
] | 625,581 | 625,577 | u545221414 | python |
p02820 | n,k = map(int, input().split())
r,s,p = map(int, input().split())
S = input()
ans = 0
for i in range(k):
Ssep = S[i::k]
flg = False
for j in range(len(Ssep)):
if j >= 1 and Ssep[j] == Ssep[j-1] and not flg:
flg = True
continue
if Ssep[j] == "r":
ans += p
... | n,k = map(int, input().split())
r,s,p = map(int, input().split())
S = input()
ans = 0
for i in range(k):
Ssep = S[i::k]
flg = False
for j in range(len(Ssep)):
if j >= 1 and Ssep[j] == Ssep[j-1] and not flg:
flg = True
continue
if Ssep[j] == "r":
ans += p
... | [
"call.remove"
] | 625,586 | 625,587 | u905582793 | python |
p02820 | N, K = map(int, input().split(" "))
R, S, P = map(int, input().split(" "))
T = input()
score_by_hand = {"r": P, "s": R, "p": S}
result = 0
score = 0
for k in range(K):
column = T[k::K]
print(column)
before = None
for hand in column:
if hand == before:
before = None
else:
... | N, K = map(int, input().split(" "))
R, S, P = map(int, input().split(" "))
T = input()
score_by_hand = {"r": P, "s": R, "p": S}
result = 0
score = 0
for k in range(K):
column = T[k::K]
before = None
for hand in column:
if hand == before:
before = None
else:
score += ... | [
"call.remove"
] | 625,593 | 625,594 | u721569287 | python |
p02820 | n,k = map(int, input().split())
r, s, p = map(int, input().split())
scores = {"r":p,"s":r,"p":s}
T = input()
import numpy as np
subT = [""] * k
for i in range(n):
ind = i % k
subT[ind] += T[i]
ans = 0
for S in subT:
cnt = 0
prev = "0"
for i, s in enumerate(S):
if i == 0:
ans +=... | n,k = map(int, input().split())
r, s, p = map(int, input().split())
scores = {"r":p,"s":r,"p":s}
T = input()
import numpy as np
subT = [""] * k
for i in range(n):
ind = i % k
subT[ind] += T[i]
ans = 0
for S in subT:
cnt = 0
prev = "0"
for i, s in enumerate(S):
if i == 0:
ans +=... | [
"assignment.add"
] | 625,597 | 625,598 | u545368057 | python |
p02820 | from collections import deque
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = deque(list(s for s in input()))
best_hand = {'r': 'p', 's': 'r', 'p': 's'}
ban = []
cand = ''
while t:
cpu = t.popleft()
if len(ban) < k:
add_hand = best_hand[cpu]
else:
ban_hand = ban... | from collections import deque
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = deque(list(s for s in input()))
best_hand = {'r': 'p', 's': 'r', 'p': 's'}
ban = []
cand = ''
while t:
cpu = t.popleft()
if len(ban) < k:
add_hand = best_hand[cpu]
else:
ban_hand = ban... | [
"call.remove"
] | 625,599 | 625,600 | u089376182 | python |
p02820 | from collections import deque
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = deque(list(s for s in input()))
best_hand = {'r': 'p', 's': 'r', 'p': 's'}
ban = []
cand = ''
while t:
cpu = t.popleft()
if len(ban) < 2:
add_hand = best_hand[cpu]
else:
ban_hand = ban... | from collections import deque
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = deque(list(s for s in input()))
best_hand = {'r': 'p', 's': 'r', 'p': 's'}
ban = []
cand = ''
while t:
cpu = t.popleft()
if len(ban) < k:
add_hand = best_hand[cpu]
else:
ban_hand = ban... | [
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change"
] | 625,601 | 625,600 | u089376182 | python |
p02820 | num = input().split(' ')
point = input().split(' ')
point_int = [int(point[i]) for i in range(3)]
data = input()
count = 1
result = 0
judge = [0 for i in range(int(num[0]))]
for i in range(int(num[0])):
if(data[i] == 'r'):
if(i - int(num[1]) >= 0):
if(data[i - int(num[1])] == 'r'):
... | num = input().split(' ')
point = input().split(' ')
point_int = [int(point[i]) for i in range(3)]
data = input()
count = 1
result = 0
judge = [0 for i in range(int(num[0]))]
for i in range(int(num[0])):
if(data[i] == 'r'):
if(i - int(num[1]) >= 0):
if(data[i - int(num[1])] == 'r'):
... | [
"call.remove"
] | 625,608 | 625,609 | u378234362 | python |
p02820 | line1 = input().split(' ')
line2 = input().split(' ')
N = int(line1[0])
K = int(line1[1])
R = int(line2[0])
S = int(line2[1])
P = int(line2[2])
T = input()
score = 0
mem = list(range(K))
for i in range(N):
index = i % K
if (mem[index] != T[i:i+1]):
if (T[i:i+1] == 'r'):
score = score + R
elif (T[i:i... | line1 = input().split(' ')
line2 = input().split(' ')
N = int(line1[0])
K = int(line1[1])
R = int(line2[0])
S = int(line2[1])
P = int(line2[2])
T = input()
score = 0
mem = list(range(K))
for i in range(N):
index = i % K
if (mem[index] != T[i:i+1]):
if (T[i:i+1] == 'r'):
score = score + P
elif (T[i:i... | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 625,610 | 625,611 | u250639998 | python |
p02820 | # K回前と現在の問いが同じだったら0点
str1 = input().split(" ")
str2 = input().split(" ")
t = list(input())
n = int(str1[0])
k = int(str1[1])
r = int(str2[0])
s = int(str2[1])
p = int(str2[2])
result = 0
hoge = 0
for i in range(0,n):
if i < k:
continue
j = i-k
if t[i] == t[j]:
t[i] = "_"
print(t)
pres ... | # K回前と現在の問いが同じだったら0点
str1 = input().split(" ")
str2 = input().split(" ")
t = list(input())
n = int(str1[0])
k = int(str1[1])
r = int(str2[0])
s = int(str2[1])
p = int(str2[2])
result = 0
hoge = 0
for i in range(0,n):
if i < k:
continue
j = i-k
if t[i] == t[j]:
t[i] = "_"
pres = p * t.c... | [
"call.remove"
] | 625,624 | 625,625 | u990148524 | python |
p02820 | N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
ans = 0
d = {'p': S, 's': R, 'r': P}
flag = [0] * K
for n in range(N):
q = n % K
ans += d.get(T[n])
if n >= K and T[n] == T[n - K] and n < N - K:
flag[q] += 1
elif (flag[q] != 0 and T[n] != T[n - K]) or n >= N - K:
... | N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
ans = 0
d = {'p': S, 's': R, 'r': P}
flag = [0] * K
for n in range(N):
q = n % K
ans += d.get(T[n])
if n >= K:
if T[n] == T[n - K] and n < N - K:
flag[q] += 1
elif (flag[q] != 0 and T[n] != T[n - K])... | [
"control_flow.branch.if.condition.change"
] | 625,628 | 625,629 | u908763441 | python |
p02820 | n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()
t1 = t.replace("r","P")
t2 = t1.replace("s","R")
t3 = t2.replace("p","S")
# print(t3)
T = list(t3)
# print(T)
minus = 0
ls = ["R","S","P"]
for i in range(k,n):
if i < n-k:
tmp = T[i]
before = T[i-k]
after = T[i+k]
... | n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()
t1 = t.replace("r","P")
t2 = t1.replace("s","R")
t3 = t2.replace("p","S")
# print(t3)
T = list(t3)
# print(T)
minus = 0
ls = ["R","S","P"]
for i in range(k,n):
if i < n-k:
tmp = T[i]
before = T[i-k]
after = T[i+k]
... | [
"assignment.variable.change"
] | 625,637 | 625,638 | u255673886 | python |
p02820 | N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
score = np.array([0, R, S, P], dtype=int)
M = (1 + (N-1)//K)
addi = M * K - N
t = np.array([{'n':0, 's':1, 'p':2, 'r':3}[i] for i in T+'n'*addi], dtype=int)
t = t.reshape(M,K).T
for i in range(K):
for j in range(M):
if j!=0 ... | N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
import numpy as np
score = np.array([0, R, S, P], dtype=int)
M = (1 + (N-1)//K)
addi = M * K - N
t = np.array([{'n':0, 's':1, 'p':2, 'r':3}[i] for i in T+'n'*addi], dtype=int)
t = t.reshape(M,K).T
for i in range(K):
for j in range(... | [] | 625,674 | 625,675 | u663093503 | python |
p02820 | N,K = map(int,input().split())
R,S,P = map(int,input().split())
dicta = {'r':P,'s':R,'p':S}
T = input()
count = 0
for i in range(N):
if i >= K-1:
if T[i-K] == T[i]:
T = T[:i] + 'z' + T[i+1:]
else:
count += dicta[T[i]]
else:
count += dicta[T[i]]
print... | N,K = map(int,input().split())
R,S,P = map(int,input().split())
dicta = {'r':P,'s':R,'p':S}
T = input()
count = 0
for i in range(N):
if i >= K:
if T[i-K] == T[i]:
T = T[:i] + 'z' + T[i+1:]
else:
count += dicta[T[i]]
else:
count += dicta[T[i]]
print(... | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 625,676 | 625,677 | u540761833 | python |
p02820 | N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
ans = 0
buf = ""
for i in range(N):
t = T[i]
if t == "r":
if i >= K:
if buf[i - K] == "p":
buf = buf + " "
continue
ans += P
buf += buf + "p"
elif t == "p":
... | N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
ans = 0
buf = ""
for i in range(N):
t = T[i]
if t == "r":
if i >= K:
if buf[i - K] == "p":
buf = buf + " "
continue
ans += P
buf = buf + "p"
elif t == "p":
... | [
"assignment.value.change"
] | 625,694 | 625,695 | u168333670 | python |
p02821 | #!python3
from itertools import accumulate
def my_bisect(a, x, key, lo=0, hi=None, side="left"):
if hi is None:
hi = len(a)
lov = key(a[lo])
hiv = key(a[hi])
if side == "left":
while lo < hi:
mid = (lo + hi) // 2
miv = key(a[mid])
if miv < val: lo... | #!python3
from itertools import accumulate
def my_bisect(a, x, key, lo=0, hi=None, side="left"):
if hi is None:
hi = len(a)
lov = key(a[lo])
hiv = key(a[hi])
if side == "left":
while lo < hi:
mid = (lo + hi) // 2
miv = key(a[mid])
if miv < val: lo... | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 625,725 | 625,726 | u348805958 | python |
p02821 | from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
d = [0] * (A[0] * 2 + 1)
for i in range(N):
d[A[i]] += 1
d = list(accumulate(d[::-1]))[::-1]
S = list(accumulate([0] + A))
left = 0
right = A[0] * 2 + 1
while right - left > 1:
mid = (le... | from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
d = [0] * (A[0] * 2 + 1)
for i in range(N):
d[A[i]] += 1
d = list(accumulate(d[::-1]))[::-1]
S = list(accumulate([0] + A))
left = 0
right = A[0] * 2 + 1
while right - left > 1:
mid = (le... | [
"literal.number.integer.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 625,753 | 625,754 | u374531474 | python |
p02821 | from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
d = [0] * (A[0] * 2 + 1)
for i in range(N):
d[A[i]] += 1
d = list(accumulate(d[::-1]))[::-1]
S = list(accumulate([0] + A))
left = 0
right = A[0] * 2 + 1
while right - left > 1:
mid = (le... | from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
d = [0] * (A[0] * 2 + 1)
for i in range(N):
d[A[i]] += 1
d = list(accumulate(d[::-1]))[::-1]
S = list(accumulate([0] + A))
left = 0
right = A[0] * 2 + 1
while right - left > 1:
mid = (le... | [
"call.remove",
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 625,755 | 625,754 | u374531474 | python |
p02821 | from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
d = [0] * (A[0] * 2 + 1)
for i in range(N):
d[A[i]] += 1
d = list(accumulate(d[::-1]))[::-1]
S = list(accumulate([0] + A))
left = 0
right = A[0] * 2 + 1
while right - left > 1:
mid = (le... | from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
d = [0] * (A[0] * 2 + 1)
for i in range(N):
d[A[i]] += 1
d = list(accumulate(d[::-1]))[::-1]
S = list(accumulate([0] + A))
left = 0
right = A[0] * 2 + 1
while right - left > 1:
mid = (le... | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 625,756 | 625,754 | u374531474 | python |
p02821 | import sys
import bisect
import itertools
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n, m = list(map(int, readline().split()))
a = list(map(int, readline().split()))
a.sort()
cor_v = a[0] * 2
inc_v = a[-1] * 2 + 1
while - cor_v + inc_v > 1:
bin_v = (cor... | import sys
import bisect
import itertools
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n, m = list(map(int, readline().split()))
a = list(map(int, readline().split()))
a.sort()
cor_v = a[0] * 2
inc_v = a[-1] * 2 + 1
while - cor_v + inc_v > 1:
bin_v = (cor... | [
"call.remove"
] | 625,765 | 625,766 | u753803401 | python |
p02821 | def run(N, M, A):
A = sorted(A, reverse=True)
right = A[0] * 2
left = 0
while left < right:
X = (left + right) // 2
# 左手の相手がaで、満足度がX以上となる組合せの数
cnt = 0
for a in A:
cnt += search(A, X - a)
if cnt >= M:
res = X
left = X + 1
... | def run(N, M, A):
A = sorted(A, reverse=True)
right = A[0] * 2
left = 0
while left <= right:
X = (left + right) // 2
# 左手の相手がaで、満足度がX以上となる組合せの数
cnt = 0
for a in A:
cnt += search(A, X - a)
if cnt >= M:
res = X
left = X + 1
... | [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 625,907 | 625,908 | u633105820 | python |
p02821 | N, M = map(int, input().split())
a = [10**18] + sorted(map(int, input().split()), reverse=True)
def solve(x):
count = 0
j = N
for i in range(1, N+1):
while a[i] + a[j] < x:
j -= 1
count += j
return count
left, right = 0, 10**18
while left < right - 1:
mid = (left + right) // ... | N, M = map(int, input().split())
a = [10**18] + sorted(map(int, input().split()), reverse=True)
def solve(x):
count = 0
j = N
for i in range(1, N+1):
while a[i] + a[j] < x:
j -= 1
count += j
return count
left, right = 0, 10**18
while left < right - 1:
mid = (left + right) // ... | [] | 625,936 | 625,937 | u079022693 | python |
p02821 | N,M = map(int,input().split())
*A, = map(int,input().split())
A.sort(reverse=True)
def count(i,B):
B = B - A[i]
l = -1
r = N
while l+1<r:
j = (l+r)//2
if A[j] >= B:
l = j
else:
r = j
return r
l = 0
r = 10**5*3
while l+1<r:
i = (l+r)//2
S = 0... | N,M = map(int,input().split())
*A, = map(int,input().split())
A.sort(reverse=True)
def count(i,B):
B = B - A[i]
l = -1
r = N
while l+1<r:
j = (l+r)//2
if A[j] >= B:
l = j
else:
r = j
return r
l = 0
r = 10**5*3
while l+1<r:
i = (l+r)//2
S = 0... | [
"assignment.variable.change",
"identifier.change",
"assignment.value.change",
"call.arguments.change"
] | 625,994 | 625,995 | u391731808 | python |
p02821 | n,m=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr,reverse=True)
acum=[arr[0]]
for i in range(1,n):
acum.append(acum[-1]+arr[i])
print(acum)
l=0
r=2*10**5+1
while r-l!=1:
mid=(l+r)//2
tmp=0
cnt=0
pos=n-1
for i in range(n):
while pos!=-1:
if arr[i]+arr[pos]>=mid:
... | n,m=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr,reverse=True)
acum=[arr[0]]
for i in range(1,n):
acum.append(acum[-1]+arr[i])
l=0
r=2*10**5+1
while r-l!=1:
mid=(l+r)//2
tmp=0
cnt=0
pos=n-1
for i in range(n):
while pos!=-1:
if arr[i]+arr[pos]>=mid:
cnt+=pos+1
... | [
"call.remove"
] | 626,041 | 626,042 | u163320134 | python |
p02821 | import sys
input = sys.stdin.readline
import bisect
from itertools import accumulate
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
left = -1
right = 1 + 2 * 10 ** 5
def shake(x):
cnt = 0
for i in A:
cnt += N - bisect.bisect_left(A, x - i)
if cnt >= M:
... | import sys
input = sys.stdin.readline
import bisect
from itertools import accumulate
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
left = -1
right = 1 + 2 * 10 ** 5
def shake(x):
cnt = 0
for i in A:
cnt += N - bisect.bisect_left(A, x - i)
if cnt >= M:
... | [
"expression.operation.binary.remove"
] | 626,047 | 626,048 | u609061751 | python |
p02821 | def main():
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
def helper(x):
p = len(A) - 1
t = 0
for a in A:
while p >= 0 and A[p] + a < x:
p -= 1
t += p + 1
return t
l, r = 0, A[0] * 2 + 1
... | def main():
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
def helper(x):
p = len(A) - 1
t = 0
for a in A:
while p >= 0 and A[p] + a < x:
p -= 1
t += p + 1
return t
l, r = 0, A[0] * 2 + 1
... | [
"call.remove"
] | 626,061 | 626,062 | u858742833 | python |
p02821 | def main():
import bisect
import sys
from itertools import accumulate
input = sys.stdin.readline
def hsnum(x):
num = 0
for i in a:
y = x-i
num += n-bisect.bisect_left(a,y)
return num
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
suma = [0]+list(ac... | def main():
import bisect
import sys
from itertools import accumulate
input = sys.stdin.readline
def hsnum(x):
num = 0
for i in a:
y = x-i
num += n-bisect.bisect_left(a,y)
return num
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
suma = [0]+list(ac... | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operator.change"
] | 626,137 | 626,138 | u905582793 | python |
p02821 | def main():
import bisect
import sys
from itertools import accumulate
input = sys.stdin.readline
def hsnum(x):
num = 0
for i in a:
y = x-i
num += n-bisect.bisect_left(a,y)
return num
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
suma = [0]+list(ac... | def main():
import bisect
import sys
from itertools import accumulate
input = sys.stdin.readline
def hsnum(x):
num = 0
for i in a:
y = x-i
num += n-bisect.bisect_left(a,y)
return num
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
suma = [0]+list(ac... | [
"expression.operator.change"
] | 626,139 | 626,138 | u905582793 | python |
p02821 | from bisect import bisect_left
def calc(N, A, cumsum, x):
num = N ** 2
total = cumsum[N] * N * 2
for a in A:
idx = bisect_left(A, x - a)
num -= idx
total -= cumsum[idx] + idx * a
return num, total
def main():
N, M = map(int, input().split())
A = list(map(int, input().... | from bisect import bisect_left
def calc(N, A, cumsum, x):
num = N ** 2
total = cumsum[N] * N * 2
for a in A:
idx = bisect_left(A, x - a)
num -= idx
total -= cumsum[idx] + idx * a
return num, total
def main():
N, M = map(int, input().split())
A = list(map(int, input().... | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 626,154 | 626,153 | u155024797 | python |
p02821 | from bisect import bisect_left
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = list(reversed(a))
rs = [0] * n
rs[0] = a[0]
for i, x in enumerate(a[1:]):
rs[i+1] = rs[i] + x
L = a[0] * 2
H = a[-1] * 2
while H - L > 1:
M = (L + H) // 2
count = 0
for x in ... | from bisect import bisect_left
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = list(reversed(a))
rs = [0] * n
rs[0] = a[0]
for i, x in enumerate(a[1:]):
rs[i+1] = rs[i] + x
L = a[-1] * 2
H = a[0] * 2
while H - L > 1:
M = (L + H) // 2
count = 0
for x in ... | [
"assignment.remove",
"assignment.add"
] | 626,172 | 626,173 | u824237520 | python |
p02821 | def ints():
return [int(x) for x in input().split()]
def ii():
return int(input())
N, M = ints()
A = ints()
A.sort()
def combinations(x):
s = 0
i = 0
j = N-1
while j>=0:
while i<N and A[i]+A[j]<x:
i += 1
s += N-i
j -= 1
return s
def koufukudo(x):
s = 0
si = 0
j = 0
i = N... | def ints():
return [int(x) for x in input().split()]
def ii():
return int(input())
N, M = ints()
A = ints()
A.sort()
def combinations(x):
s = 0
i = 0
j = N-1
while j>=0:
while i<N and A[i]+A[j]<x:
i += 1
s += N-i
j -= 1
return s
def koufukudo(x):
s = 0
si = 0
j = 0
i = N... | [
"call.remove"
] | 626,248 | 626,249 | u967136506 | python |
p02820 | n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
d={'r':p,'s':r,'p':s}
d_={'r':'p','s':'r','p':'s'}
s=0
for i in range(k):
a=0
z='0'
t_=t[i::k]
for a in range(len(t_)):
if a==0:
s+=d[t_[a]]
z=d_[t_[a]]
a+=1
else:
if z==d_[t_[a]]:
z=t_[a]
a+=1
... | n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
d={'r':p,'s':r,'p':s}
d_={'r':'p','s':'r','p':'s'}
s=0
for i in range(k):
a=0
z='0'
t_=t[i::k]
for a in range(len(t_)):
if a==0:
s+=d[t_[a]]
z=d_[t_[a]]
a+=1
else:
if z==d_[t_[a]]:
z='0'
a+=1
... | [] | 626,317 | 626,318 | u428199834 | python |
p02820 | N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=list(input())
ans=0
dic={'r':'p','s':'r','p':'s'}
score={'r':R,'s':S,'p':P}
past=[]
for i in range(len(T)):
if i>=K:
if dic[T[i]]==past[i-K]:
past.append(T[i])
continue
else:
ans+=score[dic[T[i]]]
... | N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=list(input())
ans=0
dic={'r':'p','s':'r','p':'s'}
score={'r':R,'s':S,'p':P}
past=[]
for i in range(len(T)):
if i>=K:
if dic[T[i]]==past[i-K]:
past.append('0')
continue
else:
ans+=score[dic[T[i]]]
... | [
"call.arguments.change"
] | 626,319 | 626,320 | u229518917 | python |
p02820 | N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
dp = [[0]*3 for _ in range(N+1)]
for i in range(1, N+1):
if i <= K:
dp[i][0] = int(T[i-1]=='s') * R
dp[i][1] = int(T[i-1]=='p') * P
dp[i][2] = int(T[i-1]=='r') * P
else:
dp[i][0] = max(dp[i-K][1], d... | N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
dp = [[0]*3 for _ in range(N+1)]
for i in range(1, N+1):
if i <= K:
dp[i][0] = int(T[i-1]=='s') * R
dp[i][1] = int(T[i-1]=='p') * S
dp[i][2] = int(T[i-1]=='r') * P
else:
dp[i][0] = max(dp[i-K][1], d... | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 626,321 | 626,322 | u439063038 | python |
p02820 | N, K = [int(x) for x in input().split()]
r, s, p = [int(x) for x in input().split()]
win_point = {
'r': r,
's': s,
'p': p,
}
next_hands = {
'r': ['s', 'p'],
's': ['r', 'p'],
'p': ['r', 's'],
}
enemy_hands = input()
def can_win(enemy_hand, my_hands):
# 勝てる場合にはTrueと勝てる手を教えてくれる
if enem... | N, K = [int(x) for x in input().split()]
r, s, p = [int(x) for x in input().split()]
win_point = {
'r': r,
's': s,
'p': p,
}
next_hands = {
'r': ['s', 'p'],
's': ['r', 'p'],
'p': ['r', 's'],
}
enemy_hands = input()
def can_win(enemy_hand, my_hands):
# 勝てる場合にはTrueと勝てる手を教えてくれる
if enem... | [
"assignment.variable.change",
"identifier.change"
] | 626,328 | 626,329 | u891516200 | python |
p02820 | n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
t2 = [[] for _ in range(k)]
score = [0]*n
for i,c in enumerate(t):
t2[i%k].append(c)
score = {'r':p,'s':r,'p':s}
total = 0
for t3 in t2:
if len(t3)==0: continue
if len(t3)==1:
total += score[c]
continue
for i in range(len(t3)-1):
... | n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
t2 = [[] for _ in range(k)]
score = [0]*n
for i,c in enumerate(t):
t2[i%k].append(c)
score = {'r':p,'s':r,'p':s}
total = 0
for t3 in t2:
if len(t3)==0: continue
if len(t3)==1:
total += score[t3[0]]
continue
for i in range(len(t3)-1... | [
"identifier.change",
"variable_access.subscript.index.change"
] | 626,330 | 626,331 | u221061152 | python |
p02820 | # 初期入力
N,K = (int(x) for x in input().split(" "))
R,S,P = (int(x) for x in input().split(" "))
ten_janken_dic ={"R":R,"S":S,"P":P} #じゃんけんの役ごとの点を辞書
ten_janken_sort =sorted(ten_janken_dic.items(),key=lambda x: x[1])
T =input()
#合計点と高橋君が出す手を同時進行
sum_janken = 0 # 合計点
takahasi = [] # 高橋君が出す手,K回前の手も出せる=すべて勝つとした場合
for i in T... | # 初期入力
N,K = (int(x) for x in input().split(" "))
R,S,P = (int(x) for x in input().split(" "))
ten_janken_dic ={"R":R,"S":S,"P":P} #じゃんけんの役ごとの点を辞書
ten_janken_sort =sorted(ten_janken_dic.items(),key=lambda x: x[1])
T =input()
#合計点と高橋君が出す手を同時進行
sum_janken = 0 # 合計点
takahasi = [] # 高橋君が出す手,K回前の手も出せる=すべて勝つとした場合
for i in T... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 626,336 | 626,337 | u116038906 | python |
p02820 | n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
did = "-" * k
ans = 0
for i in t:
if i == "r":
if did[-k] == "p":
did += "r"
else:
did += "p"
ans += p
elif i == "s":
if did[-k] == "r":
did += "s"
el... | n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
did = "-" * k
ans = 0
for i in t:
if i == "r":
if did[-k] == "p":
did += "-"
else:
did += "p"
ans += p
elif i == "s":
if did[-k] == "r":
did += "-"
el... | [
"literal.string.change"
] | 626,344 | 626,345 | u761989513 | python |
p02820 | n,k=map(int,input().split())
r,s,p = map(int,input().split())
T=list(input())
a=[[] for i in range(k)]
for i in range(n):
a[i%k].append(T[i])
flg=0
score=0
for j in range(k):
b=a[j]
for l in range(len(b)):
if l==0:
if b[l]=='r':
score+=p
elif b[l]=='s':
... | n,k=map(int,input().split())
r,s,p = map(int,input().split())
T=list(input())
a=[[] for i in range(k)]
for i in range(n):
a[i%k].append(T[i])
score=0
for j in range(k):
b=a[j]
flg=0
for l in range(len(b)):
if l==0:
if b[l]=='r':
score+=p
elif b[l]=='... | [
"assignment.remove",
"assignment.add"
] | 626,346 | 626,347 | u485319545 | python |
p02820 | def f(c):
"""
入力に対する勝ち手を出力
"""
if c=="r":
return "p"
elif c=="s":
return "r"
else:
return "s"
def main():
"""
まずは全て勝つ組み合わせを作って、合計ポイントを求める。
iを0からN-Kまで変化させ、T(i)=T(k+i)となる時、
T(k+i)をT(i)、T(i+2K)と異なる手に変更する。
※T(i)を変更すると、T(i)=T(i+k)=T(i+2K)=...=と連続した時に、
... | def f(c):
"""
入力に対する勝ち手を出力
"""
if c=="r":
return "p"
elif c=="s":
return "r"
else:
return "s"
def main():
"""
まずは全て勝つ組み合わせを作って、合計ポイントを求める。
iを0からN-Kまで変化させ、T(i)=T(k+i)となる時、
T(k+i)をT(i)、T(i+2K)と異なる手に変更する。
※T(i)を変更すると、T(i)=T(i+k)=T(i+2K)=...=と連続した時に、
... | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 626,352 | 626,353 | u613920660 | python |
p02820 | n.k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
for i in range(n-k):
if t[k+i] == t[i]:
t[k+i] = 0
xs = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x) | n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
for i in range(n-k):
if t[k+i] == t[i]:
t[k+i] = 0
x = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x) | [
"misc.typo",
"assignment.variable.change",
"identifier.change"
] | 626,354 | 626,355 | u175590965 | python |
p02820 | n.k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
for i in range(n-k):
if t[k+a] == t[a]:
t[k+a] = 0
xs = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x) | n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
for i in range(n-k):
if t[k+i] == t[i]:
t[k+i] = 0
x = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x) | [
"misc.typo",
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.change"
] | 626,356 | 626,355 | u175590965 | python |
p02820 | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n,k=map(int, input().split())
r,s,p=map(int, input().split())
t=input()
def kachip(te):
if te=='r':
return p
elif te=='s':
return r
else:
return s
def kachite(te):
... | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n,k=map(int, input().split())
r,s,p=map(int, input().split())
t=input()
def kachip(te):
if te=='r':
return p
elif te=='s':
return r
else:
return s
def kachite(te):
... | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add"
] | 626,377 | 626,378 | u057964173 | python |
p02821 | N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
OK=0
NG=max(A)*2+1
import bisect
while NG-OK>2: #N*N個の中で,mid以上の個数がM個以上あればOK
mid=(OK+NG)//2
score=0
for a in A:
x=bisect.bisect_left(A,mid-a)
score+=N-x
if score>=M:
OK=mid
break
e... | N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
OK=0
NG=max(A)*2+1
import bisect
while NG-OK>1: #N*N個の中で,mid以上の個数がM個以上あればOK
mid=(OK+NG)//2
score=0
for a in A:
x=bisect.bisect_left(A,mid-a)
score+=N-x
if score>=M:
OK=mid
break
e... | [
"literal.number.integer.change",
"control_flow.loop.condition.change"
] | 626,417 | 626,418 | u695811449 | python |
p02822 | from sys import stdin, setrecursionlimit
from collections import deque
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
MOD = 1000000007
N = int(input())
m = map(int, stdin.buffer.read().split())
AB = zip(m, m)
G = [[] for _ in range(N)]
for a, b in AB:
G[a - 1].append(... | from sys import stdin, setrecursionlimit
from collections import deque
setrecursionlimit(10 ** 9)
INF = 1 << 60
def input():
return stdin.readline().strip()
MOD = 1000000007
N = int(stdin.buffer.readline())
m = map(int, stdin.buffer.read().split())
AB = zip(m, m)
G = [[] for _ in range(N)]
for a, b in AB:
... | [
"assignment.value.change",
"call.arguments.change"
] | 626,456 | 626,457 | u968166680 | python |
p02823 | N,A,B = map(int,input().split())
if abs(A-B)%2 == 1:
print(min(A-1,N-B))+1+(B-A-1)//2
else:
print(abs(A-B)//2) | N,A,B = map(int,input().split())
if abs(A-B)%2 == 1:
print(min(A-1,N-B)+1+(B-A-1)//2)
else:
print(abs(A-B)//2) | [
"call.arguments.change"
] | 626,598 | 626,599 | u514118270 | python |
p02823 | n,a,b=map(int,input().split())
if (b-a)%2==0:
print((b-a)//2)
else:
print(min((b+a-1)//2),(2*n-a-b+1)//2) | n,a,b=map(int,input().split())
if (b-a)%2==0:
print((b-a)//2)
else:
print(min((b+a-1)//2,(2*n-a-b+1)//2)) | [
"call.arguments.change"
] | 626,602 | 626,603 | u474925961 | python |
p02823 | N, *AB = [int(x) for x in input().split()]
A, B = sorted(AB)
print(A, B)
if (B - A) % 2 == 0:
ans = (B - A) // 2
else:
ans = (B - A + 2 * min(N - B, A - 1) + 1) // 2
print(ans) | N, *AB = [int(x) for x in input().split()]
A, B = sorted(AB)
if (B - A) % 2 == 0:
ans = (B - A) // 2
else:
ans = (B - A + 2 * min(N - B, A - 1) + 1) // 2
print(ans) | [
"call.remove"
] | 626,610 | 626,611 | u197955752 | python |
p02823 | n,a,b = map(int,input().split())
if (b-a)%2 == 0:
print((b-a)//2)
else:
left = a+((b-a)-1)//2
right = (n-b+1)+(n-a+(n-b+1))//2
print(min(right,left)) | n,a,b = map(int,input().split())
if (b-a)%2 == 0:
print((b-a)//2)
else:
left = a+((b-a)-1)//2
right = (n-b+1)+(n-(a+n-b+1))//2
print(min(right,left)) | [] | 626,628 | 626,629 | u987164499 | python |
p02823 | n,a,b=map(int,input().split())
if (b-a)%2==0:
print((b-a)//2)
else:
print(min(a+(b-a)//2,b+(b-a)//2))
| n,a,b=map(int,input().split())
if (b-a)%2==0:
print((b-a)//2)
else:
print(min(a+(b-a)//2,(n-b+1)+(b-a)//2))
| [] | 626,642 | 626,643 | u366886346 | python |
p02823 | N,A,B=map(int,input().split())
if (B-A)%2==0:
ans=(B-A)//2
else:
ans=min(A,N-B)+(B-A)//2
print(ans)
| N,A,B=map(int,input().split())
if (B-A)%2==0:
ans=(B-A)//2
else:
ans=min(A-1,N-B)+(B-A+1)//2
print(ans)
| [
"assignment.change"
] | 626,646 | 626,647 | u391819434 | python |
p02823 | n,a,b=map(int,input().split())
if (b-a-1)%2==1:
print((b-a-1)//2+1)
else:
print(min(a-1,n-b)+1+(b-a-1)//2+1) | n,a,b=map(int,input().split())
if (b-a-1)%2==1:
print((b-a-1)//2+1)
else:
print(min(a-1,n-b)+1+(b-a-2)//2+1) | [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 626,650 | 626,651 | u453642820 | python |
p02823 | n,a,b=map(int,input().split())
if (b-a)%2 == 0:
print((b-a)//2)
else:
if n-b >= a-1:
ans = a-1
ans += (b-ans-1)//2
print(ans+1)
else:
ans = n-b
ans += (b-(a+n-b))//2
print(ans+1) | n,a,b=map(int,input().split())
if (b-a)%2 == 0:
print((b-a)//2)
else:
if n-b >= a-1:
ans = a-1
ans += (b-a-1)//2
print(ans+1)
else:
ans = n-b
ans += (b-a-1)//2
print(ans+1) | [
"identifier.change",
"expression.operation.binary.change",
"expression.operation.binary.remove",
"identifier.replace.remove",
"literal.replace.add"
] | 626,674 | 626,675 | u703214333 | python |
p02823 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy imp... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy imp... | [
"call.arguments.change",
"call.arguments.add"
] | 626,714 | 626,715 | u279460955 | python |
p02823 | N,A,B = map(int,input().split())
A,B = min(A,B),max(A,B)
if abs(A-B)%2==0:
print(abs(A-B)//2)
else:
print(min(A,N-1-B)+abs((A-B)-1)//2) | N,A,B = map(int,input().split())
A,B = min(A,B),max(A,B)
if abs(A-B)%2==0:
print(abs(A-B)//2)
else:
print(min(A-1,N-B)+abs((A-B)-1)//2)
| [
"call.arguments.change",
"call.arguments.add"
] | 626,740 | 626,741 | u364862909 | python |
p02823 | N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
print((B - A) // 2)
else:
#A->1.1, B->B-A
a = A + (B-A-1)//2
#A->A+N-B+1, B->N.N
b = N-B+1 + (N - A + B - 1)//2
print(min(a,b)) | N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
print((B - A) // 2)
else:
#A->1.1, B->B-A
a = A + (B-A-1)//2
#A->A+N-B+1, B->N.N
b = N-B+1 + (- A + B - 1)//2
print(min(a,b))
| [] | 626,746 | 626,747 | u779728630 | python |
p02823 | N, A, B = map(int, input().split())
C=B-A
D=min(A-1,N-B)+1 + (B - A - 1)/2
if C%2==1:
print (D)
else:
print(C)
| N, A, B = map(int, input().split())
C=B-A
D=min(A-1,N-B)+1 + (B - A - 1)//2
if C%2==1:
print (D)
else:
print(C//2)
| [
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 626,750 | 626,749 | u478417863 | python |
p02823 | n,a,b = map(int,input().split())
ans = (b-a)//2
if (b-a)%2!=0 and (a-1)<(n-b):
ans += a
elif (b-a)%2!=0 and (a-1)>(n-b):
ans += n-b+1
print(ans) | n,a,b = map(int,input().split())
ans = (b-a)//2
if (b-a)%2!=0 and (a-1)<(n-b):
ans += a
elif (b-a)%2!=0 and (a-1)>=(n-b):
ans += n-b+1
print(ans) | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 626,753 | 626,754 | u810288681 | python |
p02823 | N,A,B=map(int,input().split())
if (A-B)%2==0:
print((A-B)/2)
exit()
print(min((A+B-1)//2,(N-B+N-A+1)//2)) | N,A,B=map(int,input().split())
if (A-B)%2==0:
print((B-A)//2)
exit()
print(min((A+B-1)//2,(N-B+N-A+1)//2)) | [
"expression.operation.binary.remove",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 626,757 | 626,756 | u093861603 | python |
p02823 | n, a, b = map(int, input().split())
if (b - a) % 2:
print((b - a) // 2)
else:
print(min(a - 1, n - b,) + 1 + (b - a - 1) // 2)
| n, a, b = map(int, input().split())
if (b - a) % 2 == 0:
print((b - a) // 2)
else:
print(min(a - 1, n - b,) + 1 + (b - a - 1) // 2)
| [
"control_flow.branch.if.condition.change"
] | 626,758 | 626,759 | u945200821 | python |
p02823 | n, a, b = map(int, input().split())
if (b - a) % 2:
print((b - a) % 2)
else:
print(min(a - 1, n - b,) + 1 + (b - a - 1) // 2) | n, a, b = map(int, input().split())
if (b - a) % 2 == 0:
print((b - a) // 2)
else:
print(min(a - 1, n - b,) + 1 + (b - a - 1) // 2)
| [
"control_flow.branch.if.condition.change",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 626,760 | 626,759 | u945200821 | python |
p02823 | #dpでできないかな?
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappus... | #dpでできないかな?
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappus... | [
"call.add"
] | 626,771 | 626,772 | u029000441 | python |
p02823 | N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
print((B - A) // 2)
else:
print(min(A + (B - A - 1) % 2, N - B + 1 + (B - A - 1) % 2))
| N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
print((B - A) // 2)
else:
print(min(A + (B - A - 1) // 2, N - B + 1 + (B - A - 1) // 2))
| [
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 626,790 | 626,791 | u673361376 | python |
p02823 | # N = int(input())
N, A, B = [int(_) for _ in input().split()]
if (B - A) % 2 == 0:
print((B-A) // 2)
else:
print(min(N - B + 1 + N - (A + N-B+1) // 2, A + (B - A - 1)//2))
| # N = int(input())
N, A, B = [int(_) for _ in input().split()]
if (B - A) % 2 == 0:
print((B-A) // 2)
else:
print(min(N - B + 1 + (N - (A + N-B+1)) // 2, A + (B - A - 1)//2))
| [
"call.arguments.change"
] | 626,802 | 626,803 | u504562455 | python |
p02823 | n,a,b = map(int,input().split())
if (b-a)%2==0:
print((b-a)//2)
else:
m = min(b-1,n-a)
M = min(a-1,n-b)+(b-a-1)//2
print(min(m,M)) | n,a,b = map(int,input().split())
if (b-a)%2==0:
print((b-a)//2)
else:
m = min(b-1,n-a)
M = min(a-1,n-b)+(b-a-1)//2+1
print(min(m,M)) | [
"assignment.change"
] | 626,820 | 626,821 | u785578220 | python |
p02823 | n,a,b=map(int, input().split())
if (b-a)%2==0:
print((b-a)//2)
else:
print(min(a+(b-a-1)//2, b+1+(b-a-1)//2)) | n,a,b=map(int, input().split())
if (b-a)%2==0:
print((b-a)//2)
else:
print(min(a+(b-a-1)//2, n-b+1+(b-a-1)//2)) | [
"expression.operation.binary.add"
] | 626,839 | 626,840 | u748311048 | python |
p02823 | N,a,b = map(int,input().split())
if (b-a)%2 ==0:
ams = (b-a)//2
else:
ans = min(a-1,N-b)+1 + (b-a-1)//2
print(ans) | N,a,b = map(int,input().split())
if (b-a)%2 ==0:
ans = (b-a)//2
else:
ans = min(a-1,N-b)+1 + (b-a-1)//2
print(ans) | [
"assignment.variable.change",
"identifier.change"
] | 626,843 | 626,844 | u821251381 | python |
p02823 | # row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()
def resolve():
import sys
input = sys.stdin.readline
n, a, b = [int(x) for x in input().rstrip().split(" ")]
if a > n - b:
tmp = a
a = n - b
b = n - tmp
a = a - 1
... | # row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()
def resolve():
import sys
input = sys.stdin.readline
n, a, b = [int(x) for x in input().rstrip().split(" ")]
if a > n - b + 1:
tmp = a
a = n - b
b = n - tmp
else:
... | [
"control_flow.branch.if.condition.change"
] | 626,849 | 626,850 | u138083942 | python |
p02823 | '''
Created on 2020/09/03
@author: harurun
'''
def main():
import sys
pin=sys.stdin.readline
pout=sys.stdout.write
perr=sys.stderr.write
N,A,B=map(int,pin().split())
if (B-A)%2==0:
print((B-A)//2)
return
if A<N-B:
print(A+(B-A-1)//2)
else:
print(N-B+(B-A-1)//2)
return
main() | '''
Created on 2020/09/03
@author: harurun
'''
def main():
import sys
pin=sys.stdin.readline
pout=sys.stdout.write
perr=sys.stderr.write
N,A,B=map(int,pin().split())
if (B-A)%2==0:
print((B-A)//2)
return
if A<N-B+1:
print(A+(B-A-1)//2)
else:
print(N-B+1+(B-A-1)//2)
return
main() | [
"control_flow.branch.if.condition.change"
] | 626,867 | 626,868 | u519339498 | python |
p02823 | def main():
n, a, b = map(int, input().split())
if (b - a) % 2 == 0:
ans = (b - a) // 2
else:
ans = min(n - a, b - 1) + 1 + (b - a - 1) // 2
print(ans)
if __name__ == "__main__":
main()
| def main():
n, a, b = map(int, input().split())
if (b - a) % 2 == 0:
ans = (b - a) // 2
else:
ans = min(n - b, a - 1) + 1 + (b - a - 1) // 2
print(ans)
if __name__ == "__main__":
main()
| [
"call.arguments.change",
"call.arguments.add"
] | 626,873 | 626,874 | u359358631 | python |
p02823 | N, A, B = map(int, input().split())
if A % 2 == B % 2:
print(abs(A - B) // 2)
else:
A_top = A - 1
B_top = B - 1
top = (
B_top + (A - B_top - 1) // 2 if A_top > B_top else A_top + (B - A_top - 1) // 2
)
A_btm = N - A
B_btm = N - B
btm = B_btm + (A - B_btm) // 2 if A_btm > B_btm e... | N, A, B = map(int, input().split())
if A % 2 == B % 2:
print(abs(A - B) // 2)
else:
A_top = A - 1
B_top = B - 1
top = (
B_top + (A - B_top - 1) // 2 if A_top > B_top else A_top + (B - A_top - 1) // 2
)
A_btm = N - A
B_btm = N - B
btm = (
B_btm + (N - A - B_btm) // 2 if A... | [
"assignment.change"
] | 626,878 | 626,879 | u888092736 | python |
p02823 | import sys
input = sys.stdin.readline
def main():
n,a,b = [int(i) for i in input().strip().split()]
if (b-a) % 2 == 0:
print(abs(b - a) // 2)
else:
ans = min(a - 1, n - b) - 1 + (b - a - 1) // 2
print(ans)
return
if __name__ == "__main__":
main() | import sys
input = sys.stdin.readline
def main():
n,a,b = [int(i) for i in input().strip().split()]
if (b-a) % 2 == 0:
print(abs(b - a) // 2)
else:
ans = min(a - 1, n - b) + 1 + (b - a - 1) // 2
print(ans)
return
if __name__ == "__main__":
main() | [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 626,918 | 626,919 | u397496203 | python |
p02823 | import sys
input = sys.stdin.readline
def main():
n,a,b = [int(i) for i in input().strip().split()]
if (b-a) % 2 == 0:
print(abs(b - a) // 2)
else:
ans = min(a - 1, n - b) - 1 + (b - a - 1) // 2
print(ans)
return
if __name__ == "__main__":
main() | import sys
input = sys.stdin.readline
def main():
n,a,b = [int(i) for i in input().strip().split()]
if (b-a) % 2 == 0:
print(abs(b - a) // 2)
else:
ans = min(a - 1, n - b) + 1 + (b - a - 1) // 2
print(ans)
return
if __name__ == "__main__":
main() | [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 626,918 | 626,921 | u397496203 | python |
p02823 | n, a, b = map(int, input().split())
d = b - a
if d % 2 == 0:
print(d//2)
else:
dd = d//2
ans = min(dd + a, n - b + 1 - dd)
print(ans) | n, a, b = map(int, input().split())
d = b - a
if d % 2 == 0:
print(d//2)
else:
dd = d//2
ans = min(dd + a, n - b + 1 + dd)
print(ans) | [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 626,926 | 626,927 | u309141201 | python |
p02823 | N,A,B=map(int,input().split())
ans=0
if (B-A)%2==0:
ans=(B-A)//2
else:
if A-1<N-B:
if B-A==1:
ans=B-1
else:
ans=A+(B-A-1)//2
else:
if B-A==1:
ans=N-A
else:
ans=N-B-1+(A+N-B-1)//2
print(ans) | N,A,B=map(int,input().split())
ans=0
if (B-A)%2==0:
ans=(B-A)//2
else:
if A-1<N-B:
if B-A==1:
ans=B-1
else:
ans=A+(B-A-1)//2
else:
if B-A==1:
ans=N-A
else:
ans=N-B+1+(N-(A+N-B+1))//2
print(ans) | [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 626,944 | 626,945 | u075303794 | python |
p02823 | n, a, b = map(int, input().split())
if a % 2 == b % 2:
print((b - a) // 2)
else:
print(min(a-1,b-1)+1+(b-a-1)//2) | n, a, b = map(int, input().split())
if a % 2 == b % 2:
print((b - a) // 2)
else:
print(min(a-1,n-b)+1+(b-a-1)//2) | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change",
"identifier.replace.add",
"literal.replace.remove"
] | 626,970 | 626,971 | u867826040 | python |
p02823 | #!/usr/bin/env python3
n, a, b = map(int, input().split())
if (b - a) % 2 < 1:
print((b - a) // 2)
else:
print(min((a + b - 1) // 2, (2 * n - a - b + 1)))
| #!/usr/bin/env python3
n, a, b = map(int, input().split())
if (b - a) % 2 < 1:
print((b - a) // 2)
else:
print(min((a + b - 1) // 2, (2 * n - a - b + 1) // 2))
| [
"expression.operation.binary.add"
] | 626,984 | 626,985 | u094999522 | python |
p02823 | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
MOD = 10 ** ... | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
MOD = 10 ** ... | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 626,993 | 626,994 | u036104576 | python |
p02823 | N, A, B = map(int, input().split())
if (B-A-1) % 2 == 0:
val = min(A-1, N-B)
print((N-A-val-1)//2+val+1)
else:
print((B-A)//2)
| N, A, B = map(int, input().split())
if (B-A-1) % 2 == 0:
val = min(A-1, N-B)
print((B-A-1)//2+val+1)
else:
print((B-A)//2)
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change",
"expression.operation.binary.remove"
] | 627,001 | 627,002 | u289288647 | python |
p02823 | N, A, B = map(int, input().split())
if (B-A-1) % 2 == 0:
val = min(A-1, N-B)
print((B-1)//2+1)
else:
print((B-A)//2)
| N, A, B = map(int, input().split())
if (B-A-1) % 2 == 0:
val = min(A-1, N-B)
print((B-A-1)//2+val+1)
else:
print((B-A)//2)
| [
"expression.operation.binary.add"
] | 627,003 | 627,002 | u289288647 | python |
p02823 | x,a,b=map(int,input().split())
if (b-a)%2 == 0:
print((b-a)//2)
else:
print(min( a + (b-a-1)//2, n - b + 1 + (b-a-1)//2) )
| x,a,b=map(int,input().split())
if (b-a)%2 == 0:
print((b-a)//2)
else:
print(min( a + (b-a-1)//2, x - b + 1 + (b-a-1)//2) )
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 627,056 | 627,057 | u566529875 | python |
p02823 | N,A,B=map(int,input().split())
if (B-A)%2==1:
a=min(A-1,N-B)+1
b=(B-A)-1//2
print(a+b)
elif (B-A)%2==0:
print((B-A)//2) | N,A,B=map(int,input().split())
if (B-A)%2==1:
a=min(A-1,N-B)+1
b=((B-A)-1)//2
print(a+b)
elif (B-A)%2==0:
print((B-A)//2) | [] | 627,062 | 627,063 | u079022693 | python |
p02823 | import sys
input = sys.stdin.readline
MOD = 1000000007
N,A,B = map(int,input().split())
if abs(A-B)%2 == 0:
print(abs(A-B)//2)
else:
if (A-1) < (N-B):
print((A-1)+1+(B-A-1)//2)
else:
print((N-B)+1+(N-B-A)//2) | import sys
input = sys.stdin.readline
MOD = 1000000007
N,A,B = map(int,input().split())
if abs(A-B)%2 == 0:
print(abs(A-B)//2)
else:
if (A-1) < (N-B):
print((A-1)+1+(B-A-1)//2)
else:
print((N-B)+1+(B-A-1)//2) | [
"expression.operation.binary.remove"
] | 627,064 | 627,065 | u846226907 | python |
p02823 | n,a,b=[int(x) for x in input().split()]
if (a-b)%2==0:
print((a+b)//2)
else:
print(min(a-1,n-b)+1+(b-a-1)//2) | n,a,b=[int(x) for x in input().split()]
if (a+b)%2==0:
print((b-a)//2)
else:
print(min(a-1,n-b)+1+(b-a-1)//2) | [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 627,073 | 627,074 | u026788530 | python |
p02823 | n,a,b=[int(x) for x in input().split()]
if (a-b)%2==0:
print((a-b)//2)
else:
print(min(a-1,n-b)+1+(b-a-1)//2) | n,a,b=[int(x) for x in input().split()]
if (a+b)%2==0:
print((b-a)//2)
else:
print(min(a-1,n-b)+1+(b-a-1)//2) | [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 627,076 | 627,074 | u026788530 | python |
p02823 | n,a,b = map(int,input().split())
if a%2 == b%2:
print((b-a)//2)
else:
min(a-1,n-b)+1+(b-a-1)//2 | n,a,b = map(int,input().split())
if a%2 == b%2:
print((b-a)//2)
else:
print(min(a-1,n-b)+1+(b-a-1)//2) | [
"call.add",
"call.arguments.change"
] | 627,081 | 627,082 | u141410514 | python |
p02823 | n, a, b = map(int, input().split())
# 偶奇一致
if a % 2 == b % 2:
print((b - a) // 2)
else:
# left = a - 1
# right = n - b
# if left > right:
# cnt = right + 1
# left = min(a + cnt, n)
# print((n - left) // 2 + cnt)
# else:
# cnt = left + 1
# right = max(b - cnt,... | n, a, b = map(int, input().split())
# 偶奇一致
if a % 2 == b % 2:
print((b - a) // 2)
else:
# left = a - 1
# right = n - b
# if left > right:
# cnt = right + 1
# left = min(a + cnt, n)
# print((n - left) // 2 + cnt)
# else:
# cnt = left + 1
# right = max(b - cnt,... | [
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 627,083 | 627,084 | u506910932 | python |
p02823 | n,a,b=map(int,input().split())
if (a+b)%2==0:
print(abs(a-b)//2)
else:
temp=min(b-1,n-a)
if temp==b-1:
ans=(b+a-1)//2
else:
ans=(n-b+b-a-1)//2
print(ans) | n,a,b=map(int,input().split())
if (a+b)%2==0:
print(abs(a-b)//2)
else:
temp=min(b-1,n-a)
if temp==b-1:
ans=(b+a-1)//2
else:
ans=(n+1-b+n+1-a-1)//2
print(ans) | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 627,100 | 627,101 | u106778233 | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.