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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u488178971 | p03556 | python | s283117922 | s584613913 | 152 | 18 | 12,388 | 3,060 | Accepted | Accepted | 88.16 | # 077 B
import numpy as np
N = int(eval(input()))
n=int(np.sqrt(N))
print((n**2)) | N = int(eval(input()))
n = int(N**0.5)
print((n**2)) | 6 | 3 | 79 | 47 | # 077 B
import numpy as np
N = int(eval(input()))
n = int(np.sqrt(N))
print((n**2))
| N = int(eval(input()))
n = int(N**0.5)
print((n**2))
| false | 50 | [
"-# 077 B",
"-import numpy as np",
"-",
"-n = int(np.sqrt(N))",
"+n = int(N**0.5)"
] | false | 0.23867 | 0.045117 | 5.289991 | [
"s283117922",
"s584613913"
] |
u083960235 | p03107 | python | s232627198 | s768198563 | 61 | 33 | 4,652 | 4,724 | Accepted | Accepted | 45.9 | s=str(eval(input()))
s=list(s)
l=[]
for i in s:
l.append(int(i))
c=0
d=0
for i in l:
if i==0:
c+=1
else:
d+=1
ans=2*min(c,d)
print(ans)
| 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... | 16 | 28 | 172 | 882 | s = str(eval(input()))
s = list(s)
l = []
for i in s:
l.append(int(i))
c = 0
d = 0
for i in l:
if i == 0:
c += 1
else:
d += 1
ans = 2 * min(c, d)
print(ans)
| 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 | 42.857143 | [
"-s = str(eval(input()))",
"-s = list(s)",
"-l = []",
"-for i in s:",
"- l.append(int(i))",
"-c = 0",
"-d = 0",
"-for i in l:",
"- if i == 0:",
"- c += 1",
"- else:",
"- d += 1",
"-ans = 2 * min(c, d)",
"-print(ans)",
"+import sys, re, os",
"+from collections imp... | false | 0.08233 | 0.038226 | 2.153747 | [
"s232627198",
"s768198563"
] |
u391731808 | p03837 | python | s833442852 | s649561393 | 573 | 407 | 3,444 | 3,568 | Accepted | Accepted | 28.97 | N,M = list(map(int,input().split()))
abc= [list(map(int,input().split())) for _ in [0]*M]
d = [[10000*N]*N for _ in [0]*N]
for a,b,c in abc:
d[a-1][b-1]=c
d[b-1][a-1]=c
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j] = min(d[i][j],d[i][k]+d[k][j])
ans=sum(d[a-1... | N,M = list(map(int,input().split()))
ABC = [list(map(int,input().split())) for _ in [0]*M]
INF = 10**9
d = [[INF]*N for _ in [0]*N]
for i in range(N):
d[i][i] = 0
for a,b,c in ABC:
d[a-1][b-1] = c
d[b-1][a-1] = c
def Warshall_Floyd(d,N=None):
if N==None : N = len(d)
for k in range(N):
... | 12 | 17 | 352 | 492 | N, M = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in [0] * M]
d = [[10000 * N] * N for _ in [0] * N]
for a, b, c in abc:
d[a - 1][b - 1] = c
d[b - 1][a - 1] = c
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j] = min(d[i][j], d[i][k] + d[k... | N, M = list(map(int, input().split()))
ABC = [list(map(int, input().split())) for _ in [0] * M]
INF = 10**9
d = [[INF] * N for _ in [0] * N]
for i in range(N):
d[i][i] = 0
for a, b, c in ABC:
d[a - 1][b - 1] = c
d[b - 1][a - 1] = c
def Warshall_Floyd(d, N=None):
if N == None:
N = len(d)
fo... | false | 29.411765 | [
"-abc = [list(map(int, input().split())) for _ in [0] * M]",
"-d = [[10000 * N] * N for _ in [0] * N]",
"-for a, b, c in abc:",
"+ABC = [list(map(int, input().split())) for _ in [0] * M]",
"+INF = 10**9",
"+d = [[INF] * N for _ in [0] * N]",
"+for i in range(N):",
"+ d[i][i] = 0",
"+for a, b, c i... | false | 0.041225 | 0.041201 | 1.00057 | [
"s833442852",
"s649561393"
] |
u506858457 | p03107 | python | s366231315 | s766680780 | 42 | 18 | 3,956 | 3,188 | Accepted | Accepted | 57.14 | S=eval(input())
stack=[]
count=0
for s in S:
if not stack:
stack.append(s)
elif stack[-1]!=s:
stack.pop()
count+=2
else:
stack.append(s)
print(count) | S=eval(input())
A=S.count('0')
B=S.count('1')
C=min(A,B)
print((C*2)) | 12 | 5 | 198 | 65 | S = eval(input())
stack = []
count = 0
for s in S:
if not stack:
stack.append(s)
elif stack[-1] != s:
stack.pop()
count += 2
else:
stack.append(s)
print(count)
| S = eval(input())
A = S.count("0")
B = S.count("1")
C = min(A, B)
print((C * 2))
| false | 58.333333 | [
"-stack = []",
"-count = 0",
"-for s in S:",
"- if not stack:",
"- stack.append(s)",
"- elif stack[-1] != s:",
"- stack.pop()",
"- count += 2",
"- else:",
"- stack.append(s)",
"-print(count)",
"+A = S.count(\"0\")",
"+B = S.count(\"1\")",
"+C = min(A, B... | false | 0.060982 | 0.035688 | 1.708768 | [
"s366231315",
"s766680780"
] |
u499381410 | p02965 | python | s344121074 | s323613864 | 465 | 428 | 80,988 | 81,116 | Accepted | Accepted | 7.96 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
INF = float('inf')
def LI(): return list(map(int, s... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_... | 59 | 55 | 1,480 | 1,670 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
INF = float("inf")
def LI():
return list(map(int, sys.stdin... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bise... | false | 6.779661 | [
"+import bisect",
"+import random",
"+from itertools import permutations, accumulate, combinations, product",
"+import sys",
"+from pprint import pprint",
"+from copy import deepcopy",
"+import string",
"-import random",
"-from itertools import permutations, accumulate, combinations",
"-import sys... | false | 0.181236 | 0.217745 | 0.832334 | [
"s344121074",
"s323613864"
] |
u118642796 | p03090 | python | s980025586 | s450483791 | 217 | 26 | 43,632 | 4,124 | Accepted | Accepted | 88.02 | N = int(eval(input()))
ans = []
for i in range(1,N):
for j in range(i+1,N+1):
if i+j!=(N//2)*2+1:
ans.append([i,j])
print((len(ans)))
for a,b in ans:
print((a,b)) | N = int(input())
ans = []
for i in range(1,N):
for j in range(i+1,N+1):
if i+j!=(N//2)*2+1:
ans.append([i,j])
print(len(ans))
[print(a,b) for a,b in ans]
| 10 | 9 | 197 | 186 | N = int(eval(input()))
ans = []
for i in range(1, N):
for j in range(i + 1, N + 1):
if i + j != (N // 2) * 2 + 1:
ans.append([i, j])
print((len(ans)))
for a, b in ans:
print((a, b))
| N = int(input())
ans = []
for i in range(1, N):
for j in range(i + 1, N + 1):
if i + j != (N // 2) * 2 + 1:
ans.append([i, j])
print(len(ans))
[print(a, b) for a, b in ans]
| false | 10 | [
"-N = int(eval(input()))",
"+N = int(input())",
"-print((len(ans)))",
"-for a, b in ans:",
"- print((a, b))",
"+print(len(ans))",
"+[print(a, b) for a, b in ans]"
] | false | 0.079731 | 0.156321 | 0.510043 | [
"s980025586",
"s450483791"
] |
u285443936 | p03074 | python | s389568337 | s085674404 | 112 | 92 | 6,700 | 4,596 | Accepted | Accepted | 17.86 | N, K = list(map(int, input().split()))
S = list(map(int,list(eval(input()))))
A = []
B = []
if S[0] == 1:
A.append(0)
B.append(1)
else:
A.extend([0,1])
B.extend([0,0])
for i in range(1,N):
if S[i] == S[i-1]:
if S[i] == 0:
A[-1] += 1
else:
B[-1] += 1
else:
if S[i]... | N, K = list(map(int, input().split()))
S = eval(input())
array = []
count = 1
if S[0] == "0":
array.append(0)
for i in range(N):
if i+1 == N or S[i] != S[i+1]:
array.append(count)
count = 1
elif S[i] == S[i+1]:
count += 1
if S[-1] == "0":
array.append(0)
M = len(array)
ans = sum(arra... | 36 | 22 | 633 | 466 | N, K = list(map(int, input().split()))
S = list(map(int, list(eval(input()))))
A = []
B = []
if S[0] == 1:
A.append(0)
B.append(1)
else:
A.extend([0, 1])
B.extend([0, 0])
for i in range(1, N):
if S[i] == S[i - 1]:
if S[i] == 0:
A[-1] += 1
else:
B[-1] += 1
... | N, K = list(map(int, input().split()))
S = eval(input())
array = []
count = 1
if S[0] == "0":
array.append(0)
for i in range(N):
if i + 1 == N or S[i] != S[i + 1]:
array.append(count)
count = 1
elif S[i] == S[i + 1]:
count += 1
if S[-1] == "0":
array.append(0)
M = len(array)
ans ... | false | 38.888889 | [
"-S = list(map(int, list(eval(input()))))",
"-A = []",
"-B = []",
"-if S[0] == 1:",
"- A.append(0)",
"- B.append(1)",
"-else:",
"- A.extend([0, 1])",
"- B.extend([0, 0])",
"-for i in range(1, N):",
"- if S[i] == S[i - 1]:",
"- if S[i] == 0:",
"- A[-1] += 1",
... | false | 0.037746 | 0.038648 | 0.976675 | [
"s389568337",
"s085674404"
] |
u046187684 | p02887 | python | s956423985 | s044960385 | 55 | 25 | 15,968 | 4,212 | Accepted | Accepted | 54.55 | from itertools import groupby
def solve(string):
n, s = string.split()
return str(len(list(groupby(s))))
if __name__ == '__main__':
print((solve('\n'.join([eval(input()), eval(input())]))))
| def solve(string):
n, s = string.split()
return str(int(n) - sum([1 for d1, d2 in zip(s, s[1:]) if d1 == d2]))
if __name__ == '__main__':
print((solve('\n'.join([eval(input()), eval(input())]))))
| 10 | 7 | 201 | 202 | from itertools import groupby
def solve(string):
n, s = string.split()
return str(len(list(groupby(s))))
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| def solve(string):
n, s = string.split()
return str(int(n) - sum([1 for d1, d2 in zip(s, s[1:]) if d1 == d2]))
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval(input())]))))
| false | 30 | [
"-from itertools import groupby",
"-",
"-",
"- return str(len(list(groupby(s))))",
"+ return str(int(n) - sum([1 for d1, d2 in zip(s, s[1:]) if d1 == d2]))"
] | false | 0.072077 | 0.091146 | 0.790789 | [
"s956423985",
"s044960385"
] |
u074220993 | p03999 | python | s690012485 | s997080701 | 30 | 23 | 9,132 | 9,196 | Accepted | Accepted | 23.33 | s = eval(input())
L = []
sigma = 0
def sprit_sum(string, sprit, num):
global sigma
for i in range(1,len(string)+num-sprit):
str_front = string[:i]
str_back = string[i:]
L.append(int(str_front))
if num < sprit:
sprit_sum(str_back, sprit, num+1)
else... | S = eval(input())
f = lambda x: 2**(x-1) if x > 0 else 1
lenS = len(S)
ans = 0
for i in range(1,lenS+1):
for j in range(lenS-i+1):
ans += int(S[j:j+i]) * f(j) * f(lenS-j-i)
print(ans) | 22 | 8 | 536 | 197 | s = eval(input())
L = []
sigma = 0
def sprit_sum(string, sprit, num):
global sigma
for i in range(1, len(string) + num - sprit):
str_front = string[:i]
str_back = string[i:]
L.append(int(str_front))
if num < sprit:
sprit_sum(str_back, sprit, num + 1)
else:
... | S = eval(input())
f = lambda x: 2 ** (x - 1) if x > 0 else 1
lenS = len(S)
ans = 0
for i in range(1, lenS + 1):
for j in range(lenS - i + 1):
ans += int(S[j : j + i]) * f(j) * f(lenS - j - i)
print(ans)
| false | 63.636364 | [
"-s = eval(input())",
"-L = []",
"-sigma = 0",
"-",
"-",
"-def sprit_sum(string, sprit, num):",
"- global sigma",
"- for i in range(1, len(string) + num - sprit):",
"- str_front = string[:i]",
"- str_back = string[i:]",
"- L.append(int(str_front))",
"- if num ... | false | 0.042347 | 0.039666 | 1.067601 | [
"s690012485",
"s997080701"
] |
u761320129 | p03162 | python | s249359383 | s928433080 | 965 | 529 | 40,180 | 41,004 | Accepted | Accepted | 45.18 | N = int(eval(input()))
src = [tuple(map(int,input().split())) for i in range(N)]
dp = [[0]*3 for i in range(N+1)]
for i in range(N):
for j in range(3):
for k in range(3):
if j==k: continue
dp[i+1][k] = max(dp[i+1][k], dp[i][j] + src[i][k])
print((max(dp[-1]))) | N = int(eval(input()))
src = [tuple(map(int,input().split())) for i in range(N)]
dp = [[0]*3 for i in range(N)]
dp[0] = src[0]
for i,(a,b,c) in enumerate(src[1:]):
dp[i+1][0] = a + max(dp[i][1], dp[i][2])
dp[i+1][1] = b + max(dp[i][2], dp[i][0])
dp[i+1][2] = c + max(dp[i][0], dp[i][1])
print((max(... | 10 | 10 | 298 | 321 | N = int(eval(input()))
src = [tuple(map(int, input().split())) for i in range(N)]
dp = [[0] * 3 for i in range(N + 1)]
for i in range(N):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + src[i][k])
print((max(dp[-1]... | N = int(eval(input()))
src = [tuple(map(int, input().split())) for i in range(N)]
dp = [[0] * 3 for i in range(N)]
dp[0] = src[0]
for i, (a, b, c) in enumerate(src[1:]):
dp[i + 1][0] = a + max(dp[i][1], dp[i][2])
dp[i + 1][1] = b + max(dp[i][2], dp[i][0])
dp[i + 1][2] = c + max(dp[i][0], dp[i][1])
print((ma... | false | 0 | [
"-dp = [[0] * 3 for i in range(N + 1)]",
"-for i in range(N):",
"- for j in range(3):",
"- for k in range(3):",
"- if j == k:",
"- continue",
"- dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + src[i][k])",
"+dp = [[0] * 3 for i in range(N)]",
"+dp[0] = src[... | false | 0.03815 | 0.037726 | 1.011237 | [
"s249359383",
"s928433080"
] |
u118211443 | p02996 | python | s436702905 | s276084027 | 1,002 | 886 | 53,720 | 39,700 | Accepted | Accepted | 11.58 | n = int(eval(input()))
a = []
for i in range(n):
a.append(list(map(int, input().split())))
a.sort(key=lambda x: x[1])
cnt = 0
for i in range(n):
cnt += a[i][0]
# print(cnt, a[i][1])
if cnt > a[i][1]:
print('No')
exit()
print('Yes')
| n = int(eval(input()))
a = []
for i in range(n):
A, B = list(map(int, input().split()))
a.append([A, B])
b = sorted(a, key=lambda x: x[1])
# print(b)
t = 0
for i in range(n):
t += b[i][0]
if t > b[i][1]:
print('No')
exit()
print('Yes')
| 16 | 17 | 276 | 275 | n = int(eval(input()))
a = []
for i in range(n):
a.append(list(map(int, input().split())))
a.sort(key=lambda x: x[1])
cnt = 0
for i in range(n):
cnt += a[i][0]
# print(cnt, a[i][1])
if cnt > a[i][1]:
print("No")
exit()
print("Yes")
| n = int(eval(input()))
a = []
for i in range(n):
A, B = list(map(int, input().split()))
a.append([A, B])
b = sorted(a, key=lambda x: x[1])
# print(b)
t = 0
for i in range(n):
t += b[i][0]
if t > b[i][1]:
print("No")
exit()
print("Yes")
| false | 5.882353 | [
"- a.append(list(map(int, input().split())))",
"-a.sort(key=lambda x: x[1])",
"-cnt = 0",
"+ A, B = list(map(int, input().split()))",
"+ a.append([A, B])",
"+b = sorted(a, key=lambda x: x[1])",
"+# print(b)",
"+t = 0",
"- cnt += a[i][0]",
"- # print(cnt, a[i][1])",
"- if cnt > ... | false | 0.135458 | 0.2497 | 0.542483 | [
"s436702905",
"s276084027"
] |
u314050667 | p03557 | python | s953890438 | s587557208 | 280 | 256 | 26,760 | 26,768 | Accepted | Accepted | 8.57 | import numpy as np
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int64)
B = np.array(input().split(), dtype=np.int64)
C = np.array(input().split(), dtype=np.int64)
A.sort()
C.sort()
A_cnt = np.searchsorted(A, B, side='left')
C_cnt = np.searchsorted(... | import numpy as np
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int64)
B = np.array(input().split(), dtype=np.int64)
C = np.array(input().split(), dtype=np.int64)
A.sort()
B.sort()
C.sort()
A_cnt = np.searchsorted(A, B, side='left')
C_cnt = np.sea... | 18 | 19 | 382 | 392 | import numpy as np
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int64)
B = np.array(input().split(), dtype=np.int64)
C = np.array(input().split(), dtype=np.int64)
A.sort()
C.sort()
A_cnt = np.searchsorted(A, B, side="left")
C_cnt = np.searchsorted(C, B, side="righ... | import numpy as np
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = np.array(input().split(), dtype=np.int64)
B = np.array(input().split(), dtype=np.int64)
C = np.array(input().split(), dtype=np.int64)
A.sort()
B.sort()
C.sort()
A_cnt = np.searchsorted(A, B, side="left")
C_cnt = np.searchsorted(C, B, s... | false | 5.263158 | [
"+B.sort()"
] | false | 0.226142 | 0.208758 | 1.083277 | [
"s953890438",
"s587557208"
] |
u970197315 | p02837 | python | s205043778 | s737316868 | 145 | 83 | 3,064 | 3,064 | Accepted | Accepted | 42.76 | #ABC147 C
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))
n=int(eval(input()))
shogen=[]
for _ in range(n):
a=int(eval(input()))
t=[]
for __ in range(a):
s=list(map(int,input().split()))
... | n=int(eval(input()))
xy=[[] for i in range(n)]
for i in range(n):
a=int(eval(input()))
for j in range(a):
x,y=list(map(int,input().split()))
xy[i].append([x,y])
ans=0
for b in range(1<<n):
cnt=bin(b).count("1")
if cnt<=ans:continue
for j in range(n):
if b&(1<<j):
for x,y in xy[j... | 31 | 24 | 668 | 487 | # ABC147 C
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))
n = int(eval(input()))
shogen = []
for _ in range(n):
a = int(eval(input()))
t = []
for __ in range(a):
s = list(map(int, input().split()))
... | n = int(eval(input()))
xy = [[] for i in range(n)]
for i in range(n):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
xy[i].append([x, y])
ans = 0
for b in range(1 << n):
cnt = bin(b).count("1")
if cnt <= ans:
continue
for j in range(n):
... | false | 22.580645 | [
"-# ABC147 C",
"-si = lambda: eval(input())",
"-ni = lambda: int(eval(input()))",
"-nm = lambda: list(map(int, input().split()))",
"-nl = lambda: list(map(int, input().split()))",
"-shogen = []",
"-for _ in range(n):",
"+xy = [[] for i in range(n)]",
"+for i in range(n):",
"- t = []",
"- f... | false | 0.04644 | 0.039265 | 1.182725 | [
"s205043778",
"s737316868"
] |
u606878291 | p02838 | python | s006362321 | s970154751 | 648 | 244 | 124,340 | 68,728 | Accepted | Accepted | 62.35 | N = int(eval(input()))
A = tuple(map(int, input().split(' ')))
MOD = 10 ** 9 + 7
zeros = [0] * 60
ones = [0] * 60
for a in A:
for i, bit in enumerate(reversed(format(a, '060b'))):
if bit == '0':
zeros[i] += 1
else:
ones[i] += 1
base = 1
ans = 0
for i in r... | import numpy as np
N = int(eval(input()))
A = tuple(map(int, input().split(' ')))
A = np.array(A, dtype=np.int64)
MOD = 10 ** 9 + 7
ans = 0
mask = 1
for i in range(60):
ones = np.count_nonzero(A & mask)
ans += (ones * (N - ones) % MOD) * (mask % MOD)
ans %= MOD
mask <<= 1
print(ans)
| 24 | 17 | 432 | 314 | N = int(eval(input()))
A = tuple(map(int, input().split(" ")))
MOD = 10**9 + 7
zeros = [0] * 60
ones = [0] * 60
for a in A:
for i, bit in enumerate(reversed(format(a, "060b"))):
if bit == "0":
zeros[i] += 1
else:
ones[i] += 1
base = 1
ans = 0
for i in range(len(zeros)):
a... | import numpy as np
N = int(eval(input()))
A = tuple(map(int, input().split(" ")))
A = np.array(A, dtype=np.int64)
MOD = 10**9 + 7
ans = 0
mask = 1
for i in range(60):
ones = np.count_nonzero(A & mask)
ans += (ones * (N - ones) % MOD) * (mask % MOD)
ans %= MOD
mask <<= 1
print(ans)
| false | 29.166667 | [
"+import numpy as np",
"+",
"+A = np.array(A, dtype=np.int64)",
"-zeros = [0] * 60",
"-ones = [0] * 60",
"-for a in A:",
"- for i, bit in enumerate(reversed(format(a, \"060b\"))):",
"- if bit == \"0\":",
"- zeros[i] += 1",
"- else:",
"- ones[i] += 1",
"-b... | false | 0.038063 | 0.461266 | 0.082519 | [
"s006362321",
"s970154751"
] |
u497952650 | p02688 | python | s642041752 | s341633387 | 25 | 22 | 9,184 | 9,152 | Accepted | Accepted | 12 | N,K = list(map(int,input().split()))
snuke = [0]*N
for i in range(K):
d = int(eval(input()))
A = list(map(int,input().split()))
for j in A:
snuke[j-1] += 1
cnt = 0
for i in snuke:
if i == 0:
cnt += 1
print(cnt) | N,K = list(map(int,input().split()))
snukes = [1]*N
for _ in range(K):
d = int(eval(input()))
A = list(map(int,input().split()))
for i in A:
snukes[i-1] = 0
print((sum(snukes))) | 14 | 12 | 245 | 198 | N, K = list(map(int, input().split()))
snuke = [0] * N
for i in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for j in A:
snuke[j - 1] += 1
cnt = 0
for i in snuke:
if i == 0:
cnt += 1
print(cnt)
| N, K = list(map(int, input().split()))
snukes = [1] * N
for _ in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for i in A:
snukes[i - 1] = 0
print((sum(snukes)))
| false | 14.285714 | [
"-snuke = [0] * N",
"-for i in range(K):",
"+snukes = [1] * N",
"+for _ in range(K):",
"- for j in A:",
"- snuke[j - 1] += 1",
"-cnt = 0",
"-for i in snuke:",
"- if i == 0:",
"- cnt += 1",
"-print(cnt)",
"+ for i in A:",
"+ snukes[i - 1] = 0",
"+print((sum(snu... | false | 0.047705 | 0.049354 | 0.966594 | [
"s642041752",
"s341633387"
] |
u046187684 | p03448 | python | s006938307 | s929802436 | 51 | 44 | 3,316 | 3,060 | Accepted | Accepted | 13.73 | #!/usr/bin/env python3
# coding=utf-8
import sys
a = int(sys.stdin.readline().strip())
b = int(sys.stdin.readline().strip())
c = int(sys.stdin.readline().strip())
x = int(sys.stdin.readline().strip())
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if i * 50... | def solve(string):
a, b, c, x = list(map(int, string.split()))
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
ans += 1
return str(ans)
if __name__ == '__main__':
n ... | 16 | 14 | 385 | 376 | #!/usr/bin/env python3
# coding=utf-8
import sys
a = int(sys.stdin.readline().strip())
b = int(sys.stdin.readline().strip())
c = int(sys.stdin.readline().strip())
x = int(sys.stdin.readline().strip())
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if i * 500 + j * ... | def solve(string):
a, b, c, x = list(map(int, string.split()))
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
ans += 1
return str(ans)
if __name__ == "__main__":
n = 4
prin... | false | 12.5 | [
"-#!/usr/bin/env python3",
"-# coding=utf-8",
"-import sys",
"+def solve(string):",
"+ a, b, c, x = list(map(int, string.split()))",
"+ ans = 0",
"+ for i in range(a + 1):",
"+ for j in range(b + 1):",
"+ for k in range(c + 1):",
"+ if 500 * i + 100 * j + ... | false | 0.094518 | 0.036188 | 2.611822 | [
"s006938307",
"s929802436"
] |
u483896240 | p03068 | python | s442539102 | s545960061 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | # -*- coding: utf-8 -*-
n = int(eval(input()))
s = eval(input())
k = int(eval(input()))
t = s[k-1]
s_list = list(s)
for i in range(n):
if s[i] != t:
s_list[i] = '*'
s_changed = "".join(s_list)
print(s_changed) | # -*- coding: utf-8 -*-
n = int(eval(input()))
s = list(eval(input()))
k = int(eval(input()))
c = s[k-1]
for i in range(n):
if s[i] != c:
s[i] = '*'
ans = "".join(s)
print(ans) | 16 | 14 | 223 | 187 | # -*- coding: utf-8 -*-
n = int(eval(input()))
s = eval(input())
k = int(eval(input()))
t = s[k - 1]
s_list = list(s)
for i in range(n):
if s[i] != t:
s_list[i] = "*"
s_changed = "".join(s_list)
print(s_changed)
| # -*- coding: utf-8 -*-
n = int(eval(input()))
s = list(eval(input()))
k = int(eval(input()))
c = s[k - 1]
for i in range(n):
if s[i] != c:
s[i] = "*"
ans = "".join(s)
print(ans)
| false | 12.5 | [
"-s = eval(input())",
"+s = list(eval(input()))",
"-t = s[k - 1]",
"-s_list = list(s)",
"+c = s[k - 1]",
"- if s[i] != t:",
"- s_list[i] = \"*\"",
"-s_changed = \"\".join(s_list)",
"-print(s_changed)",
"+ if s[i] != c:",
"+ s[i] = \"*\"",
"+ans = \"\".join(s)",
"+print(an... | false | 0.051761 | 0.05181 | 0.999059 | [
"s442539102",
"s545960061"
] |
u796942881 | p03274 | python | s593498542 | s545985057 | 89 | 65 | 14,436 | 14,052 | Accepted | Accepted | 26.97 | MAX_D = 300000001
def main():
N, K, *xn = list(map(int, open(0).read().split()))
if 0 < xn[0]:
print((xn[K - 1]))
return
if xn[N - 1] < 0:
print((abs(xn[N - K])))
return
ans = MAX_D
for i in range(N - K + 1):
if xn[i + K - 1] < 0 and i + K <= N ... | def main():
N, K, *xn = list(map(int, open(0).read().split()))
ans = int(1e9+7)
for xl, xr in zip(xn[:], xn[K - 1:]):
ans = min(ans, xr - xl + min(abs(xr), abs(xl)))
print(ans)
return
main()
| 30 | 10 | 785 | 224 | MAX_D = 300000001
def main():
N, K, *xn = list(map(int, open(0).read().split()))
if 0 < xn[0]:
print((xn[K - 1]))
return
if xn[N - 1] < 0:
print((abs(xn[N - K])))
return
ans = MAX_D
for i in range(N - K + 1):
if xn[i + K - 1] < 0 and i + K <= N - 1 and 0 < x... | def main():
N, K, *xn = list(map(int, open(0).read().split()))
ans = int(1e9 + 7)
for xl, xr in zip(xn[:], xn[K - 1 :]):
ans = min(ans, xr - xl + min(abs(xr), abs(xl)))
print(ans)
return
main()
| false | 66.666667 | [
"-MAX_D = 300000001",
"-",
"-",
"- if 0 < xn[0]:",
"- print((xn[K - 1]))",
"- return",
"- if xn[N - 1] < 0:",
"- print((abs(xn[N - K])))",
"- return",
"- ans = MAX_D",
"- for i in range(N - K + 1):",
"- if xn[i + K - 1] < 0 and i + K <= N - 1 and ... | false | 0.035793 | 0.033288 | 1.075267 | [
"s593498542",
"s545985057"
] |
u347600233 | p02713 | python | s779600109 | s590203774 | 1,897 | 1,112 | 9,204 | 9,076 | Accepted | Accepted | 41.38 | def gcd(a, b):
if a < b:
a, b = b, a
while b:
a, b = b, a % b
return a
k = int(eval(input()))
sum = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
gcd_ij = gcd(i, j)
for k in range(1, k + 1):
sum += gcd(gcd_ij, k)
print(sum) | from math import gcd
k = int(eval(input()))
sum = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
gcd_ij = gcd(i, j)
for k in range(1, k + 1):
sum += gcd(gcd_ij, k)
print(sum) | 16 | 9 | 302 | 215 | def gcd(a, b):
if a < b:
a, b = b, a
while b:
a, b = b, a % b
return a
k = int(eval(input()))
sum = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
gcd_ij = gcd(i, j)
for k in range(1, k + 1):
sum += gcd(gcd_ij, k)
print(sum)
| from math import gcd
k = int(eval(input()))
sum = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
gcd_ij = gcd(i, j)
for k in range(1, k + 1):
sum += gcd(gcd_ij, k)
print(sum)
| false | 43.75 | [
"-def gcd(a, b):",
"- if a < b:",
"- a, b = b, a",
"- while b:",
"- a, b = b, a % b",
"- return a",
"-",
"+from math import gcd"
] | false | 0.078711 | 0.086225 | 0.912852 | [
"s779600109",
"s590203774"
] |
u935329231 | p02390 | python | s597115094 | s138822278 | 20 | 10 | 4,212 | 6,420 | Accepted | Accepted | 50 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def time(s):
h = s / 3600
m = (s - (h * 3600)) / 60
s = (s - (h * 3600)) - (m * 60)
h, m, s = list(map(str, (h, m, s)))
print("%s:%s:%s" % (h, m, s))
s = int(input())
if 0 <= s <= 86400:
time(s)
else:
sys.exit(0) | #! /usr/bin/env python
# -*- coding: utf-8 -*-
raw_time = int(input())
if 0 <= raw_time < 86400:
hour = raw_time / 3600
minute = (raw_time - hour * 3600) / 60
second = (raw_time - hour * 3600 - minute * 60)
print(("%d:%d:%d") % (hour, minute, second)) | 18 | 10 | 316 | 280 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def time(s):
h = s / 3600
m = (s - (h * 3600)) / 60
s = (s - (h * 3600)) - (m * 60)
h, m, s = list(map(str, (h, m, s)))
print("%s:%s:%s" % (h, m, s))
s = int(input())
if 0 <= s <= 86400:
time(s)
else:
sys.exit(0)
| #! /usr/bin/env python
# -*- coding: utf-8 -*-
raw_time = int(input())
if 0 <= raw_time < 86400:
hour = raw_time / 3600
minute = (raw_time - hour * 3600) / 60
second = raw_time - hour * 3600 - minute * 60
print(("%d:%d:%d") % (hour, minute, second))
| false | 44.444444 | [
"-import sys",
"-",
"-",
"-def time(s):",
"- h = s / 3600",
"- m = (s - (h * 3600)) / 60",
"- s = (s - (h * 3600)) - (m * 60)",
"- h, m, s = list(map(str, (h, m, s)))",
"- print(\"%s:%s:%s\" % (h, m, s))",
"-",
"-",
"-s = int(input())",
"-if 0 <= s <= 86400:",
"- time(s)"... | false | 0.06627 | 0.040225 | 1.647482 | [
"s597115094",
"s138822278"
] |
u075595666 | p02821 | python | s284664134 | s253920531 | 637 | 431 | 199,088 | 44,616 | Accepted | Accepted | 32.34 | import sys
input = sys.stdin.readline
mm = 10**10
k = mm.bit_length()
K = 1<<k
nu = lambda L: int("".join([bin(K+a)[-k:] for a in L[::-1]]), 2)
st = lambda n: bin(n)[2:] + "0"
li = lambda s: [int(a, 2) if len(a) else 0 for a in [s[-(i+1)*k-1:-i*k-1] for i in range(200001)]]
n,m = list(map(int, input().split... | import numpy as np
def convolve(A, B):
# 畳み込み # 要素は整数
# 3 つ以上の場合は一度にやった方がいい
dtype = np.int64
fft, ifft = np.fft.rfft, np.fft.irfft
a, b = len(A), len(B)
if a == b == 1:
return np.array([A[0]*B[0]])
n = a+b-1 # 返り値のリストの長さ
k = 1 << (n-1).bit_length()
AB = np.zeros(... | 27 | 35 | 592 | 803 | import sys
input = sys.stdin.readline
mm = 10**10
k = mm.bit_length()
K = 1 << k
nu = lambda L: int("".join([bin(K + a)[-k:] for a in L[::-1]]), 2)
st = lambda n: bin(n)[2:] + "0"
li = lambda s: [
int(a, 2) if len(a) else 0
for a in [s[-(i + 1) * k - 1 : -i * k - 1] for i in range(200001)]
]
n, m = list(map(in... | import numpy as np
def convolve(A, B):
# 畳み込み # 要素は整数
# 3 つ以上の場合は一度にやった方がいい
dtype = np.int64
fft, ifft = np.fft.rfft, np.fft.irfft
a, b = len(A), len(B)
if a == b == 1:
return np.array([A[0] * B[0]])
n = a + b - 1 # 返り値のリストの長さ
k = 1 << (n - 1).bit_length()
AB = np.zeros((... | false | 22.857143 | [
"+import numpy as np",
"+",
"+",
"+def convolve(A, B):",
"+ # 畳み込み # 要素は整数",
"+ # 3 つ以上の場合は一度にやった方がいい",
"+ dtype = np.int64",
"+ fft, ifft = np.fft.rfft, np.fft.irfft",
"+ a, b = len(A), len(B)",
"+ if a == b == 1:",
"+ return np.array([A[0] * B[0]])",
"+ n = a + b... | false | 0.774584 | 0.30394 | 2.548476 | [
"s284664134",
"s253920531"
] |
u325282913 | p03557 | python | s259712149 | s251254751 | 505 | 209 | 107,108 | 106,832 | Accepted | Accepted | 58.61 | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
check = [0] * N
ans = 0
for i in range(N):
check[i] = N - bisect.bisect_right(C,B[i])
for i in range(1,N):
check[N-1-i] += check[N-i]
for i ... | import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
cnt = [0]*N
for i in range(N):
cnt[i] = cnt[i-1] + bisect.bisect_left(A,B[i])
ans = 0
for i in range(N):
target = bisect.bisect_left(... | 17 | 14 | 430 | 383 | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
check = [0] * N
ans = 0
for i in range(N):
check[i] = N - bisect.bisect_right(C, B[i])
for i in range(1, N):
check[N - 1 - i] += check[N - i]
for i in... | import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
cnt = [0] * N
for i in range(N):
cnt[i] = cnt[i - 1] + bisect.bisect_left(A, B[i])
ans = 0
for i in range(N):
target = bisect.bisect_left(B, C... | false | 17.647059 | [
"-A = list(map(int, input().split()))",
"+A = sorted(list(map(int, input().split())))",
"-check = [0] * N",
"+cnt = [0] * N",
"+for i in range(N):",
"+ cnt[i] = cnt[i - 1] + bisect.bisect_left(A, B[i])",
"- check[i] = N - bisect.bisect_right(C, B[i])",
"-for i in range(1, N):",
"- check[N -... | false | 0.030326 | 0.037803 | 0.802213 | [
"s259712149",
"s251254751"
] |
u729133443 | p03128 | python | s599494136 | s796462492 | 201 | 167 | 15,268 | 15,332 | Accepted | Accepted | 16.92 | n,m,*a=list(map(int,open(0).read().split()))
c=(0,2,5,5,4,5,6,3,7,6)
d=[0]+[-1]*n*9
for i in range(n):
for j in a:
if d[i]+1:d[i+c[j]]=max(d[i+c[j]],d[i]*10+j)
print((d[n])) | n,m,*a=list(map(int,open(0).read().split()))
c=(0,2,5,5,4,5,6,3,7,6)
d=[0]*n*9
for i in range(n):
for j in a:
if d[i]or i<1:d[i+c[j]]=max(d[i+c[j]],d[i]*10+j)
print((d[n])) | 7 | 7 | 174 | 173 | n, m, *a = list(map(int, open(0).read().split()))
c = (0, 2, 5, 5, 4, 5, 6, 3, 7, 6)
d = [0] + [-1] * n * 9
for i in range(n):
for j in a:
if d[i] + 1:
d[i + c[j]] = max(d[i + c[j]], d[i] * 10 + j)
print((d[n]))
| n, m, *a = list(map(int, open(0).read().split()))
c = (0, 2, 5, 5, 4, 5, 6, 3, 7, 6)
d = [0] * n * 9
for i in range(n):
for j in a:
if d[i] or i < 1:
d[i + c[j]] = max(d[i + c[j]], d[i] * 10 + j)
print((d[n]))
| false | 0 | [
"-d = [0] + [-1] * n * 9",
"+d = [0] * n * 9",
"- if d[i] + 1:",
"+ if d[i] or i < 1:"
] | false | 0.05309 | 0.081441 | 0.651879 | [
"s599494136",
"s796462492"
] |
u606045429 | p02920 | python | s892355241 | s796201892 | 808 | 423 | 32,044 | 32,044 | Accepted | Accepted | 47.65 | INF = float("inf")
N, *S = list(map(int, open(0).read().split()))
M = len(S)
S.sort(reverse=True)
Q = [S[0]]
S[0] = INF
for _ in range(N):
Q.sort()
T = Q[:]
cur = 1
while Q:
p = Q.pop()
while S[cur] >= p:
cur += 1
if cur == M:
... | def main():
INF = float("inf")
N, *S = list(map(int, open(0).read().split()))
M = len(S)
S.sort(reverse=True)
Q = [S[0]]
S[0] = INF
for _ in range(N):
Q.sort()
T = Q[:]
cur = 1
while Q:
p = Q.pop()
while S[cur] >= p... | 27 | 30 | 428 | 536 | INF = float("inf")
N, *S = list(map(int, open(0).read().split()))
M = len(S)
S.sort(reverse=True)
Q = [S[0]]
S[0] = INF
for _ in range(N):
Q.sort()
T = Q[:]
cur = 1
while Q:
p = Q.pop()
while S[cur] >= p:
cur += 1
if cur == M:
print("No")
... | def main():
INF = float("inf")
N, *S = list(map(int, open(0).read().split()))
M = len(S)
S.sort(reverse=True)
Q = [S[0]]
S[0] = INF
for _ in range(N):
Q.sort()
T = Q[:]
cur = 1
while Q:
p = Q.pop()
while S[cur] >= p:
cur... | false | 10 | [
"-INF = float(\"inf\")",
"-N, *S = list(map(int, open(0).read().split()))",
"-M = len(S)",
"-S.sort(reverse=True)",
"-Q = [S[0]]",
"-S[0] = INF",
"-for _ in range(N):",
"- Q.sort()",
"- T = Q[:]",
"- cur = 1",
"- while Q:",
"- p = Q.pop()",
"- while S[cur] >= p:",
... | false | 0.072713 | 0.039764 | 1.828623 | [
"s892355241",
"s796201892"
] |
u263753244 | p02743 | python | s005640049 | s566576899 | 160 | 17 | 5,204 | 2,940 | Accepted | Accepted | 89.38 | from decimal import *
getcontext().prec=1000
a,b,c=list(map(int,input().split()))
A=Decimal(a)**Decimal("0.5")
B=Decimal(b)**Decimal("0.5")
C=Decimal(c)**Decimal("0.5")
D= Decimal(10) ** (-100)
if A+B+D<C:
print("Yes")
else:
print("No") | a,b,c=list(map(int,input().split()))
x=a**2 + b**2 + c**2 - 2*a*b - 2*a*c - 2*b*c
if x>0 and a+b-c<0:
print("Yes")
else:
print("No") | 11 | 6 | 248 | 139 | from decimal import *
getcontext().prec = 1000
a, b, c = list(map(int, input().split()))
A = Decimal(a) ** Decimal("0.5")
B = Decimal(b) ** Decimal("0.5")
C = Decimal(c) ** Decimal("0.5")
D = Decimal(10) ** (-100)
if A + B + D < C:
print("Yes")
else:
print("No")
| a, b, c = list(map(int, input().split()))
x = a**2 + b**2 + c**2 - 2 * a * b - 2 * a * c - 2 * b * c
if x > 0 and a + b - c < 0:
print("Yes")
else:
print("No")
| false | 45.454545 | [
"-from decimal import *",
"-",
"-getcontext().prec = 1000",
"-A = Decimal(a) ** Decimal(\"0.5\")",
"-B = Decimal(b) ** Decimal(\"0.5\")",
"-C = Decimal(c) ** Decimal(\"0.5\")",
"-D = Decimal(10) ** (-100)",
"-if A + B + D < C:",
"+x = a**2 + b**2 + c**2 - 2 * a * b - 2 * a * c - 2 * b * c",
"+if x... | false | 0.131411 | 0.032607 | 4.030167 | [
"s005640049",
"s566576899"
] |
u496687522 | p03240 | python | s554026574 | s033349154 | 114 | 27 | 3,064 | 3,064 | Accepted | Accepted | 76.32 | N = int(eval(input()))
lis = []
for _ in range(N):
x, y, h = list(map(int, input().split()))
if h > 0:
sx, sy, sh = x, y, h
lis.append((x, y, h))
for i in range(101):
for j in range(101):
high = sh + abs(sx - i) + abs(sy - j)
judge = -1
for x, y, h in lis:
... | N = int(eval(input()))
lis = []
for _ in range(N):
x, y, h = list(map(int, input().split()))
if h > 0:
sx, sy, sh = x, y, h
lis.append((x, y, h))
for i in range(101):
for j in range(101):
high = sh + abs(sx - i) + abs(sy - j)
judge = True
for x, y, h in lis:
... | 26 | 21 | 725 | 631 | N = int(eval(input()))
lis = []
for _ in range(N):
x, y, h = list(map(int, input().split()))
if h > 0:
sx, sy, sh = x, y, h
lis.append((x, y, h))
for i in range(101):
for j in range(101):
high = sh + abs(sx - i) + abs(sy - j)
judge = -1
for x, y, h in lis:
if ... | N = int(eval(input()))
lis = []
for _ in range(N):
x, y, h = list(map(int, input().split()))
if h > 0:
sx, sy, sh = x, y, h
lis.append((x, y, h))
for i in range(101):
for j in range(101):
high = sh + abs(sx - i) + abs(sy - j)
judge = True
for x, y, h in lis:
i... | false | 19.230769 | [
"- judge = -1",
"+ judge = True",
"- judge = 0",
"+ judge = False",
"- if judge == 0:",
"- continue",
"- for x, y, h in lis:",
"- judge = 0",
"+ judge = False",
"- if judge == 0:",
"- ... | false | 0.037395 | 0.034392 | 1.087294 | [
"s554026574",
"s033349154"
] |
u345966487 | p02707 | python | s747422496 | s826368656 | 229 | 170 | 34,032 | 34,888 | Accepted | Accepted | 25.76 | import collections
N = int(eval(input()))
boss = list(map(int, input().split()))
c = collections.Counter()
for b in boss:
c[b] += 1
for i in range(1,N+1):
print((c[i]))
| import sys
from collections import Counter
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.... | 8 | 16 | 176 | 418 | import collections
N = int(eval(input()))
boss = list(map(int, input().split()))
c = collections.Counter()
for b in boss:
c[b] += 1
for i in range(1, N + 1):
print((c[i]))
| import sys
from collections import Counter
sys.setrecursionlimit(10**8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **... | false | 50 | [
"-import collections",
"+import sys",
"+from collections import Counter",
"-N = int(eval(input()))",
"-boss = list(map(int, input().split()))",
"-c = collections.Counter()",
"-for b in boss:",
"- c[b] += 1",
"+sys.setrecursionlimit(10**8)",
"+ini = lambda: int(sys.stdin.readline())",
"+inm = ... | false | 0.062654 | 0.077306 | 0.81047 | [
"s747422496",
"s826368656"
] |
u994521204 | p02909 | python | s167405682 | s187277909 | 171 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.06 | s=eval(input())
dict={'Rainy':'Sunny', 'Sunny':'Cloudy', 'Cloudy':'Rainy'}
print((dict[s])) | s = eval(input())
memo = {"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"}
print((memo[s]))
| 3 | 3 | 85 | 93 | s = eval(input())
dict = {"Rainy": "Sunny", "Sunny": "Cloudy", "Cloudy": "Rainy"}
print((dict[s]))
| s = eval(input())
memo = {"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"}
print((memo[s]))
| false | 0 | [
"-dict = {\"Rainy\": \"Sunny\", \"Sunny\": \"Cloudy\", \"Cloudy\": \"Rainy\"}",
"-print((dict[s]))",
"+memo = {\"Sunny\": \"Cloudy\", \"Cloudy\": \"Rainy\", \"Rainy\": \"Sunny\"}",
"+print((memo[s]))"
] | false | 0.048469 | 0.044443 | 1.090596 | [
"s167405682",
"s187277909"
] |
u730769327 | p03633 | python | s919457872 | s619828201 | 266 | 108 | 63,980 | 73,072 | Accepted | Accepted | 59.4 | import fractions
from functools import reduce
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
n=int(eval(input()))
print((lcm_list([int(eval(input())) for _ in range(n... | from fractions import gcd
from functools import reduce
n=int(eval(input()))
g=1
for i in range(n):
t=int(eval(input()))
g=g*t//gcd(g,t)
print(g)
| 14 | 8 | 311 | 144 | import fractions
from functools import reduce
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
n = int(eval(input()))
print((lcm_list([int(eval(input())) for _ in range(n)])))
| from fractions import gcd
from functools import reduce
n = int(eval(input()))
g = 1
for i in range(n):
t = int(eval(input()))
g = g * t // gcd(g, t)
print(g)
| false | 42.857143 | [
"-import fractions",
"+from fractions import gcd",
"-",
"-def lcm_base(x, y):",
"- return (x * y) // fractions.gcd(x, y)",
"-",
"-",
"-def lcm(*numbers):",
"- return reduce(lcm_base, numbers, 1)",
"-",
"-",
"-def lcm_list(numbers):",
"- return reduce(lcm_base, numbers, 1)",
"-",
... | false | 0.046328 | 0.045436 | 1.019643 | [
"s919457872",
"s619828201"
] |
u970197315 | p02834 | python | s481325360 | s108516975 | 670 | 581 | 29,360 | 29,336 | Accepted | Accepted | 13.28 | # ABC148 F
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))
N, u, v = nm()
u -= 1
v -= 1
G = [[] for i in range(N)]
for i in range(N-1):
A, B = nm()
A -= 1
B -= 1
G[A].append(B)
G[B].app... | from collections import deque
n,u,v=list(map(int,input().split()))
G=[[] for i in range(n)]
dist_u=[-1]*n
dist_v=[-1]*n
for i in range(n-1):
a,b=list(map(int,input().split()))
G[a-1].append(b-1)
G[b-1].append(a-1)
u-=1
v-=1
dist_u[u]=0
q=deque([u])
while q:
cur=q.popleft()
for n... | 47 | 39 | 880 | 706 | # ABC148 F
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))
N, u, v = nm()
u -= 1
v -= 1
G = [[] for i in range(N)]
for i in range(N - 1):
A, B = nm()
A -= 1
B -= 1
G[A].append(B)
G[B].append(A)
dist_... | from collections import deque
n, u, v = list(map(int, input().split()))
G = [[] for i in range(n)]
dist_u = [-1] * n
dist_v = [-1] * n
for i in range(n - 1):
a, b = list(map(int, input().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
u -= 1
v -= 1
dist_u[u] = 0
q = deque([u])
while q:
cur = q.... | false | 17.021277 | [
"-# ABC148 F",
"-si = lambda: eval(input())",
"-ni = lambda: int(eval(input()))",
"-nm = lambda: list(map(int, input().split()))",
"-nl = lambda: list(map(int, input().split()))",
"-N, u, v = nm()",
"+from collections import deque",
"+",
"+n, u, v = list(map(int, input().split()))",
"+G = [[] for ... | false | 0.046618 | 0.04584 | 1.016972 | [
"s481325360",
"s108516975"
] |
u057109575 | p03006 | python | s858420580 | s790847124 | 181 | 119 | 39,792 | 70,688 | Accepted | Accepted | 34.25 | from itertools import combinations
from collections import Counter
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
if N == 1:
print((1))
quit()
X.sort()
diff = []
for i, j in combinations(list(range(N)), 2):
diff.append((X[i][0] - X[j][0], X[i][1] - X[j][1]))
... |
from collections import defaultdict
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
X.sort()
ctr = defaultdict(int)
for i in range(N - 1):
for j in range(i + 1, N):
p = X[i][0] - X[j][0]
q = X[i][1] - X[j][1]
ctr[(p, q)] += 1
ctr[(-p, -q... | 17 | 19 | 355 | 391 | from itertools import combinations
from collections import Counter
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
if N == 1:
print((1))
quit()
X.sort()
diff = []
for i, j in combinations(list(range(N)), 2):
diff.append((X[i][0] - X[j][0], X[i][1] - X[j][1]))
print((N - Count... | from collections import defaultdict
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
X.sort()
ctr = defaultdict(int)
for i in range(N - 1):
for j in range(i + 1, N):
p = X[i][0] - X[j][0]
q = X[i][1] - X[j][1]
ctr[(p, q)] += 1
ctr[(-p, -q)] += 1
if N ==... | false | 10.526316 | [
"-from itertools import combinations",
"-from collections import Counter",
"+from collections import defaultdict",
"+X.sort()",
"+ctr = defaultdict(int)",
"+for i in range(N - 1):",
"+ for j in range(i + 1, N):",
"+ p = X[i][0] - X[j][0]",
"+ q = X[i][1] - X[j][1]",
"+ ctr[... | false | 0.039248 | 0.03941 | 0.995901 | [
"s858420580",
"s790847124"
] |
u167988719 | p02755 | python | s714453486 | s584603538 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | A, B = list(map(int, input().split()))
ans = -1
for p in range(1, 20000):
if p * 8 // 100 == A and p * 10 // 100 == B:
ans = p
break
print(ans) | A, B = list(map(int, input().split()))
p = max((25*A+1)//2,(20*B+1)//2)
if p * 2 >= min(25*(A+1), 20*(B+1)):
p = -1
print(p) | 8 | 7 | 165 | 130 | A, B = list(map(int, input().split()))
ans = -1
for p in range(1, 20000):
if p * 8 // 100 == A and p * 10 // 100 == B:
ans = p
break
print(ans)
| A, B = list(map(int, input().split()))
p = max((25 * A + 1) // 2, (20 * B + 1) // 2)
if p * 2 >= min(25 * (A + 1), 20 * (B + 1)):
p = -1
print(p)
| false | 12.5 | [
"-ans = -1",
"-for p in range(1, 20000):",
"- if p * 8 // 100 == A and p * 10 // 100 == B:",
"- ans = p",
"- break",
"-print(ans)",
"+p = max((25 * A + 1) // 2, (20 * B + 1) // 2)",
"+if p * 2 >= min(25 * (A + 1), 20 * (B + 1)):",
"+ p = -1",
"+print(p)"
] | false | 0.045672 | 0.043805 | 1.042626 | [
"s714453486",
"s584603538"
] |
u525065967 | p02615 | python | s767294809 | s546039225 | 206 | 163 | 32,324 | 32,596 | Accepted | Accepted | 20.87 | from collections import deque
n = int(eval(input()))
A = [*list(map(int, input().split()))]
# print(n)
# print(A)
A.sort(reverse=True)
# print(A)
q = deque([A[0]])
B = []
for a in A[1:]:
x = q.popleft()
B.append(x)
q.append(a)
q.append(a)
# print(q)
# print(B)
print((sum(B)))
| from collections import deque
eval(input())
A = [*list(map(int, input().split()))]
A.sort(reverse=True)
q = deque([A[0]])
P = []
for a in A[1:]:
p = q.popleft()
P.append(p)
q.append(a); q.append(a)
print((sum(P)))
| 20 | 11 | 301 | 222 | from collections import deque
n = int(eval(input()))
A = [*list(map(int, input().split()))]
# print(n)
# print(A)
A.sort(reverse=True)
# print(A)
q = deque([A[0]])
B = []
for a in A[1:]:
x = q.popleft()
B.append(x)
q.append(a)
q.append(a)
# print(q)
# print(B)
print((sum(B)))
| from collections import deque
eval(input())
A = [*list(map(int, input().split()))]
A.sort(reverse=True)
q = deque([A[0]])
P = []
for a in A[1:]:
p = q.popleft()
P.append(p)
q.append(a)
q.append(a)
print((sum(P)))
| false | 45 | [
"-n = int(eval(input()))",
"+eval(input())",
"-# print(n)",
"-# print(A)",
"-# print(A)",
"-B = []",
"+P = []",
"- x = q.popleft()",
"- B.append(x)",
"+ p = q.popleft()",
"+ P.append(p)",
"-# print(q)",
"-# print(B)",
"-print((sum(B)))",
"+print((sum(P)))"
] | false | 0.075157 | 0.031672 | 2.372964 | [
"s767294809",
"s546039225"
] |
u305366205 | p03252 | python | s754709519 | s408433089 | 159 | 56 | 3,888 | 3,632 | Accepted | Accepted | 64.78 | import collections
s = eval(input())
t = eval(input())
dd = collections.defaultdict(str)
dd2 = collections.defaultdict(str)
for i in range(len(s)):
key = s[i]
key2 = t[i]
if dd[key] != '' and dd[key] != key2 or dd2[key2] != '' and dd2[key2] != key:
print('No')
exit()
dd[key] =... | s = eval(input())
t = eval(input())
d = {}
for si, ti in zip(s, t):
if si in d:
if d[si] != ti:
print('No')
exit()
else:
d[si] = ti
l = len(set(d.values()))
print(('Yes' if len(d) == l else 'No')) | 14 | 12 | 348 | 241 | import collections
s = eval(input())
t = eval(input())
dd = collections.defaultdict(str)
dd2 = collections.defaultdict(str)
for i in range(len(s)):
key = s[i]
key2 = t[i]
if dd[key] != "" and dd[key] != key2 or dd2[key2] != "" and dd2[key2] != key:
print("No")
exit()
dd[key] = key2
... | s = eval(input())
t = eval(input())
d = {}
for si, ti in zip(s, t):
if si in d:
if d[si] != ti:
print("No")
exit()
else:
d[si] = ti
l = len(set(d.values()))
print(("Yes" if len(d) == l else "No"))
| false | 14.285714 | [
"-import collections",
"-",
"-dd = collections.defaultdict(str)",
"-dd2 = collections.defaultdict(str)",
"-for i in range(len(s)):",
"- key = s[i]",
"- key2 = t[i]",
"- if dd[key] != \"\" and dd[key] != key2 or dd2[key2] != \"\" and dd2[key2] != key:",
"- print(\"No\")",
"- ... | false | 0.036812 | 0.037426 | 0.983588 | [
"s754709519",
"s408433089"
] |
u037430802 | p03053 | python | s841338214 | s738574114 | 998 | 566 | 107,176 | 116,572 | Accepted | Accepted | 43.29 | from collections import deque
def main():
H,W = list(map(int, input().split()))
A = [[a for a in eval(input())] for _ in range(H)]
#stack = deque([(i, j) for i in range(H) for j in range(W) if A[i][j]=="#"])
stack = [(i, j) for i in range(H) for j in range(W) if A[i][j]=="#"]
ans = 0
... | from collections import deque
H,W = list(map(int, input().split()))
A = [[str(i) for i in list(eval(input()))] for _ in range(H)]
q = deque()
for i in range(H):
for j in range(W):
if A[i][j] == "#":
q.append((i,j))
ans = 0
dyx = [(1,0), (0,1), (-1,0), (0,-1)]
while q:
fl... | 51 | 33 | 1,399 | 702 | from collections import deque
def main():
H, W = list(map(int, input().split()))
A = [[a for a in eval(input())] for _ in range(H)]
# stack = deque([(i, j) for i in range(H) for j in range(W) if A[i][j]=="#"])
stack = [(i, j) for i in range(H) for j in range(W) if A[i][j] == "#"]
ans = 0
flag ... | from collections import deque
H, W = list(map(int, input().split()))
A = [[str(i) for i in list(eval(input()))] for _ in range(H)]
q = deque()
for i in range(H):
for j in range(W):
if A[i][j] == "#":
q.append((i, j))
ans = 0
dyx = [(1, 0), (0, 1), (-1, 0), (0, -1)]
while q:
flag = False
... | false | 35.294118 | [
"-",
"-def main():",
"- H, W = list(map(int, input().split()))",
"- A = [[a for a in eval(input())] for _ in range(H)]",
"- # stack = deque([(i, j) for i in range(H) for j in range(W) if A[i][j]==\"#\"])",
"- stack = [(i, j) for i in range(H) for j in range(W) if A[i][j] == \"#\"]",
"- an... | false | 0.041827 | 0.065767 | 0.635979 | [
"s841338214",
"s738574114"
] |
u609061751 | p03325 | python | s411800205 | s573227056 | 212 | 69 | 13,236 | 4,084 | Accepted | Accepted | 67.45 | import sys
import numpy as np
input = sys.stdin.readline
N = int(eval(input()))
a = [int(x) for x in input().split()]
ans = 0
for i in a:
cnt = 0
while i % 2 == 0:
cnt += 1
i //= 2
ans += cnt
print(ans) | import sys
input = sys.stdin.readline
n = int(eval(input()))
a = [int(x) for x in input().split()]
cnt = 0
def count_even(x):
global cnt
while x % 2 == 0:
cnt += 1
x //= 2
for i in a:
count_even(i)
print(cnt) | 13 | 18 | 236 | 252 | import sys
import numpy as np
input = sys.stdin.readline
N = int(eval(input()))
a = [int(x) for x in input().split()]
ans = 0
for i in a:
cnt = 0
while i % 2 == 0:
cnt += 1
i //= 2
ans += cnt
print(ans)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
a = [int(x) for x in input().split()]
cnt = 0
def count_even(x):
global cnt
while x % 2 == 0:
cnt += 1
x //= 2
for i in a:
count_even(i)
print(cnt)
| false | 27.777778 | [
"-import numpy as np",
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-ans = 0",
"+cnt = 0",
"+",
"+",
"+def count_even(x):",
"+ global cnt",
"+ while x % 2 == 0:",
"+ cnt += 1",
"+ x //= 2",
"+",
"+",
"- cnt = 0",
"- while i % 2 == 0:",
"- cn... | false | 0.036664 | 0.036568 | 1.00262 | [
"s411800205",
"s573227056"
] |
u116002573 | p02688 | python | s857252234 | s543955057 | 65 | 23 | 67,680 | 9,172 | Accepted | Accepted | 64.62 | def main():
N, K = list(map(int, input().split()))
v = [0 for _ in range(N)]
for _ in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for u in A:
v[u-1] += 1
ans = 0
for i in range(N):
if v[i] == 0: ans += 1
return ans... | def main():
N, K = list(map(int, input().split()))
p = set()
for _ in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for i in range(d):
p.add(A[i])
return N - len(p)
if __name__ == '__main__':
print((main()))
| 16 | 13 | 358 | 287 | def main():
N, K = list(map(int, input().split()))
v = [0 for _ in range(N)]
for _ in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for u in A:
v[u - 1] += 1
ans = 0
for i in range(N):
if v[i] == 0:
ans += 1
return an... | def main():
N, K = list(map(int, input().split()))
p = set()
for _ in range(K):
d = int(eval(input()))
A = list(map(int, input().split()))
for i in range(d):
p.add(A[i])
return N - len(p)
if __name__ == "__main__":
print((main()))
| false | 18.75 | [
"- v = [0 for _ in range(N)]",
"+ p = set()",
"- for u in A:",
"- v[u - 1] += 1",
"- ans = 0",
"- for i in range(N):",
"- if v[i] == 0:",
"- ans += 1",
"- return ans",
"+ for i in range(d):",
"+ p.add(A[i])",
"+ return N -... | false | 0.151897 | 0.150435 | 1.009718 | [
"s857252234",
"s543955057"
] |
u411203878 | p03835 | python | s286893115 | s325631066 | 384 | 90 | 42,204 | 66,816 | Accepted | Accepted | 76.56 | k,s = list(map(int,input().split()))
count = 0
for i in range(s+1):
for j in range(1+s-i):
if 0<=i<=k and 0<=j<=k and 0<=s-i-j<=k:
count += 1
print(count) | K,S = list(map(int,input().split()))
ans = 0
for x in range(K+1):
for y in range(K+1):
if 0 <= S-(x+y) <= K:
ans += 1
print(ans) | 7 | 7 | 178 | 152 | k, s = list(map(int, input().split()))
count = 0
for i in range(s + 1):
for j in range(1 + s - i):
if 0 <= i <= k and 0 <= j <= k and 0 <= s - i - j <= k:
count += 1
print(count)
| K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
if 0 <= S - (x + y) <= K:
ans += 1
print(ans)
| false | 0 | [
"-k, s = list(map(int, input().split()))",
"-count = 0",
"-for i in range(s + 1):",
"- for j in range(1 + s - i):",
"- if 0 <= i <= k and 0 <= j <= k and 0 <= s - i - j <= k:",
"- count += 1",
"-print(count)",
"+K, S = list(map(int, input().split()))",
"+ans = 0",
"+for x in r... | false | 0.034469 | 0.035704 | 0.965419 | [
"s286893115",
"s325631066"
] |
u186838327 | p03043 | python | s687388075 | s343421846 | 100 | 43 | 2,940 | 2,940 | Accepted | Accepted | 57 | import math
n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
x = max(math.ceil(math.log2(k)-math.log2(i)), 0)
# print(x)
ans += (1/n) * ((1/2)**x)
print(ans)
| n, k = list(map(int, input().split()))
import math
ans = 0
for i in range(1, n+1):
if i >= k:
t = 0
else:
t = math.ceil(math.log2(k/i))
#print(t)
ans += (1/n)*((1/2)**t)
print(ans)
| 9 | 12 | 189 | 219 | import math
n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
x = max(math.ceil(math.log2(k) - math.log2(i)), 0)
# print(x)
ans += (1 / n) * ((1 / 2) ** x)
print(ans)
| n, k = list(map(int, input().split()))
import math
ans = 0
for i in range(1, n + 1):
if i >= k:
t = 0
else:
t = math.ceil(math.log2(k / i))
# print(t)
ans += (1 / n) * ((1 / 2) ** t)
print(ans)
| false | 25 | [
"+n, k = list(map(int, input().split()))",
"-n, k = list(map(int, input().split()))",
"- x = max(math.ceil(math.log2(k) - math.log2(i)), 0)",
"- # print(x)",
"- ans += (1 / n) * ((1 / 2) ** x)",
"+ if i >= k:",
"+ t = 0",
"+ else:",
"+ t = math.ceil(math.log2(k / i))",
... | false | 0.201852 | 0.130711 | 1.544263 | [
"s687388075",
"s343421846"
] |
u536113865 | p03683 | python | s704619462 | s406671205 | 701 | 48 | 5,184 | 3,060 | Accepted | Accepted | 93.15 | import math
n, m = list(map(int,input().split()))
sum = 0
if -2<n-m<2:
if n<m:
n,m = m,n
sum = math.factorial(n)*math.factorial(m)*2**(m-n+1)
sum %= 1000000007
print(sum) | n, m = list(map(int,input().split()))
MOD = 1000000007
def f(n):
ans = 1
for i in range(1,n+1):
ans*=i
ans%=MOD
return ans
sum = 0
if -2<n-m<2:
if n<m:
n,m = m,n
sum = f(n)*f(m)*2**(m-n+1)
sum %= MOD
print(sum)
| 10 | 17 | 194 | 271 | import math
n, m = list(map(int, input().split()))
sum = 0
if -2 < n - m < 2:
if n < m:
n, m = m, n
sum = math.factorial(n) * math.factorial(m) * 2 ** (m - n + 1)
sum %= 1000000007
print(sum)
| n, m = list(map(int, input().split()))
MOD = 1000000007
def f(n):
ans = 1
for i in range(1, n + 1):
ans *= i
ans %= MOD
return ans
sum = 0
if -2 < n - m < 2:
if n < m:
n, m = m, n
sum = f(n) * f(m) * 2 ** (m - n + 1)
sum %= MOD
print(sum)
| false | 41.176471 | [
"-import math",
"+n, m = list(map(int, input().split()))",
"+MOD = 1000000007",
"-n, m = list(map(int, input().split()))",
"+",
"+def f(n):",
"+ ans = 1",
"+ for i in range(1, n + 1):",
"+ ans *= i",
"+ ans %= MOD",
"+ return ans",
"+",
"+",
"- sum = math.factoria... | false | 0.082494 | 0.040195 | 2.052362 | [
"s704619462",
"s406671205"
] |
u506549878 | p03835 | python | s085804821 | s211252062 | 1,846 | 1,476 | 2,940 | 2,940 | Accepted | Accepted | 20.04 | k,s = list(map(int, input().split()))
flg = 0
for x in range(k+1):
for y in range(k+1):
z = s-x-y
if z>= 0 and z <= k:
flg += 1
print(flg) | k, s = list(map(int, input().split()))
flg = 0
for x in range(k+1):
for y in range(k+1):
z = s-x-y
if 0<= z <= k:
flg += 1
print(flg) | 8 | 8 | 191 | 178 | k, s = list(map(int, input().split()))
flg = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if z >= 0 and z <= k:
flg += 1
print(flg)
| k, s = list(map(int, input().split()))
flg = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if 0 <= z <= k:
flg += 1
print(flg)
| false | 0 | [
"- if z >= 0 and z <= k:",
"+ if 0 <= z <= k:"
] | false | 0.040651 | 0.044741 | 0.908588 | [
"s085804821",
"s211252062"
] |
u875291233 | p02956 | python | s158548237 | s692226245 | 1,924 | 1,656 | 122,104 | 111,452 | Accepted | Accepted | 13.93 | # coding: utf-8
# Your code here!
"""
Binary indexed tree
0-indexed, 関数は閉区間
0からの区間加算、1点更新
"""
class BIT: #0-indexed
def __init__(self, n):
self.tree = [0]*(n+1)
self.tree[0] = None
# self.element = [0]*(n+1)
def sum(self, i): #a_0 + ... + a_{i} #閉区間
s = 0; i += 1
... | # coding: utf-8
# Your code here!
"""
Binary indexed tree
0-indexed, 関数は閉区間
0からの区間加算、1点更新
"""
class BIT: #0-indexed
def __init__(self, n):
self.tree = [0]*(n+1)
self.tree[0] = None
# self.element = [0]*(n+1)
def sum(self, i): #a_0 + ... + a_{i} #閉区間
s = 0; i += 1
... | 93 | 94 | 2,092 | 1,841 | # coding: utf-8
# Your code here!
"""
Binary indexed tree
0-indexed, 関数は閉区間
0からの区間加算、1点更新
"""
class BIT: # 0-indexed
def __init__(self, n):
self.tree = [0] * (n + 1)
self.tree[0] = None
# self.element = [0]*(n+1)
def sum(self, i): # a_0 + ... + a_{i} #閉区間
s = 0
i ... | # coding: utf-8
# Your code here!
"""
Binary indexed tree
0-indexed, 関数は閉区間
0からの区間加算、1点更新
"""
class BIT: # 0-indexed
def __init__(self, n):
self.tree = [0] * (n + 1)
self.tree[0] = None
# self.element = [0]*(n+1)
def sum(self, i): # a_0 + ... + a_{i} #閉区間
s = 0
i ... | false | 1.06383 | [
"-# http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3791366",
"-###########################################",
"-dame_x = [0] * n",
"-dame_y = [0] * n",
"-dame_xy = [0] * n",
"+# dame_x = [0]*n",
"+# dame_y = [0]*n",
"+# dame_xy = [0]*n",
"+ABi = [0] * n",
"+CDi = [0] * n",
"-sxyi = sorted(x... | false | 0.036419 | 0.037491 | 0.971403 | [
"s158548237",
"s692226245"
] |
u075012704 | p03703 | python | s159138637 | s554653585 | 1,486 | 1,008 | 33,140 | 82,212 | Accepted | Accepted | 32.17 | from itertools import accumulate
from bisect import bisect_right
N, K = list(map(int, input().split()))
A = [0] + [int(eval(input())) for i in range(N)]
diff = [a - K for a in A]
diff = list(accumulate(diff))
class BinaryIndexedTree:
def __init__(self, n):
self.size = n
self.bit = [... | from itertools import accumulate
from bisect import bisect_right
N, K = list(map(int, input().split()))
A = [3] + [int(eval(input())) for i in range(N)]
diff = [a - K for a in A]
diff = list(accumulate(diff))
class BinaryIndexedTree:
def __init__(self, n):
self.size = n
self.bit = [... | 42 | 42 | 830 | 830 | from itertools import accumulate
from bisect import bisect_right
N, K = list(map(int, input().split()))
A = [0] + [int(eval(input())) for i in range(N)]
diff = [a - K for a in A]
diff = list(accumulate(diff))
class BinaryIndexedTree:
def __init__(self, n):
self.size = n
self.bit = [0] * (n + 1)
... | from itertools import accumulate
from bisect import bisect_right
N, K = list(map(int, input().split()))
A = [3] + [int(eval(input())) for i in range(N)]
diff = [a - K for a in A]
diff = list(accumulate(diff))
class BinaryIndexedTree:
def __init__(self, n):
self.size = n
self.bit = [0] * (n + 1)
... | false | 0 | [
"-A = [0] + [int(eval(input())) for i in range(N)]",
"+A = [3] + [int(eval(input())) for i in range(N)]"
] | false | 0.043813 | 0.081985 | 0.534401 | [
"s159138637",
"s554653585"
] |
u912237403 | p00107 | python | s935888185 | s802002040 | 20 | 10 | 4,260 | 4,208 | Accepted | Accepted | 50 | while 1:
a,b,c=sorted(map(int,input().split()))
if a==b==c==0: break
D=(a*a+b*b)**.5
for _ in [0]*eval(input()): print(["NA","OK"][2*eval(input())>D]) | while 1:
a,b,c=sorted(map(int,input().split()))
if a==b==c==0: break
D=a*a+b*b
n=eval(input())
for _ in [0]*n:
r=eval(input())
print(["NA","OK"][4*r**2>D]) | 5 | 8 | 153 | 171 | while 1:
a, b, c = sorted(map(int, input().split()))
if a == b == c == 0:
break
D = (a * a + b * b) ** 0.5
for _ in [0] * eval(input()):
print(["NA", "OK"][2 * eval(input()) > D])
| while 1:
a, b, c = sorted(map(int, input().split()))
if a == b == c == 0:
break
D = a * a + b * b
n = eval(input())
for _ in [0] * n:
r = eval(input())
print(["NA", "OK"][4 * r**2 > D])
| false | 37.5 | [
"- D = (a * a + b * b) ** 0.5",
"- for _ in [0] * eval(input()):",
"- print([\"NA\", \"OK\"][2 * eval(input()) > D])",
"+ D = a * a + b * b",
"+ n = eval(input())",
"+ for _ in [0] * n:",
"+ r = eval(input())",
"+ print([\"NA\", \"OK\"][4 * r**2 > D])"
] | false | 0.04809 | 0.047577 | 1.010773 | [
"s935888185",
"s802002040"
] |
u935558307 | p03722 | python | s487582963 | s522633851 | 212 | 165 | 75,516 | 74,996 | Accepted | Accepted | 22.17 | N,M = list(map(int,input().split()))
dp = [-float("INF")]*(N+1)
dp[1] = 0
edges = [list(map(int,input().split())) for _ in range(M)]
cnt = 0
while cnt < N:
cnt += 1
for a,b,c in edges:
dp[b] = max(dp[a]+c,dp[b])
tmp = dp[N]
cnt = 0
while cnt < N:
cnt += 1
for a,b,c in edges:
... | N,M = list(map(int,input().split()))
edges = []
for _ in range(M):
a,b,c = list(map(int,input().split()))
edges.append((a,b,c))
cost = [-float("INF")]*(N+1)
cost[1] = 0
cnt = 0
flag = True
for _ in range(N):
for a,b,c in edges:
if cost[a]+c > cost[b]:
cost[b] = cost[a]+c
... | 19 | 27 | 402 | 500 | N, M = list(map(int, input().split()))
dp = [-float("INF")] * (N + 1)
dp[1] = 0
edges = [list(map(int, input().split())) for _ in range(M)]
cnt = 0
while cnt < N:
cnt += 1
for a, b, c in edges:
dp[b] = max(dp[a] + c, dp[b])
tmp = dp[N]
cnt = 0
while cnt < N:
cnt += 1
for a, b, c in edges:
... | N, M = list(map(int, input().split()))
edges = []
for _ in range(M):
a, b, c = list(map(int, input().split()))
edges.append((a, b, c))
cost = [-float("INF")] * (N + 1)
cost[1] = 0
cnt = 0
flag = True
for _ in range(N):
for a, b, c in edges:
if cost[a] + c > cost[b]:
cost[b] = cost[a] + c... | false | 29.62963 | [
"-dp = [-float(\"INF\")] * (N + 1)",
"-dp[1] = 0",
"-edges = [list(map(int, input().split())) for _ in range(M)]",
"+edges = []",
"+for _ in range(M):",
"+ a, b, c = list(map(int, input().split()))",
"+ edges.append((a, b, c))",
"+cost = [-float(\"INF\")] * (N + 1)",
"+cost[1] = 0",
"-while ... | false | 0.034493 | 0.034302 | 1.005581 | [
"s487582963",
"s522633851"
] |
u682860781 | p03127 | python | s888277003 | s331988409 | 210 | 81 | 14,180 | 16,280 | Accepted | Accepted | 61.43 | from heapq import heapify, heappop, heappush
n = int(eval(input()))
a = list(map(int, input().split()))
heapify(a)
while len(a) > 1:
a1, a2 = heappop(a), heappop(a)
m = a2 % a1
heappush(a, a1)
if m:
heappush(a, m)
print((heappop(a))) | from fractions import gcd
from functools import reduce
n = int(eval(input()))
a = list(map(int, input().split()))
answer = reduce(gcd, a)
print(answer) | 13 | 7 | 263 | 152 | from heapq import heapify, heappop, heappush
n = int(eval(input()))
a = list(map(int, input().split()))
heapify(a)
while len(a) > 1:
a1, a2 = heappop(a), heappop(a)
m = a2 % a1
heappush(a, a1)
if m:
heappush(a, m)
print((heappop(a)))
| from fractions import gcd
from functools import reduce
n = int(eval(input()))
a = list(map(int, input().split()))
answer = reduce(gcd, a)
print(answer)
| false | 46.153846 | [
"-from heapq import heapify, heappop, heappush",
"+from fractions import gcd",
"+from functools import reduce",
"-heapify(a)",
"-while len(a) > 1:",
"- a1, a2 = heappop(a), heappop(a)",
"- m = a2 % a1",
"- heappush(a, a1)",
"- if m:",
"- heappush(a, m)",
"-print((heappop(a)))"... | false | 0.041762 | 0.05545 | 0.753154 | [
"s888277003",
"s331988409"
] |
u712284046 | p02785 | python | s241273750 | s624546654 | 241 | 151 | 25,896 | 26,020 | Accepted | Accepted | 37.34 | import heapq
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
minus_H = [i * (-1) for i in H]
heapq.heapify(minus_H)
for i in range(min(N, K)):
heapq.heappop(minus_H)
ans = - sum(minus_H)
print(ans)
| N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
H.sort(reverse = True)
if K >= N:
ans = 0
else:
ans = sum(H[K:])
print(ans)
| 14 | 11 | 241 | 166 | import heapq
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
minus_H = [i * (-1) for i in H]
heapq.heapify(minus_H)
for i in range(min(N, K)):
heapq.heappop(minus_H)
ans = -sum(minus_H)
print(ans)
| N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
H.sort(reverse=True)
if K >= N:
ans = 0
else:
ans = sum(H[K:])
print(ans)
| false | 21.428571 | [
"-import heapq",
"-",
"-minus_H = [i * (-1) for i in H]",
"-heapq.heapify(minus_H)",
"-for i in range(min(N, K)):",
"- heapq.heappop(minus_H)",
"-ans = -sum(minus_H)",
"+H.sort(reverse=True)",
"+if K >= N:",
"+ ans = 0",
"+else:",
"+ ans = sum(H[K:])"
] | false | 0.033056 | 0.037241 | 0.887625 | [
"s241273750",
"s624546654"
] |
u564902833 | p03090 | python | s788027916 | s499861039 | 26 | 20 | 3,700 | 3,316 | Accepted | Accepted | 23.08 | N = int(eval(input()))
ans = []
if N % 2 == 0:
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
if i + j != N + 1:
ans.append((i, j))
else:
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
if i + j != N:
ans.append(... | # 入力
N = int(eval(input()))
# Nが偶数ならば完全グラフから辺 (1, N), (2, N-1), ... を除いたグラフが解
# Nが奇数ならば完全グラフから辺 (1, N-1), (2, N-2), ... を除いたグラフが解
M = (
N * (N - 1) // 2 - N // 2 if N % 2 == 0 else
N * (N - 1) // 2 - (N - 1) // 2
)
s = N + 1 if N % 2 == 0 else N
ans = str(M) + '\n' + '\n'.join(
'{} {}'.format(i,... | 15 | 19 | 388 | 420 | N = int(eval(input()))
ans = []
if N % 2 == 0:
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
if i + j != N + 1:
ans.append((i, j))
else:
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
if i + j != N:
ans.append((i, j))
pri... | # 入力
N = int(eval(input()))
# Nが偶数ならば完全グラフから辺 (1, N), (2, N-1), ... を除いたグラフが解
# Nが奇数ならば完全グラフから辺 (1, N-1), (2, N-2), ... を除いたグラフが解
M = N * (N - 1) // 2 - N // 2 if N % 2 == 0 else N * (N - 1) // 2 - (N - 1) // 2
s = N + 1 if N % 2 == 0 else N
ans = (
str(M)
+ "\n"
+ "\n".join(
"{} {}".format(i, j)
... | false | 21.052632 | [
"+# 入力",
"-ans = []",
"-if N % 2 == 0:",
"- for i in range(1, N + 1):",
"- for j in range(i + 1, N + 1):",
"- if i + j != N + 1:",
"- ans.append((i, j))",
"-else:",
"- for i in range(1, N + 1):",
"- for j in range(i + 1, N + 1):",
"- if i ... | false | 0.04852 | 0.047376 | 1.02415 | [
"s788027916",
"s499861039"
] |
u411203878 | p03504 | python | s639721056 | s555535397 | 1,026 | 421 | 76,120 | 98,532 | Accepted | Accepted | 58.97 | n,c = list(map(int,input().split()))
program = [list(map(int,input().split())) for i in range(n)]
time = [0 for i in range(10**5+1)]
program.sort()
program.sort(key = lambda x: x[2])
for i in range(1,n):
if program[i][2]==program[i-1][2] and program[i][0]==program[i-1][1]:
program[i][0] = progra... | n,c = list(map(int,input().split()))
ab = []
for _ in range(n):
s, t, cha = (int(x) for x in input().split())
ab.append([s, t, cha])
ab = sorted(ab, key=lambda x: x[0])
ab = sorted(ab, key=lambda x: x[2])
for i in range(1,n):
if ab[i][0] == ab[i-1][1] and ab[i][2] == ab[i-1][2]:
ab[i][0... | 27 | 30 | 645 | 586 | n, c = list(map(int, input().split()))
program = [list(map(int, input().split())) for i in range(n)]
time = [0 for i in range(10**5 + 1)]
program.sort()
program.sort(key=lambda x: x[2])
for i in range(1, n):
if program[i][2] == program[i - 1][2] and program[i][0] == program[i - 1][1]:
program[i][0] = progra... | n, c = list(map(int, input().split()))
ab = []
for _ in range(n):
s, t, cha = (int(x) for x in input().split())
ab.append([s, t, cha])
ab = sorted(ab, key=lambda x: x[0])
ab = sorted(ab, key=lambda x: x[2])
for i in range(1, n):
if ab[i][0] == ab[i - 1][1] and ab[i][2] == ab[i - 1][2]:
ab[i][0] = ab... | false | 10 | [
"-program = [list(map(int, input().split())) for i in range(n)]",
"-time = [0 for i in range(10**5 + 1)]",
"-program.sort()",
"-program.sort(key=lambda x: x[2])",
"+ab = []",
"+for _ in range(n):",
"+ s, t, cha = (int(x) for x in input().split())",
"+ ab.append([s, t, cha])",
"+ab = sorted(ab,... | false | 0.491704 | 0.410639 | 1.197412 | [
"s639721056",
"s555535397"
] |
u054514819 | p03436 | python | s235785155 | s792785003 | 209 | 74 | 41,712 | 71,856 | Accepted | Accepted | 64.59 | from collections import deque
dirc = ((1, 0), (0, 1), (-1, 0), (0, -1))
H, W = list(map(int, input().split()))
maze = [list(str(eval(input()))) for _ in range(H)]
white = 0
for h in range(H):
for w in range(W):
if maze[h][w]=='.':
white += 1
queue = deque()
queue.appendleft((0, (0, 0))... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
H, W = mapint()
Ss = [eval(input()) for _ in range(H)]
from collections import deque
Q = deque()
dirc = ((1, 0), (0, 1), (-1, 0), (0, -1))
Q.append((0, 0))
dist = [... | 34 | 35 | 857 | 849 | from collections import deque
dirc = ((1, 0), (0, 1), (-1, 0), (0, -1))
H, W = list(map(int, input().split()))
maze = [list(str(eval(input()))) for _ in range(H)]
white = 0
for h in range(H):
for w in range(W):
if maze[h][w] == ".":
white += 1
queue = deque()
queue.appendleft((0, (0, 0)))
check... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
H, W = mapint()
Ss = [eval(input()) for _ in range(H)]
from collections import deque
Q = deque()
dirc = ((1, 0), (0, 1), (-1, 0), (0, -1))
Q.append((0, 0))
dist = ... | false | 2.857143 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+sys.setrecursionlimit(10**9)",
"+H, W = mapint()",
"+Ss = [eval(input()) for _ in range(H)]",
"+Q = deque()",
"-H... | false | 0.007296 | 0.040931 | 0.178244 | [
"s235785155",
"s792785003"
] |
u282228874 | p03103 | python | s193334033 | s582935849 | 830 | 489 | 60,760 | 27,760 | Accepted | Accepted | 41.08 | n,m = list(map(int,input().split()))
AB = [[int(i) for i in input().split()] for j in range(n)]
AB.sort()
res = 0
for a,b in AB:
m -= b
if m >= 0:
res += a*b
else:
m += b
res += a*m
break
print(res)
| n,m = list(map(int,input().split()))
AB = [list(map(int,input().split())) for i in range(n)]
AB.sort()
res = 0
for a,b in AB:
res += a*min(b,m)
m -= b
if m < 0:
break
print(res) | 13 | 10 | 216 | 201 | n, m = list(map(int, input().split()))
AB = [[int(i) for i in input().split()] for j in range(n)]
AB.sort()
res = 0
for a, b in AB:
m -= b
if m >= 0:
res += a * b
else:
m += b
res += a * m
break
print(res)
| n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(n)]
AB.sort()
res = 0
for a, b in AB:
res += a * min(b, m)
m -= b
if m < 0:
break
print(res)
| false | 23.076923 | [
"-AB = [[int(i) for i in input().split()] for j in range(n)]",
"+AB = [list(map(int, input().split())) for i in range(n)]",
"+ res += a * min(b, m)",
"- if m >= 0:",
"- res += a * b",
"- else:",
"- m += b",
"- res += a * m",
"+ if m < 0:"
] | false | 0.0633 | 0.047017 | 1.346317 | [
"s193334033",
"s582935849"
] |
u989345508 | p03566 | python | s253111162 | s668100437 | 26 | 24 | 3,296 | 3,192 | Accepted | Accepted | 7.69 | import heapq
n=int(eval(input()))
inf=10000000000000
#始まりと終わりを保持
#同じオブジェクトにするやつで一時間溶かした、しね
ans=[[-1,-1] for i in range(n)]
ans[-1][1]=0
ans[0][0]=0
t=list(map(int,input().split()))
v=list(map(int,input().split()))
v2=[]
for i in range(n):
heapq.heappush(v2,(v[i],i))
for i in range(n):
#print(ans)
... | import heapq
n=int(eval(input()))
inf=10000000000000
ans=[[-1,-1] for i in range(n)]
ans[-1][1],ans[0][0]=0,0
t=list(map(int,input().split()))
v=list(map(int,input().split()))
v2=[]
for i in range(n):
heapq.heappush(v2,(v[i],i))
def next(y,wh):
global ans,n
ansi=inf
if wh:
r1,r2=... | 70 | 50 | 1,922 | 1,275 | import heapq
n = int(eval(input()))
inf = 10000000000000
# 始まりと終わりを保持
# 同じオブジェクトにするやつで一時間溶かした、しね
ans = [[-1, -1] for i in range(n)]
ans[-1][1] = 0
ans[0][0] = 0
t = list(map(int, input().split()))
v = list(map(int, input().split()))
v2 = []
for i in range(n):
heapq.heappush(v2, (v[i], i))
for i in range(n):
# ... | import heapq
n = int(eval(input()))
inf = 10000000000000
ans = [[-1, -1] for i in range(n)]
ans[-1][1], ans[0][0] = 0, 0
t = list(map(int, input().split()))
v = list(map(int, input().split()))
v2 = []
for i in range(n):
heapq.heappush(v2, (v[i], i))
def next(y, wh):
global ans, n
ansi = inf
if wh:
... | false | 28.571429 | [
"-# 始まりと終わりを保持",
"-# 同じオブジェクトにするやつで一時間溶かした、しね",
"-ans[-1][1] = 0",
"-ans[0][0] = 0",
"+ans[-1][1], ans[0][0] = 0, 0",
"+",
"+",
"+def next(y, wh):",
"+ global ans, n",
"+ ansi = inf",
"+ if wh:",
"+ r1, r2 = list(range(y[1] - 1, -1, -1)), list(range(y[1], n))",
"+ else:",
... | false | 0.048184 | 0.050644 | 0.95144 | [
"s253111162",
"s668100437"
] |
u723583932 | p03612 | python | s365164990 | s533893334 | 113 | 97 | 14,004 | 14,008 | Accepted | Accepted | 14.16 | n=int(eval(input()))
p=list(map(int,input().split()))
cnt=0
while True:
flag=True
for i in range(n-1):
if p[i]==(i+1):
p[i],p[i+1]=p[i+1],p[i]
cnt+=1
flag=False
if flag:
break
for i in range(n-1):
if p[i+1]==(i+1+1):
p... | n=int(eval(input()))
p=list(map(int,input().split()))
cnt=0
p2=[]
for i,x in enumerate(p):
if (i+1)==p[i]:
p2.append(False)
else:
p2.append(True)
for i in range(n-1):
if p2[i]==False and p2[i+1]==True:
p2[i]=True
cnt+=1
if p2[i]==False and p2[i+1]==False:
... | 17 | 21 | 369 | 413 | n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
while True:
flag = True
for i in range(n - 1):
if p[i] == (i + 1):
p[i], p[i + 1] = p[i + 1], p[i]
cnt += 1
flag = False
if flag:
break
for i in range(n - 1):
if p[i + 1] == (i ... | n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
p2 = []
for i, x in enumerate(p):
if (i + 1) == p[i]:
p2.append(False)
else:
p2.append(True)
for i in range(n - 1):
if p2[i] == False and p2[i + 1] == True:
p2[i] = True
cnt += 1
if p2[i] == False and p2[i... | false | 19.047619 | [
"-while True:",
"- flag = True",
"- for i in range(n - 1):",
"- if p[i] == (i + 1):",
"- p[i], p[i + 1] = p[i + 1], p[i]",
"- cnt += 1",
"- flag = False",
"- if flag:",
"- break",
"- for i in range(n - 1):",
"- if p[i + 1] == (i +... | false | 0.16625 | 0.042049 | 3.953719 | [
"s365164990",
"s533893334"
] |
u498487134 | p03045 | python | s217539521 | s582360636 | 635 | 214 | 83,164 | 81,384 | Accepted | Accepted | 66.3 | import sys
input = sys.stdin.readline
#########
class UnionFind():
"""
parents : 親要素(findしない場合は根ではないことの注意),根の場合は"-(要素数)"
find(x):要素xの属するグループの根を返す
size(x):要素xの属するグループの要素数を返す
same(x,y):x,yが同じグループに属しているか返す
members(x):要素xが属するグループに属する要素をリストで返す
roots(x):全ての根の要素を返す
group_counte():グ... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
################
class UnionFind():
"""
parents : 親要素(findしない場合は根ではないことの注意),根の場合は"-(要素数)"
f... | 90 | 86 | 2,066 | 2,191 | import sys
input = sys.stdin.readline
#########
class UnionFind:
"""
parents : 親要素(findしない場合は根ではないことの注意),根の場合は"-(要素数)"
find(x):要素xの属するグループの根を返す
size(x):要素xの属するグループの要素数を返す
same(x,y):x,yが同じグループに属しているか返す
members(x):要素xが属するグループに属する要素をリストで返す
roots(x):全ての根の要素を返す
group_counte():グループの数を返す
a... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
################
class UnionFind:
"""
parents : 親要素(findしない場合は根ではないことの注意),根の場合は"-(要素数)"
... | false | 4.444444 | [
"-#########",
"-class UnionFind:",
"- \"\"\"",
"- parents : 親要素(findしない場合は根ではないことの注意),根の場合は\"-(要素数)\"",
"- find(x):要素xの属するグループの根を返す",
"- size(x):要素xの属するグループの要素数を返す",
"- same(x,y):x,yが同じグループに属しているか返す",
"- members(x):要素xが属するグループに属する要素をリストで返す",
"- roots(x):全ての根の要素を返す",
"- grou... | false | 0.09443 | 0.042421 | 2.226003 | [
"s217539521",
"s582360636"
] |
u197457087 | p03488 | python | s323177630 | s822283667 | 1,907 | 440 | 216,108 | 91,140 | Accepted | Accepted | 76.93 | S = str(eval(input()))
N = len(S)
x,y = list(map(int,input().split()))
X = []; Y =[]
Flag = True #Trueならx軸、Falseならy軸
seq = 0
for i in range(N):
if S[i] == "T":
if Flag:
X.append(seq)
if not Flag:
Y.append(seq)
Flag = not Flag
seq = 0
else:
seq += 1
if i == N-1:
... | s = str(eval(input())); n = len(s)
gx,gy = list(map(int,input().split()))
Yoko = []; Tate = []
Flag = 0; cnt = 0
Max_x = 0; Max_y = 0
for i in range(n):
if s[i] == "F":
cnt += 1
if i == n-1: #最後なら登録
if Flag == 0:
Max_x += cnt
Yoko.append(cnt)
else:
Max_y += cnt... | 57 | 65 | 1,173 | 1,495 | S = str(eval(input()))
N = len(S)
x, y = list(map(int, input().split()))
X = []
Y = []
Flag = True # Trueならx軸、Falseならy軸
seq = 0
for i in range(N):
if S[i] == "T":
if Flag:
X.append(seq)
if not Flag:
Y.append(seq)
Flag = not Flag
seq = 0
else:
seq ... | s = str(eval(input()))
n = len(s)
gx, gy = list(map(int, input().split()))
Yoko = []
Tate = []
Flag = 0
cnt = 0
Max_x = 0
Max_y = 0
for i in range(n):
if s[i] == "F":
cnt += 1
if i == n - 1: # 最後なら登録
if Flag == 0:
Max_x += cnt
Yoko.append(cnt)
... | false | 12.307692 | [
"-S = str(eval(input()))",
"-N = len(S)",
"-x, y = list(map(int, input().split()))",
"-X = []",
"-Y = []",
"-Flag = True # Trueならx軸、Falseならy軸",
"-seq = 0",
"-for i in range(N):",
"- if S[i] == \"T\":",
"- if Flag:",
"- X.append(seq)",
"- if not Flag:",
"- ... | false | 0.04802 | 0.046631 | 1.029776 | [
"s323177630",
"s822283667"
] |
u971091945 | p02714 | python | s258301352 | s409294834 | 1,916 | 1,328 | 9,148 | 9,152 | Accepted | Accepted | 30.69 | n = int(eval(input()))
s = eval(input())
r = []
g = []
b = []
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(n):
for j in range(i+1,n):
k = 2*j-i
if k<n and s[k] != s[i] and s[k] != s[j] and s[i] != s[j]:
ans -= 1
print(ans) | n = int(eval(input()))
s = eval(input())
ans = s.count("R") * s.count("G") * s.count("B")
for i in range(n-2):
si = s[i]
for j in range(i+1, i+(n-i-1)//2+1):
sj = s[j]
k = 2*j-i
if k < n and s[k] != si and s[k] != sj and si != sj:
ans -= 1
print(ans) | 15 | 14 | 274 | 298 | n = int(eval(input()))
s = eval(input())
r = []
g = []
b = []
ans = s.count("R") * s.count("G") * s.count("B")
for i in range(n):
for j in range(i + 1, n):
k = 2 * j - i
if k < n and s[k] != s[i] and s[k] != s[j] and s[i] != s[j]:
ans -= 1
print(ans)
| n = int(eval(input()))
s = eval(input())
ans = s.count("R") * s.count("G") * s.count("B")
for i in range(n - 2):
si = s[i]
for j in range(i + 1, i + (n - i - 1) // 2 + 1):
sj = s[j]
k = 2 * j - i
if k < n and s[k] != si and s[k] != sj and si != sj:
ans -= 1
print(ans)
| false | 6.666667 | [
"-r = []",
"-g = []",
"-b = []",
"-for i in range(n):",
"- for j in range(i + 1, n):",
"+for i in range(n - 2):",
"+ si = s[i]",
"+ for j in range(i + 1, i + (n - i - 1) // 2 + 1):",
"+ sj = s[j]",
"- if k < n and s[k] != s[i] and s[k] != s[j] and s[i] != s[j]:",
"+ ... | false | 0.031941 | 0.036914 | 0.865278 | [
"s258301352",
"s409294834"
] |
u391875425 | p03062 | python | s380558139 | s573069414 | 70 | 58 | 14,332 | 14,284 | Accepted | Accepted | 17.14 | n = int(eval(input()))
a = list(map(int, input().split()))
pa = []
cnt = 0
for s in a:
if s < 0:
cnt += 1
pa.append(abs(s))
if cnt % 2:
print((sum(pa) - 2 * min(pa)))
else:
print((sum(pa)))
| n = int(eval(input()))
a = list(map(int, input().split()))
pa = [abs(s) for s in a]
cnt = sum([s < 0 for s in a])
if cnt % 2:
print((sum(pa) - 2 * min(pa)))
else:
print((sum(pa)))
| 13 | 8 | 220 | 185 | n = int(eval(input()))
a = list(map(int, input().split()))
pa = []
cnt = 0
for s in a:
if s < 0:
cnt += 1
pa.append(abs(s))
if cnt % 2:
print((sum(pa) - 2 * min(pa)))
else:
print((sum(pa)))
| n = int(eval(input()))
a = list(map(int, input().split()))
pa = [abs(s) for s in a]
cnt = sum([s < 0 for s in a])
if cnt % 2:
print((sum(pa) - 2 * min(pa)))
else:
print((sum(pa)))
| false | 38.461538 | [
"-pa = []",
"-cnt = 0",
"-for s in a:",
"- if s < 0:",
"- cnt += 1",
"- pa.append(abs(s))",
"+pa = [abs(s) for s in a]",
"+cnt = sum([s < 0 for s in a])"
] | false | 0.072963 | 0.100582 | 0.725411 | [
"s380558139",
"s573069414"
] |
u353797797 | p03096 | python | s710812148 | s364008279 | 493 | 178 | 31,336 | 16,556 | Accepted | Accepted | 63.89 | from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def main():
md = 10 ** 9 + 7
n = int(input())
cc = [int(input()) for _ in range(n)]
dp = [0] * (n + 1)
dp[0] = 1
ll = defaultdict(int)
... | import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in ... | 24 | 27 | 546 | 665 | from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def main():
md = 10**9 + 7
n = int(input())
cc = [int(input()) for _ in range(n)]
dp = [0] * (n + 1)
dp[0] = 1
ll = defaultdict(int)
pc = -1
for ... | import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [... | false | 11.111111 | [
"-from collections import defaultdict",
"-sys.setrecursionlimit(10**6)",
"+sys.setrecursionlimit(10**5)",
"+def II():",
"+ return int(sys.stdin.readline())",
"+",
"+",
"+def MI():",
"+ return map(int, sys.stdin.readline().split())",
"+",
"+",
"+def LI():",
"+ return list(map(int, sy... | false | 0.141321 | 0.139981 | 1.009572 | [
"s710812148",
"s364008279"
] |
u796942881 | p03681 | python | s991620969 | s108839317 | 36 | 30 | 3,064 | 3,060 | Accepted | Accepted | 16.67 | INF = int(1e9 + 7)
def modmulti(a, b):
# aとbを掛けた値をmodする(a * b mod p)
return a * b % INF
def factorial(x):
FCT = 1
for i in range(2, x + 1):
FCT = modmulti(i, FCT)
return FCT
def main():
N, M = list(map(int, input().split()))
MIN_NM = factorial(min(N, M))
i... | INF = int(1e9 + 7)
def factorial(x):
FCT = 1
for i in range(2, x + 1):
FCT = i * FCT % INF
return FCT
def main():
N, M = list(map(int, input().split()))
MIN_NM = factorial(min(N, M))
if N == M:
print((2 * MIN_NM * MIN_NM % INF))
elif abs(N - M) <= 1:
... | 29 | 24 | 522 | 411 | INF = int(1e9 + 7)
def modmulti(a, b):
# aとbを掛けた値をmodする(a * b mod p)
return a * b % INF
def factorial(x):
FCT = 1
for i in range(2, x + 1):
FCT = modmulti(i, FCT)
return FCT
def main():
N, M = list(map(int, input().split()))
MIN_NM = factorial(min(N, M))
if N == M:
... | INF = int(1e9 + 7)
def factorial(x):
FCT = 1
for i in range(2, x + 1):
FCT = i * FCT % INF
return FCT
def main():
N, M = list(map(int, input().split()))
MIN_NM = factorial(min(N, M))
if N == M:
print((2 * MIN_NM * MIN_NM % INF))
elif abs(N - M) <= 1:
print((MIN_NM... | false | 17.241379 | [
"-",
"-",
"-def modmulti(a, b):",
"- # aとbを掛けた値をmodする(a * b mod p)",
"- return a * b % INF",
"- FCT = modmulti(i, FCT)",
"+ FCT = i * FCT % INF",
"- print((modmulti(2, modmulti(MIN_NM, MIN_NM))))",
"+ print((2 * MIN_NM * MIN_NM % INF))",
"- print((modmulti(... | false | 0.033053 | 0.03882 | 0.851437 | [
"s991620969",
"s108839317"
] |
u384679440 | p03292 | python | s976389187 | s073815137 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a = list(map(int, input().split()))
a.sort()
print((abs(a[0]-a[1]) + abs(a[1]-a[2]))) | A = list(map(int, input().split()))
ans = 0
A.sort()
for i in range(1, len(A)):
ans += abs(A[i] - A[i-1])
print(ans) | 3 | 6 | 85 | 123 | a = list(map(int, input().split()))
a.sort()
print((abs(a[0] - a[1]) + abs(a[1] - a[2])))
| A = list(map(int, input().split()))
ans = 0
A.sort()
for i in range(1, len(A)):
ans += abs(A[i] - A[i - 1])
print(ans)
| false | 50 | [
"-a = list(map(int, input().split()))",
"-a.sort()",
"-print((abs(a[0] - a[1]) + abs(a[1] - a[2])))",
"+A = list(map(int, input().split()))",
"+ans = 0",
"+A.sort()",
"+for i in range(1, len(A)):",
"+ ans += abs(A[i] - A[i - 1])",
"+print(ans)"
] | false | 0.07595 | 0.071259 | 1.065837 | [
"s976389187",
"s073815137"
] |
u168578024 | p03061 | python | s641508911 | s497556932 | 549 | 497 | 60,528 | 60,528 | Accepted | Accepted | 9.47 | # test
import sys
readline = sys.stdin.buffer.readline
class SegmentTree:
def __init__(self, N, func, I):
self.N = N
self.sz = 2**(N-1).bit_length()
self.func = func
self.I = I
self.seg = [I] * (self.sz * 2)
def assign(self, k, x):
self.seg[k + ... | import sys
readline = sys.stdin.buffer.readline
class SegmentTree:
def __init__(self, N, func, I):
self.N = N
self.sz = 2**(N-1).bit_length()
self.func = func
self.I = I
self.seg = [I] * (self.sz * 2)
def assign(self, k, x):
self.seg[k + self.sz] =... | 63 | 63 | 1,476 | 1,512 | # test
import sys
readline = sys.stdin.buffer.readline
class SegmentTree:
def __init__(self, N, func, I):
self.N = N
self.sz = 2 ** (N - 1).bit_length()
self.func = func
self.I = I
self.seg = [I] * (self.sz * 2)
def assign(self, k, x):
self.seg[k + self.sz] = ... | import sys
readline = sys.stdin.buffer.readline
class SegmentTree:
def __init__(self, N, func, I):
self.N = N
self.sz = 2 ** (N - 1).bit_length()
self.func = func
self.I = I
self.seg = [I] * (self.sz * 2)
def assign(self, k, x):
self.seg[k + self.sz] = x
... | false | 0 | [
"-# test",
"- for i in reversed(list(range(1, self.sz))):",
"+ for i in range(self.sz - 1, 0, -1):",
"+ if b == self.N:",
"+ b = self.sz"
] | false | 0.049299 | 0.048906 | 1.008038 | [
"s641508911",
"s497556932"
] |
u279955105 | p02411 | python | s676901304 | s652988669 | 30 | 20 | 7,628 | 7,716 | Accepted | Accepted | 33.33 | i = 0
while True:
m,f,r = list(map(int, input().split()))
if (m == -1 and f == -1 and r == -1):
break
elif ((m == -1) or (f == -1)) or (m + f < 30):
print("F")
elif (80 <= m + f):
print("A")
elif (65 <= m + f) and (m + f < 80):
print("B")
elif (50 <= m + f) and (m + f < 65) or (50 <= r):
pri... | while True:
m,f,r = list(map(int, input().split()))
if (m == -1 and f == -1 and r == -1):
break
elif ((m == -1) or (f == -1)) or (m + f < 30):
print("F")
elif (80 <= m + f):
print("A")
elif (65 <= m + f) and (m + f < 80):
print("B")
elif (50 <= m + f) and (m + f < 65) or (50 <= r):
print("C")... | 16 | 15 | 384 | 377 | i = 0
while True:
m, f, r = list(map(int, input().split()))
if m == -1 and f == -1 and r == -1:
break
elif ((m == -1) or (f == -1)) or (m + f < 30):
print("F")
elif 80 <= m + f:
print("A")
elif (65 <= m + f) and (m + f < 80):
print("B")
elif (50 <= m + f) and (m +... | while True:
m, f, r = list(map(int, input().split()))
if m == -1 and f == -1 and r == -1:
break
elif ((m == -1) or (f == -1)) or (m + f < 30):
print("F")
elif 80 <= m + f:
print("A")
elif (65 <= m + f) and (m + f < 80):
print("B")
elif (50 <= m + f) and (m + f < 6... | false | 6.25 | [
"-i = 0"
] | false | 0.058307 | 0.09463 | 0.616159 | [
"s676901304",
"s652988669"
] |
u936985471 | p03681 | python | s806330698 | s428248685 | 57 | 37 | 3,060 | 3,188 | Accepted | Accepted | 35.09 | n,m=list(map(int,input().split()))
div=10**9+7
if abs(n-m)>1:
print((0))
else:
ans=1
for i in range(1,n+1):
ans=ans*i%div
for i in range(1,m+1):
ans=ans*i%div
if n==m:
ans*=2
print((ans%div)) | n,m=list(map(int,input().split()))
div=10**9+7
if abs(n-m)>1:
print((0))
else:
ans=1
for i in range(1,min(m,n)+1):
ans=ans*i%div
ans*=ans
if n!=m:
ans*=max(m,n)
if n==m:
ans*=2
print((ans%div)) | 13 | 14 | 217 | 222 | n, m = list(map(int, input().split()))
div = 10**9 + 7
if abs(n - m) > 1:
print((0))
else:
ans = 1
for i in range(1, n + 1):
ans = ans * i % div
for i in range(1, m + 1):
ans = ans * i % div
if n == m:
ans *= 2
print((ans % div))
| n, m = list(map(int, input().split()))
div = 10**9 + 7
if abs(n - m) > 1:
print((0))
else:
ans = 1
for i in range(1, min(m, n) + 1):
ans = ans * i % div
ans *= ans
if n != m:
ans *= max(m, n)
if n == m:
ans *= 2
print((ans % div))
| false | 7.142857 | [
"- for i in range(1, n + 1):",
"+ for i in range(1, min(m, n) + 1):",
"- for i in range(1, m + 1):",
"- ans = ans * i % div",
"+ ans *= ans",
"+ if n != m:",
"+ ans *= max(m, n)"
] | false | 0.041568 | 0.040421 | 1.028397 | [
"s806330698",
"s428248685"
] |
u724687935 | p03478 | python | s710941382 | s083010319 | 188 | 29 | 39,664 | 2,940 | Accepted | Accepted | 84.57 | N, A, B = list(map(int, input().split()))
res = 0
for n in range(N + 1):
sum_digit = 0
i = n
while i:
i, reminder = divmod(i, 10)
sum_digit += reminder
if A <= sum_digit <= B:
res += n
print(res)
| N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
k = i
p = 0
while k > 0:
p += k % 10
k //= 10
if A <= p <= B:
ans += i
print(ans)
| 13 | 13 | 244 | 206 | N, A, B = list(map(int, input().split()))
res = 0
for n in range(N + 1):
sum_digit = 0
i = n
while i:
i, reminder = divmod(i, 10)
sum_digit += reminder
if A <= sum_digit <= B:
res += n
print(res)
| N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
k = i
p = 0
while k > 0:
p += k % 10
k //= 10
if A <= p <= B:
ans += i
print(ans)
| false | 0 | [
"-res = 0",
"-for n in range(N + 1):",
"- sum_digit = 0",
"- i = n",
"- while i:",
"- i, reminder = divmod(i, 10)",
"- sum_digit += reminder",
"- if A <= sum_digit <= B:",
"- res += n",
"-print(res)",
"+ans = 0",
"+for i in range(1, N + 1):",
"+ k = i",
... | false | 0.037763 | 0.082581 | 0.457289 | [
"s710941382",
"s083010319"
] |
u867826040 | p02596 | python | s900421605 | s149021198 | 722 | 480 | 109,396 | 105,752 | Accepted | Accepted | 33.52 | from numba import njit
@njit(cache=True)
def f(k):
a = 7%k
for i in range(k):
if a == 0:
print((i+1))
break
a = (a*10+7)%k
else:
print((-1))
k = int(eval(input()))
f(k) | from numba import njit,prange
@njit('i8(i8)',cache=True)
def f(k):
a = 7%k
for i in prange(k):
if a == 0:
return i+1
a = (a*10+7)%k
else:
return -1
k = int(eval(input()))
print((f(k))) | 13 | 12 | 230 | 235 | from numba import njit
@njit(cache=True)
def f(k):
a = 7 % k
for i in range(k):
if a == 0:
print((i + 1))
break
a = (a * 10 + 7) % k
else:
print((-1))
k = int(eval(input()))
f(k)
| from numba import njit, prange
@njit("i8(i8)", cache=True)
def f(k):
a = 7 % k
for i in prange(k):
if a == 0:
return i + 1
a = (a * 10 + 7) % k
else:
return -1
k = int(eval(input()))
print((f(k)))
| false | 7.692308 | [
"-from numba import njit",
"+from numba import njit, prange",
"-@njit(cache=True)",
"+@njit(\"i8(i8)\", cache=True)",
"- for i in range(k):",
"+ for i in prange(k):",
"- print((i + 1))",
"- break",
"+ return i + 1",
"- print((-1))",
"+ return ... | false | 0.037375 | 0.045887 | 0.814517 | [
"s900421605",
"s149021198"
] |
u252828980 | p02772 | python | s124941231 | s852997769 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | n = int(eval(input()))
L = list(map(int,input().split()))
L = [x for x in L if x%2 ==0]
if all((L[i]%3 == 0 or L[i]%5 == 0 for i in range(len(L)))):
print("APPROVED")
else:
print("DENIED") | n = int(eval(input()))
L = list(map(int,input().split()))
for i in range(n):
if L[i]%2 == 0:
if L[i]%3 == 0 or L[i]%5== 0:
continue
else:
print("DENIED")
exit()
print("APPROVED") | 9 | 12 | 200 | 241 | n = int(eval(input()))
L = list(map(int, input().split()))
L = [x for x in L if x % 2 == 0]
if all((L[i] % 3 == 0 or L[i] % 5 == 0 for i in range(len(L)))):
print("APPROVED")
else:
print("DENIED")
| n = int(eval(input()))
L = list(map(int, input().split()))
for i in range(n):
if L[i] % 2 == 0:
if L[i] % 3 == 0 or L[i] % 5 == 0:
continue
else:
print("DENIED")
exit()
print("APPROVED")
| false | 25 | [
"-L = [x for x in L if x % 2 == 0]",
"-if all((L[i] % 3 == 0 or L[i] % 5 == 0 for i in range(len(L)))):",
"- print(\"APPROVED\")",
"-else:",
"- print(\"DENIED\")",
"+for i in range(n):",
"+ if L[i] % 2 == 0:",
"+ if L[i] % 3 == 0 or L[i] % 5 == 0:",
"+ continue",
"+ ... | false | 0.044586 | 0.043702 | 1.020241 | [
"s124941231",
"s852997769"
] |
u905582793 | p03078 | python | s155745938 | s227523112 | 1,173 | 666 | 47,440 | 121,060 | Accepted | Accepted | 43.22 | import heapq as hq
x,y,z,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans = []
for p in range(1,x+1):
for q in range(1,y+1):
for r in range(min(k... | import sys
import heapq as hq
input = sys.stdin.readline
x,y,z,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans = []
for p in range(1,x+1):
for q in... | 17 | 19 | 442 | 482 | import heapq as hq
x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans = []
for p in range(1, x + 1):
for q in range(1, y + 1):
for r in ra... | import sys
import heapq as hq
input = sys.stdin.readline
x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans = []
for p in range(1, x + 1):
for q i... | false | 10.526316 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.066889 | 0.047187 | 1.417541 | [
"s155745938",
"s227523112"
] |
u934442292 | p03112 | python | s989078463 | s178707702 | 693 | 632 | 118,492 | 118,260 | Accepted | Accepted | 8.8 | import sys
import numba as nb
import numpy as np
input = sys.stdin.readline
@nb.njit("i8(i8[:],i8)", cache=True)
def binary_search(a, key):
"""Meguru type binary search"""
ng = -1
ok = len(a)
def is_ok(a, key, idx):
if key <= a[idx]:
return True
else:
... | import sys
import numba as nb
import numpy as np
input = sys.stdin.readline
@nb.njit("i8(i8[:],i8)", cache=True)
def binary_search(a, key):
"""Meguru type binary search"""
ng = -1
ok = len(a)
def is_ok(a, key, idx):
if key <= a[idx]:
return True
else:
... | 90 | 68 | 2,451 | 1,624 | import sys
import numba as nb
import numpy as np
input = sys.stdin.readline
@nb.njit("i8(i8[:],i8)", cache=True)
def binary_search(a, key):
"""Meguru type binary search"""
ng = -1
ok = len(a)
def is_ok(a, key, idx):
if key <= a[idx]:
return True
else:
return F... | import sys
import numba as nb
import numpy as np
input = sys.stdin.readline
@nb.njit("i8(i8[:],i8)", cache=True)
def binary_search(a, key):
"""Meguru type binary search"""
ng = -1
ok = len(a)
def is_ok(a, key, idx):
if key <= a[idx]:
return True
else:
return F... | false | 24.444444 | [
"- # x --> s --> t",
"- i = binary_search(S, x)",
"- if 0 < i:",
"- l_s = S[i - 1]",
"- dist_s = abs(x - l_s)",
"- j = binary_search(T, l_s)",
"- l_t, r_t = T[j - 1], T[j]",
"- dist_t = min(abs(l_s - l_t), abs(r_t - l_s)) if 0... | false | 0.05073 | 0.050572 | 1.003122 | [
"s989078463",
"s178707702"
] |
u678167152 | p02733 | python | s178117088 | s062275687 | 430 | 301 | 45,276 | 43,100 | Accepted | Accepted | 30 | import itertools
H, W, K = list(map(int, input().split()))
S = [0]*H
for i in range(H):
S[i] = eval(input())
Sdivs = []
mcnt = 1100
for b in itertools.product([0, 1], repeat=H-1):
start = 0
end = 1
Sdivs=[]
for a in b:
if a==1:
Sdivs.append(S[start:end])
start = end
end +=... | from itertools import groupby, accumulate, product, permutations, combinations
def solve():
H, W, K = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
cum = [[0]*(W+1) for _ in range(H+1)]
for i in range(1,H+1):
for j in range(1,W+1):
cum[i][j]=cum[i-1][j]... | 50 | 40 | 1,043 | 1,261 | import itertools
H, W, K = list(map(int, input().split()))
S = [0] * H
for i in range(H):
S[i] = eval(input())
Sdivs = []
mcnt = 1100
for b in itertools.product([0, 1], repeat=H - 1):
start = 0
end = 1
Sdivs = []
for a in b:
if a == 1:
Sdivs.append(S[start:end])
star... | from itertools import groupby, accumulate, product, permutations, combinations
def solve():
H, W, K = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
cum = [[0] * (W + 1) for _ in range(H + 1)]
for i in range(1, H + 1):
for j in range(1, W + 1):
cum[i][j] = (
... | false | 20 | [
"-import itertools",
"+from itertools import groupby, accumulate, product, permutations, combinations",
"-H, W, K = list(map(int, input().split()))",
"-S = [0] * H",
"-for i in range(H):",
"- S[i] = eval(input())",
"-Sdivs = []",
"-mcnt = 1100",
"-for b in itertools.product([0, 1], repeat=H - 1):... | false | 0.040937 | 0.041992 | 0.974874 | [
"s178117088",
"s062275687"
] |
u260980560 | p02366 | python | s754913729 | s509737171 | 220 | 190 | 22,328 | 22,748 | Accepted | Accepted | 13.64 | import sys
sys.setrecursionlimit(10**6)
def get_articulation_points(G, N, start=0):
v_min = [0]*N; order = [None]*N
result = []; count = 0
def dfs(v, prev):
nonlocal count
r_min = order[v] = count
fcnt = 0; p_art = 0
count += 1
for w in G[v]:
if... | import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
write = sys.stdout.write
N, M = list(map(int, readline().split()))
G = [[] for i in range(N)]
for i in range(M):
u, v = list(map(int, readline().split()))
G[u].append(v)
G[v].append(u)
# a chain decomposition
def construc... | 34 | 70 | 1,029 | 1,572 | import sys
sys.setrecursionlimit(10**6)
def get_articulation_points(G, N, start=0):
v_min = [0] * N
order = [None] * N
result = []
count = 0
def dfs(v, prev):
nonlocal count
r_min = order[v] = count
fcnt = 0
p_art = 0
count += 1
for w in G[v]:
... | import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
write = sys.stdout.write
N, M = list(map(int, readline().split()))
G = [[] for i in range(N)]
for i in range(M):
u, v = list(map(int, readline().split()))
G[u].append(v)
G[v].append(u)
# a chain decomposition
def construct(G, N):
P =... | false | 51.428571 | [
"+readline = sys.stdin.readline",
"+write = sys.stdout.write",
"+N, M = list(map(int, readline().split()))",
"+G = [[] for i in range(N)]",
"+for i in range(M):",
"+ u, v = list(map(int, readline().split()))",
"+ G[u].append(v)",
"+ G[v].append(u)",
"+# a chain decomposition",
"+def const... | false | 0.048522 | 0.045133 | 1.07509 | [
"s754913729",
"s509737171"
] |
u666550725 | p02554 | python | s922114379 | s567314440 | 69 | 63 | 61,864 | 61,848 | Accepted | Accepted | 8.7 | N = int(eval(input()))
M = 10 ** 9 + 7
def mod_pow(a, b, mod):
bin_b = []
while b:
bin_b.append(b % 2)
b >>= 1
ret = 1
for j in reversed(bin_b):
ret = (ret * ret) % mod
if j == 1:
ret = (ret * a) % mod
return ret
ans = (mod_pow(10, N, M) - 2 * mod_pow(9, N, M) + mod_pow(8, N, M)) % M
print... | N = int(eval(input()))
M = 10 ** 9 + 7
ans = (pow(10, N, M) - 2 * pow(9, N, M) + pow(8, N, M)) % M
print(ans) | 15 | 4 | 319 | 106 | N = int(eval(input()))
M = 10**9 + 7
def mod_pow(a, b, mod):
bin_b = []
while b:
bin_b.append(b % 2)
b >>= 1
ret = 1
for j in reversed(bin_b):
ret = (ret * ret) % mod
if j == 1:
ret = (ret * a) % mod
return ret
ans = (mod_pow(10, N, M) - 2 * mod_pow(9,... | N = int(eval(input()))
M = 10**9 + 7
ans = (pow(10, N, M) - 2 * pow(9, N, M) + pow(8, N, M)) % M
print(ans)
| false | 73.333333 | [
"-",
"-",
"-def mod_pow(a, b, mod):",
"- bin_b = []",
"- while b:",
"- bin_b.append(b % 2)",
"- b >>= 1",
"- ret = 1",
"- for j in reversed(bin_b):",
"- ret = (ret * ret) % mod",
"- if j == 1:",
"- ret = (ret * a) % mod",
"- return ret",
... | false | 0.035809 | 0.036932 | 0.969584 | [
"s922114379",
"s567314440"
] |
u621935300 | p02913 | python | s958633805 | s729372209 | 1,604 | 81 | 95,268 | 33,256 | Accepted | Accepted | 94.95 | # -*- coding: utf-8 -*-
# ローリングハッシュ
from collections import defaultdict
N=eval(input())
s=input()
str="abcdefghijklmnopqrstuvwxyz"
D={}
for i,str in enumerate(str):
D[str]=i+1
base=27
mod=10**9+7
hash=[]
for i,x in enumerate(s):
if i==0: hash.append(D[x])
else: hash.append( hash[-1]*base+D[x] )
... | # -*- coding: utf-8 -*-
# RollingHash
from collections import defaultdict
N=eval(input())
s=input()
str="abcdefghijklmnopqrstuvwxyz"
D={}
for i,str in enumerate(str):
D[str]=i+1
base=27
mod=10**9+7
hash=[]
for i,x in enumerate(s):
if i==0: hash.append(D[x]%mod)
else: hash.append( (hash[-1]*base+D... | 48 | 48 | 766 | 794 | # -*- coding: utf-8 -*-
# ローリングハッシュ
from collections import defaultdict
N = eval(input())
s = input()
str = "abcdefghijklmnopqrstuvwxyz"
D = {}
for i, str in enumerate(str):
D[str] = i + 1
base = 27
mod = 10**9 + 7
hash = []
for i, x in enumerate(s):
if i == 0:
hash.append(D[x])
else:
hash.... | # -*- coding: utf-8 -*-
# RollingHash
from collections import defaultdict
N = eval(input())
s = input()
str = "abcdefghijklmnopqrstuvwxyz"
D = {}
for i, str in enumerate(str):
D[str] = i + 1
base = 27
mod = 10**9 + 7
hash = []
for i, x in enumerate(s):
if i == 0:
hash.append(D[x] % mod)
else:
... | false | 0 | [
"-# ローリングハッシュ",
"+# RollingHash",
"- hash.append(D[x])",
"+ hash.append(D[x] % mod)",
"- hash.append(hash[-1] * base + D[x])",
"+ hash.append((hash[-1] * base + D[x]) % mod)",
"- return hash[r - 1]",
"+ return hash[r - 1] % mod",
"- return hash[r - 1]... | false | 0.032461 | 0.032278 | 1.005654 | [
"s958633805",
"s729372209"
] |
u690037900 | p04044 | python | s305559375 | s652869820 | 171 | 17 | 38,448 | 3,060 | Accepted | Accepted | 90.06 | a,b=list(map(int,input().split()))
c=list(eval(input()) for _ in range(a))
c.sort()
print(("".join(c)))
| a,b = list(map(int,input().split()))
c = sorted(list(eval(input()) for i in range(a)))
print(("".join(c))) | 4 | 3 | 93 | 94 | a, b = list(map(int, input().split()))
c = list(eval(input()) for _ in range(a))
c.sort()
print(("".join(c)))
| a, b = list(map(int, input().split()))
c = sorted(list(eval(input()) for i in range(a)))
print(("".join(c)))
| false | 25 | [
"-c = list(eval(input()) for _ in range(a))",
"-c.sort()",
"+c = sorted(list(eval(input()) for i in range(a)))"
] | false | 0.047949 | 0.047803 | 1.003045 | [
"s305559375",
"s652869820"
] |
u623819879 | p04045 | python | s068653402 | s605748477 | 272 | 191 | 45,292 | 40,940 | Accepted | Accepted | 29.78 | #n=int(input())
ans=10**6
n,k=list(map(int,input().split()))
p=[int(i) for i in input().split()]
s=[]
for i in range(10):
if i not in p:
s.append(str(i))
for a in s+['0']:
for b in s:
for c in s:
for d in s:
for e in s:
x=lis... | n,k=list(map(int,input().split()))
p=[int(i) for i in input().split()]
s=[]
for i in range(10):
if i not in p:
s.append(str(i))
for x in range(n,10*n):
flg=True
for d in str(x):
if d not in s:
flg=False
if flg:
print(x)
break | 19 | 15 | 475 | 298 | # n=int(input())
ans = 10**6
n, k = list(map(int, input().split()))
p = [int(i) for i in input().split()]
s = []
for i in range(10):
if i not in p:
s.append(str(i))
for a in s + ["0"]:
for b in s:
for c in s:
for d in s:
for e in s:
x = list(
... | n, k = list(map(int, input().split()))
p = [int(i) for i in input().split()]
s = []
for i in range(10):
if i not in p:
s.append(str(i))
for x in range(n, 10 * n):
flg = True
for d in str(x):
if d not in s:
flg = False
if flg:
print(x)
break
| false | 21.052632 | [
"-# n=int(input())",
"-ans = 10**6",
"-for a in s + [\"0\"]:",
"- for b in s:",
"- for c in s:",
"- for d in s:",
"- for e in s:",
"- x = list(",
"- map(",
"- int, [a + b + c + d + e, b + c + d... | false | 0.007609 | 0.115091 | 0.066116 | [
"s068653402",
"s605748477"
] |
u667084803 | p03634 | python | s863261918 | s827216814 | 1,275 | 733 | 68,680 | 68,024 | Accepted | Accepted | 42.51 | from sys import stdin
input = stdin.readline
def BFS(K,path,N):
"""リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
import queue
dist=[-1]*N
dist[K]=0
que=queue.Queue()
que.put(K)
while que.qsize():
label=que.get()
for i,c in path[label]:
if dist[i]==-1:
dist[i]=di... | from sys import stdin
input = stdin.readline
def BFS(K,path,N):
"""リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
from collections import deque
dist=[-1]*N
dist[K]=0
que=[]
que.append(K)
while que:
label=que.pop(-1)
for i,c in path[label]:
if dist[i]==-1:
dist[i]... | 28 | 28 | 702 | 703 | from sys import stdin
input = stdin.readline
def BFS(K, path, N):
"""リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
import queue
dist = [-1] * N
dist[K] = 0
que = queue.Queue()
que.put(K)
while que.qsize():
label = que.get()
for i, c in path[label]:
if... | from sys import stdin
input = stdin.readline
def BFS(K, path, N):
"""リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
from collections import deque
dist = [-1] * N
dist[K] = 0
que = []
que.append(K)
while que:
label = que.pop(-1)
for i, c in path[label]:
... | false | 0 | [
"- import queue",
"+ from collections import deque",
"- que = queue.Queue()",
"- que.put(K)",
"- while que.qsize():",
"- label = que.get()",
"+ que = []",
"+ que.append(K)",
"+ while que:",
"+ label = que.pop(-1)",
"- que.put(i)",
"+ ... | false | 0.073805 | 0.082686 | 0.892595 | [
"s863261918",
"s827216814"
] |
u644907318 | p03045 | python | s841524032 | s524182188 | 929 | 497 | 74,980 | 109,420 | Accepted | Accepted | 46.5 | def find(x):
while G[x][0]!=x:
x = G[x][0]
return x
def union(x,y):
xa = find(x)
ya = find(y)
if G[xa][1]>=G[ya][1]:
G[ya][0] = xa
G[xa][1] = max(G[xa][1],G[ya][1]+1)
else:
G[xa][0] = ya
G[ya][1] = max(G[ya][1],G[xa][1]+1)
N,M = list(map(int,i... | def find(x):
while x!=T[x][0]:
x = T[x][0]
return x
def union(x,y):
a = find(x)
b = find(y)
if T[a][1]>T[b][1]:
T[b][0] = a
elif T[a][1]==T[b][1]:
T[b][0] = a
T[a][1] += 1
else:
T[a][0] = b
N,M = list(map(int,input().split()))
A = [list(... | 23 | 29 | 549 | 621 | def find(x):
while G[x][0] != x:
x = G[x][0]
return x
def union(x, y):
xa = find(x)
ya = find(y)
if G[xa][1] >= G[ya][1]:
G[ya][0] = xa
G[xa][1] = max(G[xa][1], G[ya][1] + 1)
else:
G[xa][0] = ya
G[ya][1] = max(G[ya][1], G[xa][1] + 1)
N, M = list(map(in... | def find(x):
while x != T[x][0]:
x = T[x][0]
return x
def union(x, y):
a = find(x)
b = find(y)
if T[a][1] > T[b][1]:
T[b][0] = a
elif T[a][1] == T[b][1]:
T[b][0] = a
T[a][1] += 1
else:
T[a][0] = b
N, M = list(map(int, input().split()))
A = [list(ma... | false | 20.689655 | [
"- while G[x][0] != x:",
"- x = G[x][0]",
"+ while x != T[x][0]:",
"+ x = T[x][0]",
"- xa = find(x)",
"- ya = find(y)",
"- if G[xa][1] >= G[ya][1]:",
"- G[ya][0] = xa",
"- G[xa][1] = max(G[xa][1], G[ya][1] + 1)",
"+ a = find(x)",
"+ b = find(y)",
... | false | 0.059352 | 0.04845 | 1.225009 | [
"s841524032",
"s524182188"
] |
u752906728 | p03447 | python | s045630108 | s617545806 | 889 | 818 | 3,056 | 3,056 | Accepted | Accepted | 7.99 | from time import sleep
x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep((x%100) * 0.01)
print(ans) | from time import sleep
x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep((b%10) * 0.1)
print(ans) | 11 | 11 | 142 | 140 | from time import sleep
x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep((x % 100) * 0.01)
print(ans)
| from time import sleep
x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep((b % 10) * 0.1)
print(ans)
| false | 0 | [
"-sleep((x % 100) * 0.01)",
"+sleep((b % 10) * 0.1)"
] | false | 0.519466 | 0.440973 | 1.178001 | [
"s045630108",
"s617545806"
] |
u588341295 | p03634 | python | s118623871 | s522143978 | 623 | 505 | 80,084 | 94,804 | Accepted | Accepted | 18.94 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 49 | 50 | 1,314 | 1,342 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 2 | [
"+ans = []",
"- ans = res[x] + res[y]",
"- print(ans)",
"+ ans.append(str(res[x] + res[y]))",
"+print((\"\\n\".join(ans)))"
] | false | 0.047775 | 0.048114 | 0.99294 | [
"s118623871",
"s522143978"
] |
u299645128 | p02712 | python | s086672332 | s744961021 | 160 | 29 | 9,048 | 9,104 | Accepted | Accepted | 81.88 | N = int(eval(input()))
sum = 0
for i in range(1, N+1):
if i % 3 != 0 and i % 5 != 0:
sum += i
print(sum) | N = int(eval(input()))
Ndiv3 = N // 3
Ndiv5 = N // 5
Ndiv15 = N // 15
ans = (N*(N + 1) - 3*Ndiv3*(Ndiv3 + 1) - 5*Ndiv5*(Ndiv5 + 1) + 15*Ndiv15*(Ndiv15 + 1))//2
print(ans) | 6 | 8 | 109 | 173 | N = int(eval(input()))
sum = 0
for i in range(1, N + 1):
if i % 3 != 0 and i % 5 != 0:
sum += i
print(sum)
| N = int(eval(input()))
Ndiv3 = N // 3
Ndiv5 = N // 5
Ndiv15 = N // 15
ans = (
N * (N + 1)
- 3 * Ndiv3 * (Ndiv3 + 1)
- 5 * Ndiv5 * (Ndiv5 + 1)
+ 15 * Ndiv15 * (Ndiv15 + 1)
) // 2
print(ans)
| false | 25 | [
"-sum = 0",
"-for i in range(1, N + 1):",
"- if i % 3 != 0 and i % 5 != 0:",
"- sum += i",
"-print(sum)",
"+Ndiv3 = N // 3",
"+Ndiv5 = N // 5",
"+Ndiv15 = N // 15",
"+ans = (",
"+ N * (N + 1)",
"+ - 3 * Ndiv3 * (Ndiv3 + 1)",
"+ - 5 * Ndiv5 * (Ndiv5 + 1)",
"+ + 15 * Ndiv... | false | 0.444478 | 0.046489 | 9.560992 | [
"s086672332",
"s744961021"
] |
u189023301 | p02883 | python | s663127682 | s904101516 | 482 | 352 | 53,568 | 53,524 | Accepted | Accepted | 26.97 | import sys
import numpy as np
if sys.argv[-1] == 'ONLINE_JUDGE':
from numba.pycc import CC
cc = CC('my_module')
@cc.export('is_ok', '(i8[:],i8[:],i8,i8)')
def is_ok(A, F, x, k):
y = A - x // F
tmp = y[y > 0].sum()
return tmp <= k
cc.compile()
exit(0)
f... | import sys
import numpy as np
if sys.argv[-1] == 'ONLINE_JUDGE':
from numba.pycc import CC
cc = CC('my_module')
@cc.export('is_ok', '(i8[:],i8[:],i8,i8)')
def is_ok(A, F, x, k):
y = A - x // F
tmp = y[y > 0].sum()
return tmp <= k
cc.compile()
exit(0)
f... | 35 | 34 | 698 | 676 | import sys
import numpy as np
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
cc = CC("my_module")
@cc.export("is_ok", "(i8[:],i8[:],i8,i8)")
def is_ok(A, F, x, k):
y = A - x // F
tmp = y[y > 0].sum()
return tmp <= k
cc.compile()
exit(0)
from my_module im... | import sys
import numpy as np
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
cc = CC("my_module")
@cc.export("is_ok", "(i8[:],i8[:],i8,i8)")
def is_ok(A, F, x, k):
y = A - x // F
tmp = y[y > 0].sum()
return tmp <= k
cc.compile()
exit(0)
from my_module im... | false | 2.857143 | [
"- y = A - mid // F"
] | false | 0.508915 | 0.505065 | 1.007622 | [
"s663127682",
"s904101516"
] |
u143492911 | p03617 | python | s226429770 | s395291950 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | q,h,s,d=list(map(int,input().split()))
n=int(eval(input()))
s=min(4*q,2*h,s)
if d<2*s:
if n%2==0:
print((d*(n//2)))
else:
print((d*(n//2)+s))
else:
print((n*s))
| q,h,s,d=list(map(int,input().split()))
n=int(eval(input()))
h=min(2*q,h)
s=min(2*h,s)
if 2*s<d:
print((n*s))
else:
cnt=n%2
cnt_2=n//2
print((cnt_2*d+cnt*s))
| 10 | 10 | 180 | 166 | q, h, s, d = list(map(int, input().split()))
n = int(eval(input()))
s = min(4 * q, 2 * h, s)
if d < 2 * s:
if n % 2 == 0:
print((d * (n // 2)))
else:
print((d * (n // 2) + s))
else:
print((n * s))
| q, h, s, d = list(map(int, input().split()))
n = int(eval(input()))
h = min(2 * q, h)
s = min(2 * h, s)
if 2 * s < d:
print((n * s))
else:
cnt = n % 2
cnt_2 = n // 2
print((cnt_2 * d + cnt * s))
| false | 0 | [
"-s = min(4 * q, 2 * h, s)",
"-if d < 2 * s:",
"- if n % 2 == 0:",
"- print((d * (n // 2)))",
"- else:",
"- print((d * (n // 2) + s))",
"+h = min(2 * q, h)",
"+s = min(2 * h, s)",
"+if 2 * s < d:",
"+ print((n * s))",
"- print((n * s))",
"+ cnt = n % 2",
"+ cn... | false | 0.060781 | 0.061038 | 0.995793 | [
"s226429770",
"s395291950"
] |
u569960318 | p02272 | python | s627474162 | s186897689 | 4,270 | 3,880 | 63,748 | 63,780 | Accepted | Accepted | 9.13 | cnt = 0
def merge(L,R):
global cnt
n = len(L)+len(R)
cnt += n
A = []
i = j = 0
L.append(float("inf"))
R.append(float("inf"))
for _ in range(n):
if L[i] <= R[j]:
A.append(L[i])
i += 1
else:
A.append(R[j])
j += ... | cnt = 0
def merge(L,R):
global cnt
n = len(L)+len(R)
cnt += n
A = []
i = j = 0
L.append(-1)
R.append(-1)
for _ in range(n):
if L[i] >= R[j]:
A.append(L[i])
i += 1
else:
A.append(R[j])
j += 1
return A
d... | 29 | 29 | 592 | 578 | cnt = 0
def merge(L, R):
global cnt
n = len(L) + len(R)
cnt += n
A = []
i = j = 0
L.append(float("inf"))
R.append(float("inf"))
for _ in range(n):
if L[i] <= R[j]:
A.append(L[i])
i += 1
else:
A.append(R[j])
j += 1
retu... | cnt = 0
def merge(L, R):
global cnt
n = len(L) + len(R)
cnt += n
A = []
i = j = 0
L.append(-1)
R.append(-1)
for _ in range(n):
if L[i] >= R[j]:
A.append(L[i])
i += 1
else:
A.append(R[j])
j += 1
return A
def mergeSort... | false | 0 | [
"- L.append(float(\"inf\"))",
"- R.append(float(\"inf\"))",
"+ L.append(-1)",
"+ R.append(-1)",
"- if L[i] <= R[j]:",
"+ if L[i] >= R[j]:",
"- print((*mergeSort(A)))",
"+ print((*mergeSort(A)[::-1]))"
] | false | 0.035252 | 0.042858 | 0.82254 | [
"s627474162",
"s186897689"
] |
u729133443 | p02889 | python | s128338917 | s400860763 | 576 | 389 | 36,280 | 36,312 | Accepted | Accepted | 32.47 | import sys
from scipy.sparse.csgraph import floyd_warshall as f
def main():
n,m,l,*t=list(map(int,sys.stdin.buffer.read().split()))
d=[[0]*(n+1)for _ in range(n+1)]
for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
d=f(f(d,0)<=l)-1
d[d>n]=-1
d=d.astype('i2')
print(('\n'.join(map(str,list(map(d.__get... | def main():
import sys
from scipy.sparse.csgraph import floyd_warshall as f
n,m,l,*t=list(map(int,sys.stdin.buffer.read().split()))
d=[[0]*(n+1)for _ in range(n+1)]
for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
d=f(f(d,0)<=l)-1
d[d>n]=-1
print(('\n'.join(map(str,list(map(int,list(map(d.__getite... | 11 | 10 | 352 | 345 | import sys
from scipy.sparse.csgraph import floyd_warshall as f
def main():
n, m, l, *t = list(map(int, sys.stdin.buffer.read().split()))
d = [[0] * (n + 1) for _ in range(n + 1)]
for a, b, c in zip(*[iter(t[: m * 3])] * 3):
d[a][b] = c
d = f(f(d, 0) <= l) - 1
d[d > n] = -1
d = d.astyp... | def main():
import sys
from scipy.sparse.csgraph import floyd_warshall as f
n, m, l, *t = list(map(int, sys.stdin.buffer.read().split()))
d = [[0] * (n + 1) for _ in range(n + 1)]
for a, b, c in zip(*[iter(t[: m * 3])] * 3):
d[a][b] = c
d = f(f(d, 0) <= l) - 1
d[d > n] = -1
prin... | false | 9.090909 | [
"-import sys",
"-from scipy.sparse.csgraph import floyd_warshall as f",
"+def main():",
"+ import sys",
"+ from scipy.sparse.csgraph import floyd_warshall as f",
"-",
"-def main():",
"- d = d.astype(\"i2\")",
"- list(map(d.__getitem__, list(zip(*[iter(t[m * 3 + 1 :])] * 2... | false | 1.490691 | 0.328932 | 4.531917 | [
"s128338917",
"s400860763"
] |
u170183831 | p02891 | python | s622128849 | s318537997 | 179 | 17 | 38,256 | 3,064 | Accepted | Accepted | 90.5 | from math import floor
def solve(s, k):
counts = [0] * len(s)
prev = ''
index = -1
for l in s:
if prev == l:
counts[index] += 1
else:
index += 1
counts[index] = 1
prev = l
if index == 0:
return floor(len(s) * k / 2)
... | from math import floor
def solve(s, k):
counts = [0] * len(s)
prev = ''
index = -1
for l in s:
if prev == l:
counts[index] += 1
else:
index += 1
counts[index] = 1
prev = l
if index == 0:
return floor(len(s) * k / 2)
... | 27 | 23 | 666 | 577 | from math import floor
def solve(s, k):
counts = [0] * len(s)
prev = ""
index = -1
for l in s:
if prev == l:
counts[index] += 1
else:
index += 1
counts[index] = 1
prev = l
if index == 0:
return floor(len(s) * k / 2)
total = 0
... | from math import floor
def solve(s, k):
counts = [0] * len(s)
prev = ""
index = -1
for l in s:
if prev == l:
counts[index] += 1
else:
index += 1
counts[index] = 1
prev = l
if index == 0:
return floor(len(s) * k / 2)
total = su... | false | 14.814815 | [
"- total = 0",
"- for i in range(index + 1):",
"- if counts[i] > 1:",
"- total += floor(counts[i] / 2) * k",
"+ total = sum(floor(counts[i] / 2) * k for i in range(index + 1) if counts[i] > 1)",
"- if (counts[0] + counts[index]) % 2 == 0:",
"- total += k - 1"... | false | 0.047045 | 0.070891 | 0.663627 | [
"s622128849",
"s318537997"
] |
u191874006 | p02606 | python | s683497302 | s301910058 | 101 | 63 | 65,340 | 61,632 | Accepted | Accepted | 37.62 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
l, r, d = list(map(int, input().split()))
n = (l-1) // d + 1
m = r // d
print((m-n+1)) | 25 | 6 | 656 | 107 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
l, r, d = list(map(int, input().split()))
n = (l - 1) // d + 1
m = r // d
print((m - n + 1))
| false | 76 | [
"-import sys",
"-import math",
"-from bisect import bisect_right as br",
"-from bisect import bisect_left as bl",
"-",
"-sys.setrecursionlimit(2147483647)",
"-from heapq import heappush, heappop, heappushpop",
"-from collections import defaultdict",
"-from itertools import accumulate",
"-from coll... | false | 0.050293 | 0.034912 | 1.440568 | [
"s683497302",
"s301910058"
] |
u802537549 | p02401 | python | s927663134 | s973361716 | 30 | 20 | 7,680 | 7,400 | Accepted | Accepted | 33.33 | while True:
line = input().split()
a = int(line[0])
b = int(line[2])
op = line[1]
if op == '+':
print((a + b))
elif op == '-':
print((a - b))
elif op == '*':
print((a * b))
elif op == '/':
print((a // b))
else:
break | while True:
line = eval(input())
if '?' in line:
break
print((eval(line.replace('/', '//')))) | 16 | 5 | 300 | 109 | while True:
line = input().split()
a = int(line[0])
b = int(line[2])
op = line[1]
if op == "+":
print((a + b))
elif op == "-":
print((a - b))
elif op == "*":
print((a * b))
elif op == "/":
print((a // b))
else:
break
| while True:
line = eval(input())
if "?" in line:
break
print((eval(line.replace("/", "//"))))
| false | 68.75 | [
"- line = input().split()",
"- a = int(line[0])",
"- b = int(line[2])",
"- op = line[1]",
"- if op == \"+\":",
"- print((a + b))",
"- elif op == \"-\":",
"- print((a - b))",
"- elif op == \"*\":",
"- print((a * b))",
"- elif op == \"/\":",
"- ... | false | 0.04211 | 0.042852 | 0.982678 | [
"s927663134",
"s973361716"
] |
u189023301 | p02883 | python | s454660696 | s642976525 | 1,600 | 296 | 129,968 | 53,804 | Accepted | Accepted | 81.5 | import numpy as np
from numba import njit
@njit
def solve(stdin):
n, k = stdin[:2]
A = stdin[2: 2 + n]
A = np.sort(A)[::-1]
F = np.sort(stdin[2 + n:])
def is_ok(x):
tmp = 0
for a, f in zip(A, F):
y = a * f
if y > x:
tmp += a - ... | import sys
import numpy as np
if sys.argv[-1] == 'ONLINE_JUDGE':
from numba.pycc import CC
cc = CC('my_module')
@cc.export('is_ok', '(i8[:],i8[:],i8,i8)')
def is_ok(A, F, x, k):
tmp = 0
for a, f in zip(A, F):
y = a * f
if y > x:
tmp ... | 30 | 37 | 611 | 752 | import numpy as np
from numba import njit
@njit
def solve(stdin):
n, k = stdin[:2]
A = stdin[2 : 2 + n]
A = np.sort(A)[::-1]
F = np.sort(stdin[2 + n :])
def is_ok(x):
tmp = 0
for a, f in zip(A, F):
y = a * f
if y > x:
tmp += a - x // f
... | import sys
import numpy as np
if sys.argv[-1] == "ONLINE_JUDGE":
from numba.pycc import CC
cc = CC("my_module")
@cc.export("is_ok", "(i8[:],i8[:],i8,i8)")
def is_ok(A, F, x, k):
tmp = 0
for a, f in zip(A, F):
y = a * f
if y > x:
tmp += a - x // ... | false | 18.918919 | [
"+import sys",
"-from numba import njit",
"+if sys.argv[-1] == \"ONLINE_JUDGE\":",
"+ from numba.pycc import CC",
"-@njit",
"-def solve(stdin):",
"- n, k = stdin[:2]",
"- A = stdin[2 : 2 + n]",
"- A = np.sort(A)[::-1]",
"- F = np.sort(stdin[2 + n :])",
"+ cc = CC(\"my_module\")... | false | 0.213927 | 0.2086 | 1.025536 | [
"s454660696",
"s642976525"
] |
u010110540 | p03680 | python | s840185166 | s841511220 | 202 | 71 | 7,084 | 7,084 | Accepted | Accepted | 64.85 | N = int(eval(input()))
a = []
for _ in range(N):
a.append(int(eval(input())))
s = a[0]
cnt = 1
for i in range(N):
if s == 2:
print(cnt)
exit()
cnt += 1
s = a[s-1]
print((-1)) | import sys
N = int(eval(input()))
a = [int(i) for i in sys.stdin]
s = a[0]
cnt = 1
for i in range(N):
if s == 2:
print(cnt)
exit()
cnt += 1
s = a[s-1]
print((-1)) | 16 | 16 | 218 | 209 | N = int(eval(input()))
a = []
for _ in range(N):
a.append(int(eval(input())))
s = a[0]
cnt = 1
for i in range(N):
if s == 2:
print(cnt)
exit()
cnt += 1
s = a[s - 1]
print((-1))
| import sys
N = int(eval(input()))
a = [int(i) for i in sys.stdin]
s = a[0]
cnt = 1
for i in range(N):
if s == 2:
print(cnt)
exit()
cnt += 1
s = a[s - 1]
print((-1))
| false | 0 | [
"+import sys",
"+",
"-a = []",
"-for _ in range(N):",
"- a.append(int(eval(input())))",
"+a = [int(i) for i in sys.stdin]"
] | false | 0.03631 | 0.039535 | 0.918416 | [
"s840185166",
"s841511220"
] |
u628335443 | p02779 | python | s771948328 | s021680618 | 117 | 63 | 33,996 | 32,692 | Accepted | Accepted | 46.15 | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = Counter(a)
if max(cnt.values()) == 1:
print('YES')
else:
print('NO')
| n = int(eval(input()))
a = list(input().split())
if len(a) == len(set(a)):
print('YES')
else:
print('NO')
| 11 | 7 | 181 | 115 | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = Counter(a)
if max(cnt.values()) == 1:
print("YES")
else:
print("NO")
| n = int(eval(input()))
a = list(input().split())
if len(a) == len(set(a)):
print("YES")
else:
print("NO")
| false | 36.363636 | [
"-from collections import Counter",
"-",
"-a = list(map(int, input().split()))",
"-cnt = Counter(a)",
"-if max(cnt.values()) == 1:",
"+a = list(input().split())",
"+if len(a) == len(set(a)):"
] | false | 0.081496 | 0.081795 | 0.996345 | [
"s771948328",
"s021680618"
] |
u392319141 | p02708 | python | s277949774 | s720512397 | 204 | 129 | 9,200 | 9,104 | Accepted | Accepted | 36.76 | N, K = list(map(int, input().split()))
MOD = 10**9 + 7
S = N * (N + 1) // 2
ans = 1
for d in range(N + 1):
if N - d < K:
break
mx = S - (d * (d + 1) // 2)
mi = max(0, (N - d - 1) * ((N - d - 1) + 1) // 2)
ans += (mx - mi + 1) % MOD
ans %= MOD
print(ans) | N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for k in range(K, N + 2):
base = k * (k - 1) // 2
mx = base + k + (N - k) * k
ans += mx - base + 1
ans %= MOD
print(ans)
| 13 | 11 | 288 | 206 | N, K = list(map(int, input().split()))
MOD = 10**9 + 7
S = N * (N + 1) // 2
ans = 1
for d in range(N + 1):
if N - d < K:
break
mx = S - (d * (d + 1) // 2)
mi = max(0, (N - d - 1) * ((N - d - 1) + 1) // 2)
ans += (mx - mi + 1) % MOD
ans %= MOD
print(ans)
| N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for k in range(K, N + 2):
base = k * (k - 1) // 2
mx = base + k + (N - k) * k
ans += mx - base + 1
ans %= MOD
print(ans)
| false | 15.384615 | [
"-S = N * (N + 1) // 2",
"-ans = 1",
"-for d in range(N + 1):",
"- if N - d < K:",
"- break",
"- mx = S - (d * (d + 1) // 2)",
"- mi = max(0, (N - d - 1) * ((N - d - 1) + 1) // 2)",
"- ans += (mx - mi + 1) % MOD",
"+ans = 0",
"+for k in range(K, N + 2):",
"+ base = k * (k -... | false | 0.063141 | 0.054468 | 1.15923 | [
"s277949774",
"s720512397"
] |
u859491652 | p03731 | python | s059684621 | s882126355 | 143 | 124 | 25,200 | 26,708 | Accepted | Accepted | 13.29 | #N,Tの取得
l = list(map(int, input().split()))
N = l[0]
T = l[1]
#秒のリストを取得
tl = list(map(int, input().split()))
sw = 0 #スイッチオンオフの管理
bt = 0 #直前のスイッチを押した時間
gt = 0 #秒数総和
for i, t in enumerate(tl):
if sw == 1 and t - bt > T:
sw = 0 #全快スイッチを押してからT秒経過していたら、スイッチオフ
if sw == 0:
gt += T #スイッ... | #N,Tの取得
l = list(map(int, input().split()))
N = l[0]
T = l[1]
#秒のリストを取得
tl = list(map(int, input().split()))
bt = 0 #直前のスイッチを押した時間
gt = T #秒数総和
for t in tl[1:]:
if t - bt > T:
gt += T #スイッチオフの時はT秒追加
else:
gt += t - bt #スイッチがオンのとき、前回からの経過時間を加算
bt = t
print((str(g... | 23 | 19 | 450 | 322 | # N,Tの取得
l = list(map(int, input().split()))
N = l[0]
T = l[1]
# 秒のリストを取得
tl = list(map(int, input().split()))
sw = 0 # スイッチオンオフの管理
bt = 0 # 直前のスイッチを押した時間
gt = 0 # 秒数総和
for i, t in enumerate(tl):
if sw == 1 and t - bt > T:
sw = 0 # 全快スイッチを押してからT秒経過していたら、スイッチオフ
if sw == 0:
gt += T # スイッチオフの時... | # N,Tの取得
l = list(map(int, input().split()))
N = l[0]
T = l[1]
# 秒のリストを取得
tl = list(map(int, input().split()))
bt = 0 # 直前のスイッチを押した時間
gt = T # 秒数総和
for t in tl[1:]:
if t - bt > T:
gt += T # スイッチオフの時はT秒追加
else:
gt += t - bt # スイッチがオンのとき、前回からの経過時間を加算
bt = t
print((str(gt)))
| false | 17.391304 | [
"-sw = 0 # スイッチオンオフの管理",
"-gt = 0 # 秒数総和",
"-for i, t in enumerate(tl):",
"- if sw == 1 and t - bt > T:",
"- sw = 0 # 全快スイッチを押してからT秒経過していたら、スイッチオフ",
"- if sw == 0:",
"+gt = T # 秒数総和",
"+for t in tl[1:]:",
"+ if t - bt > T:",
"- sw = 1 # スイッチオン。"
] | false | 0.047824 | 0.048402 | 0.988049 | [
"s059684621",
"s882126355"
] |
u555767343 | p02699 | python | s254278232 | s926467281 | 69 | 63 | 61,788 | 61,812 | Accepted | Accepted | 8.7 | s, w = list(map(int, input().split()))
if w >= s:
print('unsafe')
else:
print('safe') | s, w = map(int, input().split())
print('unsafe') if w >= s else print('safe')
| 5 | 2 | 91 | 78 | s, w = list(map(int, input().split()))
if w >= s:
print("unsafe")
else:
print("safe")
| s, w = map(int, input().split())
print("unsafe") if w >= s else print("safe")
| false | 60 | [
"-s, w = list(map(int, input().split()))",
"-if w >= s:",
"- print(\"unsafe\")",
"-else:",
"- print(\"safe\")",
"+s, w = map(int, input().split())",
"+print(\"unsafe\") if w >= s else print(\"safe\")"
] | false | 0.045929 | 0.039496 | 1.162894 | [
"s254278232",
"s926467281"
] |
u935558307 | p03165 | python | s907111862 | s169097342 | 456 | 308 | 112,220 | 144,668 | Accepted | Accepted | 32.46 | S = eval(input())
T = eval(input())
lenS = len(S)
lenT = len(T)
dp = [[0]*(lenT+1) for _ in range(lenS+1)]
for i in range(1,lenS+1):
for j in range(1,lenT+1):
if S[i-1]==T[j-1]:
dp[i][j] = dp[i-1][j-1]+1
else:
dp[i][j] = max(dp[i-1][j],dp[i][j-1])
ans = []
while l... | S = eval(input())
T = eval(input())
N = len(S)
M = len(T)
#dp[i][j] -> Sのi文字目、Tのj文字目までみるとき、最長共通部分列の長さ
dp = [[0]*(M+1) for _ in range(N+1)]
for i in range(1,N+1):
s = S[i-1]
for j in range(1,M+1):
t = T[j-1]
if s == t:
dp[i][j] = dp[i-1][j-1] + 1
else:
... | 23 | 29 | 561 | 609 | S = eval(input())
T = eval(input())
lenS = len(S)
lenT = len(T)
dp = [[0] * (lenT + 1) for _ in range(lenS + 1)]
for i in range(1, lenS + 1):
for j in range(1, lenT + 1):
if S[i - 1] == T[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])... | S = eval(input())
T = eval(input())
N = len(S)
M = len(T)
# dp[i][j] -> Sのi文字目、Tのj文字目までみるとき、最長共通部分列の長さ
dp = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
s = S[i - 1]
for j in range(1, M + 1):
t = T[j - 1]
if s == t:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
... | false | 20.689655 | [
"-lenS = len(S)",
"-lenT = len(T)",
"-dp = [[0] * (lenT + 1) for _ in range(lenS + 1)]",
"-for i in range(1, lenS + 1):",
"- for j in range(1, lenT + 1):",
"- if S[i - 1] == T[j - 1]:",
"+N = len(S)",
"+M = len(T)",
"+# dp[i][j] -> Sのi文字目、Tのj文字目までみるとき、最長共通部分列の長さ",
"+dp = [[0] * (M + 1) f... | false | 0.039289 | 0.036882 | 1.065258 | [
"s907111862",
"s169097342"
] |
u629540524 | p03239 | python | s718556065 | s135937601 | 30 | 26 | 9,160 | 9,128 | Accepted | Accepted | 13.33 | n,t = list(map(int, input().split()))
y = 10**5
for i in range(n):
c,x = list(map(int,input().split()))
if x<=t:
y=min(y,c)
if y != 10**5:
print(y)
else:
print("TLE") | n,t = list(map(int, input().split()))
y = 10**5
c = [list(map(int,input().split())) for i in range(n)]
for i in range(n):
if c[i][1]<=t:
y=min(y,c[i][0])
if y != 10**5:
print(y)
else:
print("TLE") | 10 | 10 | 187 | 219 | n, t = list(map(int, input().split()))
y = 10**5
for i in range(n):
c, x = list(map(int, input().split()))
if x <= t:
y = min(y, c)
if y != 10**5:
print(y)
else:
print("TLE")
| n, t = list(map(int, input().split()))
y = 10**5
c = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
if c[i][1] <= t:
y = min(y, c[i][0])
if y != 10**5:
print(y)
else:
print("TLE")
| false | 0 | [
"+c = [list(map(int, input().split())) for i in range(n)]",
"- c, x = list(map(int, input().split()))",
"- if x <= t:",
"- y = min(y, c)",
"+ if c[i][1] <= t:",
"+ y = min(y, c[i][0])"
] | false | 0.007982 | 0.034494 | 0.231417 | [
"s718556065",
"s135937601"
] |
u569960318 | p02240 | python | s554249389 | s400225314 | 630 | 480 | 33,476 | 33,568 | Accepted | Accepted | 23.81 | import sys
def make_connected_group(G):
C = [None]*len(G)
group = 0
for i,p in enumerate(C):
if p != None: continue
friends = [i]
while len(friends) > 0:
f = friends.pop()
if C[f] == None:
C[f] = group
friends += G... | import sys
def make_connected_group(G):
C = [None]*len(G)
group = 0
for i,p in enumerate(C):
if p != None: continue
friends = [i]
while len(friends) > 0:
f = friends.pop()
if C[f] == None:
C[f] = group
friends += G... | 30 | 32 | 810 | 871 | import sys
def make_connected_group(G):
C = [None] * len(G)
group = 0
for i, p in enumerate(C):
if p != None:
continue
friends = [i]
while len(friends) > 0:
f = friends.pop()
if C[f] == None:
C[f] = group
friends +... | import sys
def make_connected_group(G):
C = [None] * len(G)
group = 0
for i, p in enumerate(C):
if p != None:
continue
friends = [i]
while len(friends) > 0:
f = friends.pop()
if C[f] == None:
C[f] = group
friends +... | false | 6.25 | [
"- for _ in range(m):",
"- s, t = list(map(int, input().split()))",
"+ for j, line in enumerate(sys.stdin):",
"+ if not j < m:",
"+ q = int(line)",
"+ break",
"+ s, t = list(map(int, line.split()))",
"- q = int(eval(input()))"
] | false | 0.061532 | 0.038479 | 1.599105 | [
"s554249389",
"s400225314"
] |
u572144347 | p03476 | python | s451926657 | s604295719 | 903 | 289 | 7,344 | 14,828 | Accepted | Accepted | 68 | #!/mnt/c/Users/moiki/bash/env/bin/python
# N,M = map(int, input().split())
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
d... |
import math
isprime = None
def sieve(n):
global isprime
if n < 2:
isprime = [False] * (n + 1)
return
isprime = [True if i % 2 != 0 else False for i in range(n + 1)]
isprime[0] = isprime[1] = False
isprime[2] = True
from math import sqrt, ceil
for... | 102 | 44 | 2,338 | 949 | #!/mnt/c/Users/moiki/bash/env/bin/python
# N,M = map(int, input().split())
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, ... | import math
isprime = None
def sieve(n):
global isprime
if n < 2:
isprime = [False] * (n + 1)
return
isprime = [True if i % 2 != 0 else False for i in range(n + 1)]
isprime[0] = isprime[1] = False
isprime[2] = True
from math import sqrt, ceil
for i in range(3, int(sqrt(n)... | false | 56.862745 | [
"-#!/mnt/c/Users/moiki/bash/env/bin/python",
"-# N,M = map(int, input().split())",
"-class Bit:",
"- def __init__(self, n):",
"- self.size = n",
"- self.tree = [0] * (n + 1)",
"-",
"- def sum(self, i):",
"- s = 0",
"- while i > 0:",
"- s += self.tree[... | false | 0.161551 | 0.007864 | 20.542104 | [
"s451926657",
"s604295719"
] |
u941438707 | p03834 | python | s986893703 | s468275181 | 175 | 18 | 38,256 | 2,940 | Accepted | Accepted | 89.71 | s=eval(input())
print((s.replace(","," "))) | a,b,c=input().split(",")
print((a,b,c))
| 2 | 2 | 36 | 39 | s = eval(input())
print((s.replace(",", " ")))
| a, b, c = input().split(",")
print((a, b, c))
| false | 0 | [
"-s = eval(input())",
"-print((s.replace(\",\", \" \")))",
"+a, b, c = input().split(\",\")",
"+print((a, b, c))"
] | false | 0.087786 | 0.034311 | 2.558529 | [
"s986893703",
"s468275181"
] |
u528748570 | p02899 | python | s806440794 | s652943557 | 245 | 217 | 19,248 | 13,880 | Accepted | Accepted | 11.43 | N = int(input())
A = list(map(int, input().split()))
A = list(enumerate(A))
A.sort(key = lambda x: x[1])
for i in range(N):
print(A[i][0] + 1, end = " ")
| N = int(input())
A = list(map(int, input().split()))
# A = list(enumerate(A))
# A.sort(key = lambda x: x[1])
# for i in range(N):
# print(A[i][0] + 1, end = " ")
A = sorted(range(N), key = lambda i: A[i])
for i in range(N):
print(A[i]+1, end = " ")
| 8 | 11 | 167 | 269 | N = int(input())
A = list(map(int, input().split()))
A = list(enumerate(A))
A.sort(key=lambda x: x[1])
for i in range(N):
print(A[i][0] + 1, end=" ")
| N = int(input())
A = list(map(int, input().split()))
# A = list(enumerate(A))
# A.sort(key = lambda x: x[1])
# for i in range(N):
# print(A[i][0] + 1, end = " ")
A = sorted(range(N), key=lambda i: A[i])
for i in range(N):
print(A[i] + 1, end=" ")
| false | 27.272727 | [
"-A = list(enumerate(A))",
"-A.sort(key=lambda x: x[1])",
"+# A = list(enumerate(A))",
"+# A.sort(key = lambda x: x[1])",
"+# for i in range(N):",
"+# print(A[i][0] + 1, end = \" \")",
"+A = sorted(range(N), key=lambda i: A[i])",
"- print(A[i][0] + 1, end=\" \")",
"+ print(A[i] + 1, end=\"... | false | 0.041929 | 0.041179 | 1.018232 | [
"s806440794",
"s652943557"
] |
u745087332 | p03142 | python | s373488088 | s868112045 | 854 | 395 | 46,852 | 25,504 | Accepted | Accepted | 53.75 | # coding:utf-8
import sys
from collections import deque
from operator import itemgetter
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
d... | # coding:utf-8
import sys
from collections import deque, defaultdict
from operator import itemgetter
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline... | 60 | 57 | 1,239 | 1,294 | # coding:utf-8
import sys
from collections import deque
from operator import itemgetter
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()... | # coding:utf-8
import sys
from collections import deque, defaultdict
from operator import itemgetter
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readl... | false | 5 | [
"-from collections import deque",
"+from collections import deque, defaultdict",
"- return eval(input())",
"+ return input()",
"+# def topological_sort(graph: list, indegree: list):",
"+# from collections import deque",
"+# que = deque(i for i in range(len(graph)) if indegree[i] == 0)",
... | false | 0.04534 | 0.037035 | 1.224233 | [
"s373488088",
"s868112045"
] |
u427344224 | p03212 | python | s071330676 | s484881254 | 121 | 50 | 15,504 | 5,236 | Accepted | Accepted | 58.68 | import sys
sys.setrecursionlimit(10 ** 9)
N = int(eval(input()))
length = len(str(N)) + 1
result = []
def dfs(now):
if len(now) <= length and now != "":
result.append(now)
if len(now) == length:
return
dfs("3" + now)
dfs("5" + now)
dfs("7" + now)
dfs(""... | N = int(eval(input()))
nums = []
length = len(str(N))
def dfs(s, n):
global nums
nums.append(s)
if n == length:
return
dfs(s + "3", n + 1)
dfs(s + "5", n + 1)
dfs(s + "7", n + 1)
dfs("", 0)
ans = 0
for i in nums:
if i.count("3") >= ... | 26 | 19 | 490 | 439 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
length = len(str(N)) + 1
result = []
def dfs(now):
if len(now) <= length and now != "":
result.append(now)
if len(now) == length:
return
dfs("3" + now)
dfs("5" + now)
dfs("7" + now)
dfs("")
ans = 0
result = s... | N = int(eval(input()))
nums = []
length = len(str(N))
def dfs(s, n):
global nums
nums.append(s)
if n == length:
return
dfs(s + "3", n + 1)
dfs(s + "5", n + 1)
dfs(s + "7", n + 1)
dfs("", 0)
ans = 0
for i in nums:
if i.count("3") >= 1 and i.count("5") >= 1 and i.count("7") >= 1:
... | false | 26.923077 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**9)",
"-length = len(str(N)) + 1",
"-result = []",
"+nums = []",
"+length = len(str(N))",
"-def dfs(now):",
"- if len(now) <= length and now != \"\":",
"- result.append(now)",
"- if len(now) == length:",
"- return",
"... | false | 0.391616 | 0.062048 | 6.311484 | [
"s071330676",
"s484881254"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.