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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u925626880 | p03455 | python | s401206804 | s713493974 | 173 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.17 | a,b = [int(s) for s in input().split()]
print((('Even', 'Odd')[(a*b)%2]))
| a,b = list(map(int, input().split()))
if ((a*b) % 2):
print('Odd')
else:
print('Even')
| 2 | 6 | 73 | 95 | a, b = [int(s) for s in input().split()]
print((("Even", "Odd")[(a * b) % 2]))
| a, b = list(map(int, input().split()))
if (a * b) % 2:
print("Odd")
else:
print("Even")
| false | 66.666667 | [
"-a, b = [int(s) for s in input().split()]",
"-print(((\"Even\", \"Odd\")[(a * b) % 2]))",
"+a, b = list(map(int, input().split()))",
"+if (a * b) % 2:",
"+ print(\"Odd\")",
"+else:",
"+ print(\"Even\")"
] | false | 0.044956 | 0.037323 | 1.204505 | [
"s401206804",
"s713493974"
] |
u506705885 | p02408 | python | s810895964 | s554091811 | 30 | 20 | 7,748 | 5,612 | Accepted | Accepted | 33.33 | S_cards=[]
H_cards=[]
C_cards=[]
D_cards=[]
for i in range(1,14):
S_cards.append(i)
H_cards.append(i)
C_cards.append(i)
D_cards.append(i)
now_cards=int(eval(input()))
for i in range(0,now_cards):
kind_num=[]
kind_num=input().split()
if kind_num[0]=='S':
S_cards.remo... | S=[i for i in range(1,14)]
H=[i for i in range(1,14)]
C=[i for i in range(1,14)]
D=[i for i in range(1,14)]
cards=int(eval(input()))
for i in range(0,cards):
mark,rank=input().split()
rank=int(rank)
if mark=="S":
S.remove(rank)
elif mark=="H":
H.remove(rank)
elif mark=="C... | 31 | 24 | 784 | 509 | S_cards = []
H_cards = []
C_cards = []
D_cards = []
for i in range(1, 14):
S_cards.append(i)
H_cards.append(i)
C_cards.append(i)
D_cards.append(i)
now_cards = int(eval(input()))
for i in range(0, now_cards):
kind_num = []
kind_num = input().split()
if kind_num[0] == "S":
S_cards.remo... | S = [i for i in range(1, 14)]
H = [i for i in range(1, 14)]
C = [i for i in range(1, 14)]
D = [i for i in range(1, 14)]
cards = int(eval(input()))
for i in range(0, cards):
mark, rank = input().split()
rank = int(rank)
if mark == "S":
S.remove(rank)
elif mark == "H":
H.remove(rank)
e... | false | 22.580645 | [
"-S_cards = []",
"-H_cards = []",
"-C_cards = []",
"-D_cards = []",
"-for i in range(1, 14):",
"- S_cards.append(i)",
"- H_cards.append(i)",
"- C_cards.append(i)",
"- D_cards.append(i)",
"-now_cards = int(eval(input()))",
"-for i in range(0, now_cards):",
"- kind_num = []",
"-... | false | 0.046981 | 0.045087 | 1.042012 | [
"s810895964",
"s554091811"
] |
u405660020 | p02912 | python | s077867498 | s593207885 | 184 | 163 | 14,168 | 14,180 | Accepted | Accepted | 11.41 | from heapq import heappop,heappush,heapify
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n,m = list(map(int,input().split()))
a = [int(x) for x in input().split()]
a_minus = [-x for x in a]
heapify(a_minus)
pop = lambda: -heappop(a_minus)
push = lambda x: heappush(a_minus,-x)
... | import heapq
n, m = list(map(int, input().split()))
a = list([int(x)*(-1) for x in input().split()])
heapq.heapify(a)
for i in range(m):
tmp_min=heapq.heappop(a)
heapq.heappush(a,(-1)*(-1*tmp_min//2)) # 計算誤差の関係で-1を2回かけてます
print((-sum(a)))
| 19 | 9 | 391 | 253 | from heapq import heappop, heappush, heapify
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n, m = list(map(int, input().split()))
a = [int(x) for x in input().split()]
a_minus = [-x for x in a]
heapify(a_minus)
pop = lambda: -heappop(a_minus)
push = lambda x: heappush(a_minus, -x)
for _ in range(m... | import heapq
n, m = list(map(int, input().split()))
a = list([int(x) * (-1) for x in input().split()])
heapq.heapify(a)
for i in range(m):
tmp_min = heapq.heappop(a)
heapq.heappush(a, (-1) * (-1 * tmp_min // 2)) # 計算誤差の関係で-1を2回かけてます
print((-sum(a)))
| false | 52.631579 | [
"-from heapq import heappop, heappush, heapify",
"-import sys",
"+import heapq",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"-a = [int(x) for x in input().split()]",
"-a_minus = [-x for x in a]",
"-heapify(a_minus)",
"-pop = lambda: -heappop(a_minus)",
"-push = lambda x: heapp... | false | 0.148584 | 0.054719 | 2.715391 | [
"s077867498",
"s593207885"
] |
u970197315 | p02631 | python | s625284846 | s254984085 | 169 | 155 | 31,648 | 31,604 | Accepted | Accepted | 8.28 | n=int(eval(input()))
a=list(map(int,input().split()))
s=0
for aa in a:
s^=aa
b=[]
for i in range(n):
b.append(s^a[i])
print((*b)) | n=int(eval(input()))
a=list(map(int,input().split()))
b=[]
s=0
for aa in a:
s^=aa
for aa in a:
b.append(s^aa)
print((*b)) | 9 | 9 | 133 | 125 | n = int(eval(input()))
a = list(map(int, input().split()))
s = 0
for aa in a:
s ^= aa
b = []
for i in range(n):
b.append(s ^ a[i])
print((*b))
| n = int(eval(input()))
a = list(map(int, input().split()))
b = []
s = 0
for aa in a:
s ^= aa
for aa in a:
b.append(s ^ aa)
print((*b))
| false | 0 | [
"+b = []",
"-b = []",
"-for i in range(n):",
"- b.append(s ^ a[i])",
"+for aa in a:",
"+ b.append(s ^ aa)"
] | false | 0.041646 | 0.041556 | 1.002164 | [
"s625284846",
"s254984085"
] |
u353919145 | p02836 | python | s948936298 | s855472548 | 183 | 17 | 38,384 | 3,060 | Accepted | Accepted | 90.71 | def main():
s = eval(input()); total = 0
for i in range(len(s) // 2):
if s[i] != s[-i - 1]:
total += 1
print(total)
main() | s = eval(input())
n = len(s)//2
count = 0
f = s[:n]
l = s[-n:]
l = l[::-1]
for i in range(n):
if f[i] != l[i]:
count+=1
print(count) | 7 | 10 | 154 | 150 | def main():
s = eval(input())
total = 0
for i in range(len(s) // 2):
if s[i] != s[-i - 1]:
total += 1
print(total)
main()
| s = eval(input())
n = len(s) // 2
count = 0
f = s[:n]
l = s[-n:]
l = l[::-1]
for i in range(n):
if f[i] != l[i]:
count += 1
print(count)
| false | 30 | [
"-def main():",
"- s = eval(input())",
"- total = 0",
"- for i in range(len(s) // 2):",
"- if s[i] != s[-i - 1]:",
"- total += 1",
"- print(total)",
"-",
"-",
"-main()",
"+s = eval(input())",
"+n = len(s) // 2",
"+count = 0",
"+f = s[:n]",
"+l = s[-n:]",
"... | false | 0.036314 | 0.041486 | 0.87534 | [
"s948936298",
"s855472548"
] |
u279266699 | p02947 | python | s131146689 | s947659341 | 450 | 225 | 24,060 | 24,100 | Accepted | Accepted | 50 | from collections import Counter
from math import factorial
def combinations_count(n, r):
return factorial(n) // (factorial(n - r) * factorial(r))
n = int(eval(input()))
S = [''.join(sorted(eval(input()))) for _ in range(n)]
S_c = Counter(S)
ans = 0
for i in list(S_c.values()):
if i != 1:
... | from collections import Counter
n = int(eval(input()))
S = [''.join(sorted(eval(input()))) for _ in range(n)]
S_c = Counter(S)
ans = 0
for i in list(S_c.values()):
ans += i * (i - 1) // 2
print(ans) | 18 | 11 | 359 | 203 | from collections import Counter
from math import factorial
def combinations_count(n, r):
return factorial(n) // (factorial(n - r) * factorial(r))
n = int(eval(input()))
S = ["".join(sorted(eval(input()))) for _ in range(n)]
S_c = Counter(S)
ans = 0
for i in list(S_c.values()):
if i != 1:
ans += comb... | from collections import Counter
n = int(eval(input()))
S = ["".join(sorted(eval(input()))) for _ in range(n)]
S_c = Counter(S)
ans = 0
for i in list(S_c.values()):
ans += i * (i - 1) // 2
print(ans)
| false | 38.888889 | [
"-from math import factorial",
"-",
"-",
"-def combinations_count(n, r):",
"- return factorial(n) // (factorial(n - r) * factorial(r))",
"-",
"- if i != 1:",
"- ans += combinations_count(i, 2)",
"+ ans += i * (i - 1) // 2"
] | false | 0.050401 | 0.04988 | 1.01045 | [
"s131146689",
"s947659341"
] |
u583507988 | p03162 | python | s915121148 | s840777150 | 667 | 250 | 50,216 | 106,196 | Accepted | Accepted | 62.52 | n = int(eval(input()))
a = [list(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]+a[i][k])
print((max(dp[-1]))) | n=int(eval(input()))
a=[list(map(int,input().split())) for i in range(n)]
dp=[[a[0][0],a[0][1],a[0][2]]]+[[0]*3 for i in range(n-1)]
for i in range(1,n):
for j in range(3):
if j==0:
dp[i][j]=max(dp[i-1][1],dp[i-1][2])+a[i][0]
elif j==1:
dp[i][j]=max(dp[i-1][0],dp[i-1][2])+a[i][1]
else... | 12 | 12 | 285 | 387 | n = int(eval(input()))
a = [list(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] + a[i][k])
print((max(dp[-1])))
| n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
dp = [[a[0][0], a[0][1], a[0][2]]] + [[0] * 3 for i in range(n - 1)]
for i in range(1, n):
for j in range(3):
if j == 0:
dp[i][j] = max(dp[i - 1][1], dp[i - 1][2]) + a[i][0]
elif j == 1:
dp[i][j] =... | false | 0 | [
"-dp = [[0] * 3 for i in range(n + 1)]",
"-for i in range(n):",
"+dp = [[a[0][0], a[0][1], a[0][2]]] + [[0] * 3 for i in range(n - 1)]",
"+for i in range(1, n):",
"- for k in range(3):",
"- if j == k:",
"- continue",
"- dp[i + 1][k] = max(dp[i + 1][k], dp[i]... | false | 0.038275 | 0.037842 | 1.011435 | [
"s915121148",
"s840777150"
] |
u761529120 | p02742 | python | s018225025 | s709048421 | 189 | 166 | 38,484 | 38,384 | Accepted | Accepted | 12.17 | def main():
H, W = list(map(int, input().split()))
if H == 1 or W == 1:
print((1))
exit()
ans = 0
ans += (W - (W // 2)) * (H - (H // 2))
ans += (W // 2) * (H // 2)
print(ans)
if __name__ == "__main__":
main() | def main():
H, W = list(map(int, input().split()))
if H == 1 or W == 1:
print((1))
exit()
ans = (H // 2) * (W // 2)
yoko = W // 2 if W % 2 == 0 else W // 2 + 1
tate = H // 2 if H % 2 == 0 else H // 2 + 1
ans += tate * yoko
print(ans)
if __name__ == "__main__":... | 15 | 15 | 263 | 324 | def main():
H, W = list(map(int, input().split()))
if H == 1 or W == 1:
print((1))
exit()
ans = 0
ans += (W - (W // 2)) * (H - (H // 2))
ans += (W // 2) * (H // 2)
print(ans)
if __name__ == "__main__":
main()
| def main():
H, W = list(map(int, input().split()))
if H == 1 or W == 1:
print((1))
exit()
ans = (H // 2) * (W // 2)
yoko = W // 2 if W % 2 == 0 else W // 2 + 1
tate = H // 2 if H % 2 == 0 else H // 2 + 1
ans += tate * yoko
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"- ans = 0",
"- ans += (W - (W // 2)) * (H - (H // 2))",
"- ans += (W // 2) * (H // 2)",
"+ ans = (H // 2) * (W // 2)",
"+ yoko = W // 2 if W % 2 == 0 else W // 2 + 1",
"+ tate = H // 2 if H % 2 == 0 else H // 2 + 1",
"+ ans += tate * yoko"
] | false | 0.041855 | 0.039976 | 1.046993 | [
"s018225025",
"s709048421"
] |
u644907318 | p02927 | python | s909353878 | s461674468 | 175 | 66 | 38,384 | 67,740 | Accepted | Accepted | 62.29 | M,D = list(map(int,input().split()))
cnt = 0
for i in range(22,D+1):
d = str(i)
if int(d[1])>=2 and int(d[1])*int(d[0])<=M:
cnt += 1
print(cnt) | M,D = list(map(int,input().split()))
cnt = 0
for m in range(4,M+1):
for d in range(1,D+1):
if d>=20:
d = str(d)
if int(d[1])>=2:
if m==int(d[0])*int(d[1]):
cnt += 1
print(cnt) | 7 | 10 | 159 | 250 | M, D = list(map(int, input().split()))
cnt = 0
for i in range(22, D + 1):
d = str(i)
if int(d[1]) >= 2 and int(d[1]) * int(d[0]) <= M:
cnt += 1
print(cnt)
| M, D = list(map(int, input().split()))
cnt = 0
for m in range(4, M + 1):
for d in range(1, D + 1):
if d >= 20:
d = str(d)
if int(d[1]) >= 2:
if m == int(d[0]) * int(d[1]):
cnt += 1
print(cnt)
| false | 30 | [
"-for i in range(22, D + 1):",
"- d = str(i)",
"- if int(d[1]) >= 2 and int(d[1]) * int(d[0]) <= M:",
"- cnt += 1",
"+for m in range(4, M + 1):",
"+ for d in range(1, D + 1):",
"+ if d >= 20:",
"+ d = str(d)",
"+ if int(d[1]) >= 2:",
"+ i... | false | 0.036118 | 0.035056 | 1.030275 | [
"s909353878",
"s461674468"
] |
u852210959 | p02708 | python | s235583618 | s924165603 | 113 | 93 | 19,640 | 19,580 | Accepted | Accepted | 17.7 | # -*- coding: utf-8 -*-
# 入力を整数に変換して受け取る
def input_int():
return int(eval(input()))
# マイナス1した値を返却
def int1(x):
return int(x) - 1
# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
return list(map(int, input().split()))
# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
re... | # -*- coding: utf-8 -*-
# 入力を整数に変換して受け取る
def input_int():
return int(eval(input()))
# マイナス1した値を返却
def int1(x):
return int(x) - 1
# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
return list(map(int, input().split()))
# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
re... | 61 | 61 | 1,171 | 1,171 | # -*- coding: utf-8 -*-
# 入力を整数に変換して受け取る
def input_int():
return int(eval(input()))
# マイナス1した値を返却
def int1(x):
return int(x) - 1
# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
return list(map(int, input().split()))
# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
return tuple(map(int, ... | # -*- coding: utf-8 -*-
# 入力を整数に変換して受け取る
def input_int():
return int(eval(input()))
# マイナス1した値を返却
def int1(x):
return int(x) - 1
# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
return list(map(int, input().split()))
# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
return tuple(map(int, ... | false | 0 | [
"- ret = (",
"- ret",
"- + (",
"- all_list_sum[n + 1]",
"- - all_list_sum[n + 1 - choice_cnt]",
"- - all_list_sum[choice_cnt]",
"- + 1",
"- )",
"- ) % MOD",
"- return ret",
"+ ret... | false | 0.052534 | 0.051595 | 1.018199 | [
"s235583618",
"s924165603"
] |
u036104576 | p02714 | python | s455822249 | s395623171 | 1,770 | 165 | 360,132 | 68,704 | Accepted | Accepted | 90.68 | import sys
import itertools
# import numpy as np
import time
import math
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
s = eval(input())
counter = [(0, ... | import sys
import itertools
# import numpy as np
import time
import math
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
s = eval(input())
r_c = 0
g_c = ... | 63 | 39 | 1,282 | 811 | import sys
import itertools
# import numpy as np
import time
import math
sys.setrecursionlimit(10**7)
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
s = eval(input())
counter = [(0, 0, 0)]
for c in s:
... | import sys
import itertools
# import numpy as np
import time
import math
sys.setrecursionlimit(10**7)
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
s = eval(input())
r_c = 0
g_c = 0
b_c = 0
for c in s:
... | false | 38.095238 | [
"-counter = [(0, 0, 0)]",
"+r_c = 0",
"+g_c = 0",
"+b_c = 0",
"- rgb = counter[-1]",
"- r, g, b = 0, 0, 0",
"- r = 1",
"+ r_c += 1",
"- g = 1",
"+ g_c += 1",
"- b = 1",
"- new_rgb = (rgb[0] + r, rgb[1] + g, rgb[2] + b)",
"- counter.append(new_rg... | false | 0.042829 | 0.048318 | 0.886411 | [
"s455822249",
"s395623171"
] |
u116233709 | p03127 | python | s107726156 | s482230197 | 1,665 | 84 | 14,252 | 14,224 | Accepted | Accepted | 94.95 | n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
while len(a)>=2:
for i in range(1,len(a)):
a[i]=a[i]%a[0]
if 0 in a:
for j in range(a.count(0)):
a.remove(0)
a.sort()
print((a[0]))
| n=int(eval(input()))
a=list(map(int,input().split()))
def gcd(x,y):
if x%y==0:
return y
else:
return gcd(y,x%y)
b=a[0]
for i in range(1,n):
b=gcd(b,a[i])
print(b)
| 15 | 15 | 229 | 198 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
while len(a) >= 2:
for i in range(1, len(a)):
a[i] = a[i] % a[0]
if 0 in a:
for j in range(a.count(0)):
a.remove(0)
a.sort()
print((a[0]))
| n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(x, y):
if x % y == 0:
return y
else:
return gcd(y, x % y)
b = a[0]
for i in range(1, n):
b = gcd(b, a[i])
print(b)
| false | 0 | [
"-a.sort()",
"-while len(a) >= 2:",
"- for i in range(1, len(a)):",
"- a[i] = a[i] % a[0]",
"- if 0 in a:",
"- for j in range(a.count(0)):",
"- a.remove(0)",
"- a.sort()",
"-print((a[0]))",
"+",
"+",
"+def gcd(x, y):",
"+ if x % y == 0:",
"+ retu... | false | 0.102922 | 0.036001 | 2.858864 | [
"s107726156",
"s482230197"
] |
u265213765 | p02659 | python | s938158634 | s889856974 | 28 | 25 | 10,016 | 10,048 | Accepted | Accepted | 10.71 | import math
from decimal import *
a,b = input().split()
a = Decimal(a)
b = Decimal(b)
b = b*100
print((math.floor(a*b//100))) | import math
from decimal import *
a,b = input().split()
a = Decimal(a)
b = Decimal(b)
# b = b*100
print((math.floor(a*b))) | 7 | 7 | 129 | 126 | import math
from decimal import *
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
b = b * 100
print((math.floor(a * b // 100)))
| import math
from decimal import *
a, b = input().split()
a = Decimal(a)
b = Decimal(b)
# b = b*100
print((math.floor(a * b)))
| false | 0 | [
"-b = b * 100",
"-print((math.floor(a * b // 100)))",
"+# b = b*100",
"+print((math.floor(a * b)))"
] | false | 0.046932 | 0.04482 | 1.047115 | [
"s938158634",
"s889856974"
] |
u941047297 | p03796 | python | s191228806 | s487460740 | 183 | 39 | 38,512 | 2,940 | Accepted | Accepted | 78.69 | N = int(eval(input()))
p = 1
m = int(1e+9 + 7)
for i in range(1, N + 1):
p = p * i
if p > m:
p = p % m
print(p) | n = int(eval(input()))
p = 1
mod = 1000000007
for i in range(1, n + 1):
p *= i
p = p % mod
print(p) | 8 | 7 | 128 | 107 | N = int(eval(input()))
p = 1
m = int(1e9 + 7)
for i in range(1, N + 1):
p = p * i
if p > m:
p = p % m
print(p)
| n = int(eval(input()))
p = 1
mod = 1000000007
for i in range(1, n + 1):
p *= i
p = p % mod
print(p)
| false | 12.5 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"-m = int(1e9 + 7)",
"-for i in range(1, N + 1):",
"- p = p * i",
"- if p > m:",
"- p = p % m",
"+mod = 1000000007",
"+for i in range(1, n + 1):",
"+ p *= i",
"+ p = p % mod"
] | false | 0.044291 | 0.067472 | 0.65643 | [
"s191228806",
"s487460740"
] |
u306950978 | p02588 | python | s004840149 | s166375050 | 421 | 384 | 99,244 | 99,220 | Accepted | Accepted | 8.79 | from decimal import Decimal
n = int(eval(input()))
a = []
r = {}
for i in range(n):
d = int(float(eval(input()))*10**9 + 0.1)
d2 = 0
d5 = 0
while True:
if d % 2 != 0 and d % 5 != 0:
break
if d % 2 == 0:
d //= 2
d2 += 1
if d % 5 ==... | from decimal import Decimal
n = int(eval(input()))
a = []
r = {}
for i in range(n):
d = int(float(eval(input()))*10**9+0.01)
d2 = 0
d5 = 0
while True:
if d % 2 != 0 and d % 5 != 0:
break
if d % 2 == 0:
d //= 2
d2 += 1
if d % 5 == ... | 28 | 28 | 647 | 646 | from decimal import Decimal
n = int(eval(input()))
a = []
r = {}
for i in range(n):
d = int(float(eval(input())) * 10**9 + 0.1)
d2 = 0
d5 = 0
while True:
if d % 2 != 0 and d % 5 != 0:
break
if d % 2 == 0:
d //= 2
d2 += 1
if d % 5 == 0:
... | from decimal import Decimal
n = int(eval(input()))
a = []
r = {}
for i in range(n):
d = int(float(eval(input())) * 10**9 + 0.01)
d2 = 0
d5 = 0
while True:
if d % 2 != 0 and d % 5 != 0:
break
if d % 2 == 0:
d //= 2
d2 += 1
if d % 5 == 0:
... | false | 0 | [
"- d = int(float(eval(input())) * 10**9 + 0.1)",
"+ d = int(float(eval(input())) * 10**9 + 0.01)"
] | false | 0.089026 | 0.048246 | 1.845267 | [
"s004840149",
"s166375050"
] |
u838644735 | p03283 | python | s317688440 | s805161684 | 897 | 513 | 124,144 | 57,248 | Accepted | Accepted | 42.81 | def main():
N, M, Q, *X = list(map(int, open(0).read().split()))
L = [0]*M
R = [0]*M
p = [0]*Q
q = [0]*Q
for i in range(M):
L[i], R[i] = X[2*i], X[2*i + 1]
for i in range(Q):
p[i], q[i] = X[2*M + 2*i], X[2*M + 2*i + 1]
# print(N, M, Q, L, R, p, q)
S = [[0]*... | def main():
N, M, Q, *X = list(map(int, open(0).read().split()))
L = [0]*M
R = [0]*M
p = [0]*Q
q = [0]*Q
for i in range(M):
L[i], R[i] = X[2*i], X[2*i + 1]
for i in range(Q):
p[i], q[i] = X[2*M + 2*i], X[2*M + 2*i + 1]
# print(N, M, Q, L, R, p, q)
S = [[0]*... | 32 | 37 | 861 | 1,026 | def main():
N, M, Q, *X = list(map(int, open(0).read().split()))
L = [0] * M
R = [0] * M
p = [0] * Q
q = [0] * Q
for i in range(M):
L[i], R[i] = X[2 * i], X[2 * i + 1]
for i in range(Q):
p[i], q[i] = X[2 * M + 2 * i], X[2 * M + 2 * i + 1]
# print(N, M, Q, L, R, p, q)
... | def main():
N, M, Q, *X = list(map(int, open(0).read().split()))
L = [0] * M
R = [0] * M
p = [0] * Q
q = [0] * Q
for i in range(M):
L[i], R[i] = X[2 * i], X[2 * i + 1]
for i in range(Q):
p[i], q[i] = X[2 * M + 2 * i], X[2 * M + 2 * i + 1]
# print(N, M, Q, L, R, p, q)
... | false | 13.513514 | [
"+ S3 = [[0] * (N + 1) for i in range(N + 1)]",
"+ for i in range(N + 1):",
"+ S3[0][i] = S2[0][i]",
"+ for j in range(1, N + 1):",
"+ S3[j][i] = S3[j - 1][i] + S2[j][i]",
"- ans = 0",
"- for j in range(pi, qi + 1):",
"- ans += S2[j][qi] - S2[j][... | false | 0.082949 | 0.042634 | 1.945588 | [
"s317688440",
"s805161684"
] |
u218834617 | p03341 | python | s234947557 | s051099691 | 287 | 113 | 33,000 | 9,744 | Accepted | Accepted | 60.63 | N=int(eval(input()))
S=eval(input())
l,r=[0]*N,[0]*N
for i in range(N-1):
l[i+1]+=l[i]+(S[i]=='W')
for i in range(N-1,0,-1):
r[i-1]+=r[i]+(S[i]=='E')
ans=3*10**5
for i in range(N):
ans=min(ans,l[i]+r[i])
print(ans)
| N=int(eval(input()))
S=eval(input())
ans=cur=S.count('E')
for c in S:
cur+=-1 if c=='E' else 1
ans=min(ans,cur)
print(ans)
| 11 | 7 | 225 | 125 | N = int(eval(input()))
S = eval(input())
l, r = [0] * N, [0] * N
for i in range(N - 1):
l[i + 1] += l[i] + (S[i] == "W")
for i in range(N - 1, 0, -1):
r[i - 1] += r[i] + (S[i] == "E")
ans = 3 * 10**5
for i in range(N):
ans = min(ans, l[i] + r[i])
print(ans)
| N = int(eval(input()))
S = eval(input())
ans = cur = S.count("E")
for c in S:
cur += -1 if c == "E" else 1
ans = min(ans, cur)
print(ans)
| false | 36.363636 | [
"-l, r = [0] * N, [0] * N",
"-for i in range(N - 1):",
"- l[i + 1] += l[i] + (S[i] == \"W\")",
"-for i in range(N - 1, 0, -1):",
"- r[i - 1] += r[i] + (S[i] == \"E\")",
"-ans = 3 * 10**5",
"-for i in range(N):",
"- ans = min(ans, l[i] + r[i])",
"+ans = cur = S.count(\"E\")",
"+for c in S:... | false | 0.037358 | 0.102702 | 0.363748 | [
"s234947557",
"s051099691"
] |
u529787332 | p03448 | python | s867099042 | s756714766 | 61 | 49 | 8,404 | 3,060 | Accepted | Accepted | 19.67 | cnt500 = int(eval(input()))
cnt100 = int(eval(input()))
cnt50 = int(eval(input()))
X = int(eval(input()))
all = []
for a in range(cnt500+1):
for b in range(cnt100+1):
for c in range(cnt50+1):
all.append(a*500 + b*100 + c*50)
print((all.count(X))) | cnt500 = int(eval(input()))
cnt100 = int(eval(input()))
cnt50 = int(eval(input()))
X = int(eval(input()))
result = 0
for a in range(cnt500+1):
for b in range(cnt100+1):
for c in range(cnt50+1):
if (a*500 + b*100 + c*50) == X:
result += 1
print(result) | 11 | 12 | 255 | 277 | cnt500 = int(eval(input()))
cnt100 = int(eval(input()))
cnt50 = int(eval(input()))
X = int(eval(input()))
all = []
for a in range(cnt500 + 1):
for b in range(cnt100 + 1):
for c in range(cnt50 + 1):
all.append(a * 500 + b * 100 + c * 50)
print((all.count(X)))
| cnt500 = int(eval(input()))
cnt100 = int(eval(input()))
cnt50 = int(eval(input()))
X = int(eval(input()))
result = 0
for a in range(cnt500 + 1):
for b in range(cnt100 + 1):
for c in range(cnt50 + 1):
if (a * 500 + b * 100 + c * 50) == X:
result += 1
print(result)
| false | 8.333333 | [
"-all = []",
"+result = 0",
"- all.append(a * 500 + b * 100 + c * 50)",
"-print((all.count(X)))",
"+ if (a * 500 + b * 100 + c * 50) == X:",
"+ result += 1",
"+print(result)"
] | false | 0.19868 | 0.086539 | 2.295845 | [
"s867099042",
"s756714766"
] |
u121921603 | p02937 | python | s921208146 | s278212899 | 291 | 262 | 47,344 | 45,936 | Accepted | Accepted | 9.97 | from string import ascii_lowercase
from bisect import bisect_right
s = eval(input())
t = eval(input())
p = {c: [] for c in s}
for x, c in enumerate(s):
p[c].append(x)
z = 0
l = -1
for c in t:
if c not in p:
print((-1))
break
x = bisect_right(p[c], l)
if x == len(p[c]):
... | #from string import ascii_lowercase
from bisect import bisect_right
s = eval(input())
t = eval(input())
p = {c: [] for c in s}
for x, c in enumerate(s):
p[c].append(x)
z = 0
l = -1
for c in t:
if c not in p:
print((-1))
break
x = bisect_right(p[c], l)
if x == len(p[c]):
... | 20 | 20 | 388 | 389 | from string import ascii_lowercase
from bisect import bisect_right
s = eval(input())
t = eval(input())
p = {c: [] for c in s}
for x, c in enumerate(s):
p[c].append(x)
z = 0
l = -1
for c in t:
if c not in p:
print((-1))
break
x = bisect_right(p[c], l)
if x == len(p[c]):
x = 0
... | # from string import ascii_lowercase
from bisect import bisect_right
s = eval(input())
t = eval(input())
p = {c: [] for c in s}
for x, c in enumerate(s):
p[c].append(x)
z = 0
l = -1
for c in t:
if c not in p:
print((-1))
break
x = bisect_right(p[c], l)
if x == len(p[c]):
x = 0
... | false | 0 | [
"-from string import ascii_lowercase",
"+# from string import ascii_lowercase"
] | false | 0.071287 | 0.193438 | 0.368525 | [
"s921208146",
"s278212899"
] |
u698868214 | p02861 | python | s971998015 | s032455365 | 38 | 30 | 13,788 | 9,012 | Accepted | Accepted | 21.05 | import itertools
n = int(eval(input()))
town = [tuple(map(int,input().split())) for _ in range(n)]
c_town = list(itertools.combinations(town,2))
lp = len(list(itertools.permutations(town)))
sum_road = 0
for i in c_town:
sum_road += ((i[0][0]-i[1][0])**2 + (i[0][1]-i[1][1])**2)**0.5
print((2*sum_road/n... | import math
from itertools import combinations
N = int(eval(input()))
xy = [tuple(map(int,input().split())) for _ in range(N)]
roots = list(combinations(list(range(0,N)),2))
sum_r = 0
for t, nt in roots:
sum_r += math.sqrt((xy[t][0] - xy[nt][0])**2 + (xy[t][1] - xy[nt][1])**2)
res = 2*sum_r/N
print... | 12 | 14 | 314 | 313 | import itertools
n = int(eval(input()))
town = [tuple(map(int, input().split())) for _ in range(n)]
c_town = list(itertools.combinations(town, 2))
lp = len(list(itertools.permutations(town)))
sum_road = 0
for i in c_town:
sum_road += ((i[0][0] - i[1][0]) ** 2 + (i[0][1] - i[1][1]) ** 2) ** 0.5
print((2 * sum_road ... | import math
from itertools import combinations
N = int(eval(input()))
xy = [tuple(map(int, input().split())) for _ in range(N)]
roots = list(combinations(list(range(0, N)), 2))
sum_r = 0
for t, nt in roots:
sum_r += math.sqrt((xy[t][0] - xy[nt][0]) ** 2 + (xy[t][1] - xy[nt][1]) ** 2)
res = 2 * sum_r / N
print(res)... | false | 14.285714 | [
"-import itertools",
"+import math",
"+from itertools import combinations",
"-n = int(eval(input()))",
"-town = [tuple(map(int, input().split())) for _ in range(n)]",
"-c_town = list(itertools.combinations(town, 2))",
"-lp = len(list(itertools.permutations(town)))",
"-sum_road = 0",
"-for i in c_tow... | false | 0.040129 | 0.088676 | 0.45253 | [
"s971998015",
"s032455365"
] |
u037430802 | p02733 | python | s579872758 | s620064566 | 538 | 455 | 47,452 | 45,660 | Accepted | Accepted | 15.43 |
H,W,K = list(map(int, input().split()))
S = [[int(i) for i in list(eval(input()))] for _ in range(H)]
accum_col = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
for j in range(W):
if i == 0:
accum_col[i][j] = S[i][j]
else:
accum_col[i][j] = acc... |
H,W,K = list(map(int, input().split()))
S = [[int(i) for i in list(eval(input()))] for i in range(H)]
# 縦の累積ホワイトチョコ数
whites_col = [[0 for _ in range(W)] for _ in range(H)]
for w in range(W):
for h in range(H):
if h == 0:
whites_col[h][w] = S[h][w]
else:
whi... | 58 | 64 | 1,577 | 1,383 | H, W, K = list(map(int, input().split()))
S = [[int(i) for i in list(eval(input()))] for _ in range(H)]
accum_col = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
for j in range(W):
if i == 0:
accum_col[i][j] = S[i][j]
else:
accum_col[i][j] = accum_col[i - 1][j]... | H, W, K = list(map(int, input().split()))
S = [[int(i) for i in list(eval(input()))] for i in range(H)]
# 縦の累積ホワイトチョコ数
whites_col = [[0 for _ in range(W)] for _ in range(H)]
for w in range(W):
for h in range(H):
if h == 0:
whites_col[h][w] = S[h][w]
else:
whites_col[h][w] = w... | false | 9.375 | [
"-S = [[int(i) for i in list(eval(input()))] for _ in range(H)]",
"-accum_col = [[0 for _ in range(W)] for _ in range(H)]",
"-for i in range(H):",
"- for j in range(W):",
"- if i == 0:",
"- accum_col[i][j] = S[i][j]",
"+S = [[int(i) for i in list(eval(input()))] for i in range(H)]",... | false | 0.044326 | 0.044167 | 1.003609 | [
"s579872758",
"s620064566"
] |
u965397031 | p02711 | python | s422982733 | s264584033 | 29 | 26 | 9,040 | 8,928 | Accepted | Accepted | 10.34 | n = eval(input())
if n[0] == '7' or n[1] == '7' or n[2] == '7':
ans = 'Yes'
else:
ans = 'No'
print(ans) | n = eval(input())
print(('Yes' if '7' in n else 'No')) | 7 | 2 | 112 | 47 | n = eval(input())
if n[0] == "7" or n[1] == "7" or n[2] == "7":
ans = "Yes"
else:
ans = "No"
print(ans)
| n = eval(input())
print(("Yes" if "7" in n else "No"))
| false | 71.428571 | [
"-if n[0] == \"7\" or n[1] == \"7\" or n[2] == \"7\":",
"- ans = \"Yes\"",
"-else:",
"- ans = \"No\"",
"-print(ans)",
"+print((\"Yes\" if \"7\" in n else \"No\"))"
] | false | 0.049039 | 0.047739 | 1.027233 | [
"s422982733",
"s264584033"
] |
u480138356 | p03546 | python | s113745105 | s801622381 | 414 | 289 | 25,992 | 17,732 | Accepted | Accepted | 30.19 | import sys
from scipy.sparse.csgraph import floyd_warshall as wf
input = sys.stdin.readline
def main():
H, W = list(map(int, input().split()))
link = [list(map(int, input().split())) for i in range(10)]
a = [list(map(int, input().split())) for i in range(H)]
link = wf(link)
ans = 0
for i ... | from scipy.sparse.csgraph import floyd_warshall as fw
def main():
h, w = list(map(int, input().split()))
link = [list(map(int, input().split())) for i in range(10)]
a = [list(map(int, input().split())) for i in range(h)]
link = fw(link)
ans = 0
for i in range(h):
for j in... | 20 | 19 | 467 | 459 | import sys
from scipy.sparse.csgraph import floyd_warshall as wf
input = sys.stdin.readline
def main():
H, W = list(map(int, input().split()))
link = [list(map(int, input().split())) for i in range(10)]
a = [list(map(int, input().split())) for i in range(H)]
link = wf(link)
ans = 0
for i in r... | from scipy.sparse.csgraph import floyd_warshall as fw
def main():
h, w = list(map(int, input().split()))
link = [list(map(int, input().split())) for i in range(10)]
a = [list(map(int, input().split())) for i in range(h)]
link = fw(link)
ans = 0
for i in range(h):
for j in range(w):
... | false | 5 | [
"-import sys",
"-from scipy.sparse.csgraph import floyd_warshall as wf",
"-",
"-input = sys.stdin.readline",
"+from scipy.sparse.csgraph import floyd_warshall as fw",
"- H, W = list(map(int, input().split()))",
"+ h, w = list(map(int, input().split()))",
"- a = [list(map(int, input().split())... | false | 0.399887 | 0.316547 | 1.263279 | [
"s113745105",
"s801622381"
] |
u695811449 | p03173 | python | s041575729 | s454457999 | 1,407 | 537 | 50,652 | 46,300 | Accepted | Accepted | 61.83 | N=int(eval(input()))
A=list(map(int,input().split()))
DPLIST=[[None]*N for i in range(N)]
for i in range(N):
DPLIST[i][i]=[0,A[i]]
for i in range(1,N):
for j in range(i,N):
#print(i,j)
ANS=float("inf")
slime=float("inf")
for k in range(j-i,j):
sc1,s... | N=int(eval(input()))
A=list(map(int,input().split()))
DPLIST=[[None]*N for i in range(N)]
for i in range(N):
DPLIST[i][i]=0
SUM=[0]
for i in range(N):
SUM.append(SUM[-1]+A[i])
for i in range(1,N):
for j in range(i,N):
ANS=float("inf")
for k in range(j-i,j):
... | 29 | 25 | 598 | 505 | N = int(eval(input()))
A = list(map(int, input().split()))
DPLIST = [[None] * N for i in range(N)]
for i in range(N):
DPLIST[i][i] = [0, A[i]]
for i in range(1, N):
for j in range(i, N):
# print(i,j)
ANS = float("inf")
slime = float("inf")
for k in range(j - i, j):
sc... | N = int(eval(input()))
A = list(map(int, input().split()))
DPLIST = [[None] * N for i in range(N)]
for i in range(N):
DPLIST[i][i] = 0
SUM = [0]
for i in range(N):
SUM.append(SUM[-1] + A[i])
for i in range(1, N):
for j in range(i, N):
ANS = float("inf")
for k in range(j - i, j):
... | false | 13.793103 | [
"- DPLIST[i][i] = [0, A[i]]",
"+ DPLIST[i][i] = 0",
"+SUM = [0]",
"+for i in range(N):",
"+ SUM.append(SUM[-1] + A[i])",
"- # print(i,j)",
"- slime = float(\"inf\")",
"- sc1, sl1 = DPLIST[j - i][k]",
"- sc2, sl2 = DPLIST[k + 1][j]",
"- if ANS... | false | 0.14208 | 0.13112 | 1.083589 | [
"s041575729",
"s454457999"
] |
u270144704 | p02786 | python | s093539650 | s590724682 | 177 | 161 | 38,384 | 38,256 | Accepted | Accepted | 9.04 | from math import floor
def kill(life):
if life in list(dp.keys()):
return dp[life]
if life == 1:
dp[life] = 1
return 1
elif life > 1:
dp[life] = kill(floor(life/2)) * 2 + 1
return dp[life]
h = int(eval(input()))
dp = {}
print((kill(h))) | def kill(life):
if life == 1:
return 1
elif life > 1:
return kill(life//2) * 2 + 1
h = int(eval(input()))
print((kill(h))) | 13 | 7 | 286 | 144 | from math import floor
def kill(life):
if life in list(dp.keys()):
return dp[life]
if life == 1:
dp[life] = 1
return 1
elif life > 1:
dp[life] = kill(floor(life / 2)) * 2 + 1
return dp[life]
h = int(eval(input()))
dp = {}
print((kill(h)))
| def kill(life):
if life == 1:
return 1
elif life > 1:
return kill(life // 2) * 2 + 1
h = int(eval(input()))
print((kill(h)))
| false | 46.153846 | [
"-from math import floor",
"-",
"-",
"- if life in list(dp.keys()):",
"- return dp[life]",
"- dp[life] = 1",
"- dp[life] = kill(floor(life / 2)) * 2 + 1",
"- return dp[life]",
"+ return kill(life // 2) * 2 + 1",
"-dp = {}"
] | false | 0.04319 | 0.04216 | 1.024437 | [
"s093539650",
"s590724682"
] |
u529386725 | p01136 | python | s629434751 | s266187181 | 2,810 | 2,240 | 13,912 | 7,976 | Accepted | Accepted | 20.28 | MAX_N = 50
MAX_DAY = 30
def solve(n, f):
dp = [[set() for j in range(n)] for i in range(MAX_DAY + 1)]
for i in range(n):
dp[0][i].add(i)
for d in range(1, MAX_DAY + 1):
# for line in dp[:5]:
# print(line)
for i in range(n):
dp[d][i] |= dp[d -... | MAX_N = 50
MAX_DAY = 30
def solve(n, f):
dp = [{i} for i in range(n)]
for d in range(1, MAX_DAY + 1):
for i in range(n):
for j in range(n):
if f[d][i] and f[d][j]:
dp[i] |= dp[j]
if len(dp[i]) == n:
return d
... | 41 | 31 | 881 | 640 | MAX_N = 50
MAX_DAY = 30
def solve(n, f):
dp = [[set() for j in range(n)] for i in range(MAX_DAY + 1)]
for i in range(n):
dp[0][i].add(i)
for d in range(1, MAX_DAY + 1):
# for line in dp[:5]:
# print(line)
for i in range(n):
dp[d][i] |= dp[d - 1][i]
... | MAX_N = 50
MAX_DAY = 30
def solve(n, f):
dp = [{i} for i in range(n)]
for d in range(1, MAX_DAY + 1):
for i in range(n):
for j in range(n):
if f[d][i] and f[d][j]:
dp[i] |= dp[j]
if len(dp[i]) == n:
return d
return -1
##... | false | 24.390244 | [
"- dp = [[set() for j in range(n)] for i in range(MAX_DAY + 1)]",
"- for i in range(n):",
"- dp[0][i].add(i)",
"+ dp = [{i} for i in range(n)]",
"- # for line in dp[:5]:",
"- # print(line)",
"- dp[d][i] |= dp[d - 1][i]",
"- dp[d][i] |= dp... | false | 0.039538 | 0.038722 | 1.021075 | [
"s629434751",
"s266187181"
] |
u371132735 | p02813 | python | s661324351 | s622727007 | 135 | 29 | 10,868 | 3,064 | Accepted | Accepted | 78.52 |
import itertools
N = int(eval(input()))
a = list(itertools.permutations(list(range(1, N+1))))
s = []
for i in a:
ans = ""
for j in i:
ans+=str(j)
s.append(ans)
P = "".join(list(input().split()))
Q = "".join(list(input().split()))
ans = abs((s.index(P)+1)-(s.index(Q)+1))
print(ans)
| # abc150_c.py
'''
全パターン作ってソートで順番みる
'''
import itertools
N = int(eval(input()))
P = tuple(list(map(int,input().split())))
Q = tuple(list(map(int,input().split())))
l = [i+1 for i in range(N)]
target = itertools.permutations(l)
cnt=0
pcnt = 0
qcnt = 0
for i in target:
cnt += 1
if i == P:
... | 16 | 22 | 298 | 384 | import itertools
N = int(eval(input()))
a = list(itertools.permutations(list(range(1, N + 1))))
s = []
for i in a:
ans = ""
for j in i:
ans += str(j)
s.append(ans)
P = "".join(list(input().split()))
Q = "".join(list(input().split()))
ans = abs((s.index(P) + 1) - (s.index(Q) + 1))
print(ans)
| # abc150_c.py
"""
全パターン作ってソートで順番みる
"""
import itertools
N = int(eval(input()))
P = tuple(list(map(int, input().split())))
Q = tuple(list(map(int, input().split())))
l = [i + 1 for i in range(N)]
target = itertools.permutations(l)
cnt = 0
pcnt = 0
qcnt = 0
for i in target:
cnt += 1
if i == P:
pcnt = cnt... | false | 27.272727 | [
"+# abc150_c.py",
"+\"\"\"",
"+全パターン作ってソートで順番みる",
"+\"\"\"",
"-a = list(itertools.permutations(list(range(1, N + 1))))",
"-s = []",
"-for i in a:",
"- ans = \"\"",
"- for j in i:",
"- ans += str(j)",
"- s.append(ans)",
"-P = \"\".join(list(input().split()))",
"-Q = \"\".join(... | false | 0.060016 | 0.041097 | 1.460348 | [
"s661324351",
"s622727007"
] |
u526603504 | p02913 | python | s841313699 | s595576357 | 831 | 75 | 247,176 | 6,516 | Accepted | Accepted | 90.97 | N = int(eval(input()))
S = eval(input())
dp = [[0 for _ in range(N)] for _ in range(N)]
ans = 0
for i in range(N):
for j in range(i + 1, N):
if S[i] == S[j]:
tmp = 1
if i > 0:
tmp += dp[i - 1][j - 1]
if j - i < tmp:
continue
... | N = int(eval(input()))
S = eval(input())
F = [1] * (N//2 + 2)
for i in range(1, len(F)):
F[i] = F[i] * 26
def check(l):
D = set()
for i in range(N - 2 * l + 1):
D.add(S[i:i+l])
if S[i+l:i+2*l] in D:
return True
OK = 0
NG = N // 2 + 1
while abs(OK - NG) > 1:
... | 17 | 25 | 381 | 412 | N = int(eval(input()))
S = eval(input())
dp = [[0 for _ in range(N)] for _ in range(N)]
ans = 0
for i in range(N):
for j in range(i + 1, N):
if S[i] == S[j]:
tmp = 1
if i > 0:
tmp += dp[i - 1][j - 1]
if j - i < tmp:
continue
dp[... | N = int(eval(input()))
S = eval(input())
F = [1] * (N // 2 + 2)
for i in range(1, len(F)):
F[i] = F[i] * 26
def check(l):
D = set()
for i in range(N - 2 * l + 1):
D.add(S[i : i + l])
if S[i + l : i + 2 * l] in D:
return True
OK = 0
NG = N // 2 + 1
while abs(OK - NG) > 1:
... | false | 32 | [
"-dp = [[0 for _ in range(N)] for _ in range(N)]",
"-ans = 0",
"-for i in range(N):",
"- for j in range(i + 1, N):",
"- if S[i] == S[j]:",
"- tmp = 1",
"- if i > 0:",
"- tmp += dp[i - 1][j - 1]",
"- if j - i < tmp:",
"- conti... | false | 0.065505 | 0.037526 | 1.745588 | [
"s841313699",
"s595576357"
] |
u729133443 | p03280 | python | s477821271 | s135872487 | 163 | 25 | 38,256 | 9,100 | Accepted | Accepted | 84.66 | print((eval('~-'+'*~-'.join(input().split())))) | a,b=list(map(int,input().split()))
print((~-a*~-b)) | 1 | 2 | 45 | 44 | print((eval("~-" + "*~-".join(input().split()))))
| a, b = list(map(int, input().split()))
print((~-a * ~-b))
| false | 50 | [
"-print((eval(\"~-\" + \"*~-\".join(input().split()))))",
"+a, b = list(map(int, input().split()))",
"+print((~-a * ~-b))"
] | false | 0.092527 | 0.037354 | 2.477026 | [
"s477821271",
"s135872487"
] |
u606045429 | p03063 | python | s611228932 | s967637923 | 254 | 108 | 12,776 | 3,500 | Accepted | Accepted | 57.48 | N = int(eval(input()))
S = eval(input())
white = [0] * (N + 1)
black = [0] * (N + 1)
for i, si in enumerate(S):
black[i + 1] = black[i]
white[i + 1] = white[i]
if si == "#":
black[i + 1] += 1
if si == ".":
white[i + 1] += 1
mi = 10 ** 10
for i in range(N + 1):
b = bl... | N, S = int(eval(input())), eval(input())
b, w = 0, S.count('.')
ans = b + w
for si in S:
if si == "#":
b += 1
if si == ".":
w -= 1
ans = min(ans, b + w)
print(ans)
| 19 | 10 | 380 | 189 | N = int(eval(input()))
S = eval(input())
white = [0] * (N + 1)
black = [0] * (N + 1)
for i, si in enumerate(S):
black[i + 1] = black[i]
white[i + 1] = white[i]
if si == "#":
black[i + 1] += 1
if si == ".":
white[i + 1] += 1
mi = 10**10
for i in range(N + 1):
b = black[i]
w = whit... | N, S = int(eval(input())), eval(input())
b, w = 0, S.count(".")
ans = b + w
for si in S:
if si == "#":
b += 1
if si == ".":
w -= 1
ans = min(ans, b + w)
print(ans)
| false | 47.368421 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-white = [0] * (N + 1)",
"-black = [0] * (N + 1)",
"-for i, si in enumerate(S):",
"- black[i + 1] = black[i]",
"- white[i + 1] = white[i]",
"+N, S = int(eval(input())), eval(input())",
"+b, w = 0, S.count(\".\")",
"+ans = b + w",
"+for si i... | false | 0.039742 | 0.038751 | 1.025583 | [
"s611228932",
"s967637923"
] |
u617515020 | p03557 | python | s093805620 | s342890351 | 327 | 251 | 23,360 | 29,388 | Accepted | Accepted | 23.24 | import bisect
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
cnt = 0
for j in range(N):
i = bisect.bisect_left(A, B[j])
k = bisect.bisect_right(C, B[j])
cnt += i * (N - k)
print(cnt) | from bisect import bisect,bisect_left
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())))
ans=0
for b in B:
i=bisect_left(A,b)
j=bisect(C,b)
ans+=i*(N-j)
print(ans) | 16 | 11 | 310 | 266 | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
cnt = 0
for j in range(N):
i = bisect.bisect_left(A, B[j])
k = bisect.bisect_right(C, B[j])
cnt += i * (N - k)
print(cnt)
| from bisect import bisect, bisect_left
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())))
ans = 0
for b in B:
i = bisect_left(A, b)
j = bisect(C, b)
ans += i * (N - j)
print(ans)
| false | 31.25 | [
"-import bisect",
"+from bisect import bisect, bisect_left",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-C = list(map(int, input().split()))",
"-A.sort()",
"-B.sort()",
"-C.sort()",
"-cnt = 0",
"-for j in range(N):",
"- i = bisect.bisect_left(A, B[j])",
... | false | 0.043866 | 0.117362 | 0.373765 | [
"s093805620",
"s342890351"
] |
u828847847 | p03504 | python | s227968902 | s175992354 | 1,123 | 1,006 | 38,260 | 41,732 | Accepted | Accepted | 10.42 | n, c = list(map(int, input().split()))
r = [[0 for i in range(c)] for j in range(100000)]
for dummy in range(n):
s, t, c = list(map(int, input().split()))
for j in range(s - 1, t):
r[j][c - 1] = 1
ans = 0
for i in range(100000):
if sum(r[i]) > ans:
ans = sum(r[i])
print(a... | n, c = list(map(int,input().split()))
arr = [[0 for i in range(c)] for j in range(10**5+1)]
for i in range(n):
s,t,ch = list(map(int,input().split()))
s -= 1
ch -= 1
for i in range(s,t):
arr[i][ch] = 1
ans = 0
for i in range(10**5+1):
ans = max(ans,sum(arr[i]))
print(ans) | 14 | 17 | 311 | 295 | n, c = list(map(int, input().split()))
r = [[0 for i in range(c)] for j in range(100000)]
for dummy in range(n):
s, t, c = list(map(int, input().split()))
for j in range(s - 1, t):
r[j][c - 1] = 1
ans = 0
for i in range(100000):
if sum(r[i]) > ans:
ans = sum(r[i])
print(ans)
| n, c = list(map(int, input().split()))
arr = [[0 for i in range(c)] for j in range(10**5 + 1)]
for i in range(n):
s, t, ch = list(map(int, input().split()))
s -= 1
ch -= 1
for i in range(s, t):
arr[i][ch] = 1
ans = 0
for i in range(10**5 + 1):
ans = max(ans, sum(arr[i]))
print(ans)
| false | 17.647059 | [
"-r = [[0 for i in range(c)] for j in range(100000)]",
"-for dummy in range(n):",
"- s, t, c = list(map(int, input().split()))",
"- for j in range(s - 1, t):",
"- r[j][c - 1] = 1",
"+arr = [[0 for i in range(c)] for j in range(10**5 + 1)]",
"+for i in range(n):",
"+ s, t, ch = list(map... | false | 0.263796 | 0.191422 | 1.378083 | [
"s227968902",
"s175992354"
] |
u638456847 | p02624 | python | s544764223 | s843978332 | 1,623 | 587 | 9,172 | 109,172 | Accepted | Accepted | 63.83 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main(N):
ans = 0
for n in range(1,N+1):
ans += (N // n) * n * (1 + (N // n)) // 2
print(ans)
if __name__ == "__main__":
N = int(readline())
main(N)
| from numba import njit
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
@njit
def main(N):
ans = 0
for n in range(1,N+1):
ans += (N // n) * n * (1 + (N // n)) // 2
print(ans)
if __name__ == "__main__":
N = int(readline())
m... | 17 | 19 | 296 | 327 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main(N):
ans = 0
for n in range(1, N + 1):
ans += (N // n) * n * (1 + (N // n)) // 2
print(ans)
if __name__ == "__main__":
N = int(readline())
main(N)
| from numba import njit
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
@njit
def main(N):
ans = 0
for n in range(1, N + 1):
ans += (N // n) * n * (1 + (N // n)) // 2
print(ans)
if __name__ == "__main__":
N = int(readline())
main(N)
| false | 10.526316 | [
"+from numba import njit",
"+@njit"
] | false | 0.549195 | 0.077759 | 7.062766 | [
"s544764223",
"s843978332"
] |
u573754721 | p02743 | python | s399104468 | s535996187 | 294 | 253 | 59,756 | 59,628 | Accepted | Accepted | 13.95 | from decimal import Decimal
a,b,c=list(map(int,input().split()))
if Decimal(a)**Decimal('0.5')+Decimal(b)**Decimal('0.5')<Decimal(c)**Decimal('0.5'):
print('Yes')
else:
print('No')
| import decimal
a,b,c=list(map(int,input().split()))
if decimal.Decimal(a)**decimal.Decimal('0.5')+decimal.Decimal(b)**decimal.Decimal('0.5')<decimal.Decimal(c)**decimal.Decimal('0.5'):
print('Yes')
else:
print('No')
| 6 | 7 | 188 | 229 | from decimal import Decimal
a, b, c = list(map(int, input().split()))
if Decimal(a) ** Decimal("0.5") + Decimal(b) ** Decimal("0.5") < Decimal(c) ** Decimal(
"0.5"
):
print("Yes")
else:
print("No")
| import decimal
a, b, c = list(map(int, input().split()))
if decimal.Decimal(a) ** decimal.Decimal("0.5") + decimal.Decimal(b) ** decimal.Decimal(
"0.5"
) < decimal.Decimal(c) ** decimal.Decimal("0.5"):
print("Yes")
else:
print("No")
| false | 14.285714 | [
"-from decimal import Decimal",
"+import decimal",
"-if Decimal(a) ** Decimal(\"0.5\") + Decimal(b) ** Decimal(\"0.5\") < Decimal(c) ** Decimal(",
"+if decimal.Decimal(a) ** decimal.Decimal(\"0.5\") + decimal.Decimal(b) ** decimal.Decimal(",
"-):",
"+) < decimal.Decimal(c) ** decimal.Decimal(\"0.5\"):"
] | false | 0.085267 | 0.043982 | 1.93868 | [
"s399104468",
"s535996187"
] |
u731368968 | p03061 | python | s057016039 | s860412554 | 249 | 225 | 14,400 | 14,080 | Accepted | Accepted | 9.64 | n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd
tl = [a[0]]
for i in range(1, n):
tl.append(gcd(tl[i - 1], a[i]))
tr = [a[n - 1]]
for i in range(1, n):
tr.append(gcd(tr[i - 1], a[n - 1 - i]))
tr.reverse()
ans = 1
for i in range(n):
tmp = 1
l = tl... | n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd
l = [a[0]]
for i in range(1, n):
l.append(gcd(l[i - 1], a[i]))
r = [a[n - 1]]
for i in range(1, n):
r.append(gcd(r[i - 1], a[n - 1 - i]))
r.reverse()
from functools import reduce
print((reduce(lambda x,y:max(x,... | 21 | 15 | 436 | 395 | n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd
tl = [a[0]]
for i in range(1, n):
tl.append(gcd(tl[i - 1], a[i]))
tr = [a[n - 1]]
for i in range(1, n):
tr.append(gcd(tr[i - 1], a[n - 1 - i]))
tr.reverse()
ans = 1
for i in range(n):
tmp = 1
l = tl[i - 1] if 0 < i els... | n = int(eval(input()))
a = list(map(int, input().split()))
from fractions import gcd
l = [a[0]]
for i in range(1, n):
l.append(gcd(l[i - 1], a[i]))
r = [a[n - 1]]
for i in range(1, n):
r.append(gcd(r[i - 1], a[n - 1 - i]))
r.reverse()
from functools import reduce
print(
(
reduce(
lambd... | false | 28.571429 | [
"-tl = [a[0]]",
"+l = [a[0]]",
"- tl.append(gcd(tl[i - 1], a[i]))",
"-tr = [a[n - 1]]",
"+ l.append(gcd(l[i - 1], a[i]))",
"+r = [a[n - 1]]",
"- tr.append(gcd(tr[i - 1], a[n - 1 - i]))",
"-tr.reverse()",
"-ans = 1",
"-for i in range(n):",
"- tmp = 1",
"- l = tl[i - 1] if 0 < i e... | false | 0.046837 | 0.04716 | 0.993151 | [
"s057016039",
"s860412554"
] |
u016881126 | p02603 | python | s277252162 | s992656096 | 32 | 28 | 9,304 | 9,172 | Accepted | Accepted | 12.5 | #!/usr/bin/env python3
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
N = int(eval(input()))
A = list(map(int, input().split()))
# どこで反転するかを記録する
pre = [0] * N
pre_index = 0
old_a = A[0]... | #!/usr/bin/env python3
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
N = int(eval(input()))
A = list(map(int, input().split()))
shojikin = 1000
stock = 0
for i in range(N):
if stoc... | 70 | 24 | 1,629 | 529 | #!/usr/bin/env python3
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10**7)
INF = float("inf")
N = int(eval(input()))
A = list(map(int, input().split()))
# どこで反転するかを記録する
pre = [0] * N
pre_index = 0
old_a = A[0]
if A[0] > A[1]:
... | #!/usr/bin/env python3
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10**7)
INF = float("inf")
N = int(eval(input()))
A = list(map(int, input().split()))
shojikin = 1000
stock = 0
for i in range(N):
if stock:
shojik... | false | 65.714286 | [
"-# どこで反転するかを記録する",
"-pre = [0] * N",
"-pre_index = 0",
"-old_a = A[0]",
"-if A[0] > A[1]:",
"- old_coef = -1",
"-elif A[0] < A[1]:",
"- old_coef = 1",
"-else:",
"- old_coef = 0",
"-for i in range(1, N):",
"- if A[i] > old_a:",
"- coef = 1",
"- elif A[i] < old_a:",
... | false | 0.042075 | 0.041367 | 1.017115 | [
"s277252162",
"s992656096"
] |
u353919145 | p03261 | python | s096239677 | s404373332 | 19 | 17 | 3,064 | 2,940 | Accepted | Accepted | 10.53 | x=int(eval(input()))
words=[]
found=0
word_1=''
word_2=''
for i in range(x):
words.append(eval(input()))
for j in range(x-1):
for k in range(j+1,x):
if words[j]==words[k]:
found=-1
for c in range(x-1):
word_1=words[c]
word_2=words[c+1]
if word_1[-1]!=word_2[0]:
... | def taka():
n = int(eval(input()))
listofwords =[]
for i in range(n):
strTEMP = eval(input())
if i == 0:
listofwords.append(strTEMP)
continue
else:
if strTEMP in listofwords:
return "No"
else:
... | 21 | 21 | 380 | 516 | x = int(eval(input()))
words = []
found = 0
word_1 = ""
word_2 = ""
for i in range(x):
words.append(eval(input()))
for j in range(x - 1):
for k in range(j + 1, x):
if words[j] == words[k]:
found = -1
for c in range(x - 1):
word_1 = words[c]
word_2 = words[c + 1]
if word_1[-1] != ... | def taka():
n = int(eval(input()))
listofwords = []
for i in range(n):
strTEMP = eval(input())
if i == 0:
listofwords.append(strTEMP)
continue
else:
if strTEMP in listofwords:
return "No"
else:
cmp = list... | false | 0 | [
"-x = int(eval(input()))",
"-words = []",
"-found = 0",
"-word_1 = \"\"",
"-word_2 = \"\"",
"-for i in range(x):",
"- words.append(eval(input()))",
"-for j in range(x - 1):",
"- for k in range(j + 1, x):",
"- if words[j] == words[k]:",
"- found = -1",
"-for c in range(x... | false | 0.045881 | 0.045225 | 1.014508 | [
"s096239677",
"s404373332"
] |
u756388720 | p02937 | python | s209128961 | s536419178 | 200 | 157 | 133,044 | 17,896 | Accepted | Accepted | 21.5 | def next(str):
N = len(str)
nxt = [[N] * 26 for i in range(N + 1)]
for i in range(N - 1, -1, -1):
for j in range(26):
nxt[i][j] = nxt[i + 1][j]
nxt[i][ord(str[i]) - ord('a')] = i
return nxt
def solve():
S = eval(input())
T = eval(input())
N = len(S)
... | from bisect import bisect
def ctoi(c):
return ord(c) - ord('a')
def solve():
S = eval(input())
T = eval(input())
N = len(S)
idx = [[] for i in range(26)]
for i in range(2 * N):
idx[ctoi(S[i % N])].append(i)
ans = -1
for c in T:
if not idx[ctoi(c)]:
... | 26 | 19 | 569 | 430 | def next(str):
N = len(str)
nxt = [[N] * 26 for i in range(N + 1)]
for i in range(N - 1, -1, -1):
for j in range(26):
nxt[i][j] = nxt[i + 1][j]
nxt[i][ord(str[i]) - ord("a")] = i
return nxt
def solve():
S = eval(input())
T = eval(input())
N = len(S)
M = 2 * ... | from bisect import bisect
def ctoi(c):
return ord(c) - ord("a")
def solve():
S = eval(input())
T = eval(input())
N = len(S)
idx = [[] for i in range(26)]
for i in range(2 * N):
idx[ctoi(S[i % N])].append(i)
ans = -1
for c in T:
if not idx[ctoi(c)]:
return ... | false | 26.923077 | [
"-def next(str):",
"- N = len(str)",
"- nxt = [[N] * 26 for i in range(N + 1)]",
"- for i in range(N - 1, -1, -1):",
"- for j in range(26):",
"- nxt[i][j] = nxt[i + 1][j]",
"- nxt[i][ord(str[i]) - ord(\"a\")] = i",
"- return nxt",
"+from bisect import bisect",
... | false | 0.03734 | 0.126681 | 0.294755 | [
"s209128961",
"s536419178"
] |
u596276291 | p03625 | python | s826265601 | s621066393 | 146 | 81 | 22,436 | 18,700 | Accepted | Accepted | 44.52 | from collections import defaultdict, Counter
from itertools import product, groupby, count
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10
def main():
N = int(eval(input()))
A_list = list(map(int, input().split()))
c = Counte... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.se... | 24 | 39 | 601 | 1,088 | from collections import defaultdict, Counter
from itertools import product, groupby, count
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10**10
def main():
N = int(eval(input()))
A_list = list(map(int, input().split()))
c = Counter(A_list)
... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecurs... | false | 38.461538 | [
"-from itertools import product, groupby, count",
"-from math import pi",
"+from itertools import product, groupby, count, permutations, combinations",
"+from math import pi, sqrt",
"+from string import ascii_lowercase",
"+from functools import lru_cache",
"+import sys",
"-INF = 10**10",
"+sys.setre... | false | 0.046736 | 0.159157 | 0.293646 | [
"s826265601",
"s621066393"
] |
u864197622 | p03090 | python | s383318112 | s617397716 | 233 | 24 | 43,248 | 3,612 | Accepted | Accepted | 89.7 | N = int(eval(input()))
c = 0
ANS = []
for i in range(N):
for j in range(i+1, N):
if i+j+2 != (N if N % 2 else N+1):
c += 1
ANS.append((i+1, j+1))
print(c)
for ans in ANS:
print((*ans)) | N = int(eval(input()))
if N & 1:
print(((N-1)**2//2))
for i in range(N):
for j in range(i+1, N):
if i + j == N - 2 and j < N - 1: continue
print((i+1, j+1))
else:
print((N*N//2-N))
for i in range(N):
for j in range(i+1, N):
if i + j == N - 1... | 14 | 13 | 232 | 348 | N = int(eval(input()))
c = 0
ANS = []
for i in range(N):
for j in range(i + 1, N):
if i + j + 2 != (N if N % 2 else N + 1):
c += 1
ANS.append((i + 1, j + 1))
print(c)
for ans in ANS:
print((*ans))
| N = int(eval(input()))
if N & 1:
print(((N - 1) ** 2 // 2))
for i in range(N):
for j in range(i + 1, N):
if i + j == N - 2 and j < N - 1:
continue
print((i + 1, j + 1))
else:
print((N * N // 2 - N))
for i in range(N):
for j in range(i + 1, N):
... | false | 7.142857 | [
"-c = 0",
"-ANS = []",
"-for i in range(N):",
"- for j in range(i + 1, N):",
"- if i + j + 2 != (N if N % 2 else N + 1):",
"- c += 1",
"- ANS.append((i + 1, j + 1))",
"-print(c)",
"-for ans in ANS:",
"- print((*ans))",
"+if N & 1:",
"+ print(((N - 1) ** 2 ... | false | 0.124548 | 0.036546 | 3.40797 | [
"s383318112",
"s617397716"
] |
u312025627 | p02741 | python | s365758454 | s394041193 | 165 | 18 | 38,384 | 3,060 | Accepted | Accepted | 89.09 | def main():
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
N = int(eval(input()))
print((A[N-1]))
if __name__ == '__main__':
main()
| def main():
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(eval(input()))
print((A[K-1]))
if __name__ == '__main__':
main()
| 9 | 9 | 216 | 216 | def main():
A = [
1,
1,
1,
2,
1,
2,
1,
5,
2,
2,
1,
5,
1,
2,
1,
14,
1,
5,
1,
5,
2,
2,
1,
15,
2,
2,
5,... | def main():
A = [
1,
1,
1,
2,
1,
2,
1,
5,
2,
2,
1,
5,
1,
2,
1,
14,
1,
5,
1,
5,
2,
2,
1,
15,
2,
2,
5,... | false | 0 | [
"- N = int(eval(input()))",
"- print((A[N - 1]))",
"+ K = int(eval(input()))",
"+ print((A[K - 1]))"
] | false | 0.05066 | 0.035193 | 1.439493 | [
"s365758454",
"s394041193"
] |
u627234757 | p02613 | python | s742474594 | s122784990 | 238 | 137 | 9,028 | 16,144 | Accepted | Accepted | 42.44 | n = int(eval(input()))
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
s = eval(input())
if s == 'AC':
ac += 1
elif s == 'WA':
wa += 1
elif s== 'TLE':
tle += 1
elif s== 'RE':
re += 1
print(('AC x '+str(ac)))
print(('WA x '+str(wa)))
print(('TLE x '+str(tle)))
print(('RE x ... | n=int(eval(input()))
s=[eval(input())for _ in range(n)]
print(("AC x",s.count("AC")))
print(("WA x",s.count("WA")))
print(("TLE x",s.count("TLE")))
print(("RE x",s.count("RE")))
| 19 | 6 | 312 | 163 | n = int(eval(input()))
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
s = eval(input())
if s == "AC":
ac += 1
elif s == "WA":
wa += 1
elif s == "TLE":
tle += 1
elif s == "RE":
re += 1
print(("AC x " + str(ac)))
print(("WA x " + str(wa)))
print(("TLE x " + str(tle)))
... | n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
print(("AC x", s.count("AC")))
print(("WA x", s.count("WA")))
print(("TLE x", s.count("TLE")))
print(("RE x", s.count("RE")))
| false | 68.421053 | [
"-ac = 0",
"-wa = 0",
"-tle = 0",
"-re = 0",
"-for i in range(n):",
"- s = eval(input())",
"- if s == \"AC\":",
"- ac += 1",
"- elif s == \"WA\":",
"- wa += 1",
"- elif s == \"TLE\":",
"- tle += 1",
"- elif s == \"RE\":",
"- re += 1",
"-print((\... | false | 0.082068 | 0.044029 | 1.863965 | [
"s742474594",
"s122784990"
] |
u623687794 | p03108 | python | s103665124 | s368712653 | 996 | 832 | 48,204 | 48,144 | Accepted | Accepted | 16.47 | import sys
sys.setrecursionlimit(100003)
n,m=list(map(int,input().split()))
bridges=[list(map(int,input().split())) for i in range(m)][::-1]
inconv=[n*(n-1)//2]*m
class UnionFind(object):
def __init__(self, N):
self.parent = [i for i in range(N)]
self.size = [1 for i in range(N)]
def... | import sys
sys.setrecursionlimit(1000003)
input=sys.stdin.readline
n,m=list(map(int,input().split()))
bridges=[list(map(int,input().split())) for i in range(m)][::-1]
inconv=[n*(n-1)//2]*m
class UnionFind(object):
def __init__(self, N):
self.parent = [i for i in range(N)]
self.size = [1 for... | 41 | 42 | 1,181 | 1,209 | import sys
sys.setrecursionlimit(100003)
n, m = list(map(int, input().split()))
bridges = [list(map(int, input().split())) for i in range(m)][::-1]
inconv = [n * (n - 1) // 2] * m
class UnionFind(object):
def __init__(self, N):
self.parent = [i for i in range(N)]
self.size = [1 for i in range(N)]... | import sys
sys.setrecursionlimit(1000003)
input = sys.stdin.readline
n, m = list(map(int, input().split()))
bridges = [list(map(int, input().split())) for i in range(m)][::-1]
inconv = [n * (n - 1) // 2] * m
class UnionFind(object):
def __init__(self, N):
self.parent = [i for i in range(N)]
self.... | false | 2.380952 | [
"-sys.setrecursionlimit(100003)",
"+sys.setrecursionlimit(1000003)",
"+input = sys.stdin.readline"
] | false | 0.057513 | 0.064223 | 0.895526 | [
"s103665124",
"s368712653"
] |
u815878613 | p02984 | python | s433616740 | s639705084 | 1,658 | 114 | 20,408 | 20,416 | Accepted | Accepted | 93.12 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0 for _ in range(N)]
sign = 1
for a in A:
ans[0] += sign * a
sign *= -1
for i in range(1, N):
ans[i] = 2 * A[0] - ans[i - 1]
t = A.pop(0)
A.append(t)
print((*ans))
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0 for _ in range(N)]
sign = 1
for a in A:
ans[0] += sign * a
sign *= -1
for i in range(1, N):
ans[i] = 2 * A[i-1] - ans[i - 1]
print((*ans))
"""
ダム1: 2( a1 - a2 + a3 )
ダム2: 2( a2 - a3 + a1 )
ダム3: 2( a3 - a1 + a2 )
""... | 18 | 21 | 265 | 314 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0 for _ in range(N)]
sign = 1
for a in A:
ans[0] += sign * a
sign *= -1
for i in range(1, N):
ans[i] = 2 * A[0] - ans[i - 1]
t = A.pop(0)
A.append(t)
print((*ans))
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = [0 for _ in range(N)]
sign = 1
for a in A:
ans[0] += sign * a
sign *= -1
for i in range(1, N):
ans[i] = 2 * A[i - 1] - ans[i - 1]
print((*ans))
"""
ダム1: 2( a1 - a2 + a3 )
ダム2: 2( a2 - a3 + a1 )
ダム3: 2( a3 - a1 + a2 )
"""
| false | 14.285714 | [
"- ans[i] = 2 * A[0] - ans[i - 1]",
"- t = A.pop(0)",
"- A.append(t)",
"+ ans[i] = 2 * A[i - 1] - ans[i - 1]",
"+\"\"\"",
"+ダム1: 2( a1 - a2 + a3 )",
"+ダム2: 2( a2 - a3 + a1 )",
"+ダム3: 2( a3 - a1 + a2 )",
"+\"\"\""
] | false | 0.145548 | 0.034813 | 4.18078 | [
"s433616740",
"s639705084"
] |
u858748695 | p03037 | python | s529773364 | s673611491 | 419 | 229 | 7,668 | 9,140 | Accepted | Accepted | 45.35 | #!/usr/bin/env python3
n, m = list(map(int, input().split()))
li = [0] * (n + 1)
for _ in range(m):
l, r = [int(x) - 1 for x in input().split()]
li[0] += 1
li[l] -= 1
li[r + 1] += 1
li[n] -= 1
for i in range(n):
li[i + 1] += li[i]
print((sum(x <= 0 for x in li[:-1])))
| n, m = list(map(int, input().split()))
ml, mr = 0, n
for i in range(m):
l, r = [int(x) - 1 for x in input().split()]
ml = max(ml, l)
mr = min(mr, r)
print((max(0, mr - ml + 1)))
| 12 | 7 | 301 | 193 | #!/usr/bin/env python3
n, m = list(map(int, input().split()))
li = [0] * (n + 1)
for _ in range(m):
l, r = [int(x) - 1 for x in input().split()]
li[0] += 1
li[l] -= 1
li[r + 1] += 1
li[n] -= 1
for i in range(n):
li[i + 1] += li[i]
print((sum(x <= 0 for x in li[:-1])))
| n, m = list(map(int, input().split()))
ml, mr = 0, n
for i in range(m):
l, r = [int(x) - 1 for x in input().split()]
ml = max(ml, l)
mr = min(mr, r)
print((max(0, mr - ml + 1)))
| false | 41.666667 | [
"-#!/usr/bin/env python3",
"-li = [0] * (n + 1)",
"-for _ in range(m):",
"+ml, mr = 0, n",
"+for i in range(m):",
"- li[0] += 1",
"- li[l] -= 1",
"- li[r + 1] += 1",
"- li[n] -= 1",
"-for i in range(n):",
"- li[i + 1] += li[i]",
"-print((sum(x <= 0 for x in li[:-1])))",
"+ ... | false | 0.079946 | 0.046216 | 1.729821 | [
"s529773364",
"s673611491"
] |
u737758066 | p03011 | python | s839176064 | s756712432 | 170 | 17 | 38,256 | 3,060 | Accepted | Accepted | 90 | p, q, r = list(map(int, input().split()))
print((min(p+q, q+r, p+r)))
| import itertools
p, q, r = list(map(int, input().split()))
ans = 10**18
for v in itertools.permutations([p, q, r], 2):
ans = min(ans, sum(v))
print(ans)
| 2 | 6 | 63 | 156 | p, q, r = list(map(int, input().split()))
print((min(p + q, q + r, p + r)))
| import itertools
p, q, r = list(map(int, input().split()))
ans = 10**18
for v in itertools.permutations([p, q, r], 2):
ans = min(ans, sum(v))
print(ans)
| false | 66.666667 | [
"+import itertools",
"+",
"-print((min(p + q, q + r, p + r)))",
"+ans = 10**18",
"+for v in itertools.permutations([p, q, r], 2):",
"+ ans = min(ans, sum(v))",
"+print(ans)"
] | false | 0.104479 | 0.043641 | 2.394079 | [
"s839176064",
"s756712432"
] |
u077291787 | p03044 | python | s741618537 | s274595657 | 484 | 386 | 81,564 | 42,792 | Accepted | Accepted | 20.25 | # ABC126D - Even Relation
import sys
sys.setrecursionlimit(10 ** 9)
def dfs(v: int, p: int) -> None:
for u, w in T[v]:
if u != p:
D[u] = (D[v] + w) % 2
dfs(u, v)
def main():
global T, D
N, *A = map(int, open(0).read().split())
T = [[] for _ in range(N... | # ABC126D - Even Relation
def dfs(r: int) -> None:
stack = [r]
while stack:
v = stack.pop()
for u, w in T[v]:
if D[u] == -1:
D[u] = (D[v] + w) % 2
stack.append(u)
def main():
global T, D
N, *A = map(int, open(0).read().split())
... | 28 | 27 | 603 | 652 | # ABC126D - Even Relation
import sys
sys.setrecursionlimit(10**9)
def dfs(v: int, p: int) -> None:
for u, w in T[v]:
if u != p:
D[u] = (D[v] + w) % 2
dfs(u, v)
def main():
global T, D
N, *A = map(int, open(0).read().split())
T = [[] for _ in range(N + 1)]
for i i... | # ABC126D - Even Relation
def dfs(r: int) -> None:
stack = [r]
while stack:
v = stack.pop()
for u, w in T[v]:
if D[u] == -1:
D[u] = (D[v] + w) % 2
stack.append(u)
def main():
global T, D
N, *A = map(int, open(0).read().split())
T = [[] fo... | false | 3.571429 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**9)",
"-",
"-",
"-def dfs(v: int, p: int) -> None:",
"- for u, w in T[v]:",
"- if u != p:",
"- D[u] = (D[v] + w) % 2",
"- dfs(u, v)",
"+def dfs(r: int) -> None:",
"+ stack = [r]",
"+ while stack:",
"+ ... | false | 0.063079 | 0.03921 | 1.608736 | [
"s741618537",
"s274595657"
] |
u317779196 | p02923 | python | s494059049 | s999060487 | 365 | 84 | 23,392 | 14,252 | Accepted | Accepted | 76.99 | import numpy as np
n = int(eval(input()))
h = np.array([int(i) for i in input().split()])
dh = np.diff(h)
ans = 0
ans_l = []
for i in range(len(dh)):
if dh[i] <= 0:
ans += 1
elif dh[i] > 0:
ans_l.append(ans)
ans = 0
ans_l.append(ans)
print((max(ans_l))) | n = int(eval(input()))
h = [int(i) for i in input().split()]
ans = 0
a = 0
for i in range(n-1):
if h[i] >= h[i+1]:
a += 1
else:
ans = max(ans, a)
a = 0
ans = max(ans, a)
print(ans) | 16 | 12 | 295 | 217 | import numpy as np
n = int(eval(input()))
h = np.array([int(i) for i in input().split()])
dh = np.diff(h)
ans = 0
ans_l = []
for i in range(len(dh)):
if dh[i] <= 0:
ans += 1
elif dh[i] > 0:
ans_l.append(ans)
ans = 0
ans_l.append(ans)
print((max(ans_l)))
| n = int(eval(input()))
h = [int(i) for i in input().split()]
ans = 0
a = 0
for i in range(n - 1):
if h[i] >= h[i + 1]:
a += 1
else:
ans = max(ans, a)
a = 0
ans = max(ans, a)
print(ans)
| false | 25 | [
"-import numpy as np",
"-",
"-h = np.array([int(i) for i in input().split()])",
"-dh = np.diff(h)",
"+h = [int(i) for i in input().split()]",
"-ans_l = []",
"-for i in range(len(dh)):",
"- if dh[i] <= 0:",
"- ans += 1",
"- elif dh[i] > 0:",
"- ans_l.append(ans)",
"- ... | false | 0.481429 | 0.064159 | 7.503732 | [
"s494059049",
"s999060487"
] |
u080364835 | p02756 | python | s674101606 | s598077700 | 860 | 533 | 97,388 | 14,052 | Accepted | Accepted | 38.02 | s = list(input())
n = int(input())
head = []
tail = []
cnt = 0
for _ in range(n):
li = list(input().split())
if li[0] == '1':
head, tail = tail, head
cnt += 1
else:
if li[1] == '1':
head += li[2]
else:
tail += li[2]
if cnt % 2 != 0:
... | s = list(input())
n = int(input())
head = []
tail = []
cnt = 0
for _ in range(n):
li = list(input().split())
if li[0] == '1':
head, tail = tail, head
cnt += 1
else:
if li[1] == '1':
head.append(li[2])
else:
tail.append(li[2])
if cnt ... | 22 | 22 | 389 | 399 | s = list(input())
n = int(input())
head = []
tail = []
cnt = 0
for _ in range(n):
li = list(input().split())
if li[0] == "1":
head, tail = tail, head
cnt += 1
else:
if li[1] == "1":
head += li[2]
else:
tail += li[2]
if cnt % 2 != 0:
s = s[::-1]
ans... | s = list(input())
n = int(input())
head = []
tail = []
cnt = 0
for _ in range(n):
li = list(input().split())
if li[0] == "1":
head, tail = tail, head
cnt += 1
else:
if li[1] == "1":
head.append(li[2])
else:
tail.append(li[2])
if cnt % 2 != 0:
s = s... | false | 0 | [
"- head += li[2]",
"+ head.append(li[2])",
"- tail += li[2]",
"+ tail.append(li[2])"
] | false | 0.045781 | 0.046685 | 0.980643 | [
"s674101606",
"s598077700"
] |
u197300773 | p02728 | python | s824746203 | s945687245 | 2,373 | 2,060 | 176,476 | 139,612 | Accepted | Accepted | 13.19 | import sys
sys.setrecursionlimit(10**7)
def modinv(a,m=10**9+7):
if a==0: return 1
else:
b=m
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lastx) = (lastx - q * x, x)
(y, last... | import sys
sys.setrecursionlimit(10**7)
def modinv(a,m=10**9+7):
if a==0: return 1
b=m
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lastx) = (lastx - q * x, x)
(y, lasty) = (lasty - q * y, y)
return lastx %... | 55 | 48 | 1,086 | 992 | import sys
sys.setrecursionlimit(10**7)
def modinv(a, m=10**9 + 7):
if a == 0:
return 1
else:
b = m
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lastx) = (lastx - q * x, x)
(y, ... | import sys
sys.setrecursionlimit(10**7)
def modinv(a, m=10**9 + 7):
if a == 0:
return 1
b = m
(x, lastx) = (0, 1)
(y, lasty) = (1, 0)
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lastx) = (lastx - q * x, x)
(y, lasty) = (lasty - q * y, y)
return las... | false | 12.727273 | [
"- else:",
"- b = m",
"- (x, lastx) = (0, 1)",
"- (y, lasty) = (1, 0)",
"- while b != 0:",
"- q = a // b",
"- (a, b) = (b, a % b)",
"- (x, lastx) = (lastx - q * x, x)",
"- (y, lasty) = (lasty - q * y, y)",
"- return ... | false | 0.033208 | 0.069089 | 0.480657 | [
"s824746203",
"s945687245"
] |
u203383537 | p02995 | python | s886859171 | s971089599 | 35 | 28 | 5,076 | 9,152 | Accepted | Accepted | 20 | import fractions
def lcm(x,y):
return (x*y)//fractions.gcd(x,y)
a,b,c,d=list(map(int,input().split()))
d1=b//c
d2=b//d
d3=b//lcm(c,d)
d4=(a-1)//c
d5=(a-1)//d
d6=(a-1)//lcm(c,d)
ansb=b-(d1+d2-d3)
ansa=a-1-(d4+d5-d6)
print((ansb-ansa))
| def gcd(x,y):
if x < y:
x,y = y,x
if y == 0:
return x
else:
return gcd(y,x%y)
def lcm(x,y):
return (x*y)//gcd(x,y)
a,b,c,d = list(map(int,input().split()))
al = b-a+1
cnt_c = b//c - (a-1)//c
cnt_d = b//d - (a-1)//d
cnt_t = b//lcm(c,d) - (a-1)/... | 17 | 23 | 250 | 361 | import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
a, b, c, d = list(map(int, input().split()))
d1 = b // c
d2 = b // d
d3 = b // lcm(c, d)
d4 = (a - 1) // c
d5 = (a - 1) // d
d6 = (a - 1) // lcm(c, d)
ansb = b - (d1 + d2 - d3)
ansa = a - 1 - (d4 + d5 - d6)
print((ansb - ansa))
| def gcd(x, y):
if x < y:
x, y = y, x
if y == 0:
return x
else:
return gcd(y, x % y)
def lcm(x, y):
return (x * y) // gcd(x, y)
a, b, c, d = list(map(int, input().split()))
al = b - a + 1
cnt_c = b // c - (a - 1) // c
cnt_d = b // d - (a - 1) // d
cnt_t = b // lcm(c, d) - (a -... | false | 26.086957 | [
"-import fractions",
"+def gcd(x, y):",
"+ if x < y:",
"+ x, y = y, x",
"+ if y == 0:",
"+ return x",
"+ else:",
"+ return gcd(y, x % y)",
"- return (x * y) // fractions.gcd(x, y)",
"+ return (x * y) // gcd(x, y)",
"-d1 = b // c",
"-d2 = b // d",
"-d3 = b ... | false | 0.083133 | 0.077651 | 1.070599 | [
"s886859171",
"s971089599"
] |
u596276291 | p03945 | python | s608197715 | s994381946 | 40 | 32 | 3,572 | 4,340 | Accepted | Accepted | 20 | from collections import defaultdict
def main():
s = eval(input())
ans = 0
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
ans += 1
print(ans)
if __name__ == '__main__':
main()
| from collections import defaultdict
from itertools import groupby
def main():
S = eval(input())
print((len([k for k, g in groupby(S)]) - 1))
if __name__ == '__main__':
main()
| 13 | 11 | 226 | 193 | from collections import defaultdict
def main():
s = eval(input())
ans = 0
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
ans += 1
print(ans)
if __name__ == "__main__":
main()
| from collections import defaultdict
from itertools import groupby
def main():
S = eval(input())
print((len([k for k, g in groupby(S)]) - 1))
if __name__ == "__main__":
main()
| false | 15.384615 | [
"+from itertools import groupby",
"- s = eval(input())",
"- ans = 0",
"- for i in range(len(s) - 1):",
"- if s[i] != s[i + 1]:",
"- ans += 1",
"- print(ans)",
"+ S = eval(input())",
"+ print((len([k for k, g in groupby(S)]) - 1))"
] | false | 0.049037 | 0.008335 | 5.88337 | [
"s608197715",
"s994381946"
] |
u926412290 | p02899 | python | s827819798 | s359260875 | 203 | 116 | 24,880 | 13,880 | Accepted | Accepted | 42.86 | N = int(input())
A = {num: i+1 for i,num in enumerate(map(int, input().split()))}
for i in range(1, N+1):
if i == N:
print(A[i])
else:
print(A[i], end=" ")
| N = int(eval(input()))
A = list(map(int, input().split()))
rev = [0] * N
for i in range(N):
rev[A[i] - 1] = i + 1
print((*rev)) | 8 | 7 | 187 | 130 | N = int(input())
A = {num: i + 1 for i, num in enumerate(map(int, input().split()))}
for i in range(1, N + 1):
if i == N:
print(A[i])
else:
print(A[i], end=" ")
| N = int(eval(input()))
A = list(map(int, input().split()))
rev = [0] * N
for i in range(N):
rev[A[i] - 1] = i + 1
print((*rev))
| false | 12.5 | [
"-N = int(input())",
"-A = {num: i + 1 for i, num in enumerate(map(int, input().split()))}",
"-for i in range(1, N + 1):",
"- if i == N:",
"- print(A[i])",
"- else:",
"- print(A[i], end=\" \")",
"+N = int(eval(input()))",
"+A = list(map(int, input().split()))",
"+rev = [0] * N"... | false | 0.037966 | 0.043799 | 0.866833 | [
"s827819798",
"s359260875"
] |
u285891772 | p02744 | python | s581527899 | s215203330 | 123 | 91 | 10,640 | 10,480 | Accepted | Accepted | 26.02 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 35 | 34 | 1,143 | 1,100 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 2.857143 | [
"-# 非再帰バージョン",
"+# 再帰バージョン",
"-w = [\"a\"]",
"-while w:",
"- s = w.pop()",
"- if len(s) == N:",
"- print(s)",
"- continue",
"+",
"+",
"+def DFS(n):",
"+ if len(n) == N:",
"+ print(n)",
"- for j in range(len(set(s)), -1, -1):",
"- t = s + as... | false | 0.106449 | 0.102021 | 1.043404 | [
"s581527899",
"s215203330"
] |
u533039576 | p02686 | python | s740938628 | s058761341 | 1,998 | 1,290 | 92,056 | 91,936 | Accepted | Accepted | 35.44 | n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
def bracket(x):
# f: final sum of brackets '(':+1, ')': -1
# m: min value of f
f = m = 0
for i in range(len(x)):
if x[i] == '(':
f += 1
else:
f -= 1
m = min(m, f)
# m <= 0
... | import sys
# input = sys.stdin.readline
input = lambda: sys.stdin.readline().rstrip()
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
def bracket(x):
# f: final sum of brackets '(':+1, ')': -1
# m: min value of f
f = m = 0
for i in range(len(x)):
if x[i] == '(':
... | 47 | 51 | 820 | 911 | n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
def bracket(x):
# f: final sum of brackets '(':+1, ')': -1
# m: min value of f
f = m = 0
for i in range(len(x)):
if x[i] == "(":
f += 1
else:
f -= 1
m = min(m, f)
# m <= 0
return f, m
... | import sys
# input = sys.stdin.readline
input = lambda: sys.stdin.readline().rstrip()
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
def bracket(x):
# f: final sum of brackets '(':+1, ')': -1
# m: min value of f
f = m = 0
for i in range(len(x)):
if x[i] == "(":
f += ... | false | 7.843137 | [
"+import sys",
"+",
"+# input = sys.stdin.readline",
"+input = lambda: sys.stdin.readline().rstrip()"
] | false | 0.036633 | 0.041894 | 0.874407 | [
"s740938628",
"s058761341"
] |
u433532588 | p02981 | python | s910415898 | s842085601 | 176 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.34 | N, A, B = list(map(int, input().split()))
if N*A > B:
print(B)
else:
print((N*A)) | N, A, B = list(map(int, input().split()))
print((min(N*A, B))) | 5 | 2 | 85 | 55 | N, A, B = list(map(int, input().split()))
if N * A > B:
print(B)
else:
print((N * A))
| N, A, B = list(map(int, input().split()))
print((min(N * A, B)))
| false | 60 | [
"-if N * A > B:",
"- print(B)",
"-else:",
"- print((N * A))",
"+print((min(N * A, B)))"
] | false | 0.041163 | 0.035482 | 1.160102 | [
"s910415898",
"s842085601"
] |
u047393579 | p02862 | python | s493611819 | s281755438 | 881 | 310 | 102,028 | 118,764 | Accepted | Accepted | 64.81 | import sys
sys.setrecursionlimit(10**7)
import math
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2,r+1):
pivot = denominator[p - 1]
... | import sys
sys.setrecursionlimit(10**7)
import math
def cmb(n, r, mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-r] % mod
X, Y = list(map(int, input().split()))
x = (-X+2*Y)/3
y = (2*X-Y)/3
if x.is_integer() and y.is_integer() and x>=0 and y>=0:
x =... | 37 | 30 | 897 | 758 | import sys
sys.setrecursionlimit(10**7)
import math
def cmb(n, r):
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2, r + 1):
pivot = denominato... | import sys
sys.setrecursionlimit(10**7)
import math
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
X, Y = list(map(int, input().split()))
x = (-X + 2 * Y) / 3
y = (2 * X - Y) / 3
if x.is_integer() and y.is_integer() and x >= 0 and y >= 0... | false | 18.918919 | [
"-def cmb(n, r):",
"- if n - r < r:",
"- r = n - r",
"- if r == 0:",
"- return 1",
"- if r == 1:",
"- return n",
"- numerator = [n - r + k + 1 for k in range(r)]",
"- denominator = [k + 1 for k in range(r)]",
"- for p in range(2, r + 1):",
"- pivot =... | false | 0.604114 | 0.346299 | 1.744484 | [
"s493611819",
"s281755438"
] |
u121161758 | p03161 | python | s760577045 | s843408277 | 1,970 | 1,677 | 13,928 | 14,048 | Accepted | Accepted | 14.87 | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
inf = 10 ** 4 + 1
dp = [inf] * N
dp[0] = 0
for i in range(1,N):
H = h[i]
dp[i] = min( [dp[j] + abs(h[j] - H) for j in range(max(0, i-K),i)])
print((dp[-1]))
| import sys
def main():
input=sys.stdin.readline
N,K=list(map(int,input().split()))
H=list(map(int,input().split()))
if N-1<=K:
print((H[N-1]-H[0]))
return
inf=10**9+7
dp=[inf]*N
dp[0]=0
for i,h in enumerate(H):
if i==0:continue
m=inf
... | 9 | 21 | 240 | 468 | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
inf = 10**4 + 1
dp = [inf] * N
dp[0] = 0
for i in range(1, N):
H = h[i]
dp[i] = min([dp[j] + abs(h[j] - H) for j in range(max(0, i - K), i)])
print((dp[-1]))
| import sys
def main():
input = sys.stdin.readline
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
if N - 1 <= K:
print((H[N - 1] - H[0]))
return
inf = 10**9 + 7
dp = [inf] * N
dp[0] = 0
for i, h in enumerate(H):
if i == 0:
... | false | 57.142857 | [
"-N, K = list(map(int, input().split()))",
"-h = list(map(int, input().split()))",
"-inf = 10**4 + 1",
"-dp = [inf] * N",
"-dp[0] = 0",
"-for i in range(1, N):",
"- H = h[i]",
"- dp[i] = min([dp[j] + abs(h[j] - H) for j in range(max(0, i - K), i)])",
"-print((dp[-1]))",
"+import sys",
"+",... | false | 0.050669 | 0.051498 | 0.983894 | [
"s760577045",
"s843408277"
] |
u858742833 | p03003 | python | s944259306 | s934263513 | 1,236 | 1,014 | 4,980 | 4,084 | Accepted | Accepted | 17.96 | def main():
mod = 10**9 + 7
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
u = [1] * (N + 1)
v = [1] * (N + 1)
for t in T:
for i, s in enumerate(S, 1):
if s == t:
v[i] = v[i - 1] + u... | def main():
mod = 10**9 + 7
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
V = [1] * N
for t in T:
p, q = 1, 1
for i, (s, v) in enumerate(zip(S, V)):
V[i] = q = v + q if s == t else v + q - p
... | 17 | 14 | 450 | 370 | def main():
mod = 10**9 + 7
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
u = [1] * (N + 1)
v = [1] * (N + 1)
for t in T:
for i, s in enumerate(S, 1):
if s == t:
v[i] = v[i - 1] + u[i]
... | def main():
mod = 10**9 + 7
N, M = list(map(int, input().split()))
S = list(map(int, input().split()))
T = list(map(int, input().split()))
V = [1] * N
for t in T:
p, q = 1, 1
for i, (s, v) in enumerate(zip(S, V)):
V[i] = q = v + q if s == t else v + q - p
... | false | 17.647059 | [
"- u = [1] * (N + 1)",
"- v = [1] * (N + 1)",
"+ V = [1] * N",
"- for i, s in enumerate(S, 1):",
"- if s == t:",
"- v[i] = v[i - 1] + u[i]",
"- else:",
"- v[i] = v[i - 1] + u[i] - u[i - 1]",
"- u, v = v, u",
"- return u[... | false | 0.035213 | 0.036359 | 0.968492 | [
"s944259306",
"s934263513"
] |
u729133443 | p03227 | python | s206079069 | s015028640 | 190 | 17 | 38,384 | 2,940 | Accepted | Accepted | 91.05 | s=eval(input())
if(len(s)<3):print(s)
else:print((s[::-1])) | s=eval(input());print((s[::-1]*(len(s)-2)or s)) | 3 | 1 | 53 | 39 | s = eval(input())
if len(s) < 3:
print(s)
else:
print((s[::-1]))
| s = eval(input())
print((s[::-1] * (len(s) - 2) or s))
| false | 66.666667 | [
"-if len(s) < 3:",
"- print(s)",
"-else:",
"- print((s[::-1]))",
"+print((s[::-1] * (len(s) - 2) or s))"
] | false | 0.037494 | 0.063411 | 0.591288 | [
"s206079069",
"s015028640"
] |
u757117214 | p03607 | python | s139744622 | s105301019 | 123 | 84 | 108,956 | 22,604 | Accepted | Accepted | 31.71 | from collections import Counter
N,*A = list(map(int,open(0).read().split()))
ca = Counter(A)
copy_ca = ca.copy()
for i in list(ca.items()):
if i[1] % 2 == 0:
del copy_ca[i[0]]
print((len(copy_ca))) | from collections import defaultdict
N,*A = list(map(int,open(0).read().split()))
d = defaultdict(int) #初期値1
for a in A:
d[a] ^= 1 #0と1を反転
print((sum(d.values()))) | 8 | 6 | 210 | 164 | from collections import Counter
N, *A = list(map(int, open(0).read().split()))
ca = Counter(A)
copy_ca = ca.copy()
for i in list(ca.items()):
if i[1] % 2 == 0:
del copy_ca[i[0]]
print((len(copy_ca)))
| from collections import defaultdict
N, *A = list(map(int, open(0).read().split()))
d = defaultdict(int) # 初期値1
for a in A:
d[a] ^= 1 # 0と1を反転
print((sum(d.values())))
| false | 25 | [
"-from collections import Counter",
"+from collections import defaultdict",
"-ca = Counter(A)",
"-copy_ca = ca.copy()",
"-for i in list(ca.items()):",
"- if i[1] % 2 == 0:",
"- del copy_ca[i[0]]",
"-print((len(copy_ca)))",
"+d = defaultdict(int) # 初期値1",
"+for a in A:",
"+ d[a] ^= ... | false | 0.10506 | 0.072701 | 1.445096 | [
"s139744622",
"s105301019"
] |
u086503932 | p03108 | python | s707273619 | s713002489 | 684 | 392 | 18,952 | 102,724 | Accepted | Accepted | 42.69 | #!/usr/bin/env python3
import sys
class UnionFind():
def __init__(self, n):
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def u... | class UnionFind():
def __init__(self, n):
self.parents = list(range(n))
self.size = [1] * n
def find(self, x):
if self.parents[x] == x:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def uni... | 51 | 37 | 1,244 | 969 | #!/usr/bin/env python3
import sys
class UnionFind:
def __init__(self, n):
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y... | class UnionFind:
def __init__(self, n):
self.parents = list(range(n))
self.size = [1] * n
def find(self, x):
if self.parents[x] == x:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y)... | false | 27.45098 | [
"-#!/usr/bin/env python3",
"-import sys",
"-",
"-",
"- self.parents = [-1] * n",
"+ self.parents = list(range(n))",
"+ self.size = [1] * n",
"- if self.parents[x] < 0:",
"+ if self.parents[x] == x:",
"- if x == y:",
"- return",
"- if ... | false | 0.078879 | 0.037047 | 2.129158 | [
"s707273619",
"s713002489"
] |
u054729397 | p03644 | python | s752644150 | s145475279 | 19 | 17 | 2,940 | 3,060 | Accepted | Accepted | 10.53 | N=int(eval(input()))
n=1
while(2*n<=N):
n*=2
print(n) | N=int(eval(input()))
count=0
max=0
for a in range(1,N+1):
while(a%2==0):
a/=2
count+=1
if(max<count):
max=count
count=0
print((2**max)) | 7 | 14 | 59 | 179 | N = int(eval(input()))
n = 1
while 2 * n <= N:
n *= 2
print(n)
| N = int(eval(input()))
count = 0
max = 0
for a in range(1, N + 1):
while a % 2 == 0:
a /= 2
count += 1
if max < count:
max = count
count = 0
print((2**max))
| false | 50 | [
"-n = 1",
"-while 2 * n <= N:",
"- n *= 2",
"-print(n)",
"+count = 0",
"+max = 0",
"+for a in range(1, N + 1):",
"+ while a % 2 == 0:",
"+ a /= 2",
"+ count += 1",
"+ if max < count:",
"+ max = count",
"+ count = 0",
"+print((2**max))"
] | false | 0.057939 | 0.060755 | 0.953644 | [
"s752644150",
"s145475279"
] |
u073852194 | p02868 | python | s462353967 | s607451913 | 1,977 | 641 | 71,512 | 97,960 | Accepted | Accepted | 67.58 | class SegTreeMin:
"""
以下のクエリを処理する
1.update: i番目の値をxに更新する
2.get_min: 区間[l, r)の最小値を得る
"""
def __init__(self, n, INF):
"""
:param n: 要素数
:param INF: 初期値(入りうる要素より十分に大きな数)
"""
self.n = n
# nより大きい2の冪数
n2 = 1
while n2 < n:... | from heapq import heappop, heappush, heapify
class Graph(): #directed
def __init__(self, n, edge, indexed=1):
self.n = n
self.graph = [[] for _ in range(n)]
self.deg = [0 for _ in range(n)]
for e in edge:
self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))... | 76 | 52 | 1,848 | 1,514 | class SegTreeMin:
"""
以下のクエリを処理する
1.update: i番目の値をxに更新する
2.get_min: 区間[l, r)の最小値を得る
"""
def __init__(self, n, INF):
"""
:param n: 要素数
:param INF: 初期値(入りうる要素より十分に大きな数)
"""
self.n = n
# nより大きい2の冪数
n2 = 1
while n2 < n:
n2... | from heapq import heappop, heappush, heapify
class Graph: # directed
def __init__(self, n, edge, indexed=1):
self.n = n
self.graph = [[] for _ in range(n)]
self.deg = [0 for _ in range(n)]
for e in edge:
self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))
... | false | 31.578947 | [
"-class SegTreeMin:",
"- \"\"\"",
"- 以下のクエリを処理する",
"- 1.update: i番目の値をxに更新する",
"- 2.get_min: 区間[l, r)の最小値を得る",
"- \"\"\"",
"-",
"- def __init__(self, n, INF):",
"- \"\"\"",
"- :param n: 要素数",
"- :param INF: 初期値(入りうる要素より十分に大きな数)",
"- \"\"\"",
"- ... | false | 0.036674 | 0.03922 | 0.93507 | [
"s462353967",
"s607451913"
] |
u764600134 | p04044 | python | s555301019 | s416983553 | 20 | 17 | 3,064 | 3,060 | Accepted | Accepted | 15 | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc042/tasks/abc042_b
"""
import sys
from sys import stdin
input = stdin.readline
def solve(data):
data.sort()
return data
def main(args):
N, L = map(int, input().split())
data = [input().strip() for _ in range(N)]
a... | N, L = list(map(int, input().split()))
S = []
for i in range(N):
line = eval(input())
S.append(line)
S.sort()
print(("".join(S))) | 25 | 7 | 424 | 129 | # -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc042/tasks/abc042_b
"""
import sys
from sys import stdin
input = stdin.readline
def solve(data):
data.sort()
return data
def main(args):
N, L = map(int, input().split())
data = [input().strip() for _ in range(N)]
ans = solve(data)
... | N, L = list(map(int, input().split()))
S = []
for i in range(N):
line = eval(input())
S.append(line)
S.sort()
print(("".join(S)))
| false | 72 | [
"-# -*- coding: utf-8 -*-",
"-\"\"\"",
"-https://beta.atcoder.jp/contests/abc042/tasks/abc042_b",
"-\"\"\"",
"-import sys",
"-from sys import stdin",
"-",
"-input = stdin.readline",
"-",
"-",
"-def solve(data):",
"- data.sort()",
"- return data",
"-",
"-",
"-def main(args):",
"... | false | 0.074755 | 0.068754 | 1.087291 | [
"s555301019",
"s416983553"
] |
u764773675 | p03448 | python | s633729364 | s779358968 | 54 | 45 | 3,060 | 3,064 | Accepted | Accepted | 16.67 | # coding: utf-8
# Your code here!
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
money = int(eval(input()))
count = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
total = i * 500 + j * 100 + k * 50
if total == money:
... | # coding: utf-8
# Your code here!
l = int(eval(input()))
m = int(eval(input()))
n = int(eval(input()))
x = int(eval(input()))
count = 0
for i in range(l + 1):
p = 500 * i
for j in range(m + 1):
q = 100 * j
for k in range(n + 1):
r = 50 * k
if p + q + r ==... | 19 | 18 | 385 | 341 | # coding: utf-8
# Your code here!
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
money = int(eval(input()))
count = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
total = i * 500 + j * 100 + k * 50
if total == money:
count... | # coding: utf-8
# Your code here!
l = int(eval(input()))
m = int(eval(input()))
n = int(eval(input()))
x = int(eval(input()))
count = 0
for i in range(l + 1):
p = 500 * i
for j in range(m + 1):
q = 100 * j
for k in range(n + 1):
r = 50 * k
if p + q + r == x:
... | false | 5.263158 | [
"-a = int(eval(input()))",
"-b = int(eval(input()))",
"-c = int(eval(input()))",
"-money = int(eval(input()))",
"+l = int(eval(input()))",
"+m = int(eval(input()))",
"+n = int(eval(input()))",
"+x = int(eval(input()))",
"-for i in range(a + 1):",
"- for j in range(b + 1):",
"- for k in... | false | 0.100497 | 0.008307 | 12.098075 | [
"s633729364",
"s779358968"
] |
u077291787 | p02689 | python | s342168099 | s229314348 | 125 | 109 | 44,040 | 43,956 | Accepted | Accepted | 12.8 | # C - Peaks
def main():
N, M, *HAB = list(map(int, open(0).read().split()))
H, AB = [0] + HAB[:N], HAB[N:]
good_observatories = set(range(1, N + 1))
for a, b in zip(*[iter(AB)] * 2):
if H[a] >= H[b]:
good_observatories.discard(b)
if H[b] >= H[a]:
good_obs... | # C - Peaks
def main():
N, M, *HAB = list(map(int, open(0).read().split()))
H, AB = [0] + HAB[:N], HAB[N:]
is_good = [False] + [True] * N
for a, b in zip(*[iter(AB)] * 2):
if H[a] >= H[b]:
is_good[b] = False
if H[b] >= H[a]:
is_good[a] = False
print(... | 15 | 15 | 416 | 372 | # C - Peaks
def main():
N, M, *HAB = list(map(int, open(0).read().split()))
H, AB = [0] + HAB[:N], HAB[N:]
good_observatories = set(range(1, N + 1))
for a, b in zip(*[iter(AB)] * 2):
if H[a] >= H[b]:
good_observatories.discard(b)
if H[b] >= H[a]:
good_observatorie... | # C - Peaks
def main():
N, M, *HAB = list(map(int, open(0).read().split()))
H, AB = [0] + HAB[:N], HAB[N:]
is_good = [False] + [True] * N
for a, b in zip(*[iter(AB)] * 2):
if H[a] >= H[b]:
is_good[b] = False
if H[b] >= H[a]:
is_good[a] = False
print((sum(is_go... | false | 0 | [
"- good_observatories = set(range(1, N + 1))",
"+ is_good = [False] + [True] * N",
"- good_observatories.discard(b)",
"+ is_good[b] = False",
"- good_observatories.discard(a)",
"- print((len(good_observatories)))",
"+ is_good[a] = False",
"+ prin... | false | 0.038712 | 0.038221 | 1.012826 | [
"s342168099",
"s229314348"
] |
u803617136 | p03775 | python | s347776734 | s680225112 | 30 | 27 | 3,060 | 3,188 | Accepted | Accepted | 10 | import math
N = int(eval(input()))
ans = len(str(N))
for i in range(2, int(math.sqrt(N)) + 1):
if N % i == 0:
ans = min(ans, len(str(N // i)))
print(ans) | from math import ceil
def divisors(n):
res = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
res.append(i)
if i != n // i:
res.append(n // i)
return res
n = int(eval(input()))
divs = divisors(n)
divs.sort()
lim = ceil(len(divs) / 2)
an... | 7 | 24 | 165 | 468 | import math
N = int(eval(input()))
ans = len(str(N))
for i in range(2, int(math.sqrt(N)) + 1):
if N % i == 0:
ans = min(ans, len(str(N // i)))
print(ans)
| from math import ceil
def divisors(n):
res = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
res.append(i)
if i != n // i:
res.append(n // i)
return res
n = int(eval(input()))
divs = divisors(n)
divs.sort()
lim = ceil(len(divs) / 2)
ans = 11
for i in... | false | 70.833333 | [
"-import math",
"+from math import ceil",
"-N = int(eval(input()))",
"-ans = len(str(N))",
"-for i in range(2, int(math.sqrt(N)) + 1):",
"- if N % i == 0:",
"- ans = min(ans, len(str(N // i)))",
"+",
"+def divisors(n):",
"+ res = []",
"+ for i in range(1, int(n**0.5) + 1):",
"+... | false | 0.046961 | 0.049328 | 0.952027 | [
"s347776734",
"s680225112"
] |
u285681431 | p02691 | python | s449889004 | s393417107 | 243 | 214 | 59,468 | 61,560 | Accepted | Accepted | 11.93 | # 雰囲気で書いたら通ってしまったがなんで通ったかわからん
# i<jという前提を無視しているのではと感じる
N = int(eval(input()))
A = list(map(int, input().split()))
# i<jとして、条件は j-i = A_i + A_j
# i + A_i = j - A_j
dict1 = {}
for i in range(1, N + 1):
tmp = i + A[i - 1]
if tmp not in dict1:
dict1[tmp] = 1
else:
dict1[tmp] += 1... | import sys
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *A = list(map(int, read().split()))
memo = defaultdict(int) # 0で初期化する
answer = 0
for idx, x in enumerate(A, 1): # indexを1から始める
# i<jを満たしながらansを計... | 30 | 21 | 589 | 509 | # 雰囲気で書いたら通ってしまったがなんで通ったかわからん
# i<jという前提を無視しているのではと感じる
N = int(eval(input()))
A = list(map(int, input().split()))
# i<jとして、条件は j-i = A_i + A_j
# i + A_i = j - A_j
dict1 = {}
for i in range(1, N + 1):
tmp = i + A[i - 1]
if tmp not in dict1:
dict1[tmp] = 1
else:
dict1[tmp] += 1
dict2 = {}
for ... | import sys
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *A = list(map(int, read().split()))
memo = defaultdict(int) # 0で初期化する
answer = 0
for idx, x in enumerate(A, 1): # indexを1から始める
# i<jを満たしながらansを計算
# idx = ... | false | 30 | [
"-# 雰囲気で書いたら通ってしまったがなんで通ったかわからん",
"-# i<jという前提を無視しているのではと感じる",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-# i<jとして、条件は j-i = A_i + A_j",
"-# i + A_i = j - A_j",
"-dict1 = {}",
"-for i in range(1, N + 1):",
"- tmp = i + A[i - 1]",
"- if tmp not in dict1:",
"- ... | false | 0.037977 | 0.037495 | 1.012868 | [
"s449889004",
"s393417107"
] |
u017415492 | p03805 | python | s462958971 | s787558237 | 71 | 36 | 74,264 | 9,384 | Accepted | Accepted | 49.3 | import itertools
n,m=list(map(int,input().split()))
edge =[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
edge[a].append(b)
edge[b].append(a)
all_lis = list(itertools.permutations(list(range(2,n+1))))
def sati(x):
#xはリスト[4,5,7]
now=1
for i in range(n-1):
if... | import itertools
n,m=list(map(int,input().split()))
edge=[[] for i in range(n+1)]
for i in range(m):
a,b=list(map(int,input().split()))
edge[a].append(b)
edge[b].append(a)
ans=0
for junretu in list(itertools.permutations(list(range(2,n+1)))):
now=1
flag=True
for i in list(junretu):
if not(i ... | 22 | 19 | 429 | 402 | import itertools
n, m = list(map(int, input().split()))
edge = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
edge[a].append(b)
edge[b].append(a)
all_lis = list(itertools.permutations(list(range(2, n + 1))))
def sati(x):
# xはリスト[4,5,7]
now = 1
for i in ra... | import itertools
n, m = list(map(int, input().split()))
edge = [[] for i in range(n + 1)]
for i in range(m):
a, b = list(map(int, input().split()))
edge[a].append(b)
edge[b].append(a)
ans = 0
for junretu in list(itertools.permutations(list(range(2, n + 1)))):
now = 1
flag = True
for i in list(j... | false | 13.636364 | [
"-all_lis = list(itertools.permutations(list(range(2, n + 1))))",
"-",
"-",
"-def sati(x):",
"- # xはリスト[4,5,7]",
"+ans = 0",
"+for junretu in list(itertools.permutations(list(range(2, n + 1)))):",
"- for i in range(n - 1):",
"- if not (x[i] in edge[now]):",
"- return 0",
... | false | 0.107539 | 0.107163 | 1.00351 | [
"s462958971",
"s787558237"
] |
u347640436 | p02936 | python | s034554277 | s663441128 | 1,677 | 1,190 | 66,136 | 25,852 | Accepted | Accepted | 29.04 | def main():
_map, _range, _int = map, range, int
n, q = _map(_int, input().split())
values = [0] * (n + 1)
parents = [0] * (n + 1)
for i in _range(n - 1):
a, b = _map(_int, input().split())
parents[b] = a
for _ in _range(q):
p, x = _map(_int, input().split())
values[p] += x
for ... | def main():
_map, _range, _int = map, range, int
n, q = _map(_int, input().split())
values = [0] * (n + 1)
parents = [0] * (n + 1)
for _ in _range(n - 1):
a, b = _map(_int, input().split())
parents[b] = a
for _ in _range(q):
p, x = _map(_int, input().split())
values[p] += x
for ... | 15 | 15 | 410 | 410 | def main():
_map, _range, _int = map, range, int
n, q = _map(_int, input().split())
values = [0] * (n + 1)
parents = [0] * (n + 1)
for i in _range(n - 1):
a, b = _map(_int, input().split())
parents[b] = a
for _ in _range(q):
p, x = _map(_int, input().split())
valu... | def main():
_map, _range, _int = map, range, int
n, q = _map(_int, input().split())
values = [0] * (n + 1)
parents = [0] * (n + 1)
for _ in _range(n - 1):
a, b = _map(_int, input().split())
parents[b] = a
for _ in _range(q):
p, x = _map(_int, input().split())
valu... | false | 0 | [
"- for i in _range(n - 1):",
"+ for _ in _range(n - 1):"
] | false | 0.042225 | 0.036665 | 1.151654 | [
"s034554277",
"s663441128"
] |
u949353021 | p02570 | python | s834091585 | s276627357 | 30 | 27 | 9,156 | 9,128 | Accepted | Accepted | 10 | d, t, s = list(map(int, input().split()))
if t-d/s >= 0:
print("Yes")
else:
print("No") | d,t,s = list(map(int, input().split()))
if s*t >= d:
print("Yes")
else:
print("No") | 5 | 5 | 93 | 89 | d, t, s = list(map(int, input().split()))
if t - d / s >= 0:
print("Yes")
else:
print("No")
| d, t, s = list(map(int, input().split()))
if s * t >= d:
print("Yes")
else:
print("No")
| false | 0 | [
"-if t - d / s >= 0:",
"+if s * t >= d:"
] | false | 0.046779 | 0.184379 | 0.253709 | [
"s834091585",
"s276627357"
] |
u296518383 | p03564 | python | s123727746 | s723132837 | 21 | 17 | 3,060 | 3,060 | Accepted | Accepted | 19.05 | N,K=int(eval(input())),int(eval(input()))
ans=10**10
for i in range(2**N):
tmp=1
for j in range(N):
if (i>>(N-j-1)&1)==1:
tmp*=2
else:
tmp+=K
ans=min(ans,tmp)
print(ans) | N,K=int(eval(input())),int(eval(input()))
M=[0]*(N+1)
M[0]=1
for i in range(1,N+1):
M[i]=min(M[i-1]*2,M[i-1]+K)
print((M[N])) | 12 | 8 | 195 | 122 | N, K = int(eval(input())), int(eval(input()))
ans = 10**10
for i in range(2**N):
tmp = 1
for j in range(N):
if (i >> (N - j - 1) & 1) == 1:
tmp *= 2
else:
tmp += K
ans = min(ans, tmp)
print(ans)
| N, K = int(eval(input())), int(eval(input()))
M = [0] * (N + 1)
M[0] = 1
for i in range(1, N + 1):
M[i] = min(M[i - 1] * 2, M[i - 1] + K)
print((M[N]))
| false | 33.333333 | [
"-ans = 10**10",
"-for i in range(2**N):",
"- tmp = 1",
"- for j in range(N):",
"- if (i >> (N - j - 1) & 1) == 1:",
"- tmp *= 2",
"- else:",
"- tmp += K",
"- ans = min(ans, tmp)",
"-print(ans)",
"+M = [0] * (N + 1)",
"+M[0] = 1",
"+for i in range... | false | 0.047528 | 0.046575 | 1.020463 | [
"s123727746",
"s723132837"
] |
u045953894 | p03556 | python | s409330285 | s561598051 | 44 | 32 | 10,236 | 9,136 | Accepted | Accepted | 27.27 | def multiple(n):
a = []
for i in range(1,int(n**.5)+1):
a.append(i*i)
return a
n = int(eval(input()))
a = multiple(n)
ans = 10**18
for i in a:
if n-i < 0:
continue
ans = min(ans,abs(n-i))
print((n-ans)) | n = int(eval(input()))
for i in range(1,n+2):
if i*i > n:
print(((i-1)*(i-1)))
exit() | 13 | 5 | 242 | 101 | def multiple(n):
a = []
for i in range(1, int(n**0.5) + 1):
a.append(i * i)
return a
n = int(eval(input()))
a = multiple(n)
ans = 10**18
for i in a:
if n - i < 0:
continue
ans = min(ans, abs(n - i))
print((n - ans))
| n = int(eval(input()))
for i in range(1, n + 2):
if i * i > n:
print(((i - 1) * (i - 1)))
exit()
| false | 61.538462 | [
"-def multiple(n):",
"- a = []",
"- for i in range(1, int(n**0.5) + 1):",
"- a.append(i * i)",
"- return a",
"-",
"-",
"-a = multiple(n)",
"-ans = 10**18",
"-for i in a:",
"- if n - i < 0:",
"- continue",
"- ans = min(ans, abs(n - i))",
"-print((n - ans))",
"... | false | 0.100516 | 0.041587 | 2.417002 | [
"s409330285",
"s561598051"
] |
u708255304 | p03007 | python | s288318703 | s555024668 | 272 | 250 | 19,368 | 19,328 | Accepted | Accepted | 8.09 | N = int(eval(input()))
AAA = list(map(int, input().split()))
AAA.sort() # 昇順ソート
m = AAA[0]
M = AAA[N-1]
ANS = []
for i in range(1, N-1):
if AAA[i] > 0:
ANS.append((m, AAA[i]))
m -= AAA[i]
continue
ANS.append((M, AAA[i]))
M -= AAA[i]
ANS.append((M, m))
print((M-... | N = int(eval(input()))
AAA = list(map(int, input().split()))
AAA.sort()
m = AAA[0]
M = AAA[N-1]
procedures = []
for i in range(1, N-1):
if AAA[i] > 0:
procedures.append((m, AAA[i]))
m -= AAA[i]
else:
procedures.append((M, AAA[i]))
M -= AAA[i]
procedures.append(... | 21 | 21 | 353 | 378 | N = int(eval(input()))
AAA = list(map(int, input().split()))
AAA.sort() # 昇順ソート
m = AAA[0]
M = AAA[N - 1]
ANS = []
for i in range(1, N - 1):
if AAA[i] > 0:
ANS.append((m, AAA[i]))
m -= AAA[i]
continue
ANS.append((M, AAA[i]))
M -= AAA[i]
ANS.append((M, m))
print((M - m))
for (x, y) i... | N = int(eval(input()))
AAA = list(map(int, input().split()))
AAA.sort()
m = AAA[0]
M = AAA[N - 1]
procedures = []
for i in range(1, N - 1):
if AAA[i] > 0:
procedures.append((m, AAA[i]))
m -= AAA[i]
else:
procedures.append((M, AAA[i]))
M -= AAA[i]
procedures.append((M, m))
print((... | false | 0 | [
"-AAA.sort() # 昇順ソート",
"+AAA.sort()",
"-ANS = []",
"+procedures = []",
"- ANS.append((m, AAA[i]))",
"+ procedures.append((m, AAA[i]))",
"- continue",
"- ANS.append((M, AAA[i]))",
"- M -= AAA[i]",
"-ANS.append((M, m))",
"+ else:",
"+ procedures.append((M, A... | false | 0.040497 | 0.119468 | 0.338978 | [
"s288318703",
"s555024668"
] |
u350248178 | p03163 | python | s249989183 | s689077446 | 652 | 216 | 181,512 | 16,344 | Accepted | Accepted | 66.87 | n,w=list(map(int,input().split()))
wv=[]
dp=[[0 for i in range(100010)]for j in range(110)]
for i in range(n):
a=[int(j) for j in input().split()]
wv.append(a)
from operator import itemgetter
wv.sort(key=itemgetter(0))
for i in range(n):
for j in range(w+1):
if j>=wv[i][0]:
... | n,W=[int(j) for j in input().split()]
wv=[[int(j) for j in input().split()]for i in range(n)]
import numpy as np
dp=np.zeros(W+1,dtype=np.int64)
for w,v in wv:
dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print((dp.max())) | 19 | 7 | 436 | 221 | n, w = list(map(int, input().split()))
wv = []
dp = [[0 for i in range(100010)] for j in range(110)]
for i in range(n):
a = [int(j) for j in input().split()]
wv.append(a)
from operator import itemgetter
wv.sort(key=itemgetter(0))
for i in range(n):
for j in range(w + 1):
if j >= wv[i][0]:
... | n, W = [int(j) for j in input().split()]
wv = [[int(j) for j in input().split()] for i in range(n)]
import numpy as np
dp = np.zeros(W + 1, dtype=np.int64)
for w, v in wv:
dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print((dp.max()))
| false | 63.157895 | [
"-n, w = list(map(int, input().split()))",
"-wv = []",
"-dp = [[0 for i in range(100010)] for j in range(110)]",
"-for i in range(n):",
"- a = [int(j) for j in input().split()]",
"- wv.append(a)",
"-from operator import itemgetter",
"+n, W = [int(j) for j in input().split()]",
"+wv = [[int(j) ... | false | 1.575825 | 0.202126 | 7.796251 | [
"s249989183",
"s689077446"
] |
u077291787 | p02558 | python | s503476220 | s754292048 | 419 | 378 | 142,888 | 144,920 | Accepted | Accepted | 9.79 | from typing import Set
class UnionFind:
"""Union-Find: O(α(N))"""
__slots__ = ["_data_size", "_first_idx", "_parents"]
def __init__(self, data_size: int, is_zero_origin: bool = True) -> None:
self._data_size = data_size
self._first_idx = 0 if is_zero_origin else 1
self... | class UnionFind:
"""Union-Find: O(α(N))"""
__slots__ = ["_data_size", "_first_idx", "_parents"]
def __init__(self, data_size: int, is_zero_origin: bool = True) -> None:
self._data_size = data_size
self._first_idx = 0 if is_zero_origin else 1
self._parents = [-1] * (data_siz... | 71 | 47 | 2,175 | 1,504 | from typing import Set
class UnionFind:
"""Union-Find: O(α(N))"""
__slots__ = ["_data_size", "_first_idx", "_parents"]
def __init__(self, data_size: int, is_zero_origin: bool = True) -> None:
self._data_size = data_size
self._first_idx = 0 if is_zero_origin else 1
self._parents =... | class UnionFind:
"""Union-Find: O(α(N))"""
__slots__ = ["_data_size", "_first_idx", "_parents"]
def __init__(self, data_size: int, is_zero_origin: bool = True) -> None:
self._data_size = data_size
self._first_idx = 0 if is_zero_origin else 1
self._parents = [-1] * (data_size + self... | false | 33.802817 | [
"-from typing import Set",
"-",
"-",
"- def __getitem__(self, x: int) -> int:",
"- \"\"\"Find the group (root) of vertex x.\"\"\"",
"+ def _find(self, x: int) -> int:",
"- self._parents[x] = self[self._parents[x]]",
"+ self._parents[x] = self._find(self._parents[x])",
"-",... | false | 0.088055 | 0.047376 | 1.858632 | [
"s503476220",
"s754292048"
] |
u394244719 | p02947 | python | s704817248 | s149624681 | 797 | 265 | 115,456 | 22,132 | Accepted | Accepted | 66.75 | import sys
import math
inint = lambda: int(sys.stdin.readline())
inintm = lambda: list(map(int, sys.stdin.readline().split()))
inintl = lambda: list(inintm())
instrm = lambda: list(map(str, sys.stdin.readline().split()))
instrl = lambda: list(instrm())
n = inint()
z = {():0}
ans = 0
def combinations... | import sys
import math
inint = lambda: int(sys.stdin.readline())
inintm = lambda: list(map(int, sys.stdin.readline().split()))
inintl = lambda: list(inintm())
instrm = lambda: list(map(str, sys.stdin.readline().split()))
instrl = lambda: list(instrm())
n = inint()
z = {}
ans = 0
for i in range(n):
... | 35 | 26 | 688 | 458 | import sys
import math
inint = lambda: int(sys.stdin.readline())
inintm = lambda: list(map(int, sys.stdin.readline().split()))
inintl = lambda: list(inintm())
instrm = lambda: list(map(str, sys.stdin.readline().split()))
instrl = lambda: list(instrm())
n = inint()
z = {(): 0}
ans = 0
def combinations(n, r):
if n... | import sys
import math
inint = lambda: int(sys.stdin.readline())
inintm = lambda: list(map(int, sys.stdin.readline().split()))
inintl = lambda: list(inintm())
instrm = lambda: list(map(str, sys.stdin.readline().split()))
instrl = lambda: list(instrm())
n = inint()
z = {}
ans = 0
for i in range(n):
s = "".join(sort... | false | 25.714286 | [
"-z = {(): 0}",
"+z = {}",
"-",
"-",
"-def combinations(n, r):",
"- if n < r:",
"- return 0",
"- else:",
"- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"-",
"-",
"- c = [0] * 123",
"- s = eval(input())",
"- for j in range(len(s)):"... | false | 0.081785 | 0.060247 | 1.357485 | [
"s704817248",
"s149624681"
] |
u991567869 | p02732 | python | s925505706 | s104019796 | 202 | 182 | 39,352 | 38,972 | Accepted | Accepted | 9.9 | def ban():
from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
b = Counter(a)
total = sum(i*(i - 1)//2 for i in list(b.values()))
ans = [(total - (b[i] - 1)) for i in a]
return "\n".join(map(str, ans))
print((ban())) | def ban():
n = int(eval(input()))
a = list(map(int, input().split()))
d = {}
total = 0
for i in a:
if i not in d:
d[i] = 1
else:
total += d[i]
d[i] += 1
ans = [total - (d[i] - 1) for i in a]
return "\n".join(map(str, ans))
... | 11 | 17 | 281 | 328 | def ban():
from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
b = Counter(a)
total = sum(i * (i - 1) // 2 for i in list(b.values()))
ans = [(total - (b[i] - 1)) for i in a]
return "\n".join(map(str, ans))
print((ban()))
| def ban():
n = int(eval(input()))
a = list(map(int, input().split()))
d = {}
total = 0
for i in a:
if i not in d:
d[i] = 1
else:
total += d[i]
d[i] += 1
ans = [total - (d[i] - 1) for i in a]
return "\n".join(map(str, ans))
print((ban()))
| false | 35.294118 | [
"- from collections import Counter",
"-",
"- b = Counter(a)",
"- total = sum(i * (i - 1) // 2 for i in list(b.values()))",
"- ans = [(total - (b[i] - 1)) for i in a]",
"+ d = {}",
"+ total = 0",
"+ for i in a:",
"+ if i not in d:",
"+ d[i] = 1",
"+ e... | false | 0.085102 | 0.033263 | 2.55843 | [
"s925505706",
"s104019796"
] |
u864197622 | p02798 | python | s417870934 | s001746507 | 769 | 544 | 50,520 | 50,520 | Accepted | Accepted | 29.26 | N = int(eval(input()))
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
AB = sorted(list(set(A + B)))
D = {ab: i+1 for i, ab in enumerate(AB)}
A = [D[a] for a in A]
B = [D[a] for a in B]
def chk(L):
NN = 5
BIT=[0] * (2**NN+1)
def addbit(i):
while i <= 2**NN:
... | N = int(eval(input()))
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
AB = sorted(list(set(A + B)))
D = {ab: i+1 for i, ab in enumerate(AB)}
A = [D[a] for a in A]
B = [D[a] for a in B]
ans = 1 << 100
for m in range(1<<N):
b = bin(m)
if b[::2].count("1") != b[1::2].count(... | 46 | 31 | 1,162 | 895 | N = int(eval(input()))
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
AB = sorted(list(set(A + B)))
D = {ab: i + 1 for i, ab in enumerate(AB)}
A = [D[a] for a in A]
B = [D[a] for a in B]
def chk(L):
NN = 5
BIT = [0] * (2**NN + 1)
def addbit(i):
while i <= 2**NN:
... | N = int(eval(input()))
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
AB = sorted(list(set(A + B)))
D = {ab: i + 1 for i, ab in enumerate(AB)}
A = [D[a] for a in A]
B = [D[a] for a in B]
ans = 1 << 100
for m in range(1 << N):
b = bin(m)
if b[::2].count("1") != b[1::2].count("1"):
... | false | 32.608696 | [
"-",
"-",
"-def chk(L):",
"- NN = 5",
"- BIT = [0] * (2**NN + 1)",
"-",
"- def addbit(i):",
"- while i <= 2**NN:",
"- BIT[i] += 1",
"- i += i & (-i)",
"-",
"- def getsum(i):",
"- ret = 0",
"- while i != 0:",
"- ret += BIT[... | false | 0.036685 | 0.035715 | 1.027161 | [
"s417870934",
"s001746507"
] |
u072053884 | p02257 | python | s217739372 | s964747100 | 310 | 40 | 7,736 | 7,696 | Accepted | Accepted | 87.1 | def is_prime(x):
if x == 2:
return 1
elif x % 2 == 0:
return 0
l = x ** 0.5
for i in range(3, int(x ** 0.5) + 1, 2):
if x % i == 0:
return 0
return 1
import sys
def solve():
file_input = sys.stdin
N = file_input.readline()
cnt = 0
... | # Fermat's little theorem
def is_prime(x):
if x == 2:
return 1
elif x % 2 == 0:
return 0
else:
return pow(2, x - 1, x) == 1
import sys
def solve():
file_input = sys.stdin
N = file_input.readline()
cnt = 0
for n in map(int, file_input):
cnt +=... | 22 | 20 | 402 | 359 | def is_prime(x):
if x == 2:
return 1
elif x % 2 == 0:
return 0
l = x**0.5
for i in range(3, int(x**0.5) + 1, 2):
if x % i == 0:
return 0
return 1
import sys
def solve():
file_input = sys.stdin
N = file_input.readline()
cnt = 0
for l in file_inp... | # Fermat's little theorem
def is_prime(x):
if x == 2:
return 1
elif x % 2 == 0:
return 0
else:
return pow(2, x - 1, x) == 1
import sys
def solve():
file_input = sys.stdin
N = file_input.readline()
cnt = 0
for n in map(int, file_input):
cnt += is_prime(n)
... | false | 9.090909 | [
"+# Fermat's little theorem",
"- l = x**0.5",
"- for i in range(3, int(x**0.5) + 1, 2):",
"- if x % i == 0:",
"- return 0",
"- return 1",
"+ else:",
"+ return pow(2, x - 1, x) == 1",
"- for l in file_input:",
"- cnt += is_prime(int(l))",
"+ for n... | false | 0.080822 | 0.035517 | 2.275597 | [
"s217739372",
"s964747100"
] |
u388927326 | p03575 | python | s006237497 | s850942344 | 119 | 28 | 3,572 | 3,572 | Accepted | Accepted | 76.47 | #!/usr/bin/env python3
from copy import deepcopy
def dfs(x, adj, visited):
for y, flag in enumerate(adj[x]):
if flag and y not in visited:
visited.add(y)
dfs(y, adj, visited)
def is_simply_connected(adj):
n = len(adj)
visited = {0}
dfs(0, adj, visited)
... | #!/usr/bin/env python3
from copy import deepcopy
def dfs(x, adj, visited):
for y, flag in enumerate(adj[x]):
if flag and y not in visited:
visited.add(y)
dfs(y, adj, visited)
def is_simply_connected(adj):
n = len(adj)
visited = {0} # O(log n). Use list instead... | 38 | 37 | 882 | 903 | #!/usr/bin/env python3
from copy import deepcopy
def dfs(x, adj, visited):
for y, flag in enumerate(adj[x]):
if flag and y not in visited:
visited.add(y)
dfs(y, adj, visited)
def is_simply_connected(adj):
n = len(adj)
visited = {0}
dfs(0, adj, visited)
return len(... | #!/usr/bin/env python3
from copy import deepcopy
def dfs(x, adj, visited):
for y, flag in enumerate(adj[x]):
if flag and y not in visited:
visited.add(y)
dfs(y, adj, visited)
def is_simply_connected(adj):
n = len(adj)
visited = {0} # O(log n). Use list instead.
dfs(0... | false | 2.631579 | [
"- visited = {0}",
"+ visited = {0} # O(log n). Use list instead.",
"- adjc = deepcopy(adj)",
"- adjc[a][b] = False",
"- adjc[b][a] = False",
"- if not is_simply_connected(adjc):",
"+ adj[a][b] = adj[b][a] = False",
"+ if not is_simply_connected(adj):",... | false | 0.120053 | 0.038114 | 3.149839 | [
"s006237497",
"s850942344"
] |
u936985471 | p03503 | python | s417370238 | s097107440 | 320 | 96 | 3,064 | 3,064 | Accepted | Accepted | 70 | n=int(eval(input()))
f=[0]*n
for i in range(n):
x=list(map(int,input().split()))
for j in range(len(x)):
if x[j]==1:
f[i]+=1<<j
p=[[0 for j in range(10)] for i in range(n)]
for i in range(n):
p[i]=list(map(int,input().split()))
ans=10**9*(-1)-1
for i in range(1,2**10):
pro=0
for... | # 曜日と時間帯の組み合わせを1111111111の10ビットで全探索
import sys
readline = sys.stdin.readline
N = int(readline())
F = [None] * N
for i in range(N):
F[i] = int(readline().rstrip().replace(" ",""),2)
P = [None] * N
for i in range(N):
P[i] = list(map(int,readline().split()))
ans = -(10 ** 10)
for i in range(1,... | 25 | 28 | 492 | 580 | n = int(eval(input()))
f = [0] * n
for i in range(n):
x = list(map(int, input().split()))
for j in range(len(x)):
if x[j] == 1:
f[i] += 1 << j
p = [[0 for j in range(10)] for i in range(n)]
for i in range(n):
p[i] = list(map(int, input().split()))
ans = 10**9 * (-1) - 1
for i in range(1,... | # 曜日と時間帯の組み合わせを1111111111の10ビットで全探索
import sys
readline = sys.stdin.readline
N = int(readline())
F = [None] * N
for i in range(N):
F[i] = int(readline().rstrip().replace(" ", ""), 2)
P = [None] * N
for i in range(N):
P[i] = list(map(int, readline().split()))
ans = -(10**10)
for i in range(1, 2**10):
# jois... | false | 10.714286 | [
"-n = int(eval(input()))",
"-f = [0] * n",
"-for i in range(n):",
"- x = list(map(int, input().split()))",
"- for j in range(len(x)):",
"- if x[j] == 1:",
"- f[i] += 1 << j",
"-p = [[0 for j in range(10)] for i in range(n)]",
"-for i in range(n):",
"- p[i] = list(map(int... | false | 0.044589 | 0.036494 | 1.22182 | [
"s417370238",
"s097107440"
] |
u922449550 | p03018 | python | s881956615 | s064237818 | 173 | 63 | 9,392 | 11,460 | Accepted | Accepted | 63.58 | S = eval(input())
N = len(S)
ans = num_a = 0
pre_is_a = True
i = 0
while i < N:
s = S[i]
if s == 'A':
pre_is_a = True
num_a += 1
elif s == 'B' and pre_is_a:
num_bc = 0
flag = True
for j in range(i, N-1, 2):
if S[j:j+2] == 'BC':
... | S = eval(input())
S = S.replace('BC', 'D')
S = S.replace('B', 'C')
S = S.split('C')
ans = 0
def count_inv(s):
res = num = 0
for si in s:
if si == 'A':
num += 1
else:
res += num
return res
for s in S:
ans += count_inv(s)
print(ans) | 36 | 20 | 694 | 277 | S = eval(input())
N = len(S)
ans = num_a = 0
pre_is_a = True
i = 0
while i < N:
s = S[i]
if s == "A":
pre_is_a = True
num_a += 1
elif s == "B" and pre_is_a:
num_bc = 0
flag = True
for j in range(i, N - 1, 2):
if S[j : j + 2] == "BC":
num_bc... | S = eval(input())
S = S.replace("BC", "D")
S = S.replace("B", "C")
S = S.split("C")
ans = 0
def count_inv(s):
res = num = 0
for si in s:
if si == "A":
num += 1
else:
res += num
return res
for s in S:
ans += count_inv(s)
print(ans)
| false | 44.444444 | [
"-N = len(S)",
"-ans = num_a = 0",
"-pre_is_a = True",
"-i = 0",
"-while i < N:",
"- s = S[i]",
"- if s == \"A\":",
"- pre_is_a = True",
"- num_a += 1",
"- elif s == \"B\" and pre_is_a:",
"- num_bc = 0",
"- flag = True",
"- for j in range(i, N - 1,... | false | 0.04189 | 0.056208 | 0.745273 | [
"s881956615",
"s064237818"
] |
u339550873 | p03110 | python | s318830444 | s034840388 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(eval(input()))
answer = 0
for _ in range(N):
x,u = input().split()
if u == "JPY":
money = float(x)
else:
money = float(x)*380000.0
answer += money
print(answer)
| #! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(eval(input()))
answer = 0
for _ in range(N):
x,u = input().split()
if u == "JPY":
money = int(x)
else:
money = float(x)*380000.0
answer += money
print(answer)
| 15 | 14 | 261 | 257 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(eval(input()))
answer = 0
for _ in range(N):
x, u = input().split()
if u == "JPY":
money = float(x)
else:
money = float(x) * 380000.0
answer += money
print(answer)
| #! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(eval(input()))
answer = 0
for _ in range(N):
x, u = input().split()
if u == "JPY":
money = int(x)
else:
money = float(x) * 380000.0
answer += money
print(answer)
| false | 6.666667 | [
"- money = float(x)",
"+ money = int(x)"
] | false | 0.042013 | 0.056693 | 0.741068 | [
"s318830444",
"s034840388"
] |
u467175809 | p01300 | python | s903846172 | s741838311 | 1,220 | 880 | 4,692 | 4,932 | Accepted | Accepted | 27.87 | while True:
S=input()
if S=='0':break
m=[1]+[0 for i in range(10)]
d=A=0
e=1
S=reversed(S)
for c in S:
d=(d+int(c)*e)%11
if int(c)!=0:A+=m[d]
m[d]+=1
e*=-1
print(A)
| while True:
S = input()[::-1]
if S == '0' : break
m = [1] + [0] * 10
diff = ans = 0
even = 1
for c in S:
num = int(c)
diff = (diff + num * even) % 11
if num : ans += m[diff]
m[diff] += 1
even *= -1
print(ans)
| 13 | 13 | 198 | 292 | while True:
S = input()
if S == "0":
break
m = [1] + [0 for i in range(10)]
d = A = 0
e = 1
S = reversed(S)
for c in S:
d = (d + int(c) * e) % 11
if int(c) != 0:
A += m[d]
m[d] += 1
e *= -1
print(A)
| while True:
S = input()[::-1]
if S == "0":
break
m = [1] + [0] * 10
diff = ans = 0
even = 1
for c in S:
num = int(c)
diff = (diff + num * even) % 11
if num:
ans += m[diff]
m[diff] += 1
even *= -1
print(ans)
| false | 0 | [
"- S = input()",
"+ S = input()[::-1]",
"- m = [1] + [0 for i in range(10)]",
"- d = A = 0",
"- e = 1",
"- S = reversed(S)",
"+ m = [1] + [0] * 10",
"+ diff = ans = 0",
"+ even = 1",
"- d = (d + int(c) * e) % 11",
"- if int(c) != 0:",
"- A +=... | false | 0.076463 | 0.037527 | 2.037538 | [
"s903846172",
"s741838311"
] |
u366886346 | p02844 | python | s548080427 | s171632613 | 275 | 98 | 9,232 | 9,356 | Accepted | Accepted | 64.36 | n=int(eval(input()))
s=list(eval(input()))
fa=[n+1]*10
la=[-1]*10
for i in range(n):
s[i]=int(s[i])
if fa[s[i]]>n:
fa[s[i]]=i
la[s[i]]=i
ans=0
for i in range(10):
for j in range(10):
if fa[i]<la[j]:
num=[0]*10
for k in range(fa[i]+1,la[j]):
... | n=int(eval(input()))
s=list(eval(input()))
num=list(range(10))
for i in range(10):
num[i]=str(num[i])
ans=0
for i in range(n-2):
if len(num)==0:
break
if s[i] in num:
num2=[str(_) for _ in range(10)]
num.remove(s[i])
for j in range(i+1,n):
if len(num2... | 18 | 19 | 371 | 454 | n = int(eval(input()))
s = list(eval(input()))
fa = [n + 1] * 10
la = [-1] * 10
for i in range(n):
s[i] = int(s[i])
if fa[s[i]] > n:
fa[s[i]] = i
la[s[i]] = i
ans = 0
for i in range(10):
for j in range(10):
if fa[i] < la[j]:
num = [0] * 10
for k in range(fa[i] + 1... | n = int(eval(input()))
s = list(eval(input()))
num = list(range(10))
for i in range(10):
num[i] = str(num[i])
ans = 0
for i in range(n - 2):
if len(num) == 0:
break
if s[i] in num:
num2 = [str(_) for _ in range(10)]
num.remove(s[i])
for j in range(i + 1, n):
if le... | false | 5.263158 | [
"-fa = [n + 1] * 10",
"-la = [-1] * 10",
"-for i in range(n):",
"- s[i] = int(s[i])",
"- if fa[s[i]] > n:",
"- fa[s[i]] = i",
"- la[s[i]] = i",
"+num = list(range(10))",
"+for i in range(10):",
"+ num[i] = str(num[i])",
"-for i in range(10):",
"- for j in range(10):",
"... | false | 0.053279 | 0.036445 | 1.461886 | [
"s548080427",
"s171632613"
] |
u254871849 | p02844 | python | s987487248 | s513517764 | 29 | 26 | 3,956 | 3,772 | Accepted | Accepted | 10.34 | import sys
from itertools import product
from string import digits
def main():
n, s = sys.stdin.read().split()
n = int(n)
cand = list(''.join(p) for p in product(digits, repeat=3))
res = set()
for c in cand:
i = s.find(c[0])
if i == -1:
continue
... | import sys
from string import digits
def main():
n, s = sys.stdin.read().split()
res = []
for i in digits:
x = s.find(i)
if x == -1:
continue
for j in digits:
y = s.find(j, x+1)
if y == -1:
continue
for ... | 29 | 25 | 576 | 531 | import sys
from itertools import product
from string import digits
def main():
n, s = sys.stdin.read().split()
n = int(n)
cand = list("".join(p) for p in product(digits, repeat=3))
res = set()
for c in cand:
i = s.find(c[0])
if i == -1:
continue
j = s.find(c[1],... | import sys
from string import digits
def main():
n, s = sys.stdin.read().split()
res = []
for i in digits:
x = s.find(i)
if x == -1:
continue
for j in digits:
y = s.find(j, x + 1)
if y == -1:
continue
for k in digits:
... | false | 13.793103 | [
"-from itertools import product",
"- n = int(n)",
"- cand = list(\"\".join(p) for p in product(digits, repeat=3))",
"- res = set()",
"- for c in cand:",
"- i = s.find(c[0])",
"- if i == -1:",
"+ res = []",
"+ for i in digits:",
"+ x = s.find(i)",
"+ ... | false | 0.138676 | 0.054518 | 2.54367 | [
"s987487248",
"s513517764"
] |
u186082958 | p02386 | python | s492550061 | s457385090 | 4,290 | 120 | 11,812 | 11,816 | Accepted | Accepted | 97.2 | class Dice:
def __init__(self):
self.u=1
self.w=2
self.s=3
self.e=4
self.n=5
self.d=6
self.dic={"W":0,"S":1,"E":2,"N":3}
def __init__(self,u,w,s,e,n,d):
self.u=u
self.w=w
self.s=s
self.e=e
self.n... | class Dice:
def __init__(self):
self.u=1
self.w=2
self.s=3
self.e=4
self.n=5
self.d=6
self.dic={"W":0,"S":1,"E":2,"N":3}
def __init__(self,u,w,s,e,n,d):
self.u=u
self.w=w
self.s=s
self.e=e
self.n... | 66 | 68 | 1,619 | 1,656 | class Dice:
def __init__(self):
self.u = 1
self.w = 2
self.s = 3
self.e = 4
self.n = 5
self.d = 6
self.dic = {"W": 0, "S": 1, "E": 2, "N": 3}
def __init__(self, u, w, s, e, n, d):
self.u = u
self.w = w
self.s = s
self.e = e... | class Dice:
def __init__(self):
self.u = 1
self.w = 2
self.s = 3
self.e = 4
self.n = 5
self.d = 6
self.dic = {"W": 0, "S": 1, "E": 2, "N": 3}
def __init__(self, u, w, s, e, n, d):
self.u = u
self.w = w
self.s = s
self.e = e... | false | 2.941176 | [
"+ if ~ans:",
"+ break"
] | false | 0.048714 | 0.04122 | 1.181822 | [
"s492550061",
"s457385090"
] |
u891504219 | p02791 | python | s765403210 | s642023385 | 95 | 76 | 24,744 | 26,012 | Accepted | Accepted | 20 | N = int(eval(input()))
P_list = list(map(int,input().split()))
i_num = 0
min_P = P_list[0]
for p in P_list:
if p <= min_P:
min_P = p
i_num += 1
print(i_num) | def main():
N = int(eval(input()))
P_list = list(map(int,input().split()))
i_num = 0
min_P = P_list[0]
for p in P_list:
if p <= min_P:
min_P = p
i_num += 1
print(i_num)
if __name__ == "__main__":
main() | 9 | 13 | 178 | 269 | N = int(eval(input()))
P_list = list(map(int, input().split()))
i_num = 0
min_P = P_list[0]
for p in P_list:
if p <= min_P:
min_P = p
i_num += 1
print(i_num)
| def main():
N = int(eval(input()))
P_list = list(map(int, input().split()))
i_num = 0
min_P = P_list[0]
for p in P_list:
if p <= min_P:
min_P = p
i_num += 1
print(i_num)
if __name__ == "__main__":
main()
| false | 30.769231 | [
"-N = int(eval(input()))",
"-P_list = list(map(int, input().split()))",
"-i_num = 0",
"-min_P = P_list[0]",
"-for p in P_list:",
"- if p <= min_P:",
"- min_P = p",
"- i_num += 1",
"-print(i_num)",
"+def main():",
"+ N = int(eval(input()))",
"+ P_list = list(map(int, inpu... | false | 0.04694 | 0.047536 | 0.987465 | [
"s765403210",
"s642023385"
] |
u970899068 | p02685 | python | s351063127 | s243961007 | 365 | 284 | 167,868 | 168,120 | Accepted | Accepted | 22.19 | # 二項係数のmod (大量のmod計算が必要なとき)
def cmb(n, r, mod):
if (r < 0 or r > n):
return 0
r=min(r,n-r)
return g1[n] * g2[r] * g2[n - r] % mod
mod=998244353
N = 10 ** 6 # 出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((... | # 二項係数のmod (大量のmod計算が必要なとき)
def cmb(n, r, mod):
if (r < 0 or r > n):
return 0
r=min(r,n-r)
return g1[n] * g2[r] * g2[n - r] % mod
mod=998244353
N = 10 ** 6 # 出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((... | 33 | 38 | 660 | 741 | # 二項係数のmod (大量のmod計算が必要なとき)
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 998244353
N = 10**6 # 出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) ... | # 二項係数のmod (大量のmod計算が必要なとき)
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 998244353
N = 10**6 # 出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N + 1):
g1.append((g1[-1] * i) ... | false | 13.157895 | [
"-for i in range(k + 1):",
"+for i in range(k, -1, -1):",
"- v1 = m * pow(m - 1, n - i - 1, mod)",
"+ if i == k:",
"+ v1 = m * pow(m - 1, n - i - 1, mod)",
"+ else:",
"+ v1 *= m - 1",
"+ v1 %= mod"
] | false | 0.00693 | 1.662284 | 0.004169 | [
"s351063127",
"s243961007"
] |
u879870653 | p03835 | python | s459543164 | s646660606 | 1,621 | 1,473 | 3,316 | 2,940 | Accepted | Accepted | 9.13 | ans = 0
k,s = list(map(int,input().split()))
for x in range(k+1) :
for y in range(k+1) :
z = s - (x+y)
if z >= 0 and z <= k :
ans += 1
print(ans)
| K,S = list(map(int,input().split()))
ans = 0
for x in range(K+1) :
for y in range(K+1) :
z = S-x-y
if 0 <= z <= K :
ans += 1
print(ans) | 10 | 8 | 195 | 168 | ans = 0
k, s = list(map(int, input().split()))
for x in range(k + 1):
for y in range(k + 1):
z = s - (x + y)
if z >= 0 and z <= k:
ans += 1
print(ans)
| K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z <= K:
ans += 1
print(ans)
| false | 20 | [
"+K, S = list(map(int, input().split()))",
"-k, s = list(map(int, input().split()))",
"-for x in range(k + 1):",
"- for y in range(k + 1):",
"- z = s - (x + y)",
"- if z >= 0 and z <= k:",
"+for x in range(K + 1):",
"+ for y in range(K + 1):",
"+ z = S - x - y",
"+ ... | false | 0.123056 | 0.039077 | 3.149071 | [
"s459543164",
"s646660606"
] |
u492447501 | p02923 | python | s500284898 | s895846600 | 81 | 67 | 14,252 | 14,252 | Accepted | Accepted | 17.28 | N = int(eval(input()))
*H, = list(map(int, input().split()))
max = 0
count = 0
node = 0
while node<N-1:
if H[node]<H[node+1]:
if max < count:
max = count
count = 0
node = node + 1
continue
count = count + 1
node = node + 1
if max < count:
... | N = int(eval(input()))
*H, = list(map(int, input().split()))
max = 0
temp = 0
for h_index in range(0, len(H)-1, 1):
if H[h_index]>=H[h_index+1]:
temp = temp + 1
continue
if max < temp:
max = temp
temp = 0
if max < temp:
max = temp
print(max) | 20 | 17 | 331 | 288 | N = int(eval(input()))
(*H,) = list(map(int, input().split()))
max = 0
count = 0
node = 0
while node < N - 1:
if H[node] < H[node + 1]:
if max < count:
max = count
count = 0
node = node + 1
continue
count = count + 1
node = node + 1
if max < count:
max = count... | N = int(eval(input()))
(*H,) = list(map(int, input().split()))
max = 0
temp = 0
for h_index in range(0, len(H) - 1, 1):
if H[h_index] >= H[h_index + 1]:
temp = temp + 1
continue
if max < temp:
max = temp
temp = 0
if max < temp:
max = temp
print(max)
| false | 15 | [
"-count = 0",
"-node = 0",
"-while node < N - 1:",
"- if H[node] < H[node + 1]:",
"- if max < count:",
"- max = count",
"- count = 0",
"- node = node + 1",
"+temp = 0",
"+for h_index in range(0, len(H) - 1, 1):",
"+ if H[h_index] >= H[h_index + 1]:",
"+ ... | false | 0.038973 | 0.039298 | 0.991754 | [
"s500284898",
"s895846600"
] |
u223663729 | p02838 | python | s670667694 | s461383522 | 1,885 | 239 | 49,232 | 65,676 | Accepted | Accepted | 87.32 | N, *A = list(map(int, open(0).read().split()))
mod = 10**9 + 7
ans = 0
for i in range(60):
mask = 1 << i
cnt = 0
for a in A:
if a & mask:
cnt += 1
x = cnt * (N-cnt)
x *= mask % mod
ans += x
ans %= mod
print(ans) | import numpy as np
N, *A = list(map(int, open(0).read().split()))
A = np.array(A, dtype=np.int64)
mod = 10**9 + 7
ans = 0
for i in range(60):
mask = 1 << i
cnt = np.count_nonzero(A&mask)
x = cnt * (N-cnt)
x *= mask % mod
ans += x
ans %= mod
print(ans) | 16 | 15 | 270 | 285 | N, *A = list(map(int, open(0).read().split()))
mod = 10**9 + 7
ans = 0
for i in range(60):
mask = 1 << i
cnt = 0
for a in A:
if a & mask:
cnt += 1
x = cnt * (N - cnt)
x *= mask % mod
ans += x
ans %= mod
print(ans)
| import numpy as np
N, *A = list(map(int, open(0).read().split()))
A = np.array(A, dtype=np.int64)
mod = 10**9 + 7
ans = 0
for i in range(60):
mask = 1 << i
cnt = np.count_nonzero(A & mask)
x = cnt * (N - cnt)
x *= mask % mod
ans += x
ans %= mod
print(ans)
| false | 6.25 | [
"+import numpy as np",
"+",
"+A = np.array(A, dtype=np.int64)",
"- cnt = 0",
"- for a in A:",
"- if a & mask:",
"- cnt += 1",
"+ cnt = np.count_nonzero(A & mask)"
] | false | 0.084793 | 0.266313 | 0.318396 | [
"s670667694",
"s461383522"
] |
u843482581 | p03478 | python | s801741759 | s327169510 | 32 | 29 | 9,132 | 9,112 | Accepted | Accepted | 9.38 | N, A, B = list(map(int, input().split()))
Sum = 0
for i in range(N):
o = (i+1)//10000
a = (i+1)%10000//1000
b = (i+1)%1000//100
c = (i+1)%100//10
d = (i+1)%10
e= o+a+b+c+d
if e >= A and e <= B:
Sum = Sum + (i+1)
print(Sum) | def FindSumOfDigits(n):
Sum = 0
while n>0:
Sum += n%10
n //= 10
return Sum
N, A, B = list(map(int, input().split()))
total = 0
for i in range(N):
Sum = FindSumOfDigits(i+1)
if A <= Sum and Sum <= B:
total += i+1
print(total)
| 14 | 15 | 249 | 257 | N, A, B = list(map(int, input().split()))
Sum = 0
for i in range(N):
o = (i + 1) // 10000
a = (i + 1) % 10000 // 1000
b = (i + 1) % 1000 // 100
c = (i + 1) % 100 // 10
d = (i + 1) % 10
e = o + a + b + c + d
if e >= A and e <= B:
Sum = Sum + (i + 1)
print(Sum)
| def FindSumOfDigits(n):
Sum = 0
while n > 0:
Sum += n % 10
n //= 10
return Sum
N, A, B = list(map(int, input().split()))
total = 0
for i in range(N):
Sum = FindSumOfDigits(i + 1)
if A <= Sum and Sum <= B:
total += i + 1
print(total)
| false | 6.666667 | [
"+def FindSumOfDigits(n):",
"+ Sum = 0",
"+ while n > 0:",
"+ Sum += n % 10",
"+ n //= 10",
"+ return Sum",
"+",
"+",
"-Sum = 0",
"+total = 0",
"- o = (i + 1) // 10000",
"- a = (i + 1) % 10000 // 1000",
"- b = (i + 1) % 1000 // 100",
"- c = (i + 1) % 100 ... | false | 0.0464 | 0.04916 | 0.943872 | [
"s801741759",
"s327169510"
] |
u298297089 | p03001 | python | s838395408 | s132539835 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | W,H,x,y = list(map(int, input().split()))
print(('{:.9f}'.format(W*H/2), 1 if W / 2 == x and H / 2 == y else 0)) | w,h,x,y = list(map(int,input().split()))
print(('{:.12f}'.format(w * h / 2), 1 if w / 2 == x and h / 2 == y else 0))
| 3 | 2 | 107 | 110 | W, H, x, y = list(map(int, input().split()))
print(("{:.9f}".format(W * H / 2), 1 if W / 2 == x and H / 2 == y else 0))
| w, h, x, y = list(map(int, input().split()))
print(("{:.12f}".format(w * h / 2), 1 if w / 2 == x and h / 2 == y else 0))
| false | 33.333333 | [
"-W, H, x, y = list(map(int, input().split()))",
"-print((\"{:.9f}\".format(W * H / 2), 1 if W / 2 == x and H / 2 == y else 0))",
"+w, h, x, y = list(map(int, input().split()))",
"+print((\"{:.12f}\".format(w * h / 2), 1 if w / 2 == x and h / 2 == y else 0))"
] | false | 0.037554 | 0.038115 | 0.985269 | [
"s838395408",
"s132539835"
] |
u347640436 | p03108 | python | s397792795 | s511539480 | 657 | 420 | 39,988 | 43,440 | Accepted | Accepted | 36.07 | # Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += pare... | # Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += pare... | 37 | 37 | 764 | 764 | # Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += parent[i]
parent[i... | # Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += parent[i]
parent[i... | false | 0 | [
"-setrecursionlimit(10**5)",
"+setrecursionlimit(10**6)"
] | false | 0.036755 | 0.045019 | 0.816449 | [
"s397792795",
"s511539480"
] |
u690037900 | p03607 | python | s834448266 | s866881484 | 213 | 166 | 14,824 | 20,888 | Accepted | Accepted | 22.07 |
N=int(eval(input()))
S=set()
for i in range(N):
s=str(eval(input()))
S^={s}
print((len(S))) | from collections import Counter
n=int(eval(input()))
L=[int(eval(input())) for i in range(n)]
L1=Counter(L)
ans=0
for i in L1:
if L1[i]%2!=0:
ans+=1
print(ans) | 7 | 9 | 92 | 167 | N = int(eval(input()))
S = set()
for i in range(N):
s = str(eval(input()))
S ^= {s}
print((len(S)))
| from collections import Counter
n = int(eval(input()))
L = [int(eval(input())) for i in range(n)]
L1 = Counter(L)
ans = 0
for i in L1:
if L1[i] % 2 != 0:
ans += 1
print(ans)
| false | 22.222222 | [
"-N = int(eval(input()))",
"-S = set()",
"-for i in range(N):",
"- s = str(eval(input()))",
"- S ^= {s}",
"-print((len(S)))",
"+from collections import Counter",
"+",
"+n = int(eval(input()))",
"+L = [int(eval(input())) for i in range(n)]",
"+L1 = Counter(L)",
"+ans = 0",
"+for i in L1... | false | 0.04203 | 0.037705 | 1.114721 | [
"s834448266",
"s866881484"
] |
u186838327 | p03835 | python | s516266980 | s580232365 | 1,246 | 269 | 2,940 | 41,052 | Accepted | Accepted | 78.41 | 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) | k,s = list(map(int, input().split()))
ans = 0
for x in range(k+1):
for y in range(k+1):
z = s-x-y
if 0 <= z and z <= k:
ans += 1
print(ans)
| 7 | 8 | 156 | 173 | 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)
| k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if 0 <= z and z <= k:
ans += 1
print(ans)
| false | 12.5 | [
"- if 0 <= (s - x - y) <= k:",
"+ z = s - x - y",
"+ if 0 <= z and z <= k:"
] | false | 0.064173 | 0.040251 | 1.594304 | [
"s516266980",
"s580232365"
] |
u369133448 | p02947 | python | s135954863 | s553708203 | 1,656 | 1,491 | 23,160 | 23,228 | Accepted | Accepted | 9.96 | n=int(eval(input()))
dic={}
for i in range(n):
wk={}
s=eval(input())
for i in range(len(s)):
if s[i] in wk:
wk[s[i]]+=1
else:
wk[s[i]]=1
list=sorted(list(wk.items()),key=lambda x:x[0])
key="".join(map(str,list(dict(list).items())))
if key in dic:
dic[key]+=1
else:
... | n=int(eval(input()))
dic={}
for i in range(n):
wk={}
s=eval(input())
for i in range(len(s)):
if s[i] in wk:
wk[s[i]]+=1
else:
wk[s[i]]=1
list=sorted(list(wk.items()),key=lambda x:x[0])
key="".join(map(str,list))
if key in dic:
dic[key]+=1
else:
dic[key]=1
ans=0
... | 23 | 23 | 411 | 397 | n = int(eval(input()))
dic = {}
for i in range(n):
wk = {}
s = eval(input())
for i in range(len(s)):
if s[i] in wk:
wk[s[i]] += 1
else:
wk[s[i]] = 1
list = sorted(list(wk.items()), key=lambda x: x[0])
key = "".join(map(str, list(dict(list).items())))
if ke... | n = int(eval(input()))
dic = {}
for i in range(n):
wk = {}
s = eval(input())
for i in range(len(s)):
if s[i] in wk:
wk[s[i]] += 1
else:
wk[s[i]] = 1
list = sorted(list(wk.items()), key=lambda x: x[0])
key = "".join(map(str, list))
if key in dic:
di... | false | 0 | [
"- key = \"\".join(map(str, list(dict(list).items())))",
"+ key = \"\".join(map(str, list))"
] | false | 0.036005 | 0.037603 | 0.957504 | [
"s135954863",
"s553708203"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.