user_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 1
value | submission_id_v0 stringlengths 10 10 | submission_id_v1 stringlengths 10 10 | cpu_time_v0 int64 10 38.3k | cpu_time_v1 int64 0 24.7k | memory_v0 int64 2.57k 1.02M | memory_v1 int64 2.57k 869k | status_v0 stringclasses 1
value | status_v1 stringclasses 1
value | improvement_frac float64 7.51 100 | input stringlengths 20 4.55k | target stringlengths 17 3.34k | code_v0_loc int64 1 148 | code_v1_loc int64 1 184 | code_v0_num_chars int64 13 4.55k | code_v1_num_chars int64 14 3.34k | code_v0_no_empty_lines stringlengths 21 6.88k | code_v1_no_empty_lines stringlengths 20 4.93k | code_same bool 1
class | relative_loc_diff_percent float64 0 79.8 | diff list | diff_only_import_comment bool 1
class | measured_runtime_v0 float64 0.01 4.45 | measured_runtime_v1 float64 0.01 4.31 | runtime_lift float64 0 359 | key list |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u729133443 | p02873 | python | s596672085 | s793014217 | 371 | 311 | 22,308 | 8,220 | Accepted | Accepted | 16.17 | from itertools import*
g=[(c>'<',len(list(m)))for c,m in groupby(eval(input()))]
n=len(g)
a=b=0
for i,(c,m)in enumerate(g):
a+=m*~-m//2+max(m,b)*c+m*(c^1)*(i>n-2)
b=m
print(a) | from itertools import*
a=b=0
for c,m in groupby(eval(input())):m=len(list(m));a+=m*-~m//2-min(m,b)*(c>'<');b=m
print(a) | 8 | 4 | 180 | 116 | from itertools import *
g = [(c > "<", len(list(m))) for c, m in groupby(eval(input()))]
n = len(g)
a = b = 0
for i, (c, m) in enumerate(g):
a += m * ~-m // 2 + max(m, b) * c + m * (c ^ 1) * (i > n - 2)
b = m
print(a)
| from itertools import *
a = b = 0
for c, m in groupby(eval(input())):
m = len(list(m))
a += m * -~m // 2 - min(m, b) * (c > "<")
b = m
print(a)
| false | 50 | [
"-g = [(c > \"<\", len(list(m))) for c, m in groupby(eval(input()))]",
"-n = len(g)",
"-for i, (c, m) in enumerate(g):",
"- a += m * ~-m // 2 + max(m, b) * c + m * (c ^ 1) * (i > n - 2)",
"+for c, m in groupby(eval(input())):",
"+ m = len(list(m))",
"+ a += m * -~m // 2 - min(m, b) * (c > \"<\"... | false | 0.103347 | 0.089257 | 1.157854 | [
"s596672085",
"s793014217"
] |
u891635666 | p02793 | python | s642993086 | s597786270 | 1,299 | 302 | 313,068 | 4,852 | Accepted | Accepted | 76.75 | import collections
import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril... | import collections
import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril... | 58 | 76 | 1,390 | 1,565 | import collections
import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in ... | import collections
import sys
input = sys.stdin.readline
ri = lambda: int(eval(input()))
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in ... | false | 23.684211 | [
"-def factorize_all(n):",
"- factorizations = [None] * (n + 1)",
"- factorizations[0] = dict()",
"- factorizations[1] = dict()",
"- for p in range(2, n + 1):",
"- if factorizations[p] is None:",
"- for k in range(1, n // p + 1):",
"- if factorizations[k] is... | false | 0.547684 | 0.049188 | 11.134424 | [
"s642993086",
"s597786270"
] |
u467736898 | p02670 | python | s137359451 | s185250156 | 1,726 | 1,469 | 122,220 | 122,080 | Accepted | Accepted | 14.89 | import numba
import numpy as np
N = int(eval(input()))
P = np.array([int(c)-1 for c in input().split()])
#from random import shuffle
#N = 500
#P = list(range(N*N))
#shuffle(P)
#P = np.array(P)
@numba.njit("i8(i8,i8[:])")
def proc(N, P):
ans = 0
Removed = np.zeros((500, 500), dtype=np.int8)
... | import numba
import numpy as np
N = int(eval(input()))
P = np.array([int(c)-1 for c in input().split()])
#from random import shuffle
#N = 500
#P = list(range(N*N))
#shuffle(P)
#P = np.array(P)
@numba.njit("i8(i8,i8[:])")
def proc(N, P):
ans = 0
Removed = np.zeros((500, 500), dtype=np.int8)
... | 51 | 57 | 1,401 | 1,609 | import numba
import numpy as np
N = int(eval(input()))
P = np.array([int(c) - 1 for c in input().split()])
# from random import shuffle
# N = 500
# P = list(range(N*N))
# shuffle(P)
# P = np.array(P)
@numba.njit("i8(i8,i8[:])")
def proc(N, P):
ans = 0
Removed = np.zeros((500, 500), dtype=np.int8)
Mat = np.... | import numba
import numpy as np
N = int(eval(input()))
P = np.array([int(c) - 1 for c in input().split()])
# from random import shuffle
# N = 500
# P = list(range(N*N))
# shuffle(P)
# P = np.array(P)
@numba.njit("i8(i8,i8[:])")
def proc(N, P):
ans = 0
Removed = np.zeros((500, 500), dtype=np.int8)
Mat = np.... | false | 10.526316 | [
"+ Buf = [(0, 0) for _ in range(1 << 17)]",
"+ Buf_idx = 0",
"- st = [(y, x)]",
"- while st:",
"- vy, vx = st.pop()",
"+ Buf[Buf_idx] = (y, x)",
"+ Buf_idx += 1",
"+ while Buf_idx:",
"+ Buf_idx -= 1",
"+ vy, vx = Buf[Buf_idx... | false | 0.046197 | 0.044399 | 1.040504 | [
"s137359451",
"s185250156"
] |
u707498674 | p02837 | python | s105116339 | s462313694 | 352 | 178 | 49,496 | 3,064 | Accepted | Accepted | 49.43 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
A = [[] for i in range(N)]
def check(target):
one_count = 0
cans = 0
for idx, flag in enumerate(target):
if flag == "1":
one_count += 1
for x, y in A[idx]:
if int(target[x]) != y:
... | import sys
def input() : return sys.stdin.readline().strip()
def main():
ans = 0
N = int(eval(input()))
test = []
for _ in range(N):
A = int(eval(input()))
temp = [tuple(map(int, input().split())) for _ in range(A)]
test.append(temp)
# bit full search
... | 37 | 31 | 744 | 753 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
A = [[] for i in range(N)]
def check(target):
one_count = 0
cans = 0
for idx, flag in enumerate(target):
if flag == "1":
one_count += 1
for x, y in A[idx]:
if int(target[x]) != y:
... | import sys
def input():
return sys.stdin.readline().strip()
def main():
ans = 0
N = int(eval(input()))
test = []
for _ in range(N):
A = int(eval(input()))
temp = [tuple(map(int, input().split())) for _ in range(A)]
test.append(temp)
# bit full search
print()
f... | false | 16.216216 | [
"-sys.setrecursionlimit(10**9)",
"-N = int(eval(input()))",
"-A = [[] for i in range(N)]",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"-def check(target):",
"- one_count = 0",
"- cans = 0",
"- for idx, flag in enumerate(target):",
"- if flag == \"1\":",
"... | false | 0.049059 | 0.087508 | 0.56063 | [
"s105116339",
"s462313694"
] |
u941753895 | p02820 | python | s239153744 | s314855842 | 244 | 199 | 11,252 | 18,552 | Accepted | Accepted | 18.44 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
de... | import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for... | 53 | 51 | 1,412 | 1,169 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) ... | import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI():
return [int(x) for x in sys.stdin.readline().spl... | false | 3.773585 | [
"-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy",
"+import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy",
"-def LI_():",
"- return [int(x) - 1 for x in sys.stdin.readline().split()]",
"+def LF():",
"+ retu... | false | 0.039635 | 0.061233 | 0.647281 | [
"s239153744",
"s314855842"
] |
u603577460 | p02361 | python | s111711831 | s608021288 | 4,450 | 1,900 | 85,892 | 93,380 | Accepted | Accepted | 57.3 | import sys
def bellmanford(G,s):
n = len(G)
dist = [float("inf") for i in range(n)]
dist[s]=0
for k in range(n):
flag = False
for u in range(n):
for v in range(len(G[u])):
if dist[G[u][v][0]]>dist[u]+G[u][v][1]:
dist[G[u][v][0]]=d... | import sys
import heapq
def Dj(G,s):
n = len(G)
dist = [float("inf") for i in range(n)]
vis = [-1 for i in range(n)]
li = [(0,s)]
dist[s]=0
heapq.heapify(li)
while len(li):
d,u = heapq.heappop(li)
if vis[u]==1:
continue
vis[u]=1
for v... | 33 | 40 | 877 | 929 | import sys
def bellmanford(G, s):
n = len(G)
dist = [float("inf") for i in range(n)]
dist[s] = 0
for k in range(n):
flag = False
for u in range(n):
for v in range(len(G[u])):
if dist[G[u][v][0]] > dist[u] + G[u][v][1]:
dist[G[u][v][0]] = ... | import sys
import heapq
def Dj(G, s):
n = len(G)
dist = [float("inf") for i in range(n)]
vis = [-1 for i in range(n)]
li = [(0, s)]
dist[s] = 0
heapq.heapify(li)
while len(li):
d, u = heapq.heappop(li)
if vis[u] == 1:
continue
vis[u] = 1
for v in... | false | 17.5 | [
"+import heapq",
"-def bellmanford(G, s):",
"+def Dj(G, s):",
"+ vis = [-1 for i in range(n)]",
"+ li = [(0, s)]",
"- for k in range(n):",
"- flag = False",
"- for u in range(n):",
"- for v in range(len(G[u])):",
"- if dist[G[u][v][0]] > dist[u] + G... | false | 0.034482 | 0.112063 | 0.307703 | [
"s111711831",
"s608021288"
] |
u351654473 | p02771 | python | s989253793 | s951220610 | 24 | 16 | 3,316 | 3,060 | Accepted | Accepted | 33.33 | A, B, C = list(map(int,input().split()))
if A ==B and B == C:
print('No')
elif B == C:
print('Yes')
elif A == C:
print('Yes')
elif A == B:
print('Yes')
else:
print('No') | A, B, C = list(map(int,input().split()))
if A == B == C:
print('No')
elif B == C:
print('Yes')
elif A == C:
print('Yes')
elif A == B:
print('Yes')
else:
print('No') | 11 | 11 | 193 | 188 | A, B, C = list(map(int, input().split()))
if A == B and B == C:
print("No")
elif B == C:
print("Yes")
elif A == C:
print("Yes")
elif A == B:
print("Yes")
else:
print("No")
| A, B, C = list(map(int, input().split()))
if A == B == C:
print("No")
elif B == C:
print("Yes")
elif A == C:
print("Yes")
elif A == B:
print("Yes")
else:
print("No")
| false | 0 | [
"-if A == B and B == C:",
"+if A == B == C:"
] | false | 0.044768 | 0.037176 | 1.204212 | [
"s989253793",
"s951220610"
] |
u054514819 | p02631 | python | s387583631 | s297866255 | 189 | 145 | 36,180 | 114,308 | Accepted | Accepted | 23.28 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
from collections import Counter
N = int(eval(input()))
As = list(mapint())
cum = 0
for a in As:
cum^=a
A = []
for a in As:
ans = cum^a
A.append(str(a... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
As = list(mapint())
ALL = 0
for a in As:
ALL ^= a
ans = [ALL^a for a in As]
print((*ans)) | 17 | 13 | 332 | 258 | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
from collections import Counter
N = int(eval(input()))
As = list(mapint())
cum = 0
for a in As:
cum ^= a
A = []
for a in As:
ans = cum ^ a
A.append(str... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
As = list(mapint())
ALL = 0
for a in As:
ALL ^= a
ans = [ALL ^ a for a in As]
print((*ans))
| false | 23.529412 | [
"-from collections import Counter",
"-",
"-cum = 0",
"+ALL = 0",
"- cum ^= a",
"-A = []",
"-for a in As:",
"- ans = cum ^ a",
"- A.append(str(ans))",
"-print((\" \".join(A)))",
"+ ALL ^= a",
"+ans = [ALL ^ a for a in As]",
"+print((*ans))"
] | false | 0.120957 | 0.036952 | 3.273385 | [
"s387583631",
"s297866255"
] |
u279493135 | p03164 | python | s363674353 | s284892894 | 519 | 175 | 113,488 | 15,344 | Accepted | Accepted | 66.28 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, a... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, a... | 34 | 30 | 1,024 | 1,022 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_u... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_u... | false | 11.764706 | [
"+import numpy as np",
"-max_v = sum(v)",
"-dp = [INF] * (max_v + 1)",
"+max_v = 0",
"+dp = np.full(1000 * N + 1, 10**18, dtype=np.int64)",
"- for i in range(max_v, -1, -1):",
"- if i - v >= 0:",
"- dp[i] = min(dp[i], dp[i - v] + w)",
"-ans = 0",
"-for i in range(len(dp)):",
... | false | 0.035842 | 0.21898 | 0.163678 | [
"s363674353",
"s284892894"
] |
u037430802 | p03828 | python | s601290347 | s178886569 | 24 | 22 | 3,316 | 3,064 | Accepted | Accepted | 8.33 | def getPrimeFactorsList(num):
pn = 2 #็ด ๆฐใฏ2ใใ
pflist = [] #็ด ๅ ๆฐใฎใชในใ
while pn * pn <= num: #โnumใพใง่ชฟในใ
while num % pn == 0: #็พๅจใฎ็ด ๆฐใงๅฒใๅใใ็ฏๅฒใงใซใผใ
num = num / pn
pflist.append(pn)
pn += 1 #ๅฒใๅใใชใใชใฃใใๆฌกใฎ็ด ๆฐใธ
if num > 1:
pflist.append(int(num))
return pflist
mod = (10 ** 9 + 7)
N = i... | N = int(eval(input()))
prime_dict = {}
while N > 1:
pn = 2
tmp = N
while pn * pn <= tmp:
while tmp % pn == 0:
tmp = tmp / pn
prime_dict[pn] = prime_dict.get(pn, 0) + 1
pn += 1
if tmp > 1:
prime_dict[tmp] = prime_dict.get(tmp, 0) + 1
N -= 1
cnt = 1
for key in list(... | 34 | 21 | 725 | 383 | def getPrimeFactorsList(num):
pn = 2 # ็ด ๆฐใฏ2ใใ
pflist = [] # ็ด ๅ ๆฐใฎใชในใ
while pn * pn <= num: # โnumใพใง่ชฟในใ
while num % pn == 0: # ็พๅจใฎ็ด ๆฐใงๅฒใๅใใ็ฏๅฒใงใซใผใ
num = num / pn
pflist.append(pn)
pn += 1 # ๅฒใๅใใชใใชใฃใใๆฌกใฎ็ด ๆฐใธ
if num > 1:
pflist.append(int(num))
return pf... | N = int(eval(input()))
prime_dict = {}
while N > 1:
pn = 2
tmp = N
while pn * pn <= tmp:
while tmp % pn == 0:
tmp = tmp / pn
prime_dict[pn] = prime_dict.get(pn, 0) + 1
pn += 1
if tmp > 1:
prime_dict[tmp] = prime_dict.get(tmp, 0) + 1
N -= 1
cnt = 1
for ... | false | 38.235294 | [
"-def getPrimeFactorsList(num):",
"- pn = 2 # ็ด ๆฐใฏ2ใใ",
"- pflist = [] # ็ด ๅ ๆฐใฎใชในใ",
"- while pn * pn <= num: # โnumใพใง่ชฟในใ",
"- while num % pn == 0: # ็พๅจใฎ็ด ๆฐใงๅฒใๅใใ็ฏๅฒใงใซใผใ",
"- num = num / pn",
"- pflist.append(pn)",
"- pn += 1 # ๅฒใๅใใชใใชใฃใใๆฌกใฎ็ด ๆฐใธ",
"- if ... | false | 0.047988 | 0.108425 | 0.442589 | [
"s601290347",
"s178886569"
] |
u671060652 | p03220 | python | s127400813 | s097284113 | 289 | 73 | 64,364 | 62,488 | Accepted | Accepted | 74.74 | import itertools
import math
import fractions
import functools
import copy
n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
minimum = 10**10
index = 0
for i in range(n):
minimum = min(minimum,abs(a-(t-h[i]*0.006)))
if minimum == abs(a-(t-h[i]*0.006))... | def main():
n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
# s = input()
mini = 10**10
ans = 0
for i, x in enumerate(h):
c = t - x * 0.006
if abs(a - c) < mini:
mini = abs(a - c)
ans = i+1... | 16 | 19 | 346 | 371 | import itertools
import math
import fractions
import functools
import copy
n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
minimum = 10**10
index = 0
for i in range(n):
minimum = min(minimum, abs(a - (t - h[i] * 0.006)))
if minimum == abs(a - (t - h[i] * 0.006)... | def main():
n = int(eval(input()))
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))
# s = input()
mini = 10**10
ans = 0
for i, x in enumerate(h):
c = t - x * 0.006
if abs(a - c) < mini:
mini = abs(a - c)
ans = i + 1
print(... | false | 15.789474 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-import copy",
"+def main():",
"+ n = int(eval(input()))",
"+ t, a = list(map(int, input().split()))",
"+ h = list(map(int, input().split()))",
"+ # s = input()",
"+ mini = 10**10",
"+ ans = 0",
... | false | 0.05439 | 0.05416 | 1.004246 | [
"s127400813",
"s097284113"
] |
u887207211 | p03721 | python | s400226645 | s018958505 | 489 | 268 | 28,640 | 29,096 | Accepted | Accepted | 45.19 | N, K = list(map(int,input().split()))
AB = sorted([list(map(int,input().split())) for _ in range(N)])
tmp = 0
for a, b in AB:
if(tmp < K-b):
tmp += b
else:
print(a)
break | import sys
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
def main():
n, k = na()
ab = [na() for _ in range(n)]
ab.sort(key = lambda x: x[0])
cnt = 0
for a, b in ab:
cnt += b
if cnt >= k:
... | 10 | 20 | 190 | 353 | N, K = list(map(int, input().split()))
AB = sorted([list(map(int, input().split())) for _ in range(N)])
tmp = 0
for a, b in AB:
if tmp < K - b:
tmp += b
else:
print(a)
break
| import sys
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
def main():
n, k = na()
ab = [na() for _ in range(n)]
ab.sort(key=lambda x: x[0])
cnt = 0
for a, b in ab:
cnt += b
if cnt >= k:
... | false | 50 | [
"-N, K = list(map(int, input().split()))",
"-AB = sorted([list(map(int, input().split())) for _ in range(N)])",
"-tmp = 0",
"-for a, b in AB:",
"- if tmp < K - b:",
"- tmp += b",
"- else:",
"- print(a)",
"- break",
"+import sys",
"+",
"+stdin = sys.stdin",
"+ns = l... | false | 0.038405 | 0.038268 | 1.003583 | [
"s400226645",
"s018958505"
] |
u721316601 | p03013 | python | s995051147 | s005258309 | 1,672 | 185 | 462,728 | 6,900 | Accepted | Accepted | 88.94 | N, M = list(map(int, input().split()))
a = [int(eval(input())) for i in range(M)] + [10**20]
dp = [1] + [0 for i in range(N+2)]
next_a = a.pop(0)
for i in range(N):
if next_a == i:
dp[i] = 0
next_a = a.pop(0)
else:
dp[i+1] += dp[i]
dp[i+2] += dp[i]
print((dp[N]%1... | MOD = 1000000007
N, M = list(map(int, input().split()))
N += 1
dp = [0] * N
dp[0] = 1
for i in range(M):
a = int(eval(input()))
dp[a] = -1
for i in range(N):
if dp[i] == -1: continue
dp[i] %= MOD
if i+1 < N and dp[i+1] != -1: dp[i+1] += dp[i]
if i+2 < N and dp[i+2] ... | 15 | 20 | 324 | 355 | N, M = list(map(int, input().split()))
a = [int(eval(input())) for i in range(M)] + [10**20]
dp = [1] + [0 for i in range(N + 2)]
next_a = a.pop(0)
for i in range(N):
if next_a == i:
dp[i] = 0
next_a = a.pop(0)
else:
dp[i + 1] += dp[i]
dp[i + 2] += dp[i]
print((dp[N] % 1000000007... | MOD = 1000000007
N, M = list(map(int, input().split()))
N += 1
dp = [0] * N
dp[0] = 1
for i in range(M):
a = int(eval(input()))
dp[a] = -1
for i in range(N):
if dp[i] == -1:
continue
dp[i] %= MOD
if i + 1 < N and dp[i + 1] != -1:
dp[i + 1] += dp[i]
if i + 2 < N and dp[i + 2] != -... | false | 25 | [
"+MOD = 1000000007",
"-a = [int(eval(input())) for i in range(M)] + [10**20]",
"-dp = [1] + [0 for i in range(N + 2)]",
"-next_a = a.pop(0)",
"+N += 1",
"+dp = [0] * N",
"+dp[0] = 1",
"+for i in range(M):",
"+ a = int(eval(input()))",
"+ dp[a] = -1",
"- if next_a == i:",
"- dp[... | false | 0.078457 | 0.037447 | 2.095153 | [
"s995051147",
"s005258309"
] |
u583507988 | p03325 | python | s075420802 | s014466461 | 82 | 64 | 10,024 | 10,124 | Accepted | Accepted | 21.95 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(n):
if a[i]%2==0:
while a[i]%2==0:
a[i] //= 2
ans += 1
print(ans) | n=int(eval(input()))
a=list(map(int,input().split()))
ans=0
for i in a:
while i%2==0:
i=i//2
ans+=1
print(ans) | 12 | 9 | 183 | 125 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(n):
if a[i] % 2 == 0:
while a[i] % 2 == 0:
a[i] //= 2
ans += 1
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while i % 2 == 0:
i = i // 2
ans += 1
print(ans)
| false | 25 | [
"-for i in range(n):",
"- if a[i] % 2 == 0:",
"- while a[i] % 2 == 0:",
"- a[i] //= 2",
"- ans += 1",
"+for i in a:",
"+ while i % 2 == 0:",
"+ i = i // 2",
"+ ans += 1"
] | false | 0.091218 | 0.087067 | 1.047676 | [
"s075420802",
"s014466461"
] |
u316386814 | p02998 | python | s648892063 | s789989513 | 1,825 | 501 | 193,868 | 114,524 | Accepted | Accepted | 72.55 | import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def YesNo(x): return 'Yes' if x else 'No'
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]... | import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def YesNo(x): return 'Yes' if x else 'No'
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]... | 50 | 45 | 1,397 | 1,281 | import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
def YesNo(x):
return "Yes" if x else "No"
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readl... | import sys
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
def YesNo(x):
return "Yes" if x else "No"
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF():
return [float(x) for x in sys.stdin.readl... | false | 10 | [
"- edges = defaultdict(list)",
"+ xy = []",
"- x, y = LI()",
"- edges[x].append(-y)",
"- edges[-y].append(x)",
"- visited = defaultdict(int)",
"- if max(len(li) for li in list(edges.values())) == 2 and N >= 10**4:",
"- m, p = 0, 0",
"- for k in list(edg... | false | 0.032938 | 0.033403 | 0.986074 | [
"s648892063",
"s789989513"
] |
u605879293 | p02259 | python | s425688256 | s067168870 | 30 | 20 | 5,616 | 5,612 | Accepted | Accepted | 33.33 | def show(array):
for i in range(len(array)):
if i != len(array) - 1:
print(array[i], end=' ')
else:
print(array[i])
def bubbleSort(array):
flag = True
count = 0
while flag:
flag = False
for j in sorted(range(1, len(array)), reverse=T... | def bubbleSort(array):
n = len(array)
cnt = 0
flag = True
while flag:
flag = False
for i in range(n-1, 0, -1):
if array[i-1] > array[i]:
array[i-1], array[i] = array[i], array[i-1]
flag = True
cnt += 1
return (arr... | 27 | 20 | 612 | 467 | def show(array):
for i in range(len(array)):
if i != len(array) - 1:
print(array[i], end=" ")
else:
print(array[i])
def bubbleSort(array):
flag = True
count = 0
while flag:
flag = False
for j in sorted(range(1, len(array)), reverse=True):
... | def bubbleSort(array):
n = len(array)
cnt = 0
flag = True
while flag:
flag = False
for i in range(n - 1, 0, -1):
if array[i - 1] > array[i]:
array[i - 1], array[i] = array[i], array[i - 1]
flag = True
cnt += 1
return (array,... | false | 25.925926 | [
"-def show(array):",
"- for i in range(len(array)):",
"- if i != len(array) - 1:",
"- print(array[i], end=\" \")",
"- else:",
"- print(array[i])",
"+def bubbleSort(array):",
"+ n = len(array)",
"+ cnt = 0",
"+ flag = True",
"+ while flag:",
"+... | false | 0.039417 | 0.039135 | 1.007221 | [
"s425688256",
"s067168870"
] |
u863442865 | p03078 | python | s575596303 | s507331378 | 745 | 329 | 105,356 | 54,232 | Accepted | Accepted | 55.84 | #xyzใฎๅ
จ้ใ่ชฟในใใจ้ใซๅใใชใ
#ใพใๅ้กใๅใใใ
#ๅ
ใซxyใ ใ่ใใฆใฟใ
#xyใฎๅใใจใฃใฆใใใใใจzใฎๅใใจใใจใ
#xyใฎๅใซใใใฆk็ช็ฎไปฅ้ใฎๅคใไฝฟใใใจใฏ็กใ
#
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations... | def main():
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
#from itertools import product
from bisect import bisect_left,bi... | 45 | 44 | 1,172 | 1,429 | # xyzใฎๅ
จ้ใ่ชฟในใใจ้ใซๅใใชใ
# ใพใๅ้กใๅใใใ
# ๅ
ใซxyใ ใ่ใใฆใฟใ
# xyใฎๅใใจใฃใฆใใใใใจzใฎๅใใจใใจใ
# xyใฎๅใซใใใฆk็ช็ฎไปฅ้ใฎๅคใไฝฟใใใจใฏ็กใ
#
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
# from collections import defaultdict
from itertools import combinations, perm... | def main():
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
# from itertools import product
from bisect import bisect_left, bise... | false | 2.222222 | [
"-# xyzใฎๅ
จ้ใ่ชฟในใใจ้ใซๅใใชใ",
"-# ใพใๅ้กใๅใใใ",
"-# ๅ
ใซxyใ ใ่ใใฆใฟใ",
"-# xyใฎๅใใจใฃใฆใใใใใจzใฎๅใใจใใจใ",
"-# xyใฎๅใซใใใฆk็ช็ฎไปฅ้ใฎๅคใไฝฟใใใจใฏ็กใ",
"-#",
"- from itertools import combinations, permutations, accumulate, groupby",
"+ from itertools import combinations, permutations, accumulate",
"- x, y, z, k = list(map(int... | false | 0.041631 | 0.042662 | 0.975823 | [
"s575596303",
"s507331378"
] |
u816488327 | p02843 | python | s842782207 | s242741997 | 51 | 18 | 3,064 | 2,940 | Accepted | Accepted | 64.71 | def solve():
X = int(eval(input()))
if X < 100:
return 0
upper1 = X // 100
for p1 in range(0, 100 * upper1 + 1, 100):
rest1 = X - p1
if rest1 == 0:
return 1
upper2 = rest1 // 101
for p2 in range(0, 101 * upper2 + 1, 101):
... | X = int(eval(input()))
if X >= 2000:
print((1))
else:
for n in range(1, 20):
if 100 * n <= X <= 105 * n:
print((1))
break
else:
print((0)) | 40 | 11 | 1,314 | 189 | def solve():
X = int(eval(input()))
if X < 100:
return 0
upper1 = X // 100
for p1 in range(0, 100 * upper1 + 1, 100):
rest1 = X - p1
if rest1 == 0:
return 1
upper2 = rest1 // 101
for p2 in range(0, 101 * upper2 + 1, 101):
rest2 = rest1 - p2... | X = int(eval(input()))
if X >= 2000:
print((1))
else:
for n in range(1, 20):
if 100 * n <= X <= 105 * n:
print((1))
break
else:
print((0))
| false | 72.5 | [
"-def solve():",
"- X = int(eval(input()))",
"- if X < 100:",
"- return 0",
"- upper1 = X // 100",
"- for p1 in range(0, 100 * upper1 + 1, 100):",
"- rest1 = X - p1",
"- if rest1 == 0:",
"- return 1",
"- upper2 = rest1 // 101",
"- for p2 ... | false | 0.042391 | 0.041554 | 1.020125 | [
"s842782207",
"s242741997"
] |
u014333473 | p04029 | python | s934686680 | s877083008 | 27 | 23 | 8,876 | 8,924 | Accepted | Accepted | 14.81 | print((sum([i for i in range(1,int(eval(input()))+1)]))) | n=int(eval(input()));print(((n*(n+1))//2)) | 1 | 1 | 48 | 34 | print((sum([i for i in range(1, int(eval(input())) + 1)])))
| n = int(eval(input()))
print(((n * (n + 1)) // 2))
| false | 0 | [
"-print((sum([i for i in range(1, int(eval(input())) + 1)])))",
"+n = int(eval(input()))",
"+print(((n * (n + 1)) // 2))"
] | false | 0.048637 | 0.120775 | 0.402712 | [
"s934686680",
"s877083008"
] |
u562935282 | p02727 | python | s445543241 | s620906002 | 294 | 251 | 24,240 | 23,328 | Accepted | Accepted | 14.63 | def main():
X, Y, A, B, C = list(map(int, input().split()))
*p, = sorted(map(int, input().split()), reverse=True)
*q, = sorted(map(int, input().split()), reverse=True)
*r, = list(map(int, input().split()))
pool = p[:X] + q[:Y] + r
pool.sort(reverse=True)
ret = sum(pool[:X + Y])
... | x, y, a, b, c = list(map(int, input().split()))
*p, = list(map(int, input().split()))
*q, = list(map(int, input().split()))
*r, = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
pool = p[:x] + q[:y] + r
pool.sort(reverse=True)
pool = pool[:x + y]
ans = sum(pool)
print(ans)
| 14 | 14 | 364 | 292 | def main():
X, Y, A, B, C = list(map(int, input().split()))
(*p,) = sorted(map(int, input().split()), reverse=True)
(*q,) = sorted(map(int, input().split()), reverse=True)
(*r,) = list(map(int, input().split()))
pool = p[:X] + q[:Y] + r
pool.sort(reverse=True)
ret = sum(pool[: X + Y])
pr... | x, y, a, b, c = list(map(int, input().split()))
(*p,) = list(map(int, input().split()))
(*q,) = list(map(int, input().split()))
(*r,) = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
pool = p[:x] + q[:y] + r
pool.sort(reverse=True)
pool = pool[: x + y]
ans = sum(pool)
print(ans)
| false | 0 | [
"-def main():",
"- X, Y, A, B, C = list(map(int, input().split()))",
"- (*p,) = sorted(map(int, input().split()), reverse=True)",
"- (*q,) = sorted(map(int, input().split()), reverse=True)",
"- (*r,) = list(map(int, input().split()))",
"- pool = p[:X] + q[:Y] + r",
"- pool.sort(reverse... | false | 0.068469 | 0.082385 | 0.831079 | [
"s445543241",
"s620906002"
] |
u573754721 | p02898 | python | s537265608 | s367113960 | 70 | 48 | 11,916 | 11,912 | Accepted | Accepted | 31.43 | n,k=list(map(int,input().split()))
L=list(map(int,input().split()))
L.sort()
for i in range(n):
if L[i]>=k:
print((n-i))
exit()
print((0)) | n,k=list(map(int,input().split()))
L=list(map(int,input().split()))
print((sum(x>=k for x in L))) | 9 | 3 | 167 | 91 | n, k = list(map(int, input().split()))
L = list(map(int, input().split()))
L.sort()
for i in range(n):
if L[i] >= k:
print((n - i))
exit()
print((0))
| n, k = list(map(int, input().split()))
L = list(map(int, input().split()))
print((sum(x >= k for x in L)))
| false | 66.666667 | [
"-L.sort()",
"-for i in range(n):",
"- if L[i] >= k:",
"- print((n - i))",
"- exit()",
"-print((0))",
"+print((sum(x >= k for x in L)))"
] | false | 0.037909 | 0.047177 | 0.803535 | [
"s537265608",
"s367113960"
] |
u695811449 | p02716 | python | s658734358 | s886325712 | 587 | 529 | 156,532 | 188,528 | Accepted | Accepted | 9.88 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N=int(eval(input()))
A=list(map(int,input().split()))
SUM=[0]*(N+1)
for i in range(N-1,-1,-1):
SUM[i]=SUM[i+1]
if (N-i)%2==1:
SUM[i]+=A[i]
#print(SUM)
ADICT=dict()
def calc(i,select):
if ADICT.get((i,select))... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N=int(eval(input()))
A=list(map(int,input().split()))
SUM=[0]*(N+1)
for i in range(N-1,-1,-1):
SUM[i]=SUM[i+1]
if (N-i)%2==1:
SUM[i]+=A[i]
#print(SUM)
from functools import lru_cache
@lru_cache(maxsize=None)... | 42 | 36 | 888 | 711 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N = int(eval(input()))
A = list(map(int, input().split()))
SUM = [0] * (N + 1)
for i in range(N - 1, -1, -1):
SUM[i] = SUM[i + 1]
if (N - i) % 2 == 1:
SUM[i] += A[i]
# print(SUM)
ADICT = dict()
def calc(i, select):
if ADICT.get((i... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N = int(eval(input()))
A = list(map(int, input().split()))
SUM = [0] * (N + 1)
for i in range(N - 1, -1, -1):
SUM[i] = SUM[i + 1]
if (N - i) % 2 == 1:
SUM[i] += A[i]
# print(SUM)
from functools import lru_cache
@lru_cache(maxsize=None... | false | 14.285714 | [
"-ADICT = dict()",
"+from functools import lru_cache",
"+@lru_cache(maxsize=None)",
"- if ADICT.get((i, select)) != None:",
"- return ADICT.get((i, select))",
"- ADICT[(i, select)] = 0",
"- ADICT[(i, select)] = SUM[i]",
"- ADICT[(i, select)] = max(calc(i + 1, select), A[... | false | 0.045169 | 0.044469 | 1.01574 | [
"s658734358",
"s886325712"
] |
u127499732 | p03162 | python | s656340375 | s020072103 | 431 | 217 | 3,064 | 37,128 | Accepted | Accepted | 49.65 | n=int(eval(input()))
ma,mb,mc=0,0,0
for _ in range(n):
a,b,c=list(map(int,input().split()))
x,y,z=ma,mb,mc
ma=a+max([y,z])
mb=b+max([z,x])
mc=c+max([x,y])
print((max([ma,mb,mc]))) | def main():
n, *abc = list(map(int, open(0).read().split()))
dp = [[0, 0, 0] for _ in range(n + 1)]
for i, (a, b, c) in enumerate(zip(abc[::3], abc[1::3], abc[2::3]), 1):
x, y, z = dp[i - 1]
dp[i] = [a + max(y, z), b + max(z, x), c + max(x, y)]
ans = max(dp[-1])
print(ans)
... | 9 | 13 | 183 | 357 | n = int(eval(input()))
ma, mb, mc = 0, 0, 0
for _ in range(n):
a, b, c = list(map(int, input().split()))
x, y, z = ma, mb, mc
ma = a + max([y, z])
mb = b + max([z, x])
mc = c + max([x, y])
print((max([ma, mb, mc])))
| def main():
n, *abc = list(map(int, open(0).read().split()))
dp = [[0, 0, 0] for _ in range(n + 1)]
for i, (a, b, c) in enumerate(zip(abc[::3], abc[1::3], abc[2::3]), 1):
x, y, z = dp[i - 1]
dp[i] = [a + max(y, z), b + max(z, x), c + max(x, y)]
ans = max(dp[-1])
print(ans)
if __nam... | false | 30.769231 | [
"-n = int(eval(input()))",
"-ma, mb, mc = 0, 0, 0",
"-for _ in range(n):",
"- a, b, c = list(map(int, input().split()))",
"- x, y, z = ma, mb, mc",
"- ma = a + max([y, z])",
"- mb = b + max([z, x])",
"- mc = c + max([x, y])",
"-print((max([ma, mb, mc])))",
"+def main():",
"+ n,... | false | 0.046798 | 0.087276 | 0.53621 | [
"s656340375",
"s020072103"
] |
u048945791 | p03295 | python | s001761181 | s081005678 | 227 | 209 | 18,188 | 23,716 | Accepted | Accepted | 7.93 | import sys
N, M = list(map(int, input().split()))
ab = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]
ab.sort(key = lambda x : x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans) | import sys
N, M = list(map(int, input().split()))
ab = [tuple(map(int, line.split())) for line in sys.stdin.readlines()]
ab.sort(key = lambda x : x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans) | 16 | 16 | 286 | 286 | import sys
N, M = list(map(int, input().split()))
ab = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]
ab.sort(key=lambda x: x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans)
| import sys
N, M = list(map(int, input().split()))
ab = [tuple(map(int, line.split())) for line in sys.stdin.readlines()]
ab.sort(key=lambda x: x[1])
ans = 0
last = -1
for a, b in ab:
if a < last:
continue
else:
ans += 1
last = b
print(ans)
| false | 0 | [
"-ab = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]",
"+ab = [tuple(map(int, line.split())) for line in sys.stdin.readlines()]"
] | false | 0.099277 | 0.038285 | 2.593114 | [
"s001761181",
"s081005678"
] |
u731436822 | p02584 | python | s029837668 | s710016880 | 30 | 27 | 9,180 | 9,088 | Accepted | Accepted | 10 | # ABC172ใC - Walking Takahashi
X,K,D=list(map(int,input().split()))
q=abs(X)//D
if q>K:
print((abs(X)-K*D))
else:
if (K-q)%2==0:
print((abs(X)-q*D))
else:
print((abs(abs(X)-(q+1)*D))) | # ABC172ใC - Walking Takahashi
X,K,D=list(map(int,input().split()))
X=abs(X)
q=X//D
if q>K:
print((X-K*D))
else:
if (K-q)%2==0:
print((X-q*D))
else:
print((-X+(q+1)*D)) | 11 | 12 | 210 | 196 | # ABC172ใC - Walking Takahashi
X, K, D = list(map(int, input().split()))
q = abs(X) // D
if q > K:
print((abs(X) - K * D))
else:
if (K - q) % 2 == 0:
print((abs(X) - q * D))
else:
print((abs(abs(X) - (q + 1) * D)))
| # ABC172ใC - Walking Takahashi
X, K, D = list(map(int, input().split()))
X = abs(X)
q = X // D
if q > K:
print((X - K * D))
else:
if (K - q) % 2 == 0:
print((X - q * D))
else:
print((-X + (q + 1) * D))
| false | 8.333333 | [
"-q = abs(X) // D",
"+X = abs(X)",
"+q = X // D",
"- print((abs(X) - K * D))",
"+ print((X - K * D))",
"- print((abs(X) - q * D))",
"+ print((X - q * D))",
"- print((abs(abs(X) - (q + 1) * D)))",
"+ print((-X + (q + 1) * D))"
] | false | 0.04297 | 0.042762 | 1.004868 | [
"s029837668",
"s710016880"
] |
u529012223 | p03137 | python | s204144101 | s824754347 | 261 | 191 | 23,000 | 23,052 | Accepted | Accepted | 26.82 | import numpy as np
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X_sort = np.array(sorted(X))[::-1]
X_diff = X_sort[:M-1] - X_sort[1:]
X_diff_sort = sorted(X_diff)[::-1]
print((max(sum(X_diff_sort[N-1:]), 0))) | import numpy as np
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X = np.array(X)
X_sorted = np.sort(X)[::-1]
X_diff = X_sorted[:-1] - X_sorted[1:]
X_diff_sorted = np.sort(X_diff)[::-1]
print((X_sorted[0] - X_sorted[-1] - X_diff_sorted[:N-1].sum())) | 10 | 11 | 242 | 282 | import numpy as np
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X_sort = np.array(sorted(X))[::-1]
X_diff = X_sort[: M - 1] - X_sort[1:]
X_diff_sort = sorted(X_diff)[::-1]
print((max(sum(X_diff_sort[N - 1 :]), 0)))
| import numpy as np
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X = np.array(X)
X_sorted = np.sort(X)[::-1]
X_diff = X_sorted[:-1] - X_sorted[1:]
X_diff_sorted = np.sort(X_diff)[::-1]
print((X_sorted[0] - X_sorted[-1] - X_diff_sorted[: N - 1].sum()))
| false | 9.090909 | [
"-X_sort = np.array(sorted(X))[::-1]",
"-X_diff = X_sort[: M - 1] - X_sort[1:]",
"-X_diff_sort = sorted(X_diff)[::-1]",
"-print((max(sum(X_diff_sort[N - 1 :]), 0)))",
"+X = np.array(X)",
"+X_sorted = np.sort(X)[::-1]",
"+X_diff = X_sorted[:-1] - X_sorted[1:]",
"+X_diff_sorted = np.sort(X_diff)[::-1]",... | false | 0.203263 | 0.285555 | 0.711819 | [
"s204144101",
"s824754347"
] |
u644907318 | p04021 | python | s593176328 | s257083757 | 694 | 271 | 66,264 | 89,248 | Accepted | Accepted | 60.95 | N = int(eval(input()))
A = sorted(list({int(eval(input())):i for i in range(N)}.items()),key=lambda x:x[0])
cnt = 0
for i in range(N):
j = A[i][1]
if i%2!=j%2:
cnt += 1
print((cnt//2)) | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A = [(A[i],i) for i in range(N)]
A = sorted(A,key=lambda x:x[0])
cnt = 0
for i in range(N):
a,j = A[i]
if (i-j)%2==1:
cnt += 1
print((cnt//2)) | 8 | 10 | 193 | 219 | N = int(eval(input()))
A = sorted(list({int(eval(input())): i for i in range(N)}.items()), key=lambda x: x[0])
cnt = 0
for i in range(N):
j = A[i][1]
if i % 2 != j % 2:
cnt += 1
print((cnt // 2))
| N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A = [(A[i], i) for i in range(N)]
A = sorted(A, key=lambda x: x[0])
cnt = 0
for i in range(N):
a, j = A[i]
if (i - j) % 2 == 1:
cnt += 1
print((cnt // 2))
| false | 20 | [
"-A = sorted(list({int(eval(input())): i for i in range(N)}.items()), key=lambda x: x[0])",
"+A = [int(eval(input())) for _ in range(N)]",
"+A = [(A[i], i) for i in range(N)]",
"+A = sorted(A, key=lambda x: x[0])",
"- j = A[i][1]",
"- if i % 2 != j % 2:",
"+ a, j = A[i]",
"+ if (i - j) % 2... | false | 0.043491 | 0.043678 | 0.995715 | [
"s593176328",
"s257083757"
] |
u647766105 | p00478 | python | s079551761 | s297543281 | 20 | 10 | 4,204 | 4,200 | Accepted | Accepted | 50 | s = input()
score = 0
for u in range(eval(input())):
ss = input()
if len((ss+ss).split(s)) > 1:
score += 1
print(score) | s = input()
score = 0
for u in range(eval(input())):
ss = input()
if s in ss*2:
score += 1
print(score) | 7 | 7 | 143 | 127 | s = input()
score = 0
for u in range(eval(input())):
ss = input()
if len((ss + ss).split(s)) > 1:
score += 1
print(score)
| s = input()
score = 0
for u in range(eval(input())):
ss = input()
if s in ss * 2:
score += 1
print(score)
| false | 0 | [
"- if len((ss + ss).split(s)) > 1:",
"+ if s in ss * 2:"
] | false | 0.050838 | 0.048063 | 1.057744 | [
"s079551761",
"s297543281"
] |
u531631168 | p03785 | python | s662479734 | s369589235 | 379 | 177 | 20,828 | 14,040 | Accepted | Accepted | 53.3 | from collections import Counter
n, c, k = list(map(int, input().split()))
time_people = Counter([int(eval(input())) for _ in range(n)])
times = sorted(time_people.keys())
ans = 0
left = 0
right = 0
while time_people[times[-1]] > 0:
space = c
while times[left] + k >= times[right] and space > 0:
... | n, c, k = list(map(int, input().split()))
T = sorted([int(eval(input())) for _ in range(n)])
ans = 1
first = T[0]
pas = 0
for t in T:
pas += 1
if t > first + k or pas > c:
ans += 1
pas = 1
first = t
print(ans) | 23 | 12 | 731 | 240 | from collections import Counter
n, c, k = list(map(int, input().split()))
time_people = Counter([int(eval(input())) for _ in range(n)])
times = sorted(time_people.keys())
ans = 0
left = 0
right = 0
while time_people[times[-1]] > 0:
space = c
while times[left] + k >= times[right] and space > 0:
new_pass... | n, c, k = list(map(int, input().split()))
T = sorted([int(eval(input())) for _ in range(n)])
ans = 1
first = T[0]
pas = 0
for t in T:
pas += 1
if t > first + k or pas > c:
ans += 1
pas = 1
first = t
print(ans)
| false | 47.826087 | [
"-from collections import Counter",
"-",
"-time_people = Counter([int(eval(input())) for _ in range(n)])",
"-times = sorted(time_people.keys())",
"-ans = 0",
"-left = 0",
"-right = 0",
"-while time_people[times[-1]] > 0:",
"- space = c",
"- while times[left] + k >= times[right] and space > 0... | false | 0.047794 | 0.04819 | 0.991768 | [
"s662479734",
"s369589235"
] |
u392319141 | p02703 | python | s626912517 | s064481548 | 1,833 | 906 | 100,460 | 25,864 | Accepted | Accepted | 50.57 | from heapq import heappush, heappop
N, M, S = list(map(int, input().split()))
mxCost = 0
edges = [[] for _ in range(N)]
for _ in range(M):
fr, to, cost, dist = list(map(int, input().split()))
mxCost = max(mxCost, cost)
fr -= 1
to -= 1
edges[fr].append((to, dist, cost))
edges[to].ap... | from heapq import heappush, heappop
N, M, S = list(map(int, input().split()))
mxCost = 0
edges = [[] for _ in range(N)]
for _ in range(M):
fr, to, cost, dist = list(map(int, input().split()))
mxCost = max(mxCost, cost)
fr -= 1
to -= 1
edges[fr].append((to, dist, cost))
edges[to].ap... | 35 | 35 | 862 | 865 | from heapq import heappush, heappop
N, M, S = list(map(int, input().split()))
mxCost = 0
edges = [[] for _ in range(N)]
for _ in range(M):
fr, to, cost, dist = list(map(int, input().split()))
mxCost = max(mxCost, cost)
fr -= 1
to -= 1
edges[fr].append((to, dist, cost))
edges[to].append((fr, dis... | from heapq import heappush, heappop
N, M, S = list(map(int, input().split()))
mxCost = 0
edges = [[] for _ in range(N)]
for _ in range(M):
fr, to, cost, dist = list(map(int, input().split()))
mxCost = max(mxCost, cost)
fr -= 1
to -= 1
edges[fr].append((to, dist, cost))
edges[to].append((fr, dis... | false | 0 | [
"- que.append((dist + d, cost, to))",
"+ heappush(que, (dist + d, cost, to))"
] | false | 0.222304 | 0.054643 | 4.068284 | [
"s626912517",
"s064481548"
] |
u133936772 | p02971 | python | s832310737 | s716543313 | 609 | 166 | 14,112 | 18,908 | Accepted | Accepted | 72.74 | n=int(eval(input()))
l=[int(eval(input())) for _ in range(n)]
s=sorted(l)
a,b=s[-1],s[-2]
for i in l: print(([b,a][a>i])) | n,*l=list(map(int,open(0)))
s=sorted(l)
for i in l: print((s[(i<s[-1])-2])) | 5 | 3 | 111 | 69 | n = int(eval(input()))
l = [int(eval(input())) for _ in range(n)]
s = sorted(l)
a, b = s[-1], s[-2]
for i in l:
print(([b, a][a > i]))
| n, *l = list(map(int, open(0)))
s = sorted(l)
for i in l:
print((s[(i < s[-1]) - 2]))
| false | 40 | [
"-n = int(eval(input()))",
"-l = [int(eval(input())) for _ in range(n)]",
"+n, *l = list(map(int, open(0)))",
"-a, b = s[-1], s[-2]",
"- print(([b, a][a > i]))",
"+ print((s[(i < s[-1]) - 2]))"
] | false | 0.118304 | 0.049209 | 2.404109 | [
"s832310737",
"s716543313"
] |
u780475861 | p02971 | python | s261401237 | s716314688 | 171 | 126 | 25,148 | 25,136 | Accepted | Accepted | 26.32 | import sys
def main():
n, *lst = map(int, sys.stdin.read().split())
max1 = max(lst)
idx = lst.index(max1)
max2 = max(lst[:idx] + lst[idx+1:])
if max2 < max1:
print(*[max1 if j != max1 else max2 for j in lst], sep='\n')
else:
print(*[max1]*n, sep='\n')
if __name__ == '__main__':... | import sys
def main():
n, *lst = list(map(int, sys.stdin.read().split()))
max1 = max(lst)
idx = lst.index(max1)
max2 = max(lst[:idx] + lst[idx+1:])
print(('\n'.join(str(max1) if j != max1 else str(max2) for j in lst)))
if __name__ == '__main__':
main()
| 16 | 13 | 331 | 273 | import sys
def main():
n, *lst = map(int, sys.stdin.read().split())
max1 = max(lst)
idx = lst.index(max1)
max2 = max(lst[:idx] + lst[idx + 1 :])
if max2 < max1:
print(*[max1 if j != max1 else max2 for j in lst], sep="\n")
else:
print(*[max1] * n, sep="\n")
if __name__ == "__m... | import sys
def main():
n, *lst = list(map(int, sys.stdin.read().split()))
max1 = max(lst)
idx = lst.index(max1)
max2 = max(lst[:idx] + lst[idx + 1 :])
print(("\n".join(str(max1) if j != max1 else str(max2) for j in lst)))
if __name__ == "__main__":
main()
| false | 18.75 | [
"- n, *lst = map(int, sys.stdin.read().split())",
"+ n, *lst = list(map(int, sys.stdin.read().split()))",
"- if max2 < max1:",
"- print(*[max1 if j != max1 else max2 for j in lst], sep=\"\\n\")",
"- else:",
"- print(*[max1] * n, sep=\"\\n\")",
"+ print((\"\\n\".join(str(max1... | false | 0.070115 | 0.038202 | 1.835391 | [
"s261401237",
"s716314688"
] |
u497596438 | p03261 | python | s030402570 | s423154446 | 185 | 169 | 38,384 | 38,492 | Accepted | Accepted | 8.65 | #S=input()
N=int(eval(input()))
#N,M,X,Y=map(int,input().split())
W=[]
can=True
for i in range(N):
w=eval(input())
if i==0:
W.append(w)
e=w[-1]
continue
s=w[0]
if e==s and not(w in W):
W.append(w)
e=w[-1]
continue
else:
can=Fal... | N=int(eval(input()))
N-=1
w=eval(input())
f=w[-1]
word={w}
for i in range(N):
w=eval(input())
ini=w[0]
if w in word:
print("No")
quit()
if ini!=f:
print("No")
quit()
word.add(w)
f=w[-1]
print("Yes")
| 23 | 17 | 376 | 253 | # S=input()
N = int(eval(input()))
# N,M,X,Y=map(int,input().split())
W = []
can = True
for i in range(N):
w = eval(input())
if i == 0:
W.append(w)
e = w[-1]
continue
s = w[0]
if e == s and not (w in W):
W.append(w)
e = w[-1]
continue
else:
can... | N = int(eval(input()))
N -= 1
w = eval(input())
f = w[-1]
word = {w}
for i in range(N):
w = eval(input())
ini = w[0]
if w in word:
print("No")
quit()
if ini != f:
print("No")
quit()
word.add(w)
f = w[-1]
print("Yes")
| false | 26.086957 | [
"-# S=input()",
"-# N,M,X,Y=map(int,input().split())",
"-W = []",
"-can = True",
"+N -= 1",
"+w = eval(input())",
"+f = w[-1]",
"+word = {w}",
"- if i == 0:",
"- W.append(w)",
"- e = w[-1]",
"- continue",
"- s = w[0]",
"- if e == s and not (w in W):",
"- ... | false | 0.044072 | 0.044197 | 0.997182 | [
"s030402570",
"s423154446"
] |
u025501820 | p02888 | python | s594526292 | s794385702 | 1,673 | 513 | 3,188 | 44,268 | Accepted | Accepted | 69.34 | import math
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
ans = 0
for a in range(N - 2):
b = a + 1
c = a + 2
while c < N and b < N - 1:
if L[c] >= L[a] + L[b]:
ans += c - 1 - b
b += 1
if b == c:
c += 1
... | N = int(eval(input()))
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(0, N - 2):
a = L[i]
for j in range(i + 1, N - 1):
b = L[j]
ok = j + 1
ng = N - 1
if L[ng] < a + b:
ans += ng - j
continue
if L[ok] >= a + b:
... | 23 | 22 | 495 | 522 | import math
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
ans = 0
for a in range(N - 2):
b = a + 1
c = a + 2
while c < N and b < N - 1:
if L[c] >= L[a] + L[b]:
ans += c - 1 - b
b += 1
if b == c:
c += 1
else:
... | N = int(eval(input()))
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(0, N - 2):
a = L[i]
for j in range(i + 1, N - 1):
b = L[j]
ok = j + 1
ng = N - 1
if L[ng] < a + b:
ans += ng - j
continue
if L[ok] >= a + b:
conti... | false | 4.347826 | [
"-import math",
"-",
"-for a in range(N - 2):",
"- b = a + 1",
"- c = a + 2",
"- while c < N and b < N - 1:",
"- if L[c] >= L[a] + L[b]:",
"- ans += c - 1 - b",
"- b += 1",
"- if b == c:",
"- c += 1",
"- else:",
"- ... | false | 0.036355 | 0.06199 | 0.586457 | [
"s594526292",
"s794385702"
] |
u556589653 | p02718 | python | s995518900 | s546511971 | 36 | 33 | 9,856 | 9,924 | Accepted | Accepted | 8.33 | from decimal import Decimal
n,m = list(map(int,input().split()))
A = list(map(int,input().split()))
border = float(sum(A)*(1/(4*m)))
border2 = str(border)
border3 = Decimal(border2)
ans = 0
judge = 0
for i in range(n):
if A[i] >= border3:
ans+=1
if ans >= m:
print("Yes")
else:
print("No") | from decimal import Decimal
n,m = list(map(int,input().split()))
A = list(map(int,input().split()))
border = float(sum(A)/(4*m))
border2 = str(border)
border3 = Decimal(border2)
ans = 0
judge = 0
for i in range(n):
if A[i] >= border3:
ans+=1
if ans >= m:
print("Yes")
else:
print("No")
| 15 | 15 | 307 | 304 | from decimal import Decimal
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
border = float(sum(A) * (1 / (4 * m)))
border2 = str(border)
border3 = Decimal(border2)
ans = 0
judge = 0
for i in range(n):
if A[i] >= border3:
ans += 1
if ans >= m:
print("Yes")
else:
print("No"... | from decimal import Decimal
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
border = float(sum(A) / (4 * m))
border2 = str(border)
border3 = Decimal(border2)
ans = 0
judge = 0
for i in range(n):
if A[i] >= border3:
ans += 1
if ans >= m:
print("Yes")
else:
print("No")
| false | 0 | [
"-border = float(sum(A) * (1 / (4 * m)))",
"+border = float(sum(A) / (4 * m))"
] | false | 0.048757 | 0.04799 | 1.015991 | [
"s995518900",
"s546511971"
] |
u467736898 | p02710 | python | s475322823 | s175012409 | 783 | 556 | 98,808 | 100,864 | Accepted | Accepted | 28.99 | # tolist ใคใๅฟใ
# https://atcoder.jp/contests/abc163/submissions/16271142
def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
... | # ๅ
ฅๅใฎใฟ
# ๅ
ฅๅใใใๆใใซ
def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
... | 99 | 103 | 3,040 | 3,022 | # tolist ใคใๅฟใ
# https://atcoder.jp/contests/abc163/submissions/16271142
def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
glob... | # ๅ
ฅๅใฎใฟ
# ๅ
ฅๅใใใๆใใซ
def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
... | false | 3.883495 | [
"-# tolist ใคใๅฟใ",
"-# https://atcoder.jp/contests/abc163/submissions/16271142",
"+# ๅ
ฅๅใฎใฟ",
"+# ๅ
ฅๅใใใๆใใซ",
"-input = sys.stdin.buffer.readline",
"-sys.setrecursionlimit(505050)",
"-N = int(input())",
"-C = np.array([\"0\"] + input().split(), dtype=np.int64)",
"-AB = np.array([list(map(int, input().sp... | false | 0.239312 | 0.301443 | 0.793888 | [
"s475322823",
"s175012409"
] |
u981931040 | p03545 | python | s064223422 | s297512702 | 164 | 20 | 38,256 | 3,064 | Accepted | Accepted | 87.8 | S = eval(input())
for i in range(2 ** len(S) - 1):
work = S
for j in range(1 ,len(S)):
if i >> (j - 1) & 1:
work = work[:2 * j - 1] + "+" + work[2 * j - 1:]
else:
work = work[:2 * j - 1] + "-" + work[2 * j - 1:]
if eval(work) == 7:
print(("{0}=7".form... | N = list(input())
num = list(map(lambda x: int(x) , N))
for i in range(8):
sum_val = num[0]
for j in range(3):
if i >> j & 1:
sum_val += num[j + 1]
else:
sum_val -= num[j + 1]
if sum_val == 7:
print(num[0] , end = '')
for j in range(3):
... | 11 | 19 | 338 | 518 | S = eval(input())
for i in range(2 ** len(S) - 1):
work = S
for j in range(1, len(S)):
if i >> (j - 1) & 1:
work = work[: 2 * j - 1] + "+" + work[2 * j - 1 :]
else:
work = work[: 2 * j - 1] + "-" + work[2 * j - 1 :]
if eval(work) == 7:
print(("{0}=7".format(wo... | N = list(input())
num = list(map(lambda x: int(x), N))
for i in range(8):
sum_val = num[0]
for j in range(3):
if i >> j & 1:
sum_val += num[j + 1]
else:
sum_val -= num[j + 1]
if sum_val == 7:
print(num[0], end="")
for j in range(3):
if i >>... | false | 42.105263 | [
"-S = eval(input())",
"-for i in range(2 ** len(S) - 1):",
"- work = S",
"- for j in range(1, len(S)):",
"- if i >> (j - 1) & 1:",
"- work = work[: 2 * j - 1] + \"+\" + work[2 * j - 1 :]",
"+N = list(input())",
"+num = list(map(lambda x: int(x), N))",
"+for i in range(8):",
... | false | 0.062416 | 0.121564 | 0.513445 | [
"s064223422",
"s297512702"
] |
u922901775 | p03566 | python | s110753832 | s380963858 | 1,991 | 1,150 | 15,232 | 46,484 | Accepted | Accepted | 42.24 | #!/usr/bin/env python3
import sys
import numpy as np
def solve(N: int, T: "List[int]", V: "List[int]"):
t_period = [0 for i in range(N+1)]
for i in range(N):
t_period[i+1] = t_period[i] + T[i]*2
limit = np.zeros((t_period[N]+1,))
for i in range(1, N):
limit[t_period[i]] = ... | #!/usr/bin/env python3
import sys
import numpy as np
def solve(N: int, T: "List[int]", V: "List[int]"):
t_period = [0 for i in range(N+1)]
for i in range(N):
t_period[i+1] = t_period[i] + T[i]*2
V = [0] + V + [0]
limit = np.zeros((N+2,t_period[N]+1))
line = np.arange(0, t_peri... | 47 | 46 | 1,400 | 1,384 | #!/usr/bin/env python3
import sys
import numpy as np
def solve(N: int, T: "List[int]", V: "List[int]"):
t_period = [0 for i in range(N + 1)]
for i in range(N):
t_period[i + 1] = t_period[i] + T[i] * 2
limit = np.zeros((t_period[N] + 1,))
for i in range(1, N):
limit[t_period[i]] = min((... | #!/usr/bin/env python3
import sys
import numpy as np
def solve(N: int, T: "List[int]", V: "List[int]"):
t_period = [0 for i in range(N + 1)]
for i in range(N):
t_period[i + 1] = t_period[i] + T[i] * 2
V = [0] + V + [0]
limit = np.zeros((N + 2, t_period[N] + 1))
line = np.arange(0, t_period... | false | 2.12766 | [
"- limit = np.zeros((t_period[N] + 1,))",
"- for i in range(1, N):",
"- limit[t_period[i]] = min((V[i - 1], V[i]))",
"- for i in range(N):",
"- limit[t_period[i] + 1 : t_period[i + 1]] = V[i]",
"- speed = np.zeros((t_period[N] + 1,))",
"- for v in range(1, 201):",
"- ... | false | 0.497525 | 0.549498 | 0.905418 | [
"s110753832",
"s380963858"
] |
u131811591 | p02376 | python | s478735245 | s153730840 | 50 | 30 | 6,336 | 6,336 | Accepted | Accepted | 40 | import sys
from collections import deque
class MaxFlow:
class Edge:
def __init__(self, to, cap, rev):
self.to, self.cap, self.rev = to, cap, rev
def __init__(self, node_size, inf):
self._node = node_size
self._inf = inf
self._level = [-1]*self._node
... | import sys
from collections import deque
class MaxFlow:
class Edge:
def __init__(self, to, cap, rev):
self.to, self.cap, self.rev = to, cap, rev
def __init__(self, node_size, inf):
self._node = node_size
self._inf = inf
self._level = [-1]*self._node
... | 71 | 66 | 2,292 | 2,275 | import sys
from collections import deque
class MaxFlow:
class Edge:
def __init__(self, to, cap, rev):
self.to, self.cap, self.rev = to, cap, rev
def __init__(self, node_size, inf):
self._node = node_size
self._inf = inf
self._level = [-1] * self._node
self.... | import sys
from collections import deque
class MaxFlow:
class Edge:
def __init__(self, to, cap, rev):
self.to, self.cap, self.rev = to, cap, rev
def __init__(self, node_size, inf):
self._node = node_size
self._inf = inf
self._level = [-1] * self._node
self.... | false | 7.042254 | [
"- for i in range(self._node):",
"- self._level[i] = -1",
"+ self._level = [-1] * self._node",
"- if self._level[e.to] < 0 < e.cap:",
"+ if e.cap > 0 > self._level[e.to]:",
"- for e in self._graph[cur_vertex][",
"- self._iter[cur_v... | false | 0.036992 | 0.036902 | 1.002419 | [
"s478735245",
"s153730840"
] |
u884323674 | p03835 | python | s494630950 | s746312534 | 1,669 | 1,212 | 3,060 | 9,036 | Accepted | Accepted | 27.38 | K, S = list(map(int, input().split()))
count = 0
for i in range(K+1):
for j in range(K+1):
k = S - (i + j)
if 0 <= k <= K:
count += 1
print(count) | K, S = list(map(int, input().split()))
ans = 0
for x in range(K+1):
for y in range(K+1):
z = S- (x + y)
if 0 <= z <= K:
ans += 1
print(ans) | 10 | 10 | 195 | 176 | K, S = list(map(int, input().split()))
count = 0
for i in range(K + 1):
for j in range(K + 1):
k = S - (i + j)
if 0 <= k <= K:
count += 1
print(count)
| K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - (x + y)
if 0 <= z <= K:
ans += 1
print(ans)
| false | 0 | [
"-count = 0",
"-for i in range(K + 1):",
"- for j in range(K + 1):",
"- k = S - (i + j)",
"- if 0 <= k <= K:",
"- count += 1",
"-print(count)",
"+ans = 0",
"+for x in range(K + 1):",
"+ for y in range(K + 1):",
"+ z = S - (x + y)",
"+ if 0 <= z <= K... | false | 0.040283 | 0.035976 | 1.119734 | [
"s494630950",
"s746312534"
] |
u256868077 | p03826 | python | s436099247 | s928552986 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | a,b,c,d=list(map(int,input().split()))
if a*b >= c*d:
print((a*b))
else:
print((c*d)) | a,b,c,d=list(map(int,input().split()))
print((max(a*b,c*d)))
| 5 | 2 | 83 | 54 | a, b, c, d = list(map(int, input().split()))
if a * b >= c * d:
print((a * b))
else:
print((c * d))
| a, b, c, d = list(map(int, input().split()))
print((max(a * b, c * d)))
| false | 60 | [
"-if a * b >= c * d:",
"- print((a * b))",
"-else:",
"- print((c * d))",
"+print((max(a * b, c * d)))"
] | false | 0.034276 | 0.037409 | 0.916251 | [
"s436099247",
"s928552986"
] |
u644907318 | p03659 | python | s336880278 | s053586378 | 218 | 128 | 24,832 | 100,536 | Accepted | Accepted | 41.28 | N = int(eval(input()))
A = list(map(int,input().split()))
B = [0]
for i in range(N):
B.append(B[i]+A[i])
dmin = 10**15
for i in range(1,N):
dmin = min(dmin,abs(B[N]-2*B[i]))
print(dmin) | N = int(eval(input()))
A = list(map(int,input().split()))
B = [0 for _ in range(N+1)]
for i in range(1,N+1):
B[i] = B[i-1]+A[i-1]
cmin = 10**15
for i in range(1,N):
cmin = min(cmin,abs(2*B[i]-B[N]))
print(cmin) | 9 | 9 | 195 | 220 | N = int(eval(input()))
A = list(map(int, input().split()))
B = [0]
for i in range(N):
B.append(B[i] + A[i])
dmin = 10**15
for i in range(1, N):
dmin = min(dmin, abs(B[N] - 2 * B[i]))
print(dmin)
| N = int(eval(input()))
A = list(map(int, input().split()))
B = [0 for _ in range(N + 1)]
for i in range(1, N + 1):
B[i] = B[i - 1] + A[i - 1]
cmin = 10**15
for i in range(1, N):
cmin = min(cmin, abs(2 * B[i] - B[N]))
print(cmin)
| false | 0 | [
"-B = [0]",
"-for i in range(N):",
"- B.append(B[i] + A[i])",
"-dmin = 10**15",
"+B = [0 for _ in range(N + 1)]",
"+for i in range(1, N + 1):",
"+ B[i] = B[i - 1] + A[i - 1]",
"+cmin = 10**15",
"- dmin = min(dmin, abs(B[N] - 2 * B[i]))",
"-print(dmin)",
"+ cmin = min(cmin, abs(2 * B[... | false | 0.042058 | 0.04212 | 0.998537 | [
"s336880278",
"s053586378"
] |
u925626880 | p03448 | python | s726194290 | s898553298 | 45 | 32 | 3,060 | 3,060 | Accepted | Accepted | 28.89 | a = int(eval(input())) # 500
b = int(eval(input())) # 100
c = int(eval(input())) # 50
x = int(eval(input()))
ans = 0
for i in range(a+1):
I = i*500
for j in range(b+1):
J = j*100
for k in range(c+1):
K = k*50
if I+J+K == x:
ans +=1
prin... | def main():
a = int(eval(input())) # 500
b = int(eval(input())) # 100
c = int(eval(input())) # 50
x = int(eval(input()))
ans = 0
for i in range(a+1):
I = i*500
for j in range(b+1):
J = j*100
for k in range(c+1):
K = k*50
... | 17 | 21 | 303 | 414 | a = int(eval(input())) # 500
b = int(eval(input())) # 100
c = int(eval(input())) # 50
x = int(eval(input()))
ans = 0
for i in range(a + 1):
I = i * 500
for j in range(b + 1):
J = j * 100
for k in range(c + 1):
K = k * 50
if I + J + K == x:
ans += 1
pri... | def main():
a = int(eval(input())) # 500
b = int(eval(input())) # 100
c = int(eval(input())) # 50
x = int(eval(input()))
ans = 0
for i in range(a + 1):
I = i * 500
for j in range(b + 1):
J = j * 100
for k in range(c + 1):
K = k * 50
... | false | 19.047619 | [
"-a = int(eval(input())) # 500",
"-b = int(eval(input())) # 100",
"-c = int(eval(input())) # 50",
"-x = int(eval(input()))",
"-ans = 0",
"-for i in range(a + 1):",
"- I = i * 500",
"- for j in range(b + 1):",
"- J = j * 100",
"- for k in range(c + 1):",
"- K = ... | false | 0.110822 | 0.007733 | 14.331065 | [
"s726194290",
"s898553298"
] |
u347640436 | p03074 | python | s391351887 | s185087598 | 109 | 74 | 5,152 | 7,164 | Accepted | Accepted | 32.11 | # ใใใใจใๆณ
N, K = list(map(int, input().split()))
S = list(map(int, eval(input())))
j = 1
r = 0
t = []
for i in range(N):
if S[i] == j:
r += 1
else:
t.append(r)
r = 1
j ^= 1
t.append(r)
if j == 0:
t.append(0)
if K >= (len(t) - 1) // 2:
print((sum(t)))
... | # ็ดฏ็ฉๅ
from sys import exit
N, K = list(map(int, input().split()))
S = eval(input())
p = '1'
count = 0
cs = []
for c in S:
if c != p:
cs.append(count)
p = c
count = 1
else:
count += 1
cs.append(count)
if p == '0':
cs.append(0)
if len(cs) < 2 * K:
print(N)
exit()
for ... | 29 | 33 | 541 | 498 | # ใใใใจใๆณ
N, K = list(map(int, input().split()))
S = list(map(int, eval(input())))
j = 1
r = 0
t = []
for i in range(N):
if S[i] == j:
r += 1
else:
t.append(r)
r = 1
j ^= 1
t.append(r)
if j == 0:
t.append(0)
if K >= (len(t) - 1) // 2:
print((sum(t)))
else:
result = sum... | # ็ดฏ็ฉๅ
from sys import exit
N, K = list(map(int, input().split()))
S = eval(input())
p = "1"
count = 0
cs = []
for c in S:
if c != p:
cs.append(count)
p = c
count = 1
else:
count += 1
cs.append(count)
if p == "0":
cs.append(0)
if len(cs) < 2 * K:
print(N)
exit()
for i... | false | 12.121212 | [
"-# ใใใใจใๆณ",
"+# ็ดฏ็ฉๅ",
"+from sys import exit",
"+",
"-S = list(map(int, eval(input())))",
"-j = 1",
"-r = 0",
"-t = []",
"-for i in range(N):",
"- if S[i] == j:",
"- r += 1",
"+S = eval(input())",
"+p = \"1\"",
"+count = 0",
"+cs = []",
"+for c in S:",
"+ if c != p:",
... | false | 0.007023 | 0.061453 | 0.114277 | [
"s391351887",
"s185087598"
] |
u186206732 | p03162 | python | s664164970 | s935693074 | 444 | 399 | 14,980 | 14,996 | Accepted | Accepted | 10.14 | n = int(eval(input()))
a = [0]
b = [0]
c = [0]
for i in range(n):
aa,bb,cc = list(map(int,input().split()))
a.append(max(b[i] + aa, c[i] + aa))
b.append(max(a[i] + bb, c[i] + bb))
c.append(max(a[i] + cc, b[i] + cc))
print((max(a[-1], b[-1], c[-1])))
| def main():
n = int(eval(input()))
a = [0]
b = [0]
c = [0]
for i in range(n):
aa,bb,cc = list(map(int,input().split()))
a.append(max(b[i] + aa, c[i] + aa))
b.append(max(a[i] + bb, c[i] + bb))
c.append(max(a[i] + cc, b[i] + cc))
print((max(a[-1], b[-1], c[-1])))
main(... | 12 | 15 | 269 | 307 | n = int(eval(input()))
a = [0]
b = [0]
c = [0]
for i in range(n):
aa, bb, cc = list(map(int, input().split()))
a.append(max(b[i] + aa, c[i] + aa))
b.append(max(a[i] + bb, c[i] + bb))
c.append(max(a[i] + cc, b[i] + cc))
print((max(a[-1], b[-1], c[-1])))
| def main():
n = int(eval(input()))
a = [0]
b = [0]
c = [0]
for i in range(n):
aa, bb, cc = list(map(int, input().split()))
a.append(max(b[i] + aa, c[i] + aa))
b.append(max(a[i] + bb, c[i] + bb))
c.append(max(a[i] + cc, b[i] + cc))
print((max(a[-1], b[-1], c[-1])))... | false | 20 | [
"-n = int(eval(input()))",
"-a = [0]",
"-b = [0]",
"-c = [0]",
"-for i in range(n):",
"- aa, bb, cc = list(map(int, input().split()))",
"- a.append(max(b[i] + aa, c[i] + aa))",
"- b.append(max(a[i] + bb, c[i] + bb))",
"- c.append(max(a[i] + cc, b[i] + cc))",
"-print((max(a[-1], b[-1], ... | false | 0.09441 | 0.068737 | 1.373503 | [
"s664164970",
"s935693074"
] |
u436484848 | p04006 | python | s487233596 | s061936492 | 754 | 662 | 3,316 | 3,316 | Accepted | Accepted | 12.2 | def read():
return [int(i) for i in input().split(" ")]
N, x = read()
A = read()
ans = sum(A)
tempcost = ans
BC = A[:]
for i in range(1, N):
BC = [BC[j - 1] if BC[j - 1] < BC[j] else BC[j] for j in range(N)]
tempcost = x * i + sum(BC)
if(ans > tempcost):
ans = tempcost
else:
break
print(ans)
| def read():
return [int(i) for i in input().split(" ")]
N, x = read()
A = read()
ans = sum(A)
tempcost = ans
BC = A[:]
xt = 0
for i in range(1, N):
xt += x
BC = [BC[j - 1] if BC[j - 1] < BC[j] else BC[j] for j in range(N)]
tempcost = xt + sum(BC)
if(ans > tempcost):
ans = tempcost
else:
break
... | 15 | 17 | 317 | 332 | def read():
return [int(i) for i in input().split(" ")]
N, x = read()
A = read()
ans = sum(A)
tempcost = ans
BC = A[:]
for i in range(1, N):
BC = [BC[j - 1] if BC[j - 1] < BC[j] else BC[j] for j in range(N)]
tempcost = x * i + sum(BC)
if ans > tempcost:
ans = tempcost
else:
break
p... | def read():
return [int(i) for i in input().split(" ")]
N, x = read()
A = read()
ans = sum(A)
tempcost = ans
BC = A[:]
xt = 0
for i in range(1, N):
xt += x
BC = [BC[j - 1] if BC[j - 1] < BC[j] else BC[j] for j in range(N)]
tempcost = xt + sum(BC)
if ans > tempcost:
ans = tempcost
else:... | false | 11.764706 | [
"+xt = 0",
"+ xt += x",
"- tempcost = x * i + sum(BC)",
"+ tempcost = xt + sum(BC)"
] | false | 0.11985 | 0.08744 | 1.370652 | [
"s487233596",
"s061936492"
] |
u808427016 | p03661 | python | s462563491 | s728101630 | 184 | 162 | 30,028 | 24,168 | Accepted | Accepted | 11.96 | import itertools
N = int(eval(input()))
A = [int(_) for _ in input().split()]
ts = list(itertools.accumulate(A))
total = ts[-1]
total_half = total / 2
r = sorted(ts[:-1], key=lambda x:abs(x - total_half))[0]
print((abs(total - r - r)))
| import itertools
N = int(eval(input()))
A = [int(_) for _ in input().split()]
ts = list(itertools.accumulate(A))
total = ts[-1]
r = list(itertools.accumulate((abs(total - t * 2) for t in ts[:-1]), min))[-1]
print(r)
| 11 | 11 | 241 | 224 | import itertools
N = int(eval(input()))
A = [int(_) for _ in input().split()]
ts = list(itertools.accumulate(A))
total = ts[-1]
total_half = total / 2
r = sorted(ts[:-1], key=lambda x: abs(x - total_half))[0]
print((abs(total - r - r)))
| import itertools
N = int(eval(input()))
A = [int(_) for _ in input().split()]
ts = list(itertools.accumulate(A))
total = ts[-1]
r = list(itertools.accumulate((abs(total - t * 2) for t in ts[:-1]), min))[-1]
print(r)
| false | 0 | [
"-total_half = total / 2",
"-r = sorted(ts[:-1], key=lambda x: abs(x - total_half))[0]",
"-print((abs(total - r - r)))",
"+r = list(itertools.accumulate((abs(total - t * 2) for t in ts[:-1]), min))[-1]",
"+print(r)"
] | false | 0.046609 | 0.047779 | 0.9755 | [
"s462563491",
"s728101630"
] |
u631277801 | p03503 | python | s290642478 | s238977588 | 282 | 60 | 3,064 | 3,064 | Accepted | Accepted | 78.72 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | 35 | 30 | 884 | 881 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 14.285714 | [
"-# bitๅ
จๆข็ดข",
"-ans = -float(\"inf\")",
"-for bit in range(1, 1 << 10):",
"- profit = 0",
"- for i, fi in enumerate(f):",
"- both = 0",
"- for mask in range(10):",
"- if bit & (1 << mask) and fi & (1 << mask):",
"- both += 1",
"- profit += p[i][b... | false | 0.103393 | 0.062793 | 1.646555 | [
"s290642478",
"s238977588"
] |
u259755734 | p02969 | python | s887254292 | s412079476 | 24 | 17 | 3,060 | 2,940 | Accepted | Accepted | 29.17 | print((3 * int(eval(input()))**2)) | r=int(eval(input()))
print((3*r*r)) | 1 | 2 | 26 | 28 | print((3 * int(eval(input())) ** 2))
| r = int(eval(input()))
print((3 * r * r))
| false | 50 | [
"-print((3 * int(eval(input())) ** 2))",
"+r = int(eval(input()))",
"+print((3 * r * r))"
] | false | 0.059167 | 0.037621 | 1.572727 | [
"s887254292",
"s412079476"
] |
u186838327 | p02820 | python | s041503090 | s577470949 | 95 | 79 | 3,444 | 68,828 | Accepted | Accepted | 16.84 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = str(eval(input()))
t_ = ''
ans = 0
for i in range(n):
if i < k:
if t[i] == 'r':
t_ += 'p'
ans += p
elif t[i] == 's':
t_ += 'r'
ans += r
else:
... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = str(eval(input()))
ans = 0
temp = [0]*n
for i in range(n):
if i <= k-1:
if t[i] == 'r':
ans += p
elif t[i] == 's':
ans += r
else:
ans += s
else:
... | 76 | 37 | 1,882 | 845 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = str(eval(input()))
t_ = ""
ans = 0
for i in range(n):
if i < k:
if t[i] == "r":
t_ += "p"
ans += p
elif t[i] == "s":
t_ += "r"
ans += r
else:
t_ +=... | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = str(eval(input()))
ans = 0
temp = [0] * n
for i in range(n):
if i <= k - 1:
if t[i] == "r":
ans += p
elif t[i] == "s":
ans += r
else:
ans += s
else:
if t[i - k... | false | 51.315789 | [
"-t_ = \"\"",
"+temp = [0] * n",
"- if i < k:",
"+ if i <= k - 1:",
"- t_ += \"p\"",
"- t_ += \"r\"",
"- t_ += \"s\"",
"- elif i + k <= n - 1:",
"- if t[i] == \"r\":",
"- if t_[i - k] != \"p\":",
"- t_ += \"p\"",
"+ ... | false | 0.037133 | 0.037167 | 0.99909 | [
"s041503090",
"s577470949"
] |
u634046173 | p03687 | python | s774811321 | s165046461 | 73 | 66 | 67,856 | 65,868 | Accepted | Accepted | 9.59 | import collections
s = eval(input())
ls = len(s)
c = collections.Counter(s)
mi = ls
valuePlaces = []
for v,k in list(c.items()):
co = 0
valuePlaces.clear()
for i in range(ls):
if s[i] == v:
valuePlaces.append(i)
ushiro = ls-valuePlaces[-1]-1
#print(ushiro,v)
max... | import collections
s = eval(input())
ls = len(s)
c = set(s)
mi = ls
valuePlaces = []
for v in c:
co = 0
valuePlaces.clear()
for i in range(ls):
if s[i] == v:
valuePlaces.append(i)
ushiro = ls-valuePlaces[-1]-1
maxLen = 0
len_vp = len(valuePlaces)
for i in r... | 29 | 24 | 621 | 546 | import collections
s = eval(input())
ls = len(s)
c = collections.Counter(s)
mi = ls
valuePlaces = []
for v, k in list(c.items()):
co = 0
valuePlaces.clear()
for i in range(ls):
if s[i] == v:
valuePlaces.append(i)
ushiro = ls - valuePlaces[-1] - 1
# print(ushiro,v)
maxLen = 0... | import collections
s = eval(input())
ls = len(s)
c = set(s)
mi = ls
valuePlaces = []
for v in c:
co = 0
valuePlaces.clear()
for i in range(ls):
if s[i] == v:
valuePlaces.append(i)
ushiro = ls - valuePlaces[-1] - 1
maxLen = 0
len_vp = len(valuePlaces)
for i in range(len_v... | false | 17.241379 | [
"-c = collections.Counter(s)",
"+c = set(s)",
"-for v, k in list(c.items()):",
"+for v in c:",
"- # print(ushiro,v)",
"- # print(len_vp)"
] | false | 0.042648 | 0.04105 | 1.038939 | [
"s774811321",
"s165046461"
] |
u350667455 | p02657 | python | s738140778 | s370425666 | 24 | 21 | 9,156 | 9,100 | Accepted | Accepted | 12.5 | A,B = list(map(int, input().split()))
print((A*B)) | A,B = input().split()
import math
A=int(A)
B=float(B)
print((math.floor(A*B))) | 2 | 5 | 43 | 80 | A, B = list(map(int, input().split()))
print((A * B))
| A, B = input().split()
import math
A = int(A)
B = float(B)
print((math.floor(A * B)))
| false | 60 | [
"-A, B = list(map(int, input().split()))",
"-print((A * B))",
"+A, B = input().split()",
"+import math",
"+",
"+A = int(A)",
"+B = float(B)",
"+print((math.floor(A * B)))"
] | false | 0.084778 | 0.039278 | 2.158433 | [
"s738140778",
"s370425666"
] |
u186838327 | p02661 | python | s416884764 | s527809592 | 464 | 351 | 25,424 | 104,532 | Accepted | Accepted | 24.35 | n = int(eval(input()))
A = [0]*n
B = [0]*n
for i in range(n):
a, b = list(map(int, input().split()))
A[i] = a
B[i] = b
A.sort()
B.sort()
if n%2 == 1:
ans = B[n//2]-A[n//2]+1
else:
ans = B[n//2-1]+B[n//2]-(A[n//2-1]+A[n//2])+1
print(ans)
| n = int(eval(input()))
A = []
B = []
for i in range(n):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort()
B.sort()
if n%2 == 1:
ans = B[n//2]-A[n//2]+1
else:
x = A[n//2-1]+A[n//2]
y = B[n//2-1]+B[n//2]
ans = y-x+1
print(ans)
| 16 | 17 | 262 | 280 | n = int(eval(input()))
A = [0] * n
B = [0] * n
for i in range(n):
a, b = list(map(int, input().split()))
A[i] = a
B[i] = b
A.sort()
B.sort()
if n % 2 == 1:
ans = B[n // 2] - A[n // 2] + 1
else:
ans = B[n // 2 - 1] + B[n // 2] - (A[n // 2 - 1] + A[n // 2]) + 1
print(ans)
| n = int(eval(input()))
A = []
B = []
for i in range(n):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort()
B.sort()
if n % 2 == 1:
ans = B[n // 2] - A[n // 2] + 1
else:
x = A[n // 2 - 1] + A[n // 2]
y = B[n // 2 - 1] + B[n // 2]
ans = y - x + 1
print(ans)
| false | 5.882353 | [
"-A = [0] * n",
"-B = [0] * n",
"+A = []",
"+B = []",
"- A[i] = a",
"- B[i] = b",
"+ A.append(a)",
"+ B.append(b)",
"- ans = B[n // 2 - 1] + B[n // 2] - (A[n // 2 - 1] + A[n // 2]) + 1",
"+ x = A[n // 2 - 1] + A[n // 2]",
"+ y = B[n // 2 - 1] + B[n // 2]",
"+ ans = y - ... | false | 0.07665 | 0.03842 | 1.995042 | [
"s416884764",
"s527809592"
] |
u548464743 | p02844 | python | s013950905 | s225314112 | 166 | 29 | 10,264 | 9,116 | Accepted | Accepted | 82.53 | n = int(eval(input()))
num_list = list(map(int,eval(input())))
cnt = 0
for i in range(10):
if i not in num_list:
continue
else:
first_pwd = num_list.index(i)
new_num_list = num_list[first_pwd + 1:]
for j in range(10):
if j not in new_num_list:
... | n=int(eval(input()))
s=eval(input())
ans=0
for i in range(10):
if str(i) in s[:-2]:
s1=s.index(str(i))
for j in range(10):
if str(j) in s[s1+1:-1]:
s2=s[s1+1:].index(str(j))+s1+1
for k in range(10):
if str(k) in s[s2+1:]:
... | 24 | 16 | 655 | 354 | n = int(eval(input()))
num_list = list(map(int, eval(input())))
cnt = 0
for i in range(10):
if i not in num_list:
continue
else:
first_pwd = num_list.index(i)
new_num_list = num_list[first_pwd + 1 :]
for j in range(10):
if j not in new_num_list:
contin... | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(10):
if str(i) in s[:-2]:
s1 = s.index(str(i))
for j in range(10):
if str(j) in s[s1 + 1 : -1]:
s2 = s[s1 + 1 :].index(str(j)) + s1 + 1
for k in range(10):
if str(k) in s[s... | false | 33.333333 | [
"-num_list = list(map(int, eval(input())))",
"-cnt = 0",
"+s = eval(input())",
"+ans = 0",
"- if i not in num_list:",
"- continue",
"- else:",
"- first_pwd = num_list.index(i)",
"- new_num_list = num_list[first_pwd + 1 :]",
"+ if str(i) in s[:-2]:",
"+ s1 = s... | false | 0.046259 | 0.046106 | 1.003313 | [
"s013950905",
"s225314112"
] |
u893063840 | p03634 | python | s500918228 | s694025058 | 1,497 | 1,357 | 178,392 | 89,312 | Accepted | Accepted | 9.35 | import sys
sys.setrecursionlimit(10 ** 6)
class Tree:
WHITE = 0
GRAY = -1
BLACK = 1
def __init__(self, adj):
n = len(adj)
self.adj = adj
self.colors = [self.WHITE] * n
self.depths = [-1] * n
self.depth = 0
def init(self):
self.__in... | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n - 1)]
q, k = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(q)]
adj = [[] for _ in range(n)]
for a, b, c in abc:
a -= 1
b -= 1
adj[a].append([b, c])
adj[b].append([a, c])
def dfs(s):
... | 55 | 35 | 1,134 | 584 | import sys
sys.setrecursionlimit(10**6)
class Tree:
WHITE = 0
GRAY = -1
BLACK = 1
def __init__(self, adj):
n = len(adj)
self.adj = adj
self.colors = [self.WHITE] * n
self.depths = [-1] * n
self.depth = 0
def init(self):
self.__init__(self.adj)
... | n = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(n - 1)]
q, k = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(q)]
adj = [[] for _ in range(n)]
for a, b, c in abc:
a -= 1
b -= 1
adj[a].append([b, c])
adj[b].append([a, c])
def dfs(s):
... | false | 36.363636 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**6)",
"-",
"-",
"-class Tree:",
"- WHITE = 0",
"- GRAY = -1",
"- BLACK = 1",
"-",
"- def __init__(self, adj):",
"- n = len(adj)",
"- self.adj = adj",
"- self.colors = [self.WHITE] * n",
"- self.depths ... | false | 0.094762 | 0.09267 | 1.022569 | [
"s500918228",
"s694025058"
] |
u033627628 | p03086 | python | s969539496 | s367459050 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | s=eval(input())
ans=0
start=-1
for i in range(len(s)):
if not s[i] in "ACGT":
ans=max(ans,i-start-1)
start=i
i+=1
ans=max(ans,i-start-1)
print(ans) | s=eval(input())
ans=0
cnt=0
for c in s:
if c in "ATCG":
cnt+=1
else:
cnt=0
ans=max(ans,cnt)
print(ans)
| 10 | 10 | 174 | 134 | s = eval(input())
ans = 0
start = -1
for i in range(len(s)):
if not s[i] in "ACGT":
ans = max(ans, i - start - 1)
start = i
i += 1
ans = max(ans, i - start - 1)
print(ans)
| s = eval(input())
ans = 0
cnt = 0
for c in s:
if c in "ATCG":
cnt += 1
else:
cnt = 0
ans = max(ans, cnt)
print(ans)
| false | 0 | [
"-start = -1",
"-for i in range(len(s)):",
"- if not s[i] in \"ACGT\":",
"- ans = max(ans, i - start - 1)",
"- start = i",
"- i += 1",
"-ans = max(ans, i - start - 1)",
"+cnt = 0",
"+for c in s:",
"+ if c in \"ATCG\":",
"+ cnt += 1",
"+ else:",
"+ cnt ... | false | 0.048126 | 0.049373 | 0.974737 | [
"s969539496",
"s367459050"
] |
u628335443 | p02780 | python | s780503814 | s369624155 | 174 | 128 | 25,060 | 25,152 | Accepted | Accepted | 26.44 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
max_sum_k = 0
cum_sum = [0] * (n+1)
cum_sum[0] = 0
cum_sum[1] = p[0]
for i in range(2, n+1):
cum_sum[i] = p[i-1] + cum_sum[i-1]
for i in range(k, n + 1):
sum_p = cum_sum[i] - cum_sum[i-k]
if sum_p > max_sum_k:
ma... | from itertools import accumulate
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
max_sum_k = 0
cum_sum = [0] + list(accumulate(p))
for i in range(k-1, n + 1):
sum_p = cum_sum[i] - cum_sum[i-k]
if sum_p > max_sum_k:
max_sum_k = sum_p
max_ex = (k + max_sum_k) / 2
... | 16 | 14 | 377 | 329 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
max_sum_k = 0
cum_sum = [0] * (n + 1)
cum_sum[0] = 0
cum_sum[1] = p[0]
for i in range(2, n + 1):
cum_sum[i] = p[i - 1] + cum_sum[i - 1]
for i in range(k, n + 1):
sum_p = cum_sum[i] - cum_sum[i - k]
if sum_p > max_sum_k:
max_s... | from itertools import accumulate
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
max_sum_k = 0
cum_sum = [0] + list(accumulate(p))
for i in range(k - 1, n + 1):
sum_p = cum_sum[i] - cum_sum[i - k]
if sum_p > max_sum_k:
max_sum_k = sum_p
max_ex = (k + max_sum_k) / 2
print(max_... | false | 12.5 | [
"+from itertools import accumulate",
"+",
"-cum_sum = [0] * (n + 1)",
"-cum_sum[0] = 0",
"-cum_sum[1] = p[0]",
"-for i in range(2, n + 1):",
"- cum_sum[i] = p[i - 1] + cum_sum[i - 1]",
"-for i in range(k, n + 1):",
"+cum_sum = [0] + list(accumulate(p))",
"+for i in range(k - 1, n + 1):"
] | false | 0.042646 | 0.186873 | 0.228207 | [
"s780503814",
"s369624155"
] |
u835283937 | p02714 | python | s477059761 | s754613296 | 1,830 | 1,448 | 9,192 | 9,152 | Accepted | Accepted | 20.87 | def main5():
N = int(eval(input()))
S = list(eval(input()))
r = g = b = 0
for c in S:
if c == "R":
r += 1
if c == "G":
g += 1
if c == "B":
b += 1
tmp = 0
for i in range(len(S)):
for j in range(len(S)):
... | def main5():
N = int(eval(input()))
S = list(eval(input()))
r = g = b = 0
for c in S:
if c == "R":
r += 1
if c == "G":
g += 1
if c == "B":
b += 1
tmp = 0
for i in range(len(S)):
for j in range(i + 1, len(S)):
... | 27 | 26 | 554 | 526 | def main5():
N = int(eval(input()))
S = list(eval(input()))
r = g = b = 0
for c in S:
if c == "R":
r += 1
if c == "G":
g += 1
if c == "B":
b += 1
tmp = 0
for i in range(len(S)):
for j in range(len(S)):
if i < j:
... | def main5():
N = int(eval(input()))
S = list(eval(input()))
r = g = b = 0
for c in S:
if c == "R":
r += 1
if c == "G":
g += 1
if c == "B":
b += 1
tmp = 0
for i in range(len(S)):
for j in range(i + 1, len(S)):
k = 2 *... | false | 3.703704 | [
"- for j in range(len(S)):",
"- if i < j:",
"- k = 2 * j - i",
"- if k < len(S) and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:",
"- tmp += 1",
"+ for j in range(i + 1, len(S)):",
"+ k = 2 * j - i",
"+ ... | false | 0.038089 | 0.036908 | 1.031989 | [
"s477059761",
"s754613296"
] |
u017810624 | p02599 | python | s523884994 | s290719300 | 1,899 | 1,690 | 245,224 | 232,524 | Accepted | Accepted | 11.01 | n,q=list(map(int,input().split()))
c=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(q)]
for i in range(q):
l[i].append(i)
l.sort(key=lambda x:x[1])
L=[-1]*(5*10**5+1)
class Bit:
def __init__(self,n):
self.size=n
self.tree=[0]*(n + 1)
self.depth=n.bit_lengt... | import sys
input=sys.stdin.readline
n,q=list(map(int,input().split()))
c=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(q)]
for i in range(q):
l[i].append(i)
l.sort(key=lambda x:x[1])
L=[-1]*(5*10**5+1)
class Bit:
def __init__(self,n):
self.size=n
self.tree=[... | 42 | 44 | 784 | 822 | n, q = list(map(int, input().split()))
c = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(q)]
for i in range(q):
l[i].append(i)
l.sort(key=lambda x: x[1])
L = [-1] * (5 * 10**5 + 1)
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
... | import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
c = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(q)]
for i in range(q):
l[i].append(i)
l.sort(key=lambda x: x[1])
L = [-1] * (5 * 10**5 + 1)
class Bit:
def __init__(self, n):
self.size ... | false | 4.545455 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.065488 | 0.065316 | 1.002637 | [
"s523884994",
"s290719300"
] |
u565149926 | p03127 | python | s777709554 | s831912252 | 88 | 80 | 13,336 | 13,296 | Accepted | Accepted | 9.09 | from fractions import gcd
N = eval(input())
ans = 0
for a in map(int, input().split()):
ans = gcd(ans, a)
print(ans)
| import fractions, functools
N = eval(input())
print((functools.reduce(fractions.gcd, list(map(int, input().split())))))
| 7 | 3 | 122 | 108 | from fractions import gcd
N = eval(input())
ans = 0
for a in map(int, input().split()):
ans = gcd(ans, a)
print(ans)
| import fractions, functools
N = eval(input())
print((functools.reduce(fractions.gcd, list(map(int, input().split())))))
| false | 57.142857 | [
"-from fractions import gcd",
"+import fractions, functools",
"-ans = 0",
"-for a in map(int, input().split()):",
"- ans = gcd(ans, a)",
"-print(ans)",
"+print((functools.reduce(fractions.gcd, list(map(int, input().split())))))"
] | false | 0.07717 | 0.040738 | 1.894296 | [
"s777709554",
"s831912252"
] |
u678167152 | p03945 | python | s307913766 | s602673524 | 47 | 18 | 3,188 | 3,188 | Accepted | Accepted | 61.7 | S = eval(input())
c=1
for i in range(len(S)-1):
if S[i]!=S[i+1]:
c+=1
print((c-1)) | def solve():
S = eval(input())
ans = S.count('BW')+S.count('WB')
return ans
print((solve())) | 6 | 5 | 85 | 100 | S = eval(input())
c = 1
for i in range(len(S) - 1):
if S[i] != S[i + 1]:
c += 1
print((c - 1))
| def solve():
S = eval(input())
ans = S.count("BW") + S.count("WB")
return ans
print((solve()))
| false | 16.666667 | [
"-S = eval(input())",
"-c = 1",
"-for i in range(len(S) - 1):",
"- if S[i] != S[i + 1]:",
"- c += 1",
"-print((c - 1))",
"+def solve():",
"+ S = eval(input())",
"+ ans = S.count(\"BW\") + S.count(\"WB\")",
"+ return ans",
"+",
"+",
"+print((solve()))"
] | false | 0.07571 | 0.04186 | 1.808667 | [
"s307913766",
"s602673524"
] |
u952708174 | p03167 | python | s232631320 | s526074496 | 1,443 | 374 | 43,732 | 43,612 | Accepted | Accepted | 74.08 | def h_grid1(MOD=10**9 + 7):
H, W = [int(i) for i in input().split()]
Grid = [eval(input()) for _ in range(H)]
# path[r][c]: ใใน(r, c)ใซ(0-based)ๅฐ้ใใ็ต่ทฏใฎๆฐ
path = [[0] * W for _ in range(H)]
path[0][0] = 1 # ในใฟใผใๅฐ็นใฏๅฟ
ใๅฐ้ใงใใ
def can_reach(row, col):
return 0 <= row < H and 0 <= col ... | def h_grid1(MOD=10**9 + 7):
H, W = [int(i) for i in input().split()]
Grid = ['#' * (W + 1)] + ['#' + eval(input()) for _ in range(H)] # ๅทฆใจไธใๅใใ
# path[r][c]: ใใน(r, c)ใซ(0-based)ๅฐ้ใใ็ต่ทฏใฎๆฐ
path = [[0] * (W + 1) for _ in range(H + 1)]
path[0][1] = 1 # path[1][1] = 1 (ในใฟใผใๅฐ็น) ใจใใใใใฎไพฟๅฎไธใฎไปฃๅ
ฅ
... | 22 | 15 | 710 | 542 | def h_grid1(MOD=10**9 + 7):
H, W = [int(i) for i in input().split()]
Grid = [eval(input()) for _ in range(H)]
# path[r][c]: ใใน(r, c)ใซ(0-based)ๅฐ้ใใ็ต่ทฏใฎๆฐ
path = [[0] * W for _ in range(H)]
path[0][0] = 1 # ในใฟใผใๅฐ็นใฏๅฟ
ใๅฐ้ใงใใ
def can_reach(row, col):
return 0 <= row < H and 0 <= col < W and Gr... | def h_grid1(MOD=10**9 + 7):
H, W = [int(i) for i in input().split()]
Grid = ["#" * (W + 1)] + ["#" + eval(input()) for _ in range(H)] # ๅทฆใจไธใๅใใ
# path[r][c]: ใใน(r, c)ใซ(0-based)ๅฐ้ใใ็ต่ทฏใฎๆฐ
path = [[0] * (W + 1) for _ in range(H + 1)]
path[0][1] = 1 # path[1][1] = 1 (ในใฟใผใๅฐ็น) ใจใใใใใฎไพฟๅฎไธใฎไปฃๅ
ฅ
for row in... | false | 31.818182 | [
"- Grid = [eval(input()) for _ in range(H)]",
"+ Grid = [\"#\" * (W + 1)] + [\"#\" + eval(input()) for _ in range(H)] # ๅทฆใจไธใๅใใ",
"- path = [[0] * W for _ in range(H)]",
"- path[0][0] = 1 # ในใฟใผใๅฐ็นใฏๅฟ
ใๅฐ้ใงใใ",
"-",
"- def can_reach(row, col):",
"- return 0 <= row < H and 0 <= col < ... | false | 0.072338 | 0.031841 | 2.271863 | [
"s232631320",
"s526074496"
] |
u598229387 | p02936 | python | s882890145 | s690877535 | 1,906 | 1,381 | 124,236 | 124,240 | Accepted | Accepted | 27.54 | n,q=list(map(int,input().split()))
ab=[[int(i) for i in input().split()] for j in range(n-1)]
px=[[int(i) for i in input().split()] for j in range(q)]
graph=[[] for i in range(n+1)]
for a,b in ab:
graph[a].append(b)
graph[b].append(a)
value=[0]*(n+1)
for p,x in px:
value[p]+=x
q=[(... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n,q=list(map(int,input().split()))
ab=[[int(i) for i in input().split()] for j in range(n-1)]
px=[[int(i) for i in input().split()] for j in range(q)]
graph=[[] for i in range(n+1)]
for a,b in ab:
graph[a].append(b)
graph[b].append(... | 25 | 28 | 544 | 616 | n, q = list(map(int, input().split()))
ab = [[int(i) for i in input().split()] for j in range(n - 1)]
px = [[int(i) for i in input().split()] for j in range(q)]
graph = [[] for i in range(n + 1)]
for a, b in ab:
graph[a].append(b)
graph[b].append(a)
value = [0] * (n + 1)
for p, x in px:
value[p] += x
q = [(... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n, q = list(map(int, input().split()))
ab = [[int(i) for i in input().split()] for j in range(n - 1)]
px = [[int(i) for i in input().split()] for j in range(q)]
graph = [[] for i in range(n + 1)]
for a, b in ab:
graph[a].append(b)
graph[b].appe... | false | 10.714286 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**7)"
] | false | 0.037033 | 0.036619 | 1.011295 | [
"s882890145",
"s690877535"
] |
u554954744 | p03326 | python | s954556957 | s360177661 | 252 | 220 | 42,736 | 40,560 | Accepted | Accepted | 12.7 | n, m = list(map(int, input().split()))
cakes = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(2**3):
tmp_arr = []
for j in range(n):
tmp = 0
for k in range(3):
if (i>>k) & 1:
tmp += cakes[j][k]
else:
... | n, m = list(map(int, input().split()))
cakes = [list(map(int, input().split())) for _ in range(n)]
import itertools
ans = 0
for a, b, c in itertools.product([-1, 1], repeat=3):
li = []
for i in range(n):
x = a*cakes[i][0] + b*cakes[i][1] + c*cakes[i][2]
li.append(x)
li.sort(reve... | 17 | 14 | 444 | 368 | n, m = list(map(int, input().split()))
cakes = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(2**3):
tmp_arr = []
for j in range(n):
tmp = 0
for k in range(3):
if (i >> k) & 1:
tmp += cakes[j][k]
else:
tmp -= cak... | n, m = list(map(int, input().split()))
cakes = [list(map(int, input().split())) for _ in range(n)]
import itertools
ans = 0
for a, b, c in itertools.product([-1, 1], repeat=3):
li = []
for i in range(n):
x = a * cakes[i][0] + b * cakes[i][1] + c * cakes[i][2]
li.append(x)
li.sort(reverse=Tr... | false | 17.647059 | [
"+import itertools",
"+",
"-for i in range(2**3):",
"- tmp_arr = []",
"- for j in range(n):",
"- tmp = 0",
"- for k in range(3):",
"- if (i >> k) & 1:",
"- tmp += cakes[j][k]",
"- else:",
"- tmp -= cakes[j][k]",
"- ... | false | 0.038139 | 0.037979 | 1.004218 | [
"s954556957",
"s360177661"
] |
u259755734 | p02779 | python | s038341780 | s936293749 | 264 | 62 | 26,808 | 31,152 | Accepted | Accepted | 76.52 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(set(A))
print(('YES' if sorted(A) == sorted(B) else 'NO')) | N = int(eval(input()))
print(('YES' if N == len(set(input().split())) else 'NO')) | 4 | 2 | 121 | 74 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(set(A))
print(("YES" if sorted(A) == sorted(B) else "NO"))
| N = int(eval(input()))
print(("YES" if N == len(set(input().split())) else "NO"))
| false | 50 | [
"-A = list(map(int, input().split()))",
"-B = list(set(A))",
"-print((\"YES\" if sorted(A) == sorted(B) else \"NO\"))",
"+print((\"YES\" if N == len(set(input().split())) else \"NO\"))"
] | false | 0.036449 | 0.034671 | 1.0513 | [
"s038341780",
"s936293749"
] |
u197300260 | p03814 | python | s708109984 | s575293171 | 29 | 23 | 3,516 | 4,012 | Accepted | Accepted | 20.69 | # Problem https://atcoder.jp/contests/abc053/tasks/abc053_b
# Python 2nd Try
def solver(string):
result = 200000
aposi = 0
zposi = len(string)
for j in range(0, len(string), 1):
if string[j] == 'A':
aposi = j
break
for j in range(len(string)-1, -1, -1):
... | # Problem https://atcoder.jp/contests/abc053/tasks/abc053_b
# Python 3rd Try
import copy
def solver(givenstring):
result = 0
usestrA = copy.copy(givenstring)
usestrZ = copy.copy(givenstring)
# a position
apos = usestrA.index('A')+1
usestrrevZ = usestrZ[::-1]
zpos = len(givenstring)... | 23 | 20 | 527 | 478 | # Problem https://atcoder.jp/contests/abc053/tasks/abc053_b
# Python 2nd Try
def solver(string):
result = 200000
aposi = 0
zposi = len(string)
for j in range(0, len(string), 1):
if string[j] == "A":
aposi = j
break
for j in range(len(string) - 1, -1, -1):
if s... | # Problem https://atcoder.jp/contests/abc053/tasks/abc053_b
# Python 3rd Try
import copy
def solver(givenstring):
result = 0
usestrA = copy.copy(givenstring)
usestrZ = copy.copy(givenstring)
# a position
apos = usestrA.index("A") + 1
usestrrevZ = usestrZ[::-1]
zpos = len(givenstring) - use... | false | 13.043478 | [
"-# Python 2nd Try",
"-def solver(string):",
"- result = 200000",
"- aposi = 0",
"- zposi = len(string)",
"- for j in range(0, len(string), 1):",
"- if string[j] == \"A\":",
"- aposi = j",
"- break",
"- for j in range(len(string) - 1, -1, -1):",
"- ... | false | 0.086824 | 0.048225 | 1.800372 | [
"s708109984",
"s575293171"
] |
u859897687 | p02969 | python | s117184091 | s141219197 | 173 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.17 | r=int(eval(input()))
print((3*r*r)) | a=int(eval(input()))
print((3*a*a)) | 2 | 2 | 28 | 28 | r = int(eval(input()))
print((3 * r * r))
| a = int(eval(input()))
print((3 * a * a))
| false | 0 | [
"-r = int(eval(input()))",
"-print((3 * r * r))",
"+a = int(eval(input()))",
"+print((3 * a * a))"
] | false | 0.117019 | 0.037279 | 3.138969 | [
"s117184091",
"s141219197"
] |
u989345508 | p03944 | python | s406906842 | s603280555 | 43 | 17 | 3,188 | 3,064 | Accepted | Accepted | 60.47 | w,h,n=input().split()
w,h,n=int(w),int(h),int(n)
s=[[0 for i in range(w)] for j in range(h)]
for i in range(n):
x,y,a=input().split()
x,y,a=int(x),int(y),int(a)
if a==1:
if x==0:
pass
else:
for j in range(h):
s[j][:x]=[1 for k in range(x)]... | w,h,n=list(map(int,input().split()))
a1,a2,a3,a4=0,w,0,h
for i in range(n):
x,y,a=list(map(int,input().split()))
if a==1:
a1=max(a1,x)
elif a==2:
a2=min(a2,x)
elif a==3:
a3=max(a3,y)
else:
a4=min(a4,y)
print((max(a2-a1,0)*max(a4-a3,0))) | 39 | 13 | 880 | 286 | w, h, n = input().split()
w, h, n = int(w), int(h), int(n)
s = [[0 for i in range(w)] for j in range(h)]
for i in range(n):
x, y, a = input().split()
x, y, a = int(x), int(y), int(a)
if a == 1:
if x == 0:
pass
else:
for j in range(h):
s[j][:x] = [1 for... | w, h, n = list(map(int, input().split()))
a1, a2, a3, a4 = 0, w, 0, h
for i in range(n):
x, y, a = list(map(int, input().split()))
if a == 1:
a1 = max(a1, x)
elif a == 2:
a2 = min(a2, x)
elif a == 3:
a3 = max(a3, y)
else:
a4 = min(a4, y)
print((max(a2 - a1, 0) * max(a... | false | 66.666667 | [
"-w, h, n = input().split()",
"-w, h, n = int(w), int(h), int(n)",
"-s = [[0 for i in range(w)] for j in range(h)]",
"+w, h, n = list(map(int, input().split()))",
"+a1, a2, a3, a4 = 0, w, 0, h",
"- x, y, a = input().split()",
"- x, y, a = int(x), int(y), int(a)",
"+ x, y, a = list(map(int, in... | false | 0.059059 | 0.03701 | 1.595771 | [
"s406906842",
"s603280555"
] |
u811436126 | p02796 | python | s338629426 | s309508463 | 629 | 550 | 42,208 | 42,584 | Accepted | Accepted | 12.56 | n = int(eval(input()))
xl = [list(map(int, input().split())) for _ in range(n)]
lr = []
for i in range(n):
l = max(xl[i][0] - xl[i][1], 0)
r = max(xl[i][0] + xl[i][1], 0)
lr.append([r, l])
lr = sorted(lr)
keep = [False] * n
# print(lr)
cur = 0
for i in range(n):
if cur <= lr[i][1]:
... | n = int(eval(input()))
xl = [list(map(int, input().split())) for _ in range(n)]
lr = []
for i in range(n):
l = max(xl[i][0] - xl[i][1], 0)
r = max(xl[i][0] + xl[i][1], 0)
lr.append([l, r])
lr.sort(key=lambda x: x[1])
keep = [False] * n
cur = 0
for i in range(n):
if cur <= lr[i][0]:
... | 29 | 21 | 635 | 391 | n = int(eval(input()))
xl = [list(map(int, input().split())) for _ in range(n)]
lr = []
for i in range(n):
l = max(xl[i][0] - xl[i][1], 0)
r = max(xl[i][0] + xl[i][1], 0)
lr.append([r, l])
lr = sorted(lr)
keep = [False] * n
# print(lr)
cur = 0
for i in range(n):
if cur <= lr[i][1]:
keep[i] = Tru... | n = int(eval(input()))
xl = [list(map(int, input().split())) for _ in range(n)]
lr = []
for i in range(n):
l = max(xl[i][0] - xl[i][1], 0)
r = max(xl[i][0] + xl[i][1], 0)
lr.append([l, r])
lr.sort(key=lambda x: x[1])
keep = [False] * n
cur = 0
for i in range(n):
if cur <= lr[i][0]:
keep[i] = Tru... | false | 27.586207 | [
"- lr.append([r, l])",
"-lr = sorted(lr)",
"+ lr.append([l, r])",
"+lr.sort(key=lambda x: x[1])",
"-# print(lr)",
"- if cur <= lr[i][1]:",
"+ if cur <= lr[i][0]:",
"- cur = lr[i][0]",
"-\"\"\"",
"-for j in range(n - 1):",
"- if keep[j]:",
"- if lr[j][0] == lr[j + 1... | false | 0.04247 | 0.037108 | 1.144515 | [
"s338629426",
"s309508463"
] |
u600402037 | p02937 | python | s382237840 | s687455086 | 280 | 154 | 45,936 | 8,052 | Accepted | Accepted | 45 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
from bisect import bisect_left
S = input().rstrip()
T = input().rstrip()
LS = len(S)
index = defaultdict(list)
for i,s in enumerate(S):
index[s].append(i)
x = -1
for t in T:
arr = in... | # E - Strings of Impurity maspyใใ
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
from bisect import bisect_left
S = input().rstrip()
T = input().rstrip()
LS = len(S)
index = defaultdict(list)
for i,s in enumerate(S):
index[s].append(i)
... | 33 | 37 | 575 | 652 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
from bisect import bisect_left
S = input().rstrip()
T = input().rstrip()
LS = len(S)
index = defaultdict(list)
for i, s in enumerate(S):
index[s].append(i)
x = -1
for t in T:
arr = index[t]
if len(arr) =... | # E - Strings of Impurity maspyใใ
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
from bisect import bisect_left
S = input().rstrip()
T = input().rstrip()
LS = len(S)
index = defaultdict(list)
for i, s in enumerate(S):
index[s].append(i)
x = -1 # ไปใฟใใจใใใๆฌกใฏx... | false | 10.810811 | [
"+# E - Strings of Impurity maspyใใ",
"-x = -1",
"+x = -1 # ไปใฟใใจใใใๆฌกใฏx+1ใใ",
"- x = -2",
"- break",
"+ print((-1))",
"+ exit()",
"- next_x = (x + 1) + arr[0] - y + LS",
"+ next_x = (x + 1) + arr[0] + LS - y",
"-print((x + 1))",
"+ans = x + 1",
"+prin... | false | 0.037278 | 0.061799 | 0.603213 | [
"s382237840",
"s687455086"
] |
u227082700 | p02792 | python | s195181957 | s440288588 | 246 | 227 | 3,064 | 3,064 | Accepted | Accepted | 7.72 | c=[10*[0]for _ in range(10)]
n=int(eval(input()))
for i in range(1,n+1):
a=int(str(i)[0])
b=int(str(i)[-1])
c[a][b]+=1
ans=0
for i in range(1,10):
for j in range(1,10):
ans+=c[i][j]*c[j][i]
print(ans) | n=int(eval(input()))
d=[10*[0]for _ in range(10)]
for i in range(1,n+1):d[int(str(i)[0])][int(str(i)[-1])]+=1
ans=0
for i in range(1,10):
for j in range(1,10):ans+=d[i][j]*d[j][i]
print(ans) | 11 | 7 | 216 | 192 | c = [10 * [0] for _ in range(10)]
n = int(eval(input()))
for i in range(1, n + 1):
a = int(str(i)[0])
b = int(str(i)[-1])
c[a][b] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += c[i][j] * c[j][i]
print(ans)
| n = int(eval(input()))
d = [10 * [0] for _ in range(10)]
for i in range(1, n + 1):
d[int(str(i)[0])][int(str(i)[-1])] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += d[i][j] * d[j][i]
print(ans)
| false | 36.363636 | [
"-c = [10 * [0] for _ in range(10)]",
"+d = [10 * [0] for _ in range(10)]",
"- a = int(str(i)[0])",
"- b = int(str(i)[-1])",
"- c[a][b] += 1",
"+ d[int(str(i)[0])][int(str(i)[-1])] += 1",
"- ans += c[i][j] * c[j][i]",
"+ ans += d[i][j] * d[j][i]"
] | false | 0.14442 | 0.154593 | 0.934192 | [
"s195181957",
"s440288588"
] |
u001024152 | p03699 | python | s555511391 | s854399917 | 212 | 20 | 3,064 | 3,316 | Accepted | Accepted | 90.57 | import sys
N = int(eval(input()))
scores = [0]*(N*100+1)
scores[0] = 1
for _ in range(N):
a = int(eval(input()))
for i in reversed(list(range(len(scores)))):
if scores[i]>0 and 0<i+a<=N*100:
scores[i+a] += 1
for i in reversed(list(range(len(scores)))):
if scores... | N = int(eval(input()))
a = list(int(eval(input())) for _ in range(N))
a.sort()
ans = sum(a)
if ans%10 > 0:
print(ans)
exit()
for ai in a:
if ai%10 > 0:
print((ans - ai))
break
else:
print((0))
| 17 | 14 | 378 | 223 | import sys
N = int(eval(input()))
scores = [0] * (N * 100 + 1)
scores[0] = 1
for _ in range(N):
a = int(eval(input()))
for i in reversed(list(range(len(scores)))):
if scores[i] > 0 and 0 < i + a <= N * 100:
scores[i + a] += 1
for i in reversed(list(range(len(scores)))):
if scores[i] and... | N = int(eval(input()))
a = list(int(eval(input())) for _ in range(N))
a.sort()
ans = sum(a)
if ans % 10 > 0:
print(ans)
exit()
for ai in a:
if ai % 10 > 0:
print((ans - ai))
break
else:
print((0))
| false | 17.647059 | [
"-import sys",
"-",
"-scores = [0] * (N * 100 + 1)",
"-scores[0] = 1",
"-for _ in range(N):",
"- a = int(eval(input()))",
"- for i in reversed(list(range(len(scores)))):",
"- if scores[i] > 0 and 0 < i + a <= N * 100:",
"- scores[i + a] += 1",
"-for i in reversed(list(range... | false | 0.054499 | 0.033206 | 1.641243 | [
"s555511391",
"s854399917"
] |
u396961814 | p02900 | python | s561770879 | s085510318 | 174 | 63 | 3,064 | 3,064 | Accepted | Accepted | 63.79 |
A,B =[int(x) for x in input().split()]
def bunkai(n):
sosu= {1}
tmp = n
stop_flag = n
if tmp%2 == 0:
while tmp%2==0:
tmp //=2
sosu.add(2)
for i in range(3,n+1,2):
if tmp%i == 0:
while tmp%i==0:
tmp //=i
... |
A,B =[int(x) for x in input().split()]
def bunkai(n):
sosu= {1}
tmp = n
if tmp%2 == 0:
while tmp%2==0:
tmp //=2
sosu.add(2)
for i in range(3,int(n**0.5)+1,2):
if tmp%i == 0:
while tmp%i==0:
tmp //=i
... | 44 | 38 | 791 | 642 | A, B = [int(x) for x in input().split()]
def bunkai(n):
sosu = {1}
tmp = n
stop_flag = n
if tmp % 2 == 0:
while tmp % 2 == 0:
tmp //= 2
sosu.add(2)
for i in range(3, n + 1, 2):
if tmp % i == 0:
while tmp % i == 0:
tmp //= i
... | A, B = [int(x) for x in input().split()]
def bunkai(n):
sosu = {1}
tmp = n
if tmp % 2 == 0:
while tmp % 2 == 0:
tmp //= 2
sosu.add(2)
for i in range(3, int(n**0.5) + 1, 2):
if tmp % i == 0:
while tmp % i == 0:
tmp //= i
sosu.a... | false | 13.636364 | [
"- stop_flag = n",
"- for i in range(3, n + 1, 2):",
"+ for i in range(3, int(n**0.5) + 1, 2):",
"- stop_flag = tmp",
"- if i > stop_flag:",
"- break",
"- else:",
"- stop_flag = int(n / i) + 1"
] | false | 0.049294 | 0.044371 | 1.110942 | [
"s561770879",
"s085510318"
] |
u408791346 | p03448 | python | s953137059 | s784658820 | 184 | 51 | 39,664 | 3,060 | Accepted | Accepted | 72.28 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
res = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
total = i*500 + j*100 + k*50
if total == x:
res += 1
print(res) | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if 500*i + 100*j + 50*k == x:
ans += 1
print(ans) | 14 | 13 | 282 | 242 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
res = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
total = i * 500 + j * 100 + k * 50
if total == x:
res += 1
print(res)
| a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
ans += 1
print(ans)
| false | 7.142857 | [
"-res = 0",
"+ans = 0",
"- total = i * 500 + j * 100 + k * 50",
"- if total == x:",
"- res += 1",
"-print(res)",
"+ if 500 * i + 100 * j + 50 * k == x:",
"+ ans += 1",
"+print(ans)"
] | false | 0.128201 | 0.080549 | 1.591599 | [
"s953137059",
"s784658820"
] |
u621935300 | p03440 | python | s416838297 | s023876627 | 681 | 575 | 53,336 | 45,380 | Accepted | Accepted | 15.57 | from collections import deque
from collections import defaultdict
import heapq
N,M=list(map(int, input().split()))
cost=list(map(int, input().split()))
if M==N-1:
print(0)
quit()
nl=[ [] for i in range(N) ]
for i in range(M):
x,y=list(map(int,input().split()))
nl[x].append(y)
nl[y].append(x)
... | from collections import deque
from collections import defaultdict
import heapq
N,M=list(map(int, input().split()))
cost=list(map(int, input().split()))
par=[i for i in range(N)]
def root(x):
if par[x]==x:
return x
else:
r=root(par[x])
par[x]=r
return r
def unite(x,y):
x=root(x)
y=root... | 65 | 56 | 1,041 | 819 | from collections import deque
from collections import defaultdict
import heapq
N, M = list(map(int, input().split()))
cost = list(map(int, input().split()))
if M == N - 1:
print(0)
quit()
nl = [[] for i in range(N)]
for i in range(M):
x, y = list(map(int, input().split()))
nl[x].append(y)
nl[y].app... | from collections import deque
from collections import defaultdict
import heapq
N, M = list(map(int, input().split()))
cost = list(map(int, input().split()))
par = [i for i in range(N)]
def root(x):
if par[x] == x:
return x
else:
r = root(par[x])
par[x] = r
return r
def unite... | false | 13.846154 | [
"-if M == N - 1:",
"- print(0)",
"- quit()",
"-nl = [[] for i in range(N)]",
"+par = [i for i in range(N)]",
"+",
"+",
"+def root(x):",
"+ if par[x] == x:",
"+ return x",
"+ else:",
"+ r = root(par[x])",
"+ par[x] = r",
"+ return r",
"+",
"+",
... | false | 0.089482 | 0.064889 | 1.379004 | [
"s416838297",
"s023876627"
] |
u347184682 | p03739 | python | s610336279 | s344027267 | 146 | 111 | 20,580 | 20,692 | Accepted | Accepted | 23.97 | import copy
n=int(eval(input()))
a=[int(x) for x in input().rstrip().split()]
ac=copy.deepcopy(a)
now=0
ans1=0
for i in range(n):
now+=a[i]
if i%2==0:
if now<=0:
ans1+=abs(now)+1
now=1
else:
if 0<=now:
ans1+=abs(now)+1
now=-1
now=0
ans2=0
for i in range(n):
... | import copy
n=int(eval(input()))
a=[int(x) for x in input().rstrip().split()]
now=0
ans1=0
for i in range(n):
now+=a[i]
if i%2==0:
if now<=0:
ans1+=abs(now)+1
now=1
else:
if 0<=now:
ans1+=abs(now)+1
now=-1
now=0
ans2=0
for i in range(n):
now+=a[i]
if i%... | 32 | 31 | 479 | 458 | import copy
n = int(eval(input()))
a = [int(x) for x in input().rstrip().split()]
ac = copy.deepcopy(a)
now = 0
ans1 = 0
for i in range(n):
now += a[i]
if i % 2 == 0:
if now <= 0:
ans1 += abs(now) + 1
now = 1
else:
if 0 <= now:
ans1 += abs(now) + 1
... | import copy
n = int(eval(input()))
a = [int(x) for x in input().rstrip().split()]
now = 0
ans1 = 0
for i in range(n):
now += a[i]
if i % 2 == 0:
if now <= 0:
ans1 += abs(now) + 1
now = 1
else:
if 0 <= now:
ans1 += abs(now) + 1
now = -1
now = 0... | false | 3.125 | [
"-ac = copy.deepcopy(a)"
] | false | 0.15165 | 0.041272 | 3.674385 | [
"s610336279",
"s344027267"
] |
u496762077 | p02928 | python | s130785961 | s687273497 | 639 | 439 | 3,188 | 3,188 | Accepted | Accepted | 31.3 | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
ans1 = 0
ans3 = 0
for i in range(n-1):
for j in range(i+1,n):
if a[i]>a[j]:
ans1+=1
elif a[i]==a[j]:
ans3+=1
ans2 = (n*(n-1))//2 - ans1 - ans3
print(((ans1*((1+k)*k)//2+ans2*(k*(k-1))//2)%(10**... | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
inv = lambda w:sum([sum([a[i]>a[j] for j in range(i+1,n)]) for i in range(n-1)])
inv1 = lambda w:sum([sum([a[i]==a[j] for j in range(i+1,n)]) for i in range(n-1)])
ans1 = inv(a)
ans3 = inv1(a)
ans2 = (n*(n-1))//2 - ans1 - ans3
print(((ans1*(... | 12 | 8 | 318 | 354 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
ans1 = 0
ans3 = 0
for i in range(n - 1):
for j in range(i + 1, n):
if a[i] > a[j]:
ans1 += 1
elif a[i] == a[j]:
ans3 += 1
ans2 = (n * (n - 1)) // 2 - ans1 - ans3
print(((ans1 * ((1 + k) * k) // 2 + ans... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
inv = lambda w: sum([sum([a[i] > a[j] for j in range(i + 1, n)]) for i in range(n - 1)])
inv1 = lambda w: sum(
[sum([a[i] == a[j] for j in range(i + 1, n)]) for i in range(n - 1)]
)
ans1 = inv(a)
ans3 = inv1(a)
ans2 = (n * (n - 1)) // 2 - an... | false | 33.333333 | [
"-ans1 = 0",
"-ans3 = 0",
"-for i in range(n - 1):",
"- for j in range(i + 1, n):",
"- if a[i] > a[j]:",
"- ans1 += 1",
"- elif a[i] == a[j]:",
"- ans3 += 1",
"+inv = lambda w: sum([sum([a[i] > a[j] for j in range(i + 1, n)]) for i in range(n - 1)])",
"+inv1 ... | false | 0.035664 | 0.115881 | 0.307766 | [
"s130785961",
"s687273497"
] |
u492447501 | p03308 | python | s011829611 | s125595437 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
*A, = list(map(int, input().split()))
max = 0
for i in range(N):
for j in range(i+1,N):
temp = abs(A[i]-A[j])
if max < temp:
max = temp
print(max) | N = int(eval(input()))
*A, = list(map(int, input().split()))
A.sort()
print((abs(A[0]-A[N-1]))) | 11 | 5 | 201 | 86 | N = int(eval(input()))
(*A,) = list(map(int, input().split()))
max = 0
for i in range(N):
for j in range(i + 1, N):
temp = abs(A[i] - A[j])
if max < temp:
max = temp
print(max)
| N = int(eval(input()))
(*A,) = list(map(int, input().split()))
A.sort()
print((abs(A[0] - A[N - 1])))
| false | 54.545455 | [
"-max = 0",
"-for i in range(N):",
"- for j in range(i + 1, N):",
"- temp = abs(A[i] - A[j])",
"- if max < temp:",
"- max = temp",
"-print(max)",
"+A.sort()",
"+print((abs(A[0] - A[N - 1])))"
] | false | 0.008774 | 0.042226 | 0.207793 | [
"s011829611",
"s125595437"
] |
u477977638 | p03436 | python | s910996139 | s947253828 | 179 | 73 | 39,408 | 71,088 | Accepted | Accepted | 59.22 | import sys
input = sys.stdin.readline
#input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
def RD(): return sys.stdin.read()
def II(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().... | import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(eval(input()))
def FI(): return float(eval(input()))
def MI(): return list(map(int,input().split()))
def MF(): return list(map(float,inp... | 107 | 59 | 1,040 | 981 | import sys
input = sys.stdin.readline
# input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
def RD():
return sys.stdin.read()
def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def TI():
return t... | import sys
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
return input().rstrip().decode()
def II():
return int(eval(input()))
def FI():
return float(eval(input()))
def MI():
return list(map(int, input().split()))
def MF():
retur... | false | 44.859813 | [
"-input = sys.stdin.readline",
"-# input = sys.stdin.buffer.readline",
"+input = sys.stdin.buffer.readline",
"+# from functools import lru_cache",
"- return sys.stdin.read()",
"+ return input().rstrip().decode()",
"+def FI():",
"+ return float(eval(input()))",
"+",
"+",
"+",
"+",
"+... | false | 0.039066 | 0.114649 | 0.340749 | [
"s910996139",
"s947253828"
] |
u933341648 | p03475 | python | s677003912 | s481627224 | 112 | 102 | 3,188 | 3,188 | Accepted | Accepted | 8.93 | n = int(eval(input()))
station = [tuple(map(int, input().split())) for _ in range(n-1)]
for i in range(n-1):
res = 0
for j in range(i, n-1):
c, s, f = station[j]
if res == 0:
res += s + c
else:
res += max(s-res, ((res+(f-1))//f)*f - res) + c
print(... | n = int(eval(input()))
station = [tuple(map(int, input().split())) for _ in range(n-1)]
for i in range(n):
res = 0
for j in range(i, n-1):
c, s, f = station[j]
res += max(s-res, ((res+(f-1))//f)*f - res) + c
print(res)
| 14 | 9 | 340 | 250 | n = int(eval(input()))
station = [tuple(map(int, input().split())) for _ in range(n - 1)]
for i in range(n - 1):
res = 0
for j in range(i, n - 1):
c, s, f = station[j]
if res == 0:
res += s + c
else:
res += max(s - res, ((res + (f - 1)) // f) * f - res) + c
pr... | n = int(eval(input()))
station = [tuple(map(int, input().split())) for _ in range(n - 1)]
for i in range(n):
res = 0
for j in range(i, n - 1):
c, s, f = station[j]
res += max(s - res, ((res + (f - 1)) // f) * f - res) + c
print(res)
| false | 35.714286 | [
"-for i in range(n - 1):",
"+for i in range(n):",
"- if res == 0:",
"- res += s + c",
"- else:",
"- res += max(s - res, ((res + (f - 1)) // f) * f - res) + c",
"+ res += max(s - res, ((res + (f - 1)) // f) * f - res) + c",
"-else:",
"- print((0))"
] | false | 0.045803 | 0.044843 | 1.021404 | [
"s677003912",
"s481627224"
] |
u811169796 | p03353 | python | s067102217 | s239162074 | 102 | 44 | 41,840 | 5,052 | Accepted | Accepted | 56.86 | s = eval(input())
k = int(eval(input()))
t = sorted(s)[min(k-1,len(s)-1)]
data = []
for i in range(len(s)):
if s[i] <= t:
data.append(s[i:])
data.sort()
if len(data) > k:
data = data[:k]
ndata = []
for ss in data:
for i in range(len(ss)):
ndata.append(ss[:i+1])
ndata = list(s... | s = eval(input())
k = int(eval(input()))
data = []
for i in range(len(s)):
for j in range(1,k+1):
data.append(s[i:min(i+j,len(s))])
data = list(set(data))
data.sort()
print((data[k-1])) | 18 | 9 | 352 | 191 | s = eval(input())
k = int(eval(input()))
t = sorted(s)[min(k - 1, len(s) - 1)]
data = []
for i in range(len(s)):
if s[i] <= t:
data.append(s[i:])
data.sort()
if len(data) > k:
data = data[:k]
ndata = []
for ss in data:
for i in range(len(ss)):
ndata.append(ss[: i + 1])
ndata = list(set(ndata... | s = eval(input())
k = int(eval(input()))
data = []
for i in range(len(s)):
for j in range(1, k + 1):
data.append(s[i : min(i + j, len(s))])
data = list(set(data))
data.sort()
print((data[k - 1]))
| false | 50 | [
"-t = sorted(s)[min(k - 1, len(s) - 1)]",
"- if s[i] <= t:",
"- data.append(s[i:])",
"+ for j in range(1, k + 1):",
"+ data.append(s[i : min(i + j, len(s))])",
"+data = list(set(data))",
"-if len(data) > k:",
"- data = data[:k]",
"-ndata = []",
"-for ss in data:",
"- fo... | false | 0.097385 | 0.084502 | 1.152458 | [
"s067102217",
"s239162074"
] |
u708255304 | p02927 | python | s829422281 | s819687780 | 29 | 26 | 3,060 | 3,060 | Accepted | Accepted | 10.34 | M, D = list(map(int, input().split()))
ans = 0
for i in range(1, M+1):
for j in range(1, D+1):
if len(str(j)) == 1:
continue
# ๆฅไปใไบๆกไปฅไธใงใใใใจใ็ขบๅฎ
d1 = int(str(j)[0])
d2 = int(str(j)[1])
if d1 >= 2 and d2 >= 2:
if i == (d1*d2):
... | M, D = list(map(int, input().split()))
ans = 0
for i in range(1, M+1): # ๆ
for j in range(10, D+1): # ๆฅไป
d1 = int(str(j)[0])
d2 = int(str(j)[1])
if d1 > 1 and d2 > 1:
if i == (d1 * d2):
ans += 1
print(ans)
| 15 | 13 | 338 | 273 | M, D = list(map(int, input().split()))
ans = 0
for i in range(1, M + 1):
for j in range(1, D + 1):
if len(str(j)) == 1:
continue
# ๆฅไปใไบๆกไปฅไธใงใใใใจใ็ขบๅฎ
d1 = int(str(j)[0])
d2 = int(str(j)[1])
if d1 >= 2 and d2 >= 2:
if i == (d1 * d2):
ans +=... | M, D = list(map(int, input().split()))
ans = 0
for i in range(1, M + 1): # ๆ
for j in range(10, D + 1): # ๆฅไป
d1 = int(str(j)[0])
d2 = int(str(j)[1])
if d1 > 1 and d2 > 1:
if i == (d1 * d2):
ans += 1
print(ans)
| false | 13.333333 | [
"-for i in range(1, M + 1):",
"- for j in range(1, D + 1):",
"- if len(str(j)) == 1:",
"- continue",
"- # ๆฅไปใไบๆกไปฅไธใงใใใใจใ็ขบๅฎ",
"+for i in range(1, M + 1): # ๆ",
"+ for j in range(10, D + 1): # ๆฅไป",
"- if d1 >= 2 and d2 >= 2:",
"+ if d1 > 1 and d2 > 1:"
] | false | 0.151081 | 0.081542 | 1.852803 | [
"s829422281",
"s819687780"
] |
u047796752 | p02625 | python | s160854871 | s643463147 | 455 | 158 | 107,740 | 91,224 | Accepted | Accepted | 65.27 | import sys
input = sys.stdin.readline
MAX = 5*10**5+100
MOD = 10**9+7
fact = [0]*MAX #fact[i]: i!
inv = [0]*MAX #inv[i]: iใฎ้ๅ
finv = [0]*MAX #finv[i]: i!ใฎ้ๅ
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i-1]*i%MOD
inv[i] = MOD-inv[MOD%i]*... | MAX = 5*10**5+100
MOD = 10**9+7
fact = [0]*MAX #fact[i]: i!
inv = [0]*MAX #inv[i]: iใฎ้ๅ
finv = [0]*MAX #finv[i]: i!ใฎ้ๅ
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i-1]*i%MOD
inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
finv[i] = finv[i-1]*inv[... | 38 | 37 | 793 | 754 | import sys
input = sys.stdin.readline
MAX = 5 * 10**5 + 100
MOD = 10**9 + 7
fact = [0] * MAX # fact[i]: i!
inv = [0] * MAX # inv[i]: iใฎ้ๅ
finv = [0] * MAX # finv[i]: i!ใฎ้ๅ
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i - 1] * i % MOD
inv[i] = MOD - inv[MO... | MAX = 5 * 10**5 + 100
MOD = 10**9 + 7
fact = [0] * MAX # fact[i]: i!
inv = [0] * MAX # inv[i]: iใฎ้ๅ
finv = [0] * MAX # finv[i]: i!ใฎ้ๅ
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i - 1] * i % MOD
inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
finv[i] =... | false | 2.631579 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-ans = (C(M, N) * fact[N]) ** 2 % MOD",
"+ans = C(M, N) * fact[N]",
"- ans += C(N, i) * C(M, i) * fact[i] * (C(M - i, N - i) * fact[N - i]) ** 2",
"+ ans += C(N, i) * C(M - i, N - i) * fact[N - i]",
"- ans -= C(N, i) * C(M, i) * ... | false | 2.433616 | 2.057786 | 1.182638 | [
"s160854871",
"s643463147"
] |
u094191970 | p03475 | python | s825965833 | s576454915 | 228 | 105 | 42,732 | 3,188 | Accepted | Accepted | 53.95 | n=int(eval(input()))
l=[list(map(int,input().split())) for i in range(n-1)]
for i in range(n-1):
ans=l[i][1]+l[i][0]
for j in range(i+1,n-1):
if ans<l[j][1]:
ans=l[j][1]+l[j][0]
else:
if ans%l[j][2]!=0:
ans+=l[j][2]-(ans%l[j][2])
ans+=l[j][0]
print(ans)
print((0)) | n=int(eval(input()))
l=[list(map(int,input().split())) for i in range(n-1)]
for i in range(n-1):
t=l[i][1]
t+=l[i][0]
for j in range(i+1,n-1):
if t<l[j][1]:
t=l[j][1]
elif t%l[j][2]!=0:
t+=l[j][2]-t%l[j][2]
t+=l[j][0]
print(t)
print((0)) | 15 | 15 | 292 | 277 | n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n - 1)]
for i in range(n - 1):
ans = l[i][1] + l[i][0]
for j in range(i + 1, n - 1):
if ans < l[j][1]:
ans = l[j][1] + l[j][0]
else:
if ans % l[j][2] != 0:
ans += l[j][2] - (ans % l... | n = int(eval(input()))
l = [list(map(int, input().split())) for i in range(n - 1)]
for i in range(n - 1):
t = l[i][1]
t += l[i][0]
for j in range(i + 1, n - 1):
if t < l[j][1]:
t = l[j][1]
elif t % l[j][2] != 0:
t += l[j][2] - t % l[j][2]
t += l[j][0]
prin... | false | 0 | [
"- ans = l[i][1] + l[i][0]",
"+ t = l[i][1]",
"+ t += l[i][0]",
"- if ans < l[j][1]:",
"- ans = l[j][1] + l[j][0]",
"- else:",
"- if ans % l[j][2] != 0:",
"- ans += l[j][2] - (ans % l[j][2])",
"- ans += l[j][0]",
"- print(an... | false | 0.039801 | 0.135748 | 0.2932 | [
"s825965833",
"s576454915"
] |
u546285759 | p00010 | python | s366237897 | s516115277 | 30 | 20 | 7,496 | 5,684 | Accepted | Accepted | 33.33 | n = int(eval(input()))
for _ in range(n):
x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
a = pow(pow(x3-x2, 2) + pow(y3-y2, 2), 0.5)
b = pow(pow(x1-x3, 2) + pow(y1-y3, 2), 0.5)
c = pow(pow(x2-x1, 2) + pow(y2-y1, 2), 0.5)
cosA = (b**2+c**2-a**2) / (2*b*c)
sinA = 1-cosA**2
... | n = int(eval(input()))
for _ in range(n):
x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
a = pow((x3-x2) ** 2 + (y3-y2) ** 2, 0.5)
b = pow((x3-x1) ** 2 + (y3-y1) ** 2, 0.5)
c = pow((x1-x2) ** 2 + (y1-y2) ** 2, 0.5)
cosA = (b**2 + c**2 - a**2) / (2*b*c)
sinA = pow(1 - cosA**2, ... | 14 | 16 | 592 | 613 | n = int(eval(input()))
for _ in range(n):
x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
a = pow(pow(x3 - x2, 2) + pow(y3 - y2, 2), 0.5)
b = pow(pow(x1 - x3, 2) + pow(y1 - y3, 2), 0.5)
c = pow(pow(x2 - x1, 2) + pow(y2 - y1, 2), 0.5)
cosA = (b**2 + c**2 - a**2) / (2 * b * c)
sinA = 1 ... | n = int(eval(input()))
for _ in range(n):
x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
a = pow((x3 - x2) ** 2 + (y3 - y2) ** 2, 0.5)
b = pow((x3 - x1) ** 2 + (y3 - y1) ** 2, 0.5)
c = pow((x1 - x2) ** 2 + (y1 - y2) ** 2, 0.5)
cosA = (b**2 + c**2 - a**2) / (2 * b * c)
sinA = pow(1 - ... | false | 12.5 | [
"- a = pow(pow(x3 - x2, 2) + pow(y3 - y2, 2), 0.5)",
"- b = pow(pow(x1 - x3, 2) + pow(y1 - y3, 2), 0.5)",
"- c = pow(pow(x2 - x1, 2) + pow(y2 - y1, 2), 0.5)",
"+ a = pow((x3 - x2) ** 2 + (y3 - y2) ** 2, 0.5)",
"+ b = pow((x3 - x1) ** 2 + (y3 - y1) ** 2, 0.5)",
"+ c = pow((x1 - x2) ** 2 +... | false | 0.047656 | 0.04795 | 0.99388 | [
"s366237897",
"s516115277"
] |
u491763171 | p00022 | python | s916866619 | s645525929 | 30 | 20 | 4,388 | 4,288 | Accepted | Accepted | 33.33 |
while 1:
n = eval(input())
if n == 0:
break
A = []
for i in range(n):
A.append(int(input()))
dp = [0] * len(A)
dp[0] = A[0]
for i in range(1, len(A)):
dp[i] = max(dp[i - 1] + A[i], A[i])
print(max(dp)) | while 1:
n = int(input())
if n == 0:
break
A = [0] * n
for i in range(n):
A[i] = int(input())
for i in range(1, len(A)):
A[i] = max(A[i - 1] + A[i], A[i])
print(max(A)) | 13 | 10 | 269 | 234 | while 1:
n = eval(input())
if n == 0:
break
A = []
for i in range(n):
A.append(int(input()))
dp = [0] * len(A)
dp[0] = A[0]
for i in range(1, len(A)):
dp[i] = max(dp[i - 1] + A[i], A[i])
print(max(dp))
| while 1:
n = int(input())
if n == 0:
break
A = [0] * n
for i in range(n):
A[i] = int(input())
for i in range(1, len(A)):
A[i] = max(A[i - 1] + A[i], A[i])
print(max(A))
| false | 23.076923 | [
"- n = eval(input())",
"+ n = int(input())",
"- A = []",
"+ A = [0] * n",
"- A.append(int(input()))",
"- dp = [0] * len(A)",
"- dp[0] = A[0]",
"+ A[i] = int(input())",
"- dp[i] = max(dp[i - 1] + A[i], A[i])",
"- print(max(dp))",
"+ A[i] = max(A[i ... | false | 0.046351 | 0.14124 | 0.328169 | [
"s916866619",
"s645525929"
] |
u360116509 | p03074 | python | s418844817 | s304661614 | 96 | 85 | 4,092 | 7,884 | Accepted | Accepted | 11.46 | def main():
N, K = list(map(int, input().split()))
S = eval(input())
nums = []
now = 1
cnt = 0
for s in S:
if int(s) == now:
cnt += 1
else:
nums.append(cnt)
now ^= 1
cnt = 1
if cnt > 0:
nums.append(cnt)
... | def main():
N, K = list(map(int, input().split()))
S = eval(input())
nums = []
now = 1
cnt = 0
for s in S:
if int(s) == now:
cnt += 1
else:
nums.append(cnt)
now ^= 1
cnt = 1
if cnt > 0:
nums.append(cnt)
... | 36 | 31 | 765 | 705 | def main():
N, K = list(map(int, input().split()))
S = eval(input())
nums = []
now = 1
cnt = 0
for s in S:
if int(s) == now:
cnt += 1
else:
nums.append(cnt)
now ^= 1
cnt = 1
if cnt > 0:
nums.append(cnt)
if len(nums) ... | def main():
N, K = list(map(int, input().split()))
S = eval(input())
nums = []
now = 1
cnt = 0
for s in S:
if int(s) == now:
cnt += 1
else:
nums.append(cnt)
now ^= 1
cnt = 1
if cnt > 0:
nums.append(cnt)
if len(nums) ... | false | 13.888889 | [
"+ sum = [0 for _ in range(len(nums) + 1)]",
"+ for i in range(len(nums)):",
"+ sum[i + 1] = sum[i] + nums[i]",
"- left = 0",
"- right = 0",
"- tmp = 0",
"- nleft = cnt",
"- nright = min(cnt + add, len(nums))",
"- while nleft > left:",
"- tmp -... | false | 0.211079 | 0.046956 | 4.495214 | [
"s418844817",
"s304661614"
] |
u224353074 | p03161 | python | s209249398 | s420642851 | 1,837 | 356 | 22,780 | 52,448 | Accepted | Accepted | 80.62 | import numpy as np
N, K = list(map(int, input().split()))
# H = np.array([int(h) for h in input().split()])
H = np.array(list(map(int, input().split())))
dp = np.zeros(N, dtype=int)
k = np.array([i for i in range(1, K+1)])
for n in range(1, N):
start = max(n-K, 0)
#if n < K:
# dp[n] = np.amin... | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
INF = 10000000000
dp = [INF]*N
dp[0] = 0
for i in range(N):
for k in range(1, K+1):
if i + k < N:
dp[i + k] = min(dp[i + k], dp[i] + abs(H[i] - H[i + k]))
print((dp[N-1])) | 17 | 13 | 499 | 277 | import numpy as np
N, K = list(map(int, input().split()))
# H = np.array([int(h) for h in input().split()])
H = np.array(list(map(int, input().split())))
dp = np.zeros(N, dtype=int)
k = np.array([i for i in range(1, K + 1)])
for n in range(1, N):
start = max(n - K, 0)
# if n < K:
# dp[n] = np.amin(dp[sta... | N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
INF = 10000000000
dp = [INF] * N
dp[0] = 0
for i in range(N):
for k in range(1, K + 1):
if i + k < N:
dp[i + k] = min(dp[i + k], dp[i] + abs(H[i] - H[i + k]))
print((dp[N - 1]))
| false | 23.529412 | [
"-import numpy as np",
"-",
"-# H = np.array([int(h) for h in input().split()])",
"-H = np.array(list(map(int, input().split())))",
"-dp = np.zeros(N, dtype=int)",
"-k = np.array([i for i in range(1, K + 1)])",
"-for n in range(1, N):",
"- start = max(n - K, 0)",
"- # if n < K:",
"- # d... | false | 0.751136 | 0.123166 | 6.098556 | [
"s209249398",
"s420642851"
] |
u347600233 | p02899 | python | s757734254 | s423875313 | 194 | 147 | 13,880 | 29,280 | Accepted | Accepted | 24.23 | n = int(input())
a = [int(i) for i in input().split()]
order = [0] * n
for i in range(n):
order[a[i] - 1] = i + 1
for i in range(n - 1):
print(str(order[i]), end=' ')
print(order[n - 1])
| n = int(input())
a = sorted([(i, int(ai)) for i, ai in zip(range(1, n + 1), input().split())], key=lambda x: x[1])
for i in range(n):
print(a[i][0], end=' ')
| 8 | 4 | 201 | 164 | n = int(input())
a = [int(i) for i in input().split()]
order = [0] * n
for i in range(n):
order[a[i] - 1] = i + 1
for i in range(n - 1):
print(str(order[i]), end=" ")
print(order[n - 1])
| n = int(input())
a = sorted(
[(i, int(ai)) for i, ai in zip(range(1, n + 1), input().split())],
key=lambda x: x[1],
)
for i in range(n):
print(a[i][0], end=" ")
| false | 50 | [
"-a = [int(i) for i in input().split()]",
"-order = [0] * n",
"+a = sorted(",
"+ [(i, int(ai)) for i, ai in zip(range(1, n + 1), input().split())],",
"+ key=lambda x: x[1],",
"+)",
"- order[a[i] - 1] = i + 1",
"-for i in range(n - 1):",
"- print(str(order[i]), end=\" \")",
"-print(orde... | false | 0.036338 | 0.056038 | 0.648446 | [
"s757734254",
"s423875313"
] |
u027403702 | p03814 | python | s677002507 | s539300090 | 73 | 18 | 3,512 | 3,500 | Accepted | Accepted | 75.34 | s = eval(input())
i = 0
while i < len(s):
if s[i] == "A":
break
i += 1
j = 1
while j <= len(s):
if s[-j] == "Z":
break
j += 1
print(((len(s) - j) - i +1)) | s = eval(input())
start = s.find("A")
end = s.rfind("Z")
print((end - start + 1)) | 12 | 4 | 189 | 76 | s = eval(input())
i = 0
while i < len(s):
if s[i] == "A":
break
i += 1
j = 1
while j <= len(s):
if s[-j] == "Z":
break
j += 1
print(((len(s) - j) - i + 1))
| s = eval(input())
start = s.find("A")
end = s.rfind("Z")
print((end - start + 1))
| false | 66.666667 | [
"-i = 0",
"-while i < len(s):",
"- if s[i] == \"A\":",
"- break",
"- i += 1",
"-j = 1",
"-while j <= len(s):",
"- if s[-j] == \"Z\":",
"- break",
"- j += 1",
"-print(((len(s) - j) - i + 1))",
"+start = s.find(\"A\")",
"+end = s.rfind(\"Z\")",
"+print((end - start ... | false | 0.037127 | 0.035493 | 1.046053 | [
"s677002507",
"s539300090"
] |
u588341295 | p03722 | python | s591888690 | s498443388 | 594 | 258 | 3,404 | 41,836 | Accepted | Accepted | 56.57 | # -*- coding: utf-8 -*-
"""
ใปใใซใใณใใฉใผใ
"""
import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
N, M = list(map(int, input().split()))
edges = [None] * M
for i in range(M):
a, b, c = list(map(int, input().split()))
# 0-indexed
# ใณในใใฎๆญฃ่ฒ ใ้่ปขใใใใฐๆ็ญ็ต่ทฏๅ้กใจใใฆ... | # -*- coding: utf-8 -*-
"""
ๅ่๏ผhttps://img.atcoder.jp/abc061/editorial.pdf
ใปใใซใใณใใฉใผใ
ใป่ฒ ใฎ้่ทฏใใใฃใฆใใใใใซ้ ็นNใๅซใพใใชใใใฐไปๅใฏOK
ใใฃใฆ็นใซๆฐไปใใชใใฃใใผใ
"""
import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
N, M = list(map(int, input().split()))
edges = [None] * M
for i in range(M... | 44 | 49 | 1,080 | 1,259 | # -*- coding: utf-8 -*-
"""
ใปใใซใใณใใฉใผใ
"""
import sys
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(10**9)
N, M = list(map(int, input().split()))
edges = [None] * M
for i in range(M):
a, b, c = list(map(int, input().split()))
# 0-indexed
# ใณในใใฎๆญฃ่ฒ ใ้่ปขใใใใฐๆ็ญ็ต่ทฏๅ้กใจใใฆๅฆ็ใงใใ
edge... | # -*- coding: utf-8 -*-
"""
ๅ่๏ผhttps://img.atcoder.jp/abc061/editorial.pdf
ใปใใซใใณใใฉใผใ
ใป่ฒ ใฎ้่ทฏใใใฃใฆใใใใใซ้ ็นNใๅซใพใใชใใใฐไปๅใฏOK
ใใฃใฆ็นใซๆฐไปใใชใใฃใใผใ
"""
import sys
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(10**9)
N, M = list(map(int, input().split()))
edges = [None] * M
for i in range(M):
a, b, c... | false | 10.204082 | [
"+ๅ่๏ผhttps://img.atcoder.jp/abc061/editorial.pdf",
"+ใป่ฒ ใฎ้่ทฏใใใฃใฆใใใใใซ้ ็นNใๅซใพใใชใใใฐไปๅใฏOK",
"+ใใฃใฆ็นใซๆฐไปใใชใใฃใใผใ",
"- verts[dest] = min(verts[src] + cost, verts[dest])",
"+ if verts[dest] > verts[src] + cost:",
"+ verts[dest] = verts[src] + cost",
"- for src, dest, cost in ... | false | 0.036662 | 0.035424 | 1.034946 | [
"s591888690",
"s498443388"
] |
u785066634 | p02817 | python | s697117971 | s973887908 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | b, c = list(map(str, input().split()))
print((c+b)) | s,t=list(map(str,input().split()))
print((t+s)) | 3 | 3 | 46 | 42 | b, c = list(map(str, input().split()))
print((c + b))
| s, t = list(map(str, input().split()))
print((t + s))
| false | 0 | [
"-b, c = list(map(str, input().split()))",
"-print((c + b))",
"+s, t = list(map(str, input().split()))",
"+print((t + s))"
] | false | 0.066108 | 0.048349 | 1.367302 | [
"s697117971",
"s973887908"
] |
u925626880 | p03478 | python | s117740636 | s715304873 | 30 | 27 | 2,940 | 2,940 | Accepted | Accepted | 10 | # -*- coding: utf-8 -*-
n, a, b = list(map(int, input().split()))
s = 0
for i in range(1, n+1):
if a <= sum(map(int, str(i))) <=b:
s += i
print(s)
| # -*- coding: utf-8 -*-
n, a, b = list(map(int, input().split()))
s = 0
print((sum(i if a <= sum(map(int, str(i))) <=b else 0
for i in range(1,n+1))))
| 11 | 8 | 173 | 170 | # -*- coding: utf-8 -*-
n, a, b = list(map(int, input().split()))
s = 0
for i in range(1, n + 1):
if a <= sum(map(int, str(i))) <= b:
s += i
print(s)
| # -*- coding: utf-8 -*-
n, a, b = list(map(int, input().split()))
s = 0
print((sum(i if a <= sum(map(int, str(i))) <= b else 0 for i in range(1, n + 1))))
| false | 27.272727 | [
"-for i in range(1, n + 1):",
"- if a <= sum(map(int, str(i))) <= b:",
"- s += i",
"-print(s)",
"+print((sum(i if a <= sum(map(int, str(i))) <= b else 0 for i in range(1, n + 1))))"
] | false | 0.046819 | 0.047102 | 0.994006 | [
"s117740636",
"s715304873"
] |
u374531474 | p03592 | python | s817534392 | s149521687 | 317 | 18 | 2,940 | 2,940 | Accepted | Accepted | 94.32 | N, M, K = list(map(int, input().split()))
ans = False
for n in range(N + 1):
for m in range(M + 1):
if n * (M - m) + m * (N - n) == K:
ans = True
break
else:
continue
break
print(('Yes' if ans else 'No'))
| N, M, K = list(map(int, input().split()))
ans = False
for n in range(N + 1):
if 2 * n == N:
if M * n == K:
ans = True
break
else:
num = M * n - K
denom = 2 * n - N
if num % denom == 0 and 0 <= num // denom <= M:
ans = True
... | 12 | 15 | 261 | 356 | N, M, K = list(map(int, input().split()))
ans = False
for n in range(N + 1):
for m in range(M + 1):
if n * (M - m) + m * (N - n) == K:
ans = True
break
else:
continue
break
print(("Yes" if ans else "No"))
| N, M, K = list(map(int, input().split()))
ans = False
for n in range(N + 1):
if 2 * n == N:
if M * n == K:
ans = True
break
else:
num = M * n - K
denom = 2 * n - N
if num % denom == 0 and 0 <= num // denom <= M:
ans = True
break
pri... | false | 20 | [
"- for m in range(M + 1):",
"- if n * (M - m) + m * (N - n) == K:",
"+ if 2 * n == N:",
"+ if M * n == K:",
"- continue",
"- break",
"+ num = M * n - K",
"+ denom = 2 * n - N",
"+ if num % denom == 0 and 0 <= num // denom <= M:",
"+ ans... | false | 0.099521 | 0.035728 | 2.785522 | [
"s817534392",
"s149521687"
] |
u133936772 | p02947 | python | s294280828 | s127352936 | 404 | 346 | 10,640 | 19,404 | Accepted | Accepted | 14.36 | n = int(eval(input()))
l = []
for i in range(n):
l.append(''.join(sorted(eval(input()))))
l.sort()
cnt = 0
ans = 0
for i in range(n-1):
if l[i+1] == l[i]:
cnt += 1
ans += cnt
else:
cnt = 0
print(ans) | n = int(eval(input()))
l = [''.join(sorted(eval(input()))) for _ in range(n)]
d = {}
ans = 0
for s in l:
if s in d:
d[s] += 1
ans += d[s]-1
else:
d[s] = 1
print(ans) | 15 | 14 | 220 | 185 | n = int(eval(input()))
l = []
for i in range(n):
l.append("".join(sorted(eval(input()))))
l.sort()
cnt = 0
ans = 0
for i in range(n - 1):
if l[i + 1] == l[i]:
cnt += 1
ans += cnt
else:
cnt = 0
print(ans)
| n = int(eval(input()))
l = ["".join(sorted(eval(input()))) for _ in range(n)]
d = {}
ans = 0
for s in l:
if s in d:
d[s] += 1
ans += d[s] - 1
else:
d[s] = 1
print(ans)
| false | 6.666667 | [
"-l = []",
"-for i in range(n):",
"- l.append(\"\".join(sorted(eval(input()))))",
"-l.sort()",
"-cnt = 0",
"+l = [\"\".join(sorted(eval(input()))) for _ in range(n)]",
"+d = {}",
"-for i in range(n - 1):",
"- if l[i + 1] == l[i]:",
"- cnt += 1",
"- ans += cnt",
"+for s in l... | false | 0.04423 | 0.111158 | 0.397904 | [
"s294280828",
"s127352936"
] |
u879870653 | p02981 | python | s699795811 | s286244680 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | N,A,B=list(map(int,input().split()));print((min(A*N,B))) | N, A, B = list(map(int,input().split()))
print((min(N*A, B))) | 1 | 2 | 48 | 54 | N, A, B = list(map(int, input().split()))
print((min(A * N, B)))
| N, A, B = list(map(int, input().split()))
print((min(N * A, B)))
| false | 50 | [
"-print((min(A * N, B)))",
"+print((min(N * A, B)))"
] | false | 0.147196 | 0.066814 | 2.203065 | [
"s699795811",
"s286244680"
] |
u831244171 | p02274 | python | s725743611 | s807182582 | 1,780 | 1,640 | 31,064 | 30,280 | Accepted | Accepted | 7.87 | from collections import deque
def mergeSort(A,left,right):
middle = (left + right) // 2
if left + 1 < right:
mergeSort(A, left, middle)
mergeSort(A, middle, right)
merge(A,left,right,middle)
def merge(A,left,right,middle):
global count
L = deque(A[left:... | from _collections import deque
SENIAL = 1000000000
def mergeSort(A,left,right):
if left + 1 < right:
middle = (left + right) // 2
mergeSort(A, left, middle)
mergeSort(A, middle, right)
merge(A,left,right,middle)
def merge(A,left,right,middle):
global count ... | 28 | 27 | 694 | 696 | from collections import deque
def mergeSort(A, left, right):
middle = (left + right) // 2
if left + 1 < right:
mergeSort(A, left, middle)
mergeSort(A, middle, right)
merge(A, left, right, middle)
def merge(A, left, right, middle):
global count
L = deque(A[left:middle])
R ... | from _collections import deque
SENIAL = 1000000000
def mergeSort(A, left, right):
if left + 1 < right:
middle = (left + right) // 2
mergeSort(A, left, middle)
mergeSort(A, middle, right)
merge(A, left, right, middle)
def merge(A, left, right, middle):
global count
L = de... | false | 3.571429 | [
"-from collections import deque",
"+from _collections import deque",
"+",
"+SENIAL = 1000000000",
"- middle = (left + right) // 2",
"+ middle = (left + right) // 2",
"- L.append(float(\"inf\"))",
"- R.append(float(\"inf\"))",
"+ L.append(SENIAL)",
"+ R.append(SENIAL)"
] | false | 0.039372 | 0.038359 | 1.026406 | [
"s725743611",
"s807182582"
] |
u396495667 | p03211 | python | s395731784 | s201907935 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | s = eval(input())
min = 100000000
for i in range(len(s)-2):
a = int(s[i:i+3])
dis = ((753-a)**2)**0.5
if dis <min:
min =dis
print((int(min))) | s = list(eval(input()))
a =''
l =[]
for i in range(2,len(s)):
a = s[i-2] + s[i-1] +s[i]
a_n = int(''.join(a))
b =abs(a_n-753)
l.append(b)
print((min(l))) | 8 | 9 | 150 | 161 | s = eval(input())
min = 100000000
for i in range(len(s) - 2):
a = int(s[i : i + 3])
dis = ((753 - a) ** 2) ** 0.5
if dis < min:
min = dis
print((int(min)))
| s = list(eval(input()))
a = ""
l = []
for i in range(2, len(s)):
a = s[i - 2] + s[i - 1] + s[i]
a_n = int("".join(a))
b = abs(a_n - 753)
l.append(b)
print((min(l)))
| false | 11.111111 | [
"-s = eval(input())",
"-min = 100000000",
"-for i in range(len(s) - 2):",
"- a = int(s[i : i + 3])",
"- dis = ((753 - a) ** 2) ** 0.5",
"- if dis < min:",
"- min = dis",
"-print((int(min)))",
"+s = list(eval(input()))",
"+a = \"\"",
"+l = []",
"+for i in range(2, len(s)):",
"... | false | 0.048487 | 0.049811 | 0.973422 | [
"s395731784",
"s201907935"
] |
u368780724 | p03033 | python | s587488402 | s905109284 | 1,895 | 1,665 | 142,584 | 131,736 | Accepted | Accepted | 12.14 | import sys
from itertools import accumulate
from collections import Counter
from bisect import bisect as br, bisect_left as bl
from operator import itemgetter
class DammyMap:
#1-indexed
def __init__(self, A, B):
#Aใซๅๆ็ถๆ
ใฎ่ฆ็ด ใใในใฆๅ
ฅใใ,Bใฏๅคๅใฎใชในใ
self.X, self.comp = self.compress(B)
se... | import sys
from itertools import accumulate
from collections import Counter
from bisect import bisect as br, bisect_left as bl
from operator import itemgetter
class DammyMap:
#1-indexed
def __init__(self, A, B):
#Aใซๅๆ็ถๆ
ใฎ่ฆ็ด ใใในใฆๅ
ฅใใ,Bใฏๅคๅใฎใชในใ
#self.X, self.comp = self.compress(B)
s... | 104 | 98 | 2,643 | 2,584 | import sys
from itertools import accumulate
from collections import Counter
from bisect import bisect as br, bisect_left as bl
from operator import itemgetter
class DammyMap:
# 1-indexed
def __init__(self, A, B):
# Aใซๅๆ็ถๆ
ใฎ่ฆ็ด ใใในใฆๅ
ฅใใ,Bใฏๅคๅใฎใชในใ
self.X, self.comp = self.compress(B)
self.siz... | import sys
from itertools import accumulate
from collections import Counter
from bisect import bisect as br, bisect_left as bl
from operator import itemgetter
class DammyMap:
# 1-indexed
def __init__(self, A, B):
# Aใซๅๆ็ถๆ
ใฎ่ฆ็ด ใใในใฆๅ
ฅใใ,Bใฏๅคๅใฎใชในใ
# self.X, self.comp = self.compress(B)
self.X... | false | 5.769231 | [
"- self.X, self.comp = self.compress(B)",
"+ # self.X, self.comp = self.compress(B)",
"+ self.X = B[:]",
"+ self.comp = {v: k for k, v in enumerate(D, 1)}",
"-def compress(L):",
"- L2 = list(set(L))",
"- L2.sort()",
"- C = {v: k for k, v in enumerate(L2)}",
"- ... | false | 0.03836 | 0.038231 | 1.003365 | [
"s587488402",
"s905109284"
] |
u113971909 | p02550 | python | s168825582 | s766446255 | 89 | 78 | 13,124 | 13,312 | Accepted | Accepted | 12.36 | #!/usr/bin python3
# -*- coding: utf-8 -*-
n, x, m = list(map(int, input().split()))
s = set([])
v = []
for i in range(m+1):
s.add(x)
v.append(x)
x = pow(x,2,m)
if x in s:
break
st = v.index(x)
lp = len(v)-st
lps = sum(v[st:])
k = (n-(st+lp)+(lp-1))//lp
ret = lps * k
n -= l... | #!/usr/bin python3
# -*- coding: utf-8 -*-
# ใซใผใใๆค็ดขใใฆ่จ็ฎ้ๅง็ธฎ
# 0->1->...->st->st+1->...->st+lp-1-โ
# โโโโโโโโโโโโโโโโโโโโโโโ
# lp
n, x, m = list(map(int, input().split()))
seen = set([])
seqs = []
for i in range(m+1):
seen.add(x)
seqs.append(x)
x = pow(x,2... | 23 | 31 | 352 | 592 | #!/usr/bin python3
# -*- coding: utf-8 -*-
n, x, m = list(map(int, input().split()))
s = set([])
v = []
for i in range(m + 1):
s.add(x)
v.append(x)
x = pow(x, 2, m)
if x in s:
break
st = v.index(x)
lp = len(v) - st
lps = sum(v[st:])
k = (n - (st + lp) + (lp - 1)) // lp
ret = lps * k
n -= lp * k
... | #!/usr/bin python3
# -*- coding: utf-8 -*-
# ใซใผใใๆค็ดขใใฆ่จ็ฎ้ๅง็ธฎ
# 0->1->...->st->st+1->...->st+lp-1-โ
# โโโโโโโโโโโโโโโโโโโโโโโ
# lp
n, x, m = list(map(int, input().split()))
seen = set([])
seqs = []
for i in range(m + 1):
seen.add(x)
seqs.append(x)
x = pow(x, 2, m)
if x in ... | false | 25.806452 | [
"+# ใซใผใใๆค็ดขใใฆ่จ็ฎ้ๅง็ธฎ",
"+# 0->1->...->st->st+1->...->st+lp-1-โ",
"+# โโโโโโโโโโโโโโโโโโโโโโโ",
"+# lp",
"-s = set([])",
"-v = []",
"+seen = set([])",
"+seqs = []",
"- s.add(x)",
"- v.append(x)",
"+ seen.add(x)",
"+ seqs.append(x)",
"- if x in s:"... | false | 0.081979 | 0.085125 | 0.963046 | [
"s168825582",
"s766446255"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.