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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u912237403 | p00097 | python | s452624852 | s962635902 | 310 | 220 | 4,396 | 4,388 | Accepted | Accepted | 29.03 | m=1001
A=list(range(9))
d=[[0]*m for i in A]
for i in range(101):
for j in A[::-1]:
if j==0: d[j][i]=1
else:
for k in range(m):
if k+i<m: d[j][k+i]+=d[j-1][k]
while 1:
n,s=list(map(int,input().split()))
if n==s==0: break
print(d[n-1][s]) | m=1001
A=list(range(9))
d=[[0]*m for i in A]
for i in range(101):
for j in A[::-1]:
if j==0: d[j][i]=1
else:
for k in range(m-i): d[j][k+i]+=d[j-1][k]
while 1:
n,s=list(map(int,input().split()))
if n==s==0: break
print(d[n-1][s]) | 13 | 12 | 270 | 253 | m = 1001
A = list(range(9))
d = [[0] * m for i in A]
for i in range(101):
for j in A[::-1]:
if j == 0:
d[j][i] = 1
else:
for k in range(m):
if k + i < m:
d[j][k + i] += d[j - 1][k]
while 1:
n, s = list(map(int, input().split()))
if ... | m = 1001
A = list(range(9))
d = [[0] * m for i in A]
for i in range(101):
for j in A[::-1]:
if j == 0:
d[j][i] = 1
else:
for k in range(m - i):
d[j][k + i] += d[j - 1][k]
while 1:
n, s = list(map(int, input().split()))
if n == s == 0:
break
... | false | 7.692308 | [
"- for k in range(m):",
"- if k + i < m:",
"- d[j][k + i] += d[j - 1][k]",
"+ for k in range(m - i):",
"+ d[j][k + i] += d[j - 1][k]"
] | false | 1.226004 | 0.425101 | 2.88403 | [
"s452624852",
"s962635902"
] |
u802963389 | p03427 | python | s515727712 | s661567944 | 181 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.61 | n = eval(input())
if len(n) == 1:
print((int(n)))
else:
all9flg = True
for i in range(1, len(n)):
if n[i] != "9":
all9flg = False
if all9flg:
print((9 * (len(n) - 1) + int(n[0])))
else:
print((9 * (len(n) - 1) + int(n[0]) - 1)) | n = eval(input())
k = len(n)
if all([i == "9" for i in n[1:]]):
print((int(n[0]) + (k - 1) * 9))
else:
print((int(n[0]) - 1 + (k - 1) * 9))
| 12 | 6 | 254 | 139 | n = eval(input())
if len(n) == 1:
print((int(n)))
else:
all9flg = True
for i in range(1, len(n)):
if n[i] != "9":
all9flg = False
if all9flg:
print((9 * (len(n) - 1) + int(n[0])))
else:
print((9 * (len(n) - 1) + int(n[0]) - 1))
| n = eval(input())
k = len(n)
if all([i == "9" for i in n[1:]]):
print((int(n[0]) + (k - 1) * 9))
else:
print((int(n[0]) - 1 + (k - 1) * 9))
| false | 50 | [
"-if len(n) == 1:",
"- print((int(n)))",
"+k = len(n)",
"+if all([i == \"9\" for i in n[1:]]):",
"+ print((int(n[0]) + (k - 1) * 9))",
"- all9flg = True",
"- for i in range(1, len(n)):",
"- if n[i] != \"9\":",
"- all9flg = False",
"- if all9flg:",
"- print... | false | 0.113225 | 0.044619 | 2.537597 | [
"s515727712",
"s661567944"
] |
u525065967 | p03266 | python | s053532539 | s223542617 | 198 | 17 | 3,060 | 2,940 | Accepted | Accepted | 91.41 | n, k = list(map(int,input().split()))
ans = 0
q, r = divmod(n, k)
for a in range(1, n+1):
b = k - a%k
c = k - b%k
if (c + a)%k == 0:
now = 1
if 1 <= b%k <= r: now *= q+1
else: now *= q
if 1 <= c%k <= r: now *= q+1
else: now *= q
ans += now
print(a... | n, k = list(map(int,input().split()))
f = n//k
ans = f**3
if k%2 == 0:
h = n//(k//2) - f
ans += h**3
print(ans)
| 14 | 7 | 318 | 120 | n, k = list(map(int, input().split()))
ans = 0
q, r = divmod(n, k)
for a in range(1, n + 1):
b = k - a % k
c = k - b % k
if (c + a) % k == 0:
now = 1
if 1 <= b % k <= r:
now *= q + 1
else:
now *= q
if 1 <= c % k <= r:
now *= q + 1
e... | n, k = list(map(int, input().split()))
f = n // k
ans = f**3
if k % 2 == 0:
h = n // (k // 2) - f
ans += h**3
print(ans)
| false | 50 | [
"-ans = 0",
"-q, r = divmod(n, k)",
"-for a in range(1, n + 1):",
"- b = k - a % k",
"- c = k - b % k",
"- if (c + a) % k == 0:",
"- now = 1",
"- if 1 <= b % k <= r:",
"- now *= q + 1",
"- else:",
"- now *= q",
"- if 1 <= c % k <= r:",... | false | 0.0388 | 0.039659 | 0.978334 | [
"s053532539",
"s223542617"
] |
u621935300 | p02803 | python | s408762349 | s964446189 | 214 | 179 | 34,280 | 34,024 | Accepted | Accepted | 16.36 | # -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
H,W=list(map(int, sys.stdin.readline().split()))
S=[ sys.stdin.readline().strip() for _ in range(H) ]
D=[(1,0),(-1,0),(0,1),(0,-1)]
def bfs(start):
Visit={}
q=deque()
q.append(start)
... | # -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
H,W=list(map(int, sys.stdin.readline().split()))
S=[ sys.stdin.readline().strip() for _ in range(H) ]
D=[(1,0),(-1,0),(0,1),(0,-1)]
def bfs(start):
Visit={}
q=deque()
q.append(start)
Vis... | 40 | 37 | 1,009 | 898 | # -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
H, W = list(map(int, sys.stdin.readline().split()))
S = [sys.stdin.readline().strip() for _ in range(H)]
D = [(1, 0), (-1, 0), (0, 1), (0, -1)]
def bfs(start):
Visit = {}
q = deque()
q.append(start)
V... | # -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
H, W = list(map(int, sys.stdin.readline().split()))
S = [sys.stdin.readline().strip() for _ in range(H)]
D = [(1, 0), (-1, 0), (0, 1), (0, -1)]
def bfs(start):
Visit = {}
q = deque()
q.append(start)
V... | false | 7.5 | [
"- L = defaultdict(lambda: float(\"inf\")) # 距離",
"- L[start] = 0",
"+ L = defaultdict(lambda: 0) # 距離",
"- L[(to_x, to_y)] = min(L[(to_x, to_y)], L[(fro_x, fro_y)] + 1)",
"+ L[(to_x, to_y)] = L[(fro_x, fro_y)] + 1",
"- if len(list(L.values())) == 0:",
... | false | 0.109385 | 0.110965 | 0.985761 | [
"s408762349",
"s964446189"
] |
u905582793 | p03855 | python | s622249550 | s861398638 | 1,338 | 803 | 144,464 | 139,348 | Accepted | Accepted | 39.99 | from collections import defaultdict
n,k,l = list(map(int,input().split()))
road = [list(map(int,input().split())) for i in range(k)]
train = [list(map(int,input().split())) for i in range(l)]
rg = [[] for i in range(n+1)]
rv = [0 for i in range(n+1)]
tg = [[] for i in range(n+1)]
tv = [0 for i in range(n+1)]
de... | from collections import defaultdict
import sys
input = sys.stdin.readline
n,k,l = list(map(int,input().split()))
road = [list(map(int,input().split())) for i in range(k)]
train = [list(map(int,input().split())) for i in range(l)]
rg = [[] for i in range(n+1)]
rv = [0 for i in range(n+1)]
tg = [[] for i in range... | 37 | 39 | 922 | 961 | from collections import defaultdict
n, k, l = list(map(int, input().split()))
road = [list(map(int, input().split())) for i in range(k)]
train = [list(map(int, input().split())) for i in range(l)]
rg = [[] for i in range(n + 1)]
rv = [0 for i in range(n + 1)]
tg = [[] for i in range(n + 1)]
tv = [0 for i in range(n + ... | from collections import defaultdict
import sys
input = sys.stdin.readline
n, k, l = list(map(int, input().split()))
road = [list(map(int, input().split())) for i in range(k)]
train = [list(map(int, input().split())) for i in range(l)]
rg = [[] for i in range(n + 1)]
rv = [0 for i in range(n + 1)]
tg = [[] for i in ran... | false | 5.128205 | [
"+import sys",
"+input = sys.stdin.readline",
"-def connect(",
"- road,",
"- rg,",
"- rv,",
"-):",
"+def connect(road, rg, rv):"
] | false | 0.045672 | 0.040763 | 1.120426 | [
"s622249550",
"s861398638"
] |
u642874916 | p02702 | python | s359873157 | s618031847 | 189 | 145 | 89,672 | 78,884 | Accepted | Accepted | 23.28 | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product
import sys
import bisect
import string
import math
import time
def I(): return int(input())
def S(): return input()
... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time
def I(): return int(eval(input(... | 93 | 78 | 1,801 | 2,163 | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product
import sys
import bisect
import string
import math
import time
def I():
return int(input())
def S():
return input()
def MI... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import (
permutations,
combinations,
accumulate,
product,
combinations_with_replacement,
)
import sys
import bisect
import string
import math
import time
def I():
re... | false | 16.129032 | [
"-from itertools import permutations, combinations, accumulate, product",
"+from itertools import (",
"+ permutations,",
"+ combinations,",
"+ accumulate,",
"+ product,",
"+ combinations_with_replacement,",
"+)",
"- return int(input())",
"+ return int(eval(input()))",
"- ... | false | 0.044198 | 0.046286 | 0.95489 | [
"s359873157",
"s618031847"
] |
u046187684 | p03160 | python | s954253283 | s308942469 | 104 | 89 | 14,952 | 14,932 | Accepted | Accepted | 14.42 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def solve(ins):
ins = ins.split("\n")
h = list(map(int, ins[1].split(" ")))
# costs = [abs(h1 - h2) for h1, h2 in zip(h, h[1:])]
costs = [0, abs(h[0] - h[1])]
for i in range(2, len(h)):
costs.append(min(costs[i - 2] + abs(h[i] - h[i ... | def solve2(ins):
ins = ins.split("\n")
h = list(map(int, ins[1].split(" ")))
# costs = [abs(h1 - h2) for h1, h2 in zip(h, h[1:])]
a, b = 0, abs(h[0] - h[1])
for i in range(2, len(h)):
a, b = b, min(a + abs(h[i] - h[i - 2]), b + abs(h[i] - h[i - 1]))
return b
if __name__ == "_... | 16 | 12 | 468 | 380 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def solve(ins):
ins = ins.split("\n")
h = list(map(int, ins[1].split(" ")))
# costs = [abs(h1 - h2) for h1, h2 in zip(h, h[1:])]
costs = [0, abs(h[0] - h[1])]
for i in range(2, len(h)):
costs.append(
min(
costs[i - 2]... | def solve2(ins):
ins = ins.split("\n")
h = list(map(int, ins[1].split(" ")))
# costs = [abs(h1 - h2) for h1, h2 in zip(h, h[1:])]
a, b = 0, abs(h[0] - h[1])
for i in range(2, len(h)):
a, b = b, min(a + abs(h[i] - h[i - 2]), b + abs(h[i] - h[i - 1]))
return b
if __name__ == "__main__":
... | false | 25 | [
"-#!/usr/bin/env python3",
"-# -*- coding: utf-8 -*-",
"-def solve(ins):",
"+def solve2(ins):",
"- costs = [0, abs(h[0] - h[1])]",
"+ a, b = 0, abs(h[0] - h[1])",
"- costs.append(",
"- min(",
"- costs[i - 2] + abs(h[i] - h[i - 2]), costs[i - 1] + abs(h[i] - h[i... | false | 0.037151 | 0.037815 | 0.982439 | [
"s954253283",
"s308942469"
] |
u179169725 | p02763 | python | s416777066 | s016332220 | 1,017 | 808 | 31,348 | 48,920 | Accepted | Accepted | 20.55 | import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_matrix(H):
'''
H is number of rows
'''
return [list(map(int, read().split())) for _ in range(H)]
def read_map(H):
'''
H i... | # https://atcoder.jp/contests/abc157/tasks/abc157_e
# セグメント木
# 各文字をビットに対応させる(セグ木を26本持っても良い)
import sys
read = sys.stdin.readline
def read_a_int():
return int(read())
class SegmentTree:
def __init__(self, ls: list, segfunc, identity_element):
'''
セグ木 (下書き)
一次元のリストlsを受け取... | 107 | 95 | 2,153 | 2,723 | import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
def read_matrix(H):
"""
H is number of rows
"""
return [list(map(int, read().split())) for _ in range(H)]
def read_map(H):
"""
H is number of rows
... | # https://atcoder.jp/contests/abc157/tasks/abc157_e
# セグメント木
# 各文字をビットに対応させる(セグ木を26本持っても良い)
import sys
read = sys.stdin.readline
def read_a_int():
return int(read())
class SegmentTree:
def __init__(self, ls: list, segfunc, identity_element):
"""
セグ木 (下書き)
一次元のリストlsを受け取り初期化する。O(len(l... | false | 11.214953 | [
"+# https://atcoder.jp/contests/abc157/tasks/abc157_e",
"+# セグメント木",
"+# 各文字をビットに対応させる(セグ木を26本持っても良い)",
"-",
"-",
"-def read_ints():",
"- return list(map(int, read().split()))",
"-def read_matrix(H):",
"- \"\"\"",
"- H is number of rows",
"- \"\"\"",
"- return [list(map(int, rea... | false | 0.042373 | 0.041053 | 1.03217 | [
"s416777066",
"s016332220"
] |
u078042885 | p00553 | python | s846738214 | s796514135 | 30 | 20 | 7,728 | 7,724 | Accepted | Accepted | 33.33 | a,b,c,d,e=[int(eval(input())) for _ in range(5)]
if a<0:
print((-a*c+d+b*e))
else:
print(((b-a)*e)) | a,b,c,d,e=[int(eval(input())) for _ in range(5)]
print((-a*c+d+b*e if a<0 else (b-a)*e)) | 5 | 2 | 101 | 81 | a, b, c, d, e = [int(eval(input())) for _ in range(5)]
if a < 0:
print((-a * c + d + b * e))
else:
print(((b - a) * e))
| a, b, c, d, e = [int(eval(input())) for _ in range(5)]
print((-a * c + d + b * e if a < 0 else (b - a) * e))
| false | 60 | [
"-if a < 0:",
"- print((-a * c + d + b * e))",
"-else:",
"- print(((b - a) * e))",
"+print((-a * c + d + b * e if a < 0 else (b - a) * e))"
] | false | 0.044823 | 0.044671 | 1.003394 | [
"s846738214",
"s796514135"
] |
u653807637 | p02991 | python | s960957381 | s718797613 | 1,128 | 765 | 118,492 | 69,792 | Accepted | Accepted | 32.18 | from collections import deque
import sys
n, m = list(map(int, input().split()))
edges = [[[] for _ in range(3)] for _ in range(n + 1)]
for _ in range(m):
u, v = list(map(int, input().split()))
edges[u][0].append((v, 1))
edges[u][1].append((v, 2))
edges[u][2].append((v, 0))
s, t = list(map(int, inpu... | from collections import deque
import sys
n, m = list(map(int, input().split()))
edges = [[] for _ in range(n + 1)]
for _ in range(m):
u, v = list(map(int, input().split()))
edges[u].append(v)
s, t = list(map(int, input().split()))
visited = [[] for _ in range(n + 1)]
q = deque()
q.append((s, 0))
... | 35 | 33 | 696 | 581 | from collections import deque
import sys
n, m = list(map(int, input().split()))
edges = [[[] for _ in range(3)] for _ in range(n + 1)]
for _ in range(m):
u, v = list(map(int, input().split()))
edges[u][0].append((v, 1))
edges[u][1].append((v, 2))
edges[u][2].append((v, 0))
s, t = list(map(int, input().... | from collections import deque
import sys
n, m = list(map(int, input().split()))
edges = [[] for _ in range(n + 1)]
for _ in range(m):
u, v = list(map(int, input().split()))
edges[u].append(v)
s, t = list(map(int, input().split()))
visited = [[] for _ in range(n + 1)]
q = deque()
q.append((s, 0))
while q:
n... | false | 5.714286 | [
"-edges = [[[] for _ in range(3)] for _ in range(n + 1)]",
"+edges = [[] for _ in range(n + 1)]",
"- edges[u][0].append((v, 1))",
"- edges[u][1].append((v, 2))",
"- edges[u][2].append((v, 0))",
"+ edges[u].append(v)",
"-visited = [[[] for _ in range(3)] for _ in range(n + 1)]",
"+visited =... | false | 0.074914 | 0.032783 | 2.285175 | [
"s960957381",
"s718797613"
] |
u761529120 | p03837 | python | s098352783 | s020163450 | 428 | 266 | 3,700 | 44,144 | Accepted | Accepted | 37.85 | def warshall_floyd(d,N):
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j] = min(d[i][j],d[i][k]+d[k][j])
return d
# N:頂点, M:辺
N, M = list(map(int, input().split()))
d = [[float('inf') for i in range(N)] for i in range(N)]
edges = []
for i in ra... | def warshall_floyd(d):
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
return d
N, M = list(map(int, input().split()))
d = [[float('inf') for i in range(N)] for i in range(N)]
edges = []
for i in range(M):
... | 31 | 30 | 610 | 602 | def warshall_floyd(d, N):
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
return d
# N:頂点, M:辺
N, M = list(map(int, input().split()))
d = [[float("inf") for i in range(N)] for i in range(N)]
edges = []
for i in range(M):
... | def warshall_floyd(d):
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
return d
N, M = list(map(int, input().split()))
d = [[float("inf") for i in range(N)] for i in range(N)]
edges = []
for i in range(M):
a, b, c = lis... | false | 3.225806 | [
"-def warshall_floyd(d, N):",
"+def warshall_floyd(d):",
"-# N:頂点, M:辺",
"-for i in range(N):",
"- d[i][i] = 0",
"-warshall_floyd(d, N)",
"+warshall_floyd(d)",
"+# 与えられた頂点間の辺の距離が求めた最短距離より大きければ",
"+# その辺は使われない"
] | false | 0.043157 | 0.046289 | 0.932351 | [
"s098352783",
"s020163450"
] |
u717762991 | p02675 | python | s458810045 | s055896329 | 289 | 60 | 80,112 | 61,768 | Accepted | Accepted | 79.24 | a = input()[-1]
if a == '3':
print('bon')
elif a in list('0168'):
print('pon')
else:
print('hon') | x = input()[-1]
if x == '3':
print('bon')
elif x in list("0168"):
print('pon')
else:
print('hon') | 7 | 7 | 115 | 117 | a = input()[-1]
if a == "3":
print("bon")
elif a in list("0168"):
print("pon")
else:
print("hon")
| x = input()[-1]
if x == "3":
print("bon")
elif x in list("0168"):
print("pon")
else:
print("hon")
| false | 0 | [
"-a = input()[-1]",
"-if a == \"3\":",
"+x = input()[-1]",
"+if x == \"3\":",
"-elif a in list(\"0168\"):",
"+elif x in list(\"0168\"):"
] | false | 0.062603 | 0.034829 | 1.797419 | [
"s458810045",
"s055896329"
] |
u340010271 | p03273 | python | s683157847 | s699935277 | 44 | 19 | 4,084 | 3,316 | Accepted | Accepted | 56.82 | import copy
H,W=list(map(int,input().split()))
a=[eval(input()) for i in range(H)]
flag=True
while flag:
if '.'*W in a:
a.remove('.'*W)
H-=1
else:
flag=False
b=[0]*H
f=True
while f:
c=copy.deepcopy(a)
g=False
for i in range(W):# i列
if g:
b... | H,W=list(map(int,input().split()))
a=[list(eval(input())) for i in range(H)]
flag=True
while flag:
if ['.']*W in a:
a.remove(['.']*W)
H-=1
else:
flag=False
flag=True
b=[[row[i] for row in a] for i in range(W)]
while flag:
if ['.']*H in b:
b.remove(['.']*H)
... | 33 | 21 | 661 | 446 | import copy
H, W = list(map(int, input().split()))
a = [eval(input()) for i in range(H)]
flag = True
while flag:
if "." * W in a:
a.remove("." * W)
H -= 1
else:
flag = False
b = [0] * H
f = True
while f:
c = copy.deepcopy(a)
g = False
for i in range(W): # i列
if g:
... | H, W = list(map(int, input().split()))
a = [list(eval(input())) for i in range(H)]
flag = True
while flag:
if ["."] * W in a:
a.remove(["."] * W)
H -= 1
else:
flag = False
flag = True
b = [[row[i] for row in a] for i in range(W)]
while flag:
if ["."] * H in b:
b.remove(["."] ... | false | 36.363636 | [
"-import copy",
"-",
"-a = [eval(input()) for i in range(H)]",
"+a = [list(eval(input())) for i in range(H)]",
"- if \".\" * W in a:",
"- a.remove(\".\" * W)",
"+ if [\".\"] * W in a:",
"+ a.remove([\".\"] * W)",
"-b = [0] * H",
"-f = True",
"-while f:",
"- c = copy.deep... | false | 0.038378 | 0.036778 | 1.043496 | [
"s683157847",
"s699935277"
] |
u089230684 | p03307 | python | s810809442 | s036484609 | 21 | 17 | 3,188 | 2,940 | Accepted | Accepted | 19.05 | # -*-coding=utf-8-*-
n = int(eval(input()))
if n%2:
n *= 2
print(n) | n=int(eval(input()))
if n%2==0:
print(n)
else:
print((n*2))
| 5 | 5 | 69 | 64 | # -*-coding=utf-8-*-
n = int(eval(input()))
if n % 2:
n *= 2
print(n)
| n = int(eval(input()))
if n % 2 == 0:
print(n)
else:
print((n * 2))
| false | 0 | [
"-# -*-coding=utf-8-*-",
"-if n % 2:",
"- n *= 2",
"-print(n)",
"+if n % 2 == 0:",
"+ print(n)",
"+else:",
"+ print((n * 2))"
] | false | 0.040681 | 0.039614 | 1.026921 | [
"s810809442",
"s036484609"
] |
u346812984 | p03804 | python | s532708002 | s515557626 | 21 | 18 | 3,064 | 3,188 | Accepted | Accepted | 14.29 | N, M = list(map(int, input().split()))
A = []
B = []
# for _ in range(N):
# A.append(list(input()))
# for _ in range(M):
# B.append(list(input()))
for _ in range(N):
A.append(eval(input()))
for _ in range(M):
B.append(eval(input()))
for i in range(N - M + 1):
for j in range(N - M + 1... | def main():
N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
for h in range(N - M + 1):
for w in range(N - M + 1):
flag = True
for i in range(M):
for j in range(M):
... | 38 | 25 | 736 | 646 | N, M = list(map(int, input().split()))
A = []
B = []
# for _ in range(N):
# A.append(list(input()))
# for _ in range(M):
# B.append(list(input()))
for _ in range(N):
A.append(eval(input()))
for _ in range(M):
B.append(eval(input()))
for i in range(N - M + 1):
for j in range(N - M + 1):
# mat... | def main():
N, M = list(map(int, input().split()))
A = [eval(input()) for _ in range(N)]
B = [eval(input()) for _ in range(M)]
for h in range(N - M + 1):
for w in range(N - M + 1):
flag = True
for i in range(M):
for j in range(M):
if A[... | false | 34.210526 | [
"-N, M = list(map(int, input().split()))",
"-A = []",
"-B = []",
"-# for _ in range(N):",
"-# A.append(list(input()))",
"-# for _ in range(M):",
"-# B.append(list(input()))",
"-for _ in range(N):",
"- A.append(eval(input()))",
"-for _ in range(M):",
"- B.append(eval(input()))",
"... | false | 0.037449 | 0.03585 | 1.044603 | [
"s532708002",
"s515557626"
] |
u847467233 | p01931 | python | s840239763 | s188988770 | 80 | 30 | 5,788 | 5,788 | Accepted | Accepted | 62.5 | # AOJ 2831: Check answers
# Python3 2018.7.12 bal4u
n = int(eval(input()))
if n == 0: print((0))
else:
s = eval(input())
ans = 1
for i in range(1, len(s)):
if s[i-1] == 'x' and s[i] == 'x': break
ans += 1
print(ans)
| # AOJ 2831: Check answers
# Python3 2018.7.12 bal4u
n = int(eval(input()))
if n == 0: print((0))
else:
s = eval(input())
ans = 1; pre = s[0]
for t in s[1:]:
if pre == 'x' and t == 'x': break
pre = t; ans += 1
print(ans)
| 13 | 13 | 224 | 228 | # AOJ 2831: Check answers
# Python3 2018.7.12 bal4u
n = int(eval(input()))
if n == 0:
print((0))
else:
s = eval(input())
ans = 1
for i in range(1, len(s)):
if s[i - 1] == "x" and s[i] == "x":
break
ans += 1
print(ans)
| # AOJ 2831: Check answers
# Python3 2018.7.12 bal4u
n = int(eval(input()))
if n == 0:
print((0))
else:
s = eval(input())
ans = 1
pre = s[0]
for t in s[1:]:
if pre == "x" and t == "x":
break
pre = t
ans += 1
print(ans)
| false | 0 | [
"- for i in range(1, len(s)):",
"- if s[i - 1] == \"x\" and s[i] == \"x\":",
"+ pre = s[0]",
"+ for t in s[1:]:",
"+ if pre == \"x\" and t == \"x\":",
"+ pre = t"
] | false | 0.035165 | 0.041131 | 0.854962 | [
"s840239763",
"s188988770"
] |
u440180827 | p02388 | python | s533576453 | s249675585 | 30 | 20 | 7,580 | 7,608 | Accepted | Accepted | 33.33 | x = int(eval(input()))
print((x ** 3)) | print((int(eval(input())) ** 3)) | 2 | 1 | 31 | 24 | x = int(eval(input()))
print((x**3))
| print((int(eval(input())) ** 3))
| false | 50 | [
"-x = int(eval(input()))",
"-print((x**3))",
"+print((int(eval(input())) ** 3))"
] | false | 0.038565 | 0.040027 | 0.963479 | [
"s533576453",
"s249675585"
] |
u729133443 | p03238 | python | s320499304 | s837425280 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | i=input;print(('2'>i()and'Hello World'or int(i())+int(i()))) | n,*t=list(map(int,open(0)));print((n%2*'Hello World'or sum(t))) | 1 | 1 | 58 | 55 | i = input
print(("2" > i() and "Hello World" or int(i()) + int(i())))
| n, *t = list(map(int, open(0)))
print((n % 2 * "Hello World" or sum(t)))
| false | 0 | [
"-i = input",
"-print((\"2\" > i() and \"Hello World\" or int(i()) + int(i())))",
"+n, *t = list(map(int, open(0)))",
"+print((n % 2 * \"Hello World\" or sum(t)))"
] | false | 0.038548 | 0.038743 | 0.994985 | [
"s320499304",
"s837425280"
] |
u905203728 | p03438 | python | s850650646 | s200888570 | 28 | 25 | 4,724 | 4,596 | Accepted | Accepted | 10.71 | n=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
if a>b:count -=a-b
elif b>a:count +=(b-a)//2
print(("Yes" if count>=0 else "No")) | n=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
all=sum(B)-sum(A)
for a,b in zip(A,B):
if a>b:count -=a-b
elif b>a:count +=(b-a)//2
print(("Yes" if count>=0 else "No")) | 9 | 10 | 204 | 223 | n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
for a, b in zip(A, B):
if a > b:
count -= a - b
elif b > a:
count += (b - a) // 2
print(("Yes" if count >= 0 else "No"))
| n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
all = sum(B) - sum(A)
for a, b in zip(A, B):
if a > b:
count -= a - b
elif b > a:
count += (b - a) // 2
print(("Yes" if count >= 0 else "No"))
| false | 10 | [
"+all = sum(B) - sum(A)"
] | false | 0.036931 | 0.036898 | 1.000894 | [
"s850650646",
"s200888570"
] |
u620084012 | p02708 | python | s555636444 | s520946467 | 158 | 68 | 9,112 | 63,476 | Accepted | Accepted | 56.96 | N, K = list(map(int,input().split()))
MOD = 10**9 + 7
ans = 0
for i in range(K,N+2):
# iこ えらぶ
ans += (N+1)*N//2-(N-i)*(N-i+1)//2-i*(i-1)//2+1
ans %= MOD
print(ans)
| N, K = list(map(int,input().split()))
MOD = 10**9 + 7
ans = 0
for k in range(K,N+2):
m = (k*(k-1))//2
M = (k*(N+N-k+1))//2
ans += M-m+1
print((ans%MOD))
| 8 | 9 | 177 | 166 | N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for i in range(K, N + 2):
# iこ えらぶ
ans += (N + 1) * N // 2 - (N - i) * (N - i + 1) // 2 - i * (i - 1) // 2 + 1
ans %= MOD
print(ans)
| N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for k in range(K, N + 2):
m = (k * (k - 1)) // 2
M = (k * (N + N - k + 1)) // 2
ans += M - m + 1
print((ans % MOD))
| false | 11.111111 | [
"-for i in range(K, N + 2):",
"- # iこ えらぶ",
"- ans += (N + 1) * N // 2 - (N - i) * (N - i + 1) // 2 - i * (i - 1) // 2 + 1",
"- ans %= MOD",
"-print(ans)",
"+for k in range(K, N + 2):",
"+ m = (k * (k - 1)) // 2",
"+ M = (k * (N + N - k + 1)) // 2",
"+ ans += M - m + 1",
"+print(... | false | 0.046547 | 0.042967 | 1.083316 | [
"s555636444",
"s520946467"
] |
u721837294 | p02584 | python | s047913080 | s044357203 | 31 | 28 | 9,180 | 9,060 | Accepted | Accepted | 9.68 | x,k,d=list(map(int,input().split()))
if(x<0):
x=x*-1
if(x>=k*d):
print((x-(k*d)))
else:
r=x%d
g=x//d
k=k-g;
if(k%2==0):
print(r)
else:
ans=min(r+d,abs(r-d))
print(ans) | x,k,d=list(map(int,input().split()))
if(x<0):
x=x*-1
if(x>=k*d):
print((x-(k*d)))
else:
r=x%d
g=x//d
k=k-g;
if(k%2==0):
print(r)
else:
ans=abs(r-d)
print(ans)
| 14 | 14 | 224 | 216 | x, k, d = list(map(int, input().split()))
if x < 0:
x = x * -1
if x >= k * d:
print((x - (k * d)))
else:
r = x % d
g = x // d
k = k - g
if k % 2 == 0:
print(r)
else:
ans = min(r + d, abs(r - d))
print(ans)
| x, k, d = list(map(int, input().split()))
if x < 0:
x = x * -1
if x >= k * d:
print((x - (k * d)))
else:
r = x % d
g = x // d
k = k - g
if k % 2 == 0:
print(r)
else:
ans = abs(r - d)
print(ans)
| false | 0 | [
"- ans = min(r + d, abs(r - d))",
"+ ans = abs(r - d)"
] | false | 0.039419 | 0.04276 | 0.921867 | [
"s047913080",
"s044357203"
] |
u391589398 | p03946 | python | s769704455 | s351509240 | 147 | 84 | 25,392 | 20,716 | Accepted | Accepted | 42.86 | n, t = list(map(int, input().split()))
A = tuple(map(int, input().split()))
AI = [(i, a) for i, a in enumerate(A)]
AI = sorted(AI, key=lambda x: x[1])
# 小さい順に見ていく
count = 0
maxdiff = 0
visited = [0] * n
for i, a in AI:
if visited[i]:
continue
visited[i] = 1
for j in range(i+1, n):
... | n, t = list(map(int, input().split()))
A = tuple(map(int, input().split()))
count = 0
maxdiff = 0
mina = 10**9+1
for a in A:
mina = min(mina, a)
diff = a - mina
if diff > maxdiff:
count = 1
maxdiff = diff
elif diff == maxdiff:
count += 1
print(count) | 25 | 14 | 552 | 297 | n, t = list(map(int, input().split()))
A = tuple(map(int, input().split()))
AI = [(i, a) for i, a in enumerate(A)]
AI = sorted(AI, key=lambda x: x[1])
# 小さい順に見ていく
count = 0
maxdiff = 0
visited = [0] * n
for i, a in AI:
if visited[i]:
continue
visited[i] = 1
for j in range(i + 1, n):
if visit... | n, t = list(map(int, input().split()))
A = tuple(map(int, input().split()))
count = 0
maxdiff = 0
mina = 10**9 + 1
for a in A:
mina = min(mina, a)
diff = a - mina
if diff > maxdiff:
count = 1
maxdiff = diff
elif diff == maxdiff:
count += 1
print(count)
| false | 44 | [
"-AI = [(i, a) for i, a in enumerate(A)]",
"-AI = sorted(AI, key=lambda x: x[1])",
"-# 小さい順に見ていく",
"-visited = [0] * n",
"-for i, a in AI:",
"- if visited[i]:",
"- continue",
"- visited[i] = 1",
"- for j in range(i + 1, n):",
"- if visited[j]:",
"- break",
"- ... | false | 0.043073 | 0.10183 | 0.422992 | [
"s769704455",
"s351509240"
] |
u259738923 | p03207 | python | s719634705 | s917662241 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | N = int(eval(input()))
max_item = 0
sum_item = 0
i = 0
while N > i:
c = int(eval(input()))
sum_item += c
max_item = max(c, max_item)
i += 1
sum_item -= max_item // 2
print(sum_item) | N = int(eval(input()))
pi = [int(eval(input())) for _ in range(N)]
print((sum(pi) - max(pi)//2)) | 13 | 3 | 268 | 84 | N = int(eval(input()))
max_item = 0
sum_item = 0
i = 0
while N > i:
c = int(eval(input()))
sum_item += c
max_item = max(c, max_item)
i += 1
sum_item -= max_item // 2
print(sum_item)
| N = int(eval(input()))
pi = [int(eval(input())) for _ in range(N)]
print((sum(pi) - max(pi) // 2))
| false | 76.923077 | [
"-max_item = 0",
"-sum_item = 0",
"-i = 0",
"-while N > i:",
"- c = int(eval(input()))",
"- sum_item += c",
"- max_item = max(c, max_item)",
"- i += 1",
"-sum_item -= max_item // 2",
"-print(sum_item)",
"+pi = [int(eval(input())) for _ in range(N)]",
"+print((sum(pi) - max(pi) // 2... | false | 0.041554 | 0.041502 | 1.001262 | [
"s719634705",
"s917662241"
] |
u470542271 | p02619 | python | s895659051 | s933470280 | 105 | 93 | 68,360 | 69,412 | Accepted | Accepted | 11.43 | D = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(eval(input())) for _ in range(D)]
last = [-1] * 26
S = 0
for d in range(D):
S += s[d][t[d] - 1]
last[t[d] - 1] = d
for i in range(26):
S -= c[i] * (d - last[i])
... | D = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(eval(input())) for _ in range(D)]
lasts = [[-1] * 26 for _ in range(D + 1)]
S = 0
for d in range(D):
S += s[d][t[d] - 1]
for i in range(26):
if i == t[d] - 1:
... | 15 | 21 | 323 | 473 | D = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(eval(input())) for _ in range(D)]
last = [-1] * 26
S = 0
for d in range(D):
S += s[d][t[d] - 1]
last[t[d] - 1] = d
for i in range(26):
S -= c[i] * (d - last[i])
print(S)
| D = int(eval(input()))
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(eval(input())) for _ in range(D)]
lasts = [[-1] * 26 for _ in range(D + 1)]
S = 0
for d in range(D):
S += s[d][t[d] - 1]
for i in range(26):
if i == t[d] - 1:
lasts[d +... | false | 28.571429 | [
"-last = [-1] * 26",
"+lasts = [[-1] * 26 for _ in range(D + 1)]",
"- last[t[d] - 1] = d",
"- S -= c[i] * (d - last[i])",
"+ if i == t[d] - 1:",
"+ lasts[d + 1][i] = d",
"+ else:",
"+ lasts[d + 1][i] = lasts[d][i]",
"+ for i in range(26):",
"+ ... | false | 0.037098 | 0.036095 | 1.027811 | [
"s895659051",
"s933470280"
] |
u604774382 | p02269 | python | s803521525 | s482595806 | 3,740 | 1,560 | 59,556 | 69,692 | Accepted | Accepted | 58.29 | n = int( eval(input( )) )
dic = {}
output = []
for i in range( n ):
cmd, word = input( ).split( " " )
if "insert" == cmd:
dic[ word ] = True
elif "find" == cmd:
try:
dic[ word ]
output.append( "yes" )
except KeyError:
output.append( "no" )
print(( "\n".join( output ) )) | n = int( input( ) )
dic = {}
output = []
for i in range( n ):
cmd, word = input( ).split( " " )
if "insert" == cmd:
dic[ word ] = True
elif "find" == cmd:
if not dic.get( word ):
output.append( "no" )
else:
output.append( "yes" )
print(( "\n".join( output ) )) | 15 | 14 | 295 | 295 | n = int(eval(input()))
dic = {}
output = []
for i in range(n):
cmd, word = input().split(" ")
if "insert" == cmd:
dic[word] = True
elif "find" == cmd:
try:
dic[word]
output.append("yes")
except KeyError:
output.append("no")
print(("\n".join(output)... | n = int(input())
dic = {}
output = []
for i in range(n):
cmd, word = input().split(" ")
if "insert" == cmd:
dic[word] = True
elif "find" == cmd:
if not dic.get(word):
output.append("no")
else:
output.append("yes")
print(("\n".join(output)))
| false | 6.666667 | [
"-n = int(eval(input()))",
"+n = int(input())",
"- try:",
"- dic[word]",
"+ if not dic.get(word):",
"+ output.append(\"no\")",
"+ else:",
"- except KeyError:",
"- output.append(\"no\")"
] | false | 0.037889 | 0.045418 | 0.834231 | [
"s803521525",
"s482595806"
] |
u391731808 | p03418 | python | s665709267 | s699013748 | 85 | 66 | 3,060 | 3,060 | Accepted | Accepted | 22.35 | N,K = list(map(int,input().split()))
ans = 0
for b in range(K+1,N+1):
ans += N//b*(b-K) + max(0,N%b-K+1)
if K==0:ans = N*N
print(ans) | N,K = list(map(int,input().split()))
ans = sum(N//b*(b-K) + max(0,N%b-K+1) for b in range(K+1,N+1)) if K>0 else N*N
print(ans) | 6 | 3 | 136 | 122 | N, K = list(map(int, input().split()))
ans = 0
for b in range(K + 1, N + 1):
ans += N // b * (b - K) + max(0, N % b - K + 1)
if K == 0:
ans = N * N
print(ans)
| N, K = list(map(int, input().split()))
ans = (
sum(N // b * (b - K) + max(0, N % b - K + 1) for b in range(K + 1, N + 1))
if K > 0
else N * N
)
print(ans)
| false | 50 | [
"-ans = 0",
"-for b in range(K + 1, N + 1):",
"- ans += N // b * (b - K) + max(0, N % b - K + 1)",
"-if K == 0:",
"- ans = N * N",
"+ans = (",
"+ sum(N // b * (b - K) + max(0, N % b - K + 1) for b in range(K + 1, N + 1))",
"+ if K > 0",
"+ else N * N",
"+)"
] | false | 0.038809 | 0.04045 | 0.959434 | [
"s665709267",
"s699013748"
] |
u498487134 | p02913 | python | s097325584 | s374676632 | 609 | 230 | 50,396 | 45,040 | Accepted | Accepted | 62.23 | def Z(s):
n=len(s)
lcp=[0]*n
lcp[0]=n
L,R=0,0
for i in range(1,n):
if(i>=R): # 過去の結果の再利用が不可
L=i
R=i
while(R<n and s[R-L]==s[R]):
R+=1
lcp[i]=R-L
elif(lcp[i-L]<R-i): # 過去の結果を再利用
lcp[i]=lcp[i-L]
... | class RollingHash(object):
"""
construct: O(N)
query:
hash: O(1)
lcp: O(logN)
search: O(N)
"""
__base1=1007; __mod1=10**9
__base2=1009; __mod2=10**7
def __init__(self,s):
"""
s: str
"""
n=len(s)
self.__s=s
... | 35 | 116 | 724 | 2,953 | def Z(s):
n = len(s)
lcp = [0] * n
lcp[0] = n
L, R = 0, 0
for i in range(1, n):
if i >= R: # 過去の結果の再利用が不可
L = i
R = i
while R < n and s[R - L] == s[R]:
R += 1
lcp[i] = R - L
elif lcp[i - L] < R - i: # 過去の結果を再利用
... | class RollingHash(object):
"""
construct: O(N)
query:
hash: O(1)
lcp: O(logN)
search: O(N)
"""
__base1 = 1007
__mod1 = 10**9
__base2 = 1009
__mod2 = 10**7
def __init__(self, s):
"""
s: str
"""
n = len(s)
self.__s = s
... | false | 69.827586 | [
"-def Z(s):",
"- n = len(s)",
"- lcp = [0] * n",
"- lcp[0] = n",
"- L, R = 0, 0",
"- for i in range(1, n):",
"- if i >= R: # 過去の結果の再利用が不可",
"- L = i",
"- R = i",
"- while R < n and s[R - L] == s[R]:",
"- R += 1",
"- ... | false | 0.006851 | 0.040412 | 0.169522 | [
"s097325584",
"s374676632"
] |
u767797498 | p02694 | python | s806851939 | s592197480 | 31 | 28 | 9,120 | 9,080 | Accepted | Accepted | 9.68 | def solve(x):
money = 100
year = 0
while money < x:
money = money * 101 // 100
year += 1
return year
x = int(eval(input()))
ans = solve(x)
print(ans) | x=int(eval(input()))
c=100
for i in range(1,10**8):
c=c*101//100
if c >= x:
print(i)
exit()
print("ERROR!")
| 11 | 8 | 172 | 121 | def solve(x):
money = 100
year = 0
while money < x:
money = money * 101 // 100
year += 1
return year
x = int(eval(input()))
ans = solve(x)
print(ans)
| x = int(eval(input()))
c = 100
for i in range(1, 10**8):
c = c * 101 // 100
if c >= x:
print(i)
exit()
print("ERROR!")
| false | 27.272727 | [
"-def solve(x):",
"- money = 100",
"- year = 0",
"- while money < x:",
"- money = money * 101 // 100",
"- year += 1",
"- return year",
"-",
"-",
"-ans = solve(x)",
"-print(ans)",
"+c = 100",
"+for i in range(1, 10**8):",
"+ c = c * 101 // 100",
"+ if c >= ... | false | 0.008922 | 0.079968 | 0.111566 | [
"s806851939",
"s592197480"
] |
u651058930 | p02707 | python | s997060467 | s573725875 | 179 | 144 | 34,048 | 32,352 | Accepted | Accepted | 19.55 | import collections
N = int(eval(input()))
A_list = list(map(int, input().split()))
A_collection = collections.Counter(A_list)
for i in range(N):
print((A_collection[i+1]))
| N = int(eval(input()))
A_list = list(map(int, input().split()))
bosses = [0] * N
for i in A_list:
bosses[i-1] += 1
for boss in bosses:
print(boss) | 8 | 8 | 177 | 156 | import collections
N = int(eval(input()))
A_list = list(map(int, input().split()))
A_collection = collections.Counter(A_list)
for i in range(N):
print((A_collection[i + 1]))
| N = int(eval(input()))
A_list = list(map(int, input().split()))
bosses = [0] * N
for i in A_list:
bosses[i - 1] += 1
for boss in bosses:
print(boss)
| false | 0 | [
"-import collections",
"-",
"-A_collection = collections.Counter(A_list)",
"-for i in range(N):",
"- print((A_collection[i + 1]))",
"+bosses = [0] * N",
"+for i in A_list:",
"+ bosses[i - 1] += 1",
"+for boss in bosses:",
"+ print(boss)"
] | false | 0.096184 | 0.042255 | 2.276258 | [
"s997060467",
"s573725875"
] |
u761320129 | p02579 | python | s185756129 | s352633615 | 1,142 | 688 | 100,740 | 99,704 | Accepted | Accepted | 39.75 | H,W = list(map(int,input().split()))
sy,sx = list(map(int,input().split()))
gy,gx = list(map(int,input().split()))
sy,sx = sy-1,sx-1
gy,gx = gy-1,gx-1
S = [eval(input()) for i in range(H)]
import heapq
INF = float('inf')
dist = [[INF]*W for i in range(H)]
dist[sy][sx] = 0
hq = [(0,sx+sy*W)]
heapq.heapify(h... | H,W = list(map(int,input().split()))
sy,sx = list(map(int,input().split()))
gy,gx = list(map(int,input().split()))
sy,sx = sy-1,sx-1
gy,gx = gy-1,gx-1
S = [eval(input()) for i in range(H)]
from collections import deque
INF = float('inf')
dist = [[INF]*W for _ in range(H)]
dist[sy][sx] = 0
q = deque([(sx,sy)... | 32 | 31 | 1,035 | 980 | H, W = list(map(int, input().split()))
sy, sx = list(map(int, input().split()))
gy, gx = list(map(int, input().split()))
sy, sx = sy - 1, sx - 1
gy, gx = gy - 1, gx - 1
S = [eval(input()) for i in range(H)]
import heapq
INF = float("inf")
dist = [[INF] * W for i in range(H)]
dist[sy][sx] = 0
hq = [(0, sx + sy * W)]
he... | H, W = list(map(int, input().split()))
sy, sx = list(map(int, input().split()))
gy, gx = list(map(int, input().split()))
sy, sx = sy - 1, sx - 1
gy, gx = gy - 1, gx - 1
S = [eval(input()) for i in range(H)]
from collections import deque
INF = float("inf")
dist = [[INF] * W for _ in range(H)]
dist[sy][sx] = 0
q = deque... | false | 3.125 | [
"-import heapq",
"+from collections import deque",
"-dist = [[INF] * W for i in range(H)]",
"+dist = [[INF] * W for _ in range(H)]",
"-hq = [(0, sx + sy * W)]",
"-heapq.heapify(hq)",
"-while hq:",
"- d, v = heapq.heappop(hq)",
"- y, x = divmod(v, W)",
"+q = deque([(sx, sy)])",
"+while q:",... | false | 0.041713 | 0.037853 | 1.101977 | [
"s185756129",
"s352633615"
] |
u993268357 | p03835 | python | s019433306 | s097186996 | 1,710 | 1,396 | 2,940 | 9,052 | Accepted | Accepted | 18.36 | n, goal_num = list(map(int, input().split()))
ans = 0
for x in range(n+1):
for y in range(n+1):
z = goal_num - x - y
if 0 <= z <= n:
ans += 1
print(ans) | n,m = list(map(int,input().split()))
cnt = 0
for i in range(n+1):
for j in range(n+1):
if m-i-j <= n and m-i-j >= 0:
cnt += 1
print(cnt) | 8 | 7 | 169 | 149 | n, goal_num = list(map(int, input().split()))
ans = 0
for x in range(n + 1):
for y in range(n + 1):
z = goal_num - x - y
if 0 <= z <= n:
ans += 1
print(ans)
| n, m = list(map(int, input().split()))
cnt = 0
for i in range(n + 1):
for j in range(n + 1):
if m - i - j <= n and m - i - j >= 0:
cnt += 1
print(cnt)
| false | 12.5 | [
"-n, goal_num = list(map(int, input().split()))",
"-ans = 0",
"-for x in range(n + 1):",
"- for y in range(n + 1):",
"- z = goal_num - x - y",
"- if 0 <= z <= n:",
"- ans += 1",
"-print(ans)",
"+n, m = list(map(int, input().split()))",
"+cnt = 0",
"+for i in range(n +... | false | 0.038685 | 0.036898 | 1.048428 | [
"s019433306",
"s097186996"
] |
u370429022 | p02422 | python | s142847839 | s081007425 | 40 | 30 | 6,724 | 6,724 | Accepted | Accepted | 25 | def my_print(s, a, b):
print((s[a:b+1]))
def my_reverse(s, a, b):
return s[:a] + s[a:b+1][::-1] + s[b+1:]
def my_replace(s, a, b, p):
return s[:a] + p + s[b+1:]
if __name__ == '__main__':
s = eval(input())
q = int(eval(input()))
for i in range(q):
code = input().split()
... | if __name__ == '__main__':
s = eval(input())
q = int(eval(input()))
for i in range(q):
code = input().split()
op, a, b = code[0], int(code[1]), int(code[2])
if op == 'print':
print((s[a:b+1]))
elif op == 'reverse':
s = s[:a] + s[a:b+1][::-1] +... | 21 | 12 | 563 | 388 | def my_print(s, a, b):
print((s[a : b + 1]))
def my_reverse(s, a, b):
return s[:a] + s[a : b + 1][::-1] + s[b + 1 :]
def my_replace(s, a, b, p):
return s[:a] + p + s[b + 1 :]
if __name__ == "__main__":
s = eval(input())
q = int(eval(input()))
for i in range(q):
code = input().split... | if __name__ == "__main__":
s = eval(input())
q = int(eval(input()))
for i in range(q):
code = input().split()
op, a, b = code[0], int(code[1]), int(code[2])
if op == "print":
print((s[a : b + 1]))
elif op == "reverse":
s = s[:a] + s[a : b + 1][::-1] + ... | false | 42.857143 | [
"-def my_print(s, a, b):",
"- print((s[a : b + 1]))",
"-",
"-",
"-def my_reverse(s, a, b):",
"- return s[:a] + s[a : b + 1][::-1] + s[b + 1 :]",
"-",
"-",
"-def my_replace(s, a, b, p):",
"- return s[:a] + p + s[b + 1 :]",
"-",
"-",
"- my_print(s, a, b)",
"+ p... | false | 0.097834 | 0.042555 | 2.298986 | [
"s142847839",
"s081007425"
] |
u867848444 | p02720 | python | s408891475 | s369392885 | 118 | 66 | 12,148 | 16,812 | Accepted | Accepted | 44.07 | from collections import deque
k = int(eval(input()))
cnt = 0
q = deque()
for i in range(1, 10):
q.append((str(i), i))
cnt += 1
if cnt == k:
print((str(i)))
exit()
while q:
lun, num = q.popleft()
for i in range(num - 1, num + 2):
if i < 0 or i >9:continue
... | from collections import deque
def bfs(k):
lunlun = []
q = deque()
count = 0
for i in range(1, 10):
lunlun.append(i)
q.append(i)
count += 1
if count >= k:return lunlun[k - 1]
while True:
num = q.popleft()
tail = num % 10
for i in [-... | 23 | 25 | 452 | 599 | from collections import deque
k = int(eval(input()))
cnt = 0
q = deque()
for i in range(1, 10):
q.append((str(i), i))
cnt += 1
if cnt == k:
print((str(i)))
exit()
while q:
lun, num = q.popleft()
for i in range(num - 1, num + 2):
if i < 0 or i > 9:
continue
... | from collections import deque
def bfs(k):
lunlun = []
q = deque()
count = 0
for i in range(1, 10):
lunlun.append(i)
q.append(i)
count += 1
if count >= k:
return lunlun[k - 1]
while True:
num = q.popleft()
tail = num % 10
for i in [-1, 0, ... | false | 8 | [
"+",
"+def bfs(k):",
"+ lunlun = []",
"+ q = deque()",
"+ count = 0",
"+ for i in range(1, 10):",
"+ lunlun.append(i)",
"+ q.append(i)",
"+ count += 1",
"+ if count >= k:",
"+ return lunlun[k - 1]",
"+ while True:",
"+ num = q.popleft()",
... | false | 0.065029 | 0.123101 | 0.528258 | [
"s408891475",
"s369392885"
] |
u791170614 | p02396 | python | s314891384 | s832669143 | 1,210 | 70 | 8,124 | 7,980 | Accepted | Accepted | 94.21 | x = []
while True:
if 0 in x:
break
x.append(int(eval(input())))
x.pop()
for i, v in enumerate(x):
print((('Case %d: %d') % (i+1, v))) | a = []
while True:
n = eval(input())
if n == "0":
break
a.append(n)
for i in range(len(a)):
print(("Case " + str(i + 1) + ": " + a[i])) | 8 | 9 | 138 | 142 | x = []
while True:
if 0 in x:
break
x.append(int(eval(input())))
x.pop()
for i, v in enumerate(x):
print((("Case %d: %d") % (i + 1, v)))
| a = []
while True:
n = eval(input())
if n == "0":
break
a.append(n)
for i in range(len(a)):
print(("Case " + str(i + 1) + ": " + a[i]))
| false | 11.111111 | [
"-x = []",
"+a = []",
"- if 0 in x:",
"+ n = eval(input())",
"+ if n == \"0\":",
"- x.append(int(eval(input())))",
"-x.pop()",
"-for i, v in enumerate(x):",
"- print(((\"Case %d: %d\") % (i + 1, v)))",
"+ a.append(n)",
"+for i in range(len(a)):",
"+ print((\"Case \" + str(... | false | 0.041172 | 0.035815 | 1.149572 | [
"s314891384",
"s832669143"
] |
u370429695 | p02802 | python | s516615547 | s951238615 | 339 | 304 | 31,564 | 19,720 | Accepted | Accepted | 10.32 | n, m = list(map(int, input().split()))
d = {}
for i in range(m):
p, s = input().split()
d.setdefault(p, [])
d[p].append(s)
cnt = 0; correct = 0
for v in list(d.values()):
if "AC" not in v:
continue
correct += 1
cnt += v.index("AC")
print((correct, cnt))
| n, m = list(map(int, input().split()))
ps = []
for _ in range(m):
p, s = input().split()
ps.append((int(p), s))
was = [0]*(n+1)
total_ac = 0
total_wa = 0
for p, s in ps:
if was[p]<0:
continue
if s=='AC':
total_wa += was[p]
total_ac += 1
was[p] = -1
else... | 15 | 18 | 289 | 364 | n, m = list(map(int, input().split()))
d = {}
for i in range(m):
p, s = input().split()
d.setdefault(p, [])
d[p].append(s)
cnt = 0
correct = 0
for v in list(d.values()):
if "AC" not in v:
continue
correct += 1
cnt += v.index("AC")
print((correct, cnt))
| n, m = list(map(int, input().split()))
ps = []
for _ in range(m):
p, s = input().split()
ps.append((int(p), s))
was = [0] * (n + 1)
total_ac = 0
total_wa = 0
for p, s in ps:
if was[p] < 0:
continue
if s == "AC":
total_wa += was[p]
total_ac += 1
was[p] = -1
else:
... | false | 16.666667 | [
"-d = {}",
"-for i in range(m):",
"+ps = []",
"+for _ in range(m):",
"- d.setdefault(p, [])",
"- d[p].append(s)",
"-cnt = 0",
"-correct = 0",
"-for v in list(d.values()):",
"- if \"AC\" not in v:",
"+ ps.append((int(p), s))",
"+was = [0] * (n + 1)",
"+total_ac = 0",
"+total_wa ... | false | 0.043015 | 0.040713 | 1.056524 | [
"s516615547",
"s951238615"
] |
u363421241 | p02819 | python | s825102974 | s403811278 | 31 | 27 | 9,216 | 9,276 | Accepted | Accepted | 12.9 | x = int(eval(input()))
def prime_factorize(n):
r = []
while n % 2 == 0:
r.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
r.append(f)
n //= f
else:
f += 2
if n != 1:
r.append(n)
return r
... | x = int(eval(input()))
def isPrime(n):
if n == 2:
return True
if n % 2 == 0:
return False
m = int(n**0.5)+1
for p in range(3, m, 2):
if n % p == 0:
return False
return True
while not isPrime(x):
x += 1
print(x) | 27 | 18 | 453 | 285 | x = int(eval(input()))
def prime_factorize(n):
r = []
while n % 2 == 0:
r.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
r.append(f)
n //= f
else:
f += 2
if n != 1:
r.append(n)
return r
for i in range(x, x ... | x = int(eval(input()))
def isPrime(n):
if n == 2:
return True
if n % 2 == 0:
return False
m = int(n**0.5) + 1
for p in range(3, m, 2):
if n % p == 0:
return False
return True
while not isPrime(x):
x += 1
print(x)
| false | 33.333333 | [
"-def prime_factorize(n):",
"- r = []",
"- while n % 2 == 0:",
"- r.append(2)",
"- n //= 2",
"- f = 3",
"- while f * f <= n:",
"- if n % f == 0:",
"- r.append(f)",
"- n //= f",
"- else:",
"- f += 2",
"- if n != 1:",
... | false | 0.008844 | 0.038518 | 0.229619 | [
"s825102974",
"s403811278"
] |
u869790980 | p03436 | python | s767609304 | s397145109 | 318 | 80 | 85,956 | 74,596 | Accepted | Accepted | 74.84 |
import collections
h,p = list(map(int, input().split()))#10 37
mat = [list(input()) for l in range(h)]
q = collections.deque([((0,0), 1)])
vis = set([(0,0)])
r = float('inf')
while(q):
u,d = q.popleft()
if u == (h-1, p-1):
r = d
break
for v in [(u[0]+1,u[1]), (u[0]-1,u[1]), (u[0],u[1]+1),(u[0... | import collections
from functools import reduce
h,p = list(map(int, input().split()))
def f(mat, h, p):
q = collections.deque([((0,0), 1)])
vis = set([(0,0)])
while(q):
u,d = q.popleft()
if u == (h-1, p-1): return collections.Counter(reduce(lambda x,y:x+y, mat))['.'] - d
for v in [(u[0]+1,u[1]),... | 30 | 17 | 611 | 548 | import collections
h, p = list(map(int, input().split())) # 10 37
mat = [list(input()) for l in range(h)]
q = collections.deque([((0, 0), 1)])
vis = set([(0, 0)])
r = float("inf")
while q:
u, d = q.popleft()
if u == (h - 1, p - 1):
r = d
break
for v in [(u[0] + 1, u[1]), (u[0] - 1, u[1]), ... | import collections
from functools import reduce
h, p = list(map(int, input().split()))
def f(mat, h, p):
q = collections.deque([((0, 0), 1)])
vis = set([(0, 0)])
while q:
u, d = q.popleft()
if u == (h - 1, p - 1):
return collections.Counter(reduce(lambda x, y: x + y, mat))["."... | false | 43.333333 | [
"+from functools import reduce",
"-h, p = list(map(int, input().split())) # 10 37",
"-mat = [list(input()) for l in range(h)]",
"-q = collections.deque([((0, 0), 1)])",
"-vis = set([(0, 0)])",
"-r = float(\"inf\")",
"-while q:",
"- u, d = q.popleft()",
"- if u == (h - 1, p - 1):",
"- ... | false | 0.041577 | 0.0496 | 0.838244 | [
"s767609304",
"s397145109"
] |
u349476738 | p02720 | python | s374183848 | s536883552 | 1,861 | 1,369 | 8,068 | 6,916 | Accepted | Accepted | 26.44 | K = int(eval(input()))
queue = [i for i in range(1, 10)]
for i in range(K - 1):
N = queue.pop(0)
if i < K // 2:
if N % 10 == 0:
queue.append(N * 10)
queue.append(N * 10 + 1)
elif N % 10 == 9:
queue.append(N * 10 + 8)
queue.append(N * ... | K = int(eval(input()))
queue = [i for i in range(1, 10)]
for i in range(K - 1):
N = queue.pop(0)
if i < K // 2.5:
if N % 10 == 0:
queue.append(N * 10)
queue.append(N * 10 + 1)
elif N % 10 == 9:
queue.append(N * 10 + 8)
queue.append(N ... | 19 | 19 | 500 | 502 | K = int(eval(input()))
queue = [i for i in range(1, 10)]
for i in range(K - 1):
N = queue.pop(0)
if i < K // 2:
if N % 10 == 0:
queue.append(N * 10)
queue.append(N * 10 + 1)
elif N % 10 == 9:
queue.append(N * 10 + 8)
queue.append(N * 10 + 9)
... | K = int(eval(input()))
queue = [i for i in range(1, 10)]
for i in range(K - 1):
N = queue.pop(0)
if i < K // 2.5:
if N % 10 == 0:
queue.append(N * 10)
queue.append(N * 10 + 1)
elif N % 10 == 9:
queue.append(N * 10 + 8)
queue.append(N * 10 + 9)
... | false | 0 | [
"- if i < K // 2:",
"+ if i < K // 2.5:"
] | false | 0.156141 | 0.007669 | 20.358823 | [
"s374183848",
"s536883552"
] |
u423585790 | p03283 | python | s123147957 | s523704785 | 1,049 | 575 | 57,692 | 57,308 | Accepted | Accepted | 45.19 | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
... | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
... | 87 | 88 | 2,140 | 2,210 | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI():... | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI():... | false | 1.136364 | [
"- c = [[0] * n for i in range(n)]",
"+ c = [[0] * (n + 1) for i in range(n + 1)]",
"- l, r = LI_()",
"+ l, r = LI()",
"- for y in range(n):",
"- for x in range(1, n):",
"+ for y in range(1, n + 1):",
"+ for x in range(1, n + 1):",
"+ for x in range(1, n + ... | false | 0.048113 | 0.040118 | 1.199284 | [
"s123147957",
"s523704785"
] |
u021548497 | p03546 | python | s309365235 | s214087003 | 44 | 35 | 3,316 | 3,064 | Accepted | Accepted | 20.45 | h, w = list(map(int, input().split()))
c = [0]*10
for i in range(10):
c[i] = [int(x) for x in input().split()]
for _ in range(10):
for i in range(10):
for j in range(10):
for k in range(10):
c[i][j] = min([c[i][j], c[i][k]+c[k][j]])
ans = 0
for i in range(h):
a = [int(x) for x in ... | h, w = list(map(int, input().split()))
c = [0]*10
for i in range(10):
c[i] = [int(x) for x in input().split()]
for k in range(10):
for i in range(10):
for j in range(10):
c[i][j] = min([c[i][j], c[i][k]+c[k][j]])
ans = 0
for i in range(h):
a = [int(x) for x in input().split()]
for j i... | 21 | 23 | 438 | 416 | h, w = list(map(int, input().split()))
c = [0] * 10
for i in range(10):
c[i] = [int(x) for x in input().split()]
for _ in range(10):
for i in range(10):
for j in range(10):
for k in range(10):
c[i][j] = min([c[i][j], c[i][k] + c[k][j]])
ans = 0
for i in range(h):
a = [int... | h, w = list(map(int, input().split()))
c = [0] * 10
for i in range(10):
c[i] = [int(x) for x in input().split()]
for k in range(10):
for i in range(10):
for j in range(10):
c[i][j] = min([c[i][j], c[i][k] + c[k][j]])
ans = 0
for i in range(h):
a = [int(x) for x in input().split()]
fo... | false | 8.695652 | [
"-for _ in range(10):",
"+for k in range(10):",
"- for k in range(10):",
"- c[i][j] = min([c[i][j], c[i][k] + c[k][j]])",
"+ c[i][j] = min([c[i][j], c[i][k] + c[k][j]])"
] | false | 0.055824 | 0.105939 | 0.526945 | [
"s309365235",
"s214087003"
] |
u054514819 | p02683 | python | s601530789 | s544448653 | 276 | 196 | 27,524 | 27,248 | Accepted | Accepted | 28.99 | N, M, X = list(map(int, input().split()))
import numpy as np
books = [list(map(int, input().split())) for _ in range(N)]
ans = 10**18
for i in range(1<<N):
algo = np.array([0]*M)
cost = 0
for j in range(N):
if (i>>j)&1:
c, *al = books[j]
al = np.array(al)
... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
import numpy as np
N, M, X = mapint()
CAs = [list(mapint()) for _ in range(N)]
ans = 10**18
flg = False
for i in range(1<<N):
tar = np.array([0]*M)
m = 0
... | 21 | 27 | 464 | 557 | N, M, X = list(map(int, input().split()))
import numpy as np
books = [list(map(int, input().split())) for _ in range(N)]
ans = 10**18
for i in range(1 << N):
algo = np.array([0] * M)
cost = 0
for j in range(N):
if (i >> j) & 1:
c, *al = books[j]
al = np.array(al)
... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
import numpy as np
N, M, X = mapint()
CAs = [list(mapint()) for _ in range(N)]
ans = 10**18
flg = False
for i in range(1 << N):
tar = np.array([0] * M)
m =... | false | 22.222222 | [
"-N, M, X = list(map(int, input().split()))",
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+sys.setrecursionlimit(10**9)",
"-books = [list(map(int, input().split()... | false | 0.266678 | 0.244542 | 1.090521 | [
"s601530789",
"s544448653"
] |
u075012704 | p03312 | python | s648459161 | s196908660 | 1,264 | 514 | 24,180 | 90,488 | Accepted | Accepted | 59.34 | from itertools import accumulate
from bisect import bisect_right
N = int(eval(input()))
A = list(map(int, input().split()))
# 累積和を前計算
cumsum = list(accumulate(A))
cumsum.insert(0, 0)
#print(cumsum)
ans = float('inf')
# 真ん中を全探索
for i in range(2, N-1):
#print(A[:i], A[i:])
# 左の真ん中
LC = cumsum... | from itertools import accumulate
from bisect import bisect_right, bisect_left
N = int(eval(input()))
A = list(map(int, input().split()))
# 累積和を前計算
cumsum = list(accumulate(A))
cumsum.insert(0, 0) # out of index 対策
ans = float('inf')
# 真ん中を全探索
for i in range(2, N-1):
#print(cumsum[:i], cumsum[i:])... | 34 | 35 | 815 | 843 | from itertools import accumulate
from bisect import bisect_right
N = int(eval(input()))
A = list(map(int, input().split()))
# 累積和を前計算
cumsum = list(accumulate(A))
cumsum.insert(0, 0)
# print(cumsum)
ans = float("inf")
# 真ん中を全探索
for i in range(2, N - 1):
# print(A[:i], A[i:])
# 左の真ん中
LC = cumsum[i] / 2
... | from itertools import accumulate
from bisect import bisect_right, bisect_left
N = int(eval(input()))
A = list(map(int, input().split()))
# 累積和を前計算
cumsum = list(accumulate(A))
cumsum.insert(0, 0) # out of index 対策
ans = float("inf")
# 真ん中を全探索
for i in range(2, N - 1):
# print(cumsum[:i], cumsum[i:])
# 左の真ん中
... | false | 2.857143 | [
"-from bisect import bisect_right",
"+from bisect import bisect_right, bisect_left",
"-cumsum.insert(0, 0)",
"-# print(cumsum)",
"+cumsum.insert(0, 0) # out of index 対策",
"- # print(A[:i], A[i:])",
"+ # print(cumsum[:i], cumsum[i:])",
"- LX = bisect_right(cumsum, LC)",
"+ LX = bisect_le... | false | 0.04483 | 0.105294 | 0.425759 | [
"s648459161",
"s196908660"
] |
u747602774 | p02579 | python | s494234838 | s121091261 | 602 | 432 | 88,328 | 91,872 | Accepted | Accepted | 28.24 | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7
from collections import deque
import itertools
h,w = list(map(int,readline().split()))
cx,cy = list(map(int,readline().split()))
gx,gy = list(map(int,readline().split()))
cx -= ... | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7
from collections import deque
import itertools
h,w = list(map(int,readline().split()))
cx,cy = list(map(int,readline().split()))
gx,gy = list(map(int,readline().split()))
cx -= ... | 50 | 53 | 1,299 | 1,430 | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
# mod = 998244353
INF = 10**18
eps = 10**-7
from collections import deque
import itertools
h, w = list(map(int, readline().split()))
cx, cy = list(map(int, readline().split()))
gx, gy = list(map(int, readline().split()))
cx -= 1
cy ... | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
# mod = 998244353
INF = 10**18
eps = 10**-7
from collections import deque
import itertools
h, w = list(map(int, readline().split()))
cx, cy = list(map(int, readline().split()))
gx, gy = list(map(int, readline().split()))
cx -= 1
cy ... | false | 5.660377 | [
"-while q1:",
"+q2 = deque([(cx, cy)])",
"+while q1 or q2:",
"- q1.appendleft((nx, ny))",
"+ q1.append((nx, ny))",
"+ q2.append((nx, ny))",
"+ else:",
"+ x, y = q2.popleft()",
"+ q2.append((nx, ny))"
] | false | 0.049521 | 0.047186 | 1.04948 | [
"s494234838",
"s121091261"
] |
u941438707 | p03212 | python | s760034010 | s006465241 | 101 | 92 | 13,500 | 10,320 | Accepted | Accepted | 8.91 | n=int(eval(input()))
d=["3","5","7"]
ans=[]
ans+=d
while d:
a=d.pop(0)
if len(a)<9:
for i in "357":
d+=[i+a]
ans+=[i+a]
ans=list(map(int,ans))
ans.sort()
print((sum(i<=n for i in ans if len(set(str(i)))==3))) | n=int(eval(input()))
d=["3","5","7"]
ans=0
while d:
a=d.pop(0)
if int(a)<=n and len(set(a))==3:ans+=1
if len(a)<9:
for i in "357":d+=[i+a]
print(ans) | 13 | 9 | 252 | 171 | n = int(eval(input()))
d = ["3", "5", "7"]
ans = []
ans += d
while d:
a = d.pop(0)
if len(a) < 9:
for i in "357":
d += [i + a]
ans += [i + a]
ans = list(map(int, ans))
ans.sort()
print((sum(i <= n for i in ans if len(set(str(i))) == 3)))
| n = int(eval(input()))
d = ["3", "5", "7"]
ans = 0
while d:
a = d.pop(0)
if int(a) <= n and len(set(a)) == 3:
ans += 1
if len(a) < 9:
for i in "357":
d += [i + a]
print(ans)
| false | 30.769231 | [
"-ans = []",
"-ans += d",
"+ans = 0",
"+ if int(a) <= n and len(set(a)) == 3:",
"+ ans += 1",
"- ans += [i + a]",
"-ans = list(map(int, ans))",
"-ans.sort()",
"-print((sum(i <= n for i in ans if len(set(str(i))) == 3)))",
"+print(ans)"
] | false | 0.606175 | 0.147774 | 4.102033 | [
"s760034010",
"s006465241"
] |
u672898046 | p03408 | python | s601414469 | s926838866 | 21 | 17 | 3,316 | 3,060 | Accepted | Accepted | 19.05 | from collections import Counter
N = int(eval(input()))
s_counter = Counter([eval(input()) for _ in range(N)])
M = int(eval(input()))
t_counter = Counter([eval(input()) for _ in range(M)])
d = {}
for key, value in list(s_counter.items()):
d[key] = [value]
for key, value in list(t_counter.items()):
if key no... | N = int(eval(input()))
s = [eval(input()) for _ in range(N)]
M = int(eval(input()))
t = [eval(input()) for _ in range(M)]
list = [s.count(i) - t.count(i) for i in set(s)]
print((max(0, *list))) | 19 | 6 | 462 | 172 | from collections import Counter
N = int(eval(input()))
s_counter = Counter([eval(input()) for _ in range(N)])
M = int(eval(input()))
t_counter = Counter([eval(input()) for _ in range(M)])
d = {}
for key, value in list(s_counter.items()):
d[key] = [value]
for key, value in list(t_counter.items()):
if key not in... | N = int(eval(input()))
s = [eval(input()) for _ in range(N)]
M = int(eval(input()))
t = [eval(input()) for _ in range(M)]
list = [s.count(i) - t.count(i) for i in set(s)]
print((max(0, *list)))
| false | 68.421053 | [
"-from collections import Counter",
"-",
"-s_counter = Counter([eval(input()) for _ in range(N)])",
"+s = [eval(input()) for _ in range(N)]",
"-t_counter = Counter([eval(input()) for _ in range(M)])",
"-d = {}",
"-for key, value in list(s_counter.items()):",
"- d[key] = [value]",
"-for key, value... | false | 0.037434 | 0.043335 | 0.863834 | [
"s601414469",
"s926838866"
] |
u030626972 | p03127 | python | s578359580 | s687273905 | 177 | 90 | 15,020 | 14,252 | Accepted | Accepted | 49.15 | n = int(eval(input()))
#モンスターiの体力:mon[i]
mon = list(map(int, input().split()))
zero = 0
while mon.count(0) != (n-1):
mon.sort()
min = mon[zero]
tei = zero + 1
for i in range(tei,n):
mon[i] = mon[i] % min
if mon[i] == 0:
zero += 1
mon.sort()
print((mon[zero]... | #モンスター数
n = int(eval(input()))
#モンスターiの体力:mon[i]
mon = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a%b)
ans = mon[0]
for i in range(1,n):
ans = gcd(ans,mon[i])
print(ans) | 17 | 17 | 315 | 255 | n = int(eval(input()))
# モンスターiの体力:mon[i]
mon = list(map(int, input().split()))
zero = 0
while mon.count(0) != (n - 1):
mon.sort()
min = mon[zero]
tei = zero + 1
for i in range(tei, n):
mon[i] = mon[i] % min
if mon[i] == 0:
zero += 1
mon.sort()
print((mon[zero]))
| # モンスター数
n = int(eval(input()))
# モンスターiの体力:mon[i]
mon = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
ans = mon[0]
for i in range(1, n):
ans = gcd(ans, mon[i])
print(ans)
| false | 0 | [
"+# モンスター数",
"-zero = 0",
"-while mon.count(0) != (n - 1):",
"- mon.sort()",
"- min = mon[zero]",
"- tei = zero + 1",
"- for i in range(tei, n):",
"- mon[i] = mon[i] % min",
"- if mon[i] == 0:",
"- zero += 1",
"-mon.sort()",
"-print((mon[zero]))",
"+",
... | false | 0.046673 | 0.06707 | 0.695876 | [
"s578359580",
"s687273905"
] |
u305366205 | p02954 | python | s130024575 | s188310028 | 145 | 127 | 10,224 | 6,400 | Accepted | Accepted | 12.41 | s = eval(input())
switch = []
ans = [0] * (len(s))
# R→L or L→Rの変化部分を保存
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
switch.append(i + 1)
# switch[i]: iが偶数なら R→L
# iが奇数なら L→Rの境目番号
start = 0
for i in range(0, len(switch), 2):
# for文終了時のエラー処理
if i == len(switch) - 1:
... | s = input()
n = len(s)
ans = [0] * n
cnt_even = 0
cnt_odd = 0
index = 0
for i in range(n - 1):
if s[i] == 'R' and s[i + 1] == 'L':
index = i
if i % 2 == 0:
cnt_even += 1
else:
cnt_odd += 1
if s[i] == 'L' and s[i + 1] == 'R' or i == n - 2:
if i == n - 2:
... | 26 | 28 | 629 | 687 | s = eval(input())
switch = []
ans = [0] * (len(s))
# R→L or L→Rの変化部分を保存
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
switch.append(i + 1)
# switch[i]: iが偶数なら R→L
# iが奇数なら L→Rの境目番号
start = 0
for i in range(0, len(switch), 2):
# for文終了時のエラー処理
if i == len(switch) - 1:
end = len(s... | s = input()
n = len(s)
ans = [0] * n
cnt_even = 0
cnt_odd = 0
index = 0
for i in range(n - 1):
if s[i] == "R" and s[i + 1] == "L":
index = i
if i % 2 == 0:
cnt_even += 1
else:
cnt_odd += 1
if s[i] == "L" and s[i + 1] == "R" or i == n - 2:
if i == n - 2:
if (i ... | false | 7.142857 | [
"-s = eval(input())",
"-switch = []",
"-ans = [0] * (len(s))",
"-# R→L or L→Rの変化部分を保存",
"-for i in range(len(s) - 1):",
"- if s[i] != s[i + 1]:",
"- switch.append(i + 1)",
"-# switch[i]: iが偶数なら R→L",
"-# iが奇数なら L→Rの境目番号",
"-start = 0",
"-for i in range(0, len(switch), 2):",
... | false | 0.089089 | 0.085323 | 1.044134 | [
"s130024575",
"s188310028"
] |
u198062737 | p02823 | python | s978974094 | s529992669 | 175 | 17 | 38,468 | 2,940 | Accepted | Accepted | 90.29 | N, A, B = list(map(int, input().split(" ")))
if A % 2 == B % 2:
print(((B - A) // 2))
else:
print((min(N - B, A - 1) + 1 + (B - A - 1) // 2)) | N, A, B = list(map(int, input().split(" ")))
if (B - A) % 2 == 0:
print(((B - A) // 2))
else:
print((min(N - B, A - 1) + 1 + (B - A - 1) // 2)) | 6 | 6 | 145 | 147 | N, A, B = list(map(int, input().split(" ")))
if A % 2 == B % 2:
print(((B - A) // 2))
else:
print((min(N - B, A - 1) + 1 + (B - A - 1) // 2))
| N, A, B = list(map(int, input().split(" ")))
if (B - A) % 2 == 0:
print(((B - A) // 2))
else:
print((min(N - B, A - 1) + 1 + (B - A - 1) // 2))
| false | 0 | [
"-if A % 2 == B % 2:",
"+if (B - A) % 2 == 0:"
] | false | 0.081755 | 0.034286 | 2.384542 | [
"s978974094",
"s529992669"
] |
u113971909 | p03578 | python | s302792830 | s677264774 | 689 | 456 | 79,876 | 79,876 | Accepted | Accepted | 33.82 | N=int(eval(input()))
D=list(map(int,input().split()))
M=int(eval(input()))
T=list(map(int,input().split()))
D.sort()
T.sort()
from collections import Counter
D=Counter(D)
dic_D={}
for i in D.most_common():
dic_D[i[0]]=i[1]
T=Counter(T)
ret = 'YES'
for i in T.most_common():
if i[0] in dic_D:
if di... | N=int(eval(input()))
D=list(map(int,input().split()))
M=int(eval(input()))
T=list(map(int,input().split()))
from collections import Counter
D=Counter(D)
dic_D={}
for i in D.most_common():
dic_D[i[0]]=i[1]
T=Counter(T)
ret = 'YES'
for i in T.most_common():
if i[0] in dic_D:
if dic_D[i[0]]<i[1]:
... | 22 | 20 | 402 | 382 | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
D.sort()
T.sort()
from collections import Counter
D = Counter(D)
dic_D = {}
for i in D.most_common():
dic_D[i[0]] = i[1]
T = Counter(T)
ret = "YES"
for i in T.most_common():
if i[0] in dic_D:
... | N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
from collections import Counter
D = Counter(D)
dic_D = {}
for i in D.most_common():
dic_D[i[0]] = i[1]
T = Counter(T)
ret = "YES"
for i in T.most_common():
if i[0] in dic_D:
if dic_D[i[... | false | 9.090909 | [
"-D.sort()",
"-T.sort()"
] | false | 0.047941 | 0.047269 | 1.014221 | [
"s302792830",
"s677264774"
] |
u938486382 | p02899 | python | s285487021 | s369391285 | 103 | 94 | 24,924 | 22,752 | Accepted | Accepted | 8.74 | n = int(eval(input()))
l = list(map(int, input().split(' ')))
d = {}
for i in range(n):
d[l[i]] = i+1
t = []
for i in range(1, n+1):
t.append(str(d[i]))
print((' '.join(t))) | n = int(eval(input()))
order = list(map(int, input().split(' ')))
d = {}
for i in range(n):
d[order[i]] = str(i+1)
print((' '.join(list(d.values()))))
| 10 | 6 | 181 | 144 | n = int(eval(input()))
l = list(map(int, input().split(" ")))
d = {}
for i in range(n):
d[l[i]] = i + 1
t = []
for i in range(1, n + 1):
t.append(str(d[i]))
print((" ".join(t)))
| n = int(eval(input()))
order = list(map(int, input().split(" ")))
d = {}
for i in range(n):
d[order[i]] = str(i + 1)
print((" ".join(list(d.values()))))
| false | 40 | [
"-l = list(map(int, input().split(\" \")))",
"+order = list(map(int, input().split(\" \")))",
"- d[l[i]] = i + 1",
"-t = []",
"-for i in range(1, n + 1):",
"- t.append(str(d[i]))",
"-print((\" \".join(t)))",
"+ d[order[i]] = str(i + 1)",
"+print((\" \".join(list(d.values()))))"
] | false | 0.042707 | 0.04296 | 0.994123 | [
"s285487021",
"s369391285"
] |
u325227960 | p02579 | python | s954490373 | s551129461 | 1,975 | 669 | 399,644 | 242,840 | Accepted | Accepted | 66.13 | h, w = list(map(int,input().split()))
sx, sy = list(map(int,input().split()))
gx, gy = list(map(int,input().split()))
S = [eval(input()) for i in range(h)]
sx-=1
sy-=1
gx-=1
gy-=1
A = [(-1,0),(1,0),(0,-1),(0,1)]
B = []
for i in range(-2,3):
for j in range(-2,3):
if i!= 0 or j!=0:
... | h, w = list(map(int,input().split()))
si, sj = list(map(int,input().split()))
gi, gj = list(map(int,input().split()))
S = [eval(input()) for i in range(h)]
n = h * w
si-=1
sj-=1
gi-=1
gj-=1
# M = [[] for i in range(h*w)]
A = [[-1,0],[1,0],[0,1],[0,-1]]
B = []
for i in range(-2, 3):
for j in range... | 83 | 71 | 1,952 | 1,675 | h, w = list(map(int, input().split()))
sx, sy = list(map(int, input().split()))
gx, gy = list(map(int, input().split()))
S = [eval(input()) for i in range(h)]
sx -= 1
sy -= 1
gx -= 1
gy -= 1
A = [(-1, 0), (1, 0), (0, -1), (0, 1)]
B = []
for i in range(-2, 3):
for j in range(-2, 3):
if i != 0 or j != 0:
... | h, w = list(map(int, input().split()))
si, sj = list(map(int, input().split()))
gi, gj = list(map(int, input().split()))
S = [eval(input()) for i in range(h)]
n = h * w
si -= 1
sj -= 1
gi -= 1
gj -= 1
# M = [[] for i in range(h*w)]
A = [[-1, 0], [1, 0], [0, 1], [0, -1]]
B = []
for i in range(-2, 3):
for j in range(... | false | 14.457831 | [
"-sx, sy = list(map(int, input().split()))",
"-gx, gy = list(map(int, input().split()))",
"+si, sj = list(map(int, input().split()))",
"+gi, gj = list(map(int, input().split()))",
"-sx -= 1",
"-sy -= 1",
"-gx -= 1",
"-gy -= 1",
"-A = [(-1, 0), (1, 0), (0, -1), (0, 1)]",
"+n = h * w",
"+si -= 1",... | false | 0.037786 | 0.038733 | 0.975555 | [
"s954490373",
"s551129461"
] |
u204842730 | p02683 | python | s490929717 | s776711346 | 74 | 31 | 9,232 | 9,220 | Accepted | Accepted | 58.11 | import itertools
n,m,x=list(map(int,input().split()))
lis=tuple(tuple(map(int,input().split())) for _ in range(n)) #再代入しないので二次元tupleでよい
ans=float("inf")
for choice in itertools.product(list(range(2)),repeat=n):#0,1のbit全探索
cost=0
skills=[0]*m
for flag,book in zip(choice,lis):
if flag:
... | import itertools
n,m,x=list(map(int,input().split()))
lis=tuple(tuple(map(int,input().split())) for _ in range(n)) #再代入しないので二次元tupleでよい
ans=float("inf")
def dfs(progress,skills,nowcost):#実行前においておけば参照できる
global ans
if progress==n:
if all(v>=x for v in skills):
ans=min(ans,nowcost)
... | 20 | 19 | 558 | 538 | import itertools
n, m, x = list(map(int, input().split()))
lis = tuple(tuple(map(int, input().split())) for _ in range(n)) # 再代入しないので二次元tupleでよい
ans = float("inf")
for choice in itertools.product(list(range(2)), repeat=n): # 0,1のbit全探索
cost = 0
skills = [0] * m
for flag, book in zip(choice, lis):
... | import itertools
n, m, x = list(map(int, input().split()))
lis = tuple(tuple(map(int, input().split())) for _ in range(n)) # 再代入しないので二次元tupleでよい
ans = float("inf")
def dfs(progress, skills, nowcost): # 実行前においておけば参照できる
global ans
if progress == n:
if all(v >= x for v in skills):
ans = mi... | false | 5 | [
"-for choice in itertools.product(list(range(2)), repeat=n): # 0,1のbit全探索",
"- cost = 0",
"- skills = [0] * m",
"- for flag, book in zip(choice, lis):",
"- if flag:",
"- C, A = book[0], book[1:]",
"- cost += book[0]",
"- for i, a in enumerate(A):",
"... | false | 0.048755 | 0.040123 | 1.215145 | [
"s490929717",
"s776711346"
] |
u837673618 | p02737 | python | s714649021 | s401247243 | 1,968 | 1,158 | 61,312 | 70,316 | Accepted | Accepted | 41.16 | from collections import defaultdict
import sys
input = lambda: sys.stdin.readline().rstrip()
def ext_euc(a, b):
x1, y1, z1 = 1, 0, a
x2, y2, z2 = 0, 1, b
while z1 != 1:
d, m = divmod(z2,z1)
x1, x2 = x2-d*x1, x1
y1, y2 = y2-d*y1, y1
z1, z2 = m, z1
return x1, y1
class mod_int(int... | from collections import defaultdict
import sys
input = lambda: sys.stdin.readline().rstrip()
def mod_inv(a):
x1, y1, z1 = 1, 0, a
x2, y2, z2 = 0, 1, M
while z1 != 1:
d, m = divmod(z2, z1)
x1, x2 = x2-d*x1, x1
y1, y2 = y2-d*y1, y1
z1, z2 = m, z1
return x1%M
def mex(s):
for i ... | 94 | 65 | 1,988 | 1,384 | from collections import defaultdict
import sys
input = lambda: sys.stdin.readline().rstrip()
def ext_euc(a, b):
x1, y1, z1 = 1, 0, a
x2, y2, z2 = 0, 1, b
while z1 != 1:
d, m = divmod(z2, z1)
x1, x2 = x2 - d * x1, x1
y1, y2 = y2 - d * y1, y1
z1, z2 = m, z1
return x1, y1... | from collections import defaultdict
import sys
input = lambda: sys.stdin.readline().rstrip()
def mod_inv(a):
x1, y1, z1 = 1, 0, a
x2, y2, z2 = 0, 1, M
while z1 != 1:
d, m = divmod(z2, z1)
x1, x2 = x2 - d * x1, x1
y1, y2 = y2 - d * y1, y1
z1, z2 = m, z1
return x1 % M
... | false | 30.851064 | [
"-def ext_euc(a, b):",
"+def mod_inv(a):",
"- x2, y2, z2 = 0, 1, b",
"+ x2, y2, z2 = 0, 1, M",
"- return x1, y1",
"-",
"-",
"-class mod_int(int):",
"- def __new__(cls, i=0, *args, **kwargs):",
"- return int.__new__(cls, i % M, *args, **kwargs)",
"-",
"- def __add__(self, ... | false | 0.157054 | 0.115679 | 1.357675 | [
"s714649021",
"s401247243"
] |
u642874916 | p02691 | python | s161921944 | s886592109 | 309 | 185 | 175,972 | 141,308 | Accepted | Accepted | 40.13 | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time
def I(): return int(input())
... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time
def I(): return int(input())
... | 92 | 83 | 2,145 | 1,759 | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import (
permutations,
combinations,
accumulate,
product,
combinations_with_replacement,
)
import sys
import bisect
import string
import math
import time
def I():
re... | from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import (
permutations,
combinations,
accumulate,
product,
combinations_with_replacement,
)
import sys
import bisect
import string
import math
import time
def I():
re... | false | 9.782609 | [
"- cnt_plus_height_minus_idx = defaultdict(int)",
"- cnt_minus_height_minus_idx = defaultdict(int)",
"- cnt_plus_height_minus_idx[H[idx] - idx] += 1",
"- cnt_minus_height_minus_idx[-H[idx] - idx] += 1",
"- for k, v in cnt_plus_height_minus_idx.items():",
"- if k in cnt_minus_... | false | 0.041894 | 0.079986 | 0.523765 | [
"s161921944",
"s886592109"
] |
u340010271 | p03266 | python | s180494912 | s165577505 | 23 | 20 | 3,572 | 2,940 | Accepted | Accepted | 13.04 | from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1,r + 1)))
return over // under
N,K=list(map(int,input().split()))
if K%2==0:
print(((N//K)**3+(((N-K//2)/... | N,K=list(map(int,input().split()))
if K%2==0:
print(((N//K)**3+(((N-K//2)//K+1)**3)))
else:
print(((N//K)**3)) | 13 | 5 | 340 | 112 | from operator import mul
from functools import reduce
def cmb(n, r):
r = min(n - r, r)
if r == 0:
return 1
over = reduce(mul, list(range(n, n - r, -1)))
under = reduce(mul, list(range(1, r + 1)))
return over // under
N, K = list(map(int, input().split()))
if K % 2 == 0:
print(((N // ... | N, K = list(map(int, input().split()))
if K % 2 == 0:
print(((N // K) ** 3 + (((N - K // 2) // K + 1) ** 3)))
else:
print(((N // K) ** 3))
| false | 61.538462 | [
"-from operator import mul",
"-from functools import reduce",
"-",
"-",
"-def cmb(n, r):",
"- r = min(n - r, r)",
"- if r == 0:",
"- return 1",
"- over = reduce(mul, list(range(n, n - r, -1)))",
"- under = reduce(mul, list(range(1, r + 1)))",
"- return over // under",
"-"... | false | 0.03952 | 0.030875 | 1.280012 | [
"s180494912",
"s165577505"
] |
u600402037 | p03283 | python | s364245811 | s234540274 | 2,139 | 842 | 16,556 | 37,252 | Accepted | Accepted | 60.64 | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# N**2の解法
N, M, Q = lr()
graph = np.array([[0] * (N+1) for _ in range(N+1)]) # 1-indexed
for i in range(M):
l, r = lr()
graph[l][r] += 1
fo... | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# N**2の解法
N, M, Qu = lr()
graph = [[0] * (N+1) for _ in range(N+1)] # 1-indexed
for i in range(M):
l, r = lr()
graph[l][r] += 1
graph = np.... | 25 | 26 | 549 | 637 | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# N**2の解法
N, M, Q = lr()
graph = np.array([[0] * (N + 1) for _ in range(N + 1)]) # 1-indexed
for i in range(M):
l, r = lr()
graph[l][r] += 1
for i in range(... | # coding: utf-8
import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# N**2の解法
N, M, Qu = lr()
graph = [[0] * (N + 1) for _ in range(N + 1)] # 1-indexed
for i in range(M):
l, r = lr()
graph[l][r] += 1
graph = np.array(graph)
... | false | 3.846154 | [
"-N, M, Q = lr()",
"-graph = np.array([[0] * (N + 1) for _ in range(N + 1)]) # 1-indexed",
"+N, M, Qu = lr()",
"+graph = [[0] * (N + 1) for _ in range(N + 1)] # 1-indexed",
"-for i in range(N + 1):",
"- graph[i] = graph[i].cumsum()",
"-graph = np.cumsum(graph, axis=0)",
"-for _ in range(Q):",
"... | false | 0.479192 | 0.300544 | 1.594414 | [
"s364245811",
"s234540274"
] |
u057109575 | p02756 | python | s297223996 | s635526597 | 844 | 316 | 98,776 | 103,688 | Accepted | Accepted | 62.56 | from collections import deque
S = eval(input())
Q = int(eval(input()))
X = [eval(input()) for _ in range(Q)]
ans = deque(S)
r = 0 # r=0: order, r=1: reverse
for i in range(Q):
q, *x = X[i].split()
if q == "1":
r = abs(r - 1)
else:
f, c = x
if (r == 0 and f == "1") or... |
from collections import deque
S = eval(input())
Q = int(eval(input()))
q = deque(list(S))
rev = 0
for _ in range(Q):
s, *x = input().split()
if s == "1":
rev += 1
else:
if ((x[0] == "1" and rev % 2 == 0)
or (x[0] == "2" and rev % 2 == 1)):
q.append... | 20 | 22 | 468 | 441 | from collections import deque
S = eval(input())
Q = int(eval(input()))
X = [eval(input()) for _ in range(Q)]
ans = deque(S)
r = 0 # r=0: order, r=1: reverse
for i in range(Q):
q, *x = X[i].split()
if q == "1":
r = abs(r - 1)
else:
f, c = x
if (r == 0 and f == "1") or (r == 1 and f ... | from collections import deque
S = eval(input())
Q = int(eval(input()))
q = deque(list(S))
rev = 0
for _ in range(Q):
s, *x = input().split()
if s == "1":
rev += 1
else:
if (x[0] == "1" and rev % 2 == 0) or (x[0] == "2" and rev % 2 == 1):
q.appendleft(x[1])
else:
... | false | 9.090909 | [
"-X = [eval(input()) for _ in range(Q)]",
"-ans = deque(S)",
"-r = 0 # r=0: order, r=1: reverse",
"-for i in range(Q):",
"- q, *x = X[i].split()",
"- if q == \"1\":",
"- r = abs(r - 1)",
"+q = deque(list(S))",
"+rev = 0",
"+for _ in range(Q):",
"+ s, *x = input().split()",
"+ ... | false | 0.033629 | 0.08951 | 0.375707 | [
"s297223996",
"s635526597"
] |
u075012704 | p04046 | python | s815855023 | s149901092 | 986 | 384 | 18,984 | 66,672 | Accepted | Accepted | 61.05 | H, W, A, B = list(map(int, input().split()))
MOD = 10 ** 9 + 7
N = 100
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, H + W + 1):
factorial.append(factorial[-1] * i % MOD)
inverse.append(pow(factorial[-1], MOD - 2, MOD))
# 組み合わせ計算
def nCr(n, r):
if n < r or r < 0:
retu... | H, W, A, B = list(map(int, input().split()))
MOD = 10 ** 9 + 7
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, H + W + 2):
factorial.append(factorial[-1] * i % MOD)
inverse.append(pow(factorial[-1], MOD - 2, MOD))
# 組み合わせ計算
def nCr(n, r):
if n < r or r < 0:
return 0
... | 25 | 25 | 554 | 549 | H, W, A, B = list(map(int, input().split()))
MOD = 10**9 + 7
N = 100
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, H + W + 1):
factorial.append(factorial[-1] * i % MOD)
inverse.append(pow(factorial[-1], MOD - 2, MOD))
# 組み合わせ計算
def nCr(n, r):
if n < r or r < 0:
return 0
elif r == 0... | H, W, A, B = list(map(int, input().split()))
MOD = 10**9 + 7
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, H + W + 2):
factorial.append(factorial[-1] * i % MOD)
inverse.append(pow(factorial[-1], MOD - 2, MOD))
# 組み合わせ計算
def nCr(n, r):
if n < r or r < 0:
return 0
elif r == 0:
... | false | 0 | [
"-N = 100",
"-for i in range(1, H + W + 1):",
"+for i in range(1, H + W + 2):",
"-for w in range(B + 1, W + 1):",
"- ans += nCr(H - A - 1 + w - 1, w - 1) * nCr(A - 1 + W - w, A - 1) % MOD",
"+for w in range(B, W):",
"+ ans += nCr(H - A - 1 + w, w) * nCr(A - 1 + W - w - 1, A - 1) % MOD",
"+ an... | false | 0.043723 | 0.043292 | 1.009956 | [
"s815855023",
"s149901092"
] |
u403301154 | p03353 | python | s058181244 | s557347518 | 38 | 33 | 4,464 | 4,464 | Accepted | Accepted | 13.16 | s = eval(input())
k = int(eval(input()))
t = set()
for i in range(len(s)):
tt = ""
for j in range(i, min(i+5, len(s))):
tt+=s[j]
t.add(tt)
print((sorted(t)[k-1])) | s = eval(input())
k = int(eval(input()))
d = set()
for i in range(1, 6):
for j in range(len(s)):
d.add(s[j:j+i])
print((sorted(d)[k-1])) | 12 | 7 | 174 | 134 | s = eval(input())
k = int(eval(input()))
t = set()
for i in range(len(s)):
tt = ""
for j in range(i, min(i + 5, len(s))):
tt += s[j]
t.add(tt)
print((sorted(t)[k - 1]))
| s = eval(input())
k = int(eval(input()))
d = set()
for i in range(1, 6):
for j in range(len(s)):
d.add(s[j : j + i])
print((sorted(d)[k - 1]))
| false | 41.666667 | [
"-t = set()",
"-for i in range(len(s)):",
"- tt = \"\"",
"- for j in range(i, min(i + 5, len(s))):",
"- tt += s[j]",
"- t.add(tt)",
"-print((sorted(t)[k - 1]))",
"+d = set()",
"+for i in range(1, 6):",
"+ for j in range(len(s)):",
"+ d.add(s[j : j + i])",
"+print(... | false | 0.087968 | 0.128215 | 0.686099 | [
"s058181244",
"s557347518"
] |
u156383602 | p02790 | python | s562502744 | s752028315 | 18 | 16 | 2,940 | 2,940 | Accepted | Accepted | 11.11 | a,b=list(map(str,input().split()))
if int(a*int(b))>=int(b*int(a)):
print((int(a*int(b))))
else:
print((int(b*int(a)))) | a,b=list(map(int,input().split()))
print((str(min(a,b))*max(a,b))) | 5 | 2 | 121 | 59 | a, b = list(map(str, input().split()))
if int(a * int(b)) >= int(b * int(a)):
print((int(a * int(b))))
else:
print((int(b * int(a))))
| a, b = list(map(int, input().split()))
print((str(min(a, b)) * max(a, b)))
| false | 60 | [
"-a, b = list(map(str, input().split()))",
"-if int(a * int(b)) >= int(b * int(a)):",
"- print((int(a * int(b))))",
"-else:",
"- print((int(b * int(a))))",
"+a, b = list(map(int, input().split()))",
"+print((str(min(a, b)) * max(a, b)))"
] | false | 0.071079 | 0.090464 | 0.785719 | [
"s562502744",
"s752028315"
] |
u514894322 | p03037 | python | s103470045 | s932159288 | 371 | 293 | 29,868 | 3,060 | Accepted | Accepted | 21.02 | n,m = list(map(int,input().split()))
ll = [list(map(int,input().split())) for _ in [0]*m]
l=[]
r=[]
for i in range(m):
l.append(ll[i][0])
r.append(ll[i][1])
l = max(l)
r = min(r)
#for _ in range(m):
# a,b = map(int,input().split())
# l = max([a,l])
# r = min([b,r])
print((max([0,r-l+1]))) | n,m = list(map(int,input().split()))
#ll = [list(map(int,input().split())) for _ in [0]*m]
#l=[]
#r=[]
#for i in range(m):
# l.append(ll[i][0])
# r.append(ll[i][1])
#l = max(l)
#r = min(r)
l=0
r=n
for _ in range(m):
a,b = list(map(int,input().split()))
l = l if l>a else a
r = r if r<b else b
pr... | 16 | 17 | 307 | 327 | n, m = list(map(int, input().split()))
ll = [list(map(int, input().split())) for _ in [0] * m]
l = []
r = []
for i in range(m):
l.append(ll[i][0])
r.append(ll[i][1])
l = max(l)
r = min(r)
# for _ in range(m):
# a,b = map(int,input().split())
# l = max([a,l])
# r = min([b,r])
print((max([0, r - l + 1])))
| n, m = list(map(int, input().split()))
# ll = [list(map(int,input().split())) for _ in [0]*m]
# l=[]
# r=[]
# for i in range(m):
# l.append(ll[i][0])
# r.append(ll[i][1])
# l = max(l)
# r = min(r)
l = 0
r = n
for _ in range(m):
a, b = list(map(int, input().split()))
l = l if l > a else a
r = r if r < b el... | false | 5.882353 | [
"-ll = [list(map(int, input().split())) for _ in [0] * m]",
"-l = []",
"-r = []",
"-for i in range(m):",
"- l.append(ll[i][0])",
"- r.append(ll[i][1])",
"-l = max(l)",
"-r = min(r)",
"-# for _ in range(m):",
"-# a,b = map(int,input().split())",
"-# l = max([a,l])",
"-# r = min([b,r])"... | false | 0.093768 | 0.070003 | 1.339496 | [
"s103470045",
"s932159288"
] |
u558242240 | p02819 | python | s962124595 | s758613251 | 845 | 154 | 20,840 | 12,632 | Accepted | Accepted | 81.78 | x = int(eval(input()))
ps = set(range(x, 4 * x + 1))
for i in range(2, x):
for j in range(0, 4 * x + 1, i):
if j in ps:
ps.remove(j)
print((min(ps)))
| import numpy as np
def make_prime(U):
is_prime = np.zeros(U,np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
M = int(U**.5)+1
for p in range(3,M,2):
if is_prime[p]:
is_prime[p*p::p+p] = 0
return is_prime.nonzero()[0] #, is_prime
primes = make_prime(10 ** 5 + 10000)
n ... | 7 | 15 | 172 | 385 | x = int(eval(input()))
ps = set(range(x, 4 * x + 1))
for i in range(2, x):
for j in range(0, 4 * x + 1, i):
if j in ps:
ps.remove(j)
print((min(ps)))
| import numpy as np
def make_prime(U):
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
M = int(U**0.5) + 1
for p in range(3, M, 2):
if is_prime[p]:
is_prime[p * p :: p + p] = 0
return is_prime.nonzero()[0] # , is_prime
primes = make_prime(10**5 + 10000)... | false | 53.333333 | [
"-x = int(eval(input()))",
"-ps = set(range(x, 4 * x + 1))",
"-for i in range(2, x):",
"- for j in range(0, 4 * x + 1, i):",
"- if j in ps:",
"- ps.remove(j)",
"-print((min(ps)))",
"+import numpy as np",
"+",
"+",
"+def make_prime(U):",
"+ is_prime = np.zeros(U, np.bool... | false | 0.551991 | 0.459635 | 1.200933 | [
"s962124595",
"s758613251"
] |
u163907160 | p03164 | python | s533949675 | s834069659 | 558 | 510 | 121,864 | 120,940 | Accepted | Accepted | 8.6 | N,W=list(map(int,input().split()))
k=[[0,0] for i in range(N)]
dp=[[W+1]*(1001*101+1) for j in range(N+1)]
R=set()
for i in range(N):
k[i][0],k[i][1]=list(map(int,input().split()))
dp[0][:k[0][1]]=[k[0][0]]*(k[0][1]+1)
dp[0][0]=0
for i in range(1,N):
for v in range(1001*101):
if v - k[i][1]>=0... | N,W=list(map(int,input().split()))
k=[[0,0] for i in range(N)]
dp=[[W+1]*(1001*101+1) for j in range(N+1)]
R=set()
for i in range(N):
k[i][0],k[i][1]=list(map(int,input().split()))
#dp[0][:k[0][1]]=[k[0][0]]*(k[0][1]+1)
dp[0][0]=0
for i in range(0,N):
for v in range(1001*101):
if v - k[i][1]>=... | 23 | 23 | 584 | 586 | N, W = list(map(int, input().split()))
k = [[0, 0] for i in range(N)]
dp = [[W + 1] * (1001 * 101 + 1) for j in range(N + 1)]
R = set()
for i in range(N):
k[i][0], k[i][1] = list(map(int, input().split()))
dp[0][: k[0][1]] = [k[0][0]] * (k[0][1] + 1)
dp[0][0] = 0
for i in range(1, N):
for v in range(1001 * 101)... | N, W = list(map(int, input().split()))
k = [[0, 0] for i in range(N)]
dp = [[W + 1] * (1001 * 101 + 1) for j in range(N + 1)]
R = set()
for i in range(N):
k[i][0], k[i][1] = list(map(int, input().split()))
# dp[0][:k[0][1]]=[k[0][0]]*(k[0][1]+1)
dp[0][0] = 0
for i in range(0, N):
for v in range(1001 * 101):
... | false | 0 | [
"-dp[0][: k[0][1]] = [k[0][0]] * (k[0][1] + 1)",
"+# dp[0][:k[0][1]]=[k[0][0]]*(k[0][1]+1)",
"-for i in range(1, N):",
"+for i in range(0, N):",
"- dp[i][v] = min(dp[i - 1][v - k[i][1]] + k[i][0], dp[i - 1][v])",
"+ dp[i + 1][v] = min(dp[i][v - k[i][1]] + k[i][0], dp[i][v])",
"- ... | false | 0.41375 | 0.487497 | 0.848723 | [
"s533949675",
"s834069659"
] |
u367701763 | p02862 | python | s201243208 | s082305399 | 300 | 223 | 101,564 | 65,628 | Accepted | Accepted | 25.67 | # https://atcoder.jp/contests/abc145/tasks/abc145_d
class Combination: # 計算量は O(n_max + log(mod))
def __init__(self, n_max, mod=10**9+7):
self.mod = mod
f = 1
self.fac = fac = [f]
for i in range(1, n_max+1): # 階乗(= n_... | # https://atcoder.jp/contests/abc145/tasks/abc145_d
X, Y = list(map(int, input().split()))
if (2*Y- X) % 3 or (2*X- Y) % 3:
print((0))
exit()
x = (2*Y - X) // 3
y = (2*X - Y) // 3
if x < 0 or y < 0:
print((0))
exit()
n = x + y
r = x
mod = 10**9 + 7
f = 1
for i in range(1, n... | 56 | 33 | 1,696 | 516 | # https://atcoder.jp/contests/abc145/tasks/abc145_d
class Combination: # 計算量は O(n_max + log(mod))
def __init__(self, n_max, mod=10**9 + 7):
self.mod = mod
f = 1
self.fac = fac = [f]
for i in range(1, n_max + 1): # 階乗(= n_max !)の逆元を生成
f = f * i % mod # 動的計画法による階乗の高速計算
... | # https://atcoder.jp/contests/abc145/tasks/abc145_d
X, Y = list(map(int, input().split()))
if (2 * Y - X) % 3 or (2 * X - Y) % 3:
print((0))
exit()
x = (2 * Y - X) // 3
y = (2 * X - Y) // 3
if x < 0 or y < 0:
print((0))
exit()
n = x + y
r = x
mod = 10**9 + 7
f = 1
for i in range(1, n + 1):
f = f * i... | false | 41.071429 | [
"-class Combination: # 計算量は O(n_max + log(mod))",
"- def __init__(self, n_max, mod=10**9 + 7):",
"- self.mod = mod",
"- f = 1",
"- self.fac = fac = [f]",
"- for i in range(1, n_max + 1): # 階乗(= n_max !)の逆元を生成",
"- f = f * i % mod # 動的計画法による階乗の高速計算",
"- ... | false | 0.27957 | 0.174306 | 1.603904 | [
"s201243208",
"s082305399"
] |
u312025627 | p03712 | python | s019677274 | s960249323 | 218 | 170 | 42,584 | 38,384 | Accepted | Accepted | 22.02 | h, w = (int(i) for i in input().split())
a = [input() for i in range(h)]
for i in range(h+2):
for j in range(w+2):
if i == 0 or i == h+1 or j == 0 or j == w+1:
print("#",end="")
else:
print(a[i-1][j-1],end="")
print()
| def main():
H, W = (int(i) for i in input().split())
A = ["#"+input()+"#" for i in range(H)]
print("#"*(W+2))
print(*A, sep="\n")
print("#"*(W+2))
if __name__ == '__main__':
main()
| 9 | 10 | 273 | 216 | h, w = (int(i) for i in input().split())
a = [input() for i in range(h)]
for i in range(h + 2):
for j in range(w + 2):
if i == 0 or i == h + 1 or j == 0 or j == w + 1:
print("#", end="")
else:
print(a[i - 1][j - 1], end="")
print()
| def main():
H, W = (int(i) for i in input().split())
A = ["#" + input() + "#" for i in range(H)]
print("#" * (W + 2))
print(*A, sep="\n")
print("#" * (W + 2))
if __name__ == "__main__":
main()
| false | 10 | [
"-h, w = (int(i) for i in input().split())",
"-a = [input() for i in range(h)]",
"-for i in range(h + 2):",
"- for j in range(w + 2):",
"- if i == 0 or i == h + 1 or j == 0 or j == w + 1:",
"- print(\"#\", end=\"\")",
"- else:",
"- print(a[i - 1][j - 1], end=\"\"... | false | 0.081322 | 0.042946 | 1.893562 | [
"s019677274",
"s960249323"
] |
u966695411 | p03331 | python | s915548471 | s308046595 | 219 | 17 | 2,940 | 2,940 | Accepted | Accepted | 92.24 | N=int(eval(input()));print((min(sum(map(int,str(i)+str(N-i)))for i in range(1,N)))) | n=sum(map(int,eval(input())));print(([n,10][n<2])) | 1 | 1 | 75 | 42 | N = int(eval(input()))
print((min(sum(map(int, str(i) + str(N - i))) for i in range(1, N))))
| n = sum(map(int, eval(input())))
print(([n, 10][n < 2]))
| false | 0 | [
"-N = int(eval(input()))",
"-print((min(sum(map(int, str(i) + str(N - i))) for i in range(1, N))))",
"+n = sum(map(int, eval(input())))",
"+print(([n, 10][n < 2]))"
] | false | 0.283193 | 0.036805 | 7.694327 | [
"s915548471",
"s308046595"
] |
u226155577 | p03097 | python | s349142617 | s427805614 | 360 | 320 | 11,328 | 11,320 | Accepted | Accepted | 11.11 | N, A, B = list(map(int, input().split()))
if bin(A).count("1")%2 == bin(B).count("1")%2:
print("No")
exit(0)
print("Yes")
ans = []
def solve(c, A, B, S):
P = A ^ B
U = P & S
b = 1
if c == 1:
ans.append(A)
ans.append(B)
return
for i in range(N):
... | N, A, B = list(map(int, input().split()))
if bin(A).count("1")%2 == bin(B).count("1")%2:
print("No")
exit(0)
print("Yes")
ans = []
def solve(c, A, B, S):
P = (A ^ B) & S
b = 1
if c == 1:
ans.append(A)
ans.append(B)
return
while not P & b:
b <<= 1... | 30 | 28 | 636 | 491 | N, A, B = list(map(int, input().split()))
if bin(A).count("1") % 2 == bin(B).count("1") % 2:
print("No")
exit(0)
print("Yes")
ans = []
def solve(c, A, B, S):
P = A ^ B
U = P & S
b = 1
if c == 1:
ans.append(A)
ans.append(B)
return
for i in range(N):
if U & b:... | N, A, B = list(map(int, input().split()))
if bin(A).count("1") % 2 == bin(B).count("1") % 2:
print("No")
exit(0)
print("Yes")
ans = []
def solve(c, A, B, S):
P = (A ^ B) & S
b = 1
if c == 1:
ans.append(A)
ans.append(B)
return
while not P & b:
b <<= 1
S0 = S ... | false | 6.666667 | [
"- P = A ^ B",
"- U = P & S",
"+ P = (A ^ B) & S",
"- for i in range(N):",
"- if U & b:",
"- assert S & b > 0, (P, S, U, b)",
"- S0 = S ^ b",
"- k = 1",
"- while not S0 & k:",
"- k <<= 1",
"- C = A ^ k",
"... | false | 0.100239 | 0.095702 | 1.047413 | [
"s349142617",
"s427805614"
] |
u706786134 | p03163 | python | s746236438 | s362215045 | 457 | 170 | 120,044 | 14,580 | Accepted | Accepted | 62.8 | n, max_weight = list(map(int, input().split()))
WV = [list(map(int, input().split())) for _ in range(n)]
W, V = list(zip(*WV))
dp = list([0] * (max_weight + 1) for _ in range(n + 1))
for i in range(n):
for w in range(1, max_weight + 1):
if w >= W[i]:
dp[i + 1][w] = max(dp[i][w], dp[i][w -... | import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros(W + 1, np.int64)
for _ in range(N):
w, v = list(map(int, input().split()))
np.maximum(dp[w:], dp[:-w] + v, out=dp[w:])
print((dp[W])) | 12 | 8 | 403 | 207 | n, max_weight = list(map(int, input().split()))
WV = [list(map(int, input().split())) for _ in range(n)]
W, V = list(zip(*WV))
dp = list([0] * (max_weight + 1) for _ in range(n + 1))
for i in range(n):
for w in range(1, max_weight + 1):
if w >= W[i]:
dp[i + 1][w] = max(dp[i][w], dp[i][w - W[i]] ... | import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros(W + 1, np.int64)
for _ in range(N):
w, v = list(map(int, input().split()))
np.maximum(dp[w:], dp[:-w] + v, out=dp[w:])
print((dp[W]))
| false | 33.333333 | [
"-n, max_weight = list(map(int, input().split()))",
"-WV = [list(map(int, input().split())) for _ in range(n)]",
"-W, V = list(zip(*WV))",
"-dp = list([0] * (max_weight + 1) for _ in range(n + 1))",
"-for i in range(n):",
"- for w in range(1, max_weight + 1):",
"- if w >= W[i]:",
"- ... | false | 0.072677 | 0.963725 | 0.075412 | [
"s746236438",
"s362215045"
] |
u260980560 | p02248 | python | s753981495 | s371494300 | 2,100 | 740 | 49,584 | 47,928 | Accepted | Accepted | 64.76 | class RH():
def __init__(self, s, base, mod):
self.base = base
self.mod = mod
self.rev = pow(base, mod-2, mod)
l = len(s)
self.h = h = [0]*(l+1)
tmp = 0
for i in range(l):
num = ord(s[i])
tmp = (tmp*base + num) % mod
... | import sys
readline = sys.stdin.readline
write = sys.stdout.write
class KMP:
def __init__(self, W):
L = len(W)
T = [0] * (L+1)
T[0] = -1
c = 0
for p in range(1, L):
if W[p] == W[c]:
T[p] = T[c]
else:
T[p] ... | 31 | 50 | 877 | 1,152 | class RH:
def __init__(self, s, base, mod):
self.base = base
self.mod = mod
self.rev = pow(base, mod - 2, mod)
l = len(s)
self.h = h = [0] * (l + 1)
tmp = 0
for i in range(l):
num = ord(s[i])
tmp = (tmp * base + num) % mod
h... | import sys
readline = sys.stdin.readline
write = sys.stdout.write
class KMP:
def __init__(self, W):
L = len(W)
T = [0] * (L + 1)
T[0] = -1
c = 0
for p in range(1, L):
if W[p] == W[c]:
T[p] = T[c]
else:
T[p] = c
... | false | 38 | [
"-class RH:",
"- def __init__(self, s, base, mod):",
"- self.base = base",
"- self.mod = mod",
"- self.rev = pow(base, mod - 2, mod)",
"- l = len(s)",
"- self.h = h = [0] * (l + 1)",
"- tmp = 0",
"- for i in range(l):",
"- num = ord(s[... | false | 0.036874 | 0.049221 | 0.749153 | [
"s753981495",
"s371494300"
] |
u411203878 | p03078 | python | s031622431 | s638202301 | 971 | 835 | 148,160 | 214,712 | Accepted | Accepted | 14.01 | x,y,z,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ab = []
ans = []
for i in range(x):
for j in range(y):
ab.append(a[i]+b[j])
ab.sort(reverse=True)
if len(ab) < k:
for i in range(len(ab))... | x,y,z,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
mid = []
for i in range(x):
for j in range(y):
mid.append(a[i]+b[j])
mid.sort(reverse=True)
ans = []
for i in range(min(k,len(mid))):
... | 28 | 26 | 541 | 435 | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ab = []
ans = []
for i in range(x):
for j in range(y):
ab.append(a[i] + b[j])
ab.sort(reverse=True)
if len(ab) < k:
for i in range(len(ab)):
fo... | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
mid = []
for i in range(x):
for j in range(y):
mid.append(a[i] + b[j])
mid.sort(reverse=True)
ans = []
for i in range(min(k, len(mid))):
for j in range... | false | 7.142857 | [
"-ab = []",
"-ans = []",
"+mid = []",
"- ab.append(a[i] + b[j])",
"-ab.sort(reverse=True)",
"-if len(ab) < k:",
"- for i in range(len(ab)):",
"- for j in range(z):",
"- ans.append(ab[i] + c[j])",
"-else:",
"- for i in range(k):",
"- for j in range(z):",
... | false | 0.03934 | 0.041127 | 0.956531 | [
"s031622431",
"s638202301"
] |
u745223262 | p03805 | python | s025032925 | s350063160 | 1,168 | 30 | 3,556 | 3,064 | Accepted | Accepted | 97.43 | import copy
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
cnt = 0
fin = set([i + 1 for i in range(n)])
def path(now, edges, past):
global cnt
if set(past) == fin:
cnt += 1
return 0
for i in range(len(edges)):
if now == edge... | import itertools
n, m = list(map(int, input().split()))
ab = set()
for _ in range(m):
a, b = list(map(int, input().split()))
ab.add((a, b))
ab.add((b, a))
cnt = 0
for x in itertools.permutations(list(range(1, n + 1))):
if x[0] != 1:
break
flag = True
for i in range(len(x)... | 38 | 21 | 1,377 | 436 | import copy
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
cnt = 0
fin = set([i + 1 for i in range(n)])
def path(now, edges, past):
global cnt
if set(past) == fin:
cnt += 1
return 0
for i in range(len(edges)):
if now == edges[i][0] ... | import itertools
n, m = list(map(int, input().split()))
ab = set()
for _ in range(m):
a, b = list(map(int, input().split()))
ab.add((a, b))
ab.add((b, a))
cnt = 0
for x in itertools.permutations(list(range(1, n + 1))):
if x[0] != 1:
break
flag = True
for i in range(len(x) - 1):
... | false | 44.736842 | [
"-import copy",
"+import itertools",
"-ab = [list(map(int, input().split())) for _ in range(m)]",
"+ab = set()",
"+for _ in range(m):",
"+ a, b = list(map(int, input().split()))",
"+ ab.add((a, b))",
"+ ab.add((b, a))",
"-fin = set([i + 1 for i in range(n)])",
"-",
"-",
"-def path(now... | false | 0.152505 | 0.043287 | 3.523148 | [
"s025032925",
"s350063160"
] |
u374765578 | p02953 | python | s168243972 | s080254647 | 113 | 85 | 14,396 | 14,396 | Accepted | Accepted | 24.78 | n = int(eval(input()))
h = list(map(int, input().split()))
w = 1
for i in range(n-1):
if h[i] - h[i+1] >= 2:
w = 0
for j in range(n-2):
if h[j] - h[j+1] == 1:
for k in range(j,n-2):
if h[k+1] - h[k+2] == 0:
continue
if h[k+1] - h[k+2] == ... | n = int(eval(input()))
h = list(map(int,input().split()))
answer = "Yes"
for i in range(n-2,0,-1):
if h[i] > h[i+1] + 1:
answer = "No"
break
elif h[i] == h[i+1] +1:
h[i] -= 1
print(answer) | 25 | 12 | 449 | 227 | n = int(eval(input()))
h = list(map(int, input().split()))
w = 1
for i in range(n - 1):
if h[i] - h[i + 1] >= 2:
w = 0
for j in range(n - 2):
if h[j] - h[j + 1] == 1:
for k in range(j, n - 2):
if h[k + 1] - h[k + 2] == 0:
continue
if h[k + 1] - h[k + 2] ==... | n = int(eval(input()))
h = list(map(int, input().split()))
answer = "Yes"
for i in range(n - 2, 0, -1):
if h[i] > h[i + 1] + 1:
answer = "No"
break
elif h[i] == h[i + 1] + 1:
h[i] -= 1
print(answer)
| false | 52 | [
"-w = 1",
"-for i in range(n - 1):",
"- if h[i] - h[i + 1] >= 2:",
"- w = 0",
"-for j in range(n - 2):",
"- if h[j] - h[j + 1] == 1:",
"- for k in range(j, n - 2):",
"- if h[k + 1] - h[k + 2] == 0:",
"- continue",
"- if h[k + 1] - h[k + 2] =... | false | 0.038594 | 0.041556 | 0.928727 | [
"s168243972",
"s080254647"
] |
u729133443 | p02889 | python | s107659030 | s870392266 | 411 | 359 | 40,872 | 40,796 | Accepted | Accepted | 12.65 | from scipy.sparse import*
def main():
f=csgraph.floyd_warshall
n,m,l,*t=list(map(int,open(0).read().split()))
d=[[0]*(n+1)for _ in range(n+1)]
for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
d=f(f(d,0)<=l)-1
d[d>n]=-1
print(('\n'.join(str(d[i])for i in zip(*[iter(t[m*3+1:])]*2))))
main() | from scipy.sparse import*
def main():
f=csgraph.floyd_warshall
n,m,l,*t=list(map(int,open(0).read().split()))
d=[[0]*(n+1)for _ in range(n+1)]
for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
d=f(f(d,0)<=l)-1
d[d>n]=-1
print(('\n'.join(str(int(d[i]))for i in zip(*[iter(t[m*3+1:])]*2))))
main() | 10 | 10 | 302 | 307 | from scipy.sparse import *
def main():
f = csgraph.floyd_warshall
n, m, l, *t = list(map(int, open(0).read().split()))
d = [[0] * (n + 1) for _ in range(n + 1)]
for a, b, c in zip(*[iter(t[: m * 3])] * 3):
d[a][b] = c
d = f(f(d, 0) <= l) - 1
d[d > n] = -1
print(("\n".join(str(d[i])... | from scipy.sparse import *
def main():
f = csgraph.floyd_warshall
n, m, l, *t = list(map(int, open(0).read().split()))
d = [[0] * (n + 1) for _ in range(n + 1)]
for a, b, c in zip(*[iter(t[: m * 3])] * 3):
d[a][b] = c
d = f(f(d, 0) <= l) - 1
d[d > n] = -1
print(("\n".join(str(int(d... | false | 0 | [
"- print((\"\\n\".join(str(d[i]) for i in zip(*[iter(t[m * 3 + 1 :])] * 2))))",
"+ print((\"\\n\".join(str(int(d[i])) for i in zip(*[iter(t[m * 3 + 1 :])] * 2))))"
] | false | 0.52773 | 1.076026 | 0.490444 | [
"s107659030",
"s870392266"
] |
u380524497 | p03476 | python | s558073747 | s955503225 | 1,071 | 868 | 4,340 | 7,788 | Accepted | Accepted | 18.95 | def is_prime(num):
if num == 1:
return False
limit = int(num ** 0.5) + 1
for i in range(2, limit):
if num % i == 0:
return False
return True
cumsum = [0] * (10**5 + 2)
count = 0
for num in range(1, 10**5, 2):
if is_prime(num):
if is_prime((num+1)... | primes = set(range(3, 10**5, 2))
primes.add(2)
cumsum = [0] * (10**5 + 2)
for i in range(3, 10**5):
if i in primes:
for not_prime in range(i+i, 10**5, i):
primes.discard(not_prime)
count = 0
for num in range(1, 10**5, 2):
if num in primes:
if (num+1)//2 in primes:
... | 26 | 24 | 546 | 537 | def is_prime(num):
if num == 1:
return False
limit = int(num**0.5) + 1
for i in range(2, limit):
if num % i == 0:
return False
return True
cumsum = [0] * (10**5 + 2)
count = 0
for num in range(1, 10**5, 2):
if is_prime(num):
if is_prime((num + 1) // 2):
... | primes = set(range(3, 10**5, 2))
primes.add(2)
cumsum = [0] * (10**5 + 2)
for i in range(3, 10**5):
if i in primes:
for not_prime in range(i + i, 10**5, i):
primes.discard(not_prime)
count = 0
for num in range(1, 10**5, 2):
if num in primes:
if (num + 1) // 2 in primes:
c... | false | 7.692308 | [
"-def is_prime(num):",
"- if num == 1:",
"- return False",
"- limit = int(num**0.5) + 1",
"- for i in range(2, limit):",
"- if num % i == 0:",
"- return False",
"- return True",
"-",
"-",
"+primes = set(range(3, 10**5, 2))",
"+primes.add(2)",
"+for i in r... | false | 0.49796 | 0.170834 | 2.914881 | [
"s558073747",
"s955503225"
] |
u623814058 | p02958 | python | s429133861 | s683458314 | 30 | 27 | 9,068 | 9,036 | Accepted | Accepted | 10 | eval(input())
*p,=list(map(int,input().split()))
print(('NO' if 2<sum([1 for i,j in zip(p,sorted(p)) if i!=j]) else 'YES')) | eval(input())
*p,=list(map(int,input().split()))
print(('YNEOS'[2<sum([1 for i,j in zip(p,sorted(p)) if i!=j])::2])) | 3 | 3 | 111 | 104 | eval(input())
(*p,) = list(map(int, input().split()))
print(("NO" if 2 < sum([1 for i, j in zip(p, sorted(p)) if i != j]) else "YES"))
| eval(input())
(*p,) = list(map(int, input().split()))
print(("YNEOS"[2 < sum([1 for i, j in zip(p, sorted(p)) if i != j]) :: 2]))
| false | 0 | [
"-print((\"NO\" if 2 < sum([1 for i, j in zip(p, sorted(p)) if i != j]) else \"YES\"))",
"+print((\"YNEOS\"[2 < sum([1 for i, j in zip(p, sorted(p)) if i != j]) :: 2]))"
] | false | 0.03482 | 0.03712 | 0.938036 | [
"s429133861",
"s683458314"
] |
u089230684 | p03272 | python | s348600515 | s311534308 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | n,i=list(map(int,input().split()))
j=0
for v in range(n):
j=j+1
if (n-1)>= i:
n=n-1
else:
break
print (j)
| N,i=[int(x)for x in input().split()]
x=N-i+1
print(x)
| 12 | 3 | 155 | 56 | n, i = list(map(int, input().split()))
j = 0
for v in range(n):
j = j + 1
if (n - 1) >= i:
n = n - 1
else:
break
print(j)
| N, i = [int(x) for x in input().split()]
x = N - i + 1
print(x)
| false | 75 | [
"-n, i = list(map(int, input().split()))",
"-j = 0",
"-for v in range(n):",
"- j = j + 1",
"- if (n - 1) >= i:",
"- n = n - 1",
"- else:",
"- break",
"-print(j)",
"+N, i = [int(x) for x in input().split()]",
"+x = N - i + 1",
"+print(x)"
] | false | 0.043895 | 0.043486 | 1.009407 | [
"s348600515",
"s311534308"
] |
u949338836 | p02257 | python | s340321578 | s425080164 | 3,570 | 360 | 6,808 | 6,816 | Accepted | Accepted | 89.92 | #coding:utf-8
import math
n = int(eval(input()))
prime_count = 0
for i in range(n):
x = int(eval(input()))
div = 1
div_count = 0
while div <= math.sqrt(x) and div_count < 3:
if x % div == 0 and div == math.sqrt(x):
div_count += 1
elif x % div == 0 and div != m... | #coding:utf-8
import math
def isPrime(n):
if n == 2:
return True
elif n % 2 == 0:
return False
else:
for i in range(3,math.ceil(math.sqrt(n))+1,2):
if n % i == 0:
return False
return True
n = int(eval(input()))
c = 0
for i in rang... | 21 | 21 | 441 | 378 | # coding:utf-8
import math
n = int(eval(input()))
prime_count = 0
for i in range(n):
x = int(eval(input()))
div = 1
div_count = 0
while div <= math.sqrt(x) and div_count < 3:
if x % div == 0 and div == math.sqrt(x):
div_count += 1
elif x % div == 0 and div != math.sqrt(x):
... | # coding:utf-8
import math
def isPrime(n):
if n == 2:
return True
elif n % 2 == 0:
return False
else:
for i in range(3, math.ceil(math.sqrt(n)) + 1, 2):
if n % i == 0:
return False
return True
n = int(eval(input()))
c = 0
for i in range(n):
... | false | 0 | [
"+",
"+def isPrime(n):",
"+ if n == 2:",
"+ return True",
"+ elif n % 2 == 0:",
"+ return False",
"+ else:",
"+ for i in range(3, math.ceil(math.sqrt(n)) + 1, 2):",
"+ if n % i == 0:",
"+ return False",
"+ return True",
"+",
"+",... | false | 0.037356 | 0.038853 | 0.961465 | [
"s340321578",
"s425080164"
] |
u869919400 | p03785 | python | s917893380 | s173417180 | 271 | 239 | 8,280 | 8,280 | Accepted | Accepted | 11.81 | n, c, k = list(map(int, input().split()))
times = sorted([int(eval(input())) for _ in range(n)])
count = 0
passengers = 0
border = 0
for i in range(n):
if border == 0:
border = times[i] + k
if c > passengers and border >= times[i]:
passengers += 1
if passengers == c:
... | n, c, k = list(map(int, input().split()))
times = sorted([int(eval(input())) for _ in range(n)])
count = 1
passengers = 0
border = times[0] + k
for t in times:
passengers += 1
if c < passengers or border < t:
count += 1
passengers = 1
border = t + k
print(count) | 21 | 14 | 528 | 297 | n, c, k = list(map(int, input().split()))
times = sorted([int(eval(input())) for _ in range(n)])
count = 0
passengers = 0
border = 0
for i in range(n):
if border == 0:
border = times[i] + k
if c > passengers and border >= times[i]:
passengers += 1
if passengers == c:
count +=... | n, c, k = list(map(int, input().split()))
times = sorted([int(eval(input())) for _ in range(n)])
count = 1
passengers = 0
border = times[0] + k
for t in times:
passengers += 1
if c < passengers or border < t:
count += 1
passengers = 1
border = t + k
print(count)
| false | 33.333333 | [
"-count = 0",
"+count = 1",
"-border = 0",
"-for i in range(n):",
"- if border == 0:",
"- border = times[i] + k",
"- if c > passengers and border >= times[i]:",
"- passengers += 1",
"- if passengers == c:",
"- count += 1",
"- passengers = 0",
"-... | false | 0.054358 | 0.033861 | 1.605314 | [
"s917893380",
"s173417180"
] |
u270681687 | p03111 | python | s362230257 | s138736095 | 221 | 82 | 41,956 | 3,188 | Accepted | Accepted | 62.9 | import sys
sys.setrecursionlimit(10**7)
n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
mp = float('inf')
def f(i, anum, alen, bnum, blen, cnum, clen):
global mp
if i == n:
if alen * blen * clen == 0:
return
mp = min(mp, abs(anum-... | import sys
sys.setrecursionlimit(10**7)
n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
mp = [float('inf')]
def f(i, anum, alen, bnum, blen, cnum, clen):
if i == n:
if alen * blen * clen == 0:
return
mp[0] = min(mp[0], abs(anum-a)+10*(... | 23 | 22 | 656 | 652 | import sys
sys.setrecursionlimit(10**7)
n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
mp = float("inf")
def f(i, anum, alen, bnum, blen, cnum, clen):
global mp
if i == n:
if alen * blen * clen == 0:
return
mp = min(
mp,
... | import sys
sys.setrecursionlimit(10**7)
n, a, b, c = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(n)]
mp = [float("inf")]
def f(i, anum, alen, bnum, blen, cnum, clen):
if i == n:
if alen * blen * clen == 0:
return
mp[0] = min(
mp[0],
a... | false | 4.347826 | [
"-mp = float(\"inf\")",
"+mp = [float(\"inf\")]",
"- global mp",
"- mp = min(",
"- mp,",
"+ mp[0] = min(",
"+ mp[0],",
"-print(mp)",
"+print((mp[0]))"
] | false | 0.066434 | 0.080162 | 0.828753 | [
"s362230257",
"s138736095"
] |
u995062424 | p02844 | python | s542674257 | s424961462 | 345 | 18 | 42,076 | 3,188 | Accepted | Accepted | 94.78 | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
num = str(i).zfill(3)
flag2 = True
start = 0
for j in range(3):
flag = False
for k in range(start, N):
if(num[j] == S[k]):
flag = True
start = k+1
... | def main():
N = int(eval(input()))
S = eval(input())
cnt = 0
for i in range(10):
idx_i = S.find(str(i))
if(idx_i == -1):
continue
for j in range(10):
idx_j = S.find(str(j), idx_i+1)
if(idx_j == -1):
continue
... | 22 | 20 | 438 | 500 | N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
num = str(i).zfill(3)
flag2 = True
start = 0
for j in range(3):
flag = False
for k in range(start, N):
if num[j] == S[k]:
flag = True
start = k + 1
break
... | def main():
N = int(eval(input()))
S = eval(input())
cnt = 0
for i in range(10):
idx_i = S.find(str(i))
if idx_i == -1:
continue
for j in range(10):
idx_j = S.find(str(j), idx_i + 1)
if idx_j == -1:
continue
for k in... | false | 9.090909 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-ans = 0",
"-for i in range(1000):",
"- num = str(i).zfill(3)",
"- flag2 = True",
"- start = 0",
"- for j in range(3):",
"- flag = False",
"- for k in range(start, N):",
"- if num[j] == S[k]:",
"- ... | false | 0.057963 | 0.006561 | 8.834357 | [
"s542674257",
"s424961462"
] |
u047796752 | p02616 | python | s610689293 | s514448802 | 330 | 197 | 116,996 | 113,004 | Accepted | Accepted | 40.3 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9+7
p, n = [], []
for i in range(N):
if A[i]>=0:
p.append(A[i])
else:
n.append(A[i])
ok = False
if len(p)>0:
if N==K:
if len(n)%2==0:
... | import sys
input = sys.stdin.readline
from collections import *
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9+7
p, n = [], []
for Ai in A:
if Ai>=0:
p.append(Ai)
else:
n.append(Ai)
if len(p)==0 and K%2==1:
if 0 in A:
print(... | 61 | 75 | 923 | 1,311 | import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
p, n = [], []
for i in range(N):
if A[i] >= 0:
p.append(A[i])
else:
n.append(A[i])
ok = False
if len(p) > 0:
if N == K:
if len(n) % 2 == 0:
ok... | import sys
input = sys.stdin.readline
from collections import *
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
p, n = [], []
for Ai in A:
if Ai >= 0:
p.append(Ai)
else:
n.append(Ai)
if len(p) == 0 and K % 2 == 1:
if 0 in A:
print((0))
... | false | 18.666667 | [
"+from collections import *",
"+",
"-for i in range(N):",
"- if A[i] >= 0:",
"- p.append(A[i])",
"+for Ai in A:",
"+ if Ai >= 0:",
"+ p.append(Ai)",
"- n.append(A[i])",
"-ok = False",
"-if len(p) > 0:",
"- if N == K:",
"- if len(n) % 2 == 0:",
"- ... | false | 0.112627 | 0.208559 | 0.540023 | [
"s610689293",
"s514448802"
] |
u366959492 | p03330 | python | s448926778 | s017817930 | 586 | 294 | 45,532 | 44,636 | Accepted | Accepted | 49.83 | n,m=list(map(int,input().split()))
d=[list(map(int,input().split())) for _ in range(m)]
c=[list(map(int,input().split())) for _ in range(n)]
ans0=[0]
ans1=[0]
ans2=[0]
for k in range(1,m+1):
a0=0
a1=0
a2=0
for i in range(n):
for j in range(n):
if (i+j+2)%3==0:
... | N,C=list(map(int,input().split()))
d=[list(map(int,input().split())) for _ in range(C)]
c=[list(map(int,input().split())) for _ in range(N)]
x=[[0]*(C+1) for _ in range(3)]
for i in range(N):
for j in range(N):
x[(i+j+2)%3][c[i][j]]+=1
from itertools import permutations
ans=1<<32
for ch in permut... | 27 | 17 | 680 | 484 | n, m = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(m)]
c = [list(map(int, input().split())) for _ in range(n)]
ans0 = [0]
ans1 = [0]
ans2 = [0]
for k in range(1, m + 1):
a0 = 0
a1 = 0
a2 = 0
for i in range(n):
for j in range(n):
if (i + j + 2) ... | N, C = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]
x = [[0] * (C + 1) for _ in range(3)]
for i in range(N):
for j in range(N):
x[(i + j + 2) % 3][c[i][j]] += 1
from itertools import permutations
ans = 1 << 3... | false | 37.037037 | [
"-n, m = list(map(int, input().split()))",
"-d = [list(map(int, input().split())) for _ in range(m)]",
"-c = [list(map(int, input().split())) for _ in range(n)]",
"-ans0 = [0]",
"-ans1 = [0]",
"-ans2 = [0]",
"-for k in range(1, m + 1):",
"- a0 = 0",
"- a1 = 0",
"- a2 = 0",
"- for i i... | false | 0.069459 | 0.048254 | 1.439447 | [
"s448926778",
"s017817930"
] |
u794173881 | p02947 | python | s304879429 | s435200304 | 1,897 | 570 | 101,976 | 80,728 | Accepted | Accepted | 69.95 | n = int(eval(input()))
s = [sorted(eval(input())) for i in range(n)]
s = sorted(s) + ["a"]
cnt = 1
ans = 0
for i in range(n):
if s[i] == s[i+1]:
cnt += 1
else:
ans += (cnt * (cnt - 1)) // 2
cnt = 1
print(ans) | n = int(eval(input()))
s = [eval(input()) for i in range(n)]
for i in range(n):
s[i] = sorted(s[i])
s[i] = "".join(s[i])
memo = {}
for i in range(n):
if s[i] not in memo:
memo[s[i]] = 1
else:
memo[s[i]] += 1
ans = 0
for num in memo:
num = memo[num]
ans += nu... | 13 | 18 | 241 | 338 | n = int(eval(input()))
s = [sorted(eval(input())) for i in range(n)]
s = sorted(s) + ["a"]
cnt = 1
ans = 0
for i in range(n):
if s[i] == s[i + 1]:
cnt += 1
else:
ans += (cnt * (cnt - 1)) // 2
cnt = 1
print(ans)
| n = int(eval(input()))
s = [eval(input()) for i in range(n)]
for i in range(n):
s[i] = sorted(s[i])
s[i] = "".join(s[i])
memo = {}
for i in range(n):
if s[i] not in memo:
memo[s[i]] = 1
else:
memo[s[i]] += 1
ans = 0
for num in memo:
num = memo[num]
ans += num * (num - 1) // 2
pri... | false | 27.777778 | [
"-s = [sorted(eval(input())) for i in range(n)]",
"-s = sorted(s) + [\"a\"]",
"-cnt = 1",
"+s = [eval(input()) for i in range(n)]",
"+for i in range(n):",
"+ s[i] = sorted(s[i])",
"+ s[i] = \"\".join(s[i])",
"+memo = {}",
"+for i in range(n):",
"+ if s[i] not in memo:",
"+ memo[s... | false | 0.047027 | 0.105797 | 0.444501 | [
"s304879429",
"s435200304"
] |
u823885866 | p02646 | python | s951446608 | s117232442 | 109 | 26 | 27,204 | 9,168 | Accepted | Accepted | 76.15 | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))
rl = lambd... | import sys
rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))
ri = lambda: int(sys.stdin.readline())
a, v = rm()
b, w = rm()
t = ri()
if v - w == 0:
print('NO')
exit()
if 0 <= abs(a-b) / (v-w) <= t:
print('YES')
else:
print('NO')
| 27 | 14 | 550 | 260 | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))
rl = lambda: list(map(... | import sys
rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))
ri = lambda: int(sys.stdin.readline())
a, v = rm()
b, w = rm()
t = ri()
if v - w == 0:
print("NO")
exit()
if 0 <= abs(a - b) / (v - w) <= t:
print("YES")
else:
print("NO")
| false | 48.148148 | [
"-import math",
"-import itertools",
"-import collections",
"-import heapq",
"-import re",
"-import numpy as np",
"-rr = lambda: sys.stdin.readline().rstrip()",
"-rs = lambda: sys.stdin.buffer.readline().split()",
"+rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))",
"-rm = lambda: ... | false | 0.035037 | 0.036647 | 0.956064 | [
"s951446608",
"s117232442"
] |
u201234972 | p02996 | python | s816384331 | s368861269 | 801 | 443 | 33,412 | 33,480 | Accepted | Accepted | 44.69 | #import sys
#input = sys.stdin.readline
def main():
N = int( eval(input()))
T = [ tuple( map( int, input().split())) for _ in range(N)]
T = sorted(T,key=lambda x:x[1])
time = 0
ans = "Yes"
for i in range(N):
time += T[i][0]
if time > T[i][1]:
ans = "No"
... | import sys
input = sys.stdin.readline
def main():
N = int( eval(input()))
T = [ tuple( map( int, input().split())) for _ in range(N)]
T = sorted(T,key=lambda x:x[1])
time = 0
ans = "Yes"
for i in range(N):
time += T[i][0]
if time > T[i][1]:
ans = "No"
... | 16 | 16 | 386 | 384 | # import sys
# input = sys.stdin.readline
def main():
N = int(eval(input()))
T = [tuple(map(int, input().split())) for _ in range(N)]
T = sorted(T, key=lambda x: x[1])
time = 0
ans = "Yes"
for i in range(N):
time += T[i][0]
if time > T[i][1]:
ans = "No"
br... | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
T = [tuple(map(int, input().split())) for _ in range(N)]
T = sorted(T, key=lambda x: x[1])
time = 0
ans = "Yes"
for i in range(N):
time += T[i][0]
if time > T[i][1]:
ans = "No"
bre... | false | 0 | [
"-# import sys",
"-# input = sys.stdin.readline",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.081908 | 0.066915 | 1.224054 | [
"s816384331",
"s368861269"
] |
u992910889 | p03644 | python | s228141210 | s935718361 | 169 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.94 | # import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
N=int(eval(input()))
val=1
while val<=N:
val=va... | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
N=int(eval(input()))
i=1
while i<=N:
i*=2
print((i//2))
resolve() | 16 | 13 | 349 | 207 | # import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
N = int(eval(input()))
val = 1
while val <= N:
val = val * 2... | import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
N = int(eval(input()))
i = 1
while i <= N:
i *= 2
print((i // 2))
resolve()
| false | 18.75 | [
"-# import bisect",
"-# import copy",
"-# import fractions",
"-# import math",
"-# import numpy as np",
"-# from collections import Counter, deque",
"-# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product",
"+import sys",
"+",
"+sys.setrecursionlimit(1... | false | 0.072515 | 0.036612 | 1.980646 | [
"s228141210",
"s935718361"
] |
u241159583 | p02861 | python | s253176157 | s981147822 | 480 | 439 | 3,188 | 4,504 | Accepted | Accepted | 8.54 | from itertools import permutations
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
N = list(range(n))
ans = 0
cnt = 0
for v in permutations(N):
x = 0
for i in range(n-1):
a = v[i]
b = v[i+1]
x += ((xy[a][0]-xy[b][0])**2 + (xy[a][1]-xy[b][1])**... | import itertools
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
ans = []
X = 0
for v in itertools.permutations(list(range(n))):
cnt = 0
X += 1
for i in range(n-1):
x1,y1 = xy[v[0]][0], xy[v[0]][1]
x2,y2 = xy[v[1]][0], xy[v[1]][1]
cnt += ((x1-x2)**2 + (y1-y... | 16 | 15 | 367 | 363 | from itertools import permutations
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
N = list(range(n))
ans = 0
cnt = 0
for v in permutations(N):
x = 0
for i in range(n - 1):
a = v[i]
b = v[i + 1]
x += ((xy[a][0] - xy[b][0]) ** 2 + (xy[a][1] - xy[b][1]) ** ... | import itertools
n = int(eval(input()))
xy = [list(map(int, input().split())) for _ in range(n)]
ans = []
X = 0
for v in itertools.permutations(list(range(n))):
cnt = 0
X += 1
for i in range(n - 1):
x1, y1 = xy[v[0]][0], xy[v[0]][1]
x2, y2 = xy[v[1]][0], xy[v[1]][1]
cnt += ((x1 - x2... | false | 6.25 | [
"-from itertools import permutations",
"+import itertools",
"-N = list(range(n))",
"-ans = 0",
"-cnt = 0",
"-for v in permutations(N):",
"- x = 0",
"+ans = []",
"+X = 0",
"+for v in itertools.permutations(list(range(n))):",
"+ cnt = 0",
"+ X += 1",
"- a = v[i]",
"- b... | false | 0.039758 | 0.05167 | 0.769464 | [
"s253176157",
"s981147822"
] |
u297574184 | p03352 | python | s789359830 | s883469339 | 20 | 17 | 3,188 | 2,940 | Accepted | Accepted | 15 | X = int(eval(input()))
powers = {1}
for base in range(2, int(X**0.5)+1):
power = base
while power <= X:
powers.add(power)
power *= base
print((max(powers)))
| X = int(eval(input()))
powers = {1}
for base in range(2, int(X**0.5)+1):
power = base * base
while power <= X:
powers.add(power)
power *= base
print((max(powers)))
| 10 | 10 | 184 | 191 | X = int(eval(input()))
powers = {1}
for base in range(2, int(X**0.5) + 1):
power = base
while power <= X:
powers.add(power)
power *= base
print((max(powers)))
| X = int(eval(input()))
powers = {1}
for base in range(2, int(X**0.5) + 1):
power = base * base
while power <= X:
powers.add(power)
power *= base
print((max(powers)))
| false | 0 | [
"- power = base",
"+ power = base * base"
] | false | 0.0684 | 0.068567 | 0.997565 | [
"s789359830",
"s883469339"
] |
u852690916 | p02793 | python | s320586531 | s789953913 | 1,056 | 351 | 517,768 | 48,220 | Accepted | Accepted | 66.76 | from collections import defaultdict
N=int(eval(input()))
A=list(map(int,input().split()))
MOD=10**9+7
LCM=defaultdict(int)
def f(n):
ret=defaultdict(int)
p=2
while n%p==0:
ret[p]+=1
n//=p
LCM[p]=max(LCM[p],ret[p])
p=3
while p*p<=n:
while n%p==0:
... | from collections import defaultdict
N=int(eval(input()))
A=list(map(int,input().split()))
MOD=10**9+7
LCM=defaultdict(int)
def f(n):
tmp=0
p=2
while n%p==0:
tmp+=1
n//=p
LCM[p]=max(LCM[p],tmp)
p=3
while p*p<=n:
tmp=0
while n%p==0:
t... | 40 | 37 | 656 | 584 | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
LCM = defaultdict(int)
def f(n):
ret = defaultdict(int)
p = 2
while n % p == 0:
ret[p] += 1
n //= p
LCM[p] = max(LCM[p], ret[p])
p = 3
while p * p <= n:
while... | from collections import defaultdict
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
LCM = defaultdict(int)
def f(n):
tmp = 0
p = 2
while n % p == 0:
tmp += 1
n //= p
LCM[p] = max(LCM[p], tmp)
p = 3
while p * p <= n:
tmp = 0
while n % ... | false | 7.5 | [
"- ret = defaultdict(int)",
"+ tmp = 0",
"- ret[p] += 1",
"+ tmp += 1",
"- LCM[p] = max(LCM[p], ret[p])",
"+ LCM[p] = max(LCM[p], tmp)",
"+ tmp = 0",
"- ret[p] += 1",
"+ tmp += 1",
"- LCM[p] = max(LCM[p], ret[p])",
"+ LCM[p] = ... | false | 0.044081 | 0.036456 | 1.209148 | [
"s320586531",
"s789953913"
] |
u046187684 | p03474 | python | s284889333 | s720629559 | 22 | 17 | 3,316 | 2,940 | Accepted | Accepted | 22.73 | #!/usr/bin/env python3
# coding=utf-8
import sys
import re
a, b = sys.stdin.readline().strip().split(" ")
s = sys.stdin.readline().strip()
a = int(a)
b = int(b)
m = re.match(r'(\d+)(-)(\d+)', s)
if m is None:
print("No")
else:
if len(m.group(1)) == a and m.group(2) == "-" and len(m.group(3)) == ... | def solve(string):
a, b, s = string.split()
a = int(a)
return "Yes" if s[a] == "-" and (s[:a] + s[a + 1:]).isdigit() else "No"
if __name__ == '__main__':
print((solve('\n'.join([eval(input()), eval(input())]))))
| 18 | 8 | 377 | 223 | #!/usr/bin/env python3
# coding=utf-8
import sys
import re
a, b = sys.stdin.readline().strip().split(" ")
s = sys.stdin.readline().strip()
a = int(a)
b = int(b)
m = re.match(r"(\d+)(-)(\d+)", s)
if m is None:
print("No")
else:
if len(m.group(1)) == a and m.group(2) == "-" and len(m.group(3)) == b:
prin... | def solve(string):
a, b, s = string.split()
a = int(a)
return "Yes" if s[a] == "-" and (s[:a] + s[a + 1 :]).isdigit() else "No"
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| false | 55.555556 | [
"-#!/usr/bin/env python3",
"-# coding=utf-8",
"-import sys",
"-import re",
"+def solve(string):",
"+ a, b, s = string.split()",
"+ a = int(a)",
"+ return \"Yes\" if s[a] == \"-\" and (s[:a] + s[a + 1 :]).isdigit() else \"No\"",
"-a, b = sys.stdin.readline().strip().split(\" \")",
"-s = sy... | false | 0.053654 | 0.043164 | 1.243031 | [
"s284889333",
"s720629559"
] |
u562935282 | p04045 | python | s499933307 | s494921490 | 58 | 36 | 2,940 | 3,064 | Accepted | Accepted | 37.93 | def inpl(): return input().split()
n, k = list(map(int, inpl()))
d = inpl()
x = n
while True:
flg = True
for c in str(x):
if c in d:
flg = False
break
if flg:
break
x += 1
print(x) | def main():
import sys
sys.setrecursionlimit(10 ** 7)
N, K = list(map(int, input().split()))
D = set(map(int, input().split()))
digits = {x for x in range(10)}
digits -= D
# print(digits)
digits = sorted(digits)
def dfs(pay):
if pay >= N:
return p... | 15 | 33 | 245 | 691 | def inpl():
return input().split()
n, k = list(map(int, inpl()))
d = inpl()
x = n
while True:
flg = True
for c in str(x):
if c in d:
flg = False
break
if flg:
break
x += 1
print(x)
| def main():
import sys
sys.setrecursionlimit(10**7)
N, K = list(map(int, input().split()))
D = set(map(int, input().split()))
digits = {x for x in range(10)}
digits -= D
# print(digits)
digits = sorted(digits)
def dfs(pay):
if pay >= N:
return pay
np = p... | false | 54.545455 | [
"-def inpl():",
"- return input().split()",
"+def main():",
"+ import sys",
"+",
"+ sys.setrecursionlimit(10**7)",
"+ N, K = list(map(int, input().split()))",
"+ D = set(map(int, input().split()))",
"+ digits = {x for x in range(10)}",
"+ digits -= D",
"+ # print(digits)"... | false | 0.059167 | 0.039871 | 1.483964 | [
"s499933307",
"s494921490"
] |
u489959379 | p03488 | python | s280363280 | s856695932 | 1,089 | 903 | 3,816 | 3,816 | Accepted | Accepted | 17.08 | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
s = eval(input())
gx, gy = list(map(int, input().split()))
spl = list(map(len, s.split("T")))
init_x = spl[0]
is_x = 0
to_x, to_y = [], []
for i in range(1, len(spl)):
... | # https://atcoder.jp/contests/abc082/submissions/13655878
# D - FT Robot
import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
s = eval(input())
gx, gy = list(map(int, input().split()))
spl = list(map(len, s.split("T")))
init_x = spl[0]
is... | 40 | 43 | 827 | 926 | import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
s = eval(input())
gx, gy = list(map(int, input().split()))
spl = list(map(len, s.split("T")))
init_x = spl[0]
is_x = 0
to_x, to_y = [], []
for i in range(1, len(spl)):
to_x.append(spl[i]) i... | # https://atcoder.jp/contests/abc082/submissions/13655878
# D - FT Robot
import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
s = eval(input())
gx, gy = list(map(int, input().split()))
spl = list(map(len, s.split("T")))
init_x = spl[0]
is_x = 0
to_x, to_... | false | 6.976744 | [
"+# https://atcoder.jp/contests/abc082/submissions/13655878",
"+# D - FT Robot",
"- to_x.append(spl[i]) if is_x else to_y.append(spl[i])",
"+ if spl[i]:",
"+ to_x.append(spl[i]) if is_x else to_y.append(spl[i])"
] | false | 0.040874 | 0.123418 | 0.331178 | [
"s280363280",
"s856695932"
] |
u371763408 | p03137 | python | s693412039 | s209983716 | 211 | 113 | 21,616 | 13,960 | Accepted | Accepted | 46.45 | n,m=list(map(int,input().split()))
X=sorted(list(map(int,input().split())))
init=[]
tmp=0
i=1
if m<n:
n=m
while i<len(X):
init.append([X[i]-X[i-1],i])
i+=1
init.sort(reverse=True,key=lambda x:x[0])
init=list([x[1] for x in init])
ans=0
init=sorted(init[:n-1])
if len(init)==0:
print((X[-1]-X[0... | n,m=list(map(int,input().split()))
X=sorted(list(map(int,input().split())))
ans=[]
if m<n:
print((0))
exit()
for i in range(m-1):
ans.append(X[i+1]-X[i])
ans=sorted(ans)
print((sum(ans[:m-n]))) | 30 | 10 | 485 | 198 | n, m = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
init = []
tmp = 0
i = 1
if m < n:
n = m
while i < len(X):
init.append([X[i] - X[i - 1], i])
i += 1
init.sort(reverse=True, key=lambda x: x[0])
init = list([x[1] for x in init])
ans = 0
init = sorted(init[: n - 1])
if len(init... | n, m = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
ans = []
if m < n:
print((0))
exit()
for i in range(m - 1):
ans.append(X[i + 1] - X[i])
ans = sorted(ans)
print((sum(ans[: m - n])))
| false | 66.666667 | [
"-init = []",
"-tmp = 0",
"-i = 1",
"+ans = []",
"- n = m",
"-while i < len(X):",
"- init.append([X[i] - X[i - 1], i])",
"- i += 1",
"-init.sort(reverse=True, key=lambda x: x[0])",
"-init = list([x[1] for x in init])",
"-ans = 0",
"-init = sorted(init[: n - 1])",
"-if len(init) == 0... | false | 0.046695 | 0.035247 | 1.324798 | [
"s693412039",
"s209983716"
] |
u634079249 | p02766 | python | s616528463 | s629647630 | 354 | 92 | 93,792 | 74,912 | Accepted | Accepted | 74.01 | import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip(... | import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip(... | 53 | 55 | 1,468 | 1,552 | import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = la... | import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = la... | false | 3.636364 | [
"+def Base_10_to_n(X, n):",
"+ if int(X / n):",
"+ return Base_10_to_n(int(X / n), n) + str(X % n)",
"+ return str(X % n)",
"+",
"+",
"- ret = 0",
"- while N != 0:",
"- N //= K",
"- ret += 1",
"- print(ret)",
"+ print((len(Base_10_to_n(N, K))))"
] | false | 0.046291 | 0.038613 | 1.198842 | [
"s616528463",
"s629647630"
] |
u411203878 | p02844 | python | s156307078 | s660966021 | 354 | 244 | 41,068 | 74,160 | Accepted | Accepted | 31.07 | n=int(eval(input()))
s=eval(input())
ans = 0
for i in range(1000):
count = 0
i = str(i)
i = (3-len(i))*'0'+i
for j in range(n):
if i[count] == s[j]:
count += 1
if count == 3:
break
if count == 3:
ans += 1
print(ans) | n=int(eval(input()))
s=list(eval(input()))
ans = 0
for i in range(1000):
i = str(i)
keta = len(list(i))
code = '0'*(3-keta)+i
code = list(code)
index = 0
for j in s:
if j == code[index]:
index += 1
if index == 3:
break
if index == 3... | 18 | 21 | 292 | 361 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
count = 0
i = str(i)
i = (3 - len(i)) * "0" + i
for j in range(n):
if i[count] == s[j]:
count += 1
if count == 3:
break
if count == 3:
ans += 1
print(ans)
| n = int(eval(input()))
s = list(eval(input()))
ans = 0
for i in range(1000):
i = str(i)
keta = len(list(i))
code = "0" * (3 - keta) + i
code = list(code)
index = 0
for j in s:
if j == code[index]:
index += 1
if index == 3:
break
if index == 3:
... | false | 14.285714 | [
"-s = eval(input())",
"+s = list(eval(input()))",
"- count = 0",
"- i = (3 - len(i)) * \"0\" + i",
"- for j in range(n):",
"- if i[count] == s[j]:",
"- count += 1",
"- if count == 3:",
"+ keta = len(list(i))",
"+ code = \"0\" * (3 - keta) + i",
"+ code ... | false | 0.036096 | 0.035188 | 1.025798 | [
"s156307078",
"s660966021"
] |
u319818856 | p03013 | python | s591200315 | s132135888 | 230 | 192 | 7,852 | 7,844 | Accepted | Accepted | 16.52 | import bisect
def typical_stairs(N: int, M: int, A: list)->int:
MOD = 10**9 + 7
A.sort()
A.append(float('inf'))
dp = [0] * (N+1)
dp[0] = 1
for i in range(N):
if A[bisect.bisect_left(A, i+1)] == i+1:
dp[i+1] = 0
else:
dp[i+1] = dp[i]
... | def typical_stairs(N: int, M: int, A: list)->int:
MOD = 10**9 + 7
dp = [0] * (N+1)
dp[0] = 1
ai = 0
for i in range(N):
if ai < M and A[ai] == i+1:
dp[i+1] = 0
ai += 1
else:
dp[i+1] = dp[i]
if i > 0:
dp[i+... | 33 | 29 | 624 | 581 | import bisect
def typical_stairs(N: int, M: int, A: list) -> int:
MOD = 10**9 + 7
A.sort()
A.append(float("inf"))
dp = [0] * (N + 1)
dp[0] = 1
for i in range(N):
if A[bisect.bisect_left(A, i + 1)] == i + 1:
dp[i + 1] = 0
else:
dp[i + 1] = dp[i]
... | def typical_stairs(N: int, M: int, A: list) -> int:
MOD = 10**9 + 7
dp = [0] * (N + 1)
dp[0] = 1
ai = 0
for i in range(N):
if ai < M and A[ai] == i + 1:
dp[i + 1] = 0
ai += 1
else:
dp[i + 1] = dp[i]
if i > 0:
dp[i + 1] +... | false | 12.121212 | [
"-import bisect",
"-",
"-",
"- A.sort()",
"- A.append(float(\"inf\"))",
"+ ai = 0",
"- if A[bisect.bisect_left(A, i + 1)] == i + 1:",
"+ if ai < M and A[ai] == i + 1:",
"+ ai += 1"
] | false | 0.048532 | 0.095944 | 0.505838 | [
"s591200315",
"s132135888"
] |
u098012509 | p02642 | python | s054705734 | s305929427 | 1,967 | 207 | 49,252 | 155,640 | Accepted | Accepted | 89.48 | import sys
import collections
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
aset = list(set(A))
aset.sort()
ans = [0] * (10 ** 6 + 1)
for a in aset:
for i in range(2, 10 ** 6 + 1):... | import sys
import collections
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
aset = list(set(A))
memo = [0] * (10 ** 6 + 1)
for a in aset:
for i in range(2, 10 ** 6 + 1):
if... | 34 | 33 | 589 | 604 | import sys
import collections
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
aset = list(set(A))
aset.sort()
ans = [0] * (10**6 + 1)
for a in aset:
for i in range(2, 10**6 + 1):
if a * i > 10... | import sys
import collections
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
aset = list(set(A))
memo = [0] * (10**6 + 1)
for a in aset:
for i in range(2, 10**6 + 1):
if a * i > 10**6:
... | false | 2.941176 | [
"- aset.sort()",
"- ans = [0] * (10**6 + 1)",
"+ memo = [0] * (10**6 + 1)",
"- ans[a * i] += 1",
"- res = 0",
"+ memo[a * i] += 1",
"+ ans = 0",
"- if ans[a] == 0 and c[a] == 1:",
"- res += 1",
"- print(res)",
"+ # 同じ数が入っていた場合もカウント... | false | 0.46069 | 0.862637 | 0.534048 | [
"s054705734",
"s305929427"
] |
u604839890 | p02584 | python | s752395704 | s871468486 | 35 | 30 | 9,164 | 9,136 | Accepted | Accepted | 14.29 | X, K, D = list(map(int, input().split()))
x = abs(X)
print((x-K*D if x > K*D else abs(x%D-(K-x//D)%2*D))) | x, k, d = list(map(int, input().split()))
t = min(abs(x)//d, k)
u = abs(x)-d*t
print((abs(u-d*((k-t)%2)))) | 3 | 5 | 99 | 103 | X, K, D = list(map(int, input().split()))
x = abs(X)
print((x - K * D if x > K * D else abs(x % D - (K - x // D) % 2 * D)))
| x, k, d = list(map(int, input().split()))
t = min(abs(x) // d, k)
u = abs(x) - d * t
print((abs(u - d * ((k - t) % 2))))
| false | 40 | [
"-X, K, D = list(map(int, input().split()))",
"-x = abs(X)",
"-print((x - K * D if x > K * D else abs(x % D - (K - x // D) % 2 * D)))",
"+x, k, d = list(map(int, input().split()))",
"+t = min(abs(x) // d, k)",
"+u = abs(x) - d * t",
"+print((abs(u - d * ((k - t) % 2))))"
] | false | 0.038849 | 0.04305 | 0.902416 | [
"s752395704",
"s871468486"
] |
u353797797 | p03168 | python | s596682889 | s270277535 | 1,465 | 215 | 3,316 | 14,544 | Accepted | Accepted | 85.32 | n=int(eval(input()))
ps=list(map(float,input().split()))
lim=(n+1)//2
dp=[0]*(lim+1)
dp[0]=1
for pi,p in enumerate(ps):
if pi+1>=lim:
st=lim-1
dp[lim]=dp[lim]+dp[lim-1]*p
else:
st=pi+1
for i in range(st,0,-1):
dp[i]=dp[i-1]*p+dp[i]*(1-p)
dp[0]=dp[0]*(1-p)
pr... | import numpy as np
n=int(eval(input()))
ps=list(map(float,input().split()))
lim=(n+1)//2
dp=np.zeros(lim+1,dtype=np.float64)
dp[0]=1
for p in ps:
dp[lim]=dp[lim]+dp[lim-1]*p
dp[1:lim]=dp[:lim-1]*p+dp[1:lim]*(1-p)
dp[0]=dp[0]*(1-p)
print((dp[-1])) | 15 | 12 | 325 | 262 | n = int(eval(input()))
ps = list(map(float, input().split()))
lim = (n + 1) // 2
dp = [0] * (lim + 1)
dp[0] = 1
for pi, p in enumerate(ps):
if pi + 1 >= lim:
st = lim - 1
dp[lim] = dp[lim] + dp[lim - 1] * p
else:
st = pi + 1
for i in range(st, 0, -1):
dp[i] = dp[i - 1] * p + ... | import numpy as np
n = int(eval(input()))
ps = list(map(float, input().split()))
lim = (n + 1) // 2
dp = np.zeros(lim + 1, dtype=np.float64)
dp[0] = 1
for p in ps:
dp[lim] = dp[lim] + dp[lim - 1] * p
dp[1:lim] = dp[: lim - 1] * p + dp[1:lim] * (1 - p)
dp[0] = dp[0] * (1 - p)
print((dp[-1]))
| false | 20 | [
"+import numpy as np",
"+",
"-dp = [0] * (lim + 1)",
"+dp = np.zeros(lim + 1, dtype=np.float64)",
"-for pi, p in enumerate(ps):",
"- if pi + 1 >= lim:",
"- st = lim - 1",
"- dp[lim] = dp[lim] + dp[lim - 1] * p",
"- else:",
"- st = pi + 1",
"- for i in range(st, 0, -... | false | 0.04708 | 0.214681 | 0.219301 | [
"s596682889",
"s270277535"
] |
u054514819 | p02714 | python | s910211243 | s415170036 | 1,479 | 312 | 9,460 | 74,544 | Accepted | Accepted | 78.9 | N = int(eval(input()))
S = list(str(eval(input())))
from collections import Counter
c = Counter(S)
ans = c['B']*c['G']*c['R']
for i in range(N-1):
for j in range(i, N):
if S[i]==S[j]:
continue
elif i+(j-i)*2>N-1:
break
s = S[i+(j-i)*2]
if s!=S[i]... | 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()))
S = list(eval(input()))
from collections import Counter
c = Counter(S)
ans = c['R']*c['G']*c['B']
for i in range(1, N):
for j in range(... | 16 | 21 | 355 | 486 | N = int(eval(input()))
S = list(str(eval(input())))
from collections import Counter
c = Counter(S)
ans = c["B"] * c["G"] * c["R"]
for i in range(N - 1):
for j in range(i, N):
if S[i] == S[j]:
continue
elif i + (j - i) * 2 > N - 1:
break
s = S[i + (j - i) * 2]
... | 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()))
S = list(eval(input()))
from collections import Counter
c = Counter(S)
ans = c["R"] * c["G"] * c["B"]
for i in range(1, N):
for j in ran... | false | 23.809524 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+sys.setrecursionlimit(10**9)",
"-S = list(str(eval(input())))",
"+S = list(eval(input()))",
"-ans = c[\"B\"] * c[\"... | false | 0.035475 | 0.034876 | 1.017185 | [
"s910211243",
"s415170036"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.