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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u600402037 | p03722 | python | s638795833 | s132353762 | 208 | 162 | 14,072 | 12,748 | Accepted | Accepted | 22.12 | # D - Score Attack
import sys
sys.setrecursionlimit(10 ** 9)
import numpy as np
from heapq import heappush, heappop
N, M, = list(map(int, input().split()))
graph = [[] for _ in range(N+1)] # graph[0]は使わない
for _ in range(M):
a, b, c = list(map(int, input().split()))
graph[a].append((b, c))
def ... | # D - Score Attack
import sys
sys.setrecursionlimit(10 ** 9)
import numpy as np
from heapq import heappush, heappop
N, M, = list(map(int, input().split()))
graph = [[] for _ in range(N+1)] # graph[0]は使わない
for _ in range(M):
a, b, c = list(map(int, input().split()))
graph[a].append((b, -c)) # ヒープ構... | 35 | 35 | 1,055 | 1,114 | # D - Score Attack
import sys
sys.setrecursionlimit(10**9)
import numpy as np
from heapq import heappush, heappop
(
N,
M,
) = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)] # graph[0]は使わない
for _ in range(M):
a, b, c = list(map(int, input().split()))
graph[a].append((b, c))
def d... | # D - Score Attack
import sys
sys.setrecursionlimit(10**9)
import numpy as np
from heapq import heappush, heappop
(
N,
M,
) = list(map(int, input().split()))
graph = [[] for _ in range(N + 1)] # graph[0]は使わない
for _ in range(M):
a, b, c = list(map(int, input().split()))
graph[a].append((b, -c)) # ヒープ... | false | 0 | [
"- graph[a].append((b, c))",
"+ graph[a].append((b, -c)) # ヒープ構造を使うため重みはマイナスの値",
"-def dijkstra(start, c):",
"+def dijkstra(start, co):",
"- dist = [-INF] * (N + 1) # dist[0]は使わない",
"+ dist = [INF] * (N + 1) # dist[0]は使わない",
"- que = [(start, 0, c)]",
"+ que = [(0, start, co)] # ... | false | 0.195498 | 0.227203 | 0.860457 | [
"s638795833",
"s132353762"
] |
u968166680 | p02820 | python | s820909801 | s682320478 | 117 | 85 | 85,460 | 79,388 | Accepted | Accepted | 27.35 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K = list(map(int, readline().split()))
R, S, P = list(map(int, readline().split()))
T = readline().strip()
T = [i... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K = list(map(int, readline().split()))
R, S, P = list(map(int, readline().split()))
T = readline().strip()
T = [i... | 35 | 35 | 796 | 703 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K = list(map(int, readline().split()))
R, S, P = list(map(int, readline().split()))
T = readline().strip()
T = [int(c) for c in T.t... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K = list(map(int, readline().split()))
R, S, P = list(map(int, readline().split()))
T = readline().strip()
T = [int(c) for c in T.t... | false | 0 | [
"- H = [R, S, P]",
"- dp = [[0] * 3 for _ in range(N + 1)]",
"- for i in range(N):",
"- com = T[i]",
"- for h in range(3):",
"- if i > K - 1:",
"- dp[i + 1][h] = max(",
"- dp[i + 1 - K][(h + 1) % 3], dp[i + 1 - K][(h + 2) % 3]",
"- ... | false | 0.034861 | 0.042067 | 0.828705 | [
"s820909801",
"s682320478"
] |
u174766008 | p02783 | python | s340989857 | s148577594 | 20 | 18 | 2,940 | 2,940 | Accepted | Accepted | 10 | h,a = list(map(int, input().split()))
i = 0
while i < 10**4:
i += 1
h = h - a
if h <= 0:
print(i)
break | h, a = list(map(int,input().split()))
print((h//a + (h%a!=0))) | 8 | 2 | 133 | 56 | h, a = list(map(int, input().split()))
i = 0
while i < 10**4:
i += 1
h = h - a
if h <= 0:
print(i)
break
| h, a = list(map(int, input().split()))
print((h // a + (h % a != 0)))
| false | 75 | [
"-i = 0",
"-while i < 10**4:",
"- i += 1",
"- h = h - a",
"- if h <= 0:",
"- print(i)",
"- break",
"+print((h // a + (h % a != 0)))"
] | false | 0.04375 | 0.041187 | 1.06223 | [
"s340989857",
"s148577594"
] |
u584083761 | p03163 | python | s483536431 | s644975984 | 1,934 | 727 | 319,940 | 173,704 | Accepted | Accepted | 62.41 | n,w=list(map(int, input().split()))
wv=[list(map(int, input().split())) for _ in range(n)]
dp = [[-float("inf") for _ in range(w+1)] for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
for j in range(w+1):
if j >= wv[i][0]:
dp[i + 1][j] = max(dp[i][j], dp[i][j - wv[i][0]] + wv[i][1])... | n,w=list(map(int, input().split()))
wv=[list(map(int, input().split())) for _ in range(n)]
dp = [[0 for _ in range(w+1)] for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
for j in range(w+1):
if j >= wv[i][0]:
dp[i + 1][j] = max(dp[i][j], dp[i][j - wv[i][0]] + wv[i][1])
el... | 15 | 14 | 395 | 391 | n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [[-float("inf") for _ in range(w + 1)] for _ in range(n + 1)]
dp[0][0] = 0
for i in range(n):
for j in range(w + 1):
if j >= wv[i][0]:
dp[i + 1][j] = max(dp[i][j], dp[i][j - wv[i][0]] + wv[i][1])... | n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]
dp[0][0] = 0
for i in range(n):
for j in range(w + 1):
if j >= wv[i][0]:
dp[i + 1][j] = max(dp[i][j], dp[i][j - wv[i][0]] + wv[i][1])
els... | false | 6.666667 | [
"-dp = [[-float(\"inf\") for _ in range(w + 1)] for _ in range(n + 1)]",
"+dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]",
"-print((max(dp[-1])))",
"+print((dp[-1][-1]))"
] | false | 0.037718 | 0.037538 | 1.00479 | [
"s483536431",
"s644975984"
] |
u072717685 | p03448 | python | s578953670 | s880265177 | 43 | 24 | 3,700 | 3,700 | Accepted | Accepted | 44.19 | import sys
input = sys.stdin.readline
from math import factorial
from itertools import combinations
from collections import Counter
from copy import deepcopy
from operator import mul
from functools import reduce
def main():
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
... | import sys
input = sys.stdin.readline
from math import factorial
from itertools import combinations
from collections import Counter
from copy import deepcopy
from operator import mul
from functools import reduce
def main():
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
... | 26 | 24 | 622 | 541 | import sys
input = sys.stdin.readline
from math import factorial
from itertools import combinations
from collections import Counter
from copy import deepcopy
from operator import mul
from functools import reduce
def main():
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(... | import sys
input = sys.stdin.readline
from math import factorial
from itertools import combinations
from collections import Counter
from copy import deepcopy
from operator import mul
from functools import reduce
def main():
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(... | false | 7.692308 | [
"- for ic in range(min(c + 1, (x - ia * 500 - ib * 100) // 50 + 1)):",
"- r += ia * 500 + ib * 100 + ic * 50 == x",
"+ r += (x - ia * 500 - ib * 100) // 50 <= c"
] | false | 0.038265 | 0.063413 | 0.603424 | [
"s578953670",
"s880265177"
] |
u094191970 | p03037 | python | s398490819 | s748459943 | 369 | 339 | 27,332 | 27,336 | Accepted | Accepted | 8.13 | n,m=list(map(int,input().split()))
ll=[list(map(int,input().split())) for i in range(m)]
a=0
b=n
for l,r in ll:
a=max(a,l)
b=min(b,r)
print((max(b-a+1,0))) | n,m=list(map(int,input().split()))
ll=[list(map(int,input().split())) for i in range(m)]
a=0
b=n
for l,r in ll:
if a<l:
a=l
if r<b:
b=r
print((max(b-a+1,0))) | 9 | 11 | 158 | 166 | n, m = list(map(int, input().split()))
ll = [list(map(int, input().split())) for i in range(m)]
a = 0
b = n
for l, r in ll:
a = max(a, l)
b = min(b, r)
print((max(b - a + 1, 0)))
| n, m = list(map(int, input().split()))
ll = [list(map(int, input().split())) for i in range(m)]
a = 0
b = n
for l, r in ll:
if a < l:
a = l
if r < b:
b = r
print((max(b - a + 1, 0)))
| false | 18.181818 | [
"- a = max(a, l)",
"- b = min(b, r)",
"+ if a < l:",
"+ a = l",
"+ if r < b:",
"+ b = r"
] | false | 0.047904 | 0.036608 | 1.308547 | [
"s398490819",
"s748459943"
] |
u225388820 | p02588 | python | s230230903 | s599946314 | 617 | 463 | 94,348 | 102,492 | Accepted | Accepted | 24.96 | class BIT:
def __init__(self, n):
#A1 ... AnのBIT(1-indexed)
self.BIT = [0] * (n + 1)
self.n = n
#A1 ~ Aiまでの和 O(logN)
def query(self, idx):
res_sum = 0
while idx > 0:
res_sum += self.BIT[idx]
idx -= idx & (-idx)
return res_s... | class BIT:
def __init__(self, n):
#A1 ... AnのBIT(1-indexed)
self.BIT = [0] * (n + 1)
self.n = n
#A1 ~ Aiまでの和 O(logN)
def query(self, idx):
res_sum = 0
while idx > 0:
res_sum += self.BIT[idx]
idx -= idx & (-idx)
return res_s... | 54 | 54 | 1,188 | 1,205 | class BIT:
def __init__(self, n):
# A1 ... AnのBIT(1-indexed)
self.BIT = [0] * (n + 1)
self.n = n
# A1 ~ Aiまでの和 O(logN)
def query(self, idx):
res_sum = 0
while idx > 0:
res_sum += self.BIT[idx]
idx -= idx & (-idx)
return res_sum
# ... | class BIT:
def __init__(self, n):
# A1 ... AnのBIT(1-indexed)
self.BIT = [0] * (n + 1)
self.n = n
# A1 ~ Aiまでの和 O(logN)
def query(self, idx):
res_sum = 0
while idx > 0:
res_sum += self.BIT[idx]
idx -= idx & (-idx)
return res_sum
# ... | false | 0 | [
"-p.sort()",
"+p.sort(key=lambda x: x[0])"
] | false | 0.041517 | 0.042482 | 0.977288 | [
"s230230903",
"s599946314"
] |
u644907318 | p03127 | python | s386344615 | s982185447 | 231 | 98 | 62,704 | 85,440 | Accepted | Accepted | 57.58 | def gcd(x,y):
while y>0:
x,y = y,x%y
return x
N = int(eval(input()))
A = list(map(int,input().split()))
a = A[0]
for i in range(1,N):
a = gcd(a,A[i])
print(a) | def gcd(x,y):
while y>0:
x,y = y,x%y
return x
N = int(eval(input()))
A = list(map(int,input().split()))
x = A[0]
for i in range(1,N):
x = gcd(x,A[i])
print(x) | 10 | 10 | 181 | 181 | def gcd(x, y):
while y > 0:
x, y = y, x % y
return x
N = int(eval(input()))
A = list(map(int, input().split()))
a = A[0]
for i in range(1, N):
a = gcd(a, A[i])
print(a)
| def gcd(x, y):
while y > 0:
x, y = y, x % y
return x
N = int(eval(input()))
A = list(map(int, input().split()))
x = A[0]
for i in range(1, N):
x = gcd(x, A[i])
print(x)
| false | 0 | [
"-a = A[0]",
"+x = A[0]",
"- a = gcd(a, A[i])",
"-print(a)",
"+ x = gcd(x, A[i])",
"+print(x)"
] | false | 0.046551 | 0.038171 | 1.21954 | [
"s386344615",
"s982185447"
] |
u002459665 | p02773 | python | s627104171 | s834580552 | 1,395 | 1,060 | 55,576 | 55,608 | Accepted | Accepted | 24.01 | N = int(eval(input()))
S = []
for i in range(N):
s = eval(input())
S.append(s)
from collections import Counter
c = Counter()
for si in S:
c[si] += 1
a = []
for k, v in list(c.items()):
a.append([v, k])
from operator import itemgetter
a.sort(key=itemgetter(1))
a.sort(key=itemgette... | N = int(eval(input()))
S = []
for i in range(N):
s = eval(input())
S.append(s)
from collections import Counter
c = Counter()
for si in S:
c[si] += 1
ca = []
for name, cnt in list(c.items()):
ca.append([name, cnt])
ca.sort(key=lambda x:x[0])
ca.sort(key=lambda x:x[1], reverse=True)
... | 25 | 23 | 387 | 386 | N = int(eval(input()))
S = []
for i in range(N):
s = eval(input())
S.append(s)
from collections import Counter
c = Counter()
for si in S:
c[si] += 1
a = []
for k, v in list(c.items()):
a.append([v, k])
from operator import itemgetter
a.sort(key=itemgetter(1))
a.sort(key=itemgetter(0), reverse=True)
fo... | N = int(eval(input()))
S = []
for i in range(N):
s = eval(input())
S.append(s)
from collections import Counter
c = Counter()
for si in S:
c[si] += 1
ca = []
for name, cnt in list(c.items()):
ca.append([name, cnt])
ca.sort(key=lambda x: x[0])
ca.sort(key=lambda x: x[1], reverse=True)
max_c = ca[0][1]
fo... | false | 8 | [
"-a = []",
"-for k, v in list(c.items()):",
"- a.append([v, k])",
"-from operator import itemgetter",
"-",
"-a.sort(key=itemgetter(1))",
"-a.sort(key=itemgetter(0), reverse=True)",
"-for ai in a:",
"- if ai[0] == a[0][0]:",
"- print((ai[1]))",
"+ca = []",
"+for name, cnt in list(c... | false | 0.040616 | 0.039982 | 1.015869 | [
"s627104171",
"s834580552"
] |
u873904588 | p02882 | python | s536056619 | s168910261 | 44 | 30 | 5,696 | 9,380 | Accepted | Accepted | 31.82 | import sys
from io import StringIO
import unittest
import math
def resolve():
a, b, x = list(map(int, input().split()))
tan_theta = 2*(b/a-x/math.pow(a, 3))
tan_theta2 = a * pow(b, 2) / (2 * x)
if math.pow(a, 3) / 2 * tan_theta < x:
theta = math.atan(tan_theta)
else:
... | # https://atcoder.jp/contests/abc144/tasks/abc144_d
import math
a, b, x = list(map(int, input().split()))
if a * a * b * (1/2) <= x:
tmp = 2 * (a*a*b-x) / (a*a*a)
print((math.degrees(math.atan(tmp))))
else:
tmp = a*b*b / (2*x)
print((math.degrees(math.atan(tmp))))
| 49 | 10 | 1,215 | 287 | import sys
from io import StringIO
import unittest
import math
def resolve():
a, b, x = list(map(int, input().split()))
tan_theta = 2 * (b / a - x / math.pow(a, 3))
tan_theta2 = a * pow(b, 2) / (2 * x)
if math.pow(a, 3) / 2 * tan_theta < x:
theta = math.atan(tan_theta)
else:
theta ... | # https://atcoder.jp/contests/abc144/tasks/abc144_d
import math
a, b, x = list(map(int, input().split()))
if a * a * b * (1 / 2) <= x:
tmp = 2 * (a * a * b - x) / (a * a * a)
print((math.degrees(math.atan(tmp))))
else:
tmp = a * b * b / (2 * x)
print((math.degrees(math.atan(tmp))))
| false | 79.591837 | [
"-import sys",
"-from io import StringIO",
"-import unittest",
"+# https://atcoder.jp/contests/abc144/tasks/abc144_d",
"-",
"-def resolve():",
"- a, b, x = list(map(int, input().split()))",
"- tan_theta = 2 * (b / a - x / math.pow(a, 3))",
"- tan_theta2 = a * pow(b, 2) / (2 * x)",
"- i... | false | 0.119232 | 0.037252 | 3.200674 | [
"s536056619",
"s168910261"
] |
u554096168 | p02936 | python | s574368599 | s298616921 | 1,763 | 1,210 | 238,808 | 72,132 | Accepted | Accepted | 31.37 | import sys
sys.setrecursionlimit(5 * 10**5)
input=sys.stdin.readline
N, Q = list(map(int, input().split()))
M = [[] for _ in range(N)]
for _ in range(N-1):
a, b = list(map(int, input().split()))
M[a-1].append(b-1)
M[b-1].append(a-1)
ans = [0] * N
for _ in range(Q):
p, x = list(map(in... | import sys
from collections import deque
sys.setrecursionlimit(5 * 10**5)
input=sys.stdin.readline
N, Q = list(map(int, input().split()))
M = [[] for _ in range(N)]
for _ in range(N-1):
a, b = list(map(int, input().split()))
M[a-1].append(b-1)
M[b-1].append(a-1)
ans = [0] * N
for _ in ran... | 28 | 30 | 589 | 592 | import sys
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
M = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
M[a - 1].append(b - 1)
M[b - 1].append(a - 1)
ans = [0] * N
for _ in range(Q):
p, x = list(map(int, inpu... | import sys
from collections import deque
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
M = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
M[a - 1].append(b - 1)
M[b - 1].append(a - 1)
ans = [0] * N
for _ in range(Q):... | false | 6.666667 | [
"+from collections import deque",
"-",
"-",
"-def setAnswer(parent, number):",
"- ans[number] += ans[parent]",
"- for i in M[number]:",
"- if i != parent:",
"- setAnswer(number, i)",
"-",
"-",
"-for i in M[0]:",
"- setAnswer(0, i)",
"+Q = deque([0])",
"+while Q:"... | false | 0.047961 | 0.006864 | 6.987029 | [
"s574368599",
"s298616921"
] |
u279493135 | p02735 | python | s277707865 | s841111382 | 343 | 60 | 63,980 | 5,444 | Accepted | Accepted | 82.51 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | 66 | 55 | 2,077 | 1,681 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | false | 16.666667 | [
"- elif s[i][j] == \"#\" and s[y][x] == \"#\":",
"+ else:",
"- elif s[i][j] == \".\" and s[y][x] == \".\":",
"- if cost[y][x] > cost[i][j]:",
"- cost[y][x] = cost[i][j]",
"- q.append((y, x))",
"- else: # # ... | false | 0.09286 | 0.058834 | 1.578349 | [
"s277707865",
"s841111382"
] |
u798803522 | p02368 | python | s995290020 | s461461949 | 2,230 | 1,050 | 22,132 | 21,992 | Accepted | Accepted | 52.91 | from collections import defaultdict
import sys
sys.setrecursionlimit(100000)
def counter():
cnt = 0
while True:
yield cnt
cnt += 1
def dfs(here, visited, track, count, connect):
visited |= {here}
for c in connect[here]:
if c not in visited:
dfs(c, visi... | from collections import defaultdict
import sys
sys.setrecursionlimit(100000)
def counter():
cnt = 0
while True:
yield cnt
cnt += 1
def dfs(here, visited, track, count, connect):
visited |= {here}
for c in connect[here]:
if c not in visited:
dfs(c, visi... | 55 | 54 | 1,525 | 1,450 | from collections import defaultdict
import sys
sys.setrecursionlimit(100000)
def counter():
cnt = 0
while True:
yield cnt
cnt += 1
def dfs(here, visited, track, count, connect):
visited |= {here}
for c in connect[here]:
if c not in visited:
dfs(c, visited, track,... | from collections import defaultdict
import sys
sys.setrecursionlimit(100000)
def counter():
cnt = 0
while True:
yield cnt
cnt += 1
def dfs(here, visited, track, count, connect):
visited |= {here}
for c in connect[here]:
if c not in visited:
dfs(c, visited, track,... | false | 1.818182 | [
"- track[here] = next(count)",
"+ track.append(here)",
"-track = [-1 for n in range(vertices)]",
"+track = []",
"-for v in range(vertices - 1, -1, -1):",
"- here = track.index(v)",
"+for here in track[::-1]:"
] | false | 0.037157 | 0.036477 | 1.018641 | [
"s995290020",
"s461461949"
] |
u546338822 | p03418 | python | s380019804 | s393310876 | 549 | 220 | 3,060 | 3,060 | Accepted | Accepted | 59.93 | n,k = list(map(int,input().split()))
def main():
ans = 0
if k!= 0:
for b in range(k+1,n+1):
for q in range((n-k)//b+1):
ans += min(b-k,n-b*q-k+1)
print(ans)
return
else:
print((n*n))
return
if __name__ == "__main__":
ma... | def main():
n,k = list(map(int,input().split()))
s = 0
if k==0:
s = n*n
else:
for k_ in range(k,n):
for q in range((n-k_)//(k_+1)+1):
if q==0:
s += n-k_
else:
s += (n-k_)//q-k_
print(s)
... | 16 | 16 | 316 | 365 | n, k = list(map(int, input().split()))
def main():
ans = 0
if k != 0:
for b in range(k + 1, n + 1):
for q in range((n - k) // b + 1):
ans += min(b - k, n - b * q - k + 1)
print(ans)
return
else:
print((n * n))
return
if __name__ == "__m... | def main():
n, k = list(map(int, input().split()))
s = 0
if k == 0:
s = n * n
else:
for k_ in range(k, n):
for q in range((n - k_) // (k_ + 1) + 1):
if q == 0:
s += n - k_
else:
s += (n - k_) // q - k_
... | false | 0 | [
"-n, k = list(map(int, input().split()))",
"-",
"-",
"- ans = 0",
"- if k != 0:",
"- for b in range(k + 1, n + 1):",
"- for q in range((n - k) // b + 1):",
"- ans += min(b - k, n - b * q - k + 1)",
"- print(ans)",
"- return",
"+ n, k = list... | false | 0.047869 | 0.043128 | 1.109921 | [
"s380019804",
"s393310876"
] |
u129978636 | p03447 | python | s335564304 | s126854526 | 19 | 17 | 2,940 | 3,064 | Accepted | Accepted | 10.53 | X = int( eval(input()))
A = int( eval(input()))
B = int( eval(input()))
X1 = X -A
Dcount = X1 // B
Dprice = B * Dcount
print((X1 - Dprice))
| X = int( eval(input()))
A = int( eval(input()))
B = int( eval(input()))
X1 = X -A
print((X1 % B))
| 11 | 6 | 134 | 84 | X = int(eval(input()))
A = int(eval(input()))
B = int(eval(input()))
X1 = X - A
Dcount = X1 // B
Dprice = B * Dcount
print((X1 - Dprice))
| X = int(eval(input()))
A = int(eval(input()))
B = int(eval(input()))
X1 = X - A
print((X1 % B))
| false | 45.454545 | [
"-Dcount = X1 // B",
"-Dprice = B * Dcount",
"-print((X1 - Dprice))",
"+print((X1 % B))"
] | false | 0.062674 | 0.04804 | 1.304611 | [
"s335564304",
"s126854526"
] |
u502312544 | p03129 | python | s960934779 | s781589273 | 30 | 27 | 9,152 | 9,064 | Accepted | Accepted | 10 | n,k = list(map(int, input().split()))
if n==1 or n==2:
if k==1:
print('YES')
else:
print('NO')
elif n%2==0:
cnt = n/2
if(cnt>=k):
print('YES')
else:
print('NO')
else:
cnt = n//2 + 1
if(cnt>=k):
print('YES')
else:
print('NO'... | n,k = list(map(int, input().split()))
x = (n+1)//2
bl = (x>=k)
ans = 'YES' if bl else 'NO'
print(ans) | 18 | 5 | 315 | 99 | n, k = list(map(int, input().split()))
if n == 1 or n == 2:
if k == 1:
print("YES")
else:
print("NO")
elif n % 2 == 0:
cnt = n / 2
if cnt >= k:
print("YES")
else:
print("NO")
else:
cnt = n // 2 + 1
if cnt >= k:
print("YES")
else:
print("NO"... | n, k = list(map(int, input().split()))
x = (n + 1) // 2
bl = x >= k
ans = "YES" if bl else "NO"
print(ans)
| false | 72.222222 | [
"-if n == 1 or n == 2:",
"- if k == 1:",
"- print(\"YES\")",
"- else:",
"- print(\"NO\")",
"-elif n % 2 == 0:",
"- cnt = n / 2",
"- if cnt >= k:",
"- print(\"YES\")",
"- else:",
"- print(\"NO\")",
"-else:",
"- cnt = n // 2 + 1",
"- if cnt >=... | false | 0.032381 | 0.033044 | 0.979928 | [
"s960934779",
"s781589273"
] |
u690536347 | p04035 | python | s101896353 | s154609759 | 133 | 100 | 14,528 | 14,076 | Accepted | Accepted | 24.81 | from itertools import accumulate as ac
n,l=list(map(int,input().split()))
*a,=list(map(int,input().split()))
v=[]
for i in range(n-1):
if a[i]+a[i+1]>=l:
v.append(i+1)
break
else:
print("Impossible")
if v:
st=v[0]
v+=list(range(1,st)[::-1])
v+=list(range(st+1,n))
print("Possible"... | n,l=map(int,input().split())
*a,=map(int,input().split())
v=[0]
for i in range(n-1):
if a[i]+a[i+1]>=l:
v[0]=i+1
v+=list(range(1,i+1)[::-1])
v+=list(range(i+2,n))
print("Possible")
print(*v[::-1],sep="\n")
break
else:
print("Impossible")
| 20 | 14 | 344 | 279 | from itertools import accumulate as ac
n, l = list(map(int, input().split()))
(*a,) = list(map(int, input().split()))
v = []
for i in range(n - 1):
if a[i] + a[i + 1] >= l:
v.append(i + 1)
break
else:
print("Impossible")
if v:
st = v[0]
v += list(range(1, st)[::-1])
v += list(range(... | n, l = map(int, input().split())
(*a,) = map(int, input().split())
v = [0]
for i in range(n - 1):
if a[i] + a[i + 1] >= l:
v[0] = i + 1
v += list(range(1, i + 1)[::-1])
v += list(range(i + 2, n))
print("Possible")
print(*v[::-1], sep="\n")
break
else:
print("Impos... | false | 30 | [
"-from itertools import accumulate as ac",
"-",
"-n, l = list(map(int, input().split()))",
"-(*a,) = list(map(int, input().split()))",
"-v = []",
"+n, l = map(int, input().split())",
"+(*a,) = map(int, input().split())",
"+v = [0]",
"- v.append(i + 1)",
"+ v[0] = i + 1",
"+ ... | false | 0.098082 | 0.085848 | 1.142514 | [
"s101896353",
"s154609759"
] |
u079022693 | p03032 | python | s109577212 | s666424804 | 37 | 32 | 3,188 | 3,064 | Accepted | Accepted | 13.51 | def main():
N,K=list(map(int,input().split()))
V=list(map(int,input().split()))
M=min(N,K)
result=0
for l in range(M+1):
for r in range(M+1-l):
L=l
R=r
count=0
minus=[]
m=l+r
while L>0:
a=V[L... | from sys import stdin
import heapq
def main():
#入力
readline=stdin.readline
n,k=list(map(int,readline().split()))
v=list(map(int,readline().split()))
v_rev=list(reversed(v))
m=min(n,k)
ans=0
for l in range(m+1):
for r in range(m+1):
if l+r>m:
... | 40 | 43 | 988 | 937 | def main():
N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
M = min(N, K)
result = 0
for l in range(M + 1):
for r in range(M + 1 - l):
L = l
R = r
count = 0
minus = []
m = l + r
while L > 0:
... | from sys import stdin
import heapq
def main():
# 入力
readline = stdin.readline
n, k = list(map(int, readline().split()))
v = list(map(int, readline().split()))
v_rev = list(reversed(v))
m = min(n, k)
ans = 0
for l in range(m + 1):
for r in range(m + 1):
if l + r > m:... | false | 6.976744 | [
"+from sys import stdin",
"+import heapq",
"+",
"+",
"- N, K = list(map(int, input().split()))",
"- V = list(map(int, input().split()))",
"- M = min(N, K)",
"- result = 0",
"- for l in range(M + 1):",
"- for r in range(M + 1 - l):",
"- L = l",
"- R =... | false | 0.036736 | 0.037173 | 0.988245 | [
"s109577212",
"s666424804"
] |
u401452016 | p03371 | python | s224193275 | s455577799 | 97 | 88 | 3,060 | 3,060 | Accepted | Accepted | 9.28 | #ABC095C 全列挙
def main():
import sys, math
A,B,C,X,Y = list(map(int, sys.stdin.readline().split()))
ans = float('inf')
for i in range(10**5+1):
tmp = i*2*C + max(0, (X-i)*A) + max(0, (Y-i)*B)
ans = min(tmp, ans)
if i > X and i > Y:
break
print(ans)
i... | #ABC095C
def main():
import sys
A,B,C,X,Y = list(map(int, sys.stdin.readline().split()))
# cをi枚とする
ans = -1
for i in range(0, 2*10**5+1, 2):
tmp = max((X-i//2)*A, 0) + i*C + max((Y-i//2)*B, 0)
if ans ==-1 or ans > tmp:
ans = tmp
print(ans)
... | 14 | 16 | 350 | 351 | # ABC095C 全列挙
def main():
import sys, math
A, B, C, X, Y = list(map(int, sys.stdin.readline().split()))
ans = float("inf")
for i in range(10**5 + 1):
tmp = i * 2 * C + max(0, (X - i) * A) + max(0, (Y - i) * B)
ans = min(tmp, ans)
if i > X and i > Y:
break
print(a... | # ABC095C
def main():
import sys
A, B, C, X, Y = list(map(int, sys.stdin.readline().split()))
# cをi枚とする
ans = -1
for i in range(0, 2 * 10**5 + 1, 2):
tmp = max((X - i // 2) * A, 0) + i * C + max((Y - i // 2) * B, 0)
if ans == -1 or ans > tmp:
ans = tmp
print(ans)
i... | false | 12.5 | [
"-# ABC095C 全列挙",
"+# ABC095C",
"- import sys, math",
"+ import sys",
"- ans = float(\"inf\")",
"- for i in range(10**5 + 1):",
"- tmp = i * 2 * C + max(0, (X - i) * A) + max(0, (Y - i) * B)",
"- ans = min(tmp, ans)",
"- if i > X and i > Y:",
"- break",
... | false | 0.049841 | 0.117752 | 0.423269 | [
"s224193275",
"s455577799"
] |
u906501980 | p02697 | python | s368891676 | s458644321 | 90 | 74 | 69,588 | 9,280 | Accepted | Accepted | 17.78 | def main():
n, m = list(map(int, input().split()))
if n & 1:
for i in range(m):
print((i+1, n-i))
else:
i = 0
flag = False
for i in range(m):
if n-2*i-1 > n//2:
print((i+1, n-i))
else:
print((i+1,... | def main():
n, m = list(map(int, input().split()))
if n%2:
for i in range(m):
print((i+1, n-i))
else:
for i in range(m):
if n-2*i-1 > n//2:
print((i+1, n-i))
else:
print((i+1, n-i-1))
if __name__ == "__main__":
... | 16 | 14 | 358 | 319 | def main():
n, m = list(map(int, input().split()))
if n & 1:
for i in range(m):
print((i + 1, n - i))
else:
i = 0
flag = False
for i in range(m):
if n - 2 * i - 1 > n // 2:
print((i + 1, n - i))
else:
print((... | def main():
n, m = list(map(int, input().split()))
if n % 2:
for i in range(m):
print((i + 1, n - i))
else:
for i in range(m):
if n - 2 * i - 1 > n // 2:
print((i + 1, n - i))
else:
print((i + 1, n - i - 1))
if __name__ ==... | false | 12.5 | [
"- if n & 1:",
"+ if n % 2:",
"- i = 0",
"- flag = False"
] | false | 0.041814 | 0.042493 | 0.984017 | [
"s368891676",
"s458644321"
] |
u018679195 | p02693 | python | s554481748 | s918461142 | 45 | 22 | 61,804 | 8,916 | Accepted | Accepted | 51.11 | k = int(eval(input()))
a, b = list(map(int, input().split()))
for i in range(a, b + 1):
if i % k == 0:
print('OK')
exit()
print('NG') | K = int(eval(input()))
s = eval(input())
A = int(s.split(" ")[0])
B = int(s.split(" ")[1])
i = 1
mul = 1
while mul <= B:
mul = i * K
if A <= mul <= B:
print("OK")
break
i = i + 1
else :
print("NG") | 7 | 14 | 147 | 230 | k = int(eval(input()))
a, b = list(map(int, input().split()))
for i in range(a, b + 1):
if i % k == 0:
print("OK")
exit()
print("NG")
| K = int(eval(input()))
s = eval(input())
A = int(s.split(" ")[0])
B = int(s.split(" ")[1])
i = 1
mul = 1
while mul <= B:
mul = i * K
if A <= mul <= B:
print("OK")
break
i = i + 1
else:
print("NG")
| false | 50 | [
"-k = int(eval(input()))",
"-a, b = list(map(int, input().split()))",
"-for i in range(a, b + 1):",
"- if i % k == 0:",
"+K = int(eval(input()))",
"+s = eval(input())",
"+A = int(s.split(\" \")[0])",
"+B = int(s.split(\" \")[1])",
"+i = 1",
"+mul = 1",
"+while mul <= B:",
"+ mul = i * K"... | false | 0.046112 | 0.008868 | 5.200079 | [
"s554481748",
"s918461142"
] |
u360116509 | p03164 | python | s316450530 | s793718898 | 851 | 418 | 299,184 | 89,292 | Accepted | Accepted | 50.88 | def main():
N, W = list(map(int, input().split()))
Ws = []
Vs = []
for _ in range(N):
w, v = list(map(int, input().split()))
Ws.append(w)
Vs.append(v)
mv = sum(Vs)
dp = [[float('INF')] * (mv + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
... | def main():
N, W = list(map(int, input().split()))
MV = 10**5
dp = [float('INF')] * (MV + 1)
dp[0] = 0
for _ in range(N):
w, v = list(map(int, input().split()))
for i in range(MV, -1, -1):
if v > i:
tmp = w
else:
tmp ... | 24 | 23 | 611 | 519 | def main():
N, W = list(map(int, input().split()))
Ws = []
Vs = []
for _ in range(N):
w, v = list(map(int, input().split()))
Ws.append(w)
Vs.append(v)
mv = sum(Vs)
dp = [[float("INF")] * (mv + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for j... | def main():
N, W = list(map(int, input().split()))
MV = 10**5
dp = [float("INF")] * (MV + 1)
dp[0] = 0
for _ in range(N):
w, v = list(map(int, input().split()))
for i in range(MV, -1, -1):
if v > i:
tmp = w
else:
tmp = dp[i - v]... | false | 4.166667 | [
"- Ws = []",
"- Vs = []",
"+ MV = 10**5",
"+ dp = [float(\"INF\")] * (MV + 1)",
"+ dp[0] = 0",
"- Ws.append(w)",
"- Vs.append(v)",
"- mv = sum(Vs)",
"- dp = [[float(\"INF\")] * (mv + 1) for _ in range(N + 1)]",
"- dp[0][0] = 0",
"- for i in range(N):",
... | false | 0.039834 | 0.211071 | 0.188724 | [
"s316450530",
"s793718898"
] |
u312025627 | p03371 | python | s835292773 | s886224622 | 181 | 166 | 38,384 | 38,384 | Accepted | Accepted | 8.29 | def main():
A, B, C, X, Y = (int(i) for i in input().split())
ans1 = A * X + B * Y
ans2 = 0
ans3 = 0
if X < Y:
ans2 += 2 * C * X
ans2 += B * (Y-X)
ans3 += 2 * C * Y
else:
ans2 += 2 * C * Y
ans2 += A * (X-Y)
ans3 += 2 * C * X
prin... | def main():
a, b, c, x, y = (int(i) for i in input().split())
ans = 0
if x > y:
p = (x - y)*a
elif y > x:
p = (y - x)*b
else:
p = 0
print((min(a*x + b*y, 2*c*max(x, y), 2*c*min(x, y) + p)))
if __name__ == '__main__':
main()
| 18 | 14 | 384 | 289 | def main():
A, B, C, X, Y = (int(i) for i in input().split())
ans1 = A * X + B * Y
ans2 = 0
ans3 = 0
if X < Y:
ans2 += 2 * C * X
ans2 += B * (Y - X)
ans3 += 2 * C * Y
else:
ans2 += 2 * C * Y
ans2 += A * (X - Y)
ans3 += 2 * C * X
print((min(ans1... | def main():
a, b, c, x, y = (int(i) for i in input().split())
ans = 0
if x > y:
p = (x - y) * a
elif y > x:
p = (y - x) * b
else:
p = 0
print((min(a * x + b * y, 2 * c * max(x, y), 2 * c * min(x, y) + p)))
if __name__ == "__main__":
main()
| false | 22.222222 | [
"- A, B, C, X, Y = (int(i) for i in input().split())",
"- ans1 = A * X + B * Y",
"- ans2 = 0",
"- ans3 = 0",
"- if X < Y:",
"- ans2 += 2 * C * X",
"- ans2 += B * (Y - X)",
"- ans3 += 2 * C * Y",
"+ a, b, c, x, y = (int(i) for i in input().split())",
"+ ans... | false | 0.036827 | 0.03393 | 1.085378 | [
"s835292773",
"s886224622"
] |
u661290476 | p00009 | python | s753935851 | s941163823 | 850 | 750 | 54,456 | 31,900 | Accepted | Accepted | 11.76 | prime=[True]*1000000
np=[0]*1000000
for i in range(2,1000000):
if prime[i]:
for j in range(i*2,1000000,i):
prime[j]=False
np[i]=np[i-1]+prime[i]
while True:
try:
n=int(eval(input()))
except:
break
print((np[n])) | prime=[True]*1000000
np=[0]*1000000
for i in range(2,1000):
if prime[i]:
for j in range(i*2,1000000,i):
prime[j]=False
while True:
try:
n=int(eval(input()))
except:
break
print((sum(prime[2:n+1]))) | 14 | 13 | 273 | 254 | prime = [True] * 1000000
np = [0] * 1000000
for i in range(2, 1000000):
if prime[i]:
for j in range(i * 2, 1000000, i):
prime[j] = False
np[i] = np[i - 1] + prime[i]
while True:
try:
n = int(eval(input()))
except:
break
print((np[n]))
| prime = [True] * 1000000
np = [0] * 1000000
for i in range(2, 1000):
if prime[i]:
for j in range(i * 2, 1000000, i):
prime[j] = False
while True:
try:
n = int(eval(input()))
except:
break
print((sum(prime[2 : n + 1])))
| false | 7.142857 | [
"-for i in range(2, 1000000):",
"+for i in range(2, 1000):",
"- np[i] = np[i - 1] + prime[i]",
"- print((np[n]))",
"+ print((sum(prime[2 : n + 1])))"
] | false | 1.561773 | 0.402627 | 3.878958 | [
"s753935851",
"s941163823"
] |
u554781254 | p02713 | python | s733596430 | s700335715 | 1,980 | 1,270 | 9,580 | 9,580 | Accepted | Accepted | 35.86 | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
from math import gcd
INF = float('inf')
NIL = - 1
n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
for j in range(1,... | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
from math import gcd
INF = float('inf')
NIL = - 1
N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
if i == 1:
a... | 21 | 28 | 412 | 548 | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
from math import gcd
INF = float("inf")
NIL = -1
n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
for ... | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
from math import gcd
INF = float("inf")
NIL = -1
N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
if i == 1:
ans += N**2
... | false | 25 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-for i in range(1, n + 1):",
"- for j in range(1, n + 1):",
"- for k in range(1, n + 1):",
"- ans += gcd(gcd(i, j), k)",
"+for i in range(1, N + 1):",
"+ if i == 1:",
"+ ans += N**2",
"+ continue",
"+ ... | false | 0.197591 | 0.047595 | 4.15154 | [
"s733596430",
"s700335715"
] |
u973108807 | p03416 | python | s476079877 | s003799805 | 64 | 51 | 2,940 | 2,940 | Accepted | Accepted | 20.31 | a,b = list(map(int,input().split()))
ans = 0
for i in range(a,b+1):
if str(i) == str(i)[::-1]:
ans += 1
print(ans) | a,b = list(map(int,input().split()))
ans = 0
for i in range(a,b+1):
s = str(i)
if s == s[::-1]:
ans += 1
print(ans) | 6 | 7 | 119 | 123 | a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
if str(i) == str(i)[::-1]:
ans += 1
print(ans)
| a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
s = str(i)
if s == s[::-1]:
ans += 1
print(ans)
| false | 14.285714 | [
"- if str(i) == str(i)[::-1]:",
"+ s = str(i)",
"+ if s == s[::-1]:"
] | false | 0.055792 | 0.063218 | 0.882535 | [
"s476079877",
"s003799805"
] |
u805852597 | p02658 | python | s866269497 | s606700388 | 80 | 49 | 21,480 | 21,656 | Accepted | Accepted | 38.75 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
for num in sorted(a):
ans *= num
if ans > 10**18:
print("-1")
exit()
print(ans) | def main ():
N = int(eval(input()))
A = list(map(int,input(). split ()))
if 0 in A:
print((0))
return
prod = 1
for a in A:
prod *= a
if prod > 1000000000000000000:
print((-1))
return
print(prod)
main () | 9 | 16 | 166 | 297 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
for num in sorted(a):
ans *= num
if ans > 10**18:
print("-1")
exit()
print(ans)
| def main():
N = int(eval(input()))
A = list(map(int, input().split()))
if 0 in A:
print((0))
return
prod = 1
for a in A:
prod *= a
if prod > 1000000000000000000:
print((-1))
return
print(prod)
main()
| false | 43.75 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-ans = 1",
"-for num in sorted(a):",
"- ans *= num",
"- if ans > 10**18:",
"- print(\"-1\")",
"- exit()",
"-print(ans)",
"+def main():",
"+ N = int(eval(input()))",
"+ A = list(map(int, input().split(... | false | 0.088942 | 0.089059 | 0.998677 | [
"s866269497",
"s606700388"
] |
u312025627 | p03700 | python | s519284327 | s388600360 | 632 | 429 | 122,840 | 94,948 | Accepted | Accepted | 32.12 | def main():
N, A, B = (int(i) for i in input().split())
H = [int(eval(input())) for i in range(N)]
def is_ok(H, mid):
H = [h - mid*B for h in H]
need = 0
for h in H:
if h > 0:
need += (h + (A - B) - 1)//(A - B)
if need <= mid:
... | def main():
import sys
input = sys.stdin.buffer.readline
N, A, B = (int(i) for i in input().split())
H = [int(eval(input())) for i in range(N)]
def is_ok(x):
need = 0
cur = [0]*N
for i, h in enumerate(H):
cur.append(max(0, h - B*x))
for i, less... | 31 | 34 | 730 | 813 | def main():
N, A, B = (int(i) for i in input().split())
H = [int(eval(input())) for i in range(N)]
def is_ok(H, mid):
H = [h - mid * B for h in H]
need = 0
for h in H:
if h > 0:
need += (h + (A - B) - 1) // (A - B)
if need <= mid:
retu... | def main():
import sys
input = sys.stdin.buffer.readline
N, A, B = (int(i) for i in input().split())
H = [int(eval(input())) for i in range(N)]
def is_ok(x):
need = 0
cur = [0] * N
for i, h in enumerate(H):
cur.append(max(0, h - B * x))
for i, less in en... | false | 8.823529 | [
"+ import sys",
"+",
"+ input = sys.stdin.buffer.readline",
"- def is_ok(H, mid):",
"- H = [h - mid * B for h in H]",
"+ def is_ok(x):",
"- for h in H:",
"- if h > 0:",
"- need += (h + (A - B) - 1) // (A - B)",
"- if need <= mid:",
"+ ... | false | 0.03732 | 0.036146 | 1.032484 | [
"s519284327",
"s388600360"
] |
u214617707 | p03546 | python | s649277548 | s571779114 | 55 | 47 | 3,444 | 3,444 | Accepted | Accepted | 14.55 | H, W = list(map(int, input().split()))
c = [[0]*10 for i in range(10)]
for i in range(10):
a = list(map(int, input().split()))
for j in range(10):
c[i][j] = a[j]
A = [[0]*W for i in range(H)]
for i in range(H):
a = list(map(int, input().split()))
for j in range(W):
A[i][j] ... | H, W = list(map(int, input().split()))
c = [[0]*10 for i in range(10)]
for i in range(10):
a = list(map(int, input().split()))
for j in range(10):
c[i][j] = a[j]
A = [[0]*W for i in range(H)]
for i in range(H):
a = list(map(int, input().split()))
for j in range(W):
A[i][j... | 27 | 28 | 664 | 647 | H, W = list(map(int, input().split()))
c = [[0] * 10 for i in range(10)]
for i in range(10):
a = list(map(int, input().split()))
for j in range(10):
c[i][j] = a[j]
A = [[0] * W for i in range(H)]
for i in range(H):
a = list(map(int, input().split()))
for j in range(W):
A[i][j] = a[j]
for... | H, W = list(map(int, input().split()))
c = [[0] * 10 for i in range(10)]
for i in range(10):
a = list(map(int, input().split()))
for j in range(10):
c[i][j] = a[j]
A = [[0] * W for i in range(H)]
for i in range(H):
a = list(map(int, input().split()))
for j in range(W):
A[i][j] = a[j]
for... | false | 3.571429 | [
"- for k in range(10):",
"- if i != j:",
"- c[i][j] = min(c[i][j], c[i][k] + c[k][j])",
"+ if i != j:",
"+ c[i][j] = min(c[i][j], c[i][k] + c[k][j])"
] | false | 0.113797 | 0.037221 | 3.057359 | [
"s649277548",
"s571779114"
] |
u520158330 | p03601 | python | s754408493 | s639780933 | 170 | 153 | 5,332 | 5,792 | Accepted | Accepted | 10 | A,B,C,D,E,F = list(map(int,input().split()))
water_sugar = []
sugar_best = []
for a in range(0,31):
water = A*a
sugar = E*water
if water==0:
pass
elif (water*100)>F:
break
elif (water*100)+sugar>F:
water_sugar.append([water*100,F-(water*100)])
elif (water*... | A,B,C,D,E,F = list(map(int,input().split()))
water_sugar = []
sugar_best = []
s = 0
max_sugar = 0
for a in range(0,31):
water = A*a
sugar = E*water
if water==0:
pass
elif (water*100)>F:
break
elif (water*100)+sugar>F:
s = F-(water*100)
water_sugar.ap... | 50 | 66 | 1,194 | 1,426 | A, B, C, D, E, F = list(map(int, input().split()))
water_sugar = []
sugar_best = []
for a in range(0, 31):
water = A * a
sugar = E * water
if water == 0:
pass
elif (water * 100) > F:
break
elif (water * 100) + sugar > F:
water_sugar.append([water * 100, F - (water * 100)])
... | A, B, C, D, E, F = list(map(int, input().split()))
water_sugar = []
sugar_best = []
s = 0
max_sugar = 0
for a in range(0, 31):
water = A * a
sugar = E * water
if water == 0:
pass
elif (water * 100) > F:
break
elif (water * 100) + sugar > F:
s = F - (water * 100)
water... | false | 24.242424 | [
"+s = 0",
"+max_sugar = 0",
"- water_sugar.append([water * 100, F - (water * 100)])",
"+ s = F - (water * 100)",
"+ water_sugar.append([water * 100, s])",
"- water_sugar.append([water * 100, sugar])",
"+ s = sugar",
"+ water_sugar.append([water * 100, s])",
... | false | 0.046311 | 0.048587 | 0.953157 | [
"s754408493",
"s639780933"
] |
u497235501 | p03013 | python | s497432326 | s898579870 | 179 | 62 | 84,248 | 14,180 | Accepted | Accepted | 65.36 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 1000000007
a=open(0)
N,_,*a = list(map(int, a.read().split()))
dp = [-1 for _ in range(100010)]
dp[0] = 0
for i in a: dp[i] = 0
def rec(i):
if dp[i] > -1:
return dp[i]
if i<3:
dp[i] = rec(i-1) + 1
r... | MOD=10**9+7
N,_,*a = list(map(int, open(0).read().split()))
A=set(a)
dp = [0 for _ in range(N+1)]
dp[:2] = 1, 0 if 1 in A else 1
for i in range(2,N+1):
if i not in A:
dp[i]=(dp[i-1]+dp[i-2])%MOD
print((dp[N]))
| 26 | 13 | 410 | 234 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 1000000007
a = open(0)
N, _, *a = list(map(int, a.read().split()))
dp = [-1 for _ in range(100010)]
dp[0] = 0
for i in a:
dp[i] = 0
def rec(i):
if dp[i] > -1:
return dp[i]
if i < 3:
dp[i] = rec(i - 1) + 1
return... | MOD = 10**9 + 7
N, _, *a = list(map(int, open(0).read().split()))
A = set(a)
dp = [0 for _ in range(N + 1)]
dp[:2] = 1, 0 if 1 in A else 1
for i in range(2, N + 1):
if i not in A:
dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
print((dp[N]))
| false | 50 | [
"-import sys",
"-",
"-sys.setrecursionlimit(2147483647)",
"-INF = float(\"inf\")",
"-MOD = 1000000007",
"-a = open(0)",
"-N, _, *a = list(map(int, a.read().split()))",
"-dp = [-1 for _ in range(100010)]",
"-dp[0] = 0",
"-for i in a:",
"- dp[i] = 0",
"-",
"-",
"-def rec(i):",
"- if ... | false | 0.056547 | 0.110701 | 0.510811 | [
"s497432326",
"s898579870"
] |
u227082700 | p03957 | python | s408000671 | s866012031 | 20 | 17 | 2,940 | 3,060 | Accepted | Accepted | 15 | s=eval(input())
if "C"in s and "F"in s:
if s.find("C")<s.rfind("F"):print("Yes")
else:print("No")
else:print("No") | s=eval(input())
if "C"not in s:print("No")
elif s.find("C",0)<s.find("F",s.find("C",0)+1):print("Yes")
else:print("No") | 5 | 4 | 116 | 116 | s = eval(input())
if "C" in s and "F" in s:
if s.find("C") < s.rfind("F"):
print("Yes")
else:
print("No")
else:
print("No")
| s = eval(input())
if "C" not in s:
print("No")
elif s.find("C", 0) < s.find("F", s.find("C", 0) + 1):
print("Yes")
else:
print("No")
| false | 20 | [
"-if \"C\" in s and \"F\" in s:",
"- if s.find(\"C\") < s.rfind(\"F\"):",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"+if \"C\" not in s:",
"+ print(\"No\")",
"+elif s.find(\"C\", 0) < s.find(\"F\", s.find(\"C\", 0) + 1):",
"+ print(\"Yes\")"
] | false | 0.052245 | 0.071722 | 0.728428 | [
"s408000671",
"s866012031"
] |
u699089116 | p02612 | python | s637198143 | s421538728 | 69 | 27 | 61,668 | 9,152 | Accepted | Accepted | 60.87 | n = int(eval(input()))
for i in range(1, 11):
if n <= i * 1000:
print((i * 1000 - n))
exit() | n = int(eval(input()))
print((0 if n % 1000 == 0 else 1000 - n % 1000)) | 6 | 3 | 110 | 66 | n = int(eval(input()))
for i in range(1, 11):
if n <= i * 1000:
print((i * 1000 - n))
exit()
| n = int(eval(input()))
print((0 if n % 1000 == 0 else 1000 - n % 1000))
| false | 50 | [
"-for i in range(1, 11):",
"- if n <= i * 1000:",
"- print((i * 1000 - n))",
"- exit()",
"+print((0 if n % 1000 == 0 else 1000 - n % 1000))"
] | false | 0.040038 | 0.039482 | 1.014074 | [
"s637198143",
"s421538728"
] |
u250583425 | p03329 | python | s424338086 | s313856513 | 700 | 200 | 85,852 | 41,968 | Accepted | Accepted | 71.43 | import sys
sys.setrecursionlimit(10 ** 9)
from functools import lru_cache
def input(): return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
yen = [6 ** i for i in range(1, 7)]
yen += [9 ** i for i in range(1, 6)]
yen = [i for i in yen if i <= N]
yen.sort(reverse=True)
... | import sys
def input(): return sys.stdin.readline().rstrip()
def MIN(a, b):
if a > b:
return b
else:
return a
def main():
N = int(eval(input()))
yen6 = [6 ** i for i in range(1, 7) if 6 ** i <= N]
yen9 = [9 ** i for i in range(1, 6) if 9 ** i <= N]
if N < 6:
... | 35 | 34 | 796 | 746 | import sys
sys.setrecursionlimit(10**9)
from functools import lru_cache
def input():
return sys.stdin.readline().rstrip()
def main():
N = int(eval(input()))
yen = [6**i for i in range(1, 7)]
yen += [9**i for i in range(1, 6)]
yen = [i for i in yen if i <= N]
yen.sort(reverse=True)
def ... | import sys
def input():
return sys.stdin.readline().rstrip()
def MIN(a, b):
if a > b:
return b
else:
return a
def main():
N = int(eval(input()))
yen6 = [6**i for i in range(1, 7) if 6**i <= N]
yen9 = [9**i for i in range(1, 6) if 9**i <= N]
if N < 6:
print(N)
... | false | 2.857143 | [
"-",
"-sys.setrecursionlimit(10**9)",
"-from functools import lru_cache",
"+def MIN(a, b):",
"+ if a > b:",
"+ return b",
"+ else:",
"+ return a",
"+",
"+",
"- yen = [6**i for i in range(1, 7)]",
"- yen += [9**i for i in range(1, 6)]",
"- yen = [i for i in yen if... | false | 0.107154 | 0.097809 | 1.095548 | [
"s424338086",
"s313856513"
] |
u193806284 | p03419 | python | s888605241 | s587764433 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 |
def calc0(N, M):
cell = [[0 for i in range(M)] for j in range(N)]
for i in range(M):
for j in range(N):
for y in range(-1, 2):
for x in range(-1, 2):
xx = i + x
yy = j + y
if 0 <= xx < M and 0 <= yy < N:
... | def calc(N, M):
if N == 1 and M == 1:
return 1
if N == 1:
return M - 2
if M == 1:
return N - 2
# N >= 2 and M >= 2:
return (N - 2) * (M - 2)
N, M = [int(_) for _ in input().split()]
print((calc(N, M)))
| 31 | 13 | 742 | 258 | def calc0(N, M):
cell = [[0 for i in range(M)] for j in range(N)]
for i in range(M):
for j in range(N):
for y in range(-1, 2):
for x in range(-1, 2):
xx = i + x
yy = j + y
if 0 <= xx < M and 0 <= yy < N:
... | def calc(N, M):
if N == 1 and M == 1:
return 1
if N == 1:
return M - 2
if M == 1:
return N - 2
# N >= 2 and M >= 2:
return (N - 2) * (M - 2)
N, M = [int(_) for _ in input().split()]
print((calc(N, M)))
| false | 58.064516 | [
"-def calc0(N, M):",
"- cell = [[0 for i in range(M)] for j in range(N)]",
"- for i in range(M):",
"- for j in range(N):",
"- for y in range(-1, 2):",
"- for x in range(-1, 2):",
"- xx = i + x",
"- yy = j + y",
"- ... | false | 0.040336 | 0.044924 | 0.897859 | [
"s888605241",
"s587764433"
] |
u350248178 | p03253 | python | s891305869 | s942272536 | 1,948 | 44 | 114,140 | 6,900 | Accepted | Accepted | 97.74 | n,m=list(map(int,input().split()))
def c(n,m):
import math
if n-m<0:
return 0
return(math.factorial(n)//math.factorial(n-m)//math.factorial(m))
def factorize(n):
fct=[]
b,e=2,0
while b*b<=n:
while n%b==0:
n=n//b
e=e+1
if e>0:
... | n,m=list(map(int,input().split()))
def factorize(n):
fct=[]
b,e=2,0
while b*b<=n:
while n%b==0:
n=n//b
e=e+1
if e>0:
fct.append((b,e))
b,e=b+1,0
if n>1:
fct.append((n,1))
return fct
l=factorize(m)
mod=10**9+7
ans... | 30 | 42 | 519 | 676 | n, m = list(map(int, input().split()))
def c(n, m):
import math
if n - m < 0:
return 0
return math.factorial(n) // math.factorial(n - m) // math.factorial(m)
def factorize(n):
fct = []
b, e = 2, 0
while b * b <= n:
while n % b == 0:
n = n // b
e = e +... | n, m = list(map(int, input().split()))
def factorize(n):
fct = []
b, e = 2, 0
while b * b <= n:
while n % b == 0:
n = n // b
e = e + 1
if e > 0:
fct.append((b, e))
b, e = b + 1, 0
if n > 1:
fct.append((n, 1))
return fct
l = fact... | false | 28.571429 | [
"-",
"-",
"-def c(n, m):",
"- import math",
"-",
"- if n - m < 0:",
"- return 0",
"- return math.factorial(n) // math.factorial(n - m) // math.factorial(m)",
"+",
"+",
"+def inv(x):",
"+ return pow(x, mod - 2, mod)",
"+",
"+",
"+cms = 10**5 + 100",
"+cm = [0] * cms",... | false | 0.366798 | 0.082603 | 4.44049 | [
"s891305869",
"s942272536"
] |
u367965715 | p02803 | python | s810169359 | s375901539 | 1,446 | 264 | 21,232 | 20,516 | Accepted | Accepted | 81.74 | import numpy as np
from collections import deque
from itertools import product
H, W = list(map(int, input().split()))
S = np.full((H, W), 'x', dtype='U1')
for i in range(H):
S[i] = list(eval(input()))
def bfs(x, y):
dist = np.full((H, W), -1, dtype='i8')
que = deque()
dist[x, y] = 0
... | import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from itertools import product
h, w = list(map(int, input().split()))
s = np.full((h, w), 'x', dtype='U1')
for i in range(h):
s[i] = list(eval(input()))
d = np.identity(h * w, dtype='i1')
for i, k in product(list(range(h)), list(range(w))... | 36 | 21 | 864 | 620 | import numpy as np
from collections import deque
from itertools import product
H, W = list(map(int, input().split()))
S = np.full((H, W), "x", dtype="U1")
for i in range(H):
S[i] = list(eval(input()))
def bfs(x, y):
dist = np.full((H, W), -1, dtype="i8")
que = deque()
dist[x, y] = 0
que.append((x... | import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from itertools import product
h, w = list(map(int, input().split()))
s = np.full((h, w), "x", dtype="U1")
for i in range(h):
s[i] = list(eval(input()))
d = np.identity(h * w, dtype="i1")
for i, k in product(list(range(h)), list(range(w))):
if s... | false | 41.666667 | [
"-from collections import deque",
"+from scipy.sparse.csgraph import floyd_warshall",
"-H, W = list(map(int, input().split()))",
"-S = np.full((H, W), \"x\", dtype=\"U1\")",
"-for i in range(H):",
"- S[i] = list(eval(input()))",
"-",
"-",
"-def bfs(x, y):",
"- dist = np.full((H, W), -1, dtyp... | false | 0.298697 | 0.285853 | 1.044932 | [
"s810169359",
"s375901539"
] |
u285891772 | p02927 | python | s574003733 | s280668251 | 50 | 40 | 5,200 | 5,160 | Accepted | Accepted | 20 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 32 | 31 | 1,115 | 1,058 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 3.125 | [
"-for m in range(1, M + 1):",
"- for d in range(1, D + 1):",
"- if len(str(d)) == 2:",
"- d1 = int(str(d)[1])",
"- d10 = int(str(d)[0])",
"- if 2 <= d1 and 2 <= d10 and d1 * d10 == m:",
"- ans += 1",
"+for i in range(1, M + 1):",
"+ for j ... | false | 0.105037 | 0.082908 | 1.266917 | [
"s574003733",
"s280668251"
] |
u604839890 | p02713 | python | s183617991 | s173505014 | 470 | 186 | 68,904 | 68,652 | Accepted | Accepted | 60.43 | import math
w = 0
k = int(eval(input()))
for i in range(1, k+1):
for j in range(1, k+1):
for l in range(1, k+1):
m = math.gcd(i, j)
w += math.gcd(m, l)
print(w) | import math
w = 0
k = int(eval(input()))
for i in range(1, k+1):
for j in range(1, k+1):
m = math.gcd(i, j)
for l in range(1, k+1):
w += math.gcd(m, l)
print(w) | 10 | 10 | 201 | 197 | import math
w = 0
k = int(eval(input()))
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + 1):
m = math.gcd(i, j)
w += math.gcd(m, l)
print(w)
| import math
w = 0
k = int(eval(input()))
for i in range(1, k + 1):
for j in range(1, k + 1):
m = math.gcd(i, j)
for l in range(1, k + 1):
w += math.gcd(m, l)
print(w)
| false | 0 | [
"+ m = math.gcd(i, j)",
"- m = math.gcd(i, j)"
] | false | 0.039662 | 0.136209 | 0.291186 | [
"s183617991",
"s173505014"
] |
u279605379 | p02297 | python | s293905102 | s191524744 | 30 | 20 | 7,668 | 7,728 | Accepted | Accepted | 33.33 | n = int(eval(input()))
P =[]
s = 0
for _ in range(n):P.append([int(i) for i in input().split()])
P.append(P[0])
for j in range(n):s += - P[j][1]*P[j+1][0] + P[j+1][1] * P[j][0]
print((s*0.5)) | n = int(eval(input()))
P =[]
s = 0
for _ in range(n):P.append([int(i) for i in input().split()])
P.append(P[0])
for j in range(n):s += P[j][1]*P[j+1][0] - P[j+1][1] * P[j][0]
print((s*-0.5)) | 7 | 7 | 189 | 188 | n = int(eval(input()))
P = []
s = 0
for _ in range(n):
P.append([int(i) for i in input().split()])
P.append(P[0])
for j in range(n):
s += -P[j][1] * P[j + 1][0] + P[j + 1][1] * P[j][0]
print((s * 0.5))
| n = int(eval(input()))
P = []
s = 0
for _ in range(n):
P.append([int(i) for i in input().split()])
P.append(P[0])
for j in range(n):
s += P[j][1] * P[j + 1][0] - P[j + 1][1] * P[j][0]
print((s * -0.5))
| false | 0 | [
"- s += -P[j][1] * P[j + 1][0] + P[j + 1][1] * P[j][0]",
"-print((s * 0.5))",
"+ s += P[j][1] * P[j + 1][0] - P[j + 1][1] * P[j][0]",
"+print((s * -0.5))"
] | false | 0.032711 | 0.038413 | 0.85157 | [
"s293905102",
"s191524744"
] |
u038408819 | p03659 | python | s892085002 | s183137696 | 236 | 191 | 28,652 | 24,832 | Accepted | Accepted | 19.07 | N = int(eval(input()))
a = list(map(int, input().split()))
s_right = [0] * (N + 1)
s_left = [0] * (N + 1)
for i in range(N):
s_left[i + 1] = s_left[i] + a[i]
s_right[i + 1] = s_right[i] + a[N - 1 - i]
ans = float('Inf')
for i in range(1, N):
#print(ans)
if ans > abs(s_left[i] - s_right[N - i])... | N = int(eval(input()))
a = list(map(int, input().split()))
s = [0] * (N + 1)
for i in range(N):
s[i + 1] = s[i] + a[i]
ans = float('Inf')
for i in range(1, N):
#print(ans)
kouho = abs(s[i] - ((s[-1]) - s[i]))
if ans > kouho:
ans = kouho
#ans = min(ans, kouho)
print(ans)
| 13 | 13 | 375 | 305 | N = int(eval(input()))
a = list(map(int, input().split()))
s_right = [0] * (N + 1)
s_left = [0] * (N + 1)
for i in range(N):
s_left[i + 1] = s_left[i] + a[i]
s_right[i + 1] = s_right[i] + a[N - 1 - i]
ans = float("Inf")
for i in range(1, N):
# print(ans)
if ans > abs(s_left[i] - s_right[N - i]):
... | N = int(eval(input()))
a = list(map(int, input().split()))
s = [0] * (N + 1)
for i in range(N):
s[i + 1] = s[i] + a[i]
ans = float("Inf")
for i in range(1, N):
# print(ans)
kouho = abs(s[i] - ((s[-1]) - s[i]))
if ans > kouho:
ans = kouho
# ans = min(ans, kouho)
print(ans)
| false | 0 | [
"-s_right = [0] * (N + 1)",
"-s_left = [0] * (N + 1)",
"+s = [0] * (N + 1)",
"- s_left[i + 1] = s_left[i] + a[i]",
"- s_right[i + 1] = s_right[i] + a[N - 1 - i]",
"+ s[i + 1] = s[i] + a[i]",
"- if ans > abs(s_left[i] - s_right[N - i]):",
"- ans = abs(s_left[i] - s_right[N - i])",
... | false | 0.038432 | 0.044861 | 0.856687 | [
"s892085002",
"s183137696"
] |
u794173881 | p03027 | python | s719891765 | s472042129 | 1,999 | 978 | 115,996 | 115,440 | Accepted | Accepted | 51.08 | class Combination:
'''
計算量:階乗・逆元テーブルの作成O(N)
nCkを求めるO(1)
'''
def __init__(self, n, MOD):
self.fact = [1]
for i in range(1, n + 1):
self.fact.append(self.fact[-1] * i % MOD)
self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i in range(n + 1)]
... | class Combination:
def __init__(self, n, MOD):
self.fact = [1]
for i in range(1, n + 1):
self.fact.append(self.fact[-1] * i % MOD)
self.inv_fact = [0] * (n + 1)
self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
for i in reversed(list(range(n))):
... | 40 | 33 | 1,109 | 981 | class Combination:
"""
計算量:階乗・逆元テーブルの作成O(N)
nCkを求めるO(1)
"""
def __init__(self, n, MOD):
self.fact = [1]
for i in range(1, n + 1):
self.fact.append(self.fact[-1] * i % MOD)
self.inv_fact = [pow(self.fact[i], MOD - 2, MOD) for i in range(n + 1)]
sel... | class Combination:
def __init__(self, n, MOD):
self.fact = [1]
for i in range(1, n + 1):
self.fact.append(self.fact[-1] * i % MOD)
self.inv_fact = [0] * (n + 1)
self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
for i in reversed(list(range(n))):
self.... | false | 17.5 | [
"- \"\"\"",
"- 計算量:階乗・逆元テーブルの作成O(N)",
"- nCkを求めるO(1)",
"- \"\"\"",
"-",
"- self.inv_fact = [pow(self.fact[i], MOD - 2, MOD) for i in range(n + 1)]",
"+ self.inv_fact = [0] * (n + 1)",
"+ self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)",
"+ for i in ... | false | 3.806618 | 1.534045 | 2.481426 | [
"s719891765",
"s472042129"
] |
u545368057 | p03061 | python | s366579372 | s386676689 | 856 | 306 | 82,668 | 14,588 | Accepted | Accepted | 64.25 | # from math import gcd
import sys
input = sys.stdin.readline
n = int(eval(input()))
As = list(map(int, input().split()))
def gcd(n, m):
# 最大公約数
a = max(n,m)
b = min(n,m)
while b:
a, b = b, a % b
return a
class segmented_tree:
X_unit = 1 << 30
X_f = lambda self, a, b... | """
左右の累積gcdをもたせて置く
i番目を除く(i=1)
R : acc[i-1]
L : racc[n-i-1]
"""
n = int(eval(input()))
As = list(map(int, input().split()))
def gcd(n, m):
a = max(n,m)
b = min(n,m)
while b:
a, b = b, a % b
return a
acc = [As[0]]
racc = [As[-1]] #(右から)i番目の累積gcd
for i in range(1,n):
... | 69 | 36 | 1,576 | 634 | # from math import gcd
import sys
input = sys.stdin.readline
n = int(eval(input()))
As = list(map(int, input().split()))
def gcd(n, m):
# 最大公約数
a = max(n, m)
b = min(n, m)
while b:
a, b = b, a % b
return a
class segmented_tree:
X_unit = 1 << 30
X_f = lambda self, a, b: gcd(a, b)... | """
左右の累積gcdをもたせて置く
i番目を除く(i=1)
R : acc[i-1]
L : racc[n-i-1]
"""
n = int(eval(input()))
As = list(map(int, input().split()))
def gcd(n, m):
a = max(n, m)
b = min(n, m)
while b:
a, b = b, a % b
return a
acc = [As[0]]
racc = [As[-1]] # (右から)i番目の累積gcd
for i in range(1, n):
acc.append(gcd(... | false | 47.826087 | [
"-# from math import gcd",
"-import sys",
"-",
"-input = sys.stdin.readline",
"+\"\"\"",
"+左右の累積gcdをもたせて置く",
"+i番目を除く(i=1)",
"+R : acc[i-1]",
"+L : racc[n-i-1]",
"+\"\"\"",
"- # 最大公約数",
"-class segmented_tree:",
"- X_unit = 1 << 30",
"- X_f = lambda self, a, b: gcd(a, b)",
"-",
... | false | 0.046775 | 0.046107 | 1.01449 | [
"s366579372",
"s386676689"
] |
u451017206 | p03215 | python | s977557137 | s986764095 | 912 | 548 | 73,952 | 55,720 | Accepted | Accepted | 39.91 | def cumsum(l):
c = [0] * len(l)
for i in range(len(l)):
c[i] = c[i-1] + l[i]
return c
N, K = list(map(int, input().split()))
a = [int(i) for i in input().split()]
c = [0] + cumsum(a)
s = {bin(c[j+i] - c[j]).replace('0b','').zfill(40) for i in range(1, N+1) for j in range(N-i+1)}
ans = 0
... | def cumsum(l):
c = [0] * len(l)
for i in range(len(l)):
c[i] = c[i-1] + l[i]
return c
N, K = list(map(int, input().split()))
a = [int(i) for i in input().split()]
c = [0] + cumsum(a)
s = [bin(c[j+i] - c[j]).replace('0b','').zfill(40) for i in range(1, N+1) for j in range(N-i+1)]
ans = 0
... | 19 | 18 | 450 | 448 | def cumsum(l):
c = [0] * len(l)
for i in range(len(l)):
c[i] = c[i - 1] + l[i]
return c
N, K = list(map(int, input().split()))
a = [int(i) for i in input().split()]
c = [0] + cumsum(a)
s = {
bin(c[j + i] - c[j]).replace("0b", "").zfill(40)
for i in range(1, N + 1)
for j in range(N - i ... | def cumsum(l):
c = [0] * len(l)
for i in range(len(l)):
c[i] = c[i - 1] + l[i]
return c
N, K = list(map(int, input().split()))
a = [int(i) for i in input().split()]
c = [0] + cumsum(a)
s = [
bin(c[j + i] - c[j]).replace("0b", "").zfill(40)
for i in range(1, N + 1)
for j in range(N - i ... | false | 5.263158 | [
"-s = {",
"+s = [",
"-}",
"+]",
"- t = {j for j in s if j[i] == \"1\"}",
"+ t = [j for j in s if j[i] == \"1\"]"
] | false | 0.086488 | 0.037291 | 2.319276 | [
"s977557137",
"s986764095"
] |
u380412651 | p03044 | python | s078724210 | s184433387 | 909 | 564 | 147,248 | 79,428 | Accepted | Accepted | 37.95 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def dfs(v, p, c):
color[v] = c
for e in graph[v]:
if e[0] == p: continue
if e[1] % 2: dfs(e[0], v, 1-c)
else: dfs(e[0], v, c)
n = int(eval(input()))
color = [-1 for _ in range(n)]
graph = [[] for _ in ra... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 5)
def dfs(v, p, c):
color[v] = c
for e in graph[v]:
if e[0] == p: continue
if e[1] % 2: dfs(e[0], v, 1-c)
else: dfs(e[0], v, c)
n = int(eval(input()))
color = [-1] * n
graph = [[] for _ in range(n)]
fo... | 25 | 24 | 535 | 503 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def dfs(v, p, c):
color[v] = c
for e in graph[v]:
if e[0] == p:
continue
if e[1] % 2:
dfs(e[0], v, 1 - c)
else:
dfs(e[0], v, c)
n = int(eval(input()))
color = [-1 for _ in range(n... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)
def dfs(v, p, c):
color[v] = c
for e in graph[v]:
if e[0] == p:
continue
if e[1] % 2:
dfs(e[0], v, 1 - c)
else:
dfs(e[0], v, c)
n = int(eval(input()))
color = [-1] * n
graph = [[] ... | false | 4 | [
"-sys.setrecursionlimit(100000)",
"+sys.setrecursionlimit(10**5)",
"-color = [-1 for _ in range(n)]",
"+color = [-1] * n",
"-for i in range(n - 1):",
"+for _ in range(n - 1):",
"-for i in range(n):",
"- print((color[i]))",
"+for c in color:",
"+ print(c)"
] | false | 0.15554 | 0.073654 | 2.111755 | [
"s078724210",
"s184433387"
] |
u466335531 | p03329 | python | s955162043 | s366481587 | 655 | 527 | 118,876 | 115,932 | Accepted | Accepted | 19.54 | six=[6**i for i in range(1,7)][::-1]
nine=[9**i for i in range(1,6)][::-1]
N=int(eval(input()))
ans=[]
def find(n,a):
if n<6: ans.append(n+a)
for s in six:
if s<=n:
find(n-s,a+1)
break
for s in nine:
if s<=n:
find(n-s,a+1)
break
... | six=[6**i for i in range(1,7)][::-1]
nine=[9**i for i in range(1,6)][::-1]
N=int(eval(input()))
ans=[]
def find(n,a):
if n<6:
ans.append(n+a)
return
for s in six:
if s<=n:
find(n-s,a+1)
break
for s in nine:
if s<=n:
find(n-s... | 17 | 19 | 341 | 366 | six = [6**i for i in range(1, 7)][::-1]
nine = [9**i for i in range(1, 6)][::-1]
N = int(eval(input()))
ans = []
def find(n, a):
if n < 6:
ans.append(n + a)
for s in six:
if s <= n:
find(n - s, a + 1)
break
for s in nine:
if s <= n:
find(n - s, a... | six = [6**i for i in range(1, 7)][::-1]
nine = [9**i for i in range(1, 6)][::-1]
N = int(eval(input()))
ans = []
def find(n, a):
if n < 6:
ans.append(n + a)
return
for s in six:
if s <= n:
find(n - s, a + 1)
break
for s in nine:
if s <= n:
... | false | 10.526316 | [
"+ return"
] | false | 0.55617 | 0.086803 | 6.407252 | [
"s955162043",
"s366481587"
] |
u715329136 | p02600 | python | s597496426 | s076836490 | 33 | 27 | 9,192 | 9,160 | Accepted | Accepted | 18.18 | rate = int(eval(input()))
k = '1'
if (400 <= rate < 600):
k = '8'
elif (600 <= rate < 800):
k = '7'
elif (800 <= rate < 1000):
k = '6'
elif (1000 <= rate < 1200):
k = '5'
elif (1200 <= rate < 1400):
k = '4'
elif (1400 <= rate < 1600):
k = '3'
elif (1600 <= rate < 1800):
k = '2... | def resolve():
rate = int(eval(input()))
if rate < 600:
print('8')
elif rate < 800:
print('7')
elif rate < 1000:
print('6')
elif rate < 1200:
print('5')
elif rate < 1400:
print('4')
elif rate < 1600:
print('3')
elif rate < 180... | 19 | 21 | 368 | 412 | rate = int(eval(input()))
k = "1"
if 400 <= rate < 600:
k = "8"
elif 600 <= rate < 800:
k = "7"
elif 800 <= rate < 1000:
k = "6"
elif 1000 <= rate < 1200:
k = "5"
elif 1200 <= rate < 1400:
k = "4"
elif 1400 <= rate < 1600:
k = "3"
elif 1600 <= rate < 1800:
k = "2"
elif 1800 <= rate < 2000:
... | def resolve():
rate = int(eval(input()))
if rate < 600:
print("8")
elif rate < 800:
print("7")
elif rate < 1000:
print("6")
elif rate < 1200:
print("5")
elif rate < 1400:
print("4")
elif rate < 1600:
print("3")
elif rate < 1800:
pri... | false | 9.52381 | [
"-rate = int(eval(input()))",
"-k = \"1\"",
"-if 400 <= rate < 600:",
"- k = \"8\"",
"-elif 600 <= rate < 800:",
"- k = \"7\"",
"-elif 800 <= rate < 1000:",
"- k = \"6\"",
"-elif 1000 <= rate < 1200:",
"- k = \"5\"",
"-elif 1200 <= rate < 1400:",
"- k = \"4\"",
"-elif 1400 <= ... | false | 0.038606 | 0.035295 | 1.093793 | [
"s597496426",
"s076836490"
] |
u379692329 | p03329 | python | s770077782 | s295798742 | 1,467 | 544 | 3,828 | 3,828 | Accepted | Accepted | 62.92 | N = int(eval(input()))
dp = [N] * (N+1)
dp[0] = 0
for i in range(1, N+1):
pow6 = []
pow9 = []
for j in range(i):
if 6**j > i:
break
pow6.append(6**j)
for k in range(i):
if 9**k > i:
break
pow9.append(9**k)
L = set(pow6 + pow9)
... | N = int(eval(input()))
INF = 10**9
dp = [INF]*(N+1)
dp[0] = 0
num6 = [6**i for i in range(1, 10)]
num9 = [9**i for i in range(1, 7)]
S = sorted([1] + num6 + num9)
for i in range(1, N+1):
tmp = INF
for j in S:
if j > i:
break
else:
dp[i] = min(tmp, dp[i-j]+1... | 23 | 18 | 430 | 356 | N = int(eval(input()))
dp = [N] * (N + 1)
dp[0] = 0
for i in range(1, N + 1):
pow6 = []
pow9 = []
for j in range(i):
if 6**j > i:
break
pow6.append(6**j)
for k in range(i):
if 9**k > i:
break
pow9.append(9**k)
L = set(pow6 + pow9)
for l in ... | N = int(eval(input()))
INF = 10**9
dp = [INF] * (N + 1)
dp[0] = 0
num6 = [6**i for i in range(1, 10)]
num9 = [9**i for i in range(1, 7)]
S = sorted([1] + num6 + num9)
for i in range(1, N + 1):
tmp = INF
for j in S:
if j > i:
break
else:
dp[i] = min(tmp, dp[i - j] + 1)
... | false | 21.73913 | [
"-dp = [N] * (N + 1)",
"+INF = 10**9",
"+dp = [INF] * (N + 1)",
"+num6 = [6**i for i in range(1, 10)]",
"+num9 = [9**i for i in range(1, 7)]",
"+S = sorted([1] + num6 + num9)",
"- pow6 = []",
"- pow9 = []",
"- for j in range(i):",
"- if 6**j > i:",
"+ tmp = INF",
"+ for j... | false | 0.643657 | 0.098083 | 6.562368 | [
"s770077782",
"s295798742"
] |
u462329577 | p02624 | python | s177826010 | s885244894 | 34 | 30 | 9,172 | 9,068 | Accepted | Accepted | 11.76 | #!/usr/bin/env python3
# input
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(eval(input()))
ans = n * (n + 1) - 1 # 1とk 自信
i = 2
while i * i <= n:
num = n // i
min_i = i * i
max_i = i * num
ans += (num - i + ... | #!/usr/bin/env python3
# input
n = int(eval(input()))
ans = n * (n + 1) - 1 # 1とk 自信
i = 2
while i * i <= n:
num = n // i
min_i = i * i
max_i = i * num
ans += (num - i + 1) * (min_i + max_i) # 自分自身
ans -= min_i
i += 1
print(ans)
| 19 | 15 | 385 | 265 | #!/usr/bin/env python3
# input
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(eval(input()))
ans = n * (n + 1) - 1 # 1とk 自信
i = 2
while i * i <= n:
num = n // i
min_i = i * i
max_i = i * num
ans += (num - i + 1) * (min_i + ma... | #!/usr/bin/env python3
# input
n = int(eval(input()))
ans = n * (n + 1) - 1 # 1とk 自信
i = 2
while i * i <= n:
num = n // i
min_i = i * i
max_i = i * num
ans += (num - i + 1) * (min_i + max_i) # 自分自身
ans -= min_i
i += 1
print(ans)
| false | 21.052632 | [
"-import sys",
"-",
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines"
] | false | 0.098906 | 0.162795 | 0.607553 | [
"s177826010",
"s885244894"
] |
u539367121 | p02901 | python | s030064403 | s740135615 | 1,609 | 1,026 | 9,260 | 9,392 | Accepted | Accepted | 36.23 | n,m=list(map(int,input().split()))
inf=10**9
cost=[inf for i in range(m)]
for i in range(m):
a,b=list(map(int,input().split()))
c=[int(x)-1 for x in input().split()]
s=0
for j in c:
s|=1<<j
cost[i]=[s,a]
#print(cost)
dp=[inf]*(1<<n)
dp[0]=0
for s in range(1<<n):
for bit,c in cost:
d... | def main():
n,m=list(map(int,input().split()))
inf=10**9
cost=[inf for i in range(m)]
for i in range(m):
a,b=list(map(int,input().split()))
c=[int(x)-1 for x in input().split()]
s=0
for j in c:
s|=1<<j
cost[i]=[s,a]
#print(cost)
dp=[inf]*(1<<n)
dp[0]=0
for s in ... | 20 | 23 | 393 | 477 | n, m = list(map(int, input().split()))
inf = 10**9
cost = [inf for i in range(m)]
for i in range(m):
a, b = list(map(int, input().split()))
c = [int(x) - 1 for x in input().split()]
s = 0
for j in c:
s |= 1 << j
cost[i] = [s, a]
# print(cost)
dp = [inf] * (1 << n)
dp[0] = 0
for s in range(1 ... | def main():
n, m = list(map(int, input().split()))
inf = 10**9
cost = [inf for i in range(m)]
for i in range(m):
a, b = list(map(int, input().split()))
c = [int(x) - 1 for x in input().split()]
s = 0
for j in c:
s |= 1 << j
cost[i] = [s, a]
# print... | false | 13.043478 | [
"-n, m = list(map(int, input().split()))",
"-inf = 10**9",
"-cost = [inf for i in range(m)]",
"-for i in range(m):",
"- a, b = list(map(int, input().split()))",
"- c = [int(x) - 1 for x in input().split()]",
"- s = 0",
"- for j in c:",
"- s |= 1 << j",
"- cost[i] = [s, a]",
... | false | 0.048421 | 0.038042 | 1.272824 | [
"s030064403",
"s740135615"
] |
u745087332 | p03255 | python | s027381814 | s069312828 | 1,994 | 1,061 | 30,572 | 25,708 | Accepted | Accepted | 46.79 | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N, X = inpl()
A = inpl()
B = [0]
for a in A:
B.append(B[-1] + a)
ans = []
for k in range(1, N + 1):
e = 5
cur = N - k
tmp = e * (B[N] - B[cur]) + (N + k) * X
cur -= k
while True:
... | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N, X = inpl()
A = inpl()
B = [0]
for a in A:
B.append(B[-1] + a)
ans = INF
for k in range(1, N + 1):
tmp = 5 * B[N] + (N + k) * X
cur = N - 2 * k
while cur > 0:
tmp += 2 * B[cur]
... | 31 | 24 | 482 | 370 | # coding:utf-8
INF = float("inf")
def inpl():
return list(map(int, input().split()))
N, X = inpl()
A = inpl()
B = [0]
for a in A:
B.append(B[-1] + a)
ans = []
for k in range(1, N + 1):
e = 5
cur = N - k
tmp = e * (B[N] - B[cur]) + (N + k) * X
cur -= k
while True:
tmp += e * (B[cu... | # coding:utf-8
INF = float("inf")
def inpl():
return list(map(int, input().split()))
N, X = inpl()
A = inpl()
B = [0]
for a in A:
B.append(B[-1] + a)
ans = INF
for k in range(1, N + 1):
tmp = 5 * B[N] + (N + k) * X
cur = N - 2 * k
while cur > 0:
tmp += 2 * B[cur]
cur -= k
ans... | false | 22.580645 | [
"-ans = []",
"+ans = INF",
"- e = 5",
"- cur = N - k",
"- tmp = e * (B[N] - B[cur]) + (N + k) * X",
"- cur -= k",
"- while True:",
"- tmp += e * (B[cur + k] - B[max(cur, 0)])",
"- if cur <= 0:",
"- break",
"- e += 2",
"+ tmp = 5 * B[N] + (N + k... | false | 0.035285 | 0.035684 | 0.988832 | [
"s027381814",
"s069312828"
] |
u279493135 | p02691 | python | s668639742 | s085274801 | 221 | 165 | 35,812 | 138,200 | Accepted | Accepted | 25.34 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
... | 29 | 30 | 951 | 962 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
accumulate,
permutations,
combinations,
product,
groupby,
combinations_with_replacement,
)
from operator import itemgetter, mul
fro... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
accumulate,
permutations,
combinations,
product,
groupby,
combinations_with_replacement,
)
from operator import itemgetter, mul
fro... | false | 3.333333 | [
"-A = [x - i for i, x in enumerate(A)]",
"-cnt_A = Counter(A)",
"+L = [i + x for i, x in enumerate(A)]",
"+R = [i - x for i, x in enumerate(A)]",
"+cnt_R = Counter(R)",
"-for i, a in enumerate(A):",
"- ans += cnt_A[-A[i] - 2 * i]",
"+for l in L:",
"+ ans += cnt_R[l]"
] | false | 0.03717 | 0.03741 | 0.993572 | [
"s668639742",
"s085274801"
] |
u146803137 | p02959 | python | s824582435 | s774440626 | 275 | 151 | 86,748 | 24,232 | Accepted | Accepted | 45.09 | import math
import re
import copy
import sys
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
for i in range(n):
c += min(a[i],b[i])
if a[i] < b[i]:
c += min(a[i+1],b[i]-a[i])
a[i+1] -= min(a[i+1],b[i]-a[i])
print(c) | n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n-1,-1,-1):
ans += min(a[i]+a[i+1],b[i])
a[i] = max(a[i]-max(b[i]-a[i+1],0),0)
print(ans)
| 17 | 8 | 303 | 215 | import math
import re
import copy
import sys
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
for i in range(n):
c += min(a[i], b[i])
if a[i] < b[i]:
c += min(a[i + 1], b[i] - a[i])
a[i + 1] -= min(a[i + 1], b[i] - a[i])
print(c)
| n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n - 1, -1, -1):
ans += min(a[i] + a[i + 1], b[i])
a[i] = max(a[i] - max(b[i] - a[i + 1], 0), 0)
print(ans)
| false | 52.941176 | [
"-import math",
"-import re",
"-import copy",
"-import sys",
"-",
"-c = 0",
"-for i in range(n):",
"- c += min(a[i], b[i])",
"- if a[i] < b[i]:",
"- c += min(a[i + 1], b[i] - a[i])",
"- a[i + 1] -= min(a[i + 1], b[i] - a[i])",
"-print(c)",
"+ans = 0",
"+for i in range(n... | false | 0.096626 | 0.045171 | 2.139118 | [
"s824582435",
"s774440626"
] |
u197968862 | p03160 | python | s201163850 | s185454786 | 234 | 99 | 52,208 | 85,732 | Accepted | Accepted | 57.69 | n = int(eval(input()))
h = list(map(int,input().split()))
dp = [0] * n
for i in range(1,n):
if i == 1:
dp[i] = abs(h[i]-h[0])
continue
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1])) | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float('inf')] * n
dp[0] = 0
for i in range(n):
if i < n - 2:
dp[i+2] = min(dp[i+2], dp[i]+abs(h[i] - h[i+2]))
dp[i+1] = min(dp[i+1], dp[i]+abs(h[i] - h[i+1]))
elif i == n - 2:
dp[i+1] = min(dp[i+1], dp[i]+abs(h... | 11 | 14 | 241 | 345 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * n
for i in range(1, n):
if i == 1:
dp[i] = abs(h[i] - h[0])
continue
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(n):
if i < n - 2:
dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]))
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
elif i == n - 2:
dp[i + 1] = min(dp[i + 1], dp[i... | false | 21.428571 | [
"-dp = [0] * n",
"-for i in range(1, n):",
"- if i == 1:",
"- dp[i] = abs(h[i] - h[0])",
"- continue",
"- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))",
"+dp = [float(\"inf\")] * n",
"+dp[0] = 0",
"+for i in range(n):",
"+ if i < n - 2:",
... | false | 0.04188 | 0.03968 | 1.055441 | [
"s201163850",
"s185454786"
] |
u910756197 | p03607 | python | s364089600 | s093368771 | 224 | 187 | 15,460 | 14,700 | Accepted | Accepted | 16.52 | from collections import defaultdict
def solve():
dic = defaultdict(int)
n = int(eval(input()))
ans = 0
for _ in range(n):
a = int(eval(input()))
dic[a] = (dic[a] + 1) % 2
print((sum(dic.values())))
if __name__ == '__main__':
solve() | n = int(eval(input()))
s = set()
for _ in range(n):
s ^= {eval(input())}
print((len(s))) | 13 | 5 | 272 | 82 | from collections import defaultdict
def solve():
dic = defaultdict(int)
n = int(eval(input()))
ans = 0
for _ in range(n):
a = int(eval(input()))
dic[a] = (dic[a] + 1) % 2
print((sum(dic.values())))
if __name__ == "__main__":
solve()
| n = int(eval(input()))
s = set()
for _ in range(n):
s ^= {eval(input())}
print((len(s)))
| false | 61.538462 | [
"-from collections import defaultdict",
"-",
"-",
"-def solve():",
"- dic = defaultdict(int)",
"- n = int(eval(input()))",
"- ans = 0",
"- for _ in range(n):",
"- a = int(eval(input()))",
"- dic[a] = (dic[a] + 1) % 2",
"- print((sum(dic.values())))",
"-",
"-",
... | false | 0.061952 | 0.113161 | 0.547468 | [
"s364089600",
"s093368771"
] |
u759412327 | p03487 | python | s193514189 | s794308628 | 79 | 72 | 20,600 | 22,368 | Accepted | Accepted | 8.86 | N = int(eval(input()))
A = list(map(int,input().split()))
B = (10**5+1)*[0]
ans = 0
for a in A:
if a<=10**5:
B[a]+=1
else:
ans+=1
for n in range(10**5):
if B[n]<n:
ans+=B[n]
elif n<B[n]:
ans+=B[n]-n
print(ans) | from collections import *
N = int(eval(input()))
C = Counter(list(map(int,input().split())))
ans = 0
for k,v in list(C.items()):
if k<v:
ans+=v-k
elif v<k:
ans+=v
print(ans) | 18 | 12 | 247 | 186 | N = int(eval(input()))
A = list(map(int, input().split()))
B = (10**5 + 1) * [0]
ans = 0
for a in A:
if a <= 10**5:
B[a] += 1
else:
ans += 1
for n in range(10**5):
if B[n] < n:
ans += B[n]
elif n < B[n]:
ans += B[n] - n
print(ans)
| from collections import *
N = int(eval(input()))
C = Counter(list(map(int, input().split())))
ans = 0
for k, v in list(C.items()):
if k < v:
ans += v - k
elif v < k:
ans += v
print(ans)
| false | 33.333333 | [
"+from collections import *",
"+",
"-A = list(map(int, input().split()))",
"-B = (10**5 + 1) * [0]",
"+C = Counter(list(map(int, input().split())))",
"-for a in A:",
"- if a <= 10**5:",
"- B[a] += 1",
"- else:",
"- ans += 1",
"-for n in range(10**5):",
"- if B[n] < n:",
... | false | 0.073948 | 0.102306 | 0.722811 | [
"s193514189",
"s794308628"
] |
u475503988 | p02927 | python | s273187763 | s897070363 | 19 | 17 | 2,940 | 3,060 | Accepted | Accepted | 10.53 | M, D = list(map(int, input().split()))
ans = 0
for m in range(1, M+1):
for d in range(22, D+1):
d1 = d % 10
if d1 < 2: continue
d10 = d // 10
if d10 < 2: continue
if d1 * d10 == m:
ans += 1
print(ans)
| M, D = list(map(int, input().split()))
ans = 0
for d in range(22, D+1):
d1 = d % 10
if d1 < 2: continue
d10 = d // 10
if d10 < 2: continue
if d1 * d10 <= M:
ans += 1
print(ans) | 13 | 12 | 265 | 211 | M, D = list(map(int, input().split()))
ans = 0
for m in range(1, M + 1):
for d in range(22, D + 1):
d1 = d % 10
if d1 < 2:
continue
d10 = d // 10
if d10 < 2:
continue
if d1 * d10 == m:
ans += 1
print(ans)
| M, D = list(map(int, input().split()))
ans = 0
for d in range(22, D + 1):
d1 = d % 10
if d1 < 2:
continue
d10 = d // 10
if d10 < 2:
continue
if d1 * d10 <= M:
ans += 1
print(ans)
| false | 7.692308 | [
"-for m in range(1, M + 1):",
"- for d in range(22, D + 1):",
"- d1 = d % 10",
"- if d1 < 2:",
"- continue",
"- d10 = d // 10",
"- if d10 < 2:",
"- continue",
"- if d1 * d10 == m:",
"- ans += 1",
"+for d in range(22, D + 1):"... | false | 0.039741 | 0.039683 | 1.001463 | [
"s273187763",
"s897070363"
] |
u252828980 | p02947 | python | s525463719 | s990428240 | 362 | 227 | 19,756 | 24,068 | Accepted | Accepted | 37.29 | n = int(eval(input()))
from collections import Counter
cnt= 0
L = []
for i in range(n):
s = sorted(eval(input()))
L.append(("".join(s)))
L = Counter(L)
for v in list(L.values()):
cnt +=(v-1)*v//2
print(cnt) | n = int(eval(input()))
L = ["".join(sorted(eval(input()))) for i in range(n)]
from collections import Counter
L = Counter(L)
def num(n):
return n*(n-1)//2
cnt = 0
for v in list(L.values()):
cnt +=num(v)
print(cnt) | 12 | 14 | 212 | 226 | n = int(eval(input()))
from collections import Counter
cnt = 0
L = []
for i in range(n):
s = sorted(eval(input()))
L.append(("".join(s)))
L = Counter(L)
for v in list(L.values()):
cnt += (v - 1) * v // 2
print(cnt)
| n = int(eval(input()))
L = ["".join(sorted(eval(input()))) for i in range(n)]
from collections import Counter
L = Counter(L)
def num(n):
return n * (n - 1) // 2
cnt = 0
for v in list(L.values()):
cnt += num(v)
print(cnt)
| false | 14.285714 | [
"+L = [\"\".join(sorted(eval(input()))) for i in range(n)]",
"+L = Counter(L)",
"+",
"+",
"+def num(n):",
"+ return n * (n - 1) // 2",
"+",
"+",
"-L = []",
"-for i in range(n):",
"- s = sorted(eval(input()))",
"- L.append((\"\".join(s)))",
"-L = Counter(L)",
"- cnt += (v - 1) *... | false | 0.084907 | 0.067737 | 1.253486 | [
"s525463719",
"s990428240"
] |
u945228737 | p03222 | python | s739770857 | s827072647 | 35 | 32 | 9,136 | 9,228 | Accepted | Accepted | 8.57 | # 解説と下記を参考に作成
# https://atcoder.jp/contests/abc113/submissions/15821617
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(H, W, K):
mod = 10 ** 9 + 7
dp = [[0] * W for _ in range(H + 1)]
... | # 解説と下記を参考に作成
# https://atcoder.jp/contests/abc113/submissions/15821617
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(H, W, K):
mod = 10 ** 9 + 7
dp = [[0] * W for _ in range(H + 1)]
d... | 54 | 38 | 1,597 | 1,054 | # 解説と下記を参考に作成
# https://atcoder.jp/contests/abc113/submissions/15821617
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(H, W, K):
mod = 10**9 + 7
dp = [[0] * W for _ in range(H + 1)]
dp[0][0] = 1
... | # 解説と下記を参考に作成
# https://atcoder.jp/contests/abc113/submissions/15821617
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(H, W, K):
mod = 10**9 + 7
dp = [[0] * W for _ in range(H + 1)]
dp[0][0] = 1
... | false | 29.62963 | [
"+ fibo = [1, 2, 3, 5, 8, 13, 21]",
"-",
"- def cnt_tmp(n, r, l, flg):",
"- re = 0",
"- if n >= W - 2:",
"- if r <= n <= l:",
"- return 1",
"- if flg:",
"- ... | false | 0.08174 | 0.140409 | 0.582155 | [
"s739770857",
"s827072647"
] |
u075012704 | p03972 | python | s318233054 | s917098359 | 711 | 501 | 27,736 | 16,512 | Accepted | Accepted | 29.54 | W, H = list(map(int, input().split()))
P = [(int(eval(input())), 0) for i in range(W)]
Q = [(int(eval(input())), 1) for i in range(H)]
E = sorted(P + Q)
used = [W + 1, H + 1]
ans = 0
for e, f in E:
ans += e * used[1 - f]
used[f] -= 1
print(ans)
| from itertools import accumulate
from bisect import bisect_left
W, H = list(map(int, input().split()))
W_cost = sorted([int(eval(input())) for i in range(W)])
H_cost = [int(eval(input())) for i in range(H)]
# 横は全部辺を張り、縦は各区間1本
W_cost_sum = sum(W_cost)
ans = W_cost_sum * (H + 1) + sum(H_cost)
W_acc_cost =... | 13 | 18 | 250 | 458 | W, H = list(map(int, input().split()))
P = [(int(eval(input())), 0) for i in range(W)]
Q = [(int(eval(input())), 1) for i in range(H)]
E = sorted(P + Q)
used = [W + 1, H + 1]
ans = 0
for e, f in E:
ans += e * used[1 - f]
used[f] -= 1
print(ans)
| from itertools import accumulate
from bisect import bisect_left
W, H = list(map(int, input().split()))
W_cost = sorted([int(eval(input())) for i in range(W)])
H_cost = [int(eval(input())) for i in range(H)]
# 横は全部辺を張り、縦は各区間1本
W_cost_sum = sum(W_cost)
ans = W_cost_sum * (H + 1) + sum(H_cost)
W_acc_cost = [0] + list(acc... | false | 27.777778 | [
"+from itertools import accumulate",
"+from bisect import bisect_left",
"+",
"-P = [(int(eval(input())), 0) for i in range(W)]",
"-Q = [(int(eval(input())), 1) for i in range(H)]",
"-E = sorted(P + Q)",
"-used = [W + 1, H + 1]",
"-ans = 0",
"-for e, f in E:",
"- ans += e * used[1 - f]",
"- ... | false | 0.037193 | 0.037655 | 0.987717 | [
"s318233054",
"s917098359"
] |
u488127128 | p03804 | python | s264101008 | s270487377 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | import sys
def solve():
n,m = list(map(int, sys.stdin.readline().split()))
A = [sys.stdin.readline().rstrip() for _ in range(n)]
B = [sys.stdin.readline().rstrip() for _ in range(m)]
for r in range(n-m+1):
for c in range(n-m+1):
X = []
for a in A[r:r+m]:
... | def solve():
n,m = list(map(int, input().split()))
A = [eval(input()) for _ in range(n)]
B = [eval(input()) for _ in range(m)]
for r in range(n-m+1):
for c in range(n-m+1):
X = []
for i,a in enumerate(A[r:r+m]):
if a[c:c+m] != B[i]:
... | 18 | 17 | 480 | 446 | import sys
def solve():
n, m = list(map(int, sys.stdin.readline().split()))
A = [sys.stdin.readline().rstrip() for _ in range(n)]
B = [sys.stdin.readline().rstrip() for _ in range(m)]
for r in range(n - m + 1):
for c in range(n - m + 1):
X = []
for a in A[r : r + m]:
... | def solve():
n, m = list(map(int, input().split()))
A = [eval(input()) for _ in range(n)]
B = [eval(input()) for _ in range(m)]
for r in range(n - m + 1):
for c in range(n - m + 1):
X = []
for i, a in enumerate(A[r : r + m]):
if a[c : c + m] != B[i]:
... | false | 5.555556 | [
"-import sys",
"-",
"-",
"- n, m = list(map(int, sys.stdin.readline().split()))",
"- A = [sys.stdin.readline().rstrip() for _ in range(n)]",
"- B = [sys.stdin.readline().rstrip() for _ in range(m)]",
"+ n, m = list(map(int, input().split()))",
"+ A = [eval(input()) for _ in range(n)]",
... | false | 0.04682 | 0.04561 | 1.02653 | [
"s264101008",
"s270487377"
] |
u545368057 | p03048 | python | s229858133 | s576303678 | 269 | 90 | 40,428 | 67,236 | Accepted | Accepted | 66.54 | R, B, G, N = list(map(int,input().split()))
cnt = 0
ball = 0
a = sorted([R,G,B])
for r in range(N//a[0]+1):
ball = r*a[0]
for b in range((N-ball)//a[1]+1):
if N-ball >= 0 and (N-ball-b*a[1])%a[2] == 0:
cnt += 1
print(cnt) | r,g,b,n = list(map(int, input().split()))
cnt = 0
for i in range(n+1):
for j in range(n+1):
rest = n - i*r - j*g
if rest >=0 and rest%b==0:
cnt += 1
print(cnt) | 13 | 8 | 261 | 192 | R, B, G, N = list(map(int, input().split()))
cnt = 0
ball = 0
a = sorted([R, G, B])
for r in range(N // a[0] + 1):
ball = r * a[0]
for b in range((N - ball) // a[1] + 1):
if N - ball >= 0 and (N - ball - b * a[1]) % a[2] == 0:
cnt += 1
print(cnt)
| r, g, b, n = list(map(int, input().split()))
cnt = 0
for i in range(n + 1):
for j in range(n + 1):
rest = n - i * r - j * g
if rest >= 0 and rest % b == 0:
cnt += 1
print(cnt)
| false | 38.461538 | [
"-R, B, G, N = list(map(int, input().split()))",
"+r, g, b, n = list(map(int, input().split()))",
"-ball = 0",
"-a = sorted([R, G, B])",
"-for r in range(N // a[0] + 1):",
"- ball = r * a[0]",
"- for b in range((N - ball) // a[1] + 1):",
"- if N - ball >= 0 and (N - ball - b * a[1]) % a[2... | false | 0.522439 | 1.645554 | 0.317485 | [
"s229858133",
"s576303678"
] |
u863370423 | p03264 | python | s446080051 | s819514131 | 164 | 29 | 38,384 | 9,092 | Accepted | Accepted | 82.32 | from math import floor, ceil
n = int(eval(input()))
a = n // 2
b = n - a
print((a * b)) | from sys import stdin,stdout
def main():
line=stdin.readline()
parts=line.split()
a=int(parts[0])
par=int(a/2)
impar=int(a/2)+a%2
stdout.write(str(par*impar))
main() | 6 | 10 | 85 | 199 | from math import floor, ceil
n = int(eval(input()))
a = n // 2
b = n - a
print((a * b))
| from sys import stdin, stdout
def main():
line = stdin.readline()
parts = line.split()
a = int(parts[0])
par = int(a / 2)
impar = int(a / 2) + a % 2
stdout.write(str(par * impar))
main()
| false | 40 | [
"-from math import floor, ceil",
"+from sys import stdin, stdout",
"-n = int(eval(input()))",
"-a = n // 2",
"-b = n - a",
"-print((a * b))",
"+",
"+def main():",
"+ line = stdin.readline()",
"+ parts = line.split()",
"+ a = int(parts[0])",
"+ par = int(a / 2)",
"+ impar = int... | false | 0.035789 | 0.041903 | 0.854093 | [
"s446080051",
"s819514131"
] |
u753803401 | p03273 | python | s194926160 | s829530666 | 329 | 172 | 21,688 | 13,580 | Accepted | Accepted | 47.72 | import numpy
h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
a = numpy.asarray(a)
a = a[:, numpy.any(a == "#", axis=0)]
a = a[numpy.any(a == "#", axis=1)]
for i in range(len(a)):
print(("".join(a[i])))
| import numpy
h, w = list(map(int, input().split()))
ls = [list(eval(input())) for _ in range(h)]
ls = numpy.array(ls)
ls = ls[numpy.any(ls == "#", axis=1), :]
ls = ls[:, numpy.any(ls == "#", axis=0)]
for i in list(ls):
print(("".join(i)))
| 8 | 8 | 234 | 236 | import numpy
h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
a = numpy.asarray(a)
a = a[:, numpy.any(a == "#", axis=0)]
a = a[numpy.any(a == "#", axis=1)]
for i in range(len(a)):
print(("".join(a[i])))
| import numpy
h, w = list(map(int, input().split()))
ls = [list(eval(input())) for _ in range(h)]
ls = numpy.array(ls)
ls = ls[numpy.any(ls == "#", axis=1), :]
ls = ls[:, numpy.any(ls == "#", axis=0)]
for i in list(ls):
print(("".join(i)))
| false | 0 | [
"-a = [list(eval(input())) for _ in range(h)]",
"-a = numpy.asarray(a)",
"-a = a[:, numpy.any(a == \"#\", axis=0)]",
"-a = a[numpy.any(a == \"#\", axis=1)]",
"-for i in range(len(a)):",
"- print((\"\".join(a[i])))",
"+ls = [list(eval(input())) for _ in range(h)]",
"+ls = numpy.array(ls)",
"+ls = ... | false | 0.258432 | 0.29641 | 0.871874 | [
"s194926160",
"s829530666"
] |
u839188633 | p02821 | python | s183883907 | s745983662 | 345 | 211 | 33,524 | 34,144 | Accepted | Accepted | 38.84 | from numpy.fft import rfft, irfft
import numpy as np
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
a = np.zeros(2 ** 18)
for Ai in A:
a[Ai] += 1
fa = rfft(a)
a2 = irfft(fa ** 2)
a2 = np.round(a2).astype(np.int)
cum_a2 = np.cumsum(a2)
index = np.searchsorted(cum_a2, ... | from numpy.fft import rfft, irfft
import numpy as np
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
a = np.bincount(A, minlength=2 ** 18)
fa = rfft(a)
a2 = irfft(fa ** 2)
a2 = np.round(a2).astype(np.int)
cum_a2 = np.cumsum(a2)
index = np.searchsorted(cum_a2, N ** 2 - M)
... | 22 | 20 | 456 | 442 | from numpy.fft import rfft, irfft
import numpy as np
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
a = np.zeros(2**18)
for Ai in A:
a[Ai] += 1
fa = rfft(a)
a2 = irfft(fa**2)
a2 = np.round(a2).astype(np.int)
cum_a2 = np.cumsum(a2)
index = np.searchsorted(cum_a2, N**2 - M)
a2[index] -= c... | from numpy.fft import rfft, irfft
import numpy as np
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
a = np.bincount(A, minlength=2**18)
fa = rfft(a)
a2 = irfft(fa**2)
a2 = np.round(a2).astype(np.int)
cum_a2 = np.cumsum(a2)
index = np.searchsorted(cum_a2, N**2 - M)
a2[index] -= cum_a2[index]... | false | 9.090909 | [
"-a = np.zeros(2**18)",
"-for Ai in A:",
"- a[Ai] += 1",
"+a = np.bincount(A, minlength=2**18)"
] | false | 0.909025 | 0.428061 | 2.12359 | [
"s183883907",
"s745983662"
] |
u550294762 | p03290 | python | s986410860 | s806109961 | 217 | 109 | 41,840 | 75,576 | Accepted | Accepted | 49.77 | d, g = list(map(int, input().split()))
pc_ls = []
for i in range(d):
p, c = list(map(int, input().split()))
pc_ls.append([p, c])
ptns = []
for i in range(2 ** d):
ptn = []
for j in range(d):
if ((i >> j) & 1):
ptn.append(j)
ptns.append(ptn)
ret = 10 ** 10
for i... | import itertools
from typing import List, Tuple
def main():
d, g = list(map(int, input().split()))
v = []
for _ in range(d):
p, c = list(map(int, input().split()))
v.append((p, c))
print((ag(v, g)))
def ag(v: List[Tuple[int, int]], g: int) -> int:
ret = 10 ** 10
... | 41 | 35 | 1,037 | 933 | d, g = list(map(int, input().split()))
pc_ls = []
for i in range(d):
p, c = list(map(int, input().split()))
pc_ls.append([p, c])
ptns = []
for i in range(2**d):
ptn = []
for j in range(d):
if (i >> j) & 1:
ptn.append(j)
ptns.append(ptn)
ret = 10**10
for item in ptns:
cnt = 0
... | import itertools
from typing import List, Tuple
def main():
d, g = list(map(int, input().split()))
v = []
for _ in range(d):
p, c = list(map(int, input().split()))
v.append((p, c))
print((ag(v, g)))
def ag(v: List[Tuple[int, int]], g: int) -> int:
ret = 10**10
for comb in ite... | false | 14.634146 | [
"-d, g = list(map(int, input().split()))",
"-pc_ls = []",
"-for i in range(d):",
"- p, c = list(map(int, input().split()))",
"- pc_ls.append([p, c])",
"-ptns = []",
"-for i in range(2**d):",
"- ptn = []",
"- for j in range(d):",
"- if (i >> j) & 1:",
"- ptn.append(j... | false | 0.038027 | 0.044433 | 0.855822 | [
"s986410860",
"s806109961"
] |
u095021077 | p03043 | python | s540027008 | s544823788 | 183 | 69 | 45,876 | 3,060 | Accepted | Accepted | 62.3 | temp=input().split()
N=int(temp[0])
K=int(temp[1])
r=[]
for i in range(1, N+1):
temp=i
counter=0
while temp<K:
temp*=2
counter+=1
r.append(counter)
print((sum([pow(0.5, r[i]) for i in range(N)])/N)) | N, K=list(map(int, input().split()))
prob=0
for i in range(1, N+1):
counter=0
while i*pow(2, counter)<K:
counter+=1
prob+=pow(1/2, counter)/N
print(prob) | 15 | 11 | 237 | 176 | temp = input().split()
N = int(temp[0])
K = int(temp[1])
r = []
for i in range(1, N + 1):
temp = i
counter = 0
while temp < K:
temp *= 2
counter += 1
r.append(counter)
print((sum([pow(0.5, r[i]) for i in range(N)]) / N))
| N, K = list(map(int, input().split()))
prob = 0
for i in range(1, N + 1):
counter = 0
while i * pow(2, counter) < K:
counter += 1
prob += pow(1 / 2, counter) / N
print(prob)
| false | 26.666667 | [
"-temp = input().split()",
"-N = int(temp[0])",
"-K = int(temp[1])",
"-r = []",
"+N, K = list(map(int, input().split()))",
"+prob = 0",
"- temp = i",
"- while temp < K:",
"- temp *= 2",
"+ while i * pow(2, counter) < K:",
"- r.append(counter)",
"-print((sum([pow(0.5, r[i]) f... | false | 0.070643 | 0.190542 | 0.370748 | [
"s540027008",
"s544823788"
] |
u072053884 | p02304 | python | s049553725 | s870364634 | 1,340 | 1,220 | 35,336 | 35,284 | Accepted | Accepted | 8.96 | # Acceptance of input
import sys
file_input = sys.stdin
n = file_input.readline()
EP = []
l = -1000000001
u = 1000000001
vs_x = set()
for line in file_input:
x1, y1, x2, y2 = (list(map(int, line.split())))
if x1 == x2:
if y1 < y2:
EP.append((y1, l, x1))
EP.ap... | # Acceptance of input
import sys
file_input = sys.stdin
n = file_input.readline()
EP = []
l = -1000000001
u = 1000000001
vs_x = set()
h_num = 0
for line in file_input:
x1, y1, x2, y2 = (list(map(int, line.split())))
if x1 == x2:
if y1 < y2:
EP.append((y1, l, x1))
... | 71 | 76 | 1,484 | 1,570 | # Acceptance of input
import sys
file_input = sys.stdin
n = file_input.readline()
EP = []
l = -1000000001
u = 1000000001
vs_x = set()
for line in file_input:
x1, y1, x2, y2 = list(map(int, line.split()))
if x1 == x2:
if y1 < y2:
EP.append((y1, l, x1))
EP.append((y2, u, x1))
... | # Acceptance of input
import sys
file_input = sys.stdin
n = file_input.readline()
EP = []
l = -1000000001
u = 1000000001
vs_x = set()
h_num = 0
for line in file_input:
x1, y1, x2, y2 = list(map(int, line.split()))
if x1 == x2:
if y1 < y2:
EP.append((y1, l, x1))
EP.append((y2, u,... | false | 6.578947 | [
"+h_num = 0",
"+ h_num += 1",
"+ h_num -= 1",
"+ if h_num == 0:",
"+ break"
] | false | 0.043628 | 0.174315 | 0.250282 | [
"s049553725",
"s870364634"
] |
u241159583 | p04005 | python | s351264163 | s334255058 | 29 | 25 | 9,172 | 9,060 | Accepted | Accepted | 13.79 | a = sorted(list(map(int, input().split())))
ok = False
for i in range(3):
if a[i] % 2 ==0:
ok = True
break
if not ok:
ans = a[0]*a[1]
print((0 if ok else ans)) | a = sorted(list(map(int, input().split())))
ans = a[0]*a[1]
for i in range(3):
if a[i]%2==0:
ans = 0
break
print(ans) | 9 | 7 | 189 | 143 | a = sorted(list(map(int, input().split())))
ok = False
for i in range(3):
if a[i] % 2 == 0:
ok = True
break
if not ok:
ans = a[0] * a[1]
print((0 if ok else ans))
| a = sorted(list(map(int, input().split())))
ans = a[0] * a[1]
for i in range(3):
if a[i] % 2 == 0:
ans = 0
break
print(ans)
| false | 22.222222 | [
"-ok = False",
"+ans = a[0] * a[1]",
"- ok = True",
"+ ans = 0",
"-if not ok:",
"- ans = a[0] * a[1]",
"-print((0 if ok else ans))",
"+print(ans)"
] | false | 0.074066 | 0.03808 | 1.945041 | [
"s351264163",
"s334255058"
] |
u600402037 | p03053 | python | s489541885 | s258272986 | 530 | 402 | 121,052 | 37,892 | Accepted | Accepted | 24.15 | import sys
from collections import deque
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to only numbers
rs = lambda: stdin.readline().rstrip() # ignores trailing space
H, W = rl()
A = [list(rs()) for _ in range(H)]
... | import sys
import numpy as np
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to only numbers
rs = lambda: stdin.readline().rstrip() # ignores trailing space
H, W = rl()
A = [list(rs()) for _ in range(H)]
INF = 10... | 34 | 27 | 910 | 704 | import sys
from collections import deque
stdin = sys.stdin
sys.setrecursionlimit(10**7)
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to only numbers
rs = lambda: stdin.readline().rstrip() # ignores trailing space
H, W = rl()
A = [list(rs()) for _ in range(H)]
answer = 0
que ... | import sys
import numpy as np
stdin = sys.stdin
sys.setrecursionlimit(10**7)
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to only numbers
rs = lambda: stdin.readline().rstrip() # ignores trailing space
H, W = rl()
A = [list(rs()) for _ in range(H)]
INF = 10**5
B = np.array([... | false | 20.588235 | [
"-from collections import deque",
"+import numpy as np",
"-answer = 0",
"-que = deque()",
"-data = [[-1] * W for _ in range(H)]",
"-for i in range(H):",
"- for j in range(W):",
"- if A[i][j] == \"#\":",
"- data[i][j] = 0",
"- que.append((j, i))",
"-while que:",
... | false | 0.041343 | 0.187514 | 0.22048 | [
"s489541885",
"s258272986"
] |
u333945892 | p03287 | python | s296661856 | s080778430 | 217 | 111 | 20,504 | 15,452 | Accepted | Accepted | 48.85 | #list_int 並べて出力 print (' '.join(map(str,ans_li)))
#list_str 並べて出力 print (' '.join(list))
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = ... | from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]
def inpl(): return list(map(int, input().split()))
def ... | 46 | 26 | 907 | 541 | # list_int 並べて出力 print (' '.join(map(str,ans_li)))
# list_str 並べて出力 print (' '.join(list))
from collections import defaultdict
import sys, heapq, bisect, math, itertools, string, queue, datetime
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
AtoZ = [chr(i) for i in range(65, 65 + 26)]
ato... | from collections import defaultdict
import sys, heapq, bisect, math, itertools, string, queue, datetime
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
AtoZ = [chr(i) for i in range(65, 65 + 26)]
atoz = [chr(i) for i in range(97, 97 + 26)]
def inpl():
return list(map(int, input().spl... | false | 43.478261 | [
"-# list_int 並べて出力 print (' '.join(map(str,ans_li)))",
"-# list_str 並べて出力 print (' '.join(list))",
"-ed = [0]",
"-SUM_L = defaultdict(int)",
"-SUM_R = defaultdict(int)",
"-SUM_L[0] += 1",
"-SUM_R[0] += 1",
"-SUM = sum(aa) % M",
"-tmpL = tmpR = 0",
"-for i in range(N):",
"- tmpL += aa[i]",
"... | false | 0.048511 | 0.074973 | 0.647051 | [
"s296661856",
"s080778430"
] |
u301624971 | p02725 | python | s641675998 | s334085889 | 127 | 111 | 26,100 | 26,444 | Accepted | Accepted | 12.6 | K,N=list(map(int,input().split()))
A=list(map(int,input().split()))
MAX=A.pop(N-1)
pre=MAX
counter=[]
for a in reversed(A):
counter.append(pre - a)
pre=a
counter.append(pre + K - MAX)
counter.sort()
print((sum(counter[:N-1])))
| def myAnswer(K:int,N:int,A:list) -> int:
distance=[]
pre = A.pop(0)
MIN = pre
for a in A:
distance.append(a - pre)
pre = a
distance.append(MIN + K - A[-1])
distance.sort()
return sum(distance[:N - 1])
def modelAnswer():
tmp=1
def main():
K,N = list(map(int,input().s... | 15 | 21 | 245 | 434 | K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
MAX = A.pop(N - 1)
pre = MAX
counter = []
for a in reversed(A):
counter.append(pre - a)
pre = a
counter.append(pre + K - MAX)
counter.sort()
print((sum(counter[: N - 1])))
| def myAnswer(K: int, N: int, A: list) -> int:
distance = []
pre = A.pop(0)
MIN = pre
for a in A:
distance.append(a - pre)
pre = a
distance.append(MIN + K - A[-1])
distance.sort()
return sum(distance[: N - 1])
def modelAnswer():
tmp = 1
def main():
K, N = list(map(... | false | 28.571429 | [
"-K, N = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-MAX = A.pop(N - 1)",
"-pre = MAX",
"-counter = []",
"-for a in reversed(A):",
"- counter.append(pre - a)",
"- pre = a",
"-counter.append(pre + K - MAX)",
"-counter.sort()",
"-print((sum(counter[: N - 1])))... | false | 0.091179 | 0.044745 | 2.037743 | [
"s641675998",
"s334085889"
] |
u796942881 | p02923 | python | s423411785 | s344080558 | 68 | 52 | 11,660 | 11,136 | Accepted | Accepted | 23.53 | def main():
H = open(0).read().split()[1:]
ans = 0
tmp = 0
for h1, h2 in zip(H[:-1], H[1:]):
if int(h1) >= int(h2):
tmp += 1
else:
if ans < tmp:
ans = tmp
tmp = 0
if ans < tmp:
ans = tmp
print(ans)
retu... | def main():
eval(input())
H = list(map(int, input().split()))
ans = 0
prev = float('inf')
cnt = -1
for cur in H:
if prev >= cur:
cnt += 1
else:
if ans < cnt:
ans = cnt
cnt = 0
prev = cur
if ans < cnt:
... | 18 | 21 | 335 | 366 | def main():
H = open(0).read().split()[1:]
ans = 0
tmp = 0
for h1, h2 in zip(H[:-1], H[1:]):
if int(h1) >= int(h2):
tmp += 1
else:
if ans < tmp:
ans = tmp
tmp = 0
if ans < tmp:
ans = tmp
print(ans)
return
main()
| def main():
eval(input())
H = list(map(int, input().split()))
ans = 0
prev = float("inf")
cnt = -1
for cur in H:
if prev >= cur:
cnt += 1
else:
if ans < cnt:
ans = cnt
cnt = 0
prev = cur
if ans < cnt:
ans = c... | false | 14.285714 | [
"- H = open(0).read().split()[1:]",
"+ eval(input())",
"+ H = list(map(int, input().split()))",
"- tmp = 0",
"- for h1, h2 in zip(H[:-1], H[1:]):",
"- if int(h1) >= int(h2):",
"- tmp += 1",
"+ prev = float(\"inf\")",
"+ cnt = -1",
"+ for cur in H:",
"+ ... | false | 0.04283 | 0.037105 | 1.15429 | [
"s423411785",
"s344080558"
] |
u144913062 | p02900 | python | s557307321 | s731394458 | 375 | 276 | 3,060 | 64,108 | Accepted | Accepted | 26.4 | A, B = list(map(int, input().split()))
ans = 1
for i in range(2, 1+int(min(A**.5, B**.5))):
if A % i == 0 and B % i == 0:
ans += 1
while A % i == 0:
A //= i
while B % i == 0:
B //= i
if A != 1 and B != 1 and (A % B == 0 or B % A == 0):
ans += 1
print(ans)
| from fractions import gcd
def prime_factor(n):
factors = set()
i = 2
while i * i <= n:
while n % i == 0:
factors.add(i)
n //= i
i += 1
if n != 1:
factors.add(n)
return factors
A, B = list(map(int, input().split()))
print((len(prime_fac... | 12 | 16 | 301 | 333 | A, B = list(map(int, input().split()))
ans = 1
for i in range(2, 1 + int(min(A**0.5, B**0.5))):
if A % i == 0 and B % i == 0:
ans += 1
while A % i == 0:
A //= i
while B % i == 0:
B //= i
if A != 1 and B != 1 and (A % B == 0 or B % A == 0):
ans += 1
print(ans)
| from fractions import gcd
def prime_factor(n):
factors = set()
i = 2
while i * i <= n:
while n % i == 0:
factors.add(i)
n //= i
i += 1
if n != 1:
factors.add(n)
return factors
A, B = list(map(int, input().split()))
print((len(prime_factor(gcd(A, B)... | false | 25 | [
"+from fractions import gcd",
"+",
"+",
"+def prime_factor(n):",
"+ factors = set()",
"+ i = 2",
"+ while i * i <= n:",
"+ while n % i == 0:",
"+ factors.add(i)",
"+ n //= i",
"+ i += 1",
"+ if n != 1:",
"+ factors.add(n)",
"+ retur... | false | 0.071701 | 0.25021 | 0.286564 | [
"s557307321",
"s731394458"
] |
u466056315 | p02681 | python | s338585018 | s719568179 | 25 | 21 | 9,108 | 9,076 | Accepted | Accepted | 16 | S = eval(input())
T = eval(input())
if S.islower() and T.islower() and len(S) >= 1 and len(S) <= 10 and len(T) == len(S) + 1 and T[:-1] == S:
print("Yes")
else:
print("No") | S = eval(input())
T = eval(input())
if S.islower() and T.islower() and T[:-1] == S:
print("Yes")
else:
print("No") | 6 | 6 | 169 | 111 | S = eval(input())
T = eval(input())
if (
S.islower()
and T.islower()
and len(S) >= 1
and len(S) <= 10
and len(T) == len(S) + 1
and T[:-1] == S
):
print("Yes")
else:
print("No")
| S = eval(input())
T = eval(input())
if S.islower() and T.islower() and T[:-1] == S:
print("Yes")
else:
print("No")
| false | 0 | [
"-if (",
"- S.islower()",
"- and T.islower()",
"- and len(S) >= 1",
"- and len(S) <= 10",
"- and len(T) == len(S) + 1",
"- and T[:-1] == S",
"-):",
"+if S.islower() and T.islower() and T[:-1] == S:"
] | false | 0.042804 | 0.042008 | 1.018948 | [
"s338585018",
"s719568179"
] |
u004423772 | p02756 | python | s592438895 | s324533089 | 483 | 347 | 8,820 | 67,360 | Accepted | Accepted | 28.16 | from collections import deque
S = input().rstrip('\r\n')
S_list = deque(S)
is_reverse = False
Q = int(eval(input()))
for _ in range(Q):
query = input().rstrip('\r\n')
t, f, c = '', '', ''
if len(query) == 1:
t = query
else:
t, f, c = query.split(' ')
if t == '1':
... | import sys
input = sys.stdin.readline
from collections import deque
def main():
S = input().rstrip("\r\n")
Q = int(eval(input()))
d = deque(S)
reverse = False
for _ in range(Q):
q = input().rstrip("\r\n")
if q == "1":
reverse = not reverse
else:
... | 30 | 23 | 694 | 599 | from collections import deque
S = input().rstrip("\r\n")
S_list = deque(S)
is_reverse = False
Q = int(eval(input()))
for _ in range(Q):
query = input().rstrip("\r\n")
t, f, c = "", "", ""
if len(query) == 1:
t = query
else:
t, f, c = query.split(" ")
if t == "1":
is_reverse ... | import sys
input = sys.stdin.readline
from collections import deque
def main():
S = input().rstrip("\r\n")
Q = int(eval(input()))
d = deque(S)
reverse = False
for _ in range(Q):
q = input().rstrip("\r\n")
if q == "1":
reverse = not reverse
else:
_, ... | false | 23.333333 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-S = input().rstrip(\"\\r\\n\")",
"-S_list = deque(S)",
"-is_reverse = False",
"-Q = int(eval(input()))",
"-for _ in range(Q):",
"- query = input().rstrip(\"\\r\\n\")",
"- t, f, c = \"\", \"\", \"\"",
"- if len(query) == 1:",
"- ... | false | 0.080566 | 0.037682 | 2.138035 | [
"s592438895",
"s324533089"
] |
u426534722 | p02277 | python | s379503431 | s442118547 | 1,380 | 1,270 | 23,472 | 23,472 | Accepted | Accepted | 7.97 | INF = int(1e10)
def merge(A, left, mid, right):
L = A[left: mid] + [[0, INF]]
R = A[mid: right] + [[0, INF]]
i = j = 0
for k in range(left, right):
if L[i][1] <= R[j][1]:
A[k] = L[i]
i += 1
else:
A[k] = R[j]
j += 1
def mergeSort... | import sys
readline = sys.stdin.readline
INF = int(1e10)
def merge(A, left, mid, right):
L = A[left: mid] + [[0, INF]]
R = A[mid: right] + [[0, INF]]
i = j = 0
for k in range(left, right):
if L[i][1] <= R[j][1]:
A[k] = L[i]
i += 1
else:
A[k... | 41 | 43 | 1,102 | 1,148 | INF = int(1e10)
def merge(A, left, mid, right):
L = A[left:mid] + [[0, INF]]
R = A[mid:right] + [[0, INF]]
i = j = 0
for k in range(left, right):
if L[i][1] <= R[j][1]:
A[k] = L[i]
i += 1
else:
A[k] = R[j]
j += 1
def mergeSort(A, left, ... | import sys
readline = sys.stdin.readline
INF = int(1e10)
def merge(A, left, mid, right):
L = A[left:mid] + [[0, INF]]
R = A[mid:right] + [[0, INF]]
i = j = 0
for k in range(left, right):
if L[i][1] <= R[j][1]:
A[k] = L[i]
i += 1
else:
A[k] = R[j]
... | false | 4.651163 | [
"+import sys",
"+",
"+readline = sys.stdin.readline",
"-A = [f(input().split()) for _ in range(n)]",
"+A = [f(readline().split()) for _ in range(n)]"
] | false | 0.040809 | 0.096963 | 0.420871 | [
"s379503431",
"s442118547"
] |
u411203878 | p03760 | python | s602718514 | s617448423 | 166 | 95 | 38,384 | 61,068 | Accepted | Accepted | 42.77 | s1=eval(input())
s2=eval(input())
ans = []
for i in range(len(s1)+len(s2)):
if i%2==0:
ans.append(s1[i//2])
else:
ans.append(s2[i//2])
print((''.join(map(str,ans)))) | a = list(eval(input()))
b = list(eval(input()))
ans = []
for i in range(len(a)):
ans.append(a[i])
if i < len(b):
ans.append(b[i])
print((''.join(ans))) | 13 | 10 | 191 | 164 | s1 = eval(input())
s2 = eval(input())
ans = []
for i in range(len(s1) + len(s2)):
if i % 2 == 0:
ans.append(s1[i // 2])
else:
ans.append(s2[i // 2])
print(("".join(map(str, ans))))
| a = list(eval(input()))
b = list(eval(input()))
ans = []
for i in range(len(a)):
ans.append(a[i])
if i < len(b):
ans.append(b[i])
print(("".join(ans)))
| false | 23.076923 | [
"-s1 = eval(input())",
"-s2 = eval(input())",
"+a = list(eval(input()))",
"+b = list(eval(input()))",
"-for i in range(len(s1) + len(s2)):",
"- if i % 2 == 0:",
"- ans.append(s1[i // 2])",
"- else:",
"- ans.append(s2[i // 2])",
"-print((\"\".join(map(str, ans))))",
"+for i in... | false | 0.061697 | 0.066147 | 0.932738 | [
"s602718514",
"s617448423"
] |
u888092736 | p03724 | python | s203146679 | s891469678 | 225 | 114 | 9,912 | 31,708 | Accepted | Accepted | 49.33 | from itertools import accumulate
N, M = map(int, input().split())
acc = [0] * N
for _ in range(M):
a, b = map(int, input().split())
if a > b:
a, b = b, a
acc[a - 1] += 1
acc[b - 1] -= 1
print("NO") if any(a % 2 for a in accumulate(acc)) else print("YES")
| from itertools import accumulate
N, M, *ab = map(int, open(0).read().split())
acc = [0] * (N + 1)
for a, b in zip(*[iter(ab)] * 2):
if a > b:
a, b = b, a
acc[a - 1] += 1
acc[b - 1] -= 1
acc = list(accumulate(acc, initial=0))
print("NO") if any(a % 2 for a in acc) else print("YES")
| 11 | 11 | 290 | 313 | from itertools import accumulate
N, M = map(int, input().split())
acc = [0] * N
for _ in range(M):
a, b = map(int, input().split())
if a > b:
a, b = b, a
acc[a - 1] += 1
acc[b - 1] -= 1
print("NO") if any(a % 2 for a in accumulate(acc)) else print("YES")
| from itertools import accumulate
N, M, *ab = map(int, open(0).read().split())
acc = [0] * (N + 1)
for a, b in zip(*[iter(ab)] * 2):
if a > b:
a, b = b, a
acc[a - 1] += 1
acc[b - 1] -= 1
acc = list(accumulate(acc, initial=0))
print("NO") if any(a % 2 for a in acc) else print("YES")
| false | 0 | [
"-N, M = map(int, input().split())",
"-acc = [0] * N",
"-for _ in range(M):",
"- a, b = map(int, input().split())",
"+N, M, *ab = map(int, open(0).read().split())",
"+acc = [0] * (N + 1)",
"+for a, b in zip(*[iter(ab)] * 2):",
"-print(\"NO\") if any(a % 2 for a in accumulate(acc)) else print(\"YES\... | false | 0.056917 | 0.041672 | 1.365837 | [
"s203146679",
"s891469678"
] |
u545368057 | p03160 | python | s352485404 | s097587812 | 180 | 166 | 13,908 | 14,876 | Accepted | Accepted | 7.78 | N = int(eval(input()))
hs = list(map(int, input().split()))
"""
dp[i] i番目に到達するときの最小値
遷移
送るDP
i-1段目まで下記を実施
dp[i+1] = min(dp[i+1], dp[i]+コスト)
if (一段飛ばしできる余地があれば):
dp[i+2] = min(dp[i+2],dp[i]+コスト)
"""
INF = 10**9+7
dp = [INF]*101000
dp[0] = 0
for i in range(1,N):
if i-2 >= 0:
cost2 = a... |
"""
dp[i] : 足場iに到達するにあたって、たどり着く最小回数
"""
INF = 10**10
dp = [INF]*110000
N = int(eval(input()))
hs = list(map(int, input().split())) + [INF,INF]
dp[0] = 0
for i in range(N):
dp[i+1] = min(dp[i+1], dp[i]+abs(hs[i+1]-hs[i]))
dp[i+2] = min(dp[i+2], dp[i]+abs(hs[i+2]-hs[i]))
print((dp[N-1]))
| 24 | 14 | 461 | 303 | N = int(eval(input()))
hs = list(map(int, input().split()))
"""
dp[i] i番目に到達するときの最小値
遷移
送るDP
i-1段目まで下記を実施
dp[i+1] = min(dp[i+1], dp[i]+コスト)
if (一段飛ばしできる余地があれば):
dp[i+2] = min(dp[i+2],dp[i]+コスト)
"""
INF = 10**9 + 7
dp = [INF] * 101000
dp[0] = 0
for i in range(1, N):
if i - 2 >= 0:
cost2 = abs(hs[i] - hs... | """
dp[i] : 足場iに到達するにあたって、たどり着く最小回数
"""
INF = 10**10
dp = [INF] * 110000
N = int(eval(input()))
hs = list(map(int, input().split())) + [INF, INF]
dp[0] = 0
for i in range(N):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(hs[i + 1] - hs[i]))
dp[i + 2] = min(dp[i + 2], dp[i] + abs(hs[i + 2] - hs[i]))
print((dp[N - 1]))
| false | 41.666667 | [
"+\"\"\"",
"+dp[i] : 足場iに到達するにあたって、たどり着く最小回数",
"+\"\"\"",
"+INF = 10**10",
"+dp = [INF] * 110000",
"-hs = list(map(int, input().split()))",
"-\"\"\"",
"-dp[i] i番目に到達するときの最小値",
"-遷移",
"-送るDP",
"-i-1段目まで下記を実施",
"-dp[i+1] = min(dp[i+1], dp[i]+コスト)",
"-if (一段飛ばしできる余地があれば):",
"- dp[i+2] = mi... | false | 0.040336 | 0.076388 | 0.528047 | [
"s352485404",
"s097587812"
] |
u433532588 | p02996 | python | s003780991 | s707901641 | 1,018 | 884 | 36,588 | 29,440 | Accepted | Accepted | 13.16 |
N = int(eval(input()))
# (締切, 時間)
DeadlineCost = [] * N
for i in range(N):
c, d = list(map(int, input().split()))
# tupleじゃなくて array だとどれぐらい遅くなる?
DeadlineCost.append([d, c])
DeadlineCost.sort(reverse=True)
#print(DeadlineCost)
t = 0
for i in range(N):
(d, c) = DeadlineCost.pop()
... |
N = int(eval(input()))
# (締切, 時間)
DeadlineCost = [] * N
for i in range(N):
c, d = list(map(int, input().split()))
DeadlineCost.append((d, c))
DeadlineCost.sort()
#print(DeadlineCost)
t = 0
for i in range(N):
# .pop じゃなくて参照に変更するとどれぐらい速くなる?
(d, c) = DeadlineCost[i]
t += c
... | 25 | 25 | 388 | 372 | N = int(eval(input()))
# (締切, 時間)
DeadlineCost = [] * N
for i in range(N):
c, d = list(map(int, input().split()))
# tupleじゃなくて array だとどれぐらい遅くなる?
DeadlineCost.append([d, c])
DeadlineCost.sort(reverse=True)
# print(DeadlineCost)
t = 0
for i in range(N):
(d, c) = DeadlineCost.pop()
t += c
if t > d... | N = int(eval(input()))
# (締切, 時間)
DeadlineCost = [] * N
for i in range(N):
c, d = list(map(int, input().split()))
DeadlineCost.append((d, c))
DeadlineCost.sort()
# print(DeadlineCost)
t = 0
for i in range(N):
# .pop じゃなくて参照に変更するとどれぐらい速くなる?
(d, c) = DeadlineCost[i]
t += c
if t > d:
print(... | false | 0 | [
"- # tupleじゃなくて array だとどれぐらい遅くなる?",
"- DeadlineCost.append([d, c])",
"-DeadlineCost.sort(reverse=True)",
"+ DeadlineCost.append((d, c))",
"+DeadlineCost.sort()",
"- (d, c) = DeadlineCost.pop()",
"+ # .pop じゃなくて参照に変更するとどれぐらい速くなる?",
"+ (d, c) = DeadlineCost[i]"
] | false | 0.051203 | 0.036469 | 1.403998 | [
"s003780991",
"s707901641"
] |
u241159583 | p03361 | python | s099114381 | s842911369 | 265 | 29 | 9,248 | 9,148 | Accepted | Accepted | 89.06 | h,w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
black = []
for i in range(h):
for j in range(w):
if s[i][j] == "#":
black.append([i,j])
for x,y in black:
flag = False
for a,b in [(0,1), (1,0), (0,-1), (-1,0)]:
if [x+a, y+b] in black: fl... | h,w = list(map(int, input().split()))
s = [eval(input()) for _ in range(h)]
for i in range(h):
for j in range(w):
if s[i][j] == "#":
flag = False
for i_new, j_new in [(i+1, j), (i-1, j), (i,j+1), (i,j-1)]:
if i_new<0 or i_new>=h or j_new<0 or j_new>=w: contin... | 15 | 16 | 386 | 508 | h, w = list(map(int, input().split()))
s = [list(eval(input())) for _ in range(h)]
black = []
for i in range(h):
for j in range(w):
if s[i][j] == "#":
black.append([i, j])
for x, y in black:
flag = False
for a, b in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
if [x + a, y + b] in black:
... | h, w = list(map(int, input().split()))
s = [eval(input()) for _ in range(h)]
for i in range(h):
for j in range(w):
if s[i][j] == "#":
flag = False
for i_new, j_new in [(i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)]:
if i_new < 0 or i_new >= h or j_new < 0 or j_new >=... | false | 6.25 | [
"-s = [list(eval(input())) for _ in range(h)]",
"-black = []",
"+s = [eval(input()) for _ in range(h)]",
"- black.append([i, j])",
"-for x, y in black:",
"- flag = False",
"- for a, b in [(0, 1), (1, 0), (0, -1), (-1, 0)]:",
"- if [x + a, y + b] in black:",
"- flag... | false | 0.0867 | 0.133054 | 0.65162 | [
"s099114381",
"s842911369"
] |
u287500079 | p02861 | python | s584239668 | s951965076 | 494 | 322 | 8,052 | 70,760 | Accepted | Accepted | 34.82 | import math
from itertools import permutations
n = int(eval(input()))
xy = [[int(i) for i in input().split()] for _ in range(n)]
arr = list(permutations(list(range(n)), n))
ans = 0
for i in range(len(arr)):
for j in range(1, n):
ans += math.sqrt(pow(xy[arr[i][j]][0] - xy[arr[i][j-1]][0], 2) + pow(xy... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 11 | 30 | 378 | 1,027 | import math
from itertools import permutations
n = int(eval(input()))
xy = [[int(i) for i in input().split()] for _ in range(n)]
arr = list(permutations(list(range(n)), n))
ans = 0
for i in range(len(arr)):
for j in range(1, n):
ans += math.sqrt(
pow(xy[arr[i][j]][0] - xy[arr[i][j - 1]][0], 2)
... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 63.333333 | [
"-import math",
"-from itertools import permutations",
"+import sys, re, os",
"+from collections import deque, defaultdict, Counter",
"+from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"+from itertools import permutations, combinations, product, accumulate",
"+from operator import ... | false | 0.046653 | 0.044591 | 1.046256 | [
"s584239668",
"s951965076"
] |
u319245933 | p02606 | python | s506409622 | s188113749 | 85 | 66 | 61,648 | 61,760 | Accepted | Accepted | 22.35 | L,R,d = list(map(int,input().split()))
print((len([i for i in range(L,R+1) if i % d == 0]))) | L,R,d=list(map(int,input().split()));print((R//d-(L-1)//d)) | 2 | 1 | 85 | 51 | L, R, d = list(map(int, input().split()))
print((len([i for i in range(L, R + 1) if i % d == 0])))
| L, R, d = list(map(int, input().split()))
print((R // d - (L - 1) // d))
| false | 50 | [
"-print((len([i for i in range(L, R + 1) if i % d == 0])))",
"+print((R // d - (L - 1) // d))"
] | false | 0.041577 | 0.040755 | 1.020158 | [
"s506409622",
"s188113749"
] |
u729133443 | p03448 | python | s682150044 | s032241396 | 188 | 50 | 40,304 | 3,060 | Accepted | Accepted | 73.4 | a,b,c,x=[int(eval(input()))+1for _ in[0]*4];print((sum(x-1==(10*s+2*t+r)*50for s in range(a)for t in range(b)for r in range(c)))) | R=range;a,b,c,x=[int(eval(input()))+1for _ in[0]*4];print((sum(x-1==(10*s+2*t+r)*50for s in R(a)for t in R(b)for r in R(c)))) | 1 | 1 | 121 | 117 | a, b, c, x = [int(eval(input())) + 1 for _ in [0] * 4]
print(
(
sum(
x - 1 == (10 * s + 2 * t + r) * 50
for s in range(a)
for t in range(b)
for r in range(c)
)
)
)
| R = range
a, b, c, x = [int(eval(input())) + 1 for _ in [0] * 4]
print(
(sum(x - 1 == (10 * s + 2 * t + r) * 50 for s in R(a) for t in R(b) for r in R(c)))
)
| false | 0 | [
"+R = range",
"- (",
"- sum(",
"- x - 1 == (10 * s + 2 * t + r) * 50",
"- for s in range(a)",
"- for t in range(b)",
"- for r in range(c)",
"- )",
"- )",
"+ (sum(x - 1 == (10 * s + 2 * t + r) * 50 for s in R(a) for t in R(b) for r ... | false | 0.057686 | 0.055655 | 1.036509 | [
"s682150044",
"s032241396"
] |
u667978773 | p02994 | python | s339607166 | s281355519 | 181 | 167 | 38,384 | 38,256 | Accepted | Accepted | 7.73 | n,l=(list(map(int,input().split())))
if l>0:
print((int((n*l+(n+1)*n/2-n-l))))
elif l+n-1<0:
print((int((n*l+(n+1)*n/2-n-(l+n-1)))))
else:
print((int((n*l+(n+1)*n/2-n)))) | n,l=(list(map(int,input().split())))
if l>0:
print((sum(range(l+1,l+n))))
elif l+n-1<0:
print((sum(range(l,l+n-1))))
else:
print((sum(range(l,l+n)))) | 7 | 7 | 170 | 149 | n, l = list(map(int, input().split()))
if l > 0:
print((int((n * l + (n + 1) * n / 2 - n - l))))
elif l + n - 1 < 0:
print((int((n * l + (n + 1) * n / 2 - n - (l + n - 1)))))
else:
print((int((n * l + (n + 1) * n / 2 - n))))
| n, l = list(map(int, input().split()))
if l > 0:
print((sum(range(l + 1, l + n))))
elif l + n - 1 < 0:
print((sum(range(l, l + n - 1))))
else:
print((sum(range(l, l + n))))
| false | 0 | [
"- print((int((n * l + (n + 1) * n / 2 - n - l))))",
"+ print((sum(range(l + 1, l + n))))",
"- print((int((n * l + (n + 1) * n / 2 - n - (l + n - 1)))))",
"+ print((sum(range(l, l + n - 1))))",
"- print((int((n * l + (n + 1) * n / 2 - n))))",
"+ print((sum(range(l, l + n))))"
] | false | 0.068899 | 0.070158 | 0.982058 | [
"s339607166",
"s281355519"
] |
u285891772 | p03044 | python | s383940733 | s619131256 | 812 | 727 | 108,092 | 99,940 | Accepted | Accepted | 10.47 | import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | 55 | 50 | 1,330 | 1,292 | import sys, re
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from collections import deque, defaultdict, Counter
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
) # , log2
from collections import deque, defaultdict, Counter
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 9.090909 | [
"-graph = defaultdict(list)",
"+graph = [[] for _ in range(N)]",
"-colors = [0] * N",
"-colors[0] = 1",
"+color = [-1] * N",
"+color[0] = 0",
"- for x, w in graph[node]:",
"- if not colors[x]:",
"+ for i, w in graph[node]:",
"+ if color[i] == -1:",
"- colors[x]... | false | 0.073782 | 0.070417 | 1.047792 | [
"s383940733",
"s619131256"
] |
u151625340 | p03006 | python | s539511880 | s143903504 | 209 | 177 | 41,584 | 39,664 | Accepted | Accepted | 15.31 | N = int(eval(input()))
X = []
for i in range(N):
xi,yi = list(map(int,input().split()))
X.append([xi,yi])
L = []
d = {}
for i in range(N):
for j in range(N):
if i == j:
continue
x,y = X[i][0]-X[j][0],X[i][1]-X[j][1]
#L.append([x,y])
if not x i... | from collections import Counter
N = int(eval(input()))
if N == 1:
print((1))
else:
X = []
for i in range(N):
xi,yi = list(map(int,input().split()))
X.append((xi,yi))
L = []
for i in range(N):
for j in range(N):
if i == j:
continue
... | 26 | 18 | 537 | 438 | N = int(eval(input()))
X = []
for i in range(N):
xi, yi = list(map(int, input().split()))
X.append([xi, yi])
L = []
d = {}
for i in range(N):
for j in range(N):
if i == j:
continue
x, y = X[i][0] - X[j][0], X[i][1] - X[j][1]
# L.append([x,y])
if not x in d:
... | from collections import Counter
N = int(eval(input()))
if N == 1:
print((1))
else:
X = []
for i in range(N):
xi, yi = list(map(int, input().split()))
X.append((xi, yi))
L = []
for i in range(N):
for j in range(N):
if i == j:
continue
x... | false | 30.769231 | [
"+from collections import Counter",
"+",
"-X = []",
"-for i in range(N):",
"- xi, yi = list(map(int, input().split()))",
"- X.append([xi, yi])",
"-L = []",
"-d = {}",
"-for i in range(N):",
"- for j in range(N):",
"- if i == j:",
"- continue",
"- x, y = X[i]... | false | 0.046002 | 0.04586 | 1.003103 | [
"s539511880",
"s143903504"
] |
u952708174 | p03163 | python | s283314295 | s268655612 | 843 | 332 | 135,168 | 20,996 | Accepted | Accepted | 60.62 | from collections import defaultdict
N, W = [int(i) for i in input().split()]
Things = [[int(i) for i in input().split()] for j in range(N)]
dp = defaultdict(int)
dp[0] = 0
for w, v in Things:
for nw, nv in list(dp.items()):
if nw + w <= W:
dp[nw + w] = max(dp[nw + w], nv + v)
print((m... | def d_knapsack1(N, W, Goods):
"""
N個の品物のi番目について、重さはw_i, 価値はv_iである。
品物のいくつかを選んでナップサックに入れるが、品物の重さの総和はW以下とする。
品物の価値の総和の最大値を求めよ。
※ 1 <= w_i <= W <= 10^5 と、重さの制約がゆるめ
"""
import numpy as np
# dp[w]: 重さwの品物の入れ方で達成できる価値の最大値
dp = np.zeros(W + 1, dtype=np.int64)
for w, v in Goods... | 11 | 20 | 335 | 659 | from collections import defaultdict
N, W = [int(i) for i in input().split()]
Things = [[int(i) for i in input().split()] for j in range(N)]
dp = defaultdict(int)
dp[0] = 0
for w, v in Things:
for nw, nv in list(dp.items()):
if nw + w <= W:
dp[nw + w] = max(dp[nw + w], nv + v)
print((max(dp.valu... | def d_knapsack1(N, W, Goods):
"""
N個の品物のi番目について、重さはw_i, 価値はv_iである。
品物のいくつかを選んでナップサックに入れるが、品物の重さの総和はW以下とする。
品物の価値の総和の最大値を求めよ。
※ 1 <= w_i <= W <= 10^5 と、重さの制約がゆるめ
"""
import numpy as np
# dp[w]: 重さwの品物の入れ方で達成できる価値の最大値
dp = np.zeros(W + 1, dtype=np.int64)
for w, v in Goods:
... | false | 45 | [
"-from collections import defaultdict",
"+def d_knapsack1(N, W, Goods):",
"+ \"\"\"",
"+ N個の品物のi番目について、重さはw_i, 価値はv_iである。",
"+ 品物のいくつかを選んでナップサックに入れるが、品物の重さの総和はW以下とする。",
"+ 品物の価値の総和の最大値を求めよ。",
"+ ※ 1 <= w_i <= W <= 10^5 と、重さの制約がゆるめ",
"+ \"\"\"",
"+ import numpy as np",
"+",
"... | false | 0.042631 | 0.940747 | 0.045317 | [
"s283314295",
"s268655612"
] |
u714225686 | p03031 | python | s133758937 | s471023509 | 309 | 20 | 21,208 | 3,188 | Accepted | Accepted | 93.53 | # n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)] # 二次元配列入力 二次元マップみたいな入力のとき
# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b)) # 0埋めのときの出力
# 000100-0.987654
import numpy as np
import math
import copy
N,... | # n=int(sys.stdin.readline())
# a,b=map(int, sys.stdin.readline().split())
# c=list(map(int, sys.stdin.readline().split()))
# s=[list(map(int,list(sys.stdin.readline()))) for i in range(h)] # 二次元配列入力 二次元マップみたいな入力のとき
# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b)) # 0埋めのときの出力
# 000100-0.987654
... | 49 | 49 | 1,157 | 1,412 | # n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)] # 二次元配列入力 二次元マップみたいな入力のとき
# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b)) # 0埋めのときの出力
# 000100-0.987654
import numpy as np
import math
import copy
N, M = list(map(in... | # n=int(sys.stdin.readline())
# a,b=map(int, sys.stdin.readline().split())
# c=list(map(int, sys.stdin.readline().split()))
# s=[list(map(int,list(sys.stdin.readline()))) for i in range(h)] # 二次元配列入力 二次元マップみたいな入力のとき
# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b)) # 0埋めのときの出力
# 000100-0.987654
import mat... | false | 0 | [
"-# n=int(input())",
"-# a,b=map(int, input().split())",
"-# c=list(map(int, input().split()))",
"-# s=[list(map(int,list(input()))) for i in range(h)] # 二次元配列入力 二次元マップみたいな入力のとき",
"+# n=int(sys.stdin.readline())",
"+# a,b=map(int, sys.stdin.readline().split())",
"+# c=list(map(int, sys.stdin.readline()... | false | 0.044662 | 0.044268 | 1.008899 | [
"s133758937",
"s471023509"
] |
u113971909 | p02707 | python | s524258956 | s305410861 | 149 | 112 | 32,368 | 33,036 | Accepted | Accepted | 24.83 | n=int(eval(input()))
A=list(map(int,input().split()))
R=[0]*n
for a in A:
R[a-1]+=1
for r in R:
print(r) | #!/usr/bin python3
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
ret = [0]*N
for a in A:
ret[a-1]+=1
print(('\n'.join(map(str, ret))))
if __name__ == '__main__':
main() | 7 | 16 | 108 | 297 | n = int(eval(input()))
A = list(map(int, input().split()))
R = [0] * n
for a in A:
R[a - 1] += 1
for r in R:
print(r)
| #!/usr/bin python3
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
ret = [0] * N
for a in A:
ret[a - 1] += 1
print(("\n".join(map(str, ret))))
if __name__ == "__main__":
main()
| false | 56.25 | [
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-R = [0] * n",
"-for a in A:",
"- R[a - 1] += 1",
"-for r in R:",
"- print(r)",
"+#!/usr/bin python3",
"+# -*- coding: utf-8 -*-",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def main():",
"+ ... | false | 0.038868 | 0.043006 | 0.903779 | [
"s524258956",
"s305410861"
] |
u656153606 | p02392 | python | s383687323 | s445898318 | 30 | 20 | 7,452 | 7,640 | Accepted | Accepted | 33.33 | Input = input().split()
if Input[2] > Input[1]:
if Input[1] > Input[0]:
print("Yes")
else:
print("No")
else:
print("No") | a, b, c = [int(i) for i in input().split()]
if a < b:
if b < c:
print('Yes')
else:
print('No')
else:
print('No') | 8 | 9 | 155 | 149 | Input = input().split()
if Input[2] > Input[1]:
if Input[1] > Input[0]:
print("Yes")
else:
print("No")
else:
print("No")
| a, b, c = [int(i) for i in input().split()]
if a < b:
if b < c:
print("Yes")
else:
print("No")
else:
print("No")
| false | 11.111111 | [
"-Input = input().split()",
"-if Input[2] > Input[1]:",
"- if Input[1] > Input[0]:",
"+a, b, c = [int(i) for i in input().split()]",
"+if a < b:",
"+ if b < c:"
] | false | 0.037903 | 0.15792 | 0.240013 | [
"s383687323",
"s445898318"
] |
u213580455 | p02995 | python | s733826398 | s550365785 | 37 | 17 | 5,304 | 3,064 | Accepted | Accepted | 54.05 | from fractions import gcd
# def gcd(x, y):
# while(y != 0):
# temp = y
# y = x%y
# x = temp
# return y
def getMultiCount(start, end, times):
if end < times: return 0
s = start-(start%times)
if s != start: s += times
e = end-(end%times)
if s > e: return 0... | def gcd(a, b):
a, b = sorted([a, b], reverse=True)
while(b != 0):
a, b = (b, a%b)
return a
def getMultiCount(start, end, times):
if end < times: return 0
s = start-(start%times)
if s != start: s += times
e = end-(end%times)
if s > e: return 0
return ((e-s)//times... | 24 | 22 | 621 | 595 | from fractions import gcd
# def gcd(x, y):
# while(y != 0):
# temp = y
# y = x%y
# x = temp
# return y
def getMultiCount(start, end, times):
if end < times:
return 0
s = start - (start % times)
if s != start:
s += times
e = end - (end % times)
if s > ... | def gcd(a, b):
a, b = sorted([a, b], reverse=True)
while b != 0:
a, b = (b, a % b)
return a
def getMultiCount(start, end, times):
if end < times:
return 0
s = start - (start % times)
if s != start:
s += times
e = end - (end % times)
if s > e:
return 0
... | false | 8.333333 | [
"-from fractions import gcd",
"+def gcd(a, b):",
"+ a, b = sorted([a, b], reverse=True)",
"+ while b != 0:",
"+ a, b = (b, a % b)",
"+ return a",
"-# def gcd(x, y):",
"-# while(y != 0):",
"-# temp = y",
"-# y = x%y",
"-# x = temp",
"-# return y",... | false | 0.152728 | 0.133561 | 1.143509 | [
"s733826398",
"s550365785"
] |
u073852194 | p03287 | python | s494722916 | s119244067 | 248 | 92 | 64,280 | 16,552 | Accepted | Accepted | 62.9 | from collections import Counter
n,m = list(map(int,input().split()))
A = list(map(int,input().split()))
S = [0]
s = 0
for i in range(n):
s += A[i]
S += [s]
R = []
for i in range(n+1):
R += [S[i]%m]
R = Counter(R)
ans = 0
for r in list(R.values()):
ans += r*(r-1)//2
print(ans) | from collections import Counter
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
S = [0]
for i in range(N):
S.append((S[-1]+A[i])%M)
C = Counter(S)
ans = 0
for v in list(C.values()):
ans += v*(v-1)//2
print(ans) | 25 | 18 | 307 | 254 | from collections import Counter
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
S = [0]
s = 0
for i in range(n):
s += A[i]
S += [s]
R = []
for i in range(n + 1):
R += [S[i] % m]
R = Counter(R)
ans = 0
for r in list(R.values()):
ans += r * (r - 1) // 2
print(ans)
| from collections import Counter
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
S = [0]
for i in range(N):
S.append((S[-1] + A[i]) % M)
C = Counter(S)
ans = 0
for v in list(C.values()):
ans += v * (v - 1) // 2
print(ans)
| false | 28 | [
"-n, m = list(map(int, input().split()))",
"+N, M = list(map(int, input().split()))",
"-s = 0",
"-for i in range(n):",
"- s += A[i]",
"- S += [s]",
"-R = []",
"-for i in range(n + 1):",
"- R += [S[i] % m]",
"-R = Counter(R)",
"+for i in range(N):",
"+ S.append((S[-1] + A[i]) % M)",... | false | 0.035469 | 0.080544 | 0.440362 | [
"s494722916",
"s119244067"
] |
u150984829 | p02275 | python | s028091213 | s301297315 | 2,660 | 930 | 224,508 | 224,412 | Accepted | Accepted | 65.04 | n=int(eval(input()))
A=list(map(int,input().split()))
m=10001
B=A[:]
C=[0]*m
for a in A:C[a]+=1
for i in range(1,m):C[i]+=C[i-1]
for j in A[::-1]:B[C[j]-1]=j;C[j]-=1
print((*B))
| eval(input())
A=list(map(int,input().split()))
B=[]
C=[0]*(max(A)+1)
for a in A:C[a]+=1
i=0
for k in C:B+=[str(i)]*k;i+=1
print((' '.join(B)))
| 9 | 8 | 178 | 142 | n = int(eval(input()))
A = list(map(int, input().split()))
m = 10001
B = A[:]
C = [0] * m
for a in A:
C[a] += 1
for i in range(1, m):
C[i] += C[i - 1]
for j in A[::-1]:
B[C[j] - 1] = j
C[j] -= 1
print((*B))
| eval(input())
A = list(map(int, input().split()))
B = []
C = [0] * (max(A) + 1)
for a in A:
C[a] += 1
i = 0
for k in C:
B += [str(i)] * k
i += 1
print((" ".join(B)))
| false | 11.111111 | [
"-n = int(eval(input()))",
"+eval(input())",
"-m = 10001",
"-B = A[:]",
"-C = [0] * m",
"+B = []",
"+C = [0] * (max(A) + 1)",
"-for i in range(1, m):",
"- C[i] += C[i - 1]",
"-for j in A[::-1]:",
"- B[C[j] - 1] = j",
"- C[j] -= 1",
"-print((*B))",
"+i = 0",
"+for k in C:",
"+ ... | false | 0.046634 | 0.041095 | 1.134807 | [
"s028091213",
"s301297315"
] |
u678167152 | p03044 | python | s980622789 | s271146489 | 1,054 | 652 | 82,908 | 76,488 | Accepted | Accepted | 38.14 | import sys
sys.setrecursionlimit(10**8)
N = int(input())
edge = [[] for _ in range(N+1)]
for i in range(N-1):
u,v,w = map(int, input().split())
edge[u].append([v,w%2])
edge[v].append([u,w%2])
color = [0]*(N+1)
visited = [False]*(N+1)
def dfs(u):
for v,w in edge[u]:
if visited[v]==False:
... | import sys
sys.setrecursionlimit(10**8)
N = int(input())
edge = [[] for _ in range(N)]
for _ in range(N-1):
u,v,w = map(int, input().split())
w %= 2
v -= 1
u -= 1
edge[u].append((w,v))
edge[v].append((w,u))
color = [-1]*N
#print(edge)
def dfs(s,col):
#print(s,col)
for w,v in edge[s]... | 23 | 30 | 470 | 476 | import sys
sys.setrecursionlimit(10**8)
N = int(input())
edge = [[] for _ in range(N + 1)]
for i in range(N - 1):
u, v, w = map(int, input().split())
edge[u].append([v, w % 2])
edge[v].append([u, w % 2])
color = [0] * (N + 1)
visited = [False] * (N + 1)
def dfs(u):
for v, w in edge[u]:
if vis... | import sys
sys.setrecursionlimit(10**8)
N = int(input())
edge = [[] for _ in range(N)]
for _ in range(N - 1):
u, v, w = map(int, input().split())
w %= 2
v -= 1
u -= 1
edge[u].append((w, v))
edge[v].append((w, u))
color = [-1] * N
# print(edge)
def dfs(s, col):
# print(s,col)
for w, v in... | false | 23.333333 | [
"-edge = [[] for _ in range(N + 1)]",
"-for i in range(N - 1):",
"+edge = [[] for _ in range(N)]",
"+for _ in range(N - 1):",
"- edge[u].append([v, w % 2])",
"- edge[v].append([u, w % 2])",
"-color = [0] * (N + 1)",
"-visited = [False] * (N + 1)",
"+ w %= 2",
"+ v -= 1",
"+ u -= 1... | false | 0.090241 | 0.039058 | 2.310448 | [
"s980622789",
"s271146489"
] |
u852690916 | p03329 | python | s507292993 | s052613167 | 224 | 192 | 45,552 | 42,476 | Accepted | Accepted | 14.29 | import heapq
N=int(eval(input()))
N_max=100000
d=set()
n=1
while n<=N_max:
d.add(n)
n*=6
n=1
while n<=N_max:
d.add(n)
n*=9
dp=[N_max+1 for _ in range(N_max+1)]
dp[0]=0
for i in range(1,N_max+1):
for n in d:
if i>=n:
dp[i]=min(dp[i],dp[i-n]+1)
print((dp[N])... | N = int(eval(input()))
a = [1]
n6 = 6
while n6 <= 100000:
a.append(n6)
n6 *= 6
n9 = 9
while n9 <= 100000:
a.append(n9)
n9 *= 9
#dp[i]=ちょうどi円払う場合に最小の操作回数
dp = [10**9] * (N+100010)
dp[0] = 0
for i in range(N):
for n in a:
dp[i+n] = min(dp[i+n], dp[i]+1)
print((dp[N])) | 22 | 20 | 313 | 308 | import heapq
N = int(eval(input()))
N_max = 100000
d = set()
n = 1
while n <= N_max:
d.add(n)
n *= 6
n = 1
while n <= N_max:
d.add(n)
n *= 9
dp = [N_max + 1 for _ in range(N_max + 1)]
dp[0] = 0
for i in range(1, N_max + 1):
for n in d:
if i >= n:
dp[i] = min(dp[i], dp[i - n] + 1... | N = int(eval(input()))
a = [1]
n6 = 6
while n6 <= 100000:
a.append(n6)
n6 *= 6
n9 = 9
while n9 <= 100000:
a.append(n9)
n9 *= 9
# dp[i]=ちょうどi円払う場合に最小の操作回数
dp = [10**9] * (N + 100010)
dp[0] = 0
for i in range(N):
for n in a:
dp[i + n] = min(dp[i + n], dp[i] + 1)
print((dp[N]))
| false | 9.090909 | [
"-import heapq",
"-",
"-N_max = 100000",
"-d = set()",
"-n = 1",
"-while n <= N_max:",
"- d.add(n)",
"- n *= 6",
"-n = 1",
"-while n <= N_max:",
"- d.add(n)",
"- n *= 9",
"-dp = [N_max + 1 for _ in range(N_max + 1)]",
"+a = [1]",
"+n6 = 6",
"+while n6 <= 100000:",
"+ a... | false | 0.854233 | 0.121577 | 7.026291 | [
"s507292993",
"s052613167"
] |
u857428111 | p02732 | python | s363148044 | s975730169 | 519 | 363 | 100,804 | 26,396 | Accepted | Accepted | 30.06 | # coding: utf-8
# Your code here!
# coding: utf-8
import sys
sys.setrecursionlimit(10000000)
#const
dxdy=((1,0),(0,1))
# my functions here!
def pin(type=int):
return list(map(type,input().rstrip().split()))
def resolve():
N,=pin()
A=list(pin())
from collections import Counter as ct
... | #%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return list(map(type,input().split()))
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
N=int(eval(input()))
A=tupin()
from collections import Counter
c=Counter(A)
total=0... | 95 | 23 | 1,699 | 513 | # coding: utf-8
# Your code here!
# coding: utf-8
import sys
sys.setrecursionlimit(10000000)
# const
dxdy = ((1, 0), (0, 1))
# my functions here!
def pin(type=int):
return list(map(type, input().rstrip().split()))
def resolve():
(N,) = pin()
A = list(pin())
from collections import Counter as ct
... | #%% for atcoder uniittest use
import sys
input = lambda: sys.stdin.readline().rstrip()
def pin(type=int):
return list(map(type, input().split()))
def tupin(t=int):
return tuple(pin(t))
#%%code
def resolve():
N = int(eval(input()))
A = tupin()
from collections import Counter
c = Counter(A... | false | 75.789474 | [
"-# coding: utf-8",
"-# Your code here!",
"-# coding: utf-8",
"+#%% for atcoder uniittest use",
"-sys.setrecursionlimit(10000000)",
"-# const",
"-dxdy = ((1, 0), (0, 1))",
"-# my functions here!",
"-def pin(type=int):",
"- return list(map(type, input().rstrip().split()))",
"+input = lambda: s... | false | 0.111702 | 0.04038 | 2.766226 | [
"s363148044",
"s975730169"
] |
u083960235 | p03640 | python | s494836972 | s689484844 | 50 | 46 | 5,964 | 10,968 | Accepted | Accepted | 8 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 46 | 40 | 1,369 | 1,191 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 13.043478 | [
"-from heapq import heapify, heappop, heappush",
"+from bisect import bisect, bisect_left, bisect_right",
"-num = 0",
"+i = 0",
"- if h % 2 == 0:",
"- for w in range(W):",
"- if A[num] > 0:",
"- A[num] -= 1",
"- else:",
"- num += 1",
... | false | 0.036914 | 0.038098 | 0.968926 | [
"s494836972",
"s689484844"
] |
u017810624 | p03152 | python | s037482606 | s542261284 | 673 | 586 | 3,316 | 3,188 | Accepted | Accepted | 12.93 | n,m=list(map(int,input().split()));a,b=[set(map(int,input().split())) for j in range(2)];c=1;N=M=0
for k in range(m*n,0,-1):
A=k in a;B=k in b
if A and B:M+=1;N+=1
elif A:c*=M;N+=1
elif B:c*=N;M+=1
else:c*=M*N-m*n+k
c%=10**9+7
print(c) | eval(input());a,b=[set(map(int,input().split())) for j in[0]*2];c=1;N=M=0;x=max(a)
for k in range(x,0,-1):
A=k in a;B=k in b
if A and B:M+=1;N+=1
elif A:c*=M;N+=1
elif B:c*=N;M+=1
else:c*=M*N-x+k
c%=10**9+7
print(c) | 9 | 9 | 243 | 223 | n, m = list(map(int, input().split()))
a, b = [set(map(int, input().split())) for j in range(2)]
c = 1
N = M = 0
for k in range(m * n, 0, -1):
A = k in a
B = k in b
if A and B:
M += 1
N += 1
elif A:
c *= M
N += 1
elif B:
c *= N
M += 1
else:
... | eval(input())
a, b = [set(map(int, input().split())) for j in [0] * 2]
c = 1
N = M = 0
x = max(a)
for k in range(x, 0, -1):
A = k in a
B = k in b
if A and B:
M += 1
N += 1
elif A:
c *= M
N += 1
elif B:
c *= N
M += 1
else:
c *= M * N - x + k... | false | 0 | [
"-n, m = list(map(int, input().split()))",
"-a, b = [set(map(int, input().split())) for j in range(2)]",
"+eval(input())",
"+a, b = [set(map(int, input().split())) for j in [0] * 2]",
"-for k in range(m * n, 0, -1):",
"+x = max(a)",
"+for k in range(x, 0, -1):",
"- c *= M * N - m * n + k",
"+... | false | 0.047619 | 0.047868 | 0.994814 | [
"s037482606",
"s542261284"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.