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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u353895424 | p02820 | python | s134157296 | s522669612 | 83 | 72 | 4,852 | 4,084 | Accepted | Accepted | 13.25 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
dp = [0] * n
commands = [""] * n
for i in range(n):
if t[i] == "r":
commands[i] = "p"
dp[i] = p
elif t[i] == "s":
commands[i] = "r"
dp[i] = r
elif t[i] == "p":
... | """
r > p
s > r
p > s
"""
n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
ans = 0
hand = [""] * n
for i in range(n):
if i < k:
if t[i] == "r":
ans += p
hand[i] = "p"
elif t[i] == "s":
ans += r
... | 24 | 43 | 477 | 929 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
dp = [0] * n
commands = [""] * n
for i in range(n):
if t[i] == "r":
commands[i] = "p"
dp[i] = p
elif t[i] == "s":
commands[i] = "r"
dp[i] = r
elif t[i] == "p":
commands[... | """
r > p
s > r
p > s
"""
n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
ans = 0
hand = [""] * n
for i in range(n):
if i < k:
if t[i] == "r":
ans += p
hand[i] = "p"
elif t[i] == "s":
ans += r
hand[i] ... | false | 44.186047 | [
"+\"\"\"",
"+r > p",
"+s > r",
"+p > s",
"+\"\"\"",
"-dp = [0] * n",
"-commands = [\"\"] * n",
"+ans = 0",
"+hand = [\"\"] * n",
"- if t[i] == \"r\":",
"- commands[i] = \"p\"",
"- dp[i] = p",
"- elif t[i] == \"s\":",
"- commands[i] = \"r\"",
"- dp[i] = r... | false | 0.036343 | 0.041664 | 0.872296 | [
"s134157296",
"s522669612"
] |
u790710233 | p02623 | python | s715192985 | s586066068 | 264 | 202 | 48,420 | 48,308 | Accepted | Accepted | 23.48 | from itertools import accumulate
import bisect
n, m, k = list(map(int, input().split()))
Acum = [0]+list(accumulate(list(map(int, input().split()))))
Bcum = [0]+list(accumulate(list(map(int, input().split()))))
ans = 0
for a in range(n+1):
if k-Acum[a] < 0:
break
b = bisect.bisect_right(Bcum,... | from itertools import accumulate
n, m, k = list(map(int, input().split()))
Acum = [0]+list(accumulate(list(map(int, input().split()))))
Bcum = [0]+list(accumulate(list(map(int, input().split()))))
ans = 0
b = m
for a in range(n+1):
if k < Acum[a]:
break
while k < Acum[a]+Bcum[b]:
b -... | 14 | 15 | 366 | 356 | from itertools import accumulate
import bisect
n, m, k = list(map(int, input().split()))
Acum = [0] + list(accumulate(list(map(int, input().split()))))
Bcum = [0] + list(accumulate(list(map(int, input().split()))))
ans = 0
for a in range(n + 1):
if k - Acum[a] < 0:
break
b = bisect.bisect_right(Bcum, k... | from itertools import accumulate
n, m, k = list(map(int, input().split()))
Acum = [0] + list(accumulate(list(map(int, input().split()))))
Bcum = [0] + list(accumulate(list(map(int, input().split()))))
ans = 0
b = m
for a in range(n + 1):
if k < Acum[a]:
break
while k < Acum[a] + Bcum[b]:
b -= 1... | false | 6.666667 | [
"-import bisect",
"+b = m",
"- if k - Acum[a] < 0:",
"+ if k < Acum[a]:",
"- b = bisect.bisect_right(Bcum, k - Acum[a]) - 1",
"+ while k < Acum[a] + Bcum[b]:",
"+ b -= 1"
] | false | 0.036945 | 0.070725 | 0.522379 | [
"s715192985",
"s586066068"
] |
u848535504 | p02945 | python | s747568193 | s009874199 | 31 | 27 | 9,004 | 9,140 | Accepted | Accepted | 12.9 | A,B = list(map(int,input().split()))
print((max(A+B,A-B,A*B))) | A,B = list(map(int,input().split()))
print((max(A+B,A*B,A-B))) | 3 | 3 | 57 | 57 | A, B = list(map(int, input().split()))
print((max(A + B, A - B, A * B)))
| A, B = list(map(int, input().split()))
print((max(A + B, A * B, A - B)))
| false | 0 | [
"-print((max(A + B, A - B, A * B)))",
"+print((max(A + B, A * B, A - B)))"
] | false | 0.049439 | 0.047664 | 1.037228 | [
"s747568193",
"s009874199"
] |
u905203728 | p02609 | python | s456040226 | s984843043 | 453 | 323 | 99,096 | 81,500 | Accepted | Accepted | 28.7 | def popcount(x):
return bin(x).count("1")
n=int(eval(input()))
x=eval(input())
num=int(x,2)
cnt=popcount(num)
A=[]
for i in range(n):
number=num
if x[i]=="1" and cnt==1:A.append(-1)
elif x[i]=="1":
number %=cnt-1
A.append((number-pow(2,n-i-1,cnt-1))%(cnt-1))
else:
... | def popcount(x):
return bin(x).count("1")
n=int(eval(input()))
x=eval(input())
num=int(x,2)
cnt=popcount(num)
mod1=num%(cnt+1)
mod2=num%(cnt-1) if cnt-1!=0 else 0
for i in range(n):
if x[i]=="0":
ans=(mod1+pow(2,n-i-1,cnt+1))%(cnt+1)
else:
if cnt-1==0:
print(... | 29 | 26 | 566 | 496 | def popcount(x):
return bin(x).count("1")
n = int(eval(input()))
x = eval(input())
num = int(x, 2)
cnt = popcount(num)
A = []
for i in range(n):
number = num
if x[i] == "1" and cnt == 1:
A.append(-1)
elif x[i] == "1":
number %= cnt - 1
A.append((number - pow(2, n - i - 1, cnt -... | def popcount(x):
return bin(x).count("1")
n = int(eval(input()))
x = eval(input())
num = int(x, 2)
cnt = popcount(num)
mod1 = num % (cnt + 1)
mod2 = num % (cnt - 1) if cnt - 1 != 0 else 0
for i in range(n):
if x[i] == "0":
ans = (mod1 + pow(2, n - i - 1, cnt + 1)) % (cnt + 1)
else:
if cnt ... | false | 10.344828 | [
"-A = []",
"+mod1 = num % (cnt + 1)",
"+mod2 = num % (cnt - 1) if cnt - 1 != 0 else 0",
"- number = num",
"- if x[i] == \"1\" and cnt == 1:",
"- A.append(-1)",
"- elif x[i] == \"1\":",
"- number %= cnt - 1",
"- A.append((number - pow(2, n - i - 1, cnt - 1)) % (cnt - 1))... | false | 0.034397 | 0.035675 | 0.964184 | [
"s456040226",
"s984843043"
] |
u499381410 | p03488 | python | s983174733 | s761833873 | 486 | 217 | 76,892 | 40,432 | Accepted | Accepted | 55.35 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_... | 62 | 58 | 1,686 | 1,630 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bise... | false | 6.451613 | [
"+from pprint import pprint",
"+from copy import deepcopy",
"+from operator import mul",
"+from pprint import pprint",
"-INF = float(\"inf\")",
"+sys.setrecursionlimit(2147483647)",
"+INF = 10**13",
"- return list(map(int, sys.stdin.readline().split()))",
"+ return list(map(int, sys.stdin.buff... | false | 0.040031 | 0.041101 | 0.973981 | [
"s983174733",
"s761833873"
] |
u001024152 | p03964 | python | s439468488 | s103498605 | 203 | 21 | 39,152 | 3,060 | Accepted | Accepted | 89.66 | N = int(eval(input()))
ratio = [tuple(map(int, input().split())) for _ in range(N)]
t,a = 1,1
for nt,na in ratio:
if nt<t or na<a:
r = max((t-1)//nt+1, (a-1)//na+1)
nt *= r
na *= r
t,a = nt,na
#print(t, a)
print((t+a))
| N = int(eval(input()))
ratio = [tuple(map(int, input().split())) for _ in range(N)]
t,a = 1,1
for nt,na in ratio:
if nt<t or na<a:
r = max(-(-t//nt), -(-a//na))
nt *= r
na *= r
t,a = nt,na
#print(t, a)
print((t+a))
| 12 | 12 | 259 | 255 | N = int(eval(input()))
ratio = [tuple(map(int, input().split())) for _ in range(N)]
t, a = 1, 1
for nt, na in ratio:
if nt < t or na < a:
r = max((t - 1) // nt + 1, (a - 1) // na + 1)
nt *= r
na *= r
t, a = nt, na
# print(t, a)
print((t + a))
| N = int(eval(input()))
ratio = [tuple(map(int, input().split())) for _ in range(N)]
t, a = 1, 1
for nt, na in ratio:
if nt < t or na < a:
r = max(-(-t // nt), -(-a // na))
nt *= r
na *= r
t, a = nt, na
# print(t, a)
print((t + a))
| false | 0 | [
"- r = max((t - 1) // nt + 1, (a - 1) // na + 1)",
"+ r = max(-(-t // nt), -(-a // na))"
] | false | 0.041184 | 0.037955 | 1.085084 | [
"s439468488",
"s103498605"
] |
u533039576 | p02603 | python | s185935579 | s823831206 | 118 | 31 | 73,288 | 9,212 | Accepted | Accepted | 73.73 | n = int(eval(input()))
a = [-1] + list(map(int, input().split()))
# dp[i] = (i+1)日目終了時点での金額の最大値
# dp[i+1] = max(dp[i], {dp[j] % a[k] + (dp[j] // a[k]) * a[l] | j<k<l<=i})
dp = [0] * (n + 1)
dp[0] = dp[1] = 1000
dp[2] = max(dp[0] % a[1] + (dp[0] // a[1]) * a[2], dp[1])
# print(a)
# print(dp)
for i in rang... | n = int(eval(input()))
a = [-1] + list(map(int, input().split()))
# dp[i] = (i+1)日目終了時点での金額の最大値
# dp[i] = max(dp[i-1], {dp[j-1] % a[j] + (dp[j-1] // a[j]) * a[i] | j<i})
dp = [0] * (n + 1)
dp[0] = dp[1] = 1000
dp[2] = max(dp[0] % a[1] + (dp[0] // a[1]) * a[2], dp[1])
for i in range(1, n + 1):
cand = dp[... | 21 | 16 | 558 | 455 | n = int(eval(input()))
a = [-1] + list(map(int, input().split()))
# dp[i] = (i+1)日目終了時点での金額の最大値
# dp[i+1] = max(dp[i], {dp[j] % a[k] + (dp[j] // a[k]) * a[l] | j<k<l<=i})
dp = [0] * (n + 1)
dp[0] = dp[1] = 1000
dp[2] = max(dp[0] % a[1] + (dp[0] // a[1]) * a[2], dp[1])
# print(a)
# print(dp)
for i in range(1, n + 1):
... | n = int(eval(input()))
a = [-1] + list(map(int, input().split()))
# dp[i] = (i+1)日目終了時点での金額の最大値
# dp[i] = max(dp[i-1], {dp[j-1] % a[j] + (dp[j-1] // a[j]) * a[i] | j<i})
dp = [0] * (n + 1)
dp[0] = dp[1] = 1000
dp[2] = max(dp[0] % a[1] + (dp[0] // a[1]) * a[2], dp[1])
for i in range(1, n + 1):
cand = dp[i - 1]
f... | false | 23.809524 | [
"-# dp[i+1] = max(dp[i], {dp[j] % a[k] + (dp[j] // a[k]) * a[l] | j<k<l<=i})",
"+# dp[i] = max(dp[i-1], {dp[j-1] % a[j] + (dp[j-1] // a[j]) * a[i] | j<i})",
"-# print(a)",
"-# print(dp)",
"- for j in range(i):",
"- for k in range(j + 1, i):",
"- for l in range(k + 1, i + 1):",
"- ... | false | 0.041608 | 0.077326 | 0.538093 | [
"s185935579",
"s823831206"
] |
u896847891 | p02958 | python | s543867678 | s975159126 | 20 | 17 | 2,940 | 2,940 | Accepted | Accepted | 15 | n=int(eval(input()))
a=list(map(int,input().split()))
c=0
for i in range(n-1):
if a[i]!=i+1:
c+=1
print(("YES" if c<3 else "NO"))
| n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
if p[i] != i+1:
cnt += 1
print(("YES" if cnt < 3 else "NO")) | 8 | 9 | 138 | 158 | n = int(eval(input()))
a = list(map(int, input().split()))
c = 0
for i in range(n - 1):
if a[i] != i + 1:
c += 1
print(("YES" if c < 3 else "NO"))
| n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
if p[i] != i + 1:
cnt += 1
print(("YES" if cnt < 3 else "NO"))
| false | 11.111111 | [
"-a = list(map(int, input().split()))",
"-c = 0",
"-for i in range(n - 1):",
"- if a[i] != i + 1:",
"- c += 1",
"-print((\"YES\" if c < 3 else \"NO\"))",
"+p = list(map(int, input().split()))",
"+cnt = 0",
"+for i in range(n):",
"+ if p[i] != i + 1:",
"+ cnt += 1",
"+print(... | false | 0.04187 | 0.039495 | 1.060142 | [
"s543867678",
"s975159126"
] |
u806779442 | p03031 | python | s401482685 | s580225163 | 41 | 21 | 3,064 | 3,064 | Accepted | Accepted | 48.78 | N, M = list(map(int,input().split()))
K = []
S = []
for _ in range(M):
KS = list(map(int,input().split()))
k = KS.pop(0)
K.append(k)
S.append(KS)
P = list(map(int,input().split()))
cnt = 2 ** N
ans = 0
for i in range(cnt):
flg = 1
for j in range(M):
s = S[j]
su... | N, M = list(map(int,input().split()))
K = []
S = []
for _ in range(M):
KS = list(map(int,input().split()))
k = KS.pop(0)
K.append(k)
S.append(KS)
P = list(map(int,input().split()))
cnt = 2 ** N
ans = 0
sum = [0] * M
for j in range(M):
for x in S[j]:
sum[j] += 2 ** (x - 1)... | 31 | 33 | 620 | 619 | N, M = list(map(int, input().split()))
K = []
S = []
for _ in range(M):
KS = list(map(int, input().split()))
k = KS.pop(0)
K.append(k)
S.append(KS)
P = list(map(int, input().split()))
cnt = 2**N
ans = 0
for i in range(cnt):
flg = 1
for j in range(M):
s = S[j]
sum_s = 0
fo... | N, M = list(map(int, input().split()))
K = []
S = []
for _ in range(M):
KS = list(map(int, input().split()))
k = KS.pop(0)
K.append(k)
S.append(KS)
P = list(map(int, input().split()))
cnt = 2**N
ans = 0
sum = [0] * M
for j in range(M):
for x in S[j]:
sum[j] += 2 ** (x - 1)
for i in range(cnt... | false | 6.060606 | [
"+sum = [0] * M",
"+for j in range(M):",
"+ for x in S[j]:",
"+ sum[j] += 2 ** (x - 1)",
"- s = S[j]",
"- sum_s = 0",
"- for x in s:",
"- sum_s += 2 ** (x - 1)",
"- calc = sum_s & i",
"+ calc = sum[j] & i"
] | false | 0.047016 | 0.078374 | 0.599896 | [
"s401482685",
"s580225163"
] |
u922449550 | p03564 | python | s679627422 | s034045647 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | N = int(eval(input()))
K = int(eval(input()))
ans = float('inf')
for i in range(2**N):
now = 1
for j in range(N):
if i>>j & 1:
now *= 2
else:
now += K
ans = min(ans, now)
print(ans) | N = int(eval(input()))
K = int(eval(input()))
now = 1
for i in range(N):
now = min(now*2, now+K)
print(now) | 14 | 8 | 210 | 106 | N = int(eval(input()))
K = int(eval(input()))
ans = float("inf")
for i in range(2**N):
now = 1
for j in range(N):
if i >> j & 1:
now *= 2
else:
now += K
ans = min(ans, now)
print(ans)
| N = int(eval(input()))
K = int(eval(input()))
now = 1
for i in range(N):
now = min(now * 2, now + K)
print(now)
| false | 42.857143 | [
"-ans = float(\"inf\")",
"-for i in range(2**N):",
"- now = 1",
"- for j in range(N):",
"- if i >> j & 1:",
"- now *= 2",
"- else:",
"- now += K",
"- ans = min(ans, now)",
"-print(ans)",
"+now = 1",
"+for i in range(N):",
"+ now = min(now * 2, ... | false | 0.053974 | 0.050804 | 1.062396 | [
"s679627422",
"s034045647"
] |
u628285938 | p03721 | python | s123757214 | s006776502 | 260 | 220 | 24,008 | 11,656 | Accepted | Accepted | 15.38 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 01:14:47 2020
@author: liang
"""
N, K = list(map(int,input().split()))
A = list()
for i in range(N):
a, b = list(map(int,input().split()))
A.append((a,b))
A.sort(key= lambda x:x[0])
tmp = 0
for i in range(N):
a, b = A[i]
tmp += b
... | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 01:21:16 2020
@author: liang
"""
#バケツソートO(n)
N, K = list(map(int,input().split()))
num = [0]*(10**5+1)
for i in range(N):
a, b = list(map(int,input().split()))
num[a] += b
tmp = 0
for i in range(10**5+ 1):
tmp += num[i]
if tmp >= K:
... | 21 | 20 | 355 | 339 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 01:14:47 2020
@author: liang
"""
N, K = list(map(int, input().split()))
A = list()
for i in range(N):
a, b = list(map(int, input().split()))
A.append((a, b))
A.sort(key=lambda x: x[0])
tmp = 0
for i in range(N):
a, b = A[i]
tmp += b
if tmp >= K:
... | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 01:21:16 2020
@author: liang
"""
# バケツソートO(n)
N, K = list(map(int, input().split()))
num = [0] * (10**5 + 1)
for i in range(N):
a, b = list(map(int, input().split()))
num[a] += b
tmp = 0
for i in range(10**5 + 1):
tmp += num[i]
if tmp >= K:
print... | false | 4.761905 | [
"-Created on Mon Sep 28 01:14:47 2020",
"+Created on Mon Sep 28 01:21:16 2020",
"+# バケツソートO(n)",
"-A = list()",
"+num = [0] * (10**5 + 1)",
"- A.append((a, b))",
"-A.sort(key=lambda x: x[0])",
"+ num[a] += b",
"-for i in range(N):",
"- a, b = A[i]",
"- tmp += b",
"+for i in range(1... | false | 0.069718 | 0.037872 | 1.840879 | [
"s123757214",
"s006776502"
] |
u111365362 | p03013 | python | s139801048 | s822830792 | 499 | 213 | 55,640 | 7,848 | Accepted | Accepted | 57.31 | huge = 10**9+7
n,m = list(map(int,input().split()))
a = [0,1]
b = []
now = 0
for _ in range(m):
b.append(int(eval(input())))
b.append(n+1)
for i in range(1,n+1):
if b[now] == i:
tmp = 0
now += 1
else:
tmp = a[-2] + a[-1]
a.append(tmp % huge)
print((a[-1])) | n,m = list(map(int,input().split()))
mod = 10 ** 9 + 7
broken = []
for _ in range(m):
broken.append(int(eval(input())))
here = 0
dp = [0,1]
for i in range(n):
if here != m:
if i+1 == broken[here]:
dp.append(0)
here += 1
else:
dp.append((dp[-2]+dp[-1])%mod)
else:
dp.app... | 16 | 18 | 277 | 359 | huge = 10**9 + 7
n, m = list(map(int, input().split()))
a = [0, 1]
b = []
now = 0
for _ in range(m):
b.append(int(eval(input())))
b.append(n + 1)
for i in range(1, n + 1):
if b[now] == i:
tmp = 0
now += 1
else:
tmp = a[-2] + a[-1]
a.append(tmp % huge)
print((a[-1]))
| n, m = list(map(int, input().split()))
mod = 10**9 + 7
broken = []
for _ in range(m):
broken.append(int(eval(input())))
here = 0
dp = [0, 1]
for i in range(n):
if here != m:
if i + 1 == broken[here]:
dp.append(0)
here += 1
else:
dp.append((dp[-2] + dp[-1]) % m... | false | 11.111111 | [
"-huge = 10**9 + 7",
"-a = [0, 1]",
"-b = []",
"-now = 0",
"+mod = 10**9 + 7",
"+broken = []",
"- b.append(int(eval(input())))",
"-b.append(n + 1)",
"-for i in range(1, n + 1):",
"- if b[now] == i:",
"- tmp = 0",
"- now += 1",
"+ broken.append(int(eval(input())))",
"... | false | 0.036503 | 0.06388 | 0.57143 | [
"s139801048",
"s822830792"
] |
u372144784 | p03253 | python | s650196053 | s689736401 | 334 | 134 | 125,728 | 144,400 | Accepted | Accepted | 59.88 | import sys
readline = sys.stdin.buffer.readline
from collections import Counter
n,m = list(map(int,readline().split()))
mod = 10**9+7
"""素因数分解"""
def factrize(n):
b = 2
fct = []
while b*b <= n:
while n % b == 0:
n //= b
#もし素因数を重複させたくないならここを加えてfct.append(b)を消す
... | import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
"""
1*1*1*1*m = mなども含める
4をそのまま使う場合と2*2に分ける場合などの場合分けが必要
約数列挙からどうこうする?
"""
n,m = list(map(int,readline().split()))
mod = 10**9+7
def pow(n,p,mod=10**9+7): #繰り返し二乗法(nのp乗)
res = 1
while p > 0:
if p % 2 ==... | 53 | 61 | 1,224 | 1,268 | import sys
readline = sys.stdin.buffer.readline
from collections import Counter
n, m = list(map(int, readline().split()))
mod = 10**9 + 7
"""素因数分解"""
def factrize(n):
b = 2
fct = []
while b * b <= n:
while n % b == 0:
n //= b
# もし素因数を重複させたくないならここを加えてfct.append(b)を消す
... | import sys
readline = sys.stdin.buffer.readline
def even(n):
return 1 if n % 2 == 0 else 0
"""
1*1*1*1*m = mなども含める
4をそのまま使う場合と2*2に分ける場合などの場合分けが必要
約数列挙からどうこうする?
"""
n, m = list(map(int, readline().split()))
mod = 10**9 + 7
def pow(n, p, mod=10**9 + 7): # 繰り返し二乗法(nのp乗)
res = 1
while p > 0:
if ... | false | 13.114754 | [
"-from collections import Counter",
"+",
"+def even(n):",
"+ return 1 if n % 2 == 0 else 0",
"+",
"+",
"+\"\"\"",
"+1*1*1*1*m = mなども含める",
"+4をそのまま使う場合と2*2に分ける場合などの場合分けが必要",
"+約数列挙からどうこうする?",
"+\"\"\"",
"+",
"+",
"+def pow(n, p, mod=10**9 + 7): # 繰り返し二乗法(nのp乗)",
"+ res = 1",
"+ ... | false | 1.647427 | 0.498619 | 3.303978 | [
"s650196053",
"s689736401"
] |
u814986259 | p03295 | python | s304861573 | s546920934 | 583 | 455 | 35,820 | 16,996 | Accepted | Accepted | 21.96 |
N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(M)]
ab = [tuple([ab[i][0], ab[i][1], i]) for i in range(M)]
ans = 1
tmp = 0
a = sorted(ab, key=lambda x: x[0])
b = sorted(ab, key=lambda x: x[1])
checked = set()
for i in range(M):
if b[tmp][1] <= a[i][... | N,M=list(map(int,input().split()))
ab=[tuple(map(int,input().split())) for i in range(M)]
ab.sort()
l=1
r=N
ans=1
for a,b in ab:
l=max(a,l)
r=min(b,r)
if l>=r:
ans+=1
l=a
r=b
print(ans)
| 22 | 16 | 460 | 217 | N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(M)]
ab = [tuple([ab[i][0], ab[i][1], i]) for i in range(M)]
ans = 1
tmp = 0
a = sorted(ab, key=lambda x: x[0])
b = sorted(ab, key=lambda x: x[1])
checked = set()
for i in range(M):
if b[tmp][1] <= a[i][0]:
ans += 1
... | N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(M)]
ab.sort()
l = 1
r = N
ans = 1
for a, b in ab:
l = max(a, l)
r = min(b, r)
if l >= r:
ans += 1
l = a
r = b
print(ans)
| false | 27.272727 | [
"-ab = [tuple([ab[i][0], ab[i][1], i]) for i in range(M)]",
"+ab.sort()",
"+l = 1",
"+r = N",
"-tmp = 0",
"-a = sorted(ab, key=lambda x: x[0])",
"-b = sorted(ab, key=lambda x: x[1])",
"-checked = set()",
"-for i in range(M):",
"- if b[tmp][1] <= a[i][0]:",
"+for a, b in ab:",
"+ l = max(... | false | 0.083273 | 0.037905 | 2.196911 | [
"s304861573",
"s546920934"
] |
u729133443 | p03760 | python | s135654980 | s854969225 | 181 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90.61 | j=''.join;print((j(list(map(j,list(zip(eval(input()),eval(input())+' '))))))) | j=''.join;print((j(list(map(j,list(zip(*open(0)))))))) | 1 | 1 | 51 | 40 | j = "".join
print((j(list(map(j, list(zip(eval(input()), eval(input()) + " ")))))))
| j = "".join
print((j(list(map(j, list(zip(*open(0))))))))
| false | 0 | [
"-print((j(list(map(j, list(zip(eval(input()), eval(input()) + \" \")))))))",
"+print((j(list(map(j, list(zip(*open(0))))))))"
] | false | 0.081624 | 0.035126 | 2.323763 | [
"s135654980",
"s854969225"
] |
u924691798 | p03283 | python | s478908427 | s891869284 | 368 | 335 | 72,580 | 82,692 | Accepted | Accepted | 8.97 | import sys
input = sys.stdin.readline
N, M, Q = list(map(int, input().split()))
cum = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
l, r = list(map(int, input().split()))
cum[l][r] += 1
for i in range(1, N+1):
for j in range(i+1, N+1):
cum[i][j] += cum[i][j-1]
for _ in range(Q):
... | import sys
input = sys.stdin.readline
N, M, Q = map(int, input().split())
cum = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
l, r = map(int, input().split())
cum[l][r] += 1
for i in range(1, N+1):
for j in range(i+1, N+1):
cum[i][j] += cum[i][j-1]
ans = []
for _ in range(Q):
... | 17 | 19 | 427 | 465 | import sys
input = sys.stdin.readline
N, M, Q = list(map(int, input().split()))
cum = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
l, r = list(map(int, input().split()))
cum[l][r] += 1
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
cum[i][j] += cum[i][j - 1]
for _ in range(Q):
... | import sys
input = sys.stdin.readline
N, M, Q = map(int, input().split())
cum = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
l, r = map(int, input().split())
cum[l][r] += 1
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
cum[i][j] += cum[i][j - 1]
ans = []
for _ in range(Q):
... | false | 10.526316 | [
"-N, M, Q = list(map(int, input().split()))",
"+N, M, Q = map(int, input().split())",
"- l, r = list(map(int, input().split()))",
"+ l, r = map(int, input().split())",
"+ans = []",
"- p, q = list(map(int, input().split()))",
"+ p, q = map(int, input().split())",
"- print(tot)",
"+ ... | false | 0.035357 | 0.039261 | 0.900548 | [
"s478908427",
"s891869284"
] |
u072717685 | p03633 | python | s600510647 | s856952274 | 36 | 29 | 5,076 | 9,176 | Accepted | Accepted | 19.44 | from fractions import gcd
from functools import reduce
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(nums):
return reduce(lcm_base, nums, 1)
def main():
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]
print((lcm_list(t)))
if __name__ == '__main__':
... | import sys
read = sys.stdin.read
from math import gcd
def main():
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]
if n == 1:
print((t[0]))
sys.exit()
r = (t[0] * t[1]) // gcd(t[0], t[1])
if n == 2:
print(r)
sys.exit()
for i1 in range... | 15 | 20 | 316 | 414 | from fractions import gcd
from functools import reduce
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(nums):
return reduce(lcm_base, nums, 1)
def main():
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]
print((lcm_list(t)))
if __name__ == "__main__":
main()... | import sys
read = sys.stdin.read
from math import gcd
def main():
n = int(eval(input()))
t = [int(eval(input())) for _ in range(n)]
if n == 1:
print((t[0]))
sys.exit()
r = (t[0] * t[1]) // gcd(t[0], t[1])
if n == 2:
print(r)
sys.exit()
for i1 in range(2, n):
... | false | 25 | [
"-from fractions import gcd",
"-from functools import reduce",
"+import sys",
"-",
"-def lcm_base(x, y):",
"- return (x * y) // gcd(x, y)",
"-",
"-",
"-def lcm_list(nums):",
"- return reduce(lcm_base, nums, 1)",
"+read = sys.stdin.read",
"+from math import gcd",
"- print((lcm_list(t... | false | 0.057205 | 0.044492 | 1.285741 | [
"s600510647",
"s856952274"
] |
u350997995 | p02780 | python | s644773328 | s030183697 | 237 | 189 | 25,060 | 24,812 | Accepted | Accepted | 20.25 | N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
B = [0]
def f(p):
return p*(1+p)//2/p
for i in range(N):
B.append(B[i]+f(P[i]))
ans = 0
for i in range(K,N+1):
ans = max(ans,B[i]-B[i-K])
print(ans) | N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
ans = 0
D = [0]+[(p+1)/2 for p in P]
res = 0
for i in range(N+1):
res += D[i]
if i>=K:
res-=D[i-K]
ans = max(res,ans)
print(ans) | 11 | 11 | 236 | 228 | N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
B = [0]
def f(p):
return p * (1 + p) // 2 / p
for i in range(N):
B.append(B[i] + f(P[i]))
ans = 0
for i in range(K, N + 1):
ans = max(ans, B[i] - B[i - K])
print(ans)
| N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
ans = 0
D = [0] + [(p + 1) / 2 for p in P]
res = 0
for i in range(N + 1):
res += D[i]
if i >= K:
res -= D[i - K]
ans = max(res, ans)
print(ans)
| false | 0 | [
"-B = [0]",
"-",
"-",
"-def f(p):",
"- return p * (1 + p) // 2 / p",
"-",
"-",
"-for i in range(N):",
"- B.append(B[i] + f(P[i]))",
"-for i in range(K, N + 1):",
"- ans = max(ans, B[i] - B[i - K])",
"+D = [0] + [(p + 1) / 2 for p in P]",
"+res = 0",
"+for i in range(N + 1):",
"+... | false | 0.040645 | 0.072496 | 0.560656 | [
"s644773328",
"s030183697"
] |
u063052907 | p03345 | python | s164167349 | s710317951 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | A, B, C, K = list(map(int, input().split()))
ans = A - B
if K%2==1:
ans = -ans
if abs(ans) > 10**18:
ans = "Unfair"
print(ans) | A, B, C, K = list(map(int, input().split()))
ans = A - B
if K%2==1:
ans = -ans
print(ans) | 10 | 7 | 140 | 95 | A, B, C, K = list(map(int, input().split()))
ans = A - B
if K % 2 == 1:
ans = -ans
if abs(ans) > 10**18:
ans = "Unfair"
print(ans)
| A, B, C, K = list(map(int, input().split()))
ans = A - B
if K % 2 == 1:
ans = -ans
print(ans)
| false | 30 | [
"-if abs(ans) > 10**18:",
"- ans = \"Unfair\""
] | false | 0.036463 | 0.040113 | 0.909008 | [
"s164167349",
"s710317951"
] |
u699296734 | p02881 | python | s485033264 | s606381592 | 155 | 142 | 9,372 | 9,252 | Accepted | Accepted | 8.39 | n = int(eval(input()))
max_div_num = 1
for i in range(2, int(n**(1/2) + 1)):
if n % i == 0:
max_div_num = max(i, max_div_num)
x = max_div_num
y = n // max_div_num
print((x + y - 2)) | n = int(eval(input()))
max_div_num = 1
for i in range(2, int(n**(1/2) + 1)):
if n % i == 0:
max_div_num = i
x = max_div_num
y = n // max_div_num
print((x + y - 2)) | 12 | 12 | 200 | 182 | n = int(eval(input()))
max_div_num = 1
for i in range(2, int(n ** (1 / 2) + 1)):
if n % i == 0:
max_div_num = max(i, max_div_num)
x = max_div_num
y = n // max_div_num
print((x + y - 2))
| n = int(eval(input()))
max_div_num = 1
for i in range(2, int(n ** (1 / 2) + 1)):
if n % i == 0:
max_div_num = i
x = max_div_num
y = n // max_div_num
print((x + y - 2))
| false | 0 | [
"- max_div_num = max(i, max_div_num)",
"+ max_div_num = i"
] | false | 0.043912 | 0.0439 | 1.000284 | [
"s485033264",
"s606381592"
] |
u433375322 | p02675 | python | s849228035 | s285634550 | 32 | 26 | 8,944 | 9,152 | Accepted | Accepted | 18.75 | N=int(eval(input()))
if N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9 :
print("hon")
elif N%10==0 or N%10==1 or N%10==6 or N%10==8 :
print("pon")
else:
print("bon") | n=int(eval(input()))
if n%10==3:
print("bon")
elif n%10==0 or n%10==1 or n%10==6 or n%10==8:
print("pon")
else:
print("hon") | 7 | 7 | 182 | 136 | N = int(eval(input()))
if N % 10 == 2 or N % 10 == 4 or N % 10 == 5 or N % 10 == 7 or N % 10 == 9:
print("hon")
elif N % 10 == 0 or N % 10 == 1 or N % 10 == 6 or N % 10 == 8:
print("pon")
else:
print("bon")
| n = int(eval(input()))
if n % 10 == 3:
print("bon")
elif n % 10 == 0 or n % 10 == 1 or n % 10 == 6 or n % 10 == 8:
print("pon")
else:
print("hon")
| false | 0 | [
"-N = int(eval(input()))",
"-if N % 10 == 2 or N % 10 == 4 or N % 10 == 5 or N % 10 == 7 or N % 10 == 9:",
"- print(\"hon\")",
"-elif N % 10 == 0 or N % 10 == 1 or N % 10 == 6 or N % 10 == 8:",
"+n = int(eval(input()))",
"+if n % 10 == 3:",
"+ print(\"bon\")",
"+elif n % 10 == 0 or n % 10 == 1 o... | false | 0.167343 | 0.199687 | 0.838023 | [
"s849228035",
"s285634550"
] |
u761320129 | p03611 | python | s696315068 | s706653269 | 181 | 128 | 14,436 | 20,788 | Accepted | Accepted | 29.28 | N = int(eval(input()))
A = list(map(int,input().split()))
from collections import Counter
ctr = Counter(A)
ans = 0
for i in range(10**5+1):
t = ctr[i-1] + ctr[i] + ctr[i+1]
ans = max(ans,t)
print(ans) | N = int(eval(input()))
A = list(map(int,input().split()))
from collections import Counter
ctr = Counter(A)
ans = 0
for x in range(10**5+2):
t = ctr[x-1] + ctr[x] + ctr[x+1]
ans = max(t,ans)
print(ans) | 10 | 10 | 212 | 212 | N = int(eval(input()))
A = list(map(int, input().split()))
from collections import Counter
ctr = Counter(A)
ans = 0
for i in range(10**5 + 1):
t = ctr[i - 1] + ctr[i] + ctr[i + 1]
ans = max(ans, t)
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
from collections import Counter
ctr = Counter(A)
ans = 0
for x in range(10**5 + 2):
t = ctr[x - 1] + ctr[x] + ctr[x + 1]
ans = max(t, ans)
print(ans)
| false | 0 | [
"-for i in range(10**5 + 1):",
"- t = ctr[i - 1] + ctr[i] + ctr[i + 1]",
"- ans = max(ans, t)",
"+for x in range(10**5 + 2):",
"+ t = ctr[x - 1] + ctr[x] + ctr[x + 1]",
"+ ans = max(t, ans)"
] | false | 0.80198 | 1.228928 | 0.652586 | [
"s696315068",
"s706653269"
] |
u094191970 | p02947 | python | s290619000 | s946887890 | 422 | 368 | 39,040 | 17,852 | Accepted | Accepted | 12.8 | n=int(eval(input()))
l=[sorted(list(eval(input()))) for i in range(n)]
d={}
for i in l:
i=''.join(i)
if i in d:
d[i]+=1
else:
d[i]=1
ans=0
for v in list(d.values()):
if v>=2:
ans+=v*(v-1)//2
print(ans) | n=int(eval(input()))
d={}
for i in range(n):
s=''.join(sorted(eval(input())))
if s in d:
d[s]+=1
else:
d[s]=1
print((sum(v*(v-1)//2 for v in list(d.values())))) | 16 | 11 | 220 | 166 | n = int(eval(input()))
l = [sorted(list(eval(input()))) for i in range(n)]
d = {}
for i in l:
i = "".join(i)
if i in d:
d[i] += 1
else:
d[i] = 1
ans = 0
for v in list(d.values()):
if v >= 2:
ans += v * (v - 1) // 2
print(ans)
| n = int(eval(input()))
d = {}
for i in range(n):
s = "".join(sorted(eval(input())))
if s in d:
d[s] += 1
else:
d[s] = 1
print((sum(v * (v - 1) // 2 for v in list(d.values()))))
| false | 31.25 | [
"-l = [sorted(list(eval(input()))) for i in range(n)]",
"-for i in l:",
"- i = \"\".join(i)",
"- if i in d:",
"- d[i] += 1",
"+for i in range(n):",
"+ s = \"\".join(sorted(eval(input())))",
"+ if s in d:",
"+ d[s] += 1",
"- d[i] = 1",
"-ans = 0",
"-for v in lis... | false | 0.037596 | 0.038134 | 0.98588 | [
"s290619000",
"s946887890"
] |
u761529120 | p02918 | python | s223680359 | s173358358 | 174 | 65 | 45,168 | 68,564 | Accepted | Accepted | 62.64 | def runlength(S):
cnt = 1
res = []
for i in range(len(S)-1):
if S[i] == S[i+1]:
cnt += 1
else:
res.append(cnt)
cnt = 1
res.append(cnt)
return res
def main():
N, K = list(map(int, input().split()))
S = eval(input())
A... | def main():
N, K = list(map(int, input().split()))
S = eval(input())
cnt = 0
for i in range(1,N):
if S[i] == S[i-1]:
cnt += 1
ans = min(N-1,cnt+2*K)
print(ans)
if __name__ == "__main__":
main() | 28 | 13 | 480 | 243 | def runlength(S):
cnt = 1
res = []
for i in range(len(S) - 1):
if S[i] == S[i + 1]:
cnt += 1
else:
res.append(cnt)
cnt = 1
res.append(cnt)
return res
def main():
N, K = list(map(int, input().split()))
S = eval(input())
A = runlength(S... | def main():
N, K = list(map(int, input().split()))
S = eval(input())
cnt = 0
for i in range(1, N):
if S[i] == S[i - 1]:
cnt += 1
ans = min(N - 1, cnt + 2 * K)
print(ans)
if __name__ == "__main__":
main()
| false | 53.571429 | [
"-def runlength(S):",
"- cnt = 1",
"- res = []",
"- for i in range(len(S) - 1):",
"- if S[i] == S[i + 1]:",
"- cnt += 1",
"- else:",
"- res.append(cnt)",
"- cnt = 1",
"- res.append(cnt)",
"- return res",
"-",
"-",
"- A = runl... | false | 0.034854 | 0.088503 | 0.393814 | [
"s223680359",
"s173358358"
] |
u325264482 | p03127 | python | s363675483 | s886549035 | 98 | 82 | 16,244 | 16,280 | Accepted | Accepted | 16.33 | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
ans = fractions.gcd(A[0], A[1])
for i in range(2, N):
ans = fractions.gcd(ans, A[i])
print(ans)
| import fractions
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))
ans = reduce(fractions.gcd, A)
print(ans)
| 13 | 9 | 189 | 152 | import fractions
N = int(eval(input()))
A = list(map(int, input().split()))
ans = fractions.gcd(A[0], A[1])
for i in range(2, N):
ans = fractions.gcd(ans, A[i])
print(ans)
| import fractions
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))
ans = reduce(fractions.gcd, A)
print(ans)
| false | 30.769231 | [
"+from functools import reduce",
"-ans = fractions.gcd(A[0], A[1])",
"-for i in range(2, N):",
"- ans = fractions.gcd(ans, A[i])",
"+ans = reduce(fractions.gcd, A)"
] | false | 0.007188 | 0.052585 | 0.136702 | [
"s363675483",
"s886549035"
] |
u903005414 | p02552 | python | s708013398 | s833549613 | 30 | 26 | 9,140 | 9,136 | Accepted | Accepted | 13.33 | x = int(eval(input()))
ans = 1 if x == 0 else 0
print(ans)
| print((1 if int(eval(input())) == 0 else 0))
| 3 | 1 | 55 | 37 | x = int(eval(input()))
ans = 1 if x == 0 else 0
print(ans)
| print((1 if int(eval(input())) == 0 else 0))
| false | 66.666667 | [
"-x = int(eval(input()))",
"-ans = 1 if x == 0 else 0",
"-print(ans)",
"+print((1 if int(eval(input())) == 0 else 0))"
] | false | 0.08456 | 0.037309 | 2.266478 | [
"s708013398",
"s833549613"
] |
u392319141 | p02990 | python | s246594258 | s530824615 | 77 | 22 | 5,748 | 3,572 | Accepted | Accepted | 71.43 | N , K = list(map(int,input().split()))
M = N - K
fact = [1] * (N+1)
for i in range(1,N+1) :
fact[i] = fact[i-1] * i
def p(n,r) :
return fact[n] // fact[n-r]
def combi(n,r) :
return p(n,r) // fact[r]
for i in range(1,K+1) :
if i-1 > N-K :
print((0))
continue
... | class Combination:
def __init__(self, size, mod=10**9 + 7):
self.size = size + 2
self.mod = mod
self.fact = [1, 1] + [0] * size
self.factInv = [1, 1] + [0] * size
self.inv = [0, 1] + [0] * size
for i in range(2, self.size):
self.fact[i] = self.fa... | 25 | 46 | 414 | 1,271 | N, K = list(map(int, input().split()))
M = N - K
fact = [1] * (N + 1)
for i in range(1, N + 1):
fact[i] = fact[i - 1] * i
def p(n, r):
return fact[n] // fact[n - r]
def combi(n, r):
return p(n, r) // fact[r]
for i in range(1, K + 1):
if i - 1 > N - K:
print((0))
continue
blue =... | class Combination:
def __init__(self, size, mod=10**9 + 7):
self.size = size + 2
self.mod = mod
self.fact = [1, 1] + [0] * size
self.factInv = [1, 1] + [0] * size
self.inv = [0, 1] + [0] * size
for i in range(2, self.size):
self.fact[i] = self.fact[i - 1] ... | false | 45.652174 | [
"-N, K = list(map(int, input().split()))",
"-M = N - K",
"-fact = [1] * (N + 1)",
"-for i in range(1, N + 1):",
"- fact[i] = fact[i - 1] * i",
"+class Combination:",
"+ def __init__(self, size, mod=10**9 + 7):",
"+ self.size = size + 2",
"+ self.mod = mod",
"+ self.fact ... | false | 0.037818 | 0.037558 | 1.006928 | [
"s246594258",
"s530824615"
] |
u498487134 | p02732 | python | s327580461 | s490227638 | 401 | 215 | 82,892 | 107,936 | Accepted | Accepted | 46.38 | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
A=LI()
from collections import defaultdict
dd = defaultdict(int)
for i in ... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
A=LI()
from collections import defaultdict
dd = defaultdict(int)
for i in ... | 27 | 31 | 516 | 604 | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
A = LI()
from collections import defaultdict
dd = defaultdict(int)
... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N = I()
A = LI()
from collections import defaultdict
dd = defaultdict(int)
... | false | 12.903226 | [
"- S = 0",
"+ ans = 0",
"- S += (v * (v - 1)) // 2",
"+ ans += (v * (v - 1)) // 2",
"+ a = A[i]",
"- ans = S - (v - 1)",
"- print(ans)",
"+ temp = ans",
"+ temp -= (v * (v - 1)) // 2",
"+ temp += ((v - 1) * (v - 2)) // 2",
"+ p... | false | 0.036667 | 0.035595 | 1.030106 | [
"s327580461",
"s490227638"
] |
u620084012 | p02772 | python | s836425926 | s940071133 | 204 | 18 | 38,416 | 2,940 | Accepted | Accepted | 91.18 |
N = int(eval(input()))
A = list(map(int,input().split()))
for e in A:
if e%2 == 0:
if e%3 != 0 and e%5 != 0:
print("DENIED")
exit(0)
print("APPROVED")
| import sys
def input():
return sys.stdin.readline()[:-1]
def main():
N = int(eval(input()))
A = list(map(int,input().split()))
for e in A:
if e%2 == 0:
if e%3 != 0 and e%5 != 0:
print("DENIED")
exit(0)
print("APPROVED")
if __name__ ==... | 10 | 15 | 192 | 339 | N = int(eval(input()))
A = list(map(int, input().split()))
for e in A:
if e % 2 == 0:
if e % 3 != 0 and e % 5 != 0:
print("DENIED")
exit(0)
print("APPROVED")
| import sys
def input():
return sys.stdin.readline()[:-1]
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
for e in A:
if e % 2 == 0:
if e % 3 != 0 and e % 5 != 0:
print("DENIED")
exit(0)
print("APPROVED")
if __name__ == ... | false | 33.333333 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-for e in A:",
"- if e % 2 == 0:",
"- if e % 3 != 0 and e % 5 != 0:",
"- print(\"DENIED\")",
"- exit(0)",
"-print(\"APPROVED\")",
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.std... | false | 0.084797 | 0.039394 | 2.152527 | [
"s836425926",
"s940071133"
] |
u095094246 | p03031 | python | s030297684 | s528019729 | 184 | 41 | 39,792 | 9,216 | Accepted | Accepted | 77.72 | n,m=list(map(int,input().split()))
k=[0]*m
s=[0]*m
for i in range(m):
tmp = list(map(int,input().split()))
k[i] = tmp[0]
s[i] = tmp[1:]
p=list(map(int,input().split()))
res=0
for bit in range(2**n):
for i in range(m):
cnt=0
for sw in s[i]:
if (bit >> (sw-1) & 1):
cnt += 1
... | n,m=list(map(int,input().split()))
k=[0]*m
s=[[0 for j in range(n)] for i in range(m)]
for i in range(m):
x = list(map(int,input().split()))
k = x[0]
for j in range(1, k+1):
s[i][x[j]-1] = 1
p=list(map(int,input().split()))
ans = 0
for x in range(2**n):
for i in range(m):
cnt = 0
for ... | 21 | 22 | 383 | 481 | n, m = list(map(int, input().split()))
k = [0] * m
s = [0] * m
for i in range(m):
tmp = list(map(int, input().split()))
k[i] = tmp[0]
s[i] = tmp[1:]
p = list(map(int, input().split()))
res = 0
for bit in range(2**n):
for i in range(m):
cnt = 0
for sw in s[i]:
if bit >> (sw - ... | n, m = list(map(int, input().split()))
k = [0] * m
s = [[0 for j in range(n)] for i in range(m)]
for i in range(m):
x = list(map(int, input().split()))
k = x[0]
for j in range(1, k + 1):
s[i][x[j] - 1] = 1
p = list(map(int, input().split()))
ans = 0
for x in range(2**n):
for i in range(m):
... | false | 4.545455 | [
"-s = [0] * m",
"+s = [[0 for j in range(n)] for i in range(m)]",
"- tmp = list(map(int, input().split()))",
"- k[i] = tmp[0]",
"- s[i] = tmp[1:]",
"+ x = list(map(int, input().split()))",
"+ k = x[0]",
"+ for j in range(1, k + 1):",
"+ s[i][x[j] - 1] = 1",
"-res = 0",
"... | false | 0.04473 | 0.045356 | 0.986196 | [
"s030297684",
"s528019729"
] |
u701318346 | p03723 | python | s878861578 | s226038018 | 20 | 17 | 3,188 | 3,060 | Accepted | Accepted | 15 | A, B, C = list(map(int, input().split()))
ans = 0
if A == B == C and A % 2 == 0:
ans = -1
else:
count = 0
while (A % 2 == B % 2 == C % 2 == 0):
wA = (B/2 + C/2)
wB = (A/2 + C/2)
wC = (A/2 + B/2)
A = wA
B = wB
C = wC
count += 1
ans =... | def solve(A, B, C):
if (A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
return 0
elif (A == B == C):
return -1
else:
return solve((B/2 + C/2), (A/2 + C/2), (A/2 + B/2)) + 1
A, B, C = list(map(int, input().split()))
ans = solve(A, B, C)
print(ans)
| 18 | 11 | 335 | 281 | A, B, C = list(map(int, input().split()))
ans = 0
if A == B == C and A % 2 == 0:
ans = -1
else:
count = 0
while A % 2 == B % 2 == C % 2 == 0:
wA = B / 2 + C / 2
wB = A / 2 + C / 2
wC = A / 2 + B / 2
A = wA
B = wB
C = wC
count += 1
ans = count
print... | def solve(A, B, C):
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
return 0
elif A == B == C:
return -1
else:
return solve((B / 2 + C / 2), (A / 2 + C / 2), (A / 2 + B / 2)) + 1
A, B, C = list(map(int, input().split()))
ans = solve(A, B, C)
print(ans)
| false | 38.888889 | [
"+def solve(A, B, C):",
"+ if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:",
"+ return 0",
"+ elif A == B == C:",
"+ return -1",
"+ else:",
"+ return solve((B / 2 + C / 2), (A / 2 + C / 2), (A / 2 + B / 2)) + 1",
"+",
"+",
"-ans = 0",
"-if A == B == C and A % 2 == 0:",
... | false | 0.117686 | 0.117548 | 1.001176 | [
"s878861578",
"s226038018"
] |
u023127434 | p03105 | python | s586602629 | s862336129 | 29 | 26 | 9,028 | 9,040 | Accepted | Accepted | 10.34 | a, b, c = list(map(int, input().split()))
if b // a < c:
print((b // a))
else:
print(c) | a, b, c = list(map(int, input().split()))
if b // a > c:
print(c)
else:
print((b // a)) | 5 | 6 | 91 | 89 | a, b, c = list(map(int, input().split()))
if b // a < c:
print((b // a))
else:
print(c)
| a, b, c = list(map(int, input().split()))
if b // a > c:
print(c)
else:
print((b // a))
| false | 16.666667 | [
"-if b // a < c:",
"+if b // a > c:",
"+ print(c)",
"+else:",
"-else:",
"- print(c)"
] | false | 0.037119 | 0.035963 | 1.032142 | [
"s586602629",
"s862336129"
] |
u994064513 | p03855 | python | s321092179 | s505966732 | 1,687 | 1,415 | 114,728 | 127,784 | Accepted | Accepted | 16.12 | from collections import deque, Counter
N, K, L = [int(s) for s in input().split()]
edge_road = [[int(s) - 1 for s in input().split()] for _ in range(K)]
edge_train = [[int(s) - 1 for s in input().split()] for _ in range(L)]
graph_road = [[] for _ in range(N)]
graph_train = [[] for _ in range(N)]
for i, j in e... | N, M, L = [int(s) for s in input().split()]
parent_road = list(range(N))
parent_train = list(range(N))
rank_road = [0] * N
rank_train = [0] * N
class UnionFind:
def __init__(self, n):
self.parent = list(range(n))
self.rank = [0] * N
def find(self, x):
if x == self.parent[... | 61 | 55 | 1,646 | 1,384 | from collections import deque, Counter
N, K, L = [int(s) for s in input().split()]
edge_road = [[int(s) - 1 for s in input().split()] for _ in range(K)]
edge_train = [[int(s) - 1 for s in input().split()] for _ in range(L)]
graph_road = [[] for _ in range(N)]
graph_train = [[] for _ in range(N)]
for i, j in edge_road:... | N, M, L = [int(s) for s in input().split()]
parent_road = list(range(N))
parent_train = list(range(N))
rank_road = [0] * N
rank_train = [0] * N
class UnionFind:
def __init__(self, n):
self.parent = list(range(n))
self.rank = [0] * N
def find(self, x):
if x == self.parent[x]:
... | false | 9.836066 | [
"-from collections import deque, Counter",
"+N, M, L = [int(s) for s in input().split()]",
"+parent_road = list(range(N))",
"+parent_train = list(range(N))",
"+rank_road = [0] * N",
"+rank_train = [0] * N",
"-N, K, L = [int(s) for s in input().split()]",
"-edge_road = [[int(s) - 1 for s in input().spl... | false | 0.11372 | 0.084728 | 1.342183 | [
"s321092179",
"s505966732"
] |
u895445743 | p03557 | python | s417410762 | s586813778 | 461 | 218 | 105,572 | 105,304 | Accepted | Accepted | 52.71 | 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()
ans=0
for b in B:
a = bisect.bisect_left(A, b) # 挿入点はどの同じ値よりも左
c = bisect.bisect_right(C, b) # 挿入点はどの同じ値よりも右
ans += a * (len(C)-c)
pri... | 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()
ans = 0
for b in B:
a = bisect.bisect_left(A, b)
c = bisect.bisect_right(C, b)
#print("a:{0},c:{1}".format(a, c))
... | 14 | 20 | 321 | 351 | 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()
ans = 0
for b in B:
a = bisect.bisect_left(A, b) # 挿入点はどの同じ値よりも左
c = bisect.bisect_right(C, b) # 挿入点はどの同じ値よりも右
ans += a * (len(C) - c... | 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()
ans = 0
for b in B:
a = bisect.bisect_left(A, b)
c = bisect.bisect_right(C, b)
# print("a:{0},c:{1}".format(a, c))
ans += a * (len(... | false | 30 | [
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"- a = bisect.bisect_left(A, b) # 挿入点はどの同じ値よりも左",
"- c = bisect.bisect_right(C, b) # 挿入点はどの同じ値よりも右",
"+ a = bisect.bisect_left(A, b)",
"+ c = bisect.bisect_right(C, b)",
"+ # print(\"a:{0},c:{1}\".format(a, c))"
] | false | 0.04214 | 0.041975 | 1.003918 | [
"s417410762",
"s586813778"
] |
u054514819 | p02973 | python | s922250375 | s738376612 | 253 | 107 | 8,860 | 13,600 | Accepted | Accepted | 57.71 | N = int(eval(input()))
As = [int(eval(input())) for _ in range(N)]
from bisect import bisect_right
from collections import deque
def LIS(L):
dp = deque([L[0]])
length = len(L)
for i in range(1, length):
a = L[i]
if a >= dp[-1]:
dp.append(a)
else:
... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
As = [-int(eval(input())) for _ in range(N)]
from bisect import bisect_right
lis = [1]
for a in As:
if a>=lis[-1]:
lis.append(a)
... | 17 | 17 | 380 | 370 | N = int(eval(input()))
As = [int(eval(input())) for _ in range(N)]
from bisect import bisect_right
from collections import deque
def LIS(L):
dp = deque([L[0]])
length = len(L)
for i in range(1, length):
a = L[i]
if a >= dp[-1]:
dp.append(a)
else:
dp[bisect_r... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
As = [-int(eval(input())) for _ in range(N)]
from bisect import bisect_right
lis = [1]
for a in As:
if a >= lis[-1]:
lis.append(... | false | 0 | [
"-N = int(eval(input()))",
"-As = [int(eval(input())) for _ in range(N)]",
"-from bisect import bisect_right",
"-from collections import deque",
"+import sys",
"-def LIS(L):",
"- dp = deque([L[0]])",
"- length = len(L)",
"- for i in range(1, length):",
"- a = L[i]",
"- if ... | false | 0.070755 | 0.035994 | 1.965739 | [
"s922250375",
"s738376612"
] |
u074220993 | p03797 | python | s899372579 | s489576873 | 26 | 24 | 9,152 | 9,100 | Accepted | Accepted | 7.69 | N, M = list(map(int, input().split()))
if 2*N < M:
extra = (M - 2*N) // 4
ans = N + extra
else:
ans = M // 2
print(ans) | N, M = list(map(int, input().split()))
print((M//2 if 2*N > M else N + (M-2*N)//4)) | 7 | 2 | 131 | 76 | N, M = list(map(int, input().split()))
if 2 * N < M:
extra = (M - 2 * N) // 4
ans = N + extra
else:
ans = M // 2
print(ans)
| N, M = list(map(int, input().split()))
print((M // 2 if 2 * N > M else N + (M - 2 * N) // 4))
| false | 71.428571 | [
"-if 2 * N < M:",
"- extra = (M - 2 * N) // 4",
"- ans = N + extra",
"-else:",
"- ans = M // 2",
"-print(ans)",
"+print((M // 2 if 2 * N > M else N + (M - 2 * N) // 4))"
] | false | 0.043788 | 0.041191 | 1.063045 | [
"s899372579",
"s489576873"
] |
u197457087 | p02713 | python | s309181718 | s801640865 | 1,378 | 485 | 9,168 | 68,680 | Accepted | Accepted | 64.8 | import math
n = int(eval(input()))
ans = 0
for i in range(1,n+1):
for j in range(1,n+1):
temp = math.gcd(i,j)
for k in range(1,n+1):
ans += math.gcd(temp,k)
print(ans) | import math
N = int(eval(input()))
ans = 0
for i in range(1,N+1):
for j in range(1,N+1):
for k in range(1,N+1):
temp = math.gcd(i,j)
temp = math.gcd(temp,k)
ans += temp
print(ans) | 10 | 10 | 187 | 206 | import math
n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
temp = math.gcd(i, j)
for k in range(1, n + 1):
ans += math.gcd(temp, k)
print(ans)
| import math
N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
for j in range(1, N + 1):
for k in range(1, N + 1):
temp = math.gcd(i, j)
temp = math.gcd(temp, k)
ans += temp
print(ans)
| false | 0 | [
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-for i in range(1, n + 1):",
"- for j in range(1, n + 1):",
"- temp = math.gcd(i, j)",
"- for k in range(1, n + 1):",
"- ans += math.gcd(temp, k)",
"+for i in range(1, N + 1):",
"+ for j in range(1, N + 1):",
"+ ... | false | 0.149845 | 0.039157 | 3.826808 | [
"s309181718",
"s801640865"
] |
u424768586 | p02590 | python | s059664497 | s458683257 | 839 | 631 | 136,444 | 136,132 | Accepted | Accepted | 24.79 | import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from co... | import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from co... | 89 | 89 | 2,949 | 3,004 | import sys
sys.setrecursionlimit(10**7) # 再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right # 2分探索
# bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from co... | import sys
sys.setrecursionlimit(10**7) # 再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right # 2分探索
# bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from co... | false | 0 | [
"-from numpy.fft import rfft, irfft",
"+",
"+# from numpy.fft import rfft, irfft",
"+import numpy as np",
"- rf = rfft(cnt, 2 * (P - 1))",
"- X = irfft(rf * rf)",
"+ rf = np.fft.rfft(cnt, 2 * (P - 1))",
"+ X = np.rint(np.fft.irfft(rf * rf)).astype(np.int64)",
"- ans += itoa[i] * r... | false | 1.43969 | 1.749119 | 0.823094 | [
"s059664497",
"s458683257"
] |
u548624367 | p03568 | python | s639610808 | s667647256 | 31 | 27 | 9,076 | 9,076 | Accepted | Accepted | 12.9 | n = int(eval(input()))
a = sum(list([1-int(x)%2 for x in input().split()]))
print((3**n-2**a))
| print((3**int(eval(input()))-2**sum(list([1-int(x)%2 for x in input().split()]))))
| 3 | 1 | 92 | 78 | n = int(eval(input()))
a = sum(list([1 - int(x) % 2 for x in input().split()]))
print((3**n - 2**a))
| print(
(
3 ** int(eval(input()))
- 2 ** sum(list([1 - int(x) % 2 for x in input().split()]))
)
)
| false | 66.666667 | [
"-n = int(eval(input()))",
"-a = sum(list([1 - int(x) % 2 for x in input().split()]))",
"-print((3**n - 2**a))",
"+print(",
"+ (",
"+ 3 ** int(eval(input()))",
"+ - 2 ** sum(list([1 - int(x) % 2 for x in input().split()]))",
"+ )",
"+)"
] | false | 0.033988 | 0.038951 | 0.872588 | [
"s639610808",
"s667647256"
] |
u729133443 | p03067 | python | s419677481 | s134392576 | 170 | 18 | 38,384 | 2,940 | Accepted | Accepted | 89.41 | a,b,c=list(map(int,input().split()));print(((a>c)-(b>c)and'Yes'or'No')) | a,b,c=list(map(int,input().split()));print(('NYoe s'[(c>a)^(c>b)::2])) | 1 | 1 | 63 | 62 | a, b, c = list(map(int, input().split()))
print(((a > c) - (b > c) and "Yes" or "No"))
| a, b, c = list(map(int, input().split()))
print(("NYoe s"[(c > a) ^ (c > b) :: 2]))
| false | 0 | [
"-print(((a > c) - (b > c) and \"Yes\" or \"No\"))",
"+print((\"NYoe s\"[(c > a) ^ (c > b) :: 2]))"
] | false | 0.047263 | 0.043312 | 1.091237 | [
"s419677481",
"s134392576"
] |
u638282348 | p02782 | python | s793737956 | s986693383 | 732 | 663 | 82,164 | 82,164 | Accepted | Accepted | 9.43 | MOD = 10 ** 9 + 7
FACT_MAX = 2 * 10 ** 6 + 3
fact = [1] * FACT_MAX
for i in range(1, FACT_MAX):
fact[i] = fact[i - 1] * i % MOD
def comb(n, r):
return fact[n] * pow(fact[n - r], MOD - 2, MOD) * pow(fact[r], MOD - 2, MOD)
def g(r, c):
return (comb(r + c + 2, c + 1) - 1) % MOD
r1, c1, r2, c2 = list(m... | MOD = 10 ** 9 + 7
def comb(n, r):
return fact[n] * pow(fact[n - r], MOD - 2, MOD) * pow(fact[r], MOD - 2, MOD)
def g(r, c):
return (comb(r + c + 2, c + 1) - 1) % MOD
r1, c1, r2, c2 = list(map(int, input().split()))
FACT_MAX = r2 + c2 + 3
fact = [1] * FACT_MAX
for i in range(1, FACT_MAX):
fact[i] = ... | 11 | 11 | 418 | 414 | MOD = 10**9 + 7
FACT_MAX = 2 * 10**6 + 3
fact = [1] * FACT_MAX
for i in range(1, FACT_MAX):
fact[i] = fact[i - 1] * i % MOD
def comb(n, r):
return fact[n] * pow(fact[n - r], MOD - 2, MOD) * pow(fact[r], MOD - 2, MOD)
def g(r, c):
return (comb(r + c + 2, c + 1) - 1) % MOD
r1, c1, r2, c2 = list(map(int,... | MOD = 10**9 + 7
def comb(n, r):
return fact[n] * pow(fact[n - r], MOD - 2, MOD) * pow(fact[r], MOD - 2, MOD)
def g(r, c):
return (comb(r + c + 2, c + 1) - 1) % MOD
r1, c1, r2, c2 = list(map(int, input().split()))
FACT_MAX = r2 + c2 + 3
fact = [1] * FACT_MAX
for i in range(1, FACT_MAX):
fact[i] = fact[... | false | 0 | [
"-FACT_MAX = 2 * 10**6 + 3",
"-fact = [1] * FACT_MAX",
"-for i in range(1, FACT_MAX):",
"- fact[i] = fact[i - 1] * i % MOD",
"+FACT_MAX = r2 + c2 + 3",
"+fact = [1] * FACT_MAX",
"+for i in range(1, FACT_MAX):",
"+ fact[i] = fact[i - 1] * i % MOD"
] | false | 1.126299 | 0.048394 | 23.27366 | [
"s793737956",
"s986693383"
] |
u947375463 | p03035 | python | s564827843 | s579367051 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | A, B = list(map(int,input().split()))
if A < 6:
print((0))
elif A < 13:
print((int(B / 2)))
else:
print(B)
| A,B=list(map(int,input().split()))
if 13<=A:
print((int(B)))
if 6<=A and A<=12:
print((int(B/2)))
if A<=5:
print((int(0))) | 8 | 8 | 117 | 130 | A, B = list(map(int, input().split()))
if A < 6:
print((0))
elif A < 13:
print((int(B / 2)))
else:
print(B)
| A, B = list(map(int, input().split()))
if 13 <= A:
print((int(B)))
if 6 <= A and A <= 12:
print((int(B / 2)))
if A <= 5:
print((int(0)))
| false | 0 | [
"-if A < 6:",
"- print((0))",
"-elif A < 13:",
"+if 13 <= A:",
"+ print((int(B)))",
"+if 6 <= A and A <= 12:",
"-else:",
"- print(B)",
"+if A <= 5:",
"+ print((int(0)))"
] | false | 0.045337 | 0.048486 | 0.935063 | [
"s564827843",
"s579367051"
] |
u312025627 | p02939 | python | s071696594 | s749071207 | 271 | 226 | 43,340 | 42,460 | Accepted | Accepted | 16.61 | def main():
S = eval(input())
N = len(S)
from collections import deque
def solve(S):
cur = deque([S[0]])
ans1 = 1
i = 1
plus = 1
while i < N:
if i+plus > N:
break
if S[i:i+plus] in cur:
plus +=... | def main():
S = eval(input())
N = len(S)
from collections import deque
def solve(S):
cur = deque([S[0]])
ans = 1
i = 1
plus = 1
while i < N:
if i+plus > N:
break
if S[i:i+plus] in cur:
plus += ... | 46 | 27 | 1,070 | 568 | def main():
S = eval(input())
N = len(S)
from collections import deque
def solve(S):
cur = deque([S[0]])
ans1 = 1
i = 1
plus = 1
while i < N:
if i + plus > N:
break
if S[i : i + plus] in cur:
plus += 1
... | def main():
S = eval(input())
N = len(S)
from collections import deque
def solve(S):
cur = deque([S[0]])
ans = 1
i = 1
plus = 1
while i < N:
if i + plus > N:
break
if S[i : i + plus] in cur:
plus += 1
... | false | 41.304348 | [
"- ans1 = 1",
"+ ans = 1",
"- ans1 += 1",
"- cur = deque([S[:2]])",
"- ans2 = 1",
"- i = 2",
"- plus = 1",
"- while i < N:",
"- if i + plus > N:",
"- ans2 = -1",
"- break",
"- if... | false | 0.049343 | 0.133191 | 0.370468 | [
"s071696594",
"s749071207"
] |
u476604182 | p03112 | python | s873140946 | s848800058 | 1,700 | 961 | 14,568 | 45,268 | Accepted | Accepted | 43.47 | from bisect import bisect_left
INF = 10**18
A, B, Q = list(map(int, input().split()))
als = [int(eval(input())) for i in range(A)]
bls = [int(eval(input())) for i in range(B)]
als = [-INF]+als+[INF]
bls = [-INF]+bls+[INF]
for i in range(Q):
x = int(eval(input()))
ai = bisect_left(als,x)
bi = bisect_le... | import numpy as np
A, B, Q, *L = list(map(int, open(0).read().split()))
s = L[:A]
t = L[A:A+B]
x = L[A+B:]
s = [-float('inf')]+s+[float('inf')]
t = [-float('inf')]+t+[float('inf')]
sls = np.searchsorted(s,x)
tls = np.searchsorted(t,x)
for ar, br, c in zip(sls,tls,x):
bl = br-1
al = ar-1
n = s[ar]-t[... | 18 | 18 | 483 | 453 | from bisect import bisect_left
INF = 10**18
A, B, Q = list(map(int, input().split()))
als = [int(eval(input())) for i in range(A)]
bls = [int(eval(input())) for i in range(B)]
als = [-INF] + als + [INF]
bls = [-INF] + bls + [INF]
for i in range(Q):
x = int(eval(input()))
ai = bisect_left(als, x)
bi = bisec... | import numpy as np
A, B, Q, *L = list(map(int, open(0).read().split()))
s = L[:A]
t = L[A : A + B]
x = L[A + B :]
s = [-float("inf")] + s + [float("inf")]
t = [-float("inf")] + t + [float("inf")]
sls = np.searchsorted(s, x)
tls = np.searchsorted(t, x)
for ar, br, c in zip(sls, tls, x):
bl = br - 1
al = ar - 1
... | false | 0 | [
"-from bisect import bisect_left",
"+import numpy as np",
"-INF = 10**18",
"-A, B, Q = list(map(int, input().split()))",
"-als = [int(eval(input())) for i in range(A)]",
"-bls = [int(eval(input())) for i in range(B)]",
"-als = [-INF] + als + [INF]",
"-bls = [-INF] + bls + [INF]",
"-for i in range(Q)... | false | 0.106849 | 0.307031 | 0.348007 | [
"s873140946",
"s848800058"
] |
u924691798 | p02925 | python | s307629158 | s931722323 | 1,949 | 1,775 | 230,972 | 225,596 | Accepted | Accepted | 8.93 | def toId(i, j):
pair = A[i][j]
if i > pair:
i, pair = pair, i
return ids[i][pair]
def dfs(x):
if dp[x] != -1:
if done[x]:
return dp[x]
else:
return -1
dp[x] = 1
for y in G[x]:
res = dfs(y)
if res == -1:
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def toId(i, j):
pair = A[i][j]
if i > pair:
i, pair = pair, i
return ids[i][pair]
def dfs(x):
if dp[x] != -1:
if done[x]:
return dp[x]
else:
return -1
dp[x] = 1
f... | 45 | 49 | 998 | 1,069 | def toId(i, j):
pair = A[i][j]
if i > pair:
i, pair = pair, i
return ids[i][pair]
def dfs(x):
if dp[x] != -1:
if done[x]:
return dp[x]
else:
return -1
dp[x] = 1
for y in G[x]:
res = dfs(y)
if res == -1:
return -1
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
def toId(i, j):
pair = A[i][j]
if i > pair:
i, pair = pair, i
return ids[i][pair]
def dfs(x):
if dp[x] != -1:
if done[x]:
return dp[x]
else:
return -1
dp[x] = 1
for y in G[x]:
... | false | 8.163265 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**7)",
"+",
"+"
] | false | 0.109013 | 0.0075 | 14.535637 | [
"s307629158",
"s931722323"
] |
u596276291 | p03415 | python | s293133743 | s973729993 | 30 | 27 | 4,172 | 3,956 | Accepted | Accepted | 10 | 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... | #!/usr/bin/python3
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_cac... | 22 | 28 | 573 | 722 | 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... | #!/usr/bin/python3
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... | false | 21.428571 | [
"+#!/usr/bin/python3",
"+dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]",
"+",
"+",
"+def inside(y, x, H, W):",
"+ return 0 <= y < H and 0 <= x < W",
"- a = eval(input())",
"- b = eval(input())",
"- c = eval(input())",
"- print((a[0] + b[1] + c[2]))",
"+ C = []",
"+ for i in rang... | false | 0.04188 | 0.041915 | 0.999167 | [
"s293133743",
"s973729993"
] |
u159994501 | p03274 | python | s480503588 | s651045718 | 97 | 86 | 14,228 | 14,392 | Accepted | Accepted | 11.34 | N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
m = float("INF")
for i in range(N - K + 1):
if x[i + K - 1] * x[i] < 0:
m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))
else:
m = min(m, max(abs(x[i + K - 1]), abs(x[i])))
print(m)
| N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
m = float("INF")
for i in range(N - K + 1):
m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))
print(m)
| 9 | 6 | 302 | 199 | N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
m = float("INF")
for i in range(N - K + 1):
if x[i + K - 1] * x[i] < 0:
m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))
else:
m = min(m, max(abs(x[i + K - 1]), abs(x[i])))
print(m)
| N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
m = float("INF")
for i in range(N - K + 1):
m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))
print(m)
| false | 33.333333 | [
"- if x[i + K - 1] * x[i] < 0:",
"- m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))",
"- else:",
"- m = min(m, max(abs(x[i + K - 1]), abs(x[i])))",
"+ m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))"
] | false | 0.034715 | 0.034909 | 0.994451 | [
"s480503588",
"s651045718"
] |
u735891571 | p02555 | python | s608514357 | s700495286 | 102 | 94 | 67,960 | 65,416 | Accepted | Accepted | 7.84 | S = int(eval(input()))
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
p = 10 ** 9 + 7
N = S # N は必要分だけ用意する
fact = [1, 1] # fact[n] = (n! mod p)
factinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1] # facti... | # -*- coding: utf-8 -*-
S = int(eval(input()))
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
p = 10 ** 9 + 7
N = S # N は必要分だけ用意する
fact = [1, 1] # fact[n] = (n! mod p)
factinv = [1, 1] # factinv[n] = ((n!)^(-1) mo... | 26 | 28 | 602 | 632 | S = int(eval(input()))
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n - r] % p
p = 10**9 + 7
N = S # N は必要分だけ用意する
fact = [1, 1] # fact[n] = (n! mod p)
factinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1] # factinv 計算用
for... | # -*- coding: utf-8 -*-
S = int(eval(input()))
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n - r] % p
p = 10**9 + 7
N = S # N は必要分だけ用意する
fact = [1, 1] # fact[n] = (n! mod p)
factinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)
inv = [... | false | 7.142857 | [
"+# -*- coding: utf-8 -*-",
"-for i in range(S):",
"+for i in range(S // 3):"
] | false | 0.039676 | 0.085025 | 0.46664 | [
"s608514357",
"s700495286"
] |
u094191970 | p03633 | python | s086800720 | s155146205 | 35 | 29 | 5,048 | 9,084 | Accepted | Accepted | 17.14 | from fractions import gcd
n=int(eval(input()))
t=[int(eval(input())) for i in range(n)]
ans=1
for i in range(n):
ans=ans*t[i]//gcd(ans,t[i])
print(ans) | from math import gcd
n=int(eval(input()))
lcm=0
for i in range(n):
t=int(eval(input()))
if lcm==0:
lcm=t
else:
lcm=(t*lcm)//gcd(t,lcm)
print(lcm) | 9 | 13 | 151 | 162 | from fractions import gcd
n = int(eval(input()))
t = [int(eval(input())) for i in range(n)]
ans = 1
for i in range(n):
ans = ans * t[i] // gcd(ans, t[i])
print(ans)
| from math import gcd
n = int(eval(input()))
lcm = 0
for i in range(n):
t = int(eval(input()))
if lcm == 0:
lcm = t
else:
lcm = (t * lcm) // gcd(t, lcm)
print(lcm)
| false | 30.769231 | [
"-from fractions import gcd",
"+from math import gcd",
"-t = [int(eval(input())) for i in range(n)]",
"-ans = 1",
"+lcm = 0",
"- ans = ans * t[i] // gcd(ans, t[i])",
"-print(ans)",
"+ t = int(eval(input()))",
"+ if lcm == 0:",
"+ lcm = t",
"+ else:",
"+ lcm = (t * lcm... | false | 0.11585 | 0.070362 | 1.646488 | [
"s086800720",
"s155146205"
] |
u437215432 | p02720 | python | s418231456 | s456564263 | 41 | 34 | 3,064 | 9,324 | Accepted | Accepted | 17.07 | # ABC161D
def f(k):
if 1 <= k <= 9:
print(k)
else:
nxt = [[0,1], [0,1,2], [1,2,3], [2,3,4], [3,4,5], [4,5,6], [5,6,7], [6,7,8], [7,8,9], [8,9]]
cum_npi = [0, 9, 35, 110, 327, 956, 2782, 8089, 23527, 68468, 199368]
for length, begin in enumerate(cum_npi):
if k ... | # ABC161D
def f(k):
if 1 <= k <= 9:
print(k)
else:
nxt = [[0,1], [0,1,2], [1,2,3], [2,3,4], [3,4,5], [4,5,6], [5,6,7], [6,7,8], [7,8,9], [8,9]]
cum_npi = [0, 9, 35, 110, 327, 956, 2782, 8089, 23527, 68468, 199368]
for length, begin in enumerate(cum_npi):
if ... | 52 | 53 | 2,026 | 2,032 | # ABC161D
def f(k):
if 1 <= k <= 9:
print(k)
else:
nxt = [
[0, 1],
[0, 1, 2],
[1, 2, 3],
[2, 3, 4],
[3, 4, 5],
[4, 5, 6],
[5, 6, 7],
[6, 7, 8],
[7, 8, 9],
[8, 9],
]
... | # ABC161D
def f(k):
if 1 <= k <= 9:
print(k)
else:
nxt = [
[0, 1],
[0, 1, 2],
[1, 2, 3],
[2, 3, 4],
[3, 4, 5],
[4, 5, 6],
[5, 6, 7],
[6, 7, 8],
[7, 8, 9],
[8, 9],
]
... | false | 1.886792 | [
"- length, begin, found",
"+ # length, begin, found",
"- x",
"+ # x"
] | false | 0.077371 | 0.1073 | 0.72107 | [
"s418231456",
"s456564263"
] |
u671060652 | p03239 | python | s015411602 | s274422205 | 333 | 285 | 66,156 | 63,980 | Accepted | Accepted | 14.41 | import itertools
import math
import fractions
import functools
n, t = list(map(int, input().split()))
pair = []
for i in range(n):
ci, ti = list(map(int, input().split()))
pair.append([ci, ti])
c = 1001
for i in range(n):
if pair[i][1] <= t:
c = min(c,pair[i][0])
if c == 1001:
... | import itertools
import math
import fractions
import functools
import copy
N, T = list(map(int, input().split()))
c= []
t = []
for i in range(N):
ci, ti = list(map(int, input().split()))
c.append(ci)
t.append(ti)
cost = 10**10
for i in range(N):
if t[i] <= T:
cost = min(cos... | 18 | 21 | 336 | 371 | import itertools
import math
import fractions
import functools
n, t = list(map(int, input().split()))
pair = []
for i in range(n):
ci, ti = list(map(int, input().split()))
pair.append([ci, ti])
c = 1001
for i in range(n):
if pair[i][1] <= t:
c = min(c, pair[i][0])
if c == 1001:
print("TLE")
els... | import itertools
import math
import fractions
import functools
import copy
N, T = list(map(int, input().split()))
c = []
t = []
for i in range(N):
ci, ti = list(map(int, input().split()))
c.append(ci)
t.append(ti)
cost = 10**10
for i in range(N):
if t[i] <= T:
cost = min(cost, c[i])
if cost == ... | false | 14.285714 | [
"+import copy",
"-n, t = list(map(int, input().split()))",
"-pair = []",
"-for i in range(n):",
"+N, T = list(map(int, input().split()))",
"+c = []",
"+t = []",
"+for i in range(N):",
"- pair.append([ci, ti])",
"-c = 1001",
"-for i in range(n):",
"- if pair[i][1] <= t:",
"- c = ... | false | 0.03594 | 0.045807 | 0.784591 | [
"s015411602",
"s274422205"
] |
u282676559 | p03361 | python | s438874963 | s185439869 | 20 | 18 | 3,192 | 3,064 | Accepted | Accepted | 10 | def checkDraw(S, y, x):
return S[y][x] == '#'
H,W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
for h,ss in enumerate(S):
for w,s in enumerate(ss):
if s == '#':
if h == 0:
if w == 0:
if checkDraw(S, h+1, w) or checkDraw(S, h, w+1):
pass... | H, W = map(int, input().split())
pad_s = ['.'*(W+2)]
for h in range(H):
pad_s.append('.' + input() + '.')
pad_s.append('.'*(W+2))
for i,ss in enumerate(pad_s):
for j,s in enumerate(ss):
if s == '#'\
and pad_s[i][j+1] == '.'\
and pad_s[i][j-1] == '.'\
and pad_s[i+1][j] == '.'\
... | 67 | 18 | 1,853 | 398 | def checkDraw(S, y, x):
return S[y][x] == "#"
H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
for h, ss in enumerate(S):
for w, s in enumerate(ss):
if s == "#":
if h == 0:
if w == 0:
if checkDraw(S, h + 1, w) or checkDraw(S, ... | H, W = map(int, input().split())
pad_s = ["." * (W + 2)]
for h in range(H):
pad_s.append("." + input() + ".")
pad_s.append("." * (W + 2))
for i, ss in enumerate(pad_s):
for j, s in enumerate(ss):
if (
s == "#"
and pad_s[i][j + 1] == "."
and pad_s[i][j - 1] == "."
... | false | 73.134328 | [
"-def checkDraw(S, y, x):",
"- return S[y][x] == \"#\"",
"-",
"-",
"-H, W = list(map(int, input().split()))",
"-S = [eval(input()) for _ in range(H)]",
"-for h, ss in enumerate(S):",
"- for w, s in enumerate(ss):",
"- if s == \"#\":",
"- if h == 0:",
"- if ... | false | 0.075954 | 0.03759 | 2.020582 | [
"s438874963",
"s185439869"
] |
u350909943 | p03693 | python | s626544034 | s199398453 | 29 | 25 | 9,160 | 9,156 | Accepted | Accepted | 13.79 | vals = input().split()
s_val = ""
for v in vals:
s_val = s_val + v
i_val = int(s_val)
if i_val%4==0:
print("YES")
else:
print("NO")
| s_val = "".join(input().split())
i_val = int(s_val)
if i_val%4==0:
print("YES")
else:
print("NO")
| 11 | 7 | 151 | 109 | vals = input().split()
s_val = ""
for v in vals:
s_val = s_val + v
i_val = int(s_val)
if i_val % 4 == 0:
print("YES")
else:
print("NO")
| s_val = "".join(input().split())
i_val = int(s_val)
if i_val % 4 == 0:
print("YES")
else:
print("NO")
| false | 36.363636 | [
"-vals = input().split()",
"-s_val = \"\"",
"-for v in vals:",
"- s_val = s_val + v",
"+s_val = \"\".join(input().split())"
] | false | 0.042876 | 0.037594 | 1.140484 | [
"s626544034",
"s199398453"
] |
u239917977 | p03161 | python | s198730958 | s465911378 | 469 | 415 | 54,876 | 54,876 | Accepted | Accepted | 11.51 | def main():
import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
inf = float("inf")
dp = [inf]*N
dp[0] = 0
steps = [inf] * K
for i in range(1, N):
steps = [inf] * K
for j in range(1, min(i,... | def main():
import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
inf = float("inf")
dp = [inf]*N
dp[0] = 0
for i in range(N-1):
for j in range(1, min(K+1, (N-i))):
dp[i+j] = min(dp[i+j], abs... | 25 | 20 | 503 | 400 | def main():
import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
inf = float("inf")
dp = [inf] * N
dp[0] = 0
steps = [inf] * K
for i in range(1, N):
steps = [inf] * K
for j in range(1, min(i, K) + 1):
... | def main():
import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
inf = float("inf")
dp = [inf] * N
dp[0] = 0
for i in range(N - 1):
for j in range(1, min(K + 1, (N - i))):
dp[i + j] = min(dp[i + j], abs(H[i ... | false | 20 | [
"- steps = [inf] * K",
"- for i in range(1, N):",
"- steps = [inf] * K",
"- for j in range(1, min(i, K) + 1):",
"- steps[j - 1] = abs(H[i - j] - H[i]) + dp[i - j]",
"- step = min(steps)",
"- dp[i] = min(dp[i], step)",
"+ for i in range(N - 1):",
"+ ... | false | 0.035859 | 0.126976 | 0.282409 | [
"s198730958",
"s465911378"
] |
u536034761 | p03574 | python | s936808853 | s442003742 | 78 | 34 | 74,048 | 9,268 | Accepted | Accepted | 56.41 | h, w = list(map(int, input().split()))
ans = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
S = eval(input())
for j, s in enumerate(S):
if s == "#":
ans[i][j] = "#"
if i != 0:
if ans[i - 1][j] != "#":
ans[i - 1][j] += 1... | h, w = list(map(int, input().split()))
ans = [[0 for _ in range(w+2)] for _ in range(h+2)]
for i in range(h):
S = eval(input())
for j, s in enumerate(S):
if s == "#":
ans[i+1][j+1] = "#"
if ans[i][j+1] != "#":
ans[i][j+1] += 1
if ans[i+1][j]... | 35 | 27 | 1,201 | 865 | h, w = list(map(int, input().split()))
ans = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
S = eval(input())
for j, s in enumerate(S):
if s == "#":
ans[i][j] = "#"
if i != 0:
if ans[i - 1][j] != "#":
ans[i - 1][j] += 1
... | h, w = list(map(int, input().split()))
ans = [[0 for _ in range(w + 2)] for _ in range(h + 2)]
for i in range(h):
S = eval(input())
for j, s in enumerate(S):
if s == "#":
ans[i + 1][j + 1] = "#"
if ans[i][j + 1] != "#":
ans[i][j + 1] += 1
if ans[i + 1]... | false | 22.857143 | [
"-ans = [[0 for _ in range(w)] for _ in range(h)]",
"+ans = [[0 for _ in range(w + 2)] for _ in range(h + 2)]",
"- ans[i][j] = \"#\"",
"- if i != 0:",
"- if ans[i - 1][j] != \"#\":",
"- ans[i - 1][j] += 1",
"- if j != 0:",
"- ... | false | 0.109646 | 0.036294 | 3.021004 | [
"s936808853",
"s442003742"
] |
u761989513 | p03363 | python | s158194774 | s131051454 | 1,518 | 262 | 43,356 | 43,244 | Accepted | Accepted | 82.74 | from collections import Counter
import math
def nCr(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = int(eval(input()))
a = list(map(int, input().split()))
a_t = [0]
for i in range(n):
a_t.append(a[i] + a_t[i])
ac = Counter(a_t[1:])
ans = 0
for i in ac:
if... | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
a_t = [0]
for i in range(n):
a_t.append(a[i] + a_t[i])
a_t = collections.Counter(sorted(a_t))
ans = 0
for i in list(a_t.values()):
ans += i * (i - 1) // 2
print(ans)
| 20 | 12 | 405 | 252 | from collections import Counter
import math
def nCr(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = int(eval(input()))
a = list(map(int, input().split()))
a_t = [0]
for i in range(n):
a_t.append(a[i] + a_t[i])
ac = Counter(a_t[1:])
ans = 0
for i in ac:
if i == 0:
... | import collections
n = int(eval(input()))
a = list(map(int, input().split()))
a_t = [0]
for i in range(n):
a_t.append(a[i] + a_t[i])
a_t = collections.Counter(sorted(a_t))
ans = 0
for i in list(a_t.values()):
ans += i * (i - 1) // 2
print(ans)
| false | 40 | [
"-from collections import Counter",
"-import math",
"-",
"-",
"-def nCr(n, r):",
"- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"-",
"+import collections",
"-ac = Counter(a_t[1:])",
"+a_t = collections.Counter(sorted(a_t))",
"-for i in ac:",
"- if i == 0:",
... | false | 0.039159 | 0.038214 | 1.024722 | [
"s158194774",
"s131051454"
] |
u948524308 | p03192 | python | s468302371 | s198112849 | 19 | 17 | 2,940 | 3,064 | Accepted | Accepted | 10.53 | N = list(eval(input()))
ans = N.count("2")
print(ans) | N = eval(input())
ans = N.count("2")
print(ans) | 3 | 3 | 49 | 43 | N = list(eval(input()))
ans = N.count("2")
print(ans)
| N = eval(input())
ans = N.count("2")
print(ans)
| false | 0 | [
"-N = list(eval(input()))",
"+N = eval(input())"
] | false | 0.050291 | 0.049017 | 1.025991 | [
"s468302371",
"s198112849"
] |
u606045429 | p03053 | python | s950093638 | s277541291 | 818 | 685 | 151,472 | 161,628 | Accepted | Accepted | 16.26 | from collections import deque
H, W = [int(i) for i in input().split()]
A = [list(eval(input())) for _ in range(H)]
Q = deque((i, j, 0) for i in range(H) for j in range(W) if A[i][j] == "#")
ans = 0
while Q:
i, j, dist = Q.popleft()
ans = max(ans, dist)
for di, dj in [(1, 0), (0, 1), (-1, 0), (... | from collections import deque
H, W = [int(i) for i in input().split()]
A = [list(eval(input())) for _ in range(H)]
Q = deque()
for i in range(H):
for j in range(W):
if A[i][j] == "#":
Q.append((i, j, 0))
ma = 0
while Q:
i, j, dist = Q.popleft()
ma = max(ma, dist)
fo... | 18 | 21 | 503 | 521 | from collections import deque
H, W = [int(i) for i in input().split()]
A = [list(eval(input())) for _ in range(H)]
Q = deque((i, j, 0) for i in range(H) for j in range(W) if A[i][j] == "#")
ans = 0
while Q:
i, j, dist = Q.popleft()
ans = max(ans, dist)
for di, dj in [(1, 0), (0, 1), (-1, 0), (0, -1)]:
... | from collections import deque
H, W = [int(i) for i in input().split()]
A = [list(eval(input())) for _ in range(H)]
Q = deque()
for i in range(H):
for j in range(W):
if A[i][j] == "#":
Q.append((i, j, 0))
ma = 0
while Q:
i, j, dist = Q.popleft()
ma = max(ma, dist)
for ni, nj in [(i +... | false | 14.285714 | [
"-Q = deque((i, j, 0) for i in range(H) for j in range(W) if A[i][j] == \"#\")",
"-ans = 0",
"+Q = deque()",
"+for i in range(H):",
"+ for j in range(W):",
"+ if A[i][j] == \"#\":",
"+ Q.append((i, j, 0))",
"+ma = 0",
"- ans = max(ans, dist)",
"- for di, dj in [(1, 0), (... | false | 0.05112 | 0.051977 | 0.983518 | [
"s950093638",
"s277541291"
] |
u254871849 | p02881 | python | s438577473 | s522452489 | 147 | 116 | 2,940 | 3,060 | Accepted | Accepted | 21.09 | n = int(eval(input()))
for i in range(int(n**0.5), 0, -1):
if n % i == 0:
print((n // i + i - 2))
exit() | # 2019-11-19 19:43:48(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import arr... | 6 | 28 | 122 | 681 | n = int(eval(input()))
for i in range(int(n**0.5), 0, -1):
if n % i == 0:
print((n // i + i - 2))
exit()
| # 2019-11-19 19:43:48(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from... | false | 78.571429 | [
"-n = int(eval(input()))",
"-for i in range(int(n**0.5), 0, -1):",
"- if n % i == 0:",
"- print((n // i + i - 2))",
"- exit()",
"+# 2019-11-19 19:43:48(JST)",
"+import sys",
"+",
"+# import collections",
"+import math",
"+",
"+# from string import ascii_lowercase, ascii_upperc... | false | 0.040867 | 0.049742 | 0.821576 | [
"s438577473",
"s522452489"
] |
u952708174 | p02780 | python | s191694291 | s794085081 | 160 | 124 | 25,188 | 28,620 | Accepted | Accepted | 22.5 | def d_dice_in_line():
N, K = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]
def experience(x):
return (x + 1) / 2 # 1からxまで出るサイコロの出目の期待値
ans = []
tmp = 0
for i in range(K):
tmp += experience(P[i])
ans.append(tmp)
for i in range(K, N)... | def d_dice_in_line():
from itertools import accumulate
N, K = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]
expected_value = [0] + [(p + 1) / 2 for p in P]
cumsum = list(accumulate(expected_value))
return max([cumsum[j + K] - cumsum[j] for j in range(N - K + 1)]... | 19 | 10 | 464 | 348 | def d_dice_in_line():
N, K = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]
def experience(x):
return (x + 1) / 2 # 1からxまで出るサイコロの出目の期待値
ans = []
tmp = 0
for i in range(K):
tmp += experience(P[i])
ans.append(tmp)
for i in range(K, N):
tm... | def d_dice_in_line():
from itertools import accumulate
N, K = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]
expected_value = [0] + [(p + 1) / 2 for p in P]
cumsum = list(accumulate(expected_value))
return max([cumsum[j + K] - cumsum[j] for j in range(N - K + 1)])
pri... | false | 47.368421 | [
"+ from itertools import accumulate",
"+",
"-",
"- def experience(x):",
"- return (x + 1) / 2 # 1からxまで出るサイコロの出目の期待値",
"-",
"- ans = []",
"- tmp = 0",
"- for i in range(K):",
"- tmp += experience(P[i])",
"- ans.append(tmp)",
"- for i in range(K, N):",
"- ... | false | 0.059923 | 0.076762 | 0.780642 | [
"s191694291",
"s794085081"
] |
u037430802 | p03266 | python | s238678490 | s245352399 | 28 | 18 | 11,032 | 2,940 | Accepted | Accepted | 35.71 | n, k =list(map(int, input().split()))
ans = 0
#kで割り切れるn以下の数のリスト
odd = [i for i in range(k, n+1, k)] #kから始まり、nまで、k刻み
ans += len(odd) ** 3 #abcの選び方のため3乗
if k % 2 == 0:
#k/2から始まり、nまでで、kで割ると余りがk/2になる
even = [i for i in range(k//2, n+1, k)]
ans += len(even) ** 3
print(ans)
|
N,K = list(map(int, input().split()))
a = N // K
b = 0
if K % 2 == 0:
b = a+1 if N - a*K >= K/2 else a
print((a**3 + b**3))
| 13 | 8 | 287 | 130 | n, k = list(map(int, input().split()))
ans = 0
# kで割り切れるn以下の数のリスト
odd = [i for i in range(k, n + 1, k)] # kから始まり、nまで、k刻み
ans += len(odd) ** 3 # abcの選び方のため3乗
if k % 2 == 0:
# k/2から始まり、nまでで、kで割ると余りがk/2になる
even = [i for i in range(k // 2, n + 1, k)]
ans += len(even) ** 3
print(ans)
| N, K = list(map(int, input().split()))
a = N // K
b = 0
if K % 2 == 0:
b = a + 1 if N - a * K >= K / 2 else a
print((a**3 + b**3))
| false | 38.461538 | [
"-n, k = list(map(int, input().split()))",
"-ans = 0",
"-# kで割り切れるn以下の数のリスト",
"-odd = [i for i in range(k, n + 1, k)] # kから始まり、nまで、k刻み",
"-ans += len(odd) ** 3 # abcの選び方のため3乗",
"-if k % 2 == 0:",
"- # k/2から始まり、nまでで、kで割ると余りがk/2になる",
"- even = [i for i in range(k // 2, n + 1, k)]",
"- ans +... | false | 0.041608 | 0.040752 | 1.021002 | [
"s238678490",
"s245352399"
] |
u562446079 | p03993 | python | s275219758 | s029872171 | 90 | 81 | 13,940 | 13,876 | Accepted | Accepted | 10 | n = int(eval(input()))
L = [int(x)-1 for x in input().split()]
# for i , j in enumerate(L):
# print(i,j)
cnt = 0
for i in range(n):
if L[L[i]] == i:
cnt += 1
print((cnt//2))
| import sys
input = lambda: sys.stdin.readline()
# print = lambda: sys.stdout.writeline()
def main():
n = int(eval(input()))
L = [int(x)-1 for x in input().split()]
cnt = 0
for i in range(n):
if L[L[i]] == i:
cnt += 1
print((cnt//2))
if __name__ == '__main__':
... | 12 | 16 | 196 | 321 | n = int(eval(input()))
L = [int(x) - 1 for x in input().split()]
# for i , j in enumerate(L):
# print(i,j)
cnt = 0
for i in range(n):
if L[L[i]] == i:
cnt += 1
print((cnt // 2))
| import sys
input = lambda: sys.stdin.readline()
# print = lambda: sys.stdout.writeline()
def main():
n = int(eval(input()))
L = [int(x) - 1 for x in input().split()]
cnt = 0
for i in range(n):
if L[L[i]] == i:
cnt += 1
print((cnt // 2))
if __name__ == "__main__":
main()
| false | 25 | [
"-n = int(eval(input()))",
"-L = [int(x) - 1 for x in input().split()]",
"-# for i , j in enumerate(L):",
"-# print(i,j)",
"-cnt = 0",
"-for i in range(n):",
"- if L[L[i]] == i:",
"- cnt += 1",
"-print((cnt // 2))",
"+import sys",
"+",
"+input = lambda: sys.stdin.readline()",
"... | false | 0.044414 | 0.043958 | 1.010377 | [
"s275219758",
"s029872171"
] |
u186838327 | p02953 | python | s609677579 | s659710761 | 217 | 87 | 63,856 | 85,036 | Accepted | Accepted | 59.91 | n = int(eval(input()))
l = list(map(int, input().split()))
if n == 1:
print('Yes')
exit()
for i in reversed(list(range(n))):
if i == n-1:
continue
else:
if l[i] == l[i+1]+1:
l[i] -= 1
elif l[i] <= l[i+1]:
continue
else:
print('No')
exit()
print('Yes') | n = int(eval(input()))
H = list(map(int, input().split()))
for i in reversed(list(range(n-1))):
if H[i] <= H[i+1]:
continue
elif H[i] == H[i+1]+1:
H[i] -= 1
else:
print('No')
exit()
else:
print('Yes')
| 19 | 12 | 307 | 248 | n = int(eval(input()))
l = list(map(int, input().split()))
if n == 1:
print("Yes")
exit()
for i in reversed(list(range(n))):
if i == n - 1:
continue
else:
if l[i] == l[i + 1] + 1:
l[i] -= 1
elif l[i] <= l[i + 1]:
continue
else:
print("N... | n = int(eval(input()))
H = list(map(int, input().split()))
for i in reversed(list(range(n - 1))):
if H[i] <= H[i + 1]:
continue
elif H[i] == H[i + 1] + 1:
H[i] -= 1
else:
print("No")
exit()
else:
print("Yes")
| false | 36.842105 | [
"-l = list(map(int, input().split()))",
"-if n == 1:",
"+H = list(map(int, input().split()))",
"+for i in reversed(list(range(n - 1))):",
"+ if H[i] <= H[i + 1]:",
"+ continue",
"+ elif H[i] == H[i + 1] + 1:",
"+ H[i] -= 1",
"+ else:",
"+ print(\"No\")",
"+ e... | false | 0.036735 | 0.036486 | 1.006823 | [
"s609677579",
"s659710761"
] |
u884323674 | p02612 | python | s968509932 | s070847397 | 30 | 26 | 9,148 | 9,116 | Accepted | Accepted | 13.33 | N = int(eval(input()))
if N % 1000 == 0:
print((0))
else:
n = N // 1000
print((1000*(n+1)-N)) | N = int(eval(input()))
print((1000 * ((N - 1) // 1000 + 1) - N)) | 6 | 3 | 100 | 59 | N = int(eval(input()))
if N % 1000 == 0:
print((0))
else:
n = N // 1000
print((1000 * (n + 1) - N))
| N = int(eval(input()))
print((1000 * ((N - 1) // 1000 + 1) - N))
| false | 50 | [
"-if N % 1000 == 0:",
"- print((0))",
"-else:",
"- n = N // 1000",
"- print((1000 * (n + 1) - N))",
"+print((1000 * ((N - 1) // 1000 + 1) - N))"
] | false | 0.074965 | 0.035029 | 2.140105 | [
"s968509932",
"s070847397"
] |
u631277801 | p03325 | python | s574400185 | s679976092 | 87 | 25 | 4,148 | 4,148 | Accepted | Accepted | 71.26 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for a in A:
tmp = a
while tmp%2==0:
ans += 1
tmp //=2
print(ans) | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for a in A:
ans += bin(a)[::-1].index("1")
print(ans) | 11 | 8 | 169 | 135 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for a in A:
tmp = a
while tmp % 2 == 0:
ans += 1
tmp //= 2
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for a in A:
ans += bin(a)[::-1].index("1")
print(ans)
| false | 27.272727 | [
"- tmp = a",
"- while tmp % 2 == 0:",
"- ans += 1",
"- tmp //= 2",
"+ ans += bin(a)[::-1].index(\"1\")"
] | false | 0.061789 | 0.195231 | 0.316493 | [
"s574400185",
"s679976092"
] |
u609061751 | p03033 | python | s378824813 | s284856772 | 1,818 | 1,330 | 110,300 | 112,220 | Accepted | Accepted | 26.84 | import sys
input = lambda : sys.stdin.readline().rstrip()
class SegmentTree:
def __init__(self, n, ele, segfun):
self.ide_ele = ele
self.segfun = segfun
self.n = n
self.N0 = 1 << n.bit_length()
self.data = [self.ide_ele] * (self.N0 * 2)
def update(self, l, r... | import sys
input = lambda : sys.stdin.readline().rstrip()
class SegmentTree:
def __init__(self, n, ele, segfun):
self.ide_ele = ele
self.segfun = segfun
self.n = n
self.N0 = 1 << n.bit_length()
self.data = [self.ide_ele] * (self.N0 * 2)
def update(self, l, r... | 57 | 57 | 1,415 | 1,417 | import sys
input = lambda: sys.stdin.readline().rstrip()
class SegmentTree:
def __init__(self, n, ele, segfun):
self.ide_ele = ele
self.segfun = segfun
self.n = n
self.N0 = 1 << n.bit_length()
self.data = [self.ide_ele] * (self.N0 * 2)
def update(self, l, r, val):
... | import sys
input = lambda: sys.stdin.readline().rstrip()
class SegmentTree:
def __init__(self, n, ele, segfun):
self.ide_ele = ele
self.segfun = segfun
self.n = n
self.N0 = 1 << n.bit_length()
self.data = [self.ide_ele] * (self.N0 * 2)
def update(self, l, r, val):
... | false | 0 | [
"-stx.sort(reverse=True)",
"+# stx.sort(reverse=True)"
] | false | 0.037122 | 0.038008 | 0.976701 | [
"s378824813",
"s284856772"
] |
u389910364 | p03283 | python | s654473927 | s291491362 | 2,098 | 1,540 | 102,620 | 81,332 | Accepted | Accepted | 26.6 | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
class BinaryIndexedTree:
# http://hos.ac/slides/20140319_bit.pdf
def __init__(self, size):
"""
... | import os
import sys
import numpy as np
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
N, M, Q = list(map(int, sys.stdin.buffer.readline().split()))
LR = [list(map(int, sys.stdin.buffe... | 73 | 27 | 1,678 | 680 | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
class BinaryIndexedTree:
# http://hos.ac/slides/20140319_bit.pdf
def __init__(self, size):
"""
:param int size:
... | import os
import sys
import numpy as np
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
N, M, Q = list(map(int, sys.stdin.buffer.readline().split()))
LR = [list(map(int, sys.stdin.buffer.readline().split())) for... | false | 63.013699 | [
"+import numpy as np",
"-class BinaryIndexedTree:",
"- # http://hos.ac/slides/20140319_bit.pdf",
"- def __init__(self, size):",
"- \"\"\"",
"- :param int size:",
"- \"\"\"",
"- self._bit = [0] * size",
"- self._size = size",
"-",
"- def add(self, i, w)... | false | 0.042754 | 0.236328 | 0.180908 | [
"s654473927",
"s291491362"
] |
u392319141 | p02574 | python | s801362945 | s890539762 | 892 | 337 | 132,940 | 187,208 | Accepted | Accepted | 62.22 | from collections import Counter
from math import gcd
class Prime:
def __init__(self, N):
smallestPrime = [1] * (N + 1)
primes = []
for i in range(2, N + 1):
if smallestPrime[i] != 1:
continue
primes.append(i)
for p in range(i ... | from collections import Counter
from math import gcd
class Prime:
def __init__(self, N):
smallestPrime = [1] * (N + 1)
primes = []
for i in range(2, N + 1):
if smallestPrime[i] != 1:
continue
primes.append(i)
for p in range(i ... | 56 | 59 | 1,329 | 1,386 | from collections import Counter
from math import gcd
class Prime:
def __init__(self, N):
smallestPrime = [1] * (N + 1)
primes = []
for i in range(2, N + 1):
if smallestPrime[i] != 1:
continue
primes.append(i)
for p in range(i * 2, N + 1, ... | from collections import Counter
from math import gcd
class Prime:
def __init__(self, N):
smallestPrime = [1] * (N + 1)
primes = []
for i in range(2, N + 1):
if smallestPrime[i] != 1:
continue
primes.append(i)
for p in range(i * 2, N + 1, ... | false | 5.084746 | [
"- while (p := self.smallestPrime[n]) != 1:",
"+ while True:",
"+ p = self.smallestPrime[n]",
"+ if p == 1:",
"+ break"
] | false | 0.036948 | 0.036617 | 1.009037 | [
"s801362945",
"s890539762"
] |
u585482323 | p03575 | python | s920203760 | s152023676 | 210 | 170 | 38,384 | 38,256 | Accepted | Accepted | 19.05 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [lis... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [lis... | 77 | 86 | 2,058 | 2,394 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
r... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
r... | false | 10.465116 | [
"- self.cnt = 0",
"+ self.articulation = []",
"+ self.cnt = 0",
"+ is_articulation = False",
"+ n = 0",
"+ n += 1",
"- if self.pre[x] < self.low[y]:",
"- self.bridge.append((x, y))",
"+ if self.pre[x] <= s... | false | 0.046823 | 0.042815 | 1.09361 | [
"s920203760",
"s152023676"
] |
u644516473 | p02574 | python | s529473387 | s599401187 | 496 | 383 | 239,612 | 199,028 | Accepted | Accepted | 22.78 | from functools import reduce
from itertools import combinations
from math import gcd
def func(A):
n = len(A) - len(set(A))
if n > 0 and n+1 != A.count(1):
return False
is_A = [False] * (10**6+1)
for a in A:
is_A[a] = True
n = 0
for i in range(2, 10**6+1, 2):
... | from functools import reduce
from itertools import combinations
from math import gcd
def func(A):
is_A = [0] * (10**6+1)
for a in A:
is_A[a] += 1
if any(x > 1 for x in is_A[2:]):
return False
n = 0
for i in range(2, 10**6+1, 2):
if is_A[i]:
n += 1
... | 43 | 42 | 980 | 945 | from functools import reduce
from itertools import combinations
from math import gcd
def func(A):
n = len(A) - len(set(A))
if n > 0 and n + 1 != A.count(1):
return False
is_A = [False] * (10**6 + 1)
for a in A:
is_A[a] = True
n = 0
for i in range(2, 10**6 + 1, 2):
if is... | from functools import reduce
from itertools import combinations
from math import gcd
def func(A):
is_A = [0] * (10**6 + 1)
for a in A:
is_A[a] += 1
if any(x > 1 for x in is_A[2:]):
return False
n = 0
for i in range(2, 10**6 + 1, 2):
if is_A[i]:
n += 1
if n >... | false | 2.325581 | [
"- n = len(A) - len(set(A))",
"- if n > 0 and n + 1 != A.count(1):",
"+ is_A = [0] * (10**6 + 1)",
"+ for a in A:",
"+ is_A[a] += 1",
"+ if any(x > 1 for x in is_A[2:]):",
"- is_A = [False] * (10**6 + 1)",
"- for a in A:",
"- is_A[a] = True"
] | false | 0.440073 | 0.743642 | 0.591781 | [
"s529473387",
"s599401187"
] |
u692746605 | p03371 | python | s633490646 | s729443693 | 22 | 17 | 2,940 | 3,064 | Accepted | Accepted | 22.73 | A,B,C,X,Y=list(map(int,input().split()))
if 2*C<A+B:
print((2*C*min(X,Y)+(min(2*C,A)*(X-Y) if X>=Y else min(2*C,B)*(Y-X))))
else:
print((A*X+B*Y))
| A,B,C,X,Y=list(map(int,input().split()))
D,E=min(2*C,A),min(2*C,B)
if 2*C<A+B:
print((2*C*min(X,Y)+((X-Y)*D if X>=Y else E*(Y-X))))
else:
print((A*X+B*Y))
| 6 | 7 | 147 | 156 | A, B, C, X, Y = list(map(int, input().split()))
if 2 * C < A + B:
print(
(
2 * C * min(X, Y)
+ (min(2 * C, A) * (X - Y) if X >= Y else min(2 * C, B) * (Y - X))
)
)
else:
print((A * X + B * Y))
| A, B, C, X, Y = list(map(int, input().split()))
D, E = min(2 * C, A), min(2 * C, B)
if 2 * C < A + B:
print((2 * C * min(X, Y) + ((X - Y) * D if X >= Y else E * (Y - X))))
else:
print((A * X + B * Y))
| false | 14.285714 | [
"+D, E = min(2 * C, A), min(2 * C, B)",
"- print(",
"- (",
"- 2 * C * min(X, Y)",
"- + (min(2 * C, A) * (X - Y) if X >= Y else min(2 * C, B) * (Y - X))",
"- )",
"- )",
"+ print((2 * C * min(X, Y) + ((X - Y) * D if X >= Y else E * (Y - X))))"
] | false | 0.048736 | 0.046723 | 1.043093 | [
"s633490646",
"s729443693"
] |
u477320129 | p03107 | python | s017628520 | s767681805 | 47 | 38 | 9,856 | 9,508 | Accepted | Accepted | 19.15 | #!/usr/bin/env python3
import sys
def solve(S: str):
stack = [-1]
for c in map(int, S):
if stack[-1] + c == 1:
stack.pop()
continue
stack.append(c)
return len(S)-len(stack)+1
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main... | #!/usr/bin/env python3
import sys
def solve(S: str):
from collections import Counter
c = Counter(S)
return 2 * min(c["0"], c["1"])
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
def iterate_tokens():
for line in sys.stdin:
for word in ... | 29 | 25 | 650 | 562 | #!/usr/bin/env python3
import sys
def solve(S: str):
stack = [-1]
for c in map(int, S):
if stack[-1] + c == 1:
stack.pop()
continue
stack.append(c)
return len(S) - len(stack) + 1
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
... | #!/usr/bin/env python3
import sys
def solve(S: str):
from collections import Counter
c = Counter(S)
return 2 * min(c["0"], c["1"])
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.spli... | false | 13.793103 | [
"- stack = [-1]",
"- for c in map(int, S):",
"- if stack[-1] + c == 1:",
"- stack.pop()",
"- continue",
"- stack.append(c)",
"- return len(S) - len(stack) + 1",
"+ from collections import Counter",
"+",
"+ c = Counter(S)",
"+ return 2 * min(c... | false | 0.036611 | 0.041847 | 0.874888 | [
"s017628520",
"s767681805"
] |
u644907318 | p02983 | python | s463451488 | s453859332 | 1,348 | 60 | 3,064 | 63,956 | Accepted | Accepted | 95.55 | L,R = list(map(int,input().split()))
if R-L+1>=2019:
print((0))
else:
R = R%2019
L = L%2019
if R<L:
print((0))
else:
cmin = 2019
for i in range(L,R):
for j in range(L+1,R+1):
cmin = min(cmin,(i*j)%2019)
print(cmin) | L,R = list(map(int,input().split()))
if R-L+1>=673:
print((0))
else:
cmin = 2019
for i in range(L,R):
for j in range(i+1,R+1):
cmin = min(cmin,(i*j)%2019)
print(cmin) | 14 | 9 | 297 | 202 | L, R = list(map(int, input().split()))
if R - L + 1 >= 2019:
print((0))
else:
R = R % 2019
L = L % 2019
if R < L:
print((0))
else:
cmin = 2019
for i in range(L, R):
for j in range(L + 1, R + 1):
cmin = min(cmin, (i * j) % 2019)
print(cmin)
| L, R = list(map(int, input().split()))
if R - L + 1 >= 673:
print((0))
else:
cmin = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
cmin = min(cmin, (i * j) % 2019)
print(cmin)
| false | 35.714286 | [
"-if R - L + 1 >= 2019:",
"+if R - L + 1 >= 673:",
"- R = R % 2019",
"- L = L % 2019",
"- if R < L:",
"- print((0))",
"- else:",
"- cmin = 2019",
"- for i in range(L, R):",
"- for j in range(L + 1, R + 1):",
"- cmin = min(cmin, (i * j) %... | false | 0.097101 | 0.038673 | 2.510782 | [
"s463451488",
"s453859332"
] |
u835482198 | p03767 | python | s274533115 | s467938720 | 237 | 212 | 39,492 | 37,084 | Accepted | Accepted | 10.55 | N = int(eval(input()))
A = list(sorted(map(int, input().split())))
# N = 10
# A = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 100000... | # https://atcoder.jp/contests/agc012/tasks/agc012_a
N = int(eval(input()))
a = list(sorted(map(int, input().split())))
print((sum(a[N::2])))
| 16 | 5 | 608 | 138 | N = int(eval(input()))
A = list(sorted(map(int, input().split())))
# N = 10
# A = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 100000000... | # https://atcoder.jp/contests/agc012/tasks/agc012_a
N = int(eval(input()))
a = list(sorted(map(int, input().split())))
print((sum(a[N::2])))
| false | 68.75 | [
"+# https://atcoder.jp/contests/agc012/tasks/agc012_a",
"-A = list(sorted(map(int, input().split())))",
"-# N = 10",
"-# A = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000... | false | 0.046528 | 0.047142 | 0.986973 | [
"s274533115",
"s467938720"
] |
u624475441 | p03266 | python | s159444505 | s875687013 | 125 | 17 | 2,940 | 2,940 | Accepted | Accepted | 86.4 | N, K = list(map(int, input().split()))
print((sum(((N+a%K)//K)**2 for a in range(1,N+1) if (2*a)%K==0))) | N, K = list(map(int, input().split()))
if K % 2:
print(((N // K) ** 3))
else:
print(((N // K) ** 3 + (N // (K // 2) - N // K) ** 3)) | 2 | 5 | 97 | 134 | N, K = list(map(int, input().split()))
print((sum(((N + a % K) // K) ** 2 for a in range(1, N + 1) if (2 * a) % K == 0)))
| N, K = list(map(int, input().split()))
if K % 2:
print(((N // K) ** 3))
else:
print(((N // K) ** 3 + (N // (K // 2) - N // K) ** 3))
| false | 60 | [
"-print((sum(((N + a % K) // K) ** 2 for a in range(1, N + 1) if (2 * a) % K == 0)))",
"+if K % 2:",
"+ print(((N // K) ** 3))",
"+else:",
"+ print(((N // K) ** 3 + (N // (K // 2) - N // K) ** 3))"
] | false | 0.110481 | 0.036867 | 2.996723 | [
"s159444505",
"s875687013"
] |
u617515020 | p02862 | python | s493374185 | s167097617 | 177 | 137 | 3,064 | 9,068 | Accepted | Accepted | 22.6 | M=10**9+7
x,y=list(map(int,input().split()))
ans=0
if (x+y)%3==0:
a=(2*y-x)//3
b=(2*x-y)//3
if a>=0 and b>=0:
f1,f2=1,1
for i in range(a+1,a+b+1):
f1*=i
f1%=M
for i in range(1,b+1):
f2*=i
f2%=M
ans=f1*pow(f2,M-2,M)
print((ans%M)) | X,Y=list(map(int,input().split()))
if 2*Y<X or 2*X<Y:
print((0))
exit()
if not((X%3==0 and Y%3==0) or (X%3==1 and Y%3==2) or (X%3==2 and Y%3==1)):
print((0))
exit()
P=10**9+7
A=(2*Y-X)//3
B=(2*X-Y)//3
num = 1
for i in range(A+1, A+B+1):
num=num*i%P
den = 1
for j in range(1, B+1):
den = den*j%... | 17 | 18 | 284 | 353 | M = 10**9 + 7
x, y = list(map(int, input().split()))
ans = 0
if (x + y) % 3 == 0:
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a >= 0 and b >= 0:
f1, f2 = 1, 1
for i in range(a + 1, a + b + 1):
f1 *= i
f1 %= M
for i in range(1, b + 1):
f2 *= i
... | X, Y = list(map(int, input().split()))
if 2 * Y < X or 2 * X < Y:
print((0))
exit()
if not (
(X % 3 == 0 and Y % 3 == 0)
or (X % 3 == 1 and Y % 3 == 2)
or (X % 3 == 2 and Y % 3 == 1)
):
print((0))
exit()
P = 10**9 + 7
A = (2 * Y - X) // 3
B = (2 * X - Y) // 3
num = 1
for i in range(A + 1, A ... | false | 5.555556 | [
"-M = 10**9 + 7",
"-x, y = list(map(int, input().split()))",
"-ans = 0",
"-if (x + y) % 3 == 0:",
"- a = (2 * y - x) // 3",
"- b = (2 * x - y) // 3",
"- if a >= 0 and b >= 0:",
"- f1, f2 = 1, 1",
"- for i in range(a + 1, a + b + 1):",
"- f1 *= i",
"- ... | false | 0.097613 | 0.087437 | 1.116383 | [
"s493374185",
"s167097617"
] |
u645250356 | p03074 | python | s551786396 | s132713479 | 185 | 88 | 47,412 | 4,480 | Accepted | Accepted | 52.43 | n,k = list(map(int,input().split()))
s = eval(input())
tmp = s[0]
cnt = 1
ans = 0
ss = []
res = [0]
sum = 0
if s[0] == '0':
ss.append(0)
for i in range(1,n):
if s[i] == tmp:
cnt += 1
else:
tmp = s[i]
ss.append(cnt)
cnt = 1
ss.append(cnt)
if s[-1] == '0':
... | n,k = list(map(int,input().split()))
s = eval(input())
tmp = s[0]
cnt = 1
ss = []
if s[0] == '0':
ss.append(0)
for i in range(1,n):
if s[i] == tmp:
cnt += 1
else:
tmp = s[i]
ss.append(cnt)
cnt = 1
ss.append(cnt)
if s[-1] == '0':
ss.append(0)
ll = len(ss... | 32 | 33 | 533 | 518 | n, k = list(map(int, input().split()))
s = eval(input())
tmp = s[0]
cnt = 1
ans = 0
ss = []
res = [0]
sum = 0
if s[0] == "0":
ss.append(0)
for i in range(1, n):
if s[i] == tmp:
cnt += 1
else:
tmp = s[i]
ss.append(cnt)
cnt = 1
ss.append(cnt)
if s[-1] == "0":
ss.append(0)
l... | n, k = list(map(int, input().split()))
s = eval(input())
tmp = s[0]
cnt = 1
ss = []
if s[0] == "0":
ss.append(0)
for i in range(1, n):
if s[i] == tmp:
cnt += 1
else:
tmp = s[i]
ss.append(cnt)
cnt = 1
ss.append(cnt)
if s[-1] == "0":
ss.append(0)
ll = len(ss)
l = 0
r = k * ... | false | 3.030303 | [
"-ans = 0",
"-res = [0]",
"-sum = 0",
"-for i in range(ll):",
"- sum += ss[i]",
"- res.append(sum)",
"-if ll // 2 <= k:",
"- print(n)",
"-else:",
"- for i in range(ll - k * 2)[::2]:",
"- ans = max(ans, res[i + k * 2 + 1] - res[i])",
"- print(ans)",
"+l = 0",
"+r = k *... | false | 0.06039 | 0.104392 | 0.578489 | [
"s551786396",
"s132713479"
] |
u467736898 | p02575 | python | s428222815 | s820701843 | 694 | 509 | 53,596 | 53,476 | Accepted | Accepted | 26.66 | def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
cc.export... | def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
cc.export... | 94 | 84 | 2,859 | 2,405 | def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
cc.export(func.... | def numba_compile(numba_config):
import os, sys
if sys.argv[-1] == "ONLINE_JUDGE":
from numba import njit
from numba.pycc import CC
cc = CC("my_module")
for func, signature in numba_config:
globals()[func.__name__] = njit(signature)(func)
cc.export(func.... | false | 10.638298 | [
"- sqrtA = 500",
"+ sqrtA = 256",
"+ Data[W + 1 :] = 1 << 30",
"- def get_min(s, t):",
"- res = 1 << 62",
"- bl, br = s // sqrtA + 1, t // sqrtA",
"- if bl > br:",
"- eval_data(br)",
"- return Data[s:t].min()",
"- if bl < br:",
"- ... | false | 0.27979 | 0.194313 | 1.439893 | [
"s428222815",
"s820701843"
] |
u580273604 | p02554 | python | s461862070 | s322925379 | 392 | 28 | 9,148 | 9,060 | Accepted | Accepted | 92.86 | N=int(eval(input()))
a=1;b=1;c=1
MOD=10**9+7
for i in range(N):
a=a*10%MOD
b=b*9%MOD
c=c*8%MOD
print(((a-2*b+c)%MOD)) | N=int(eval(input()));M=10**9+7
print(((pow(10,N,M)-2*pow(9,N,M)+pow(8,N,M))%M))
| 9 | 2 | 124 | 73 | N = int(eval(input()))
a = 1
b = 1
c = 1
MOD = 10**9 + 7
for i in range(N):
a = a * 10 % MOD
b = b * 9 % MOD
c = c * 8 % MOD
print(((a - 2 * b + c) % MOD))
| N = int(eval(input()))
M = 10**9 + 7
print(((pow(10, N, M) - 2 * pow(9, N, M) + pow(8, N, M)) % M))
| false | 77.777778 | [
"-a = 1",
"-b = 1",
"-c = 1",
"-MOD = 10**9 + 7",
"-for i in range(N):",
"- a = a * 10 % MOD",
"- b = b * 9 % MOD",
"- c = c * 8 % MOD",
"-print(((a - 2 * b + c) % MOD))",
"+M = 10**9 + 7",
"+print(((pow(10, N, M) - 2 * pow(9, N, M) + pow(8, N, M)) % M))"
] | false | 0.296964 | 0.034789 | 8.536253 | [
"s461862070",
"s322925379"
] |
u022407960 | p02378 | python | s843189858 | s416809856 | 70 | 60 | 9,188 | 9,216 | Accepted | Accepted | 14.29 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 4 6
0 0
0 2
0 3
1 1
2 1
2 3
output:
3
"""
import sys
def dfs(current, matching, visited):
for target in range(y_num):
if not visited[target] and target in adj_table[current]:
visited[target] = True
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 4 6
0 0
0 2
0 3
1 1
2 1
2 3
output:
3
"""
import sys
def dfs(current, matching, visited):
for target in range(y_num):
if (not visited[target]) and (target in adj_table[current]):
visited[target] = True
... | 53 | 53 | 1,267 | 1,271 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 4 6
0 0
0 2
0 3
1 1
2 1
2 3
output:
3
"""
import sys
def dfs(current, matching, visited):
for target in range(y_num):
if not visited[target] and target in adj_table[current]:
visited[target] = True
""" Matching[target] = -1... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3 4 6
0 0
0 2
0 3
1 1
2 1
2 3
output:
3
"""
import sys
def dfs(current, matching, visited):
for target in range(y_num):
if (not visited[target]) and (target in adj_table[current]):
visited[target] = True
""" Matching[target] ... | false | 0 | [
"- if not visited[target] and target in adj_table[current]:",
"+ if (not visited[target]) and (target in adj_table[current]):"
] | false | 0.047436 | 0.048397 | 0.980139 | [
"s843189858",
"s416809856"
] |
u136090046 | p03962 | python | s735481796 | s561846675 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | val = input().split()
print((len(set(val)))) | a = input().split()
print((len(set(a)))) | 2 | 2 | 43 | 39 | val = input().split()
print((len(set(val))))
| a = input().split()
print((len(set(a))))
| false | 0 | [
"-val = input().split()",
"-print((len(set(val))))",
"+a = input().split()",
"+print((len(set(a))))"
] | false | 0.041162 | 0.040099 | 1.026512 | [
"s735481796",
"s561846675"
] |
u606045429 | p02651 | python | s163759280 | s330004930 | 150 | 100 | 9,148 | 9,152 | Accepted | Accepted | 33.33 | T = int(eval(input()))
for _ in range(T):
N = int(eval(input()))
A = [int(i) for i in input().split()]
S = eval(input())
B = []
ans = 0
for a, s in zip(reversed(A), reversed(S)):
for b in B:
a = min(a, a ^ b)
if a:
if s == "1":
... | T = int(eval(input()))
for _ in range(T):
N = int(eval(input()))
A = [int(i) for i in input().split()]
S = eval(input())
B = []
ans = 0
for a, s in zip(reversed(A), reversed(S)):
for b in B:
a = a if a < (b := a ^ b) else b
if a:
if s == "1"... | 19 | 19 | 379 | 394 | T = int(eval(input()))
for _ in range(T):
N = int(eval(input()))
A = [int(i) for i in input().split()]
S = eval(input())
B = []
ans = 0
for a, s in zip(reversed(A), reversed(S)):
for b in B:
a = min(a, a ^ b)
if a:
if s == "1":
ans = 1
... | T = int(eval(input()))
for _ in range(T):
N = int(eval(input()))
A = [int(i) for i in input().split()]
S = eval(input())
B = []
ans = 0
for a, s in zip(reversed(A), reversed(S)):
for b in B:
a = a if a < (b := a ^ b) else b
if a:
if s == "1":
... | false | 0 | [
"- a = min(a, a ^ b)",
"+ a = a if a < (b := a ^ b) else b"
] | false | 0.049257 | 0.048779 | 1.009783 | [
"s163759280",
"s330004930"
] |
u917092881 | p02939 | python | s906225155 | s129387712 | 103 | 80 | 3,500 | 3,628 | Accepted | Accepted | 22.33 | s = str(eval(input()))
l = len(s)
counter = 0
prev = None
pivot = 0
while pivot < l:
n = 1
if prev == s[pivot]:
if pivot + 1 < l:
if pivot + 2 < l:
prev = s[pivot + 2]
counter += 2
pivot += 3
else:
... | s = str(eval(input()))
cur = ""
prev = ""
counter = 0
for i in range(len(s)):
cur += s[i]
if cur != prev:
counter += 1
prev = cur
cur = ""
print((int(counter))) | 26 | 12 | 484 | 196 | s = str(eval(input()))
l = len(s)
counter = 0
prev = None
pivot = 0
while pivot < l:
n = 1
if prev == s[pivot]:
if pivot + 1 < l:
if pivot + 2 < l:
prev = s[pivot + 2]
counter += 2
pivot += 3
else:
counter += 1
... | s = str(eval(input()))
cur = ""
prev = ""
counter = 0
for i in range(len(s)):
cur += s[i]
if cur != prev:
counter += 1
prev = cur
cur = ""
print((int(counter)))
| false | 53.846154 | [
"-l = len(s)",
"+cur = \"\"",
"+prev = \"\"",
"-prev = None",
"-pivot = 0",
"-while pivot < l:",
"- n = 1",
"- if prev == s[pivot]:",
"- if pivot + 1 < l:",
"- if pivot + 2 < l:",
"- prev = s[pivot + 2]",
"- counter += 2",
"- ... | false | 0.043799 | 0.039873 | 1.098463 | [
"s906225155",
"s129387712"
] |
u957167787 | p03137 | python | s043440394 | s902706526 | 148 | 112 | 13,960 | 13,960 | Accepted | Accepted | 24.32 | import heapq
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
dist = [0]*(M-1)
for i in range(M-1):
dist[i] = -(X[i+1] - X[i])
#print(dist)
heapq.heapify(dist)
for i in range(N-1):
if len(dist) == 0:
break
heapq.heappop(dist)
ans = 0
if len(... | N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
dist = [0]*(M-1)
for i in range(M-1):
dist[i] = X[i+1] - X[i]
dist.sort()
ans = 0
if N < M:
for i in range((M-1)-(N-1)):
ans += dist[i]
print(ans) | 22 | 16 | 360 | 259 | import heapq
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
dist = [0] * (M - 1)
for i in range(M - 1):
dist[i] = -(X[i + 1] - X[i])
# print(dist)
heapq.heapify(dist)
for i in range(N - 1):
if len(dist) == 0:
break
heapq.heappop(dist)
ans = 0
if len(dist) != 0:
... | N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
dist = [0] * (M - 1)
for i in range(M - 1):
dist[i] = X[i + 1] - X[i]
dist.sort()
ans = 0
if N < M:
for i in range((M - 1) - (N - 1)):
ans += dist[i]
print(ans)
| false | 27.272727 | [
"-import heapq",
"-",
"- dist[i] = -(X[i + 1] - X[i])",
"-# print(dist)",
"-heapq.heapify(dist)",
"-for i in range(N - 1):",
"- if len(dist) == 0:",
"- break",
"- heapq.heappop(dist)",
"+ dist[i] = X[i + 1] - X[i]",
"+dist.sort()",
"-if len(dist) != 0:",
"- ans = -sum(d... | false | 0.14124 | 0.076962 | 1.835207 | [
"s043440394",
"s902706526"
] |
u130900604 | p02780 | python | s289540016 | s817324056 | 238 | 118 | 77,448 | 105,852 | Accepted | Accepted | 50.42 | n,k=list(map(int,input().split()))
p=list(map(int,input().split()))
p=[pp+1 for pp in p]
ans=sum(p[0:k])
last=ans
for i in range(n-k):
tmp=last-p[i]+p[i+k]
ans=max(ans,tmp)
last=tmp
ans/=2
print(ans) | n,k,*a=list(map(int,open(0).read().split()))
b=[q+1 for q in a]
ans=sum(b[:k])
now=ans
for i in range(k,n):
now=now+b[i]-b[i-k]
ans=max(ans,now)
print((ans/2)) | 12 | 8 | 211 | 162 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p = [pp + 1 for pp in p]
ans = sum(p[0:k])
last = ans
for i in range(n - k):
tmp = last - p[i] + p[i + k]
ans = max(ans, tmp)
last = tmp
ans /= 2
print(ans)
| n, k, *a = list(map(int, open(0).read().split()))
b = [q + 1 for q in a]
ans = sum(b[:k])
now = ans
for i in range(k, n):
now = now + b[i] - b[i - k]
ans = max(ans, now)
print((ans / 2))
| false | 33.333333 | [
"-n, k = list(map(int, input().split()))",
"-p = list(map(int, input().split()))",
"-p = [pp + 1 for pp in p]",
"-ans = sum(p[0:k])",
"-last = ans",
"-for i in range(n - k):",
"- tmp = last - p[i] + p[i + k]",
"- ans = max(ans, tmp)",
"- last = tmp",
"-ans /= 2",
"-print(ans)",
"+n, k... | false | 0.038637 | 0.038555 | 1.002111 | [
"s289540016",
"s817324056"
] |
u588341295 | p03221 | python | s433099868 | s116883318 | 856 | 528 | 47,968 | 36,088 | Accepted | Accepted | 38.32 | # -*- coding: utf-8 -*-
class City:
def __init__(self, id, pref, year):
self.id = id
self.pref = pref
self.year = year
self.num = 0
N,M = list(map(int, input().split()))
cities = []
for i in range(M):
p, y = list(map(int, input().split()))
cities.append(City(i+... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 29 | 36 | 673 | 983 | # -*- coding: utf-8 -*-
class City:
def __init__(self, id, pref, year):
self.id = id
self.pref = pref
self.year = year
self.num = 0
N, M = list(map(int, input().split()))
cities = []
for i in range(M):
p, y = list(map(int, input().split()))
cities.append(City(i + 1, p, y))
... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 19.444444 | [
"-class City:",
"- def __init__(self, id, pref, year):",
"- self.id = id",
"- self.pref = pref",
"- self.year = year",
"- self.num = 0",
"+import sys",
"-N, M = list(map(int, input().split()))",
"-cities = []",
"-for i in range(M):",
"- p, y = list(map(int, inpu... | false | 0.078528 | 0.059175 | 1.327041 | [
"s433099868",
"s116883318"
] |
u472696272 | p02777 | python | s016699832 | s309285252 | 24 | 18 | 3,060 | 2,940 | Accepted | Accepted | 25 | s1, s2 = input().split()
a, b = list(map(int, input().split()))
s3 = eval(input())
if s1==s3:
print((a-1, ' ', b))
elif s2==s3:
print((a, ' ', b-1)) | s,t = input().split()
a,b = list(map(int,input().split()))
u = eval(input())
if u==s:
a -= 1
else:
b -= 1
print((a,' ',b))
| 8 | 8 | 144 | 120 | s1, s2 = input().split()
a, b = list(map(int, input().split()))
s3 = eval(input())
if s1 == s3:
print((a - 1, " ", b))
elif s2 == s3:
print((a, " ", b - 1))
| s, t = input().split()
a, b = list(map(int, input().split()))
u = eval(input())
if u == s:
a -= 1
else:
b -= 1
print((a, " ", b))
| false | 0 | [
"-s1, s2 = input().split()",
"+s, t = input().split()",
"-s3 = eval(input())",
"-if s1 == s3:",
"- print((a - 1, \" \", b))",
"-elif s2 == s3:",
"- print((a, \" \", b - 1))",
"+u = eval(input())",
"+if u == s:",
"+ a -= 1",
"+else:",
"+ b -= 1",
"+print((a, \" \", b))"
] | false | 0.047197 | 0.048555 | 0.97203 | [
"s016699832",
"s309285252"
] |
u374531474 | p03503 | python | s540603167 | s275493862 | 500 | 175 | 3,064 | 3,064 | Accepted | Accepted | 65 | N = int(eval(input()))
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
ans = -10 ** 10
for b in range(1, 2 ** 10):
bin_str = format(b, '010b')
p = 0
for i in range(N):
c = 0
for j in range(10):
c += F[i][... | N = int(eval(input()))
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
ans = -10 ** 10
def calc(b):
p = 0
for i in range(N):
c = 0
for j in range(10):
c += F[i][j] * b[j]
p += P[i][c]
return p
... | 15 | 28 | 392 | 531 | N = int(eval(input()))
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
ans = -(10**10)
for b in range(1, 2**10):
bin_str = format(b, "010b")
p = 0
for i in range(N):
c = 0
for j in range(10):
c += F[i][j] * int(bin_s... | N = int(eval(input()))
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
ans = -(10**10)
def calc(b):
p = 0
for i in range(N):
c = 0
for j in range(10):
c += F[i][j] * b[j]
p += P[i][c]
return p
def dfs(b):... | false | 46.428571 | [
"-for b in range(1, 2**10):",
"- bin_str = format(b, \"010b\")",
"+",
"+",
"+def calc(b):",
"- c += F[i][j] * int(bin_str[j])",
"+ c += F[i][j] * b[j]",
"- ans = max(ans, p)",
"+ return p",
"+",
"+",
"+def dfs(b):",
"+ global ans",
"+ if len(b) == 10:",... | false | 0.007149 | 0.078613 | 0.090944 | [
"s540603167",
"s275493862"
] |
u340500592 | p02394 | python | s651494077 | s350411424 | 30 | 20 | 7,664 | 7,668 | Accepted | Accepted | 33.33 | W, H, x, y, r = list(map(int, input().split()))
if x + r <= W and x - r >= 0 and y + r <= H and y - r >= 0:
print('Yes')
else:
print('No') | W, H, x, y, r = list(map(int, input().split()))
if (0 <= x-r and x+r <= W) and (0 <= y-r and y+r <= H):
print('Yes')
else:
print('No') | 5 | 5 | 138 | 134 | W, H, x, y, r = list(map(int, input().split()))
if x + r <= W and x - r >= 0 and y + r <= H and y - r >= 0:
print("Yes")
else:
print("No")
| W, H, x, y, r = list(map(int, input().split()))
if (0 <= x - r and x + r <= W) and (0 <= y - r and y + r <= H):
print("Yes")
else:
print("No")
| false | 0 | [
"-if x + r <= W and x - r >= 0 and y + r <= H and y - r >= 0:",
"+if (0 <= x - r and x + r <= W) and (0 <= y - r and y + r <= H):"
] | false | 0.04206 | 0.041167 | 1.021702 | [
"s651494077",
"s350411424"
] |
u197457087 | p03579 | python | s343536610 | s311173695 | 541 | 362 | 31,288 | 35,344 | Accepted | Accepted | 33.09 | import sys
sys.setrecursionlimit(10**7)
N, M = list(map(int,input().split()))
michi = [[] for i in range(N)]
for i in range(M):
tempa, tempb = list(map(int,input().split()))
michi[tempa-1].append(tempb-1)
michi[tempb-1].append(tempa-1)
#print(michi)
colors = [0 for i in range(N)]
def dfs(v,col... | import sys
sys.setrecursionlimit(10**7)
N,M = list(map(int,input().split()))
edge = [[] for _ in range(N)]
for i in range(M):
a,b = list(map(int,input().split()))
a-=1;b-=1
edge[a].append(b)
edge[b].append(a)
#print(edge)
colors = [0 for i in range(N)]
def dfs(v,color):
colors[v] = color
fo... | 30 | 34 | 617 | 667 | import sys
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
michi = [[] for i in range(N)]
for i in range(M):
tempa, tempb = list(map(int, input().split()))
michi[tempa - 1].append(tempb - 1)
michi[tempb - 1].append(tempa - 1)
# print(michi)
colors = [0 for i in range(N)]
def dfs(v, co... | import sys
sys.setrecursionlimit(10**7)
N, M = list(map(int, input().split()))
edge = [[] for _ in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edge[a].append(b)
edge[b].append(a)
# print(edge)
colors = [0 for i in range(N)]
def dfs(v, color):
colors[v] = ... | false | 11.764706 | [
"-michi = [[] for i in range(N)]",
"+edge = [[] for _ in range(N)]",
"- tempa, tempb = list(map(int, input().split()))",
"- michi[tempa - 1].append(tempb - 1)",
"- michi[tempb - 1].append(tempa - 1)",
"-# print(michi)",
"+ a, b = list(map(int, input().split()))",
"+ a -= 1",
"+ b -... | false | 0.074229 | 0.037996 | 1.953619 | [
"s343536610",
"s311173695"
] |
u705621008 | p03262 | python | s304962565 | s081587454 | 96 | 84 | 15,020 | 15,020 | Accepted | Accepted | 12.5 | n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
def gcd(x, y):
while (y != 0):
x, y = y, x%y
return x
diff = []
for j in l:
diff.append(abs(j - x))
ans = diff[0]
for d in diff[1:]:
ans = gcd(ans, d)
print(ans)
| n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
def gcd(x, y):
while (y != 0):
x, y = y, x%y
return x
ans = abs(l[0] - x)
for d in l[1:]:
ans = gcd(ans, abs(d - x))
print(ans)
| 23 | 15 | 287 | 236 | n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
def gcd(x, y):
while y != 0:
x, y = y, x % y
return x
diff = []
for j in l:
diff.append(abs(j - x))
ans = diff[0]
for d in diff[1:]:
ans = gcd(ans, d)
print(ans)
| n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
def gcd(x, y):
while y != 0:
x, y = y, x % y
return x
ans = abs(l[0] - x)
for d in l[1:]:
ans = gcd(ans, abs(d - x))
print(ans)
| false | 34.782609 | [
"-diff = []",
"-for j in l:",
"- diff.append(abs(j - x))",
"-ans = diff[0]",
"-for d in diff[1:]:",
"- ans = gcd(ans, d)",
"+ans = abs(l[0] - x)",
"+for d in l[1:]:",
"+ ans = gcd(ans, abs(d - x))"
] | false | 0.041098 | 0.040286 | 1.020162 | [
"s304962565",
"s081587454"
] |
u761320129 | p03231 | python | s557364076 | s899484703 | 47 | 38 | 5,560 | 5,432 | Accepted | Accepted | 19.15 | from fractions import gcd
N,M = list(map(int,input().split()))
S = eval(input())
T = eval(input())
g = gcd(N,M)
ans = N*M//g
print((ans if S[::N//g] == T[::M//g] else -1)) | from fractions import gcd
N,M = list(map(int,input().split()))
S = eval(input())
T = eval(input())
g = gcd(N,M)
l = N*M//g
for i in range(g):
if S[N*i//g] != T[M*i//g]:
print((-1))
exit()
print(l) | 7 | 12 | 157 | 208 | from fractions import gcd
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
g = gcd(N, M)
ans = N * M // g
print((ans if S[:: N // g] == T[:: M // g] else -1))
| from fractions import gcd
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
g = gcd(N, M)
l = N * M // g
for i in range(g):
if S[N * i // g] != T[M * i // g]:
print((-1))
exit()
print(l)
| false | 41.666667 | [
"-ans = N * M // g",
"-print((ans if S[:: N // g] == T[:: M // g] else -1))",
"+l = N * M // g",
"+for i in range(g):",
"+ if S[N * i // g] != T[M * i // g]:",
"+ print((-1))",
"+ exit()",
"+print(l)"
] | false | 0.18075 | 0.096488 | 1.873284 | [
"s557364076",
"s899484703"
] |
u393224521 | p02683 | python | s712911782 | s470995806 | 125 | 106 | 71,496 | 70,296 | Accepted | Accepted | 15.2 | import sys
n,m,x= list(map(int, sys.stdin.readline().rstrip("\n").split()))
lines = [ [int(s) for s in line.split()] for line in sys.stdin ]
books = {}
num = 0
for a in range(2):
for b in range(2):
for c in range(2):
for d in range(2):
for e in range(2):
... | import sys
n,m,x= list(map(int, sys.stdin.readline().rstrip("\n").split()))
lines = [ [int(s) for s in line.split()] for line in sys.stdin ]
books = {}
num = 0
for a in range(2):
for b in range(2):
for c in range(2):
for d in range(2):
for e in range(2):
... | 41 | 40 | 1,407 | 1,333 | import sys
n, m, x = list(map(int, sys.stdin.readline().rstrip("\n").split()))
lines = [[int(s) for s in line.split()] for line in sys.stdin]
books = {}
num = 0
for a in range(2):
for b in range(2):
for c in range(2):
for d in range(2):
for e in range(2):
for... | import sys
n, m, x = list(map(int, sys.stdin.readline().rstrip("\n").split()))
lines = [[int(s) for s in line.split()] for line in sys.stdin]
books = {}
num = 0
for a in range(2):
for b in range(2):
for c in range(2):
for d in range(2):
for e in range(2):
for... | false | 2.439024 | [
"- for o in range(2):",
"- books[num] = [",
"- a,",
"- b,",
"- ... | false | 0.200551 | 0.205308 | 0.976829 | [
"s712911782",
"s470995806"
] |
u260980560 | p01104 | python | s180817221 | s817026702 | 4,750 | 220 | 193,612 | 20,380 | Accepted | Accepted | 95.37 | ans = []
while 1:
n, m = map(int, input().split())
if n+m == 0:
break
C = {0: 0}
for i in range(n):
b = int(input(), 2)
for k, v in dict(C).items():
if C.get(k^b, 0) < v+1:
C[k^b] = v+1
ans.append(C[0])
print(*ans, sep="\n")
| def make(n):
C = {0: 0}
for i in range(n):
b = int(input(), 2)
for k, v in dict(C).items():
if C.get(k^b, 0) < v+1:
C[k^b] = v+1
return C
def calc(P, Q):
yield 0
for k, v in P.items():
if k in Q:
yield v + Q[k]
def solve():... | 13 | 20 | 308 | 495 | ans = []
while 1:
n, m = map(int, input().split())
if n + m == 0:
break
C = {0: 0}
for i in range(n):
b = int(input(), 2)
for k, v in dict(C).items():
if C.get(k ^ b, 0) < v + 1:
C[k ^ b] = v + 1
ans.append(C[0])
print(*ans, sep="\n")
| def make(n):
C = {0: 0}
for i in range(n):
b = int(input(), 2)
for k, v in dict(C).items():
if C.get(k ^ b, 0) < v + 1:
C[k ^ b] = v + 1
return C
def calc(P, Q):
yield 0
for k, v in P.items():
if k in Q:
yield v + Q[k]
def solve():
... | false | 35 | [
"-ans = []",
"-while 1:",
"- n, m = map(int, input().split())",
"- if n + m == 0:",
"- break",
"+def make(n):",
"- ans.append(C[0])",
"-print(*ans, sep=\"\\n\")",
"+ return C",
"+",
"+",
"+def calc(P, Q):",
"+ yield 0",
"+ for k, v in P.items():",
"+ if k ... | false | 0.079146 | 0.038076 | 2.078649 | [
"s180817221",
"s817026702"
] |
u158380546 | p02583 | python | s199250736 | s826066607 | 160 | 90 | 9,192 | 9,124 | Accepted | Accepted | 43.75 | n = int(eval(input()))
x = list(map(int,input().split()))
x.sort()
con = 0
for p in range(n):
for q in range(p+1,n):
for r in range(q+1,n):
if x[p] != x[q] and x[q] != x[r] and x[r] < (x[p] + x[q]) and x[q] < (x[p] + x[r]) and (x[r]-x[p]) < x[q] and (x[r]-x[q]) < x[p] and (x[q]-x[p]... | n = int(eval(input()))
x = list(map(int,input().split()))
x.sort()
con = 0
for p in range(n):
for q in range(p+1,n):
for r in range(q+1,n):
if x[p] != x[q] and x[q] != x[r] and x[r] < (x[p] + x[q]):
con += 1
print(con);
| 14 | 14 | 380 | 287 | n = int(eval(input()))
x = list(map(int, input().split()))
x.sort()
con = 0
for p in range(n):
for q in range(p + 1, n):
for r in range(q + 1, n):
if (
x[p] != x[q]
and x[q] != x[r]
and x[r] < (x[p] + x[q])
and x[q] < (x[p] + x[r])
... | n = int(eval(input()))
x = list(map(int, input().split()))
x.sort()
con = 0
for p in range(n):
for q in range(p + 1, n):
for r in range(q + 1, n):
if x[p] != x[q] and x[q] != x[r] and x[r] < (x[p] + x[q]):
con += 1
print(con)
| false | 0 | [
"- if (",
"- x[p] != x[q]",
"- and x[q] != x[r]",
"- and x[r] < (x[p] + x[q])",
"- and x[q] < (x[p] + x[r])",
"- and (x[r] - x[p]) < x[q]",
"- and (x[r] - x[q]) < x[p]",
"- and (x[q] - x... | false | 0.046657 | 0.064081 | 0.728098 | [
"s199250736",
"s826066607"
] |
u905582793 | p03061 | python | s825306787 | s713108343 | 1,875 | 941 | 121,880 | 95,208 | Accepted | Accepted | 49.81 | def gcd(a,b):
if a*b == 0:
return max(a,b)
if a<b:
a,b = b,a
return gcd(b,a%b)
n = int(eval(input()))
ls = list(map(int,input().split()))
length = 2**(n.bit_length())
calc = gcd
unit = 0
Seg = [unit for i in range(length*2-1)]
def init():
for i in range(n):
Seg[i+length-1] = ls[i]
f... | from fractions import gcd
ide = 0
def func(a,b):
return gcd(a,b)
class SegmentTree:
def __init__(self,ls):
n = len(ls)
self.tree = [ide for i in range(n)]+ls
for i in range(1,n)[::-1]:
self.tree[i] = func(self.tree[i<<1|0],self.tree[i<<1|1])
def get(self,l,r):
ret = ide
l += ... | 38 | 42 | 841 | 918 | def gcd(a, b):
if a * b == 0:
return max(a, b)
if a < b:
a, b = b, a
return gcd(b, a % b)
n = int(eval(input()))
ls = list(map(int, input().split()))
length = 2 ** (n.bit_length())
calc = gcd
unit = 0
Seg = [unit for i in range(length * 2 - 1)]
def init():
for i in range(n):
... | from fractions import gcd
ide = 0
def func(a, b):
return gcd(a, b)
class SegmentTree:
def __init__(self, ls):
n = len(ls)
self.tree = [ide for i in range(n)] + ls
for i in range(1, n)[::-1]:
self.tree[i] = func(self.tree[i << 1 | 0], self.tree[i << 1 | 1])
def get(s... | false | 9.52381 | [
"-def gcd(a, b):",
"- if a * b == 0:",
"- return max(a, b)",
"- if a < b:",
"- a, b = b, a",
"- return gcd(b, a % b)",
"+from fractions import gcd",
"+",
"+ide = 0",
"-n = int(eval(input()))",
"-ls = list(map(int, input().split()))",
"-length = 2 ** (n.bit_length())",
... | false | 0.193394 | 0.063294 | 3.055502 | [
"s825306787",
"s713108343"
] |
u297574184 | p02951 | python | s246987634 | s168073744 | 20 | 18 | 3,316 | 2,940 | Accepted | Accepted | 10 | A, B, C = list(map(int, input().split()))
C -= A-B
if C < 0:
C = 0
print(C)
| A, B, C = list(map(int, input().split()))
d = min(A-B, C)
print((C-d))
| 7 | 4 | 82 | 67 | A, B, C = list(map(int, input().split()))
C -= A - B
if C < 0:
C = 0
print(C)
| A, B, C = list(map(int, input().split()))
d = min(A - B, C)
print((C - d))
| false | 42.857143 | [
"-C -= A - B",
"-if C < 0:",
"- C = 0",
"-print(C)",
"+d = min(A - B, C)",
"+print((C - d))"
] | false | 0.033723 | 0.03627 | 0.929777 | [
"s246987634",
"s168073744"
] |
u102242691 | p03548 | python | s009860620 | s081221437 | 27 | 18 | 3,060 | 2,940 | Accepted | Accepted | 33.33 |
x,y,z = list(map(int,input().split()))
ans = 0
while (y + z) * ans <= (x - z):
ans += 1
# print((y + z) * ans)
# print(ans)
print((ans-1))
|
x,y,z = list(map(int,input().split()))
ans = int((x-z)//(y+z))
print(ans)
| 11 | 4 | 155 | 72 | x, y, z = list(map(int, input().split()))
ans = 0
while (y + z) * ans <= (x - z):
ans += 1
# print((y + z) * ans)
# print(ans)
print((ans - 1))
| x, y, z = list(map(int, input().split()))
ans = int((x - z) // (y + z))
print(ans)
| false | 63.636364 | [
"-ans = 0",
"-while (y + z) * ans <= (x - z):",
"- ans += 1",
"-# print((y + z) * ans)",
"-# print(ans)",
"-print((ans - 1))",
"+ans = int((x - z) // (y + z))",
"+print(ans)"
] | false | 0.134592 | 0.042259 | 3.184966 | [
"s009860620",
"s081221437"
] |
u385497113 | p00015 | python | s764368584 | s521626063 | 20 | 10 | 4,232 | 4,240 | Accepted | Accepted | 50 | #! -*- coding: utf-8-unix -*-
import sys
# if __name__=='__main__':
# lines = [int(x.strip()) for x in sys.stdin.readlines()]
# print lines
# n = lines[0]
# for i in xrange(n):
# # a, b = int(lines[i+1]), int(lines[i+2])
# a, b = lines[2*i+1], lines[2*i+2]
# if len(str(a+b)) > 80:
# ... | import sys
if __name__=='__main__':
lines = [int(x.strip()) for x in sys.stdin.readlines() if x != '' and x != '\n']
n = lines[0]
for i in range(n):
a, b = lines[2*i+1], lines[2*i+2]
if len(str(a+b)) > 80:
print('overflow')
else:
print(a+b) | 27 | 11 | 713 | 269 | #! -*- coding: utf-8-unix -*-
import sys
# if __name__=='__main__':
# lines = [int(x.strip()) for x in sys.stdin.readlines()]
# print lines
# n = lines[0]
# for i in xrange(n):
# # a, b = int(lines[i+1]), int(lines[i+2])
# a, b = lines[2*i+1], lines[2*i+2]
# if len(str(a+b)) > 80:
# print 'ov... | import sys
if __name__ == "__main__":
lines = [int(x.strip()) for x in sys.stdin.readlines() if x != "" and x != "\n"]
n = lines[0]
for i in range(n):
a, b = lines[2 * i + 1], lines[2 * i + 2]
if len(str(a + b)) > 80:
print("overflow")
else:
print(a + b)
| false | 59.259259 | [
"-#! -*- coding: utf-8-unix -*-",
"-# if __name__=='__main__':",
"-# lines = [int(x.strip()) for x in sys.stdin.readlines()]",
"-# print lines",
"-# n = lines[0]",
"-# for i in xrange(n):",
"-# # a, b = int(lines[i+1]), int(lines[i+2])",
"-# a, b = lines[2*i+1], lines[2*i+2]",
"-# ... | false | 0.06722 | 0.065118 | 1.032278 | [
"s764368584",
"s521626063"
] |
u729133443 | p03095 | python | s960616120 | s605223396 | 168 | 21 | 45,168 | 3,188 | Accepted | Accepted | 87.5 | eval(input());s=eval(input())
a,*b=[s.count(i)+1for i in set(s)]
for t in b:a=t*a%(10**9+7)
print((a-1)) |
eval(input());s=eval(input())
a,*b=list(map(s.count,set(s)));a+=1
for t in b:a=-~t*a%(10**9+7)
print((a-1)) | 4 | 5 | 93 | 92 | eval(input())
s = eval(input())
a, *b = [s.count(i) + 1 for i in set(s)]
for t in b:
a = t * a % (10**9 + 7)
print((a - 1))
| eval(input())
s = eval(input())
a, *b = list(map(s.count, set(s)))
a += 1
for t in b:
a = -~t * a % (10**9 + 7)
print((a - 1))
| false | 20 | [
"-a, *b = [s.count(i) + 1 for i in set(s)]",
"+a, *b = list(map(s.count, set(s)))",
"+a += 1",
"- a = t * a % (10**9 + 7)",
"+ a = -~t * a % (10**9 + 7)"
] | false | 0.060661 | 0.173714 | 0.349198 | [
"s960616120",
"s605223396"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.