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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u987164499 | p03456 | python | s457780077 | s960854121 | 149 | 17 | 12,456 | 2,940 | Accepted | Accepted | 88.59 | from sys import stdin
from itertools import combinations
from math import factorial
import numpy as np
import math
a,b = [int(x) for x in stdin.readline().rstrip().split()]
c = int(str(a)+str(b))
if int(math.sqrt(c))**2 == c:
print("Yes")
else:
print("No") | a,b = list(map(int,input().split()))
n = int(str(a)+str(b))
for i in range(1,350):
if i**2 == n:
print("Yes")
exit()
print("No") | 14 | 10 | 280 | 154 | from sys import stdin
from itertools import combinations
from math import factorial
import numpy as np
import math
a, b = [int(x) for x in stdin.readline().rstrip().split()]
c = int(str(a) + str(b))
if int(math.sqrt(c)) ** 2 == c:
print("Yes")
else:
print("No")
| a, b = list(map(int, input().split()))
n = int(str(a) + str(b))
for i in range(1, 350):
if i**2 == n:
print("Yes")
exit()
print("No")
| false | 28.571429 | [
"-from sys import stdin",
"-from itertools import combinations",
"-from math import factorial",
"-import numpy as np",
"-import math",
"-",
"-a, b = [int(x) for x in stdin.readline().rstrip().split()]",
"-c = int(str(a) + str(b))",
"-if int(math.sqrt(c)) ** 2 == c:",
"- print(\"Yes\")",
"-els... | false | 0.041311 | 0.033241 | 1.242745 | [
"s457780077",
"s960854121"
] |
u690037900 | p03221 | python | s223348421 | s054765063 | 683 | 484 | 41,024 | 36,400 | Accepted | Accepted | 29.14 | import bisect
import collections
N,M=list(map(int,input().split()))
L=collections.defaultdict(list)
p=[[int(j) for j in input().split()] for i in range(M)]
for x,y in sorted(p):
L[x]+=[y]
for x,y in p:
z=bisect.bisect(L[x],y)
print(("%06d%06d"%(x,z)))
| import sys
import collections
import bisect as bs
input=sys.stdin.readline
n,m=list(map(int,input().split()))
d=collections.defaultdict(list)
L=[]
for i in range(m):
a,b=list(map(int,input().split()))
L.append((a,b))
for x,y in sorted(L):
d[x].append(y)
for x,y in L:
z=bs.bisect(d[x],y)
... | 10 | 15 | 265 | 333 | import bisect
import collections
N, M = list(map(int, input().split()))
L = collections.defaultdict(list)
p = [[int(j) for j in input().split()] for i in range(M)]
for x, y in sorted(p):
L[x] += [y]
for x, y in p:
z = bisect.bisect(L[x], y)
print(("%06d%06d" % (x, z)))
| import sys
import collections
import bisect as bs
input = sys.stdin.readline
n, m = list(map(int, input().split()))
d = collections.defaultdict(list)
L = []
for i in range(m):
a, b = list(map(int, input().split()))
L.append((a, b))
for x, y in sorted(L):
d[x].append(y)
for x, y in L:
z = bs.bisect(d[x]... | false | 33.333333 | [
"-import bisect",
"+import sys",
"+import bisect as bs",
"-N, M = list(map(int, input().split()))",
"-L = collections.defaultdict(list)",
"-p = [[int(j) for j in input().split()] for i in range(M)]",
"-for x, y in sorted(p):",
"- L[x] += [y]",
"-for x, y in p:",
"- z = bisect.bisect(L[x], y)... | false | 0.040694 | 0.00722 | 5.63612 | [
"s223348421",
"s054765063"
] |
u902380746 | p03386 | python | s665204426 | s279320816 | 183 | 164 | 38,704 | 38,256 | Accepted | Accepted | 10.38 | import sys
import math
import bisect
def solve(a, b, k):
ans = []
for i in range(k):
if a + i <= b:
ans.append(a + i)
if b - i >= a:
ans.append(b - i)
ans = list(sorted(set(ans)))
return ans
def main():
a, b, k = list(map(int, input().split())... | import sys
import math
import bisect
def solve(a, b, k):
ans = []
for i in range(k):
if a + i <= b:
ans.append(a + i)
if b - i >= a:
ans.append(b - i)
ans = sorted(set(ans))
return ans
def main():
a, b, k = list(map(int, input().split()))
... | 21 | 21 | 406 | 400 | import sys
import math
import bisect
def solve(a, b, k):
ans = []
for i in range(k):
if a + i <= b:
ans.append(a + i)
if b - i >= a:
ans.append(b - i)
ans = list(sorted(set(ans)))
return ans
def main():
a, b, k = list(map(int, input().split()))
for a i... | import sys
import math
import bisect
def solve(a, b, k):
ans = []
for i in range(k):
if a + i <= b:
ans.append(a + i)
if b - i >= a:
ans.append(b - i)
ans = sorted(set(ans))
return ans
def main():
a, b, k = list(map(int, input().split()))
for a in solv... | false | 0 | [
"- ans = list(sorted(set(ans)))",
"+ ans = sorted(set(ans))"
] | false | 0.070008 | 0.049556 | 1.412699 | [
"s665204426",
"s279320816"
] |
u562935282 | p03027 | python | s168469585 | s728584295 | 614 | 551 | 94,028 | 93,804 | Accepted | Accepted | 10.26 | # https://atcoder.jp/contests/m-solutions2019/submissions/5741430
import sys
input = sys.stdin.readline
MOD = 10 ** 6 + 3
fact = [1]
for n in range(1, MOD):
fact.append((fact[-1] * n) % MOD)
# d>1 の数列を d=1 となる数列に変換する
# MODの倍数を含む数列の積は0になるので,
# MODの倍数を含まない区間の積が計算できればよい
# そのような区間の右端はMOD... | # https://atcoder.jp/contests/m-solutions2019/submissions/5741430
import sys
input = sys.stdin.readline
MOD = 10 ** 6 + 3
fact = [1]
for n in range(1, MOD):
fact.append((fact[-1] * n) % MOD)
# d>1 の数列を d=1 となる数列に変換する
# MODの倍数を含む数列の積は0になるので,
# MODの倍数を含まない区間の積が計算できればよい
# そのような区間の右端はMOD... | 44 | 46 | 1,011 | 1,069 | # https://atcoder.jp/contests/m-solutions2019/submissions/5741430
import sys
input = sys.stdin.readline
MOD = 10**6 + 3
fact = [1]
for n in range(1, MOD):
fact.append((fact[-1] * n) % MOD)
# d>1 の数列を d=1 となる数列に変換する
# MODの倍数を含む数列の積は0になるので,
# MODの倍数を含まない区間の積が計算できればよい
# そのような区間の右端はMOD-1であり,fact[MOD-1]... | # https://atcoder.jp/contests/m-solutions2019/submissions/5741430
import sys
input = sys.stdin.readline
MOD = 10**6 + 3
fact = [1]
for n in range(1, MOD):
fact.append((fact[-1] * n) % MOD)
# d>1 の数列を d=1 となる数列に変換する
# MODの倍数を含む数列の積は0になるので,
# MODの倍数を含まない区間の積が計算できればよい
# そのような区間の右端はMOD-1であり,fact[MOD-1]... | false | 4.347826 | [
"-Q = int(eval(input()))",
"+Q = int(input())",
"+ans = []",
"- x, d, n = list(map(int, input().split()))",
"+ x, d, n = map(int, input().split())",
"- print((0))",
"+ ans.append(0)",
"- print((pow(x, n, MOD)))",
"+ ans.append(pow(x, n, MOD))",
"- print((0)... | false | 1.079693 | 1.167482 | 0.924805 | [
"s168469585",
"s728584295"
] |
u203669169 | p03607 | python | s528960421 | s475675441 | 231 | 177 | 18,364 | 21,728 | Accepted | Accepted | 23.38 | #! /usr/bin/env python3
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, pe... | #! /usr/bin/env python3
from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import... | 19 | 20 | 533 | 570 | #! /usr/bin/env python3
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import (
accumulate,
product,... | #! /usr/bin/env python3
from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import (
... | false | 5 | [
"+",
"+# from math import gcd",
"-A = [int(eval(input())) for _ in range(N)]",
"+A = [int(eval(input())) for i in range(N)]",
"-ct = 0",
"-for i in list(c.values()):",
"- if i % 2 != 0:",
"- ct += 1",
"-print(ct)",
"+ret = 0",
"+for key, item in list(c.items()):",
"+ if item % 2 =... | false | 0.102274 | 0.04381 | 2.334492 | [
"s528960421",
"s475675441"
] |
u864013199 | p03287 | python | s805796678 | s294538295 | 90 | 75 | 16,548 | 16,556 | Accepted | Accepted | 16.67 | from collections import Counter
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [0]
for a in A:
B.append((B[-1]+a)%M)
c = Counter(B)
ans = 0
for v in list(c.values()):
ans += v*(v-1)//2
print(ans)
| from collections import Counter
def main():
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [0]
for a in A:
B.append((B[-1]+a)%M)
c = Counter(B)
ans = 0
for v in list(c.values()):
ans += v*(v-1)//2
print(ans)
if __name__ == '__mai... | 11 | 15 | 231 | 325 | from collections import Counter
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0]
for a in A:
B.append((B[-1] + a) % M)
c = Counter(B)
ans = 0
for v in list(c.values()):
ans += v * (v - 1) // 2
print(ans)
| from collections import Counter
def main():
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0]
for a in A:
B.append((B[-1] + a) % M)
c = Counter(B)
ans = 0
for v in list(c.values()):
ans += v * (v - 1) // 2
print(ans)
if __name__ == "__... | false | 26.666667 | [
"-N, M = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-B = [0]",
"-for a in A:",
"- B.append((B[-1] + a) % M)",
"-c = Counter(B)",
"-ans = 0",
"-for v in list(c.values()):",
"- ans += v * (v - 1) // 2",
"-print(ans)",
"+",
"+def main():",
"+ N, M = list... | false | 0.035083 | 0.036678 | 0.95651 | [
"s805796678",
"s294538295"
] |
u654470292 | p03608 | python | s678384800 | s180628878 | 572 | 264 | 88,152 | 84,248 | Accepted | Accepted | 53.85 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') +... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 49 | 50 | 1,152 | 1,254 | import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations, accumulate, combinations, product
from fractions import gcd
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
mod = pow(10, 9) + 7
al = [chr(ord(... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 2 | [
"-import sys",
"+import bisect, copy, heapq, math, sys",
"-import heapq",
"-import math",
"-import bisect",
"-from itertools import permutations, accumulate, combinations, product",
"-from fractions import gcd",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, pe... | false | 0.035703 | 0.033113 | 1.078241 | [
"s678384800",
"s180628878"
] |
u759412327 | p03796 | python | s969647353 | s382409708 | 230 | 152 | 3,972 | 9,956 | Accepted | Accepted | 33.91 | from math import factorial
print((factorial(int(eval(input())))%(10**9+7))) | from math import *
print((factorial(int(eval(input())))%(10**9+7))) | 2 | 2 | 68 | 60 | from math import factorial
print((factorial(int(eval(input()))) % (10**9 + 7)))
| from math import *
print((factorial(int(eval(input()))) % (10**9 + 7)))
| false | 0 | [
"-from math import factorial",
"+from math import *"
] | false | 0.547273 | 0.105736 | 5.17583 | [
"s969647353",
"s382409708"
] |
u239342230 | p02873 | python | s485580409 | s435100599 | 597 | 450 | 48,500 | 48,404 | Accepted | Accepted | 24.62 | S=eval(input())
S_rev=S[::-1]
import numpy as np
arr_rev=[]
cnt=0
for s_rev in S_rev:
if s_rev==">":
cnt+=1
else:
cnt=0
arr_rev.append(cnt)
A=np.array(arr_rev[::-1]+[0])
arr=[]
cnt=0
for s in S:
if s=="<":
cnt+=1
else:
cnt=0
arr.append(c... | import numpy as np
S=eval(input());T=S[::-1];a=[];c=0
for t in T:
if t==">":
c+=1
else:
c=0
a.append(c)
A=np.array(a[::-1]+[0])
b=[];c=0
for s in S:
if s=="<":
c+=1
else:
c=0
b.append(c)
B=np.array([0]+b)
print((np.maximum(A,B).sum())) | 28 | 18 | 371 | 300 | S = eval(input())
S_rev = S[::-1]
import numpy as np
arr_rev = []
cnt = 0
for s_rev in S_rev:
if s_rev == ">":
cnt += 1
else:
cnt = 0
arr_rev.append(cnt)
A = np.array(arr_rev[::-1] + [0])
arr = []
cnt = 0
for s in S:
if s == "<":
cnt += 1
else:
cnt = 0
arr.append... | import numpy as np
S = eval(input())
T = S[::-1]
a = []
c = 0
for t in T:
if t == ">":
c += 1
else:
c = 0
a.append(c)
A = np.array(a[::-1] + [0])
b = []
c = 0
for s in S:
if s == "<":
c += 1
else:
c = 0
b.append(c)
B = np.array([0] + b)
print((np.maximum(A, B).su... | false | 35.714286 | [
"-S = eval(input())",
"-S_rev = S[::-1]",
"-arr_rev = []",
"-cnt = 0",
"-for s_rev in S_rev:",
"- if s_rev == \">\":",
"- cnt += 1",
"+S = eval(input())",
"+T = S[::-1]",
"+a = []",
"+c = 0",
"+for t in T:",
"+ if t == \">\":",
"+ c += 1",
"- cnt = 0",
"- ... | false | 0.046106 | 0.21581 | 0.213643 | [
"s485580409",
"s435100599"
] |
u934442292 | p02623 | python | s537945821 | s521205637 | 707 | 602 | 42,208 | 42,392 | Accepted | Accepted | 14.85 | import sys
from itertools import accumulate
input = sys.stdin.readline
def binary_search(a, key):
"""Meguru type binary search"""
ok = -1
ng = len(a)
while (abs(ok - ng) > 1):
mid = (ok + ng) // 2
if a[mid] <= key:
ok = mid
else:
ng = m... | import sys
from itertools import accumulate
input = sys.stdin.readline
def binary_search(a, key):
"""Meguru type binary search"""
ok = -1
ng = len(a)
while (ng - ok > 1):
mid = (ok + ng) // 2
if a[mid] <= key:
ok = mid
else:
ng = mid
... | 43 | 43 | 808 | 803 | import sys
from itertools import accumulate
input = sys.stdin.readline
def binary_search(a, key):
"""Meguru type binary search"""
ok = -1
ng = len(a)
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if a[mid] <= key:
ok = mid
else:
ng = mid
return ok
... | import sys
from itertools import accumulate
input = sys.stdin.readline
def binary_search(a, key):
"""Meguru type binary search"""
ok = -1
ng = len(a)
while ng - ok > 1:
mid = (ok + ng) // 2
if a[mid] <= key:
ok = mid
else:
ng = mid
return ok
def m... | false | 0 | [
"- while abs(ok - ng) > 1:",
"+ while ng - ok > 1:"
] | false | 0.043719 | 0.052318 | 0.835641 | [
"s537945821",
"s521205637"
] |
u794145298 | p02710 | python | s385540926 | s265259366 | 1,119 | 743 | 253,168 | 209,780 | Accepted | Accepted | 33.6 | N = int(eval(input()))
Cs = list(map(int, input().split()))
adj = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
adj[a - 1].append(b - 1)
adj[b - 1].append(a - 1)
degs = [0] * N
clusters = [[] for _ in range(N)]
def go(curr, fro):
col = Cs[curr] - 1
... | N = int(eval(input()))
Cs = list(map(int, input().split()))
adj = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
adj[a - 1].append(b - 1)
adj[b - 1].append(a - 1)
under_col = [0] * N
ans = [0] * N
def tri(n):
return n * (n + 1) // 2
def go(curr,... | 53 | 49 | 1,256 | 1,071 | N = int(eval(input()))
Cs = list(map(int, input().split()))
adj = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
adj[a - 1].append(b - 1)
adj[b - 1].append(a - 1)
degs = [0] * N
clusters = [[] for _ in range(N)]
def go(curr, fro):
col = Cs[curr] - 1
deg = 1
... | N = int(eval(input()))
Cs = list(map(int, input().split()))
adj = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = list(map(int, input().split()))
adj[a - 1].append(b - 1)
adj[b - 1].append(a - 1)
under_col = [0] * N
ans = [0] * N
def tri(n):
return n * (n + 1) // 2
def go(curr, fro):
col = ... | false | 7.54717 | [
"-degs = [0] * N",
"-clusters = [[] for _ in range(N)]",
"+under_col = [0] * N",
"+ans = [0] * N",
"+",
"+",
"+def tri(n):",
"+ return n * (n + 1) // 2",
"+ prev_under = under_col[col]",
"- clust = {}",
"- ch_deg, ch_clust = yield go(n, curr)",
"- clusters[col].append(ch... | false | 0.040088 | 0.007435 | 5.391629 | [
"s385540926",
"s265259366"
] |
u133936772 | p02861 | python | s668752534 | s406313198 | 436 | 17 | 3,188 | 2,940 | Accepted | Accepted | 96.1 | n = int(eval(input()))
ll = [list(map(int,input().split())) for _ in range(n)]
import itertools as it
c,d = 0,0
for t in it.permutations(list(range(n))):
c += 1
for i in range(len(t)-1):
d += ((ll[t[i+1]][1]-ll[t[i]][1])**2+(ll[t[i+1]][0]-ll[t[i]][0])**2)**.5
print((d/c)) | n=int(eval(input()))
l=[list(map(int,input().split())) for _ in range(n)]
print((sum(((x-z)**2+(y-w)**2)**.5 for x,y in l for z,w in l)/n)) | 9 | 3 | 274 | 133 | n = int(eval(input()))
ll = [list(map(int, input().split())) for _ in range(n)]
import itertools as it
c, d = 0, 0
for t in it.permutations(list(range(n))):
c += 1
for i in range(len(t) - 1):
d += (
(ll[t[i + 1]][1] - ll[t[i]][1]) ** 2 + (ll[t[i + 1]][0] - ll[t[i]][0]) ** 2
) ** 0.5... | n = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(n)]
print((sum(((x - z) ** 2 + (y - w) ** 2) ** 0.5 for x, y in l for z, w in l) / n))
| false | 66.666667 | [
"-ll = [list(map(int, input().split())) for _ in range(n)]",
"-import itertools as it",
"-",
"-c, d = 0, 0",
"-for t in it.permutations(list(range(n))):",
"- c += 1",
"- for i in range(len(t) - 1):",
"- d += (",
"- (ll[t[i + 1]][1] - ll[t[i]][1]) ** 2 + (ll[t[i + 1]][0] - ll[... | false | 0.076018 | 0.039181 | 1.940193 | [
"s668752534",
"s406313198"
] |
u580697892 | p03486 | python | s768033363 | s497383989 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | # coding: utf-8
s = eval(input())
t = eval(input())
re_s = sorted(s)
re_t = sorted(t, reverse=True)
print(("Yes" if re_s < re_t else "No")) | # coding: utf-8
s = list(eval(input()))
t = list(eval(input()))
s.sort()
t.sort(reverse=True)
sd = "".join(s)
td = "".join(t)
print(("Yes" if sd < td else "No")) | 6 | 8 | 130 | 154 | # coding: utf-8
s = eval(input())
t = eval(input())
re_s = sorted(s)
re_t = sorted(t, reverse=True)
print(("Yes" if re_s < re_t else "No"))
| # coding: utf-8
s = list(eval(input()))
t = list(eval(input()))
s.sort()
t.sort(reverse=True)
sd = "".join(s)
td = "".join(t)
print(("Yes" if sd < td else "No"))
| false | 25 | [
"-s = eval(input())",
"-t = eval(input())",
"-re_s = sorted(s)",
"-re_t = sorted(t, reverse=True)",
"-print((\"Yes\" if re_s < re_t else \"No\"))",
"+s = list(eval(input()))",
"+t = list(eval(input()))",
"+s.sort()",
"+t.sort(reverse=True)",
"+sd = \"\".join(s)",
"+td = \"\".join(t)",
"+print(... | false | 0.048719 | 0.054811 | 0.888849 | [
"s768033363",
"s497383989"
] |
u662396511 | p02699 | python | s882570625 | s552335578 | 23 | 20 | 9,088 | 9,020 | Accepted | Accepted | 13.04 | S, W = list(map(int, input().split()))
if S>W:
print("safe")
else:
print("unsafe") | s, w = list(map(int, input().split()))
if s>w:
print("safe")
else:
print("unsafe") | 5 | 5 | 84 | 84 | S, W = list(map(int, input().split()))
if S > W:
print("safe")
else:
print("unsafe")
| s, w = list(map(int, input().split()))
if s > w:
print("safe")
else:
print("unsafe")
| false | 0 | [
"-S, W = list(map(int, input().split()))",
"-if S > W:",
"+s, w = list(map(int, input().split()))",
"+if s > w:"
] | false | 0.06074 | 0.061234 | 0.991935 | [
"s882570625",
"s552335578"
] |
u782850731 | p00005 | python | s941121630 | s070497435 | 30 | 20 | 5,900 | 5,896 | Accepted | Accepted | 33.33 | from __future__ import (division, absolute_import, print_function,
unicode_literals)
import sys
from fractions import gcd
from itertools import count
for line in sys.stdin:
small, large = sorted(int(n) for n in line .split())
for i in count(large, large):
if not i % sma... | from __future__ import (division, absolute_import, print_function,
unicode_literals)
import sys
from fractions import gcd
for line in sys.stdin:
small, large = sorted(int(n) for n in line .split())
G = gcd(large, small)
print(G, large // G * small) | 13 | 9 | 398 | 293 | from __future__ import division, absolute_import, print_function, unicode_literals
import sys
from fractions import gcd
from itertools import count
for line in sys.stdin:
small, large = sorted(int(n) for n in line.split())
for i in count(large, large):
if not i % small:
lcm = i
... | from __future__ import division, absolute_import, print_function, unicode_literals
import sys
from fractions import gcd
for line in sys.stdin:
small, large = sorted(int(n) for n in line.split())
G = gcd(large, small)
print(G, large // G * small)
| false | 30.769231 | [
"-from itertools import count",
"- for i in count(large, large):",
"- if not i % small:",
"- lcm = i",
"- break",
"- print(gcd(large, small), lcm)",
"+ G = gcd(large, small)",
"+ print(G, large // G * small)"
] | false | 0.064373 | 0.061489 | 1.046905 | [
"s941121630",
"s070497435"
] |
u724687935 | p03448 | python | s442996045 | s321932609 | 169 | 51 | 38,896 | 3,060 | Accepted | Accepted | 69.82 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
cnt = 0
for num_A in [num_A for num_A in range(A + 1) if (num_A * 500 <= X)]:
rest_XA = X - num_A * 500
for num_B in [num_B for num_B in range(B + 1) if num_B * 100 <= rest_XA]:
rest_XAB = rest_XA - n... | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
cnt = 0
for a in range(A + 1):
for b in range(B + 1):
for c in range(C + 1):
if 500 * a + 100 * b + 50 * c == X:
cnt += 1
print(cnt)
| 14 | 14 | 396 | 257 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
cnt = 0
for num_A in [num_A for num_A in range(A + 1) if (num_A * 500 <= X)]:
rest_XA = X - num_A * 500
for num_B in [num_B for num_B in range(B + 1) if num_B * 100 <= rest_XA]:
rest_XAB = rest_XA - num_B * 100
... | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
cnt = 0
for a in range(A + 1):
for b in range(B + 1):
for c in range(C + 1):
if 500 * a + 100 * b + 50 * c == X:
cnt += 1
print(cnt)
| false | 0 | [
"-for num_A in [num_A for num_A in range(A + 1) if (num_A * 500 <= X)]:",
"- rest_XA = X - num_A * 500",
"- for num_B in [num_B for num_B in range(B + 1) if num_B * 100 <= rest_XA]:",
"- rest_XAB = rest_XA - num_B * 100",
"- if rest_XAB % 50 == 0 and rest_XAB <= C * 50:",
"- ... | false | 0.088999 | 0.117232 | 0.759169 | [
"s442996045",
"s321932609"
] |
u151503168 | p02996 | python | s405831422 | s217806208 | 1,012 | 794 | 55,264 | 31,828 | Accepted | Accepted | 21.54 | N = int(eval(input()))
X = sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[1])
t = 0
for a, b in X:
t += a
if (t > b):
print("No")
exit()
print("Yes") | N = int(eval(input()))
X = [tuple(map(int, input().split())) for _ in range(N)]
X.sort(key=lambda x:x[1])
t = 0
for a, b in X:
t += a
if (t > b):
print("No")
break
else:
print("Yes") | 9 | 11 | 201 | 214 | N = int(eval(input()))
X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])
t = 0
for a, b in X:
t += a
if t > b:
print("No")
exit()
print("Yes")
| N = int(eval(input()))
X = [tuple(map(int, input().split())) for _ in range(N)]
X.sort(key=lambda x: x[1])
t = 0
for a, b in X:
t += a
if t > b:
print("No")
break
else:
print("Yes")
| false | 18.181818 | [
"-X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])",
"+X = [tuple(map(int, input().split())) for _ in range(N)]",
"+X.sort(key=lambda x: x[1])",
"- exit()",
"-print(\"Yes\")",
"+ break",
"+else:",
"+ print(\"Yes\")"
] | false | 0.094725 | 0.045759 | 2.070088 | [
"s405831422",
"s217806208"
] |
u189023301 | p02819 | python | s444925514 | s497941926 | 51 | 28 | 20,640 | 9,400 | Accepted | Accepted | 45.1 | def solve():
from bisect import bisect_right, bisect, bisect_left
x = int(eval(input()))
n = 100100
primes = set(range(2, n + 1))
for i in range(2, int(n ** 0.5 + 1)):
if i not in primes:
i += 1
else:
ran = list(range(i * 2, n + 1, i))
pr... | def solve():
x = int(eval(input()))
def is_prime(n):
for i in range(2, int(x ** 0.5) + 1):
if n % i == 0:
return False
return True
while not is_prime(x):
x += 1
print(x)
solve()
| 17 | 14 | 438 | 256 | def solve():
from bisect import bisect_right, bisect, bisect_left
x = int(eval(input()))
n = 100100
primes = set(range(2, n + 1))
for i in range(2, int(n**0.5 + 1)):
if i not in primes:
i += 1
else:
ran = list(range(i * 2, n + 1, i))
primes.differ... | def solve():
x = int(eval(input()))
def is_prime(n):
for i in range(2, int(x**0.5) + 1):
if n % i == 0:
return False
return True
while not is_prime(x):
x += 1
print(x)
solve()
| false | 17.647059 | [
"- from bisect import bisect_right, bisect, bisect_left",
"+ x = int(eval(input()))",
"- x = int(eval(input()))",
"- n = 100100",
"- primes = set(range(2, n + 1))",
"- for i in range(2, int(n**0.5 + 1)):",
"- if i not in primes:",
"- i += 1",
"- else:",
"... | false | 0.221937 | 0.036189 | 6.132767 | [
"s444925514",
"s497941926"
] |
u734548018 | p03681 | python | s914607693 | s207257569 | 495 | 168 | 54,640 | 38,384 | Accepted | Accepted | 66.06 | # /usr/bin/python
# -*- coding: utf-8 -*-
import math
D = 10**9+7
def main():
NM = sorted(list(map(int, input().split())))
if NM[1]-NM[0] > 1:
return 0
elif NM[0]==NM[1]:
ret = 2*(math.factorial(NM[0])**2) % D
return ret
else:
ret = math.factorial(NM[0])*math.factorial(NM[1])... | # /usr/bin/python
# -*- coding: utf-8 -*-
import math
D = 10**9+7
def fact(n):
ret = 1
for i in range(1,n+1):
ret = (ret*i) % D
return ret
def main():
NM = sorted(list(map(int, input().split())))
n,m = [fact(NM[0]), fact(NM[1])]
if NM[0]==NM[1]:
return (n*m*2) % D
elif NM[0... | 21 | 26 | 387 | 423 | # /usr/bin/python
# -*- coding: utf-8 -*-
import math
D = 10**9 + 7
def main():
NM = sorted(list(map(int, input().split())))
if NM[1] - NM[0] > 1:
return 0
elif NM[0] == NM[1]:
ret = 2 * (math.factorial(NM[0]) ** 2) % D
return ret
else:
ret = math.factorial(NM[0]) * ma... | # /usr/bin/python
# -*- coding: utf-8 -*-
import math
D = 10**9 + 7
def fact(n):
ret = 1
for i in range(1, n + 1):
ret = (ret * i) % D
return ret
def main():
NM = sorted(list(map(int, input().split())))
n, m = [fact(NM[0]), fact(NM[1])]
if NM[0] == NM[1]:
return (n * m * 2) ... | false | 19.230769 | [
"+def fact(n):",
"+ ret = 1",
"+ for i in range(1, n + 1):",
"+ ret = (ret * i) % D",
"+ return ret",
"+",
"+",
"- if NM[1] - NM[0] > 1:",
"+ n, m = [fact(NM[0]), fact(NM[1])]",
"+ if NM[0] == NM[1]:",
"+ return (n * m * 2) % D",
"+ elif NM[0] + 1 == NM[1]:",... | false | 0.057894 | 0.038349 | 1.509679 | [
"s914607693",
"s207257569"
] |
u707124227 | p03040 | python | s854728196 | s555388888 | 984 | 695 | 117,732 | 109,456 | Accepted | Accepted | 29.37 | q=int(eval(input()))
query=[eval(input()) for _ in range(q)]
from bisect import bisect_left
ary=[-float('inf')]
for qq in query:
if qq[0]=='1':
_,a,_=list(map(int,qq.split()))
ary.append(a)
ary.sort()
ary.append(float('inf'))
class SegmentTree():
def __init__(self,size,f=lambda x,y:x+y,default=... | q=int(eval(input()))
query=[eval(input()) for _ in range(q)]
from bisect import bisect_left
ary=[-float('inf')]
for qq in query:
if qq[0]=='1':
_,a,_=list(map(int,qq.split()))
ary.append(a)
ary.sort()
ary.append(float('inf'))
class BIT:
def __init__(self, n):
self.n = n
self.data = [0... | 77 | 68 | 1,762 | 1,428 | q = int(eval(input()))
query = [eval(input()) for _ in range(q)]
from bisect import bisect_left
ary = [-float("inf")]
for qq in query:
if qq[0] == "1":
_, a, _ = list(map(int, qq.split()))
ary.append(a)
ary.sort()
ary.append(float("inf"))
class SegmentTree:
def __init__(self, size, f=lambda x... | q = int(eval(input()))
query = [eval(input()) for _ in range(q)]
from bisect import bisect_left
ary = [-float("inf")]
for qq in query:
if qq[0] == "1":
_, a, _ = list(map(int, qq.split()))
ary.append(a)
ary.sort()
ary.append(float("inf"))
class BIT:
def __init__(self, n):
self.n = n
... | false | 11.688312 | [
"-class SegmentTree:",
"- def __init__(self, size, f=lambda x, y: x + y, default=0):",
"- self.size = pow(2, (size - 1).bit_length())",
"- self.f = f",
"- self.default = default",
"- self.data = [default] * (self.size * 2)",
"+class BIT:",
"+ def __init__(self, n):",
... | false | 0.079598 | 0.043776 | 1.818306 | [
"s854728196",
"s555388888"
] |
u074220993 | p03436 | python | s102479235 | s307409656 | 262 | 134 | 29,380 | 26,588 | Accepted | Accepted | 48.85 | H, W = list(map(int, input().split()))
import numpy as np
Grid = np.array([[0 if x == '.' else -1 for x in eval(input())] for _ in range(H)],dtype='int64')
def solveMase(Grid, start, goal):
seen = {start}
V = [start]
while len(V) != 0:
v = V.pop(0)
if v == goal:
return... | H, W = list(map(int, input().split()))
import numpy as np
Grid = np.array([[0 if x == '.' else -1 for x in eval(input())] for _ in range(H)],dtype='int64')
def solveMase(Grid, start, goal): #bfsで迷路を解き、スタート-ゴール間の最低必要白マス数を返す
seen = {start}
V = [start]
while len(V) != 0: #bfs
v = V.pop(0)
... | 34 | 30 | 872 | 913 | H, W = list(map(int, input().split()))
import numpy as np
Grid = np.array(
[[0 if x == "." else -1 for x in eval(input())] for _ in range(H)], dtype="int64"
)
def solveMase(Grid, start, goal):
seen = {start}
V = [start]
while len(V) != 0:
v = V.pop(0)
if v == goal:
return ... | H, W = list(map(int, input().split()))
import numpy as np
Grid = np.array(
[[0 if x == "." else -1 for x in eval(input())] for _ in range(H)], dtype="int64"
)
def solveMase(Grid, start, goal): # bfsで迷路を解き、スタート-ゴール間の最低必要白マス数を返す
seen = {start}
V = [start]
while len(V) != 0: # bfs
v = V.pop(0)... | false | 11.764706 | [
"-def solveMase(Grid, start, goal):",
"+def solveMase(Grid, start, goal): # bfsで迷路を解き、スタート-ゴール間の最低必要白マス数を返す",
"- while len(V) != 0:",
"+ while len(V) != 0: # bfs",
"+ # 移動先nvをリストにまとめる",
"+ # bfs",
"-if nes_white > 0:",
"- ans = white - nes_white",
"-else:",
"- ans = -1"... | false | 0.181782 | 0.656326 | 0.276969 | [
"s102479235",
"s307409656"
] |
u842401785 | p02775 | python | s613794434 | s866399913 | 760 | 508 | 133,496 | 133,496 | Accepted | Accepted | 33.16 | n = eval(input())
s = []
for c in n:
s.append(int(c))
s.reverse()
l = len(s)
INF = 1000000000
def get_next(c):
ret = [
[INF, INF],
[INF, INF],
]
# for a in range(10):
# for b in range(10):
# if a - b == c:
# ret[0][0] = min(ret[0][0]... | n = eval(input())
s = []
for c in n:
s.append(int(c))
s.reverse()
l = len(s)
INF = 1000000000
def get_next(c):
ret = [
[INF, INF],
[INF, INF],
]
# for a in range(10):
# for b in range(10):
# if a - b == c:
# ret[0][0] = min(ret[0][0]... | 51 | 62 | 1,335 | 1,598 | n = eval(input())
s = []
for c in n:
s.append(int(c))
s.reverse()
l = len(s)
INF = 1000000000
def get_next(c):
ret = [
[INF, INF],
[INF, INF],
]
# for a in range(10):
# for b in range(10):
# if a - b == c:
# ret[0][0] = min(ret[0][0], a + b)
# ... | n = eval(input())
s = []
for c in n:
s.append(int(c))
s.reverse()
l = len(s)
INF = 1000000000
def get_next(c):
ret = [
[INF, INF],
[INF, INF],
]
# for a in range(10):
# for b in range(10):
# if a - b == c:
# ret[0][0] = min(ret[0][0], a + b)
# ... | false | 17.741935 | [
"- for b in range(10):",
"- a = c + b",
"- if 0 <= a < 10:",
"- ret[0][0] = min(ret[0][0], a + b)",
"- a = c + b - 10",
"- if 0 <= a < 10:",
"- ret[0][1] = min(ret[0][1], a + b)",
"- a = c + b + 1",
"- if 0 <= a < 10:",
"- ... | false | 0.048311 | 0.047356 | 1.020173 | [
"s613794434",
"s866399913"
] |
u453968283 | p03386 | python | s663177959 | s748010262 | 19 | 17 | 3,060 | 3,064 | Accepted | Accepted | 10.53 | ip=[int(x) for x in input().split()]
a=ip[0]
b=ip[1]
k=ip[2]
if k>=(b-a+1):
for i in range(a,b+1):
print(i)
else:
lw=list(range(a,a+k))
hg=list(range(b-k+1,b+1))
res=list(set(lw+hg))
res.sort()
for i in res:
print(i)
| ip=[int(x) for x in input().split()]
a=ip[0];b=ip[1];k=ip[2]
ans=list()
for i in range(0,k):
ans.append(a)
ans.append(b)
a=a+1
b=b-1
if((a>ip[1])|(b<ip[0])):
break
res=list(set(ans))
res.sort()
for i in res:
print(i) | 14 | 14 | 245 | 261 | ip = [int(x) for x in input().split()]
a = ip[0]
b = ip[1]
k = ip[2]
if k >= (b - a + 1):
for i in range(a, b + 1):
print(i)
else:
lw = list(range(a, a + k))
hg = list(range(b - k + 1, b + 1))
res = list(set(lw + hg))
res.sort()
for i in res:
print(i)
| ip = [int(x) for x in input().split()]
a = ip[0]
b = ip[1]
k = ip[2]
ans = list()
for i in range(0, k):
ans.append(a)
ans.append(b)
a = a + 1
b = b - 1
if (a > ip[1]) | (b < ip[0]):
break
res = list(set(ans))
res.sort()
for i in res:
print(i)
| false | 0 | [
"-if k >= (b - a + 1):",
"- for i in range(a, b + 1):",
"- print(i)",
"-else:",
"- lw = list(range(a, a + k))",
"- hg = list(range(b - k + 1, b + 1))",
"- res = list(set(lw + hg))",
"- res.sort()",
"- for i in res:",
"- print(i)",
"+ans = list()",
"+for i in ran... | false | 0.038218 | 0.061841 | 0.617996 | [
"s663177959",
"s748010262"
] |
u347640436 | p03087 | python | s532819802 | s655288030 | 902 | 269 | 6,164 | 6,332 | Accepted | Accepted | 70.18 | n, q = list(map(int, input().split()))
s = eval(input())
c = [0] * (n + 1)
for i in range(2, n + 1):
if s[i - 1] == 'C' and s[i - 2] == 'A':
c[i] = c[i - 1] + 1
else:
c[i] = c[i - 1]
for _ in range(q):
l, r = list(map(int, input().split()))
t = c[r] - c[l - 1]
if l > 1 and s[l - 2: l] == 'A... | from sys import stdin
def main():
readline = stdin.readline
n, q = list(map(int, readline().split()))
s = eval(input())
c = [0] * (n + 1)
for i in range(2, n + 1):
if s[i - 1] == 'C' and s[i - 2] == 'A':
c[i] = c[i - 1] + 1
else:
c[i] = c[i - 1]
for _ in range(q):
l, r = ... | 14 | 18 | 330 | 437 | n, q = list(map(int, input().split()))
s = eval(input())
c = [0] * (n + 1)
for i in range(2, n + 1):
if s[i - 1] == "C" and s[i - 2] == "A":
c[i] = c[i - 1] + 1
else:
c[i] = c[i - 1]
for _ in range(q):
l, r = list(map(int, input().split()))
t = c[r] - c[l - 1]
if l > 1 and s[l - 2 : ... | from sys import stdin
def main():
readline = stdin.readline
n, q = list(map(int, readline().split()))
s = eval(input())
c = [0] * (n + 1)
for i in range(2, n + 1):
if s[i - 1] == "C" and s[i - 2] == "A":
c[i] = c[i - 1] + 1
else:
c[i] = c[i - 1]
for _ in... | false | 22.222222 | [
"-n, q = list(map(int, input().split()))",
"-s = eval(input())",
"-c = [0] * (n + 1)",
"-for i in range(2, n + 1):",
"- if s[i - 1] == \"C\" and s[i - 2] == \"A\":",
"- c[i] = c[i - 1] + 1",
"- else:",
"- c[i] = c[i - 1]",
"-for _ in range(q):",
"- l, r = list(map(int, input... | false | 0.041249 | 0.047831 | 0.862387 | [
"s532819802",
"s655288030"
] |
u479835943 | p02832 | python | s582640227 | s736833746 | 158 | 104 | 25,724 | 18,332 | Accepted | Accepted | 34.18 | n = int(eval(input()))
a = list(map(int, input().split()))
ans_lst = []
for ai in a:
if len(ans_lst) == 0 and ai == 1:
ans_lst.append(1)
elif len(ans_lst) > 0 and ans_lst[-1] == ai - 1:
ans_lst.append(ai)
if len(ans_lst) == 0:
print((-1))
else:
print((n - len(ans_lst))) | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for ai in a:
if ans == ai - 1:
ans += 1
if ans == 0:
print((-1))
else:
print((n-ans)) | 12 | 10 | 297 | 165 | n = int(eval(input()))
a = list(map(int, input().split()))
ans_lst = []
for ai in a:
if len(ans_lst) == 0 and ai == 1:
ans_lst.append(1)
elif len(ans_lst) > 0 and ans_lst[-1] == ai - 1:
ans_lst.append(ai)
if len(ans_lst) == 0:
print((-1))
else:
print((n - len(ans_lst)))
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for ai in a:
if ans == ai - 1:
ans += 1
if ans == 0:
print((-1))
else:
print((n - ans))
| false | 16.666667 | [
"-ans_lst = []",
"+ans = 0",
"- if len(ans_lst) == 0 and ai == 1:",
"- ans_lst.append(1)",
"- elif len(ans_lst) > 0 and ans_lst[-1] == ai - 1:",
"- ans_lst.append(ai)",
"-if len(ans_lst) == 0:",
"+ if ans == ai - 1:",
"+ ans += 1",
"+if ans == 0:",
"- print((n - ... | false | 0.038173 | 0.036355 | 1.050024 | [
"s582640227",
"s736833746"
] |
u498487134 | p02984 | python | s771369056 | s880534711 | 252 | 102 | 84,452 | 96,432 | Accepted | Accepted | 59.52 | N=int(eval(input()))
A=list(map(int,input().split()))
s=sum(A)//2
ans=[0]*N
rem=0
for i in range(1,N,2):
rem+=A[i]
ans[0]=(s-rem)*2
for i in range(1,N):
ans[i]=(A[i-1]-ans[i-1]//2)*2
ans[-1]=(A[-1]-ans[0]//2)*2
print((' '.join(map(str, ans)))) | 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()
S=sum(A)
S2=0
for i in range(1,N,2):
S2+=A[i]
B=[0]*N... | 19 | 24 | 268 | 436 | N = int(eval(input()))
A = list(map(int, input().split()))
s = sum(A) // 2
ans = [0] * N
rem = 0
for i in range(1, N, 2):
rem += A[i]
ans[0] = (s - rem) * 2
for i in range(1, N):
ans[i] = (A[i - 1] - ans[i - 1] // 2) * 2
ans[-1] = (A[-1] - ans[0] // 2) * 2
print((" ".join(map(str, ans))))
| 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()
S = sum(A)
S2 = 0
for i in range(1, N, 2):
S2 += A[... | false | 20.833333 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-s = sum(A) // 2",
"-ans = [0] * N",
"-rem = 0",
"-for i in range(1, N, 2):",
"- rem += A[i]",
"-ans[0] = (s - rem) * 2",
"-for i in range(1, N):",
"- ans[i] = (A[i - 1] - ans[i - 1] // 2) * 2",
"-ans[-1] = (A[-1] - ans[0]... | false | 0.036659 | 0.085958 | 0.426479 | [
"s771369056",
"s880534711"
] |
u844005364 | p03161 | python | s873861812 | s197687408 | 519 | 408 | 56,416 | 55,008 | Accepted | Accepted | 21.39 | n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
def frog(n, k, h):
d = [float('inf')] * n
d[0] = 0
for i in range(1, n):
d[i] = min(
d[j] + abs(h[i] - h[j]) for j in range(max(i - k, 0), i)
)
return d[n - 1]
print((frog(n, ... | n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
dp = [float('inf')] * n
dp[0] = 0
for i in range(1, n):
for j in range(max(i - k, 0), i):
dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]))
print((dp[n - 1]))
| 15 | 10 | 325 | 254 | n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
def frog(n, k, h):
d = [float("inf")] * n
d[0] = 0
for i in range(1, n):
d[i] = min(d[j] + abs(h[i] - h[j]) for j in range(max(i - k, 0), i))
return d[n - 1]
print((frog(n, k, h)))
| n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
for j in range(max(i - k, 0), i):
dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]))
print((dp[n - 1]))
| false | 33.333333 | [
"-",
"-",
"-def frog(n, k, h):",
"- d = [float(\"inf\")] * n",
"- d[0] = 0",
"- for i in range(1, n):",
"- d[i] = min(d[j] + abs(h[i] - h[j]) for j in range(max(i - k, 0), i))",
"- return d[n - 1]",
"-",
"-",
"-print((frog(n, k, h)))",
"+dp = [float(\"inf\")] * n",
"+dp[0]... | false | 0.035283 | 0.038257 | 0.922256 | [
"s873861812",
"s197687408"
] |
u864197622 | p03040 | python | s596881065 | s570253753 | 1,454 | 631 | 11,108 | 11,100 | Accepted | Accepted | 56.6 | from heapq import *
Q = int(eval(input()))
L, R = [], []
ans = 0
for _ in range(Q):
a = [int(a) for a in input().split()]
if a[0] == 1:
ans += a[2]
if len(L) == 0 or a[1] <= -L[0]:
heappush(L, -a[1])
ans += -L[0] - a[1]
else:
heappush(R, a[... | import sys
input = sys.stdin.readline
from heapq import *
Q = int(eval(input()))
L, R = [], []
ans = 0
for _ in range(Q):
a = [int(a) for a in input().split()]
if a[0] == 1:
ans += a[2]
if len(L) == 0 or a[1] <= -L[0]:
heappush(L, -a[1])
ans += -L[0] - a[1]
... | 21 | 23 | 560 | 601 | from heapq import *
Q = int(eval(input()))
L, R = [], []
ans = 0
for _ in range(Q):
a = [int(a) for a in input().split()]
if a[0] == 1:
ans += a[2]
if len(L) == 0 or a[1] <= -L[0]:
heappush(L, -a[1])
ans += -L[0] - a[1]
else:
heappush(R, a[1])
... | import sys
input = sys.stdin.readline
from heapq import *
Q = int(eval(input()))
L, R = [], []
ans = 0
for _ in range(Q):
a = [int(a) for a in input().split()]
if a[0] == 1:
ans += a[2]
if len(L) == 0 or a[1] <= -L[0]:
heappush(L, -a[1])
ans += -L[0] - a[1]
else... | false | 8.695652 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.053251 | 0.035609 | 1.495417 | [
"s596881065",
"s570253753"
] |
u600402037 | p03033 | python | s387132618 | s388143618 | 1,880 | 1,663 | 134,524 | 134,300 | Accepted | Accepted | 11.54 | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
STX.sort(key=lambda x: x[2], reverse=True)
event = []
for s, t, x in STX:
... | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
event = []
append = event.append
for s, t, x in STX:
append((s-x, 0, x)... | 45 | 46 | 958 | 941 | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
STX.sort(key=lambda x: x[2], reverse=True)
event = []
for s, t, x in STX:
event.appen... | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
event = []
append = event.append
for s, t, x in STX:
append((s - x, 0, x))
append... | false | 2.173913 | [
"-STX.sort(key=lambda x: x[2], reverse=True)",
"+append = event.append",
"- event.append((s - x, 0, x))",
"- event.append((t - x, -1, x))",
"+ append((s - x, 0, x))",
"+ append((t - x, -1, x))",
"- event.append((d, 1, i))",
"+ append((d, 1, i))",
"+add = cur.add",
"+remove = cur.... | false | 0.03715 | 0.03812 | 0.974534 | [
"s387132618",
"s388143618"
] |
u497625442 | p03287 | python | s462986883 | s261394752 | 124 | 85 | 14,956 | 16,832 | Accepted | Accepted | 31.45 | from collections import Counter
c = Counter()
N, M = list(map(int,input().split()))
a = list(map(int,input().split()))
s = 0
c[s] += 1
for i in range(N):
s = (s + a[i]) % M
c[s] += 1
# print(c)
S=0
# t=0
for (i,k) in list(c.items()):
if k > 1:
S += (k-1)*k//2
# t += k
print(S)
# print(t) | from collections import Counter
from itertools import accumulate
from functools import reduce
N, M = list(map(int, input().split()))
A = [int(x) for x in input().split()]
c = Counter([0] + [x % M for x in accumulate(A)])
ans = reduce(lambda x,y:x+y, [v*(v-1)//2 for v in list(c.values())])
print(ans)
| 19 | 10 | 308 | 300 | from collections import Counter
c = Counter()
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
s = 0
c[s] += 1
for i in range(N):
s = (s + a[i]) % M
c[s] += 1
# print(c)
S = 0
# t=0
for (i, k) in list(c.items()):
if k > 1:
S += (k - 1) * k // 2
# t += k
print(S)
# prin... | from collections import Counter
from itertools import accumulate
from functools import reduce
N, M = list(map(int, input().split()))
A = [int(x) for x in input().split()]
c = Counter([0] + [x % M for x in accumulate(A)])
ans = reduce(lambda x, y: x + y, [v * (v - 1) // 2 for v in list(c.values())])
print(ans)
| false | 47.368421 | [
"+from itertools import accumulate",
"+from functools import reduce",
"-c = Counter()",
"-a = list(map(int, input().split()))",
"-s = 0",
"-c[s] += 1",
"-for i in range(N):",
"- s = (s + a[i]) % M",
"- c[s] += 1",
"-# print(c)",
"-S = 0",
"-# t=0",
"-for (i, k) in list(c.items()):",
... | false | 0.058934 | 0.057762 | 1.020278 | [
"s462986883",
"s261394752"
] |
u750838232 | p02888 | python | s773511862 | s644724906 | 1,510 | 1,317 | 3,316 | 3,188 | Accepted | Accepted | 12.78 | import bisect
n = int(eval(input()))
l = sorted(list(map(int, input().split())))
ans = 0
for i in range(n):
for j in range(i+1, n):
k = bisect.bisect_left(l, l[i]+l[j])
if k > j:
ans += k - j - 1
print(ans)
| import bisect
n = int(eval(input()))
l = sorted(list(map(int, input().split())))
ans = 0
for i in range(n):
for j in range(i+1, n):
k = bisect.bisect_left(l, l[i]+l[j])
#if k > j:
ans += k - j - 1
print(ans)
| 14 | 14 | 234 | 233 | import bisect
n = int(eval(input()))
l = sorted(list(map(int, input().split())))
ans = 0
for i in range(n):
for j in range(i + 1, n):
k = bisect.bisect_left(l, l[i] + l[j])
if k > j:
ans += k - j - 1
print(ans)
| import bisect
n = int(eval(input()))
l = sorted(list(map(int, input().split())))
ans = 0
for i in range(n):
for j in range(i + 1, n):
k = bisect.bisect_left(l, l[i] + l[j])
# if k > j:
ans += k - j - 1
print(ans)
| false | 0 | [
"- if k > j:",
"- ans += k - j - 1",
"+ # if k > j:",
"+ ans += k - j - 1"
] | false | 0.048159 | 0.083993 | 0.573372 | [
"s773511862",
"s644724906"
] |
u183422236 | p02684 | python | s010227653 | s088203851 | 1,685 | 105 | 103,404 | 95,120 | Accepted | Accepted | 93.77 | import bisect
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
seen = []
seen_sort = [1]
start = 1
while True:
tmp = a[start - 1]
seen.append(start)
index = bisect.bisect_left(seen_sort, tmp)
if index >= len(seen_sort) or seen_sort[index] != tmp:
seen_sort.... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
visited = []
visited_index = [-1] * n
pre = 0
while visited_index[pre] == -1:
now = a[pre]
visited.append(pre)
visited_index[pre] = len(visited)
pre = now - 1
loop = len(visited) - visited_index[pre] + 1
head = vis... | 23 | 21 | 581 | 447 | import bisect
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
seen = []
seen_sort = [1]
start = 1
while True:
tmp = a[start - 1]
seen.append(start)
index = bisect.bisect_left(seen_sort, tmp)
if index >= len(seen_sort) or seen_sort[index] != tmp:
seen_sort.insert(index... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
visited = []
visited_index = [-1] * n
pre = 0
while visited_index[pre] == -1:
now = a[pre]
visited.append(pre)
visited_index[pre] = len(visited)
pre = now - 1
loop = len(visited) - visited_index[pre] + 1
head = visited_index[pre]... | false | 8.695652 | [
"-import bisect",
"-",
"-seen = []",
"-seen_sort = [1]",
"-start = 1",
"-while True:",
"- tmp = a[start - 1]",
"- seen.append(start)",
"- index = bisect.bisect_left(seen_sort, tmp)",
"- if index >= len(seen_sort) or seen_sort[index] != tmp:",
"- seen_sort.insert(index, tmp)",
... | false | 0.078262 | 0.035905 | 2.179721 | [
"s010227653",
"s088203851"
] |
u583507988 | p03165 | python | s691773766 | s623955548 | 313 | 281 | 144,128 | 144,604 | Accepted | Accepted | 10.22 | S=eval(input())
T=eval(input())
n=len(S)
m=len(T)
dp=[[0]*(m+1) for i in range(n+1)]
for i in range(n):
for j in range(m):
dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j],dp[i][j]+(S[i]==T[j]))
ans=''
while n>0 and m>0:
if dp[n][m]==dp[n-1][m]:
n-=1
elif dp[n][m]==dp[n][m-1]:
m-=1
else:
n-... | S=eval(input())
T=eval(input())
n=len(S)
m=len(T)
dp=[[0]*(m+1) for i in range(n+1)]
for i in range(n):
for j in range(m):
if S[i]==T[j]:
dp[i+1][j+1]=dp[i][j]+1
else:
dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])
ans=''
while n>0 and m>0:
if dp[n][m]==dp[n-1][m]:
n-=1
elif dp[n][... | 19 | 22 | 350 | 392 | S = eval(input())
T = eval(input())
n = len(S)
m = len(T)
dp = [[0] * (m + 1) for i in range(n + 1)]
for i in range(n):
for j in range(m):
dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j], dp[i][j] + (S[i] == T[j]))
ans = ""
while n > 0 and m > 0:
if dp[n][m] == dp[n - 1][m]:
n -= 1
elif dp... | S = eval(input())
T = eval(input())
n = len(S)
m = len(T)
dp = [[0] * (m + 1) for i in range(n + 1)]
for i in range(n):
for j in range(m):
if S[i] == T[j]:
dp[i + 1][j + 1] = dp[i][j] + 1
else:
dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1])
ans = ""
while n > 0 and m > 0:... | false | 13.636364 | [
"- dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j], dp[i][j] + (S[i] == T[j]))",
"+ if S[i] == T[j]:",
"+ dp[i + 1][j + 1] = dp[i][j] + 1",
"+ else:",
"+ dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1])"
] | false | 0.088803 | 0.042817 | 2.073991 | [
"s691773766",
"s623955548"
] |
u312025627 | p03437 | python | s002648851 | s603140062 | 179 | 165 | 38,256 | 38,384 | Accepted | Accepted | 7.82 | x, y = (int(i) for i in input().split())
if x%y == 0:
print((-1))
else:
print(x) | def main():
X, Y = (int(i) for i in input().split())
if X % Y == 0:
print((-1))
else:
print(X)
if __name__ == '__main__':
main()
| 5 | 10 | 86 | 170 | x, y = (int(i) for i in input().split())
if x % y == 0:
print((-1))
else:
print(x)
| def main():
X, Y = (int(i) for i in input().split())
if X % Y == 0:
print((-1))
else:
print(X)
if __name__ == "__main__":
main()
| false | 50 | [
"-x, y = (int(i) for i in input().split())",
"-if x % y == 0:",
"- print((-1))",
"-else:",
"- print(x)",
"+def main():",
"+ X, Y = (int(i) for i in input().split())",
"+ if X % Y == 0:",
"+ print((-1))",
"+ else:",
"+ print(X)",
"+",
"+",
"+if __name__ == \"__m... | false | 0.045037 | 0.045128 | 0.997988 | [
"s002648851",
"s603140062"
] |
u418826171 | p03470 | python | s172972650 | s242910643 | 31 | 27 | 9,144 | 9,168 | Accepted | Accepted | 12.9 | N = int(eval(input()))
d = sorted([int(eval(input())) for i in range(N)])
ans = 1
for i in range(N-1):
if d[i] < d[i+1]:
ans += 1
print(ans) | N = int(eval(input()))
d = [int(eval(input())) for i in range(N)]
print((len(set(d)))) | 7 | 3 | 146 | 74 | N = int(eval(input()))
d = sorted([int(eval(input())) for i in range(N)])
ans = 1
for i in range(N - 1):
if d[i] < d[i + 1]:
ans += 1
print(ans)
| N = int(eval(input()))
d = [int(eval(input())) for i in range(N)]
print((len(set(d))))
| false | 57.142857 | [
"-d = sorted([int(eval(input())) for i in range(N)])",
"-ans = 1",
"-for i in range(N - 1):",
"- if d[i] < d[i + 1]:",
"- ans += 1",
"-print(ans)",
"+d = [int(eval(input())) for i in range(N)]",
"+print((len(set(d))))"
] | false | 0.048242 | 0.048726 | 0.990064 | [
"s172972650",
"s242910643"
] |
u440566786 | p02912 | python | s766435097 | s171389027 | 401 | 367 | 68,224 | 63,856 | Accepted | Accepted | 8.48 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from heapq import heappush,heappop,heapify
def resolve():
n,m=list(map(int,input().split()))
A=list([-int(x) for x in input().split()])
heapify(A)
for _ in range(m):
x=... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
class Heap(object):
def __init__(self, A):
self._heap = []
# heapify は O(n) でできるらしいが、O(nlogn) で妥協
# cf. https://github.com/python/cpython/blob/3.8/Lib/h... | 17 | 74 | 400 | 2,131 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
from heapq import heappush, heappop, heapify
def resolve():
n, m = list(map(int, input().split()))
A = list([-int(x) for x in input().split()])
heapify(A)
for _ in range(m):
... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda: sys.stdin.readline().rstrip()
class Heap(object):
def __init__(self, A):
self._heap = []
# heapify は O(n) でできるらしいが、O(nlogn) で妥協
# cf. https://github.com/python/cpython/blob/3.8/Lib... | false | 77.027027 | [
"-MOD = 10**9 + 7",
"+MOD = 10**9 + 7 # 998244353",
"-from heapq import heappush, heappop, heapify",
"+",
"+",
"+class Heap(object):",
"+ def __init__(self, A):",
"+ self._heap = []",
"+ # heapify は O(n) でできるらしいが、O(nlogn) で妥協",
"+ # cf. https://github.com/python/cpython/bl... | false | 0.113534 | 0.136637 | 0.830919 | [
"s766435097",
"s171389027"
] |
u867848444 | p02887 | python | s189891475 | s807829149 | 196 | 42 | 45,424 | 3,316 | Accepted | Accepted | 78.57 | n=int(eval(input()))
s=eval(input())
ss=set(s)
l=s[0]
count=1
for j in range(n):
if l!=s[j]:
count+=1
l=s[j]
print(count) | n=int(eval(input()))
s=eval(input())
cnt=1
temp=s[0]
for i in range(n):
if temp!=s[i]:
cnt+=1
temp=s[i]
print(cnt) | 10 | 9 | 138 | 130 | n = int(eval(input()))
s = eval(input())
ss = set(s)
l = s[0]
count = 1
for j in range(n):
if l != s[j]:
count += 1
l = s[j]
print(count)
| n = int(eval(input()))
s = eval(input())
cnt = 1
temp = s[0]
for i in range(n):
if temp != s[i]:
cnt += 1
temp = s[i]
print(cnt)
| false | 10 | [
"-ss = set(s)",
"-l = s[0]",
"-count = 1",
"-for j in range(n):",
"- if l != s[j]:",
"- count += 1",
"- l = s[j]",
"-print(count)",
"+cnt = 1",
"+temp = s[0]",
"+for i in range(n):",
"+ if temp != s[i]:",
"+ cnt += 1",
"+ temp = s[i]",
"+print(cnt)"
] | false | 0.044942 | 0.044852 | 1.002 | [
"s189891475",
"s807829149"
] |
u670180528 | p02889 | python | s413638726 | s945574737 | 642 | 568 | 40,792 | 40,760 | Accepted | Accepted | 11.53 | from scipy.sparse.csgraph import floyd_warshall
import numpy as np
n,m,l,*L=list(map(int,open(0).read().split()))
abc=L[:3*m];st=L[3*m+1:]
town=[[float("inf")]*n for _ in range(n)]
for a,b,c in zip(*[iter(abc)]*3):
if c<=l:
town[a-1][b-1]=c
fw=floyd_warshall(town,0)
ti=floyd_warshall(np.where(fw<=l,1,fw),0)... | def main():
from scipy.sparse.csgraph import floyd_warshall
import numpy as np
n, m, l, *L = list(map(int, open(0).read().split()))
abc = L[:3 * m];
st = L[3 * m + 1:]
r = [[float("inf")] * n for _ in range(n)]
for a, b, c in zip(*[iter(abc)] * 3):
if c <= l: r[a - 1][b - 1] = c
fw = floyd_warshall(r... | 15 | 21 | 428 | 542 | from scipy.sparse.csgraph import floyd_warshall
import numpy as np
n, m, l, *L = list(map(int, open(0).read().split()))
abc = L[: 3 * m]
st = L[3 * m + 1 :]
town = [[float("inf")] * n for _ in range(n)]
for a, b, c in zip(*[iter(abc)] * 3):
if c <= l:
town[a - 1][b - 1] = c
fw = floyd_warshall(town, 0)
ti ... | def main():
from scipy.sparse.csgraph import floyd_warshall
import numpy as np
n, m, l, *L = list(map(int, open(0).read().split()))
abc = L[: 3 * m]
st = L[3 * m + 1 :]
r = [[float("inf")] * n for _ in range(n)]
for a, b, c in zip(*[iter(abc)] * 3):
if c <= l:
r[a - 1][b... | false | 28.571429 | [
"-from scipy.sparse.csgraph import floyd_warshall",
"-import numpy as np",
"+def main():",
"+ from scipy.sparse.csgraph import floyd_warshall",
"+ import numpy as np",
"-n, m, l, *L = list(map(int, open(0).read().split()))",
"-abc = L[: 3 * m]",
"-st = L[3 * m + 1 :]",
"-town = [[float(\"inf\"... | false | 0.298478 | 0.284051 | 1.050793 | [
"s413638726",
"s945574737"
] |
u057916330 | p03221 | python | s711746000 | s615152256 | 753 | 691 | 38,420 | 39,152 | Accepted | Accepted | 8.23 | # https://abc113.contest.atcoder.jp/tasks/abc113_c
def pad(n):
return '{:0>6}'.format(n)
N, M = list(map(int, input().split()))
data = [None for _ in range(M)]
for i in range(M):
Pi, Yi = list(map(int, input().split()))
data[i] = [Pi, Yi, 1, i]
data.sort(key=lambda x: x[1]) # sort by year
da... | # https://abc113.contest.atcoder.jp/tasks/abc113_c
def pad(n):
return '{:0>6}'.format(n)
N, M = list(map(int, input().split()))
work = [None for _ in range(M)]
orig = [None for _ in range(M)] # retains original order
for i in range(M):
Pi, Yi = list(map(int, input().split()))
data = [Pi, Yi, 1,... | 23 | 25 | 606 | 652 | # https://abc113.contest.atcoder.jp/tasks/abc113_c
def pad(n):
return "{:0>6}".format(n)
N, M = list(map(int, input().split()))
data = [None for _ in range(M)]
for i in range(M):
Pi, Yi = list(map(int, input().split()))
data[i] = [Pi, Yi, 1, i]
data.sort(key=lambda x: x[1]) # sort by year
data.sort(key=l... | # https://abc113.contest.atcoder.jp/tasks/abc113_c
def pad(n):
return "{:0>6}".format(n)
N, M = list(map(int, input().split()))
work = [None for _ in range(M)]
orig = [None for _ in range(M)] # retains original order
for i in range(M):
Pi, Yi = list(map(int, input().split()))
data = [Pi, Yi, 1, i]
wo... | false | 8 | [
"-data = [None for _ in range(M)]",
"+work = [None for _ in range(M)]",
"+orig = [None for _ in range(M)] # retains original order",
"- data[i] = [Pi, Yi, 1, i]",
"-data.sort(key=lambda x: x[1]) # sort by year",
"-data.sort(key=lambda x: x[0]) # sort by prefectures",
"+ data = [Pi, Yi, 1, i]",
... | false | 0.043457 | 0.043251 | 1.004761 | [
"s711746000",
"s615152256"
] |
u905203728 | p03401 | python | s184757604 | s357904229 | 410 | 372 | 64,876 | 63,980 | Accepted | Accepted | 9.27 | n=int(eval(input()))
box=[0]+list(map(int,input().split()))+[0]
count=0
for i in range(n+1):count +=abs(box[i]-box[i+1])
for j in range(1,n+1):
print((count-(abs(box[j-1]-box[j])+abs(box[j]-box[j+1]))+abs(box[j-1]-box[j+1]))) | n=int(eval(input()))
add=list(map(int,input().split()))
add.insert(0,0)
add.append(0)
count=0
for i in range(n+1):
count +=abs(add[i]-add[i+1])
for i in range(1,n+1):
print((count-(abs(add[i-1]-add[i])+abs(add[i]-add[i+1]))+(abs(add[i-1]-add[i+1])))) | 6 | 9 | 226 | 258 | n = int(eval(input()))
box = [0] + list(map(int, input().split())) + [0]
count = 0
for i in range(n + 1):
count += abs(box[i] - box[i + 1])
for j in range(1, n + 1):
print(
(
count
- (abs(box[j - 1] - box[j]) + abs(box[j] - box[j + 1]))
+ abs(box[j - 1] - box[j + 1])
... | n = int(eval(input()))
add = list(map(int, input().split()))
add.insert(0, 0)
add.append(0)
count = 0
for i in range(n + 1):
count += abs(add[i] - add[i + 1])
for i in range(1, n + 1):
print(
(
count
- (abs(add[i - 1] - add[i]) + abs(add[i] - add[i + 1]))
+ (abs(add[i... | false | 33.333333 | [
"-box = [0] + list(map(int, input().split())) + [0]",
"+add = list(map(int, input().split()))",
"+add.insert(0, 0)",
"+add.append(0)",
"- count += abs(box[i] - box[i + 1])",
"-for j in range(1, n + 1):",
"+ count += abs(add[i] - add[i + 1])",
"+for i in range(1, n + 1):",
"- - (abs(... | false | 0.044011 | 0.043352 | 1.015184 | [
"s184757604",
"s357904229"
] |
u596276291 | p03700 | python | s643907390 | s562780636 | 1,276 | 1,048 | 8,624 | 9,064 | Accepted | Accepted | 17.87 | from collections import defaultdict
from math import ceil
def can_kill(total, A, B, h_list):
add = A - B
num = 0
for h in h_list:
h -= B * total
num += ceil(h / add)
if num > total:
return False
return True
def main():
N, A, B = list(map(int, i... | 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... | 33 | 51 | 695 | 1,216 | from collections import defaultdict
from math import ceil
def can_kill(total, A, B, h_list):
add = A - B
num = 0
for h in h_list:
h -= B * total
num += ceil(h / add)
if num > total:
return False
return True
def main():
N, A, B = list(map(int, input().split()))... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecurs... | false | 35.294118 | [
"-from collections import defaultdict",
"-from math import ceil",
"+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, bisec... | false | 0.053105 | 0.048512 | 1.094669 | [
"s643907390",
"s562780636"
] |
u651235280 | p02761 | python | s004917927 | s713301273 | 30 | 26 | 9,192 | 9,192 | Accepted | Accepted | 13.33 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n,m = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(m)]
for i in range(1000):
flag = True
for s in sc:
num = str(i)
if len(num) >= s[0] and str(s[1]) == num[s[0] - 1]:
... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n,m = list(map(int, input().split()))
v = [list(map(int, input().split())) for _ in range(m)]
for i in range(1000):
flag = True
num = str(i)
for sc in v:
if len(num) >= sc[0] and str(sc[1]) == num[sc[0] - 1]:
... | 21 | 20 | 469 | 462 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n, m = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(m)]
for i in range(1000):
flag = True
for s in sc:
num = str(i)
if len(num) >= s[0] and str(s[1]) == num[s[0] - 1]:
continue... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n, m = list(map(int, input().split()))
v = [list(map(int, input().split())) for _ in range(m)]
for i in range(1000):
flag = True
num = str(i)
for sc in v:
if len(num) >= sc[0] and str(sc[1]) == num[sc[0] - 1]:
continue
... | false | 4.761905 | [
"-sc = [list(map(int, input().split())) for _ in range(m)]",
"+v = [list(map(int, input().split())) for _ in range(m)]",
"- for s in sc:",
"- num = str(i)",
"- if len(num) >= s[0] and str(s[1]) == num[s[0] - 1]:",
"+ num = str(i)",
"+ for sc in v:",
"+ if len(num) >= sc[0... | false | 0.042567 | 0.073252 | 0.581096 | [
"s004917927",
"s713301273"
] |
u955248595 | p03231 | python | s892569461 | s383215560 | 48 | 39 | 13,308 | 9,384 | Accepted | Accepted | 18.75 | import math
N,M = (int(T) for T in input().split())
S = eval(input())
T = eval(input())
NMG = math.gcd(N,M)
Length = N*M//NMG
Flag = True
SIndex = [Nk*(M//NMG) for Nk in range(0,N)]
SList = list(S)
Count = 0
for Mk in range(0,M):
if Mk%(M//NMG)==0:
if SList[Count*(N//NMG)]!=T[Mk]:
... | import math
N,M = (int(T) for T in input().split())
S = eval(input())
T = eval(input())
NMgcd = math.gcd(N,M)
Leng = N*M//NMgcd
Flag = True
SList = [S[Nk] for Nk in range(0,N) if Nk%(N//NMgcd)==0]
for Mk in range(0,len(SList)):
if SList[Mk]!=T[Mk*(M//NMgcd)]:
Flag = False
break
if ... | 23 | 18 | 435 | 352 | import math
N, M = (int(T) for T in input().split())
S = eval(input())
T = eval(input())
NMG = math.gcd(N, M)
Length = N * M // NMG
Flag = True
SIndex = [Nk * (M // NMG) for Nk in range(0, N)]
SList = list(S)
Count = 0
for Mk in range(0, M):
if Mk % (M // NMG) == 0:
if SList[Count * (N // NMG)] != T[Mk]:
... | import math
N, M = (int(T) for T in input().split())
S = eval(input())
T = eval(input())
NMgcd = math.gcd(N, M)
Leng = N * M // NMgcd
Flag = True
SList = [S[Nk] for Nk in range(0, N) if Nk % (N // NMgcd) == 0]
for Mk in range(0, len(SList)):
if SList[Mk] != T[Mk * (M // NMgcd)]:
Flag = False
break
... | false | 21.73913 | [
"-NMG = math.gcd(N, M)",
"-Length = N * M // NMG",
"+NMgcd = math.gcd(N, M)",
"+Leng = N * M // NMgcd",
"-SIndex = [Nk * (M // NMG) for Nk in range(0, N)]",
"-SList = list(S)",
"-Count = 0",
"-for Mk in range(0, M):",
"- if Mk % (M // NMG) == 0:",
"- if SList[Count * (N // NMG)] != T[Mk]... | false | 0.037924 | 0.040761 | 0.930411 | [
"s892569461",
"s383215560"
] |
u386819480 | p03449 | python | s293331859 | s073292765 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | #!/usr/bin/env python3
import sys
def dfs(x:int, y:int):
if(y == 1 and x == (N-1)):
return A[y][x]
elif(y > 1 or x > N-1):
return 0
else:
return max(dfs(x+1, y), dfs(x, y+1)) + A[y][x]
def solve(N: int, A: "List[List[int]]"):
print((dfs(0,0)))
... | #!/usr/bin/env python3
import sys
def solve(N: int, A: "List[List[int]]"):
ans = 0
for i in range(0,N):
ans = max(sum(A[0][:i+1])+sum(A[1][i:]), ans)
print(ans)
return
# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now... | 34 | 27 | 879 | 741 | #!/usr/bin/env python3
import sys
def dfs(x: int, y: int):
if y == 1 and x == (N - 1):
return A[y][x]
elif y > 1 or x > N - 1:
return 0
else:
return max(dfs(x + 1, y), dfs(x, y + 1)) + A[y][x]
def solve(N: int, A: "List[List[int]]"):
print((dfs(0, 0)))
return
# Generate... | #!/usr/bin/env python3
import sys
def solve(N: int, A: "List[List[int]]"):
ans = 0
for i in range(0, N):
ans = max(sum(A[0][: i + 1]) + sum(A[1][i:]), ans)
print(ans)
return
# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can ... | false | 20.588235 | [
"-def dfs(x: int, y: int):",
"- if y == 1 and x == (N - 1):",
"- return A[y][x]",
"- elif y > 1 or x > N - 1:",
"- return 0",
"- else:",
"- return max(dfs(x + 1, y), dfs(x, y + 1)) + A[y][x]",
"-",
"-",
"- print((dfs(0, 0)))",
"+ ans = 0",
"+ for i in ran... | false | 0.047775 | 0.037948 | 1.258964 | [
"s293331859",
"s073292765"
] |
u241159583 | p03610 | python | s092410024 | s264370556 | 19 | 17 | 3,188 | 3,188 | Accepted | Accepted | 10.53 | s = eval(input())
print((s[::2])) | s = eval(input())
print((s[0::2])) | 2 | 2 | 26 | 27 | s = eval(input())
print((s[::2]))
| s = eval(input())
print((s[0::2]))
| false | 0 | [
"-print((s[::2]))",
"+print((s[0::2]))"
] | false | 0.042973 | 0.046982 | 0.914652 | [
"s092410024",
"s264370556"
] |
u811841526 | p02408 | python | s712966202 | s203379100 | 40 | 20 | 7,984 | 5,604 | Accepted | Accepted | 50 | from collections import OrderedDict
cards = OrderedDict()
cards['S'] = set()
cards['H'] = set()
cards['C'] = set()
cards['D'] = set()
n = int(eval(input()))
for _ in range(n):
suit, num = input().split()
num = int(num)
cards[suit].add(num)
for suit, nums in list(cards.items()):
for num... | n = int(eval(input()))
deck = []
for i in range(n):
deck.append(eval(input()))
for suit in 'SHCD':
for i in range(1, 14):
card = f'{suit} {i}'
if card not in deck:
print(card)
| 18 | 11 | 383 | 212 | from collections import OrderedDict
cards = OrderedDict()
cards["S"] = set()
cards["H"] = set()
cards["C"] = set()
cards["D"] = set()
n = int(eval(input()))
for _ in range(n):
suit, num = input().split()
num = int(num)
cards[suit].add(num)
for suit, nums in list(cards.items()):
for num in range(1, 14):... | n = int(eval(input()))
deck = []
for i in range(n):
deck.append(eval(input()))
for suit in "SHCD":
for i in range(1, 14):
card = f"{suit} {i}"
if card not in deck:
print(card)
| false | 38.888889 | [
"-from collections import OrderedDict",
"-",
"-cards = OrderedDict()",
"-cards[\"S\"] = set()",
"-cards[\"H\"] = set()",
"-cards[\"C\"] = set()",
"-cards[\"D\"] = set()",
"-for _ in range(n):",
"- suit, num = input().split()",
"- num = int(num)",
"- cards[suit].add(num)",
"-for suit, ... | false | 0.048022 | 0.040009 | 1.200263 | [
"s712966202",
"s203379100"
] |
u298633786 | p03994 | python | s223748319 | s074259413 | 1,903 | 206 | 52,400 | 52,912 | Accepted | Accepted | 89.17 | import sys
import math # noqa
import bisect # noqa
import queue # noqa
def input():
return sys.stdin.readline().rstrip()
def main():
S = eval(input())
K = int(eval(input()))
S = [s for s in S]
D = [ord('z') - ord(s) + 1 if s != 'a' else 0 for s in S]
T = []
for s, d ... | import sys
import math # noqa
import bisect # noqa
import queue # noqa
def input():
return sys.stdin.readline().rstrip()
def main():
S = eval(input())
K = int(eval(input()))
S = [s for s in S]
D = [ord('z') - ord(s) + 1 if s != 'a' else 0 for s in S]
T = []
for s, d ... | 37 | 38 | 652 | 665 | import sys
import math # noqa
import bisect # noqa
import queue # noqa
def input():
return sys.stdin.readline().rstrip()
def main():
S = eval(input())
K = int(eval(input()))
S = [s for s in S]
D = [ord("z") - ord(s) + 1 if s != "a" else 0 for s in S]
T = []
for s, d in zip(S, D):
... | import sys
import math # noqa
import bisect # noqa
import queue # noqa
def input():
return sys.stdin.readline().rstrip()
def main():
S = eval(input())
K = int(eval(input()))
S = [s for s in S]
D = [ord("z") - ord(s) + 1 if s != "a" else 0 for s in S]
T = []
for s, d in zip(S, D):
... | false | 2.631579 | [
"+ K %= 26"
] | false | 0.196189 | 0.046096 | 4.256058 | [
"s223748319",
"s074259413"
] |
u755801379 | p02713 | python | s579755966 | s899961481 | 1,370 | 451 | 9,176 | 68,900 | Accepted | Accepted | 67.08 | k=int(eval(input()))
import math
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
a=math.gcd(i,j)
for l in range(1,k+1):
ans+=math.gcd(a,l)
print(ans) | k=int(eval(input()))
import math
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
for l in range(1,k+1):
a=math.gcd(i,j)
ans+=math.gcd(a,l)
print(ans) | 9 | 9 | 187 | 185 | k = int(eval(input()))
import math
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
a = math.gcd(i, j)
for l in range(1, k + 1):
ans += math.gcd(a, l)
print(ans)
| k = int(eval(input()))
import math
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for l in range(1, k + 1):
a = math.gcd(i, j)
ans += math.gcd(a, l)
print(ans)
| false | 0 | [
"- a = math.gcd(i, j)",
"+ a = math.gcd(i, j)"
] | false | 0.110131 | 0.206157 | 0.534208 | [
"s579755966",
"s899961481"
] |
u922449550 | p03165 | python | s345956361 | s723403040 | 574 | 528 | 112,476 | 112,476 | Accepted | Accepted | 8.01 | S = eval(input())
T = eval(input())
dp = [[0] * (len(T)+1) for i in range(len(S)+1)]
for i, s in enumerate(S, 1):
for j, t in enumerate(T, 1):
if s == t:
dp[i][j] = dp[i-1][j-1] + 1
else:
dp[i][j] = max(dp[i-1][j], dp[i][j-1])
ans = []
while i > 0 and j > 0:
if dp[i][j] == dp[i][j... | S = eval(input())
T = eval(input())
dp = [[0] * (len(T)+1) for i in range(len(S)+1)]
for i, s in enumerate(S, 1):
for j, t in enumerate(T, 1):
if s == t:
dp[i][j] = dp[i-1][j-1] + 1
else:
dp[i][j] = max(dp[i-1][j], dp[i][j-1])
ans = ''
while i > 0 and j > 0:
if dp[i][j] == dp[i][j... | 23 | 23 | 454 | 440 | S = eval(input())
T = eval(input())
dp = [[0] * (len(T) + 1) for i in range(len(S) + 1)]
for i, s in enumerate(S, 1):
for j, t in enumerate(T, 1):
if s == t:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
ans = []
while i > 0 and j > 0:
i... | S = eval(input())
T = eval(input())
dp = [[0] * (len(T) + 1) for i in range(len(S) + 1)]
for i, s in enumerate(S, 1):
for j, t in enumerate(T, 1):
if s == t:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
ans = ""
while i > 0 and j > 0:
i... | false | 0 | [
"-ans = []",
"+ans = \"\"",
"- ans.append(S[i - 1])",
"+ ans += S[i - 1]",
"-print((\"\".join(ans[::-1])))",
"+print((ans[::-1]))"
] | false | 0.112951 | 0.039762 | 2.840672 | [
"s345956361",
"s723403040"
] |
u873482706 | p00134 | python | s636005241 | s748328493 | 30 | 20 | 4,964 | 4,692 | Accepted | Accepted | 33.33 | import math
N = eval(input())
S = sum([int(input()) for i in range(N)]) / float(N)
print(int(math.floor(S))) | N = eval(input())
print(sum([int(input()) for i in range(N)]) / N) | 4 | 2 | 108 | 64 | import math
N = eval(input())
S = sum([int(input()) for i in range(N)]) / float(N)
print(int(math.floor(S)))
| N = eval(input())
print(sum([int(input()) for i in range(N)]) / N)
| false | 50 | [
"-import math",
"-",
"-S = sum([int(input()) for i in range(N)]) / float(N)",
"-print(int(math.floor(S)))",
"+print(sum([int(input()) for i in range(N)]) / N)"
] | false | 0.164647 | 0.037304 | 4.413668 | [
"s636005241",
"s748328493"
] |
u844646164 | p03253 | python | s581495226 | s571398449 | 198 | 131 | 58,096 | 15,380 | Accepted | Accepted | 33.84 | import math
import collections
Mod = 1000000007
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
def COMinit():
for i in range(2, N+111):
fac.append(fac[-1]*i%Mod)
inv.append((-inv[Mod%i] * (Mod//i)) % Mod)
finv.append(finv[-1] * inv[-1] % Mod)
def COM(n, k):
if n < 0 or k <... | import math
import collections
#Max = 210000
Mod = 1000000007
"""
fac = [0] * Max
finv = [0] * Max
inv = [0] * Max
def COMinit():
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, Max):
fac[i] = fac[i-1] * i % Mod
inv[i] = Mod - inv[Mod%i] * (Mod//i)... | 34 | 47 | 755 | 1,078 | import math
import collections
Mod = 1000000007
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
def COMinit():
for i in range(2, N + 111):
fac.append(fac[-1] * i % Mod)
inv.append((-inv[Mod % i] * (Mod // i)) % Mod)
finv.append(finv[-1] * inv[-1] % Mod)
def COM(n, k):
if n < 0 or k < 0 or n... | import math
import collections
# Max = 210000
Mod = 1000000007
"""
fac = [0] * Max
finv = [0] * Max
inv = [0] * Max
def COMinit():
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, Max):
fac[i] = fac[i-1] * i % Mod
inv[i] = Mod - inv[Mod%i] * (Mod//i) % Mod
... | false | 27.659574 | [
"+# Max = 210000",
"+\"\"\"",
"+fac = [0] * Max",
"+finv = [0] * Max",
"+inv = [0] * Max",
"+def COMinit():",
"+ fac[0] = fac[1] = 1",
"+ finv[0] = finv[1] = 1",
"+ inv[1] = 1",
"+ for i in range(2, Max):",
"+ fac[i] = fac[i-1] * i % Mod",
"+ inv[i] = Mod - inv[Mod%i]... | false | 0.131151 | 0.08667 | 1.513218 | [
"s581495226",
"s571398449"
] |
u699089116 | p02803 | python | s455236315 | s523257897 | 354 | 319 | 9,436 | 9,476 | Accepted | Accepted | 9.89 | from collections import deque
H, W = list(map(int, input().split()))
maze = [list(eval(input())) for _ in range(H)]
direction = [[0, 1], [1, 0], [0, -1], [-1, 0]]
ans = 0
for sh in range(H):
for sw in range(W):
if maze[sh][sw] == "#":
continue
dist = [[-1] * W for _ in range... | from collections import deque
H, W = list(map(int, input().split()))
maze = [list(eval(input())) for _ in range(H)]
directions = [[0, 1], [1, 0], [0, -1], [-1, 0]]
ans = 0
for sh in range(H):
for sw in range(W):
if maze[sh][sw] == "#":
continue
dist = [[-1] * W for _ in range(... | 31 | 31 | 905 | 934 | from collections import deque
H, W = list(map(int, input().split()))
maze = [list(eval(input())) for _ in range(H)]
direction = [[0, 1], [1, 0], [0, -1], [-1, 0]]
ans = 0
for sh in range(H):
for sw in range(W):
if maze[sh][sw] == "#":
continue
dist = [[-1] * W for _ in range(H)]
... | from collections import deque
H, W = list(map(int, input().split()))
maze = [list(eval(input())) for _ in range(H)]
directions = [[0, 1], [1, 0], [0, -1], [-1, 0]]
ans = 0
for sh in range(H):
for sw in range(W):
if maze[sh][sw] == "#":
continue
dist = [[-1] * W for _ in range(H)]
... | false | 0 | [
"-direction = [[0, 1], [1, 0], [0, -1], [-1, 0]]",
"+directions = [[0, 1], [1, 0], [0, -1], [-1, 0]]",
"- for dh, dw in direction:",
"- if not ((0 <= nh + dh < H) and (0 <= nw + dw < W)):",
"+ for dh, dw in directions:",
"+ tmp_h, tmp_w = nh + dh, nw + d... | false | 0.045744 | 0.044927 | 1.018175 | [
"s455236315",
"s523257897"
] |
u969850098 | p03029 | python | s815709146 | s056700136 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | A, P = list(map(int, input().split()))
print(((A * 3 + P) // 2)) | a, p = list(map(int, input().split()))
print(((a*3 + p) // 2)) | 2 | 2 | 57 | 55 | A, P = list(map(int, input().split()))
print(((A * 3 + P) // 2))
| a, p = list(map(int, input().split()))
print(((a * 3 + p) // 2))
| false | 0 | [
"-A, P = list(map(int, input().split()))",
"-print(((A * 3 + P) // 2))",
"+a, p = list(map(int, input().split()))",
"+print(((a * 3 + p) // 2))"
] | false | 0.043144 | 0.042218 | 1.021942 | [
"s815709146",
"s056700136"
] |
u057109575 | p03946 | python | s923304691 | s552518468 | 296 | 240 | 69,916 | 69,920 | Accepted | Accepted | 18.92 | from bisect import bisect_left
from collections import defaultdict
N, T, *A = list(map(int, open(0).read().split()))
inf = 10 ** 9 + 7
dp = [inf] * (N + 1)
ctr = defaultdict(int)
for i in range(N):
idx = bisect_left(dp, A[i])
dp[idx] = A[i]
if idx != 0:
ctr[A[i] - dp[0]] += 1
print(... | from collections import defaultdict
N, T, *A = list(map(int, open(0).read().split()))
ctr = defaultdict(int)
m = 10 ** 9 + 7
for i in range(N):
m = min(m, A[i])
ctr[A[i] - m] += 1
print((ctr[max(ctr)]))
| 15 | 11 | 329 | 216 | from bisect import bisect_left
from collections import defaultdict
N, T, *A = list(map(int, open(0).read().split()))
inf = 10**9 + 7
dp = [inf] * (N + 1)
ctr = defaultdict(int)
for i in range(N):
idx = bisect_left(dp, A[i])
dp[idx] = A[i]
if idx != 0:
ctr[A[i] - dp[0]] += 1
print((ctr[max(ctr)]))
| from collections import defaultdict
N, T, *A = list(map(int, open(0).read().split()))
ctr = defaultdict(int)
m = 10**9 + 7
for i in range(N):
m = min(m, A[i])
ctr[A[i] - m] += 1
print((ctr[max(ctr)]))
| false | 26.666667 | [
"-from bisect import bisect_left",
"-inf = 10**9 + 7",
"-dp = [inf] * (N + 1)",
"+m = 10**9 + 7",
"- idx = bisect_left(dp, A[i])",
"- dp[idx] = A[i]",
"- if idx != 0:",
"- ctr[A[i] - dp[0]] += 1",
"+ m = min(m, A[i])",
"+ ctr[A[i] - m] += 1"
] | false | 0.04255 | 0.041906 | 1.01537 | [
"s923304691",
"s552518468"
] |
u038408819 | p03013 | python | s569914035 | s045138015 | 595 | 213 | 463,476 | 7,764 | Accepted | Accepted | 64.2 | N, M = list(map(int, input().split()))
#a = [int(input()) for _ in range(M)]
issafe = [True] * (N + 1)
for i in range(M):
issafe[int(eval(input()))] = False
dp = [0] * (N + 1)
dp[0] = 1
if issafe[1]:
dp[1] = 1
for i in range(2, N + 1):
if issafe[i - 1]:
dp[i] += dp[i - 1]
if issa... | N, M = list(map(int, input().split()))
#a = [int(input()) for _ in range(M)]
issafe = [True] * (N + 1)
for i in range(M):
issafe[int(eval(input()))] = False
dp = [0] * (N + 1)
dp[0] = 1
if issafe[1]:
dp[1] = 1
mod = 1000000007
for i in range(2, N + 1):
if issafe[i - 1]:
dp[i] += dp[i... | 19 | 20 | 386 | 404 | N, M = list(map(int, input().split()))
# a = [int(input()) for _ in range(M)]
issafe = [True] * (N + 1)
for i in range(M):
issafe[int(eval(input()))] = False
dp = [0] * (N + 1)
dp[0] = 1
if issafe[1]:
dp[1] = 1
for i in range(2, N + 1):
if issafe[i - 1]:
dp[i] += dp[i - 1]
if issafe[i - 2]:
... | N, M = list(map(int, input().split()))
# a = [int(input()) for _ in range(M)]
issafe = [True] * (N + 1)
for i in range(M):
issafe[int(eval(input()))] = False
dp = [0] * (N + 1)
dp[0] = 1
if issafe[1]:
dp[1] = 1
mod = 1000000007
for i in range(2, N + 1):
if issafe[i - 1]:
dp[i] += dp[i - 1]
if is... | false | 5 | [
"+mod = 1000000007",
"-mod = 1000000007",
"-print((dp[N] % mod))",
"+ dp[i] = dp[i] % mod",
"+print((dp[N]))"
] | false | 0.084417 | 0.032467 | 2.600128 | [
"s569914035",
"s045138015"
] |
u426534722 | p02243 | python | s311651007 | s565286375 | 750 | 390 | 70,900 | 42,520 | Accepted | Accepted | 48 | from sys import stdin
import heapq
INF = 1<<21
n = int(stdin.readline())
adj = [[]] * n
for u in range(0, n):
U = list(map(int, stdin.readline().split()[2:]))
adj[u] = [e for e in zip(U[0::2], U[1::2])]
def dijkstra():
d = [0] + [INF] * (n - 1)
hq = [(0, 0)]
while hq:
u = heapq.h... | from sys import stdin
import heapq
INF = 1<<21
n = int(stdin.readline())
adj = [[]] * n
for u in range(0, n):
U = list(map(int, stdin.readline().split()[2:]))
adj[u] = (e for e in zip(U[0::2], U[1::2]))
def dijkstra():
d = [0] + [INF] * (n - 1)
hq = [(0, 0)]
while hq:
u = heapq.h... | 21 | 21 | 556 | 556 | from sys import stdin
import heapq
INF = 1 << 21
n = int(stdin.readline())
adj = [[]] * n
for u in range(0, n):
U = list(map(int, stdin.readline().split()[2:]))
adj[u] = [e for e in zip(U[0::2], U[1::2])]
def dijkstra():
d = [0] + [INF] * (n - 1)
hq = [(0, 0)]
while hq:
u = heapq.heappop(... | from sys import stdin
import heapq
INF = 1 << 21
n = int(stdin.readline())
adj = [[]] * n
for u in range(0, n):
U = list(map(int, stdin.readline().split()[2:]))
adj[u] = (e for e in zip(U[0::2], U[1::2]))
def dijkstra():
d = [0] + [INF] * (n - 1)
hq = [(0, 0)]
while hq:
u = heapq.heappop(... | false | 0 | [
"- adj[u] = [e for e in zip(U[0::2], U[1::2])]",
"+ adj[u] = (e for e in zip(U[0::2], U[1::2]))"
] | false | 0.057101 | 0.054986 | 1.038457 | [
"s311651007",
"s565286375"
] |
u724687935 | p03377 | python | s967620171 | s311034332 | 167 | 25 | 38,256 | 9,048 | Accepted | Accepted | 85.03 | A, B, X = list(map(int, input().split()))
ans = 'YES' if A <= X and X <= A + B else 'NO'
print(ans)
| A, B, X = list(map(int, input().split()))
ans = 'YES' if A <= X <= A + B else 'NO'
print(ans)
| 4 | 3 | 98 | 90 | A, B, X = list(map(int, input().split()))
ans = "YES" if A <= X and X <= A + B else "NO"
print(ans)
| A, B, X = list(map(int, input().split()))
ans = "YES" if A <= X <= A + B else "NO"
print(ans)
| false | 25 | [
"-ans = \"YES\" if A <= X and X <= A + B else \"NO\"",
"+ans = \"YES\" if A <= X <= A + B else \"NO\""
] | false | 0.087707 | 0.038215 | 2.295094 | [
"s967620171",
"s311034332"
] |
u606045429 | p02889 | python | s361341864 | s094236507 | 1,894 | 644 | 133,600 | 40,784 | Accepted | Accepted | 66 | def WarshallFloyd(M):
N = len(M)
for k in range(N):
for j in range(N):
for i in range(N):
M[i][j] = min(M[i][j], M[i][k] + M[k][j])
return M
INF = float("inf")
N, M, L, *I = list(map(int, open(0).read().split()))
ABC, ST = I[:3 * M], I[3 * M + 1:]
E = [[IN... | from scipy.sparse.csgraph import floyd_warshall
N, M, L, *I = list(map(int, open(0).read().split()))
ABC, ST = I[:3 * M], I[3 * M + 1:]
E = [[0] * N for _ in range(N)]
for a, b, c in zip(*[iter(ABC)] * 3):
E[a - 1][b - 1] = E[b - 1][a - 1] = c
E = floyd_warshall(E)
E = [[(eij <= L) for j, eij in enumer... | 32 | 21 | 711 | 541 | def WarshallFloyd(M):
N = len(M)
for k in range(N):
for j in range(N):
for i in range(N):
M[i][j] = min(M[i][j], M[i][k] + M[k][j])
return M
INF = float("inf")
N, M, L, *I = list(map(int, open(0).read().split()))
ABC, ST = I[: 3 * M], I[3 * M + 1 :]
E = [[INF] * N for _... | from scipy.sparse.csgraph import floyd_warshall
N, M, L, *I = list(map(int, open(0).read().split()))
ABC, ST = I[: 3 * M], I[3 * M + 1 :]
E = [[0] * N for _ in range(N)]
for a, b, c in zip(*[iter(ABC)] * 3):
E[a - 1][b - 1] = E[b - 1][a - 1] = c
E = floyd_warshall(E)
E = [[(eij <= L) for j, eij in enumerate(ei)] f... | false | 34.375 | [
"-def WarshallFloyd(M):",
"- N = len(M)",
"- for k in range(N):",
"- for j in range(N):",
"- for i in range(N):",
"- M[i][j] = min(M[i][j], M[i][k] + M[k][j])",
"- return M",
"+from scipy.sparse.csgraph import floyd_warshall",
"-",
"-INF = float(\"inf\")",... | false | 0.087831 | 0.611362 | 0.143664 | [
"s361341864",
"s094236507"
] |
u558242240 | p02792 | python | s649410548 | s654104793 | 314 | 246 | 3,064 | 3,316 | Accepted | Accepted | 21.66 | n = int(eval(input()))
ab = {}
for i in range(1, n+1):
t = str(i)
if (t[0], t[-1]) in ab:
ab[(t[0], t[-1])] += 1
else:
ab[(t[0], t[-1])] = 1
#print(ab)
ans = 0
for i in range(1, n+1):
t = str(i)
if (t[-1], t[0]) in ab:
ans += ab[(t[-1], t[0])]
print(ans)
| from collections import defaultdict
n = int(eval(input()))
counter = defaultdict(int)
for i in range(1, n+1):
t = str(i)
counter[(t[0], t[-1])] += 1
ans = 0
for i in range(1, n+1):
t = str(i)
ans += counter[(t[-1], t[0])]
print(ans)
| 16 | 15 | 309 | 261 | n = int(eval(input()))
ab = {}
for i in range(1, n + 1):
t = str(i)
if (t[0], t[-1]) in ab:
ab[(t[0], t[-1])] += 1
else:
ab[(t[0], t[-1])] = 1
# print(ab)
ans = 0
for i in range(1, n + 1):
t = str(i)
if (t[-1], t[0]) in ab:
ans += ab[(t[-1], t[0])]
print(ans)
| from collections import defaultdict
n = int(eval(input()))
counter = defaultdict(int)
for i in range(1, n + 1):
t = str(i)
counter[(t[0], t[-1])] += 1
ans = 0
for i in range(1, n + 1):
t = str(i)
ans += counter[(t[-1], t[0])]
print(ans)
| false | 6.25 | [
"+from collections import defaultdict",
"+",
"-ab = {}",
"+counter = defaultdict(int)",
"- if (t[0], t[-1]) in ab:",
"- ab[(t[0], t[-1])] += 1",
"- else:",
"- ab[(t[0], t[-1])] = 1",
"-# print(ab)",
"+ counter[(t[0], t[-1])] += 1",
"- if (t[-1], t[0]) in ab:",
"- ... | false | 0.058239 | 0.050706 | 1.148568 | [
"s649410548",
"s654104793"
] |
u606045429 | p02574 | python | s305987060 | s748437492 | 644 | 534 | 121,888 | 121,944 | Accepted | Accepted | 17.08 | from functools import reduce
from math import gcd
N, *A = list(map(int, open(0).read().split()))
C = [0] * (10 ** 6 + 10)
for a in A:
C[a] += 1
if reduce(gcd, A) != 1:
print("not coprime")
elif all(sum(C[i::i]) <= 1 for i in range(2, len(C))):
print("pairwise coprime")
else:
print("... | from functools import reduce
from math import gcd
N, *A = list(map(int, open(0).read().split()))
C = [0] * (max(A) + 1)
for a in A:
C[a] += 1
if reduce(gcd, A) != 1:
print("not coprime")
elif all(sum(C[i::i]) <= 1 for i in range(2, len(C))):
print("pairwise coprime")
else:
print("se... | 17 | 17 | 331 | 329 | from functools import reduce
from math import gcd
N, *A = list(map(int, open(0).read().split()))
C = [0] * (10**6 + 10)
for a in A:
C[a] += 1
if reduce(gcd, A) != 1:
print("not coprime")
elif all(sum(C[i::i]) <= 1 for i in range(2, len(C))):
print("pairwise coprime")
else:
print("setwise coprime")
| from functools import reduce
from math import gcd
N, *A = list(map(int, open(0).read().split()))
C = [0] * (max(A) + 1)
for a in A:
C[a] += 1
if reduce(gcd, A) != 1:
print("not coprime")
elif all(sum(C[i::i]) <= 1 for i in range(2, len(C))):
print("pairwise coprime")
else:
print("setwise coprime")
| false | 0 | [
"-C = [0] * (10**6 + 10)",
"+C = [0] * (max(A) + 1)"
] | false | 0.481772 | 0.03718 | 12.957925 | [
"s305987060",
"s748437492"
] |
u125090409 | p02595 | python | s391000523 | s732715227 | 912 | 566 | 66,508 | 66,588 | Accepted | Accepted | 37.94 | import numpy as np
n, d = list(map(int, input().split()))
x, y = np.array([list(map(int, input().split())) for _ in range(n)]).T
print((sum(x**2+y**2<=d**2))) | import numpy as np
n, d = list(map(int, input().split()))
x, y = np.array([list(map(int, input().split())) for _ in range(n)]).T
print(((x**2+y**2<=d**2).sum())) | 6 | 6 | 157 | 160 | import numpy as np
n, d = list(map(int, input().split()))
x, y = np.array([list(map(int, input().split())) for _ in range(n)]).T
print((sum(x**2 + y**2 <= d**2)))
| import numpy as np
n, d = list(map(int, input().split()))
x, y = np.array([list(map(int, input().split())) for _ in range(n)]).T
print(((x**2 + y**2 <= d**2).sum()))
| false | 0 | [
"-print((sum(x**2 + y**2 <= d**2)))",
"+print(((x**2 + y**2 <= d**2).sum()))"
] | false | 0.24293 | 0.24745 | 0.981733 | [
"s391000523",
"s732715227"
] |
u533039576 | p03164 | python | s863967311 | s666676384 | 239 | 186 | 147,240 | 149,336 | Accepted | Accepted | 22.18 | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(n)]
V_MAX = 10**5
dp = [[w + 1] * (V_MAX + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i, (wi, vi) in enumerate(items):
for j in range(V_MAX + 1):
if j >= vi:
... | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(n)]
V_MAX = 10**5
dp = [[w + 1] * (V_MAX + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i, (wi, vi) in enumerate(items):
for j in range(V_MAX + 1):
if j >= vi:
... | 24 | 23 | 566 | 530 | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(n)]
V_MAX = 10**5
dp = [[w + 1] * (V_MAX + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i, (wi, vi) in enumerate(items):
for j in range(V_MAX + 1):
if j >= vi:
dp[... | import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
items = [tuple(map(int, input().split())) for _ in range(n)]
V_MAX = 10**5
dp = [[w + 1] * (V_MAX + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i, (wi, vi) in enumerate(items):
for j in range(V_MAX + 1):
if j >= vi:
dp[... | false | 4.166667 | [
"-for i in range(n + 1):",
"- for j in range(V_MAX + 1):",
"- if dp[i][j] <= w:",
"- ans = max(ans, j)",
"+for j in range(V_MAX + 1):",
"+ if dp[n][j] <= w:",
"+ ans = max(ans, j)"
] | false | 0.338748 | 0.266267 | 1.272216 | [
"s863967311",
"s666676384"
] |
u325492232 | p02844 | python | s879042642 | s974830919 | 1,859 | 1,210 | 9,200 | 9,212 | Accepted | Accepted | 34.91 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
# 確認するpinの数字の組み合わせと桁の初期化
current_digit = 0
pin = f'{i:0>3}'
# pin = list(str(i).zfill(3))
k = pin[current_digit]
for num in s:
# 見つけると桁を右に一つずらす
if num == k:
current_digit += 1
... | def sumitrust2019_d():
n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
# 確認するpinの数字の組み合わせと桁の初期化
# pin = list(str(i).zfill(3))
current_digit = 0
pin = f'{i:0>3}'
search_num = pin[current_digit]
for num in s:
... | 25 | 32 | 533 | 860 | n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
# 確認するpinの数字の組み合わせと桁の初期化
current_digit = 0
pin = f"{i:0>3}"
# pin = list(str(i).zfill(3))
k = pin[current_digit]
for num in s:
# 見つけると桁を右に一つずらす
if num == k:
current_digit += 1
# indexが3... | def sumitrust2019_d():
n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
# 確認するpinの数字の組み合わせと桁の初期化
# pin = list(str(i).zfill(3))
current_digit = 0
pin = f"{i:0>3}"
search_num = pin[current_digit]
for num in s:
# 見つけると桁を右に一つず... | false | 21.875 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-ans = 0",
"-for i in range(1000):",
"- # 確認するpinの数字の組み合わせと桁の初期化",
"- current_digit = 0",
"- pin = f\"{i:0>3}\"",
"- # pin = list(str(i).zfill(3))",
"- k = pin[current_digit]",
"- for num in s:",
"- # 見つけると桁を右に一つずらす",
"... | false | 0.093061 | 0.097701 | 0.952505 | [
"s879042642",
"s974830919"
] |
u270681687 | p03326 | python | s497701258 | s174674988 | 240 | 28 | 41,328 | 3,572 | Accepted | Accepted | 88.33 | n, m = list(map(int, input().split()))
x = []
y = []
z = []
for i in range(n):
X, Y, Z = list(map(int, input().split()))
x.append(X)
y.append(Y)
z.append(Z)
sign = [1, -1]
ans = []
for j in sign:
for k in sign:
for l in sign:
a = []
for i in r... | n, m = list(map(int, input().split()))
cake = [list(map(int, input().split())) for i in range(n)]
box = [[[[] for i in range(2)] for j in range(2)] for k in range(2)]
ans = 0
for i in range(2):
for j in range(2):
for k in range(2):
worth = 0
for x, y, z in cake:
... | 25 | 22 | 462 | 626 | n, m = list(map(int, input().split()))
x = []
y = []
z = []
for i in range(n):
X, Y, Z = list(map(int, input().split()))
x.append(X)
y.append(Y)
z.append(Z)
sign = [1, -1]
ans = []
for j in sign:
for k in sign:
for l in sign:
a = []
for i in range(n):
... | n, m = list(map(int, input().split()))
cake = [list(map(int, input().split())) for i in range(n)]
box = [[[[] for i in range(2)] for j in range(2)] for k in range(2)]
ans = 0
for i in range(2):
for j in range(2):
for k in range(2):
worth = 0
for x, y, z in cake:
if i ... | false | 12 | [
"-x = []",
"-y = []",
"-z = []",
"-for i in range(n):",
"- X, Y, Z = list(map(int, input().split()))",
"- x.append(X)",
"- y.append(Y)",
"- z.append(Z)",
"-sign = [1, -1]",
"-ans = []",
"-for j in sign:",
"- for k in sign:",
"- for l in sign:",
"- a = []",
... | false | 0.03534 | 0.089531 | 0.394718 | [
"s497701258",
"s174674988"
] |
u644907318 | p03139 | python | s701328755 | s591274570 | 68 | 27 | 61,480 | 9,064 | Accepted | Accepted | 60.29 | N,A,B = list(map(int,input().split()))
print((min(A,B),max(0,A+B-N))) | N,A,B = list(map(int,input().split()))
print((min(A,B),max(A+B-N,0))) | 2 | 2 | 62 | 62 | N, A, B = list(map(int, input().split()))
print((min(A, B), max(0, A + B - N)))
| N, A, B = list(map(int, input().split()))
print((min(A, B), max(A + B - N, 0)))
| false | 0 | [
"-print((min(A, B), max(0, A + B - N)))",
"+print((min(A, B), max(A + B - N, 0)))"
] | false | 0.037619 | 0.067014 | 0.561355 | [
"s701328755",
"s591274570"
] |
u597374218 | p02860 | python | s112776801 | s580952304 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | N=int(eval(input()))
S=eval(input())
print(("Yes" if N%2==0 and S[:N//2]==S[N//2:] else "No")) | N=int(eval(input()))
S=eval(input())
print(("Yes" if S[:N//2]==S[N//2:] else "No")) | 3 | 3 | 82 | 71 | N = int(eval(input()))
S = eval(input())
print(("Yes" if N % 2 == 0 and S[: N // 2] == S[N // 2 :] else "No"))
| N = int(eval(input()))
S = eval(input())
print(("Yes" if S[: N // 2] == S[N // 2 :] else "No"))
| false | 0 | [
"-print((\"Yes\" if N % 2 == 0 and S[: N // 2] == S[N // 2 :] else \"No\"))",
"+print((\"Yes\" if S[: N // 2] == S[N // 2 :] else \"No\"))"
] | false | 0.04387 | 0.038831 | 1.12977 | [
"s112776801",
"s580952304"
] |
u880128069 | p02712 | python | s632716543 | s864004420 | 227 | 201 | 33,616 | 9,128 | Accepted | Accepted | 11.45 | N = int(eval(input()))
a = [0] * N
for i in range(1,N+1):
if i%3 == 0 and i%5 == 0:
pass
elif i%3 == 0:
pass
elif i%5 == 0:
pass
else:
a[i-1] = i
print((sum(a))) | N = int(eval(input()))
ans = 0
for i in range(1,N+1):
if i%3==0 and i%5==0:
pass
elif i%3==0:
pass
elif i%5==0:
pass
else:
ans += i
print(ans)
| 15 | 15 | 218 | 179 | N = int(eval(input()))
a = [0] * N
for i in range(1, N + 1):
if i % 3 == 0 and i % 5 == 0:
pass
elif i % 3 == 0:
pass
elif i % 5 == 0:
pass
else:
a[i - 1] = i
print((sum(a)))
| N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
if i % 3 == 0 and i % 5 == 0:
pass
elif i % 3 == 0:
pass
elif i % 5 == 0:
pass
else:
ans += i
print(ans)
| false | 0 | [
"-a = [0] * N",
"+ans = 0",
"- a[i - 1] = i",
"-print((sum(a)))",
"+ ans += i",
"+print(ans)"
] | false | 0.352745 | 0.174504 | 2.021411 | [
"s632716543",
"s864004420"
] |
u285891772 | p03031 | python | s002169644 | s902580530 | 66 | 50 | 5,204 | 5,204 | Accepted | Accepted | 24.24 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | 45 | 43 | 1,278 | 1,207 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 4.444444 | [
"- for j in range(M):",
"- cnt_sk = 0",
"- for k in range(ks[j][0]):",
"- # print(k, ks[j][k+1])",
"- # print(i[ks[j][k+1]-1] == \"1\")",
"- if i[ks[j][k + 1] - 1] == \"1\":",
"- cnt_sk += 1",
"- # print(cnt_sk)",
"- if c... | false | 0.036851 | 0.037776 | 0.975502 | [
"s002169644",
"s902580530"
] |
u029000441 | p02802 | python | s527903323 | s195999790 | 373 | 264 | 15,700 | 31,884 | Accepted | Accepted | 29.22 | import sys
nm=input().rstrip().split(" ")
n=int(nm[0])
m=int(nm[1])
answers=[[] for i in range(n)]
for i in range(m):
line=input().rstrip().split(" ")
if line[1]=="AC":
answers[int(line[0])-1].append(1)
if line[1]=="WA":
answers[int(line[0])-1].append(0)
#print(answers)
ac=0
i=0... | N,M=list(map(int,input().split()))
L=[list(input().split()) for i in range(M)]
W=[0]*N
A=[0]*N
a=0
w=0
for i in range(M):
if L[i][1]=="AC":
A[int(L[i][0])-1]=1
elif L[i][1]=="WA" and A[int(L[i][0])-1]==0:
W[int(L[i][0])-1]+=1
#for i in A:
#a+=i
#for i in W:
#w+=i
for i in range(N):... | 32 | 22 | 634 | 366 | import sys
nm = input().rstrip().split(" ")
n = int(nm[0])
m = int(nm[1])
answers = [[] for i in range(n)]
for i in range(m):
line = input().rstrip().split(" ")
if line[1] == "AC":
answers[int(line[0]) - 1].append(1)
if line[1] == "WA":
answers[int(line[0]) - 1].append(0)
# print(answers)
a... | N, M = list(map(int, input().split()))
L = [list(input().split()) for i in range(M)]
W = [0] * N
A = [0] * N
a = 0
w = 0
for i in range(M):
if L[i][1] == "AC":
A[int(L[i][0]) - 1] = 1
elif L[i][1] == "WA" and A[int(L[i][0]) - 1] == 0:
W[int(L[i][0]) - 1] += 1
# for i in A:
# a+=i
# for i in W:
#... | false | 31.25 | [
"-import sys",
"-",
"-nm = input().rstrip().split(\" \")",
"-n = int(nm[0])",
"-m = int(nm[1])",
"-answers = [[] for i in range(n)]",
"-for i in range(m):",
"- line = input().rstrip().split(\" \")",
"- if line[1] == \"AC\":",
"- answers[int(line[0]) - 1].append(1)",
"- if line[1]... | false | 0.04234 | 0.037475 | 1.129831 | [
"s527903323",
"s195999790"
] |
u489959379 | p03673 | python | s989945202 | s023761498 | 229 | 161 | 25,536 | 27,588 | Accepted | Accepted | 29.69 | from collections import deque
n = int(eval(input()))
A = list(map(int, input().split()))
B = deque()
for i in range(n):
if i % 2 == 0:
B.append(A[i])
else:
B.appendleft(A[i])
if n % 2 == 0:
print((*B))
else:
B = list(B)
print((*(B[::-1]))) | import sys
# import numpy as np
from collections import Counter, deque
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(eval(input()))
A = deque(list(map(int, input().split())))
B = deque([])
if n % 2 == 0:
for i in range(n):
... | 16 | 33 | 282 | 713 | from collections import deque
n = int(eval(input()))
A = list(map(int, input().split()))
B = deque()
for i in range(n):
if i % 2 == 0:
B.append(A[i])
else:
B.appendleft(A[i])
if n % 2 == 0:
print((*B))
else:
B = list(B)
print((*(B[::-1])))
| import sys
# import numpy as np
from collections import Counter, deque
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n = int(eval(input()))
A = deque(list(map(int, input().split())))
B = deque([])
if n % 2 == 0:
for i in range(n):
a = deque.popl... | false | 51.515152 | [
"-from collections import deque",
"+import sys",
"-n = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-B = deque()",
"-for i in range(n):",
"- if i % 2 == 0:",
"- B.append(A[i])",
"+# import numpy as np",
"+from collections import Counter, deque",
"+",
"+sys.setrecursi... | false | 0.080122 | 0.042868 | 1.869016 | [
"s989945202",
"s023761498"
] |
u130900604 | p03107 | python | s234788999 | s721654913 | 26 | 20 | 3,956 | 3,956 | Accepted | Accepted | 23.08 | def main():
msg=list(eval(input()))
a,b=0,0
for _ in msg:
if _ == "0":
a+=1
else:
b+=1
ans=2*min(a,b)
print(ans)
main() | def main():
msg=list(eval(input()))
a=msg.count("1")
b=len(msg)-a
print((2*min(a,b)))
main() | 11 | 6 | 157 | 97 | def main():
msg = list(eval(input()))
a, b = 0, 0
for _ in msg:
if _ == "0":
a += 1
else:
b += 1
ans = 2 * min(a, b)
print(ans)
main()
| def main():
msg = list(eval(input()))
a = msg.count("1")
b = len(msg) - a
print((2 * min(a, b)))
main()
| false | 45.454545 | [
"- a, b = 0, 0",
"- for _ in msg:",
"- if _ == \"0\":",
"- a += 1",
"- else:",
"- b += 1",
"- ans = 2 * min(a, b)",
"- print(ans)",
"+ a = msg.count(\"1\")",
"+ b = len(msg) - a",
"+ print((2 * min(a, b)))"
] | false | 0.037917 | 0.043003 | 0.881712 | [
"s234788999",
"s721654913"
] |
u146816547 | p01102 | python | s206477205 | s736370247 | 10 | 0 | 4,648 | 4,652 | Accepted | Accepted | 100 | while True:
s1 = input()
if s1 == '.':
break
s2 = input()
s1 = s1.split('"')
s2 = s2.split('"')
if s1 == s2:
print("IDENTICAL")
elif len(s1) != len(s2):
print("DIFFERENT")
else:
cnt = 0
for i in range(len(s1)):
... | def solve(s, t):
s = s.split('"')
t = t.split('"')
if s == t:
return "IDENTICAL"
if len(s) == len(t):
cnt = 0
for i in range(len(s)):
if s[i] != t[i] and i % 2 == 1:
cnt += 1
elif s[i] != t[i]:
cnt += 2
... | 26 | 28 | 504 | 507 | while True:
s1 = input()
if s1 == ".":
break
s2 = input()
s1 = s1.split('"')
s2 = s2.split('"')
if s1 == s2:
print("IDENTICAL")
elif len(s1) != len(s2):
print("DIFFERENT")
else:
cnt = 0
for i in range(len(s1)):
if s1[i] != s2[i] and i %... | def solve(s, t):
s = s.split('"')
t = t.split('"')
if s == t:
return "IDENTICAL"
if len(s) == len(t):
cnt = 0
for i in range(len(s)):
if s[i] != t[i] and i % 2 == 1:
cnt += 1
elif s[i] != t[i]:
cnt += 2
if cnt == 1:
... | false | 7.142857 | [
"+def solve(s, t):",
"+ s = s.split('\"')",
"+ t = t.split('\"')",
"+ if s == t:",
"+ return \"IDENTICAL\"",
"+ if len(s) == len(t):",
"+ cnt = 0",
"+ for i in range(len(s)):",
"+ if s[i] != t[i] and i % 2 == 1:",
"+ cnt += 1",
"+ ... | false | 0.061851 | 0.061316 | 1.008714 | [
"s206477205",
"s736370247"
] |
u146803137 | p03030 | python | s218954433 | s182934804 | 26 | 24 | 9,180 | 9,032 | Accepted | Accepted | 7.69 | n = int(eval(input()))
d = {}
for i in range(n):
s ,p = input().split()
p = int(p)
if not(s in d):
d[s] = {}
d[s][p*-1] = i+1
for i in sorted(d.keys()):
for j in sorted(d[i].keys()):
print((d[i][j]))
| n = int(eval(input()))
s = []
p = [0] * 101
d = {}
for i in range(n):
a,b = input().split()
b = int(b)
s.append(a)
p[b] = i+1
if a in list(d.keys()):
d[a].append(b)
continue
d[a] = [b]
s = sorted(set(s))
for i in s:
c = sorted(d[i],reverse=True)
for j in c... | 11 | 18 | 238 | 337 | n = int(eval(input()))
d = {}
for i in range(n):
s, p = input().split()
p = int(p)
if not (s in d):
d[s] = {}
d[s][p * -1] = i + 1
for i in sorted(d.keys()):
for j in sorted(d[i].keys()):
print((d[i][j]))
| n = int(eval(input()))
s = []
p = [0] * 101
d = {}
for i in range(n):
a, b = input().split()
b = int(b)
s.append(a)
p[b] = i + 1
if a in list(d.keys()):
d[a].append(b)
continue
d[a] = [b]
s = sorted(set(s))
for i in s:
c = sorted(d[i], reverse=True)
for j in c:
pr... | false | 38.888889 | [
"+s = []",
"+p = [0] * 101",
"- s, p = input().split()",
"- p = int(p)",
"- if not (s in d):",
"- d[s] = {}",
"- d[s][p * -1] = i + 1",
"-for i in sorted(d.keys()):",
"- for j in sorted(d[i].keys()):",
"- print((d[i][j]))",
"+ a, b = input().split()",
"+ b = ... | false | 0.038479 | 0.03971 | 0.969023 | [
"s218954433",
"s182934804"
] |
u550835660 | p02756 | python | s458416643 | s525122655 | 1,439 | 1,302 | 40,656 | 41,712 | Accepted | Accepted | 9.52 | s = eval(input())
q = int(eval(input()))
qs = [input().split() for i in range(q)]
n = False
left= right = ""
for operation in qs:
if operation[0] == '1':
n = not n
if operation[0] == '2':
t , f, c = operation
f = int(f)
if n:
f = 1 if f != 1 else 2
... | s = eval(input())
q = int(eval(input()))
qs = [input().split() for i in range(q)]
n = False
left= right = ""
for operation in qs:
if operation[0] == '1':
n = not n
if operation[0] == '2':
t , f, c = operation
if n:
f = '1' if f != '1' else '2'
if f == '1':... | 19 | 18 | 435 | 425 | s = eval(input())
q = int(eval(input()))
qs = [input().split() for i in range(q)]
n = False
left = right = ""
for operation in qs:
if operation[0] == "1":
n = not n
if operation[0] == "2":
t, f, c = operation
f = int(f)
if n:
f = 1 if f != 1 else 2
if f == 1:
... | s = eval(input())
q = int(eval(input()))
qs = [input().split() for i in range(q)]
n = False
left = right = ""
for operation in qs:
if operation[0] == "1":
n = not n
if operation[0] == "2":
t, f, c = operation
if n:
f = "1" if f != "1" else "2"
if f == "1":
... | false | 5.263158 | [
"- f = int(f)",
"- f = 1 if f != 1 else 2",
"- if f == 1:",
"+ f = \"1\" if f != \"1\" else \"2\"",
"+ if f == \"1\":",
"- elif f == 2:",
"+ elif f == \"2\":"
] | false | 0.038687 | 0.038951 | 0.993247 | [
"s458416643",
"s525122655"
] |
u506127000 | p03912 | python | s753098004 | s310353490 | 323 | 283 | 54,380 | 54,252 | Accepted | Accepted | 12.38 | MAX_X = 10 ** 5 + 100
def main():
N, M = [int(i) for i in input().split()]
X = [0] * (MAX_X + 1)
for i in map(int, input().split()):
X[i] += 1
Y = [sum(X[i::M]) for i in range(min(M, MAX_X))]
# Mの倍数
ans = Y[0] // 2
Y[0] = 0
# M%2==0のM/2
if M % 2 == 0:
... | MAX_X = 10 ** 5 + 100
def main():
N, M = [int(i) for i in input().split()]
X = [0] * (MAX_X + 1)
for i in map(int, input().split()):
X[i] += 1
Y = [sum(X[i::M]) for i in range(min(M, MAX_X))]
# Mの倍数
ans = Y[0] // 2
Y[0] = 0
# M%2==0のM/2
try:
if M % 2... | 35 | 35 | 838 | 846 | MAX_X = 10**5 + 100
def main():
N, M = [int(i) for i in input().split()]
X = [0] * (MAX_X + 1)
for i in map(int, input().split()):
X[i] += 1
Y = [sum(X[i::M]) for i in range(min(M, MAX_X))]
# Mの倍数
ans = Y[0] // 2
Y[0] = 0
# M%2==0のM/2
if M % 2 == 0:
ans += Y[M // 2]... | MAX_X = 10**5 + 100
def main():
N, M = [int(i) for i in input().split()]
X = [0] * (MAX_X + 1)
for i in map(int, input().split()):
X[i] += 1
Y = [sum(X[i::M]) for i in range(min(M, MAX_X))]
# Mの倍数
ans = Y[0] // 2
Y[0] = 0
# M%2==0のM/2
try:
if M % 2 == 0:
... | false | 0 | [
"- if M % 2 == 0:",
"- ans += Y[M // 2] // 2",
"- Y[M // 2] = 0",
"- for i in range(1, M // 2 + 1):",
"- j = M - i",
"- tmp = min(Y[i], Y[j])",
"- ans += tmp",
"- Y[i] -= tmp",
"- Y[j] -= tmp",
"- for i, n in enumerate(X):",
"- ... | false | 0.052115 | 0.060482 | 0.861665 | [
"s753098004",
"s310353490"
] |
u747602774 | p02662 | python | s778272470 | s685696304 | 273 | 168 | 147,108 | 132,284 | Accepted | Accepted | 38.46 | N,S = list(map(int,input().split()))
A = list(map(int,input().split()))
dp = [[0 for j in range(S+2)] for i in range(N+1)]
dp[0][0] = 1
mod = 998244353
for i,a in enumerate(A):
for j in range(S+1):
if j-a >= 0:
dp[i+1][j] = (dp[i][j]*2+dp[i][j-a])%mod
else:
dp[i+1][... | N,S = list(map(int,input().split()))
A = list(map(int,input().split()))
dp = [[0]*(S+2) for i in range(N+1)]
dp[0][0] = 1
mod = 998244353
for i,a in enumerate(A):
for j in range(S+1):
if j-a >= 0:
dp[i+1][j] = (dp[i][j]*2+dp[i][j-a])%mod
else:
dp[i+1][j] = dp[i][j]*... | 13 | 12 | 353 | 337 | N, S = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [[0 for j in range(S + 2)] for i in range(N + 1)]
dp[0][0] = 1
mod = 998244353
for i, a in enumerate(A):
for j in range(S + 1):
if j - a >= 0:
dp[i + 1][j] = (dp[i][j] * 2 + dp[i][j - a]) % mod
else:
... | N, S = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [[0] * (S + 2) for i in range(N + 1)]
dp[0][0] = 1
mod = 998244353
for i, a in enumerate(A):
for j in range(S + 1):
if j - a >= 0:
dp[i + 1][j] = (dp[i][j] * 2 + dp[i][j - a]) % mod
else:
dp[i + 1... | false | 7.692308 | [
"-dp = [[0 for j in range(S + 2)] for i in range(N + 1)]",
"+dp = [[0] * (S + 2) for i in range(N + 1)]"
] | false | 0.088669 | 0.038468 | 2.305015 | [
"s778272470",
"s685696304"
] |
u764860452 | p02837 | python | s971866943 | s640707950 | 153 | 91 | 3,188 | 3,064 | Accepted | Accepted | 40.52 | def main():
N = int(eval(input()))
testimony = [[] for _ in range(N)]
for i in range(N):
num = int(eval(input()))
for j in range(num):
person, state = list(map(int, input().split()))
testimony[i].append([person-1, state])
honest... | from itertools import product
N=int(eval(input()))
data=[]
for i in range(N):
for j in range(int(eval(input()))):
x,y=list(map(int,input().split()))
data.append((i,x-1,y))
#print(data)
ans=0
for i in product([1,0],repeat=N):
#print(i)
s=True
for k in data:
if i[k[0... | 25 | 20 | 771 | 419 | def main():
N = int(eval(input()))
testimony = [[] for _ in range(N)]
for i in range(N):
num = int(eval(input()))
for j in range(num):
person, state = list(map(int, input().split()))
testimony[i].append([person - 1, state])
honest = 0
for i in range(1, 2**N):
... | from itertools import product
N = int(eval(input()))
data = []
for i in range(N):
for j in range(int(eval(input()))):
x, y = list(map(int, input().split()))
data.append((i, x - 1, y))
# print(data)
ans = 0
for i in product([1, 0], repeat=N):
# print(i)
s = True
for k in data:
if... | false | 20 | [
"-def main():",
"- N = int(eval(input()))",
"- testimony = [[] for _ in range(N)]",
"- for i in range(N):",
"- num = int(eval(input()))",
"- for j in range(num):",
"- person, state = list(map(int, input().split()))",
"- testimony[i].append([person - 1, stat... | false | 0.037458 | 0.046175 | 0.811212 | [
"s971866943",
"s640707950"
] |
u190405389 | p03450 | python | s373437895 | s690625579 | 1,393 | 400 | 106,144 | 84,736 | Accepted | Accepted | 71.28 | n,m = list(map(int, input().split()))
dist = [[] for i in range(n)]
for i in range(m):
l,r,d = list(map(int,input().split()))
l-=1
r-=1
dist[l].append([r,d])
dist[r].append([l,-d])
position = [10**10]*n
for i in range(n):
if position[i]==10**10:
stack = [i]
po... | import sys
sys.setrecursionlimit(10**7)
readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print(('\n'.join(m... | 32 | 80 | 687 | 1,976 | n, m = list(map(int, input().split()))
dist = [[] for i in range(n)]
for i in range(m):
l, r, d = list(map(int, input().split()))
l -= 1
r -= 1
dist[l].append([r, d])
dist[r].append([l, -d])
position = [10**10] * n
for i in range(n):
if position[i] == 10**10:
stack = [i]
position... | import sys
sys.setrecursionlimit(10**7)
readline = sys.stdin.buffer.readline
def readstr():
return readline().rstrip().decode()
def readstrs():
return list(readline().decode().split())
def readint():
return int(readline())
def readints():
return list(map(int, readline().split()))
def printrow... | false | 60 | [
"-n, m = list(map(int, input().split()))",
"-dist = [[] for i in range(n)]",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+readline = sys.stdin.buffer.readline",
"+",
"+",
"+def readstr():",
"+ return readline().rstrip().decode()",
"+",
"+",
"+def readstrs():",
"+ return lis... | false | 0.054321 | 0.042785 | 1.269632 | [
"s373437895",
"s690625579"
] |
u906501980 | p02762 | python | s697887373 | s491247023 | 1,526 | 920 | 140,596 | 25,136 | Accepted | Accepted | 39.71 | import sys
input = sys.stdin.buffer.readline
class UnionFind:
__slots__ = ["data"]
def __init__(self, n=0):
self.data = [-1]*(n+1)
def root(self, x):
if self.data[x] < 0:
return x
self.data[x] = self.root(self.data[x])
return self.data[x]
... | import sys
input = sys.stdin.buffer.readline
class UnionFind:
__slots__ = ["data"]
def __init__(self, n=0):
self.data = [-1]*(n+1)
def root(self, x):
if self.data[x] < 0:
return x
self.data[x] = self.root(self.data[x])
return self.data[x]
... | 57 | 57 | 1,466 | 1,436 | import sys
input = sys.stdin.buffer.readline
class UnionFind:
__slots__ = ["data"]
def __init__(self, n=0):
self.data = [-1] * (n + 1)
def root(self, x):
if self.data[x] < 0:
return x
self.data[x] = self.root(self.data[x])
return self.data[x]
def unite(s... | import sys
input = sys.stdin.buffer.readline
class UnionFind:
__slots__ = ["data"]
def __init__(self, n=0):
self.data = [-1] * (n + 1)
def root(self, x):
if self.data[x] < 0:
return x
self.data[x] = self.root(self.data[x])
return self.data[x]
def unite(s... | false | 0 | [
"- friends = [[] for _ in range(n + 1)]",
"+ friends = [0] * (n + 1)",
"- friends[a].append(b)",
"- friends[b].append(a)",
"+ friends[a] += 1",
"+ friends[b] += 1",
"- nf = len(friends[i])",
"+ nf = friends[i]"
] | false | 0.177213 | 0.042954 | 4.125693 | [
"s697887373",
"s491247023"
] |
u875291233 | p02684 | python | s314374961 | s600803163 | 452 | 133 | 183,328 | 93,600 | Accepted | Accepted | 70.58 | # coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline
n,k,*a = list(map(int,read().split()))
for i in range(n): a[i] -= 1
def pow2(a,n):
if n==0: return list(range(n))
if n==1: return a
if n%2:
return mul(a,pow2(a,n-1))
else:
x... | # coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline
n,k,*a = list(map(int,read().split()))
for i in range(n): a[i] -= 1
na = [0]*n
v = 0
while k:
if k&1: v = a[v]
for j, aj in enumerate(a):
na[j] = a[aj]
a,na = na,a
i += 1
... | 23 | 20 | 441 | 341 | # coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline
n, k, *a = list(map(int, read().split()))
for i in range(n):
a[i] -= 1
def pow2(a, n):
if n == 0:
return list(range(n))
if n == 1:
return a
if n % 2:
return mul(a, pow2(a, n - 1))
... | # coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline
n, k, *a = list(map(int, read().split()))
for i in range(n):
a[i] -= 1
na = [0] * n
v = 0
while k:
if k & 1:
v = a[v]
for j, aj in enumerate(a):
na[j] = a[aj]
a, na = na, a
i += 1
k ... | false | 13.043478 | [
"-",
"-",
"-def pow2(a, n):",
"- if n == 0:",
"- return list(range(n))",
"- if n == 1:",
"- return a",
"- if n % 2:",
"- return mul(a, pow2(a, n - 1))",
"- else:",
"- x = pow2(a, n // 2)",
"- return mul(x, x)",
"-",
"-",
"-def mul(a, b):",
... | false | 0.077411 | 0.036932 | 2.096062 | [
"s314374961",
"s600803163"
] |
u703950586 | p03044 | python | s658355498 | s931935774 | 930 | 556 | 160,428 | 80,392 | Accepted | Accepted | 40.22 | import sys,queue,math,copy,itertools,bisect,collections
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N = NI()
edge = [[] for _ in ra... | import sys,queue,math,copy,itertools,bisect,collections
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N = NI()
edge = [[] for _ in range(N+1)]
color = [-1] * (N+1)
for _ in range(N-1):
u,v,w = LI()
edge[u].append((v,w... | 23 | 20 | 627 | 531 | import sys, queue, math, copy, itertools, bisect, collections
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
_LI = lambda: [int(x) - 1 for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())
N = NI()
edge = [[] for _ in range(... | import sys, queue, math, copy, itertools, bisect, collections
sys.setrecursionlimit(10**7)
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())
N = NI()
edge = [[] for _ in range(N + 1)]
color = [-1] * (N + 1)
for _ in range(N - 1):
u, v, w = LI()
edge[u].append((v... | false | 13.043478 | [
"-INF = 10**18",
"-MOD = 10**9 + 7",
"-_LI = lambda: [int(x) - 1 for x in sys.stdin.readline().split()]"
] | false | 0.096767 | 0.038229 | 2.53123 | [
"s658355498",
"s931935774"
] |
u868701750 | p03835 | python | s437737161 | s590094664 | 1,985 | 1,225 | 2,940 | 2,940 | Accepted | Accepted | 38.29 | # -*- coding: utf-8 -*-
K, S = list(map(int, input().split()))
count = 0
for x in range(0, K+1):
for y in range(0, K+1):
z = S - x - y
if z < 0 or z > K:
continue
if x + y + z == S:
count += 1
print(count)
| K, S = list(map(int, input().split()))
c = 0
for x in range(K+1):
for y in range(K+1):
if 0 <= (S-x-y) <= K:
c += 1
print(c)
| 14 | 7 | 268 | 149 | # -*- coding: utf-8 -*-
K, S = list(map(int, input().split()))
count = 0
for x in range(0, K + 1):
for y in range(0, K + 1):
z = S - x - y
if z < 0 or z > K:
continue
if x + y + z == S:
count += 1
print(count)
| K, S = list(map(int, input().split()))
c = 0
for x in range(K + 1):
for y in range(K + 1):
if 0 <= (S - x - y) <= K:
c += 1
print(c)
| false | 50 | [
"-# -*- coding: utf-8 -*-",
"-count = 0",
"-for x in range(0, K + 1):",
"- for y in range(0, K + 1):",
"- z = S - x - y",
"- if z < 0 or z > K:",
"- continue",
"- if x + y + z == S:",
"- count += 1",
"-print(count)",
"+c = 0",
"+for x in range(K + ... | false | 0.044543 | 0.037473 | 1.188648 | [
"s437737161",
"s590094664"
] |
u530606147 | p02640 | python | s208226797 | s502942850 | 23 | 21 | 9,156 | 9,128 | Accepted | Accepted | 8.7 | x, y = list(map(int, input().split()))
for i in range(x + 1):
if 2 * i + 4 * (x - i) == y:
print('Yes')
exit()
print('No')
| x, y = list(map(int, input().split()))
a2 = 4 * x - y
if a2 % 2 == 0 and 0 <= a2 // 2 <= x:
print('Yes')
else:
print('No')
| 8 | 7 | 142 | 134 | x, y = list(map(int, input().split()))
for i in range(x + 1):
if 2 * i + 4 * (x - i) == y:
print("Yes")
exit()
print("No")
| x, y = list(map(int, input().split()))
a2 = 4 * x - y
if a2 % 2 == 0 and 0 <= a2 // 2 <= x:
print("Yes")
else:
print("No")
| false | 12.5 | [
"-for i in range(x + 1):",
"- if 2 * i + 4 * (x - i) == y:",
"- print(\"Yes\")",
"- exit()",
"-print(\"No\")",
"+a2 = 4 * x - y",
"+if a2 % 2 == 0 and 0 <= a2 // 2 <= x:",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.116044 | 0.116052 | 0.999932 | [
"s208226797",
"s502942850"
] |
u826929627 | p03361 | python | s583418279 | s980131392 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | """考え方
上下左右のいずれか隣接するマスが黒である必要がある。
つまり黒マスが1つだけポツンと存在した場合はNGとなる。
横チェック、縦チェック、の2つに分断して確認を行う。
"""
H,W = list(map(int,input().split()))
list_matu = []
for h in range(H):
list_matu.append(list(eval(input())))
## 横チェック
ng_matu=[]
for h in range(H): ## 全レコードが対象
for w in range(1,W-1): ## 列ごとに実施
... | H,W = list(map(int , input().split() ))
"""考え方
普通に全探索して問題あるか無いかを確認して行く。
1行目、H行目、1列目、W列目だけは少し注意!!!
→0行目、H+1行目、0列目、W+1列目を追加する
"""
list_ = []
list_.append(['.' for i in range(W+2)])
for h in range(H):
list_.append(list('.'+eval(input())+'.'))
list_.append(['.' for i in range(W+2)])
ans = 'Yes'
for h in... | 43 | 27 | 863 | 620 | """考え方
上下左右のいずれか隣接するマスが黒である必要がある。
つまり黒マスが1つだけポツンと存在した場合はNGとなる。
横チェック、縦チェック、の2つに分断して確認を行う。
"""
H, W = list(map(int, input().split()))
list_matu = []
for h in range(H):
list_matu.append(list(eval(input())))
## 横チェック
ng_matu = []
for h in range(H): ## 全レコードが対象
for w in range(1, W - 1): ## 列ごとに実施
target =... | H, W = list(map(int, input().split()))
"""考え方
普通に全探索して問題あるか無いかを確認して行く。
1行目、H行目、1列目、W列目だけは少し注意!!!
→0行目、H+1行目、0列目、W+1列目を追加する
"""
list_ = []
list_.append(["." for i in range(W + 2)])
for h in range(H):
list_.append(list("." + eval(input()) + "."))
list_.append(["." for i in range(W + 2)])
ans = "Yes"
for h in range(H)... | false | 37.209302 | [
"+H, W = list(map(int, input().split()))",
"-上下左右のいずれか隣接するマスが黒である必要がある。",
"-つまり黒マスが1つだけポツンと存在した場合はNGとなる。",
"-横チェック、縦チェック、の2つに分断して確認を行う。",
"+普通に全探索して問題あるか無いかを確認して行く。",
"+1行目、H行目、1列目、W列目だけは少し注意!!!",
"+→0行目、H+1行目、0列目、W+1列目を追加する",
"-H, W = list(map(int, input().split()))",
"-list_matu = []",
"+list_ =... | false | 0.036165 | 0.036807 | 0.982551 | [
"s583418279",
"s980131392"
] |
u408260374 | p01545 | python | s811511311 | s226587317 | 4,020 | 1,440 | 27,952 | 27,748 | Accepted | Accepted | 64.18 | import math
class SegmentTree:
"""
Segment Tree
query:
1. update(i, val): update i-th value to val
2. query(low, high): find f(value) in [low, high)
time complexity: O(log n)
space complexity: O(2n)
"""
def __init__(self, N, f, default):
self.N = 1 << math.ceil... | import math
class FenwickTree:
def __init__(self, a_list, f, default):
# 0-indexed
self.N = len(a_list)
self.bit = a_list[:]
self.f = f
self.default = default
for _ in range(self.N, 1 << (math.ceil(math.log(self.N, 2)))):
self.bit.append(self.... | 45 | 35 | 1,368 | 1,012 | import math
class SegmentTree:
"""
Segment Tree
query:
1. update(i, val): update i-th value to val
2. query(low, high): find f(value) in [low, high)
time complexity: O(log n)
space complexity: O(2n)
"""
def __init__(self, N, f, default):
self.N = 1 << math.ceil(math.log(N,... | import math
class FenwickTree:
def __init__(self, a_list, f, default):
# 0-indexed
self.N = len(a_list)
self.bit = a_list[:]
self.f = f
self.default = default
for _ in range(self.N, 1 << (math.ceil(math.log(self.N, 2)))):
self.bit.append(self.default)
... | false | 22.222222 | [
"-class SegmentTree:",
"- \"\"\"",
"- Segment Tree",
"- query:",
"- 1. update(i, val): update i-th value to val",
"- 2. query(low, high): find f(value) in [low, high)",
"- time complexity: O(log n)",
"- space complexity: O(2n)",
"- \"\"\"",
"-",
"- def __init__(self, N... | false | 0.100297 | 0.157751 | 0.635794 | [
"s811511311",
"s226587317"
] |
u014333473 | p04030 | python | s422006828 | s839314832 | 30 | 25 | 9,032 | 9,000 | Accepted | Accepted | 16.67 | s=eval(input())
result = []
for i in s:
if i=='0':
result.append('0')
elif i=='1':
result.append('1')
elif i=='B':
if not result:
continue
result.pop()
print((''.join(result))) | n=[]
for i in input():
if i=='B':
if n: n.pop()
else:
n.append(i)
print(*n,sep='')
| 12 | 7 | 207 | 100 | s = eval(input())
result = []
for i in s:
if i == "0":
result.append("0")
elif i == "1":
result.append("1")
elif i == "B":
if not result:
continue
result.pop()
print(("".join(result)))
| n = []
for i in input():
if i == "B":
if n:
n.pop()
else:
n.append(i)
print(*n, sep="")
| false | 41.666667 | [
"-s = eval(input())",
"-result = []",
"-for i in s:",
"- if i == \"0\":",
"- result.append(\"0\")",
"- elif i == \"1\":",
"- result.append(\"1\")",
"- elif i == \"B\":",
"- if not result:",
"- continue",
"- result.pop()",
"-print((\"\".join(resul... | false | 0.188795 | 0.043726 | 4.317708 | [
"s422006828",
"s839314832"
] |
u811434779 | p00430 | python | s318076323 | s800821733 | 130 | 100 | 6,468 | 6,272 | Accepted | Accepted | 23.08 | l = [0 for i in range(31)]
pos = goal = 0
def solve(cur,sum):
global pos, goal
if cur == goal:
print(" ".join(map(str,l[:pos])))
return
for i in range(sum,0,-1):
if cur + i <= goal:
l[pos] = i
pos += 1
solve(cur+i,i)
pos -= ... | l = [0]*31
pos = goal = 0
def solve(cur,sum):
global pos, goal
if cur == goal:
print(" ".join(map(str,l[:pos])))
return
for i in range(sum,0,-1):
if cur + i <= goal:
l[pos] = i
pos += 1
solve(cur+i,i)
pos -= 1
while True:
... | 17 | 17 | 404 | 390 | l = [0 for i in range(31)]
pos = goal = 0
def solve(cur, sum):
global pos, goal
if cur == goal:
print(" ".join(map(str, l[:pos])))
return
for i in range(sum, 0, -1):
if cur + i <= goal:
l[pos] = i
pos += 1
solve(cur + i, i)
pos -= 1
... | l = [0] * 31
pos = goal = 0
def solve(cur, sum):
global pos, goal
if cur == goal:
print(" ".join(map(str, l[:pos])))
return
for i in range(sum, 0, -1):
if cur + i <= goal:
l[pos] = i
pos += 1
solve(cur + i, i)
pos -= 1
while True:
... | false | 0 | [
"-l = [0 for i in range(31)]",
"+l = [0] * 31"
] | false | 0.043477 | 0.101092 | 0.430072 | [
"s318076323",
"s800821733"
] |
u141610915 | p03666 | python | s935006466 | s352766522 | 189 | 71 | 40,428 | 67,932 | Accepted | Accepted | 62.43 | import sys
input = sys.stdin.readline
N, A, B, C, D = list(map(int, input().split()))
for i in range(N - 1):
r = D * (N - i - 1) + A
l = C * (N - i - 1) + A
r -= C * i
l -= D * i
#print(l, r, i)
if B in range(l, r + 1):
print("YES")
exit(0)
print("NO") | import sys
input = sys.stdin.readline
N, A, B, C, D = list(map(int, input().split()))
for i in range(N - 1):
l = C * i + A - D * (N - i - 1)
r = D * i + A - C * (N - i - 1) + 1
if B in range(l, r):
print("YES")
break
else: print("NO") | 14 | 10 | 280 | 251 | import sys
input = sys.stdin.readline
N, A, B, C, D = list(map(int, input().split()))
for i in range(N - 1):
r = D * (N - i - 1) + A
l = C * (N - i - 1) + A
r -= C * i
l -= D * i
# print(l, r, i)
if B in range(l, r + 1):
print("YES")
exit(0)
print("NO")
| import sys
input = sys.stdin.readline
N, A, B, C, D = list(map(int, input().split()))
for i in range(N - 1):
l = C * i + A - D * (N - i - 1)
r = D * i + A - C * (N - i - 1) + 1
if B in range(l, r):
print("YES")
break
else:
print("NO")
| false | 28.571429 | [
"- r = D * (N - i - 1) + A",
"- l = C * (N - i - 1) + A",
"- r -= C * i",
"- l -= D * i",
"- # print(l, r, i)",
"- if B in range(l, r + 1):",
"+ l = C * i + A - D * (N - i - 1)",
"+ r = D * i + A - C * (N - i - 1) + 1",
"+ if B in range(l, r):",
"- exit(0)",
"-p... | false | 0.159013 | 0.152277 | 1.044235 | [
"s935006466",
"s352766522"
] |
u867848444 | p03545 | python | s110200065 | s365485318 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | l=list(map(int,eval(input())))
n=3
for i in range(2**n):
s = str(l[0])
sum_s = l[0]
for j in range(n):
#j桁目が1の時
if (i>>j)&1:
s+='+'+str(l[j+1])
sum_s+=l[j+1]
#j桁目が0の時
else:
s+='-'+str(l[j+1])
sum_s-=l[j+1]
... | l=list(map(int,eval(input())))
def dfs(i,s,sum):
if i==3:
if sum==7:
print((s+'=7'))
exit()
else:
dfs(i+1,s+'-'+str(l[i+1]),sum-l[i+1])
dfs(i+1,s+'+'+str(l[i+1]),sum+l[i+1])
return -1
dfs(0,str(l[0]),l[0]) | 19 | 13 | 365 | 271 | l = list(map(int, eval(input())))
n = 3
for i in range(2**n):
s = str(l[0])
sum_s = l[0]
for j in range(n):
# j桁目が1の時
if (i >> j) & 1:
s += "+" + str(l[j + 1])
sum_s += l[j + 1]
# j桁目が0の時
else:
s += "-" + str(l[j + 1])
sum_s -= ... | l = list(map(int, eval(input())))
def dfs(i, s, sum):
if i == 3:
if sum == 7:
print((s + "=7"))
exit()
else:
dfs(i + 1, s + "-" + str(l[i + 1]), sum - l[i + 1])
dfs(i + 1, s + "+" + str(l[i + 1]), sum + l[i + 1])
return -1
dfs(0, str(l[0]), l[0])
| false | 31.578947 | [
"-n = 3",
"-for i in range(2**n):",
"- s = str(l[0])",
"- sum_s = l[0]",
"- for j in range(n):",
"- # j桁目が1の時",
"- if (i >> j) & 1:",
"- s += \"+\" + str(l[j + 1])",
"- sum_s += l[j + 1]",
"- # j桁目が0の時",
"- else:",
"- s += \... | false | 0.039196 | 0.038378 | 1.021327 | [
"s110200065",
"s365485318"
] |
u620084012 | p03807 | python | s359250855 | s241531882 | 226 | 55 | 62,448 | 14,108 | Accepted | Accepted | 75.66 | N = int(eval(input()))
A = list(map(int,input().split()))
c = 0
for e in A:
if e%2 == 1:
c += 1
if c%2 == 1:
print("NO")
else:
print("YES")
| N = int(eval(input()))
A = list(map(int,input().split()))
t = 0
for e in A:
t += e%2
print(("YES" if t%2 == 0 else "NO"))
| 10 | 6 | 163 | 123 | N = int(eval(input()))
A = list(map(int, input().split()))
c = 0
for e in A:
if e % 2 == 1:
c += 1
if c % 2 == 1:
print("NO")
else:
print("YES")
| N = int(eval(input()))
A = list(map(int, input().split()))
t = 0
for e in A:
t += e % 2
print(("YES" if t % 2 == 0 else "NO"))
| false | 40 | [
"-c = 0",
"+t = 0",
"- if e % 2 == 1:",
"- c += 1",
"-if c % 2 == 1:",
"- print(\"NO\")",
"-else:",
"- print(\"YES\")",
"+ t += e % 2",
"+print((\"YES\" if t % 2 == 0 else \"NO\"))"
] | false | 0.038469 | 0.06787 | 0.566805 | [
"s359250855",
"s241531882"
] |
u780475861 | p03246 | python | s323517549 | s454148251 | 103 | 89 | 20,396 | 20,572 | Accepted | Accepted | 13.59 | from collections import Counter
def main():
n = int(eval(input()))
m = list(map(int, input().split()))
lst1, lst2 = list(zip(*list(zip(m, m))))
c1, c2 = sorted(list(Counter(lst1).items()), key=lambda x: x[1], reverse=1), sorted(list(Counter(lst2).items()), key=lambda x: x[1], reverse=1)
c1.append((0... | from collections import Counter
def main():
n, *lst = list(map(int, open(0).read().split()))
c1, c2 = sorted(list(Counter(lst[::2]).items()), key=lambda x: x[1], reverse=1), sorted(list(Counter(lst[1::2]).items()), key=lambda x: x[1], reverse=1)
c1.append((0, 0)), c2.append((0, 0))
if c1[0][0] != c2[0]... | 17 | 15 | 485 | 455 | from collections import Counter
def main():
n = int(eval(input()))
m = list(map(int, input().split()))
lst1, lst2 = list(zip(*list(zip(m, m))))
c1, c2 = sorted(list(Counter(lst1).items()), key=lambda x: x[1], reverse=1), sorted(
list(Counter(lst2).items()), key=lambda x: x[1], reverse=1
)
... | from collections import Counter
def main():
n, *lst = list(map(int, open(0).read().split()))
c1, c2 = sorted(
list(Counter(lst[::2]).items()), key=lambda x: x[1], reverse=1
), sorted(list(Counter(lst[1::2]).items()), key=lambda x: x[1], reverse=1)
c1.append((0, 0)), c2.append((0, 0))
if c1... | false | 11.764706 | [
"- n = int(eval(input()))",
"- m = list(map(int, input().split()))",
"- lst1, lst2 = list(zip(*list(zip(m, m))))",
"- c1, c2 = sorted(list(Counter(lst1).items()), key=lambda x: x[1], reverse=1), sorted(",
"- list(Counter(lst2).items()), key=lambda x: x[1], reverse=1",
"- )",
"+ ... | false | 0.04159 | 0.045414 | 0.915791 | [
"s323517549",
"s454148251"
] |
u775681539 | p03162 | python | s887354696 | s343569114 | 1,692 | 301 | 148,168 | 70,236 | Accepted | Accepted | 82.21 | #python3
def main():
n = int(eval(input()))
a = []
for _ in range(n):
x, y, z = list(map(int, input().split()))
a.append((x, y, z))
dp = [[0 for _ in range(3)] for _ in range(10*n)]
for i in range(n):
for j in range(3):
for k in range(3):
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
n = int(readline())
act = []
for _ in range(n):
a, b, c = list(map(int, readline().split()))
act.append((a, b, c))
#dp[i][j]:= 太郎くんがi日目に活動jを行って得る... | 21 | 26 | 470 | 727 | # python3
def main():
n = int(eval(input()))
a = []
for _ in range(n):
x, y, z = list(map(int, input().split()))
a.append((x, y, z))
dp = [[0 for _ in range(3)] for _ in range(10 * n)]
for i in range(n):
for j in range(3):
for k in range(3):
if j =... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
n = int(readline())
act = []
for _ in range(n):
a, b, c = list(map(int, readline().split()))
act.append((a, b, c))
# dp[i][j]:= 太郎くんがi日目に活動jを行って得る幸福度の総和の最大値
... | false | 19.230769 | [
"-# python3",
"-def main():",
"- n = int(eval(input()))",
"- a = []",
"- for _ in range(n):",
"- x, y, z = list(map(int, input().split()))",
"- a.append((x, y, z))",
"- dp = [[0 for _ in range(3)] for _ in range(10 * n)]",
"- for i in range(n):",
"- for j in ran... | false | 0.074415 | 0.102698 | 0.724596 | [
"s887354696",
"s343569114"
] |
u346812984 | p03069 | python | s530229419 | s602511243 | 140 | 96 | 11,144 | 11,368 | Accepted | Accepted | 31.43 | N = int(eval(input()))
S = eval(input())
white = [0] * (N + 1)
for i in range(N):
if S[i] == ".":
white[i + 1] = white[i] + 1
else:
white[i + 1] = white[i]
ans = N
for i in range(N + 1):
tmp = (i - white[i]) + (white[-1] - white[i])
if tmp < ans:
ans = tmp
prin... | import sys
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
S = eval(input())
B = S.count("#")
W = S.count(".")
# 左からi文字目までの白の数
n_white = []
if S[0] == ".":
... | 17 | 46 | 315 | 827 | N = int(eval(input()))
S = eval(input())
white = [0] * (N + 1)
for i in range(N):
if S[i] == ".":
white[i + 1] = white[i] + 1
else:
white[i + 1] = white[i]
ans = N
for i in range(N + 1):
tmp = (i - white[i]) + (white[-1] - white[i])
if tmp < ans:
ans = tmp
print(ans)
| import sys
sys.setrecursionlimit(10**6)
INF = float("inf")
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
S = eval(input())
B = S.count("#")
W = S.count(".")
# 左からi文字目までの白の数
n_white = []
if S[0] == ".":
n_white.append(1)
... | false | 63.043478 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-white = [0] * (N + 1)",
"-for i in range(N):",
"- if S[i] == \".\":",
"- white[i + 1] = white[i] + 1",
"+import sys",
"+",
"+sys.setrecursionlimit(10**6)",
"+INF = float(\"inf\")",
"+MOD = 10**9 + 7",
"+",
"+",
"+def input():",
... | false | 0.092346 | 0.03808 | 2.425092 | [
"s530229419",
"s602511243"
] |
u352394527 | p00519 | python | s937236210 | s667052584 | 190 | 170 | 7,936 | 7,788 | Accepted | Accepted | 10.53 | from heapq import heappop as pop
from heapq import heappush as push
INF = 10 ** 20
def main():
n, k = list(map(int, input().split()))
clst = []
rlst = []
for i in range(n):
c, r = list(map(int, input().split()))
clst.append(c)
rlst.append(r)
edges = [[] * n for i in range(... | from heapq import heappop as pop
from heapq import heappush as push
def main():
n, k = list(map(int, input().split()))
clst = []
rlst = []
for i in range(n):
c, r = list(map(int, input().split()))
clst.append(c)
rlst.append(r)
edges = [[] * n for i in range(n)]
for i... | 65 | 61 | 1,309 | 1,170 | from heapq import heappop as pop
from heapq import heappush as push
INF = 10**20
def main():
n, k = list(map(int, input().split()))
clst = []
rlst = []
for i in range(n):
c, r = list(map(int, input().split()))
clst.append(c)
rlst.append(r)
edges = [[] * n for i in range(n)... | from heapq import heappop as pop
from heapq import heappush as push
def main():
n, k = list(map(int, input().split()))
clst = []
rlst = []
for i in range(n):
c, r = list(map(int, input().split()))
clst.append(c)
rlst.append(r)
edges = [[] * n for i in range(n)]
for i in... | false | 6.153846 | [
"-",
"-INF = 10**20",
"- costs = [INF for i in range(n)]",
"- costs[0] = 0",
"- used = [False for i in range(n)]",
"+ costs = [None] * n",
"+ used = [False] * n",
"- while loop:",
"+ while loop and temp:",
"- if not temp:",
"- break",
"- ... | false | 0.048396 | 0.049123 | 0.985196 | [
"s937236210",
"s667052584"
] |
u581187895 | p02629 | python | s199740211 | s347999497 | 33 | 27 | 9,180 | 9,136 | Accepted | Accepted | 18.18 |
def resolve():
lower = "abcdefghijklmnopqrstuvwxyz"
N = int(eval(input()))
ans = ""
while N > 26:
idx = N % 26
ans += lower[idx-1]
N = -(-N//26)-1
idx = N % 26
ans += lower[idx - 1]
print((ans[::-1]))
if __name__ == "__main__":
resolve()
|
def resolve():
lower = "abcdefghijklmnopqrstuvwxyz"
N = int(eval(input()))
ans = ""
while N:
N -= 1
idx = N%26
ans += lower[idx]
N //= 26
print((ans[::-1]))
if __name__ == "__main__":
resolve()
| 16 | 15 | 308 | 259 | def resolve():
lower = "abcdefghijklmnopqrstuvwxyz"
N = int(eval(input()))
ans = ""
while N > 26:
idx = N % 26
ans += lower[idx - 1]
N = -(-N // 26) - 1
idx = N % 26
ans += lower[idx - 1]
print((ans[::-1]))
if __name__ == "__main__":
resolve()
| def resolve():
lower = "abcdefghijklmnopqrstuvwxyz"
N = int(eval(input()))
ans = ""
while N:
N -= 1
idx = N % 26
ans += lower[idx]
N //= 26
print((ans[::-1]))
if __name__ == "__main__":
resolve()
| false | 6.25 | [
"- while N > 26:",
"+ while N:",
"+ N -= 1",
"- ans += lower[idx - 1]",
"- N = -(-N // 26) - 1",
"- idx = N % 26",
"- ans += lower[idx - 1]",
"+ ans += lower[idx]",
"+ N //= 26"
] | false | 0.04389 | 0.04503 | 0.974681 | [
"s199740211",
"s347999497"
] |
u072717685 | p03583 | python | s370034767 | s338037409 | 1,130 | 731 | 9,264 | 109,688 | Accepted | Accepted | 35.31 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, 3501):
shisu = h * N * n
bosu = n * (h * 4 - N) - h * N
if bosu >= 1:
if not (shisu / bosu) % 1:
... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from numba import njit
def main():
N = int(input())
@njit
def solve(N):
for h in range(1, 3501):
for n in range(1, 3501):
shisu = h * N * n
bosu = n * (h * 4 - N) - h * N
... | 17 | 21 | 467 | 561 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
N = int(eval(input()))
for h in range(1, 3501):
for n in range(1, 3501):
shisu = h * N * n
bosu = n * (h * 4 - N) - h * N
if bosu >= 1:
if not (shisu / bosu) % 1:
... | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from numba import njit
def main():
N = int(input())
@njit
def solve(N):
for h in range(1, 3501):
for n in range(1, 3501):
shisu = h * N * n
bosu = n * (h * 4 - N) - h * N
... | false | 19.047619 | [
"+from numba import njit",
"- N = int(eval(input()))",
"- for h in range(1, 3501):",
"- for n in range(1, 3501):",
"- shisu = h * N * n",
"- bosu = n * (h * 4 - N) - h * N",
"- if bosu >= 1:",
"- if not (shisu / bosu) % 1:",
"- ... | false | 0.47914 | 0.044094 | 10.866372 | [
"s370034767",
"s338037409"
] |
u017723605 | p03545 | python | s108642115 | s960547368 | 24 | 18 | 3,188 | 3,064 | Accepted | Accepted | 25 | #!/usr/bin/env python3
import sys
def solve(ABCD: str):
num_str = ABCD
N = len(num_str) - 1
for bit in range(2 ** N):
tmp = num_str[0]
for i in range(N):
if bit & 1 << i:
tmp += "+"
else:
tmp += "-"
tmp += ... | #!/usr/bin/env python3
import sys
def solve(num_str: str):
N = len(num_str) - 1
for bit in range(2 ** N):
ans = num_str[0]
for i in range(N):
if bit & 1 << i:
ans += "+"
else:
ans += "-"
ans += num_str[i + 1]
... | 37 | 35 | 874 | 838 | #!/usr/bin/env python3
import sys
def solve(ABCD: str):
num_str = ABCD
N = len(num_str) - 1
for bit in range(2**N):
tmp = num_str[0]
for i in range(N):
if bit & 1 << i:
tmp += "+"
else:
tmp += "-"
tmp += num_str[i + 1]
... | #!/usr/bin/env python3
import sys
def solve(num_str: str):
N = len(num_str) - 1
for bit in range(2**N):
ans = num_str[0]
for i in range(N):
if bit & 1 << i:
ans += "+"
else:
ans += "-"
ans += num_str[i + 1]
if eval(ans... | false | 5.405405 | [
"-def solve(ABCD: str):",
"- num_str = ABCD",
"+def solve(num_str: str):",
"- tmp = num_str[0]",
"+ ans = num_str[0]",
"- tmp += \"+\"",
"+ ans += \"+\"",
"- tmp += \"-\"",
"- tmp += num_str[i + 1]",
"- res = eval(tmp)... | false | 0.041195 | 0.041863 | 0.984022 | [
"s108642115",
"s960547368"
] |
u358254559 | p03069 | python | s781834017 | s958802554 | 186 | 101 | 12,820 | 3,500 | Accepted | Accepted | 45.7 | n = int(eval(input()))
s = eval(input())
b_lst=[]
w_lst=[]
b_cnt=0
w_cnt=0
for i in range(len(s)):
b_lst.append(b_cnt)
w_lst.append(w_cnt)
if s[i]=="#":
b_cnt+=1
if s[len(s)-i-1]==".":
w_cnt+=1
b_lst.append(b_cnt)
w_lst.append(w_cnt)
w_lst.reverse()
ans=10**9
for b,w i... | n = int(eval(input()))
s = eval(input())
ans=0
for stone in s:
if stone==".":
ans+=1
ans_mn=ans
for i in range(len(s)):
if s[i]=="#":
ans+=1
if s[i]==".":
ans-=1
if ans < ans_mn:
ans_mn=ans
print(ans_mn) | 22 | 15 | 375 | 253 | n = int(eval(input()))
s = eval(input())
b_lst = []
w_lst = []
b_cnt = 0
w_cnt = 0
for i in range(len(s)):
b_lst.append(b_cnt)
w_lst.append(w_cnt)
if s[i] == "#":
b_cnt += 1
if s[len(s) - i - 1] == ".":
w_cnt += 1
b_lst.append(b_cnt)
w_lst.append(w_cnt)
w_lst.reverse()
ans = 10**9
for b,... | n = int(eval(input()))
s = eval(input())
ans = 0
for stone in s:
if stone == ".":
ans += 1
ans_mn = ans
for i in range(len(s)):
if s[i] == "#":
ans += 1
if s[i] == ".":
ans -= 1
if ans < ans_mn:
ans_mn = ans
print(ans_mn)
| false | 31.818182 | [
"-b_lst = []",
"-w_lst = []",
"-b_cnt = 0",
"-w_cnt = 0",
"+ans = 0",
"+for stone in s:",
"+ if stone == \".\":",
"+ ans += 1",
"+ans_mn = ans",
"- b_lst.append(b_cnt)",
"- w_lst.append(w_cnt)",
"- b_cnt += 1",
"- if s[len(s) - i - 1] == \".\":",
"- w_cnt +... | false | 0.032573 | 0.041316 | 0.788387 | [
"s781834017",
"s958802554"
] |
u254871849 | p03111 | python | s213299691 | s996353979 | 363 | 63 | 26,556 | 3,064 | Accepted | Accepted | 82.64 | import sys
from functools import lru_cache
inf = float('inf')
n, A, B, C, *l = list(map(int, sys.stdin.read().split()))
@lru_cache(None)
def cost(a, b, c, cnt, i):
if i == n:
if not (a and b and c): return inf
return abs(A - a) + abs(B - b) + abs(C - c) + 10 * (cnt - 3)
return min(c... | import sys
inf = float('inf')
n, A, B, C, *l = list(map(int, sys.stdin.read().split()))
def cost(a, b, c, cnt, i):
if i == n:
if not (a and b and c): return inf
return abs(A - a) + abs(B - b) + abs(C - c) + 10 * (cnt - 3)
return min(cost(a, b, c, cnt, i+1),
cost(a+l[i... | 21 | 19 | 572 | 521 | import sys
from functools import lru_cache
inf = float("inf")
n, A, B, C, *l = list(map(int, sys.stdin.read().split()))
@lru_cache(None)
def cost(a, b, c, cnt, i):
if i == n:
if not (a and b and c):
return inf
return abs(A - a) + abs(B - b) + abs(C - c) + 10 * (cnt - 3)
return min... | import sys
inf = float("inf")
n, A, B, C, *l = list(map(int, sys.stdin.read().split()))
def cost(a, b, c, cnt, i):
if i == n:
if not (a and b and c):
return inf
return abs(A - a) + abs(B - b) + abs(C - c) + 10 * (cnt - 3)
return min(
cost(a, b, c, cnt, i + 1),
cost... | false | 9.52381 | [
"-from functools import lru_cache",
"-@lru_cache(None)"
] | false | 0.25194 | 0.11675 | 2.157941 | [
"s213299691",
"s996353979"
] |
u480200603 | p02971 | python | s508133796 | s719237190 | 871 | 320 | 68,952 | 12,512 | Accepted | Accepted | 63.26 | n = int(eval(input()))
l = []
m1 = 0
m2 = 0
for i in range(n):
num = int(eval(input()))
l.append(num)
if num > m1:
m1 = num
elif num > m2:
m2 = num
for i in range(n):
if l[i] != m1:
print(m1)
else:
print(m2)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
l = []
m1 = 0
m2 = 0
for i in range(n):
num = int(eval(input()))
l.append(num)
if num > m1:
m1 = num
elif num > m2:
m2 = num
for i in range(n):
if l[i] != m1:
print(m1)
else:
print(m... | 17 | 20 | 269 | 311 | n = int(eval(input()))
l = []
m1 = 0
m2 = 0
for i in range(n):
num = int(eval(input()))
l.append(num)
if num > m1:
m1 = num
elif num > m2:
m2 = num
for i in range(n):
if l[i] != m1:
print(m1)
else:
print(m2)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
l = []
m1 = 0
m2 = 0
for i in range(n):
num = int(eval(input()))
l.append(num)
if num > m1:
m1 = num
elif num > m2:
m2 = num
for i in range(n):
if l[i] != m1:
print(m1)
else:
print(m2)
| false | 15 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.075843 | 0.125429 | 0.60467 | [
"s508133796",
"s719237190"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.