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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u699296734 | p03317 | python | s682182508 | s378748518 | 60 | 55 | 20,480 | 20,572 | Accepted | Accepted | 8.33 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
now = k
res = 1
while now < n:
now += k-1
res += 1
print(res) | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
if (n + k - 1) // k == 1:
print((1))
else:
res = ((n - k) + (k - 2)) // (k - 1) + 1
print(res)
| 10 | 8 | 149 | 182 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
now = k
res = 1
while now < n:
now += k - 1
res += 1
print(res)
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
if (n + k - 1) // k == 1:
print((1))
else:
res = ((n - k) + (k - 2)) // (k - 1) + 1
print(res)
| false | 20 | [
"-now = k",
"-res = 1",
"-while now < n:",
"- now += k - 1",
"- res += 1",
"-print(res)",
"+if (n + k - 1) // k == 1:",
"+ print((1))",
"+else:",
"+ res = ((n - k) + (k - 2)) // (k - 1) + 1",
"+ print(res)"
] | false | 0.036335 | 0.035785 | 1.015373 | [
"s682182508",
"s378748518"
] |
u585482323 | p02953 | python | s294616356 | s011044792 | 235 | 200 | 60,144 | 58,224 | Accepted | Accepted | 14.89 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline()... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 78 | 42 | 1,312 | 989 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(x) for x in sys.stdin... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 46.153846 | [
"+from itertools import permutations, accumulate",
"-import random",
"- return [int(x) for x in sys.stdin.readline().split()]",
"+ return [int(x) for x in sys.stdin.buffer.readline().split()]",
"- return int(sys.stdin.readline())",
"+ return int(sys.stdin.buffer.readline())",
"-# A",
"-def... | false | 0.045222 | 0.043239 | 1.045853 | [
"s294616356",
"s011044792"
] |
u023229441 | p03044 | python | s489874273 | s196692915 | 882 | 461 | 85,700 | 172,128 | Accepted | Accepted | 47.73 | import copy ; import sys ; sys.setrecursionlimit(11451419)
n=int(eval(input()))
color=[-1 for i in range(n)]
color[0]=1
G=[[] for i in range(n)]
for i in range(n-1):
a,b,d=list(map(int,input().split()))
G[a-1].append([b-1,d])
G[b-1].append([a-1,d])
def dfs(x):
for i,dis in G[x]:
if ... | import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal #変換後の末尾桁を0や0.01で指定
#Decimal((str(0... | 24 | 35 | 482 | 974 | import copy
import sys
sys.setrecursionlimit(11451419)
n = int(eval(input()))
color = [-1 for i in range(n)]
color[0] = 1
G = [[] for i in range(n)]
for i in range(n - 1):
a, b, d = list(map(int, input().split()))
G[a - 1].append([b - 1, d])
G[b - 1].append([a - 1, d])
def dfs(x):
for i, dis in G[x]:... | import sys
mod = 10**9 + 7
inf = float("inf")
from math import sqrt, ceil
from collections import (
deque,
Counter,
defaultdict,
) # すべてのkeyが用意されてる defaultdict(int)で初期化
input = lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP, Decimal # 変換後の末尾桁を0や0.0... | false | 31.428571 | [
"-import copy",
"+mod = 10**9 + 7",
"+inf = float(\"inf\")",
"+from math import sqrt, ceil",
"+from collections import (",
"+ deque,",
"+ Counter,",
"+ defaultdict,",
"+) # すべてのkeyが用意されてる defaultdict(int)で初期化",
"+",
"+input = lambda: sys.stdin.readline().strip()",
"+from decimal impo... | false | 0.040918 | 0.04209 | 0.972154 | [
"s489874273",
"s196692915"
] |
u411203878 | p03476 | python | s975707913 | s164868747 | 1,110 | 738 | 53,340 | 93,836 | Accepted | Accepted | 33.51 | import math
def is_prime(n):
if n==1 :
return False
for k in range(2,int(math.sqrt(n))+1):
if n%k==0:
return False
return True
count = [0]
buf = 0
for i in range(1, 10**5 + 2):
if i % 2 == 0:
count.append(buf)
continue
hantei1 = is_... | def prime(p):
primeFlag = True
if p == 1:
primeFlag = False
for i in range(2,(int(p**0.5)+1)):
if p%i==0:
primeFlag = False
break
if primeFlag:
return True
else:
return False
Q = int(eval(input()))
memo = [0]*100001
for ... | 32 | 29 | 546 | 584 | import math
def is_prime(n):
if n == 1:
return False
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
count = [0]
buf = 0
for i in range(1, 10**5 + 2):
if i % 2 == 0:
count.append(buf)
continue
hantei1 = is_prime(i)
... | def prime(p):
primeFlag = True
if p == 1:
primeFlag = False
for i in range(2, (int(p**0.5) + 1)):
if p % i == 0:
primeFlag = False
break
if primeFlag:
return True
else:
return False
Q = int(eval(input()))
memo = [0] * 100001
for i in range(2,... | false | 9.375 | [
"-import math",
"+def prime(p):",
"+ primeFlag = True",
"+ if p == 1:",
"+ primeFlag = False",
"+ for i in range(2, (int(p**0.5) + 1)):",
"+ if p % i == 0:",
"+ primeFlag = False",
"+ break",
"+ if primeFlag:",
"+ return True",
"+ else:... | false | 0.892757 | 0.73462 | 1.215264 | [
"s975707913",
"s164868747"
] |
u997641430 | p03162 | python | s107150840 | s717571173 | 615 | 384 | 65,624 | 3,316 | Accepted | Accepted | 37.56 | N = int(eval(input()))
A, B, C = [], [], []
for n in range(N):
a, b, c = list(map(int, input().split()))
A.append(a)
B.append(b)
C.append(c)
a, b, c = 0, 0, 0
for n in range(N):
a, b, c = A[n] + max(b, c), B[n] + max(c, a), C[n] + max(a, b)
print((max(a, b, c)))
| N = int(eval(input()))
a, b, c = 0, 0, 0
for n in range(N):
an, bn, cn = list(map(int, input().split()))
a, b, c = an + max(b, c), bn + max(c, a), cn + max(a, b)
print((max(a, b, c)))
| 11 | 6 | 279 | 183 | N = int(eval(input()))
A, B, C = [], [], []
for n in range(N):
a, b, c = list(map(int, input().split()))
A.append(a)
B.append(b)
C.append(c)
a, b, c = 0, 0, 0
for n in range(N):
a, b, c = A[n] + max(b, c), B[n] + max(c, a), C[n] + max(a, b)
print((max(a, b, c)))
| N = int(eval(input()))
a, b, c = 0, 0, 0
for n in range(N):
an, bn, cn = list(map(int, input().split()))
a, b, c = an + max(b, c), bn + max(c, a), cn + max(a, b)
print((max(a, b, c)))
| false | 45.454545 | [
"-A, B, C = [], [], []",
"-for n in range(N):",
"- a, b, c = list(map(int, input().split()))",
"- A.append(a)",
"- B.append(b)",
"- C.append(c)",
"- a, b, c = A[n] + max(b, c), B[n] + max(c, a), C[n] + max(a, b)",
"+ an, bn, cn = list(map(int, input().split()))",
"+ a, b, c = an... | false | 0.037642 | 0.035693 | 1.054604 | [
"s107150840",
"s717571173"
] |
u499381410 | p02793 | python | s409181683 | s744109516 | 582 | 287 | 5,708 | 84,700 | Accepted | Accepted | 50.69 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from copy import... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | 84 | 65 | 2,206 | 1,558 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from copy import deepcop... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | false | 22.619048 | [
"-from bisect import bisect_right, bisect_left",
"+import math",
"+import bisect",
"-from copy import deepcopy",
"-from math import factorial, ceil, floor, gamma, log",
"+from math import factorial, ceil, floor",
"+from operator import mul",
"- return list(map(int, sys.stdin.buffer.readline().split... | false | 0.04628 | 0.047139 | 0.981764 | [
"s409181683",
"s744109516"
] |
u270467412 | p02837 | python | s631585298 | s648070485 | 1,588 | 185 | 3,064 | 3,064 | Accepted | Accepted | 88.35 | N = int(eval(input()))
A = []
xy = []
for i in range(N):
a = int(eval(input()))
A.append(a)
xykari = []
for j in range(a):
xykari2 = list(map(int, input().split()))
xykari.append(xykari2)
xy.append(xykari)
ans = 0
for i in range(2**N): # iはケース名
honest = 0
ng = 0
for j in range... | N = int(eval(input()))
A = []
xy = []
for i in range(N):
a = int(eval(input()))
A.append(a)
xykari = []
for j in range(a):
xykari2 = list(map(int, input().split()))
xykari.append(xykari2)
xy.append(xykari)
ans = 0
for i in range(2**N): # iはケース名
honest = 0
ng = 0
for j in range... | 30 | 33 | 635 | 682 | N = int(eval(input()))
A = []
xy = []
for i in range(N):
a = int(eval(input()))
A.append(a)
xykari = []
for j in range(a):
xykari2 = list(map(int, input().split()))
xykari.append(xykari2)
xy.append(xykari)
ans = 0
for i in range(2**N): # iはケース名
honest = 0
ng = 0
for j in... | N = int(eval(input()))
A = []
xy = []
for i in range(N):
a = int(eval(input()))
A.append(a)
xykari = []
for j in range(a):
xykari2 = list(map(int, input().split()))
xykari.append(xykari2)
xy.append(xykari)
ans = 0
for i in range(2**N): # iはケース名
honest = 0
ng = 0
for j in... | false | 9.090909 | [
"+ break",
"+ if ng == 1:",
"+ break"
] | false | 0.18649 | 0.07732 | 2.411924 | [
"s631585298",
"s648070485"
] |
u089230684 | p03264 | python | s377228356 | s791797819 | 167 | 18 | 38,512 | 2,940 | Accepted | Accepted | 89.22 | k=int(eval(input()))
if (k%2)==1 and k<=100:
a=k//2
b=k//2+1
elif (k%2)==0 and k<=100:
a=k//2
b=k//2
print((a*b)) | K=int(eval(input()))
l=0
for i in range(1,K+1):
for z in range(i,K+1):
if (i%2==0 and z%2==1) or (i%2==1 and z%2==0):
l+=1
print(l)
| 8 | 7 | 128 | 156 | k = int(eval(input()))
if (k % 2) == 1 and k <= 100:
a = k // 2
b = k // 2 + 1
elif (k % 2) == 0 and k <= 100:
a = k // 2
b = k // 2
print((a * b))
| K = int(eval(input()))
l = 0
for i in range(1, K + 1):
for z in range(i, K + 1):
if (i % 2 == 0 and z % 2 == 1) or (i % 2 == 1 and z % 2 == 0):
l += 1
print(l)
| false | 12.5 | [
"-k = int(eval(input()))",
"-if (k % 2) == 1 and k <= 100:",
"- a = k // 2",
"- b = k // 2 + 1",
"-elif (k % 2) == 0 and k <= 100:",
"- a = k // 2",
"- b = k // 2",
"-print((a * b))",
"+K = int(eval(input()))",
"+l = 0",
"+for i in range(1, K + 1):",
"+ for z in range(i, K + 1):... | false | 0.085416 | 0.041108 | 2.077832 | [
"s377228356",
"s791797819"
] |
u227082700 | p03634 | python | s323957839 | s817694760 | 1,605 | 1,328 | 55,388 | 81,788 | Accepted | Accepted | 17.26 | n=int(eval(input()))
l=[[]for _ in range(n)]
for i in range(n-1):
a,b,c=list(map(int,input().split()))
l[a-1]+=[[b-1,c]]
l[b-1]+=[[a-1,c]]
q,k=list(map(int,input().split()))
k-=1
Q=[[k,0]]
c=[0]*n;c[k]=-1
while Q:
p=[]
for i,j in Q:
for x,y in l[i]:
if c[x]==0:
c[x]=j+y
... | from heapq import heappop,heappush
def dijkstra(s,n,edge):
inf=10**20
ans=[inf]*n
ans[s]=0
h=[[0,s]]
while h:
c,v=heappop(h)
if ans[v]<c:continue
for u,t in edge[v]:
if c+t<ans[u]:
ans[u]=c+t
heappush(h,[c+t,u])
return ans
n=int(eval(input()))
edge=[[]for _ i... | 22 | 27 | 409 | 640 | n = int(eval(input()))
l = [[] for _ in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
l[a - 1] += [[b - 1, c]]
l[b - 1] += [[a - 1, c]]
q, k = list(map(int, input().split()))
k -= 1
Q = [[k, 0]]
c = [0] * n
c[k] = -1
while Q:
p = []
for i, j in Q:
for x, y in l[i... | from heapq import heappop, heappush
def dijkstra(s, n, edge):
inf = 10**20
ans = [inf] * n
ans[s] = 0
h = [[0, s]]
while h:
c, v = heappop(h)
if ans[v] < c:
continue
for u, t in edge[v]:
if c + t < ans[u]:
ans[u] = c + t
... | false | 18.518519 | [
"+from heapq import heappop, heappush",
"+",
"+",
"+def dijkstra(s, n, edge):",
"+ inf = 10**20",
"+ ans = [inf] * n",
"+ ans[s] = 0",
"+ h = [[0, s]]",
"+ while h:",
"+ c, v = heappop(h)",
"+ if ans[v] < c:",
"+ continue",
"+ for u, t in edge[v... | false | 0.106874 | 0.105069 | 1.017181 | [
"s323957839",
"s817694760"
] |
u747602774 | p03944 | python | s138627411 | s857815224 | 78 | 17 | 3,064 | 3,064 | Accepted | Accepted | 78.21 | W,H,N=list(map(int,input().split()))
li=[[1 for w in range(W)] for h in range(H)]
for n in range(N):
X,Y,a=list(map(int,input().split()))
if a==1:
for y in range(H):
for x in range(X):
li[y][x]=0
elif a==3:
for y in range(Y):
for x in range(W):
li[y][x]=0
elif... | w,h,n = list(map(int,input().split()))
p = [0,w,0,h]
for i in range(n):
x,y,a = list(map(int,input().split()))
if a == 1:
p[0] = max(x,p[0])
if a == 2:
p[1] = min(x,p[1])
if a == 3:
p[2] = max(y,p[2])
if a == 4:
p[3] = min(y,p[3])
print((max(0,p[1]-p[0])*m... | 26 | 13 | 517 | 324 | W, H, N = list(map(int, input().split()))
li = [[1 for w in range(W)] for h in range(H)]
for n in range(N):
X, Y, a = list(map(int, input().split()))
if a == 1:
for y in range(H):
for x in range(X):
li[y][x] = 0
elif a == 3:
for y in range(Y):
for x in... | w, h, n = list(map(int, input().split()))
p = [0, w, 0, h]
for i in range(n):
x, y, a = list(map(int, input().split()))
if a == 1:
p[0] = max(x, p[0])
if a == 2:
p[1] = min(x, p[1])
if a == 3:
p[2] = max(y, p[2])
if a == 4:
p[3] = min(y, p[3])
print((max(0, p[1] - p[0... | false | 50 | [
"-W, H, N = list(map(int, input().split()))",
"-li = [[1 for w in range(W)] for h in range(H)]",
"-for n in range(N):",
"- X, Y, a = list(map(int, input().split()))",
"+w, h, n = list(map(int, input().split()))",
"+p = [0, w, 0, h]",
"+for i in range(n):",
"+ x, y, a = list(map(int, input().spli... | false | 0.053626 | 0.037597 | 1.426351 | [
"s138627411",
"s857815224"
] |
u314050667 | p03017 | python | s125171189 | s583795409 | 105 | 85 | 3,572 | 3,572 | Accepted | Accepted | 19.05 | N, A, B, C, D = list(map(int, input().split()))
A, B, C, D = A-1, B-1, C-1, D-1
S = eval(input()) + "###"
def chk(l, r):
for i in range(l, r-1):
if S[i:i+2] == "##":
return 0
return 1
def chk3(l, r):
for i in range(l, r):
if S[i:i+3].count("#") == 0:
retu... | import sys
n,a,b,c,d = list(map(int, input().split()))
s = eval(input())
tmp = ""
for i in range(a,c):
if s[i] == tmp == "#":
print("No")
sys.exit()
tmp = s[i]
for i in range(b,d):
if s[i] == tmp == "#":
print("No")
sys.exit()
tmp = s[i]
if c < d:
print("Yes")
sys.exit()
else:
... | 19 | 34 | 428 | 462 | N, A, B, C, D = list(map(int, input().split()))
A, B, C, D = A - 1, B - 1, C - 1, D - 1
S = eval(input()) + "###"
def chk(l, r):
for i in range(l, r - 1):
if S[i : i + 2] == "##":
return 0
return 1
def chk3(l, r):
for i in range(l, r):
if S[i : i + 3].count("#") == 0:
... | import sys
n, a, b, c, d = list(map(int, input().split()))
s = eval(input())
tmp = ""
for i in range(a, c):
if s[i] == tmp == "#":
print("No")
sys.exit()
tmp = s[i]
for i in range(b, d):
if s[i] == tmp == "#":
print("No")
sys.exit()
tmp = s[i]
if c < d:
print("Yes")
... | false | 44.117647 | [
"-N, A, B, C, D = list(map(int, input().split()))",
"-A, B, C, D = A - 1, B - 1, C - 1, D - 1",
"-S = eval(input()) + \"###\"",
"+import sys",
"-",
"-def chk(l, r):",
"- for i in range(l, r - 1):",
"- if S[i : i + 2] == \"##\":",
"- return 0",
"- return 1",
"-",
"-",
... | false | 0.042799 | 0.043306 | 0.988278 | [
"s125171189",
"s583795409"
] |
u747703115 | p03425 | python | s038995423 | s838000699 | 174 | 40 | 3,064 | 10,864 | Accepted | Accepted | 77.01 | n = int(eval(input()))
m, a, r, c, h = 0, 0, 0, 0, 0
for i in range(n):
s = eval(input())
if s[0]=='M':
m += 1
elif s[0]=='A':
a += 1
elif s[0]=='R':
r += 1
elif s[0]=='C':
c += 1
elif s[0]=='H':
h += 1
print((m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*... | from itertools import combinations
n, *S = open(0).read().split()
# 頭文字だけ抜き出す.
cap = [s[0] for s in S]
# M,A,R,C,H,それぞれ頭文字の中にある数をカウント.
cnt = [cap.count(i) for i in "MARCH"]
# 組み合わせの合計を取る.
ans = sum(x*y*z for x, y, z in combinations(cnt, 3))
print(ans) | 15 | 9 | 337 | 259 | n = int(eval(input()))
m, a, r, c, h = 0, 0, 0, 0, 0
for i in range(n):
s = eval(input())
if s[0] == "M":
m += 1
elif s[0] == "A":
a += 1
elif s[0] == "R":
r += 1
elif s[0] == "C":
c += 1
elif s[0] == "H":
h += 1
print(
(
m * a * r
+ m ... | from itertools import combinations
n, *S = open(0).read().split()
# 頭文字だけ抜き出す.
cap = [s[0] for s in S]
# M,A,R,C,H,それぞれ頭文字の中にある数をカウント.
cnt = [cap.count(i) for i in "MARCH"]
# 組み合わせの合計を取る.
ans = sum(x * y * z for x, y, z in combinations(cnt, 3))
print(ans)
| false | 40 | [
"-n = int(eval(input()))",
"-m, a, r, c, h = 0, 0, 0, 0, 0",
"-for i in range(n):",
"- s = eval(input())",
"- if s[0] == \"M\":",
"- m += 1",
"- elif s[0] == \"A\":",
"- a += 1",
"- elif s[0] == \"R\":",
"- r += 1",
"- elif s[0] == \"C\":",
"- c += 1"... | false | 0.044105 | 0.042746 | 1.031808 | [
"s038995423",
"s838000699"
] |
u497952650 | p02791 | python | s788183966 | s483740595 | 169 | 145 | 24,744 | 24,744 | Accepted | Accepted | 14.2 | N = int(eval(input()))
P = list(map(int,input().split()))
minp = P[0]
ans = 0
for i in range(N):
if i != 0:
minp = min(minp,P[i])
if minp == P[i]:
ans += 1
print(ans)
| N = int(eval(input()))
P = list(map(int,input().split()))
minp = P[0]
ans = 0
for i in range(N):
minp = min(minp,P[i])
if minp == P[i]:
ans += 1
print(ans) | 13 | 12 | 200 | 179 | N = int(eval(input()))
P = list(map(int, input().split()))
minp = P[0]
ans = 0
for i in range(N):
if i != 0:
minp = min(minp, P[i])
if minp == P[i]:
ans += 1
print(ans)
| N = int(eval(input()))
P = list(map(int, input().split()))
minp = P[0]
ans = 0
for i in range(N):
minp = min(minp, P[i])
if minp == P[i]:
ans += 1
print(ans)
| false | 7.692308 | [
"- if i != 0:",
"- minp = min(minp, P[i])",
"+ minp = min(minp, P[i])"
] | false | 0.095204 | 0.046926 | 2.028795 | [
"s788183966",
"s483740595"
] |
u197300773 | p02901 | python | s096488733 | s665573638 | 1,316 | 775 | 3,188 | 3,188 | Accepted | Accepted | 41.11 | n,m=list(map(int,input().split()))
L=2**n
cost=[0]+[10**8 for i in range(L-1)]
for i in range(m):
a,b=list(map(int,input().split()))
c=sum([2**(int(i)-1) for i in input().split()])
for j in range(L):
q=j|c
x=cost[j]+a
if cost[q]>x:
cost[q]=x
print((cost[L-1] ... | def main():
n,m=list(map(int,input().split()))
L=2**n
cost=[0]+[10**8 for i in range(L-1)]
for _ in range(m):
a,_=list(map(int,input().split()))
c=sum([2**(int(i)-1) for i in input().split()])
for j in range(L):
q=j|c
x=cost[j]+a
if... | 13 | 17 | 334 | 437 | n, m = list(map(int, input().split()))
L = 2**n
cost = [0] + [10**8 for i in range(L - 1)]
for i in range(m):
a, b = list(map(int, input().split()))
c = sum([2 ** (int(i) - 1) for i in input().split()])
for j in range(L):
q = j | c
x = cost[j] + a
if cost[q] > x:
cost[q] ... | def main():
n, m = list(map(int, input().split()))
L = 2**n
cost = [0] + [10**8 for i in range(L - 1)]
for _ in range(m):
a, _ = list(map(int, input().split()))
c = sum([2 ** (int(i) - 1) for i in input().split()])
for j in range(L):
q = j | c
x = cost[j] ... | false | 23.529412 | [
"-n, m = list(map(int, input().split()))",
"-L = 2**n",
"-cost = [0] + [10**8 for i in range(L - 1)]",
"-for i in range(m):",
"- a, b = list(map(int, input().split()))",
"- c = sum([2 ** (int(i) - 1) for i in input().split()])",
"- for j in range(L):",
"- q = j | c",
"- x = co... | false | 0.123479 | 0.073671 | 1.676071 | [
"s096488733",
"s665573638"
] |
u163320134 | p03593 | python | s355071775 | s345431960 | 23 | 21 | 3,316 | 3,064 | Accepted | Accepted | 8.7 | h,w=list(map(int,input().split()))
ans=[['']*w for _ in range(h)]
char={}
for _ in range(h):
s=eval(input())
for c in s:
if c not in char:
char[c]=1
else:
char[c]+=1
ch=h//2
cw=w//2
fh=False
fw=False
if h%2==1:
ch+=1
fh=True
if w%2==1:
cw+=1
fw=True
for i in range(ch)... | h,w=list(map(int,input().split()))
char={}
for _ in range(h):
s=eval(input())
for c in s:
if c not in char:
char[c]=1
else:
char[c]+=1
cnt4=(h//2)*(w//2)
cnt2=0
cnt1=0
if h%2==1 and w%2==1:
cnt1=1
cnt2=h//2+w//2
elif h%2==1:
cnt2=w//2
elif w%2==1:
cnt2=h//2
flag=True
... | 86 | 51 | 1,863 | 861 | h, w = list(map(int, input().split()))
ans = [[""] * w for _ in range(h)]
char = {}
for _ in range(h):
s = eval(input())
for c in s:
if c not in char:
char[c] = 1
else:
char[c] += 1
ch = h // 2
cw = w // 2
fh = False
fw = False
if h % 2 == 1:
ch += 1
fh = True
if ... | h, w = list(map(int, input().split()))
char = {}
for _ in range(h):
s = eval(input())
for c in s:
if c not in char:
char[c] = 1
else:
char[c] += 1
cnt4 = (h // 2) * (w // 2)
cnt2 = 0
cnt1 = 0
if h % 2 == 1 and w % 2 == 1:
cnt1 = 1
cnt2 = h // 2 + w // 2
elif h % 2... | false | 40.697674 | [
"-ans = [[\"\"] * w for _ in range(h)]",
"-ch = h // 2",
"-cw = w // 2",
"-fh = False",
"-fw = False",
"-if h % 2 == 1:",
"- ch += 1",
"- fh = True",
"-if w % 2 == 1:",
"- cw += 1",
"- fw = True",
"-for i in range(ch):",
"- for j in range(cw):",
"- if (i == ch - 1 and... | false | 0.038964 | 0.034573 | 1.127017 | [
"s355071775",
"s345431960"
] |
u905203728 | p02862 | python | s406243767 | s881071015 | 306 | 130 | 118,764 | 156,708 | Accepted | Accepted | 57.52 | def cmb(n,r,mod):
if r<0 or r>n:return 0
r=min(r,n-r)
return g1[n]*g2[r]*g2[n-r]%mod
mod=10**9+7
x,y=list(map(int,input().split()))
g1=[1,1]
g2=[1,1]
inverse=[0,1]
n,m=(2*y-x)//3,(2*x-y)//3
if (x+y)%3!=0 or n<0 or m<0:print((0));exit()
for i in range(2,n+m+1):
g1.append((g1[-1]*i)%mo... | mod=10**9+7
x,y=list(map(int,input().split()))
X,Y=(2*y-x)//3,(2*x-y)//3
if X<0 or Y<0 or (x+y)%3!=0:print((0));exit()
def cmb(n,r,mod):
if r<0 or r>n:return 0
return g1[r]*g2[r]%mod
n=X+Y
k=max(X,Y)
g1=[1,n]
g2=[1,1]
inverse=[0,1]
for i,j in enumerate(range(n-1,((n-k+1)-1),-1)):
i=... | 21 | 25 | 432 | 462 | def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
mod = 10**9 + 7
x, y = list(map(int, input().split()))
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
n, m = (2 * y - x) // 3, (2 * x - y) // 3
if (x + y) % 3 != 0 or n < 0 or m < 0:
print((0))
... | mod = 10**9 + 7
x, y = list(map(int, input().split()))
X, Y = (2 * y - x) // 3, (2 * x - y) // 3
if X < 0 or Y < 0 or (x + y) % 3 != 0:
print((0))
exit()
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
return g1[r] * g2[r] % mod
n = X + Y
k = max(X, Y)
g1 = [1, n]
g2 = [1, 1]
inverse = [0, 1... | false | 16 | [
"+mod = 10**9 + 7",
"+x, y = list(map(int, input().split()))",
"+X, Y = (2 * y - x) // 3, (2 * x - y) // 3",
"+if X < 0 or Y < 0 or (x + y) % 3 != 0:",
"+ print((0))",
"+ exit()",
"+",
"+",
"- r = min(r, n - r)",
"- return g1[n] * g2[r] * g2[n - r] % mod",
"+ return g1[r] * g2[r] ... | false | 0.82883 | 0.168717 | 4.912556 | [
"s406243767",
"s881071015"
] |
u586121204 | p02887 | python | s136675957 | s496919712 | 44 | 35 | 3,316 | 12,788 | Accepted | Accepted | 20.45 | n = int(eval(input()))
s = eval(input())
before = ''
new = ''
for c in s:
if before != c:
new += c
before = c
print((len(new))) | import re
N = int(eval(input()))
S = eval(input())
rex = r'(.)\1{0,}'
pattern = re.compile(rex)
ans = pattern.findall(S)
print((len(ans))) | 9 | 10 | 141 | 136 | n = int(eval(input()))
s = eval(input())
before = ""
new = ""
for c in s:
if before != c:
new += c
before = c
print((len(new)))
| import re
N = int(eval(input()))
S = eval(input())
rex = r"(.)\1{0,}"
pattern = re.compile(rex)
ans = pattern.findall(S)
print((len(ans)))
| false | 10 | [
"-n = int(eval(input()))",
"-s = eval(input())",
"-before = \"\"",
"-new = \"\"",
"-for c in s:",
"- if before != c:",
"- new += c",
"- before = c",
"-print((len(new)))",
"+import re",
"+",
"+N = int(eval(input()))",
"+S = eval(input())",
"+rex = r\"(.)\\1{0,}\"",
"+patt... | false | 0.04202 | 0.040205 | 1.04514 | [
"s136675957",
"s496919712"
] |
u576432509 | p03721 | python | s967498648 | s147031588 | 465 | 321 | 20,104 | 5,744 | Accepted | Accepted | 30.97 | n,k=list(map(int,input().split()))
a=[]
for i in range(n):
ai,bi=list(map(int,input().split()))
a.append([ai,bi])
a.sort()
sumb=0
for i in range(n):
sumb=sumb+a[i][1]
if sumb>=k:
print((a[i][0]))
break
|
n,k=list(map(int,input().split()))
cnt=[0]*100001
for i in range(n):
ai,bi=list(map(int,input().split()))
cnt[ai]+=bi
for ans in range(1,len(cnt)):
if cnt[ans]>=k:
print(ans)
break
k-=cnt[ans] | 16 | 13 | 247 | 231 | n, k = list(map(int, input().split()))
a = []
for i in range(n):
ai, bi = list(map(int, input().split()))
a.append([ai, bi])
a.sort()
sumb = 0
for i in range(n):
sumb = sumb + a[i][1]
if sumb >= k:
print((a[i][0]))
break
| n, k = list(map(int, input().split()))
cnt = [0] * 100001
for i in range(n):
ai, bi = list(map(int, input().split()))
cnt[ai] += bi
for ans in range(1, len(cnt)):
if cnt[ans] >= k:
print(ans)
break
k -= cnt[ans]
| false | 18.75 | [
"-a = []",
"+cnt = [0] * 100001",
"- a.append([ai, bi])",
"-a.sort()",
"-sumb = 0",
"-for i in range(n):",
"- sumb = sumb + a[i][1]",
"- if sumb >= k:",
"- print((a[i][0]))",
"+ cnt[ai] += bi",
"+for ans in range(1, len(cnt)):",
"+ if cnt[ans] >= k:",
"+ print(an... | false | 0.035727 | 0.032159 | 1.110944 | [
"s967498648",
"s147031588"
] |
u022407960 | p02234 | python | s258358722 | s342857749 | 170 | 140 | 7,816 | 7,948 | Accepted | Accepted | 17.65 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def mat_mul_opt(_mat_info):
r, c = list(map(int, _mat_info[0]))
rc_info.extend([r, c])
for each in _mat_info[1:]:
rc_info.append(int(each[1]))
for l in range(2, mat_num + 1):
for i in range(1, mat_num - l + 2):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def mat_mul_opt(_mat_info):
rc_info.extend(list(map(int, _mat_info[0])))
rc_info.extend(list([int(x[1]) for x in _mat_info[1:]]))
for l in range(2, mat_num + 1):
for i in range(1, mat_num - l + 2):
j = i + l - 1
... | 31 | 29 | 851 | 835 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def mat_mul_opt(_mat_info):
r, c = list(map(int, _mat_info[0]))
rc_info.extend([r, c])
for each in _mat_info[1:]:
rc_info.append(int(each[1]))
for l in range(2, mat_num + 1):
for i in range(1, mat_num - l + 2):
j = i ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def mat_mul_opt(_mat_info):
rc_info.extend(list(map(int, _mat_info[0])))
rc_info.extend(list([int(x[1]) for x in _mat_info[1:]]))
for l in range(2, mat_num + 1):
for i in range(1, mat_num - l + 2):
j = i + l - 1
ans[i... | false | 6.451613 | [
"- r, c = list(map(int, _mat_info[0]))",
"- rc_info.extend([r, c])",
"- for each in _mat_info[1:]:",
"- rc_info.append(int(each[1]))",
"+ rc_info.extend(list(map(int, _mat_info[0])))",
"+ rc_info.extend(list([int(x[1]) for x in _mat_info[1:]]))"
] | false | 0.037671 | 0.065849 | 0.572085 | [
"s258358722",
"s342857749"
] |
u353895424 | p03254 | python | s984198825 | s239091562 | 171 | 30 | 38,448 | 9,060 | Accepted | Accepted | 82.46 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
ans = 0
if x > sum(a):
print((n-1))
else:
for _a in a:
x -= _a
if x < 0:
print(ans)
exit()
else:
... | n, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
ans = 0
for a in A:
x -= a
if x < 0:
break
else:
ans += 1
if 0 < x:
ans -= 1
print((max(ans, 0)))
| 15 | 15 | 350 | 222 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
ans = 0
if x > sum(a):
print((n - 1))
else:
for _a in a:
x -= _a
if x < 0:
print(ans)
exit()
else:
ans += 1
print(ans)
| n, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
ans = 0
for a in A:
x -= a
if x < 0:
break
else:
ans += 1
if 0 < x:
ans -= 1
print((max(ans, 0)))
| false | 0 | [
"-a = list(map(int, input().split()))",
"-a.sort()",
"+A = list(map(int, input().split()))",
"+A.sort()",
"-if x > sum(a):",
"- print((n - 1))",
"-else:",
"- for _a in a:",
"- x -= _a",
"- if x < 0:",
"- print(ans)",
"- exit()",
"- else:",
"... | false | 0.090354 | 0.0418 | 2.161592 | [
"s984198825",
"s239091562"
] |
u823885866 | p03162 | python | s322624012 | s310015186 | 1,554 | 608 | 41,828 | 56,520 | Accepted | Accepted | 60.88 | import sys
import math
import itertools
import collections
import numpy as np
rl = sys.stdin.readline
n = int(rl())
li = [list(map(int, rl().split())) for _ in range(n)]
dp = np.zeros((n, 3), dtype=int)
dp[0] = li[0]
for i in range(1, n):
a = dp[i-1][1] + li[i][0]
b = dp[i-1][2] + li[i][0]
... | import sys
import math
import itertools
import collections
import numpy as np
rl = sys.stdin.readline
n = int(rl())
li = [list(map(int, rl().split())) for _ in range(n)]
dp = [[0]*3 for _ in range(n)]
dp[0] = li[0]
for i in range(1, n):
a = dp[i-1][1] + li[i][0]
b = dp[i-1][2] + li[i][0]
... | 27 | 27 | 549 | 547 | import sys
import math
import itertools
import collections
import numpy as np
rl = sys.stdin.readline
n = int(rl())
li = [list(map(int, rl().split())) for _ in range(n)]
dp = np.zeros((n, 3), dtype=int)
dp[0] = li[0]
for i in range(1, n):
a = dp[i - 1][1] + li[i][0]
b = dp[i - 1][2] + li[i][0]
dp[i][0] = m... | import sys
import math
import itertools
import collections
import numpy as np
rl = sys.stdin.readline
n = int(rl())
li = [list(map(int, rl().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
dp[0] = li[0]
for i in range(1, n):
a = dp[i - 1][1] + li[i][0]
b = dp[i - 1][2] + li[i][0]
dp[i][0] = m... | false | 0 | [
"-dp = np.zeros((n, 3), dtype=int)",
"+dp = [[0] * 3 for _ in range(n)]"
] | false | 0.456797 | 0.064729 | 7.057087 | [
"s322624012",
"s310015186"
] |
u396495667 | p04044 | python | s172453455 | s885990746 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | n,l =list(map(int, input().split()))
s = [eval(input()) for i in range(n)]
s.sort()
print((''.join(s))) | n,l = list(map(int, input().split()))
s = [eval(input()) for _ in range(n)]
s.sort()
print((''.join(s))) | 4 | 4 | 92 | 93 | n, l = list(map(int, input().split()))
s = [eval(input()) for i in range(n)]
s.sort()
print(("".join(s)))
| n, l = list(map(int, input().split()))
s = [eval(input()) for _ in range(n)]
s.sort()
print(("".join(s)))
| false | 0 | [
"-s = [eval(input()) for i in range(n)]",
"+s = [eval(input()) for _ in range(n)]"
] | false | 0.112262 | 0.036336 | 3.089593 | [
"s172453455",
"s885990746"
] |
u562935282 | p03039 | python | s736246388 | s518768180 | 241 | 205 | 18,960 | 11,384 | Accepted | Accepted | 14.94 | def cmb(n, r):
return fact[n] * inv_fact[r] * inv_fact[n - r] % MOD
MOD = 10 ** 9 + 7
N, M, K = list(map(int, input().split()))
fact = [1]
for i in range(1, N * M - 2 + 1):
fact.append(fact[-1] * i % MOD)
inv_fact = [-1] * (N * M - 1)
inv_fact[-1] = pow(fact[-1], MOD - 2, MOD)
for i in range(... | from collections import defaultdict
mod = 10 ** 9 + 7
memo = defaultdict(int)
def cmb(n, r):
if (n, r) in memo:
return memo[(n, r)]
if n < r or r < 0:
return 0
if r > n - r:
return cmb(n, n - r)
res = f[n] * pow(f[n - r], mod - 2, mod) * pow(f[r], mod - 2,... | 30 | 41 | 578 | 707 | def cmb(n, r):
return fact[n] * inv_fact[r] * inv_fact[n - r] % MOD
MOD = 10**9 + 7
N, M, K = list(map(int, input().split()))
fact = [1]
for i in range(1, N * M - 2 + 1):
fact.append(fact[-1] * i % MOD)
inv_fact = [-1] * (N * M - 1)
inv_fact[-1] = pow(fact[-1], MOD - 2, MOD)
for i in range(N * M - 3, -1, -1):... | from collections import defaultdict
mod = 10**9 + 7
memo = defaultdict(int)
def cmb(n, r):
if (n, r) in memo:
return memo[(n, r)]
if n < r or r < 0:
return 0
if r > n - r:
return cmb(n, n - r)
res = f[n] * pow(f[n - r], mod - 2, mod) * pow(f[r], mod - 2, mod) % mod
memo[(n... | false | 26.829268 | [
"-def cmb(n, r):",
"- return fact[n] * inv_fact[r] * inv_fact[n - r] % MOD",
"+from collections import defaultdict",
"+",
"+mod = 10**9 + 7",
"+memo = defaultdict(int)",
"-MOD = 10**9 + 7",
"-N, M, K = list(map(int, input().split()))",
"-fact = [1]",
"-for i in range(1, N * M - 2 + 1):",
"- ... | false | 0.043418 | 0.146628 | 0.296106 | [
"s736246388",
"s518768180"
] |
u423585790 | p03026 | python | s796170997 | s785554572 | 302 | 249 | 48,860 | 49,116 | Accepted | Accepted | 17.55 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
... | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
... | 108 | 106 | 2,268 | 2,223 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI():
... | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI():
... | false | 1.851852 | [
"- C.sort(reverse=True)",
"- c = deque()",
"- for ci in C:",
"- c.appendleft(ci)",
"+ C.sort()",
"+ c = deque(C)"
] | false | 0.041624 | 0.041315 | 1.007488 | [
"s796170997",
"s785554572"
] |
u072717685 | p02660 | python | s016070651 | s827846952 | 292 | 123 | 9,448 | 9,348 | Accepted | Accepted | 57.88 | import sys
from collections import Counter
def main():
n = int(eval(input()))
def is_prime(n):
for i in range(2, n + 1):
if i * i > n:
break
if n % i == 0:
return False
return n != 1
def prime_dec(n):
i = 2
... | import sys
read = sys.stdin.read
def main():
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= ... | 49 | 38 | 981 | 873 | import sys
from collections import Counter
def main():
n = int(eval(input()))
def is_prime(n):
for i in range(2, n + 1):
if i * i > n:
break
if n % i == 0:
return False
return n != 1
def prime_dec(n):
i = 2
table = [... | import sys
read = sys.stdin.read
def main():
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
... | false | 22.44898 | [
"-from collections import Counter",
"+",
"+read = sys.stdin.read",
"+ def factorization(n):",
"+ arr = []",
"+ temp = n",
"+ for i in range(2, int(-(-(n**0.5) // 1)) + 1):",
"+ if temp % i == 0:",
"+ cnt = 0",
"+ while temp % i == 0:... | false | 0.086412 | 0.060739 | 1.422684 | [
"s016070651",
"s827846952"
] |
u077291787 | p03281 | python | s693132973 | s221723740 | 19 | 17 | 3,060 | 3,064 | Accepted | Accepted | 10.53 | # ABC106B - 105
n = int(eval(input()))
odd = []
odd_divs = []
for i in range(1, n + 1):
if i % 2 == 1:
odd.append(i)
for i in range(len(odd)):
count = 0
for j in range(1, odd[i] + 1):
if odd[i] % j == 0:
count += 1
odd_divs.append(count)
... | # ABC106B - 105
def divisors(x: int) -> set:
"""
Compute divisors of a number.
Args: x (int): an integer to be evaluated.
Returns: divs (set): set of divisors
"""
divs = set()
for i in range(1, int(x ** 0.5) + 1):
if x % i == 0:
divs.add(i), divs.add(x // ... | 17 | 23 | 343 | 504 | # ABC106B - 105
n = int(eval(input()))
odd = []
odd_divs = []
for i in range(1, n + 1):
if i % 2 == 1:
odd.append(i)
for i in range(len(odd)):
count = 0
for j in range(1, odd[i] + 1):
if odd[i] % j == 0:
count += 1
odd_divs.append(count)
print((odd_divs.count(8)))
| # ABC106B - 105
def divisors(x: int) -> set:
"""
Compute divisors of a number.
Args: x (int): an integer to be evaluated.
Returns: divs (set): set of divisors
"""
divs = set()
for i in range(1, int(x**0.5) + 1):
if x % i == 0:
divs.add(i), divs.add(x // i)
return divs... | false | 26.086957 | [
"-n = int(eval(input()))",
"-odd = []",
"-odd_divs = []",
"-for i in range(1, n + 1):",
"- if i % 2 == 1:",
"- odd.append(i)",
"-for i in range(len(odd)):",
"- count = 0",
"- for j in range(1, odd[i] + 1):",
"- if odd[i] % j == 0:",
"- count += 1",
"- odd_d... | false | 0.050189 | 0.050268 | 0.998412 | [
"s693132973",
"s221723740"
] |
u345966487 | p03363 | python | s070235625 | s955986283 | 165 | 130 | 41,492 | 35,712 | Accepted | Accepted | 21.21 | import itertools
import collections
N = int(eval(input()))
A = list(map(int, input().split()))
acum = [0] + list(itertools.accumulate(A))
acount = collections.Counter(acum)
print((sum(n * (n-1) // 2 for n in list(acount.values())))) | from itertools import *
from collections import *
eval(input())
A=list(accumulate(list(map(int,input().split()))))
print((sum(n*(n-1)//2 for n in list(Counter(A+[0]).values())))) | 7 | 5 | 224 | 162 | import itertools
import collections
N = int(eval(input()))
A = list(map(int, input().split()))
acum = [0] + list(itertools.accumulate(A))
acount = collections.Counter(acum)
print((sum(n * (n - 1) // 2 for n in list(acount.values()))))
| from itertools import *
from collections import *
eval(input())
A = list(accumulate(list(map(int, input().split()))))
print((sum(n * (n - 1) // 2 for n in list(Counter(A + [0]).values()))))
| false | 28.571429 | [
"-import itertools",
"-import collections",
"+from itertools import *",
"+from collections import *",
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-acum = [0] + list(itertools.accumulate(A))",
"-acount = collections.Counter(acum)",
"-print((sum(n * (n - 1) // 2 for n in list(a... | false | 0.042008 | 0.046535 | 0.902724 | [
"s070235625",
"s955986283"
] |
u077291787 | p04035 | python | s368312694 | s610373607 | 103 | 74 | 18,156 | 21,836 | Accepted | Accepted | 28.16 | # AGC002C - Knot Puzzle
def main():
N, L = tuple(map(int, input().split()))
A = tuple(map(int, input().split()))
B = [i + j for i, j in zip(A, A[1:])]
for i, (a, b) in enumerate(zip(A, A[1:]), 1):
if a + b >= L:
ans = [i for i in range(1, i)]
ans += [i for i in ra... | # AGC002C - Knot Puzzle
def main():
N, L, *A = list(map(int, open(0).read().split()))
B = [i + j for i, j in zip(A, A[1:])]
x = max(B)
if x >= L: # at least one pair must be equal or greater than L
idx = B.index(x) + 1
# keep the biggest one until the end
ans = [i for i ... | 18 | 17 | 513 | 528 | # AGC002C - Knot Puzzle
def main():
N, L = tuple(map(int, input().split()))
A = tuple(map(int, input().split()))
B = [i + j for i, j in zip(A, A[1:])]
for i, (a, b) in enumerate(zip(A, A[1:]), 1):
if a + b >= L:
ans = [i for i in range(1, i)]
ans += [i for i in range(N - ... | # AGC002C - Knot Puzzle
def main():
N, L, *A = list(map(int, open(0).read().split()))
B = [i + j for i, j in zip(A, A[1:])]
x = max(B)
if x >= L: # at least one pair must be equal or greater than L
idx = B.index(x) + 1
# keep the biggest one until the end
ans = [i for i in range... | false | 5.555556 | [
"- N, L = tuple(map(int, input().split()))",
"- A = tuple(map(int, input().split()))",
"+ N, L, *A = list(map(int, open(0).read().split()))",
"- for i, (a, b) in enumerate(zip(A, A[1:]), 1):",
"- if a + b >= L:",
"- ans = [i for i in range(1, i)]",
"- ans += [i f... | false | 0.037576 | 0.040472 | 0.928461 | [
"s368312694",
"s610373607"
] |
u759412327 | p02959 | python | s171510071 | s676762955 | 142 | 121 | 18,476 | 24,152 | Accepted | Accepted | 14.79 | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
z = 0
for i in range(N):
if B[i]<=A[i]:
z+=B[i]
elif A[i]<B[i]<=A[i]+A[i+1]:
z+=B[i]
A[i+1]-=B[i]-A[i]
else:
z+=A[i]+A[i+1]
A[i+1]=0
print(z) | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for n in range(N):
if B[n]<=A[n]:
ans+=B[n]
elif B[n]<=A[n]+A[n+1]:
ans+=B[n]
A[n+1]-=B[n]-A[n]
else:
ans+=A[n]+A[n+1]
A[n+1] = 0
print(ans) | 16 | 16 | 271 | 278 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
z = 0
for i in range(N):
if B[i] <= A[i]:
z += B[i]
elif A[i] < B[i] <= A[i] + A[i + 1]:
z += B[i]
A[i + 1] -= B[i] - A[i]
else:
z += A[i] + A[i + 1]
A[i + 1] = 0
print(z)
| N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for n in range(N):
if B[n] <= A[n]:
ans += B[n]
elif B[n] <= A[n] + A[n + 1]:
ans += B[n]
A[n + 1] -= B[n] - A[n]
else:
ans += A[n] + A[n + 1]
A[n + 1] = 0
print(ans... | false | 0 | [
"-z = 0",
"-for i in range(N):",
"- if B[i] <= A[i]:",
"- z += B[i]",
"- elif A[i] < B[i] <= A[i] + A[i + 1]:",
"- z += B[i]",
"- A[i + 1] -= B[i] - A[i]",
"+ans = 0",
"+for n in range(N):",
"+ if B[n] <= A[n]:",
"+ ans += B[n]",
"+ elif B[n] <= A[n] + A... | false | 0.066375 | 0.048962 | 1.355649 | [
"s171510071",
"s676762955"
] |
u497805118 | p03212 | python | s195527648 | s728714533 | 155 | 72 | 3,700 | 3,060 | Accepted | Accepted | 53.55 | n = int(eval(input()))
q = [ 3, 5, 7 ]
ans = 0
while len(q) != 0:
x = q.pop(0)
for i in [ 3, 5 , 7]:
y = 10 * x + i
if ( y <= n):
q.append(y)
if '3' in str(y) and '5' in str(y) and '7' in str(y):
ans += 1
print(ans) | n = int(eval(input()))
def dfs(l):
return sum([
# next
dfs(10 * l + i) if (10 * l + i) <= n else 0
for i in [3, 5, 7]] +
# current
[1 if '3' in str(l) and '5' in str(l) and '7' in str(l) else 0]
)
print((dfs(0))) | 13 | 12 | 286 | 269 | n = int(eval(input()))
q = [3, 5, 7]
ans = 0
while len(q) != 0:
x = q.pop(0)
for i in [3, 5, 7]:
y = 10 * x + i
if y <= n:
q.append(y)
if "3" in str(y) and "5" in str(y) and "7" in str(y):
ans += 1
print(ans)
| n = int(eval(input()))
def dfs(l):
return sum(
[
# next
dfs(10 * l + i) if (10 * l + i) <= n else 0
for i in [3, 5, 7]
]
+
# current
[1 if "3" in str(l) and "5" in str(l) and "7" in str(l) else 0]
)
print((dfs(0)))
| false | 7.692308 | [
"-q = [3, 5, 7]",
"-ans = 0",
"-while len(q) != 0:",
"- x = q.pop(0)",
"- for i in [3, 5, 7]:",
"- y = 10 * x + i",
"- if y <= n:",
"- q.append(y)",
"- if \"3\" in str(y) and \"5\" in str(y) and \"7\" in str(y):",
"- ans += 1",
"-print(ans... | false | 0.057477 | 0.058839 | 0.976852 | [
"s195527648",
"s728714533"
] |
u606045429 | p02867 | python | s802781629 | s275943922 | 644 | 534 | 30,864 | 30,860 | Accepted | Accepted | 17.08 | # https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_c
class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return... | # https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_c
class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return... | 50 | 44 | 1,221 | 1,142 | # https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_c
class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return self.data... | # https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_c
class UnionFind:
def __init__(self, size):
self.data = [-1] * size
def find(self, x):
if self.data[x] < 0:
return x
else:
self.data[x] = self.find(self.data[x])
return self.data... | false | 12 | [
"-parents = {uf.find(i) for i in range(N)}",
"-if len(parents) > 1:",
"- print(\"Yes\")",
"- quit()",
"-if any(a <= b for a, b in zip(A[1:], B)):",
"+if uf.size(0) != N or any(a <= b for a, b in zip(A[1:], B)):"
] | false | 0.040745 | 0.038257 | 1.065036 | [
"s802781629",
"s275943922"
] |
u583507988 | p03457 | python | s250247249 | s815682163 | 272 | 234 | 17,720 | 9,176 | Accepted | Accepted | 13.97 | n = int(eval(input()))
t = [0]
x = [0]
y = [0]
for i in range(n):
t_, x_, y_ = list(map(int, input().split()))
t.append(t_)
x.append(x_)
y.append(y_)
for j in range(n):
dt = t[j+1] - t[j]
dx = abs(x[j+1] - x[j])
dy = abs(y[j+1] - y[j])
if dx+dy>dt or dt%2!=(dx+dy)%2:
print('No')
... | n=int(eval(input()))
t=0
x=0
y=0
for i in range(n):
t_,x_,y_=list(map(int,input().split()))
t=abs(t_-t)
x=abs(x_-x)
y=abs(y_-y)
if x+y>t:
print('No')
exit()
if t_%2!=(x_+y_)%2:
print('No')
exit()
print('Yes') | 19 | 17 | 335 | 243 | n = int(eval(input()))
t = [0]
x = [0]
y = [0]
for i in range(n):
t_, x_, y_ = list(map(int, input().split()))
t.append(t_)
x.append(x_)
y.append(y_)
for j in range(n):
dt = t[j + 1] - t[j]
dx = abs(x[j + 1] - x[j])
dy = abs(y[j + 1] - y[j])
if dx + dy > dt or dt % 2 != (dx + dy) % 2:
... | n = int(eval(input()))
t = 0
x = 0
y = 0
for i in range(n):
t_, x_, y_ = list(map(int, input().split()))
t = abs(t_ - t)
x = abs(x_ - x)
y = abs(y_ - y)
if x + y > t:
print("No")
exit()
if t_ % 2 != (x_ + y_) % 2:
print("No")
exit()
print("Yes")
| false | 10.526316 | [
"-t = [0]",
"-x = [0]",
"-y = [0]",
"+t = 0",
"+x = 0",
"+y = 0",
"- t.append(t_)",
"- x.append(x_)",
"- y.append(y_)",
"-for j in range(n):",
"- dt = t[j + 1] - t[j]",
"- dx = abs(x[j + 1] - x[j])",
"- dy = abs(y[j + 1] - y[j])",
"- if dx + dy > dt or dt % 2 != (dx + ... | false | 0.037858 | 0.043813 | 0.864073 | [
"s250247249",
"s815682163"
] |
u509392332 | p02735 | python | s752558873 | s196189864 | 54 | 42 | 5,876 | 3,956 | Accepted | Accepted | 22.22 | H, W = list(map(int, input().split()))
def change(x):
if x == '#':
return 1
else:
return 0
field = list()
for i in range(H):
field.append(list(map(change,[i for i in eval(input())])))
vector = [[1, 0], [0, 1]]
check_list = [[0 for _ in range(W)] for i in range(H)]
check_list[0][... | H, W = list(map(int, input().split()))
def change(x): # 黒なら1, 白なら0 ※しなくてもよい
if x == '#':
return 1
else:
return 0
field = list()
for i in range(H):
field.append(list(map(change,[i for i in eval(input())])))
# 右と横に移動するベクトル
vector = [[1, 0], [0, 1]]
# 座標(i, j)に到達したか確認するリスト 未到... | 44 | 62 | 1,396 | 2,075 | H, W = list(map(int, input().split()))
def change(x):
if x == "#":
return 1
else:
return 0
field = list()
for i in range(H):
field.append(list(map(change, [i for i in eval(input())])))
vector = [[1, 0], [0, 1]]
check_list = [[0 for _ in range(W)] for i in range(H)]
check_list[0][0] = 1
c... | H, W = list(map(int, input().split()))
def change(x): # 黒なら1, 白なら0 ※しなくてもよい
if x == "#":
return 1
else:
return 0
field = list()
for i in range(H):
field.append(list(map(change, [i for i in eval(input())])))
# 右と横に移動するベクトル
vector = [[1, 0], [0, 1]]
# 座標(i, j)に到達したか確認するリスト 未到達: 0 到達: 1
... | false | 29.032258 | [
"-def change(x):",
"+def change(x): # 黒なら1, 白なら0 ※しなくてもよい",
"+# 右と横に移動するベクトル",
"-check_list = [[0 for _ in range(W)] for i in range(H)]",
"+# 座標(i, j)に到達したか確認するリスト 未到達: 0 到達: 1",
"+check_list = [[0 for _ in range(W)] for _ in range(H)]",
"-count_list = [[[0, [0, 0]] for _ in range(W)] for i in range(... | false | 0.214095 | 0.075592 | 2.832228 | [
"s752558873",
"s196189864"
] |
u562935282 | p02899 | python | s629545284 | s554104189 | 295 | 163 | 59,180 | 19,172 | Accepted | Accepted | 44.75 | n = int(eval(input()))
a = tuple(map(int, input().split()))
ans = [-1] * n
for ind, aa in enumerate(a, 1):
ans[aa - 1] = ind
print((*ans))
| n = int(eval(input()))
a = tuple(map(int, input().split()))
b = [x[0] for x in sorted(enumerate(a, 1), key=lambda x: x[1])]
print((*b))
| 7 | 4 | 142 | 136 | n = int(eval(input()))
a = tuple(map(int, input().split()))
ans = [-1] * n
for ind, aa in enumerate(a, 1):
ans[aa - 1] = ind
print((*ans))
| n = int(eval(input()))
a = tuple(map(int, input().split()))
b = [x[0] for x in sorted(enumerate(a, 1), key=lambda x: x[1])]
print((*b))
| false | 42.857143 | [
"-ans = [-1] * n",
"-for ind, aa in enumerate(a, 1):",
"- ans[aa - 1] = ind",
"-print((*ans))",
"+b = [x[0] for x in sorted(enumerate(a, 1), key=lambda x: x[1])]",
"+print((*b))"
] | false | 0.083411 | 0.1445 | 0.577237 | [
"s629545284",
"s554104189"
] |
u392319141 | p03283 | python | s595653230 | s796806970 | 1,232 | 1,122 | 26,080 | 19,148 | Accepted | Accepted | 8.93 | N, M, Q = list(map(int, input().split()))
train = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M) :
L, R = list(map(int, input().split()))
train[L][R] += 1
que = []
for _ in range(Q) :
p, q = list(map(int, input().split()))
que.append((p, q))
# 累積和
S = [[0 for _ in rang... | N, M, Q = map(int, input().split())
LR = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
L, R = map(int, input().split())
LR[L][R] += 1
for l in range(1, N + 1):
for r in range(1, N + 1):
LR[l][r] = LR[l - 1][r] + LR[l][r - 1] - LR[l - 1][r - 1] + LR[l][r]
ans = []
for _ in... | 23 | 19 | 562 | 483 | N, M, Q = list(map(int, input().split()))
train = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for _ in range(M):
L, R = list(map(int, input().split()))
train[L][R] += 1
que = []
for _ in range(Q):
p, q = list(map(int, input().split()))
que.append((p, q))
# 累積和
S = [[0 for _ in range(N + 1)] for _ ... | N, M, Q = map(int, input().split())
LR = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
L, R = map(int, input().split())
LR[L][R] += 1
for l in range(1, N + 1):
for r in range(1, N + 1):
LR[l][r] = LR[l - 1][r] + LR[l][r - 1] - LR[l - 1][r - 1] + LR[l][r]
ans = []
for _ in range(Q):
p,... | false | 17.391304 | [
"-N, M, Q = list(map(int, input().split()))",
"-train = [[0 for _ in range(N + 1)] for _ in range(N + 1)]",
"+N, M, Q = map(int, input().split())",
"+LR = [[0] * (N + 1) for _ in range(N + 1)]",
"- L, R = list(map(int, input().split()))",
"- train[L][R] += 1",
"-que = []",
"-for _ in range(Q):",... | false | 0.043092 | 0.04452 | 0.967942 | [
"s595653230",
"s796806970"
] |
u808427016 | p03558 | python | s021951164 | s494172101 | 91 | 68 | 9,192 | 7,832 | Accepted | Accepted | 25.27 | from collections import deque
def solve(K):
checked = [99999999999] * (K + 1)
queue = deque()
queue.append((1, 1))
checked[1] = 1
while queue:
x, n = queue.popleft()
if x == 0:
return n
_ = (x * 10) % K
if n < checked[_]:
queue.a... | def solve(K):
checked = [False] * K
def calc(x):
while not checked[x]:
checked[x] = True
yield x
x = (x * 10) % K
i = 0
xs = [0]
while 1:
i += 1
ys = []
for x in xs:
for z in calc((x + 1) % K):
... | 24 | 21 | 550 | 448 | from collections import deque
def solve(K):
checked = [99999999999] * (K + 1)
queue = deque()
queue.append((1, 1))
checked[1] = 1
while queue:
x, n = queue.popleft()
if x == 0:
return n
_ = (x * 10) % K
if n < checked[_]:
queue.appendleft((_,... | def solve(K):
checked = [False] * K
def calc(x):
while not checked[x]:
checked[x] = True
yield x
x = (x * 10) % K
i = 0
xs = [0]
while 1:
i += 1
ys = []
for x in xs:
for z in calc((x + 1) % K):
if z == ... | false | 12.5 | [
"-from collections import deque",
"+def solve(K):",
"+ checked = [False] * K",
"+ def calc(x):",
"+ while not checked[x]:",
"+ checked[x] = True",
"+ yield x",
"+ x = (x * 10) % K",
"-def solve(K):",
"- checked = [99999999999] * (K + 1)",
"- qu... | false | 0.150816 | 0.043001 | 3.507253 | [
"s021951164",
"s494172101"
] |
u836939578 | p02548 | python | s542245874 | s567907830 | 145 | 70 | 75,656 | 62,892 | Accepted | Accepted | 51.72 | N = int(eval(input()))
table = [0] * (N+5)
for i in range(1, N+3):
for j in range(i, N+2, i):
table[j] += 1
ans = 0
for i in range(N):
ans += table[i]
print(ans) | N = int(eval(input()))
ans = 0
for i in range(1, N):
ans += (N-1) // i
print(ans) | 12 | 8 | 185 | 89 | N = int(eval(input()))
table = [0] * (N + 5)
for i in range(1, N + 3):
for j in range(i, N + 2, i):
table[j] += 1
ans = 0
for i in range(N):
ans += table[i]
print(ans)
| N = int(eval(input()))
ans = 0
for i in range(1, N):
ans += (N - 1) // i
print(ans)
| false | 33.333333 | [
"-table = [0] * (N + 5)",
"-for i in range(1, N + 3):",
"- for j in range(i, N + 2, i):",
"- table[j] += 1",
"-for i in range(N):",
"- ans += table[i]",
"+for i in range(1, N):",
"+ ans += (N - 1) // i"
] | false | 0.439848 | 0.062344 | 7.055223 | [
"s542245874",
"s567907830"
] |
u200887663 | p03416 | python | s843966320 | s441828649 | 91 | 54 | 2,940 | 9,036 | Accepted | Accepted | 40.66 | a,b=list(map(int,input().split()))
count=0
for i in range(a,b+1):
l1=list(str(i))
l2=l1[::-1]
if l1==l2 :
count+=1
print(count) | #n=int(input())
a,b=list(map(int,input().split()))
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
count=0
for i in range(a,b+1):
istr=str(i)
if istr[0]==istr[4] and istr[1]==istr[3]:
count+=1
print(count)
| 8 | 10 | 138 | 265 | a, b = list(map(int, input().split()))
count = 0
for i in range(a, b + 1):
l1 = list(str(i))
l2 = l1[::-1]
if l1 == l2:
count += 1
print(count)
| # n=int(input())
a, b = list(map(int, input().split()))
# l=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
count = 0
for i in range(a, b + 1):
istr = str(i)
if istr[0] == istr[4] and istr[1] == istr[3]:
count += 1
print(count)
| false | 20 | [
"+# n=int(input())",
"+# l=list(map(int,input().split()))",
"+# l=[list(map(int,input().split())) for i in range(n)]",
"- l1 = list(str(i))",
"- l2 = l1[::-1]",
"- if l1 == l2:",
"+ istr = str(i)",
"+ if istr[0] == istr[4] and istr[1] == istr[3]:"
] | false | 0.05569 | 0.040246 | 1.383728 | [
"s843966320",
"s441828649"
] |
u352558780 | p03231 | python | s305261669 | s289199847 | 25 | 22 | 3,944 | 3,828 | Accepted | Accepted | 12 | import math
N,M = list(map(int,input().split()))
S = eval(input())
T = eval(input())
def lcd(n,m):
return int(n * m / gcd(n,m))
def gcd(n,m):
if n % m == 0:
return m
else:
return gcd(m,n % m)
# return int(m*n/math.gcd(n,m))
def prove(n,m):
n_i = int(n/... | import math
N,M = list(map(int,input().split()))
S = eval(input())
T = eval(input())
def lcd(n,m):
return int(n * m / gcd(n,m))
def gcd(n,m):
if n % m == 0:
return m
else:
return gcd(m,n % m)
# return int(m*n/math.gcd(n,m))
def prove(n,m):
n_i = int(lc... | 36 | 34 | 591 | 575 | import math
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
def lcd(n, m):
return int(n * m / gcd(n, m))
def gcd(n, m):
if n % m == 0:
return m
else:
return gcd(m, n % m)
# return int(m*n/math.gcd(n,m))
def prove(n, m):
n_i = int(n / gcd(n, m))
m_... | import math
N, M = list(map(int, input().split()))
S = eval(input())
T = eval(input())
def lcd(n, m):
return int(n * m / gcd(n, m))
def gcd(n, m):
if n % m == 0:
return m
else:
return gcd(m, n % m)
# return int(m*n/math.gcd(n,m))
def prove(n, m):
n_i = int(lcd(n, m) / n)
m_... | false | 5.555556 | [
"- n_i = int(n / gcd(n, m))",
"- m_i = int(m / gcd(n, m))",
"- n_list, m_list = [], []",
"- for i in range(gcd(n, m)):",
"- n_list += S[i * n_i]",
"- m_list += T[i * m_i]",
"+ n_i = int(lcd(n, m) / n)",
"+ m_i = int(lcd(n, m) / m)",
"+ n_list = [S[m_i * i] for i in... | false | 0.089761 | 0.089257 | 1.005649 | [
"s305261669",
"s289199847"
] |
u922449550 | p03078 | python | s414495018 | s585462714 | 149 | 37 | 17,936 | 4,976 | Accepted | Accepted | 75.17 | # 想定解法2
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
ids = []
for x in range(1, X+1):
for y in range(1, Y+1):
if x*y > K:
... | # 想定解法3
import heapq
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
Q =[]
heapq.heappush(Q, [-(A[0]+B[0]+C[0]), 0, 0, 0])
added_id... | 30 | 30 | 581 | 826 | # 想定解法2
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
ids = []
for x in range(1, X + 1):
for y in range(1, Y + 1):
if x * y > K:
... | # 想定解法3
import heapq
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
Q = []
heapq.heappush(Q, [-(A[0] + B[0] + C[0]), 0, 0, 0])
added_idx = set((0, 0, ... | false | 0 | [
"-# 想定解法2",
"+# 想定解法3",
"+import heapq",
"+",
"-ids = []",
"-for x in range(1, X + 1):",
"- for y in range(1, Y + 1):",
"- if x * y > K:",
"- break",
"- for z in range(1, Z + 1):",
"- if x * y * z <= K:",
"- ids.append((x - 1, y - 1, z - 1)... | false | 0.037817 | 0.047114 | 0.802669 | [
"s414495018",
"s585462714"
] |
u867848444 | p02802 | python | s828564079 | s143532952 | 373 | 336 | 41,756 | 29,088 | Accepted | Accepted | 9.92 | n,m=list(map(int,input().split()))
l=[list(input().split()) for i in range(m)]
from collections import defaultdict
cnt_ac=defaultdict(lambda:0)
cnt_wa=defaultdict(lambda:0)
count_wa=0
count_ac=0
for i in range(m):
if cnt_ac[l[i][0]]==0:
if l[i][1]=='WA':
cnt_wa[l[i][0]]+=1
... | from collections import defaultdict
n,m=list(map(int,input().split()))
p,s=[],[]
for i in range(m):
P,S=input().split()
p.append(int(P))
s.append(S)
pena=0
cnt_ac=defaultdict(lambda :0)
cnt_wa=defaultdict(lambda :0)
for x,y in zip(p,s):
if cnt_ac[x]==0:
if y=='AC':
cnt... | 19 | 21 | 474 | 439 | n, m = list(map(int, input().split()))
l = [list(input().split()) for i in range(m)]
from collections import defaultdict
cnt_ac = defaultdict(lambda: 0)
cnt_wa = defaultdict(lambda: 0)
count_wa = 0
count_ac = 0
for i in range(m):
if cnt_ac[l[i][0]] == 0:
if l[i][1] == "WA":
cnt_wa[l[i][0]] += 1... | from collections import defaultdict
n, m = list(map(int, input().split()))
p, s = [], []
for i in range(m):
P, S = input().split()
p.append(int(P))
s.append(S)
pena = 0
cnt_ac = defaultdict(lambda: 0)
cnt_wa = defaultdict(lambda: 0)
for x, y in zip(p, s):
if cnt_ac[x] == 0:
if y == "AC":
... | false | 9.52381 | [
"-n, m = list(map(int, input().split()))",
"-l = [list(input().split()) for i in range(m)]",
"+n, m = list(map(int, input().split()))",
"+p, s = [], []",
"+for i in range(m):",
"+ P, S = input().split()",
"+ p.append(int(P))",
"+ s.append(S)",
"+pena = 0",
"-count_wa = 0",
"-count_ac = ... | false | 0.045195 | 0.044138 | 1.023936 | [
"s828564079",
"s143532952"
] |
u600402037 | p03073 | python | s811323112 | s256112625 | 895 | 64 | 15,696 | 4,652 | Accepted | Accepted | 92.85 | import numpy as np
S = list(int(x) for x in eval(input()))
L1 = np.array([0 if x % 2 == 0 else 1 for x in range(len(S))] )
L2 = np.array([1 if x % 2 == 0 else 0 for x in range(len(S))])
print((min(sum(np.logical_xor(S, L2)), sum(np.logical_xor(S, L1))))) | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = list(map(int, list(sr())))
count = 0
for i in range(len(S)-1):
if S[i] == S[i+1]:
S[i+1] = 1 - S[i+1]
count += 1
answer = min(count, len(S) - co... | 8 | 16 | 256 | 340 | import numpy as np
S = list(int(x) for x in eval(input()))
L1 = np.array([0 if x % 2 == 0 else 1 for x in range(len(S))])
L2 = np.array([1 if x % 2 == 0 else 0 for x in range(len(S))])
print((min(sum(np.logical_xor(S, L2)), sum(np.logical_xor(S, L1)))))
| # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = list(map(int, list(sr())))
count = 0
for i in range(len(S) - 1):
if S[i] == S[i + 1]:
S[i + 1] = 1 - S[i + 1]
count += 1
answer = min(count, len(S) - count)
pri... | false | 50 | [
"-import numpy as np",
"+# coding: utf-8",
"+import sys",
"-S = list(int(x) for x in eval(input()))",
"-L1 = np.array([0 if x % 2 == 0 else 1 for x in range(len(S))])",
"-L2 = np.array([1 if x % 2 == 0 else 0 for x in range(len(S))])",
"-print((min(sum(np.logical_xor(S, L2)), sum(np.logical_xor(S, L1)))... | false | 0.945261 | 0.036057 | 26.215458 | [
"s811323112",
"s256112625"
] |
u644907318 | p03150 | python | s500911920 | s703006056 | 166 | 63 | 38,256 | 64,872 | Accepted | Accepted | 62.05 | S = input().strip()
N = len(S)
x = "keyence"
n = len(x)
if N<n:
flag = 0
else:
flag = 0
for i in range(7):
for j in range(1,8):
if S[:i]+S[-j:]==x:
flag = 1
break
if flag==1:break
if flag==1:
print("YES")
else:
print("NO") | S = input().strip()
N = len(S)
flag = 0
if S=="keyence":
flag = 1
else:
for i in range(N):
for j in range(i,N):
x = S[:i]
y = S[j+1:]
if x+y=="keyence":
flag = 1
break
if flag==1:break
if flag==1:
print("YES")... | 18 | 18 | 319 | 344 | S = input().strip()
N = len(S)
x = "keyence"
n = len(x)
if N < n:
flag = 0
else:
flag = 0
for i in range(7):
for j in range(1, 8):
if S[:i] + S[-j:] == x:
flag = 1
break
if flag == 1:
break
if flag == 1:
print("YES")
else:
print... | S = input().strip()
N = len(S)
flag = 0
if S == "keyence":
flag = 1
else:
for i in range(N):
for j in range(i, N):
x = S[:i]
y = S[j + 1 :]
if x + y == "keyence":
flag = 1
break
if flag == 1:
break
if flag == 1:
... | false | 0 | [
"-x = \"keyence\"",
"-n = len(x)",
"-if N < n:",
"- flag = 0",
"+flag = 0",
"+if S == \"keyence\":",
"+ flag = 1",
"- flag = 0",
"- for i in range(7):",
"- for j in range(1, 8):",
"- if S[:i] + S[-j:] == x:",
"+ for i in range(N):",
"+ for j in range(i... | false | 0.117351 | 0.037163 | 3.157723 | [
"s500911920",
"s703006056"
] |
u352394527 | p01334 | python | s251580576 | s732707688 | 120 | 110 | 6,672 | 6,672 | Accepted | Accepted | 8.33 | while True:
n = int(eval(input()))
if n == 0:break
to = []
for i in range(n):
line = list(map(int, input().split()))
for j in range(n):
x, y = line[2 * j:2 * j + 2]
to.append(y * n + x)
order = []
used = [False] * (n * n)
def dfs(x):
if used[x]:return
used[x] =... | while True:
n = int(eval(input()))
if n == 0:break
to = []
for i in range(n):
line = list(map(int, input().split()))
for j in range(n):
x, y = line[2 * j:2 * j + 2]
to.append(y * n + x)
order = []
used = [False] * (n * n)
def dfs(x):
if used[x]:return
used[x] =... | 37 | 37 | 761 | 746 | while True:
n = int(eval(input()))
if n == 0:
break
to = []
for i in range(n):
line = list(map(int, input().split()))
for j in range(n):
x, y = line[2 * j : 2 * j + 2]
to.append(y * n + x)
order = []
used = [False] * (n * n)
def dfs(x):
... | while True:
n = int(eval(input()))
if n == 0:
break
to = []
for i in range(n):
line = list(map(int, input().split()))
for j in range(n):
x, y = line[2 * j : 2 * j + 2]
to.append(y * n + x)
order = []
used = [False] * (n * n)
def dfs(x):
... | false | 0 | [
"+ if x in group:",
"+ return True",
"- if x in group:",
"- return True",
"+ used[x] = True",
"- for g in group:",
"- used[g] = True"
] | false | 0.128509 | 0.090216 | 1.424459 | [
"s251580576",
"s732707688"
] |
u279439669 | p02571 | python | s741424092 | s625638301 | 51 | 47 | 9,132 | 9,092 | Accepted | Accepted | 7.84 | def core(s, t):
result = len(t)
for start in range(len(s) - len(t) + 1):
diff = 0
for i in range(len(t)):
if t[i] != s[start + i]:
diff += 1
result = min([diff, result])
return result
if __name__ == "__main__":
strings = [eval(input()) for i in range(2)]
print((core(st... | def subst(S, T)-> int:
lenT = len(T)
result = lenT
for i in range(len(S) - lenT + 1):
# tempS = S[i-lenT:i]
tempResult = 0
for j in range(lenT):
if T[j] != S[j + i]:
tempResult += 1
if tempResult < result:
result = tempResult
return result
if __name__ == "... | 13 | 18 | 336 | 382 | def core(s, t):
result = len(t)
for start in range(len(s) - len(t) + 1):
diff = 0
for i in range(len(t)):
if t[i] != s[start + i]:
diff += 1
result = min([diff, result])
return result
if __name__ == "__main__":
strings = [eval(input()) for i in range... | def subst(S, T) -> int:
lenT = len(T)
result = lenT
for i in range(len(S) - lenT + 1):
# tempS = S[i-lenT:i]
tempResult = 0
for j in range(lenT):
if T[j] != S[j + i]:
tempResult += 1
if tempResult < result:
result = tempResult
retur... | false | 27.777778 | [
"-def core(s, t):",
"- result = len(t)",
"- for start in range(len(s) - len(t) + 1):",
"- diff = 0",
"- for i in range(len(t)):",
"- if t[i] != s[start + i]:",
"- diff += 1",
"- result = min([diff, result])",
"+def subst(S, T) -> int:",
"+ le... | false | 0.038933 | 0.04522 | 0.860974 | [
"s741424092",
"s625638301"
] |
u904612569 | p03160 | python | s516567159 | s685963529 | 132 | 115 | 13,592 | 20,588 | Accepted | Accepted | 12.88 | from sys import stdin as I
from sys import stdout as O
N = int(I.readline())
H = [None] + list(map(int,I.readline().split()))
DP = [None for i in range(N+1)]
DP[1] = 0
DP[2] = abs(H[2]-H[1])
for i in range(3,N+1):DP[i] = min(DP[i-2]+abs(H[i]-H[i-2]),DP[i-1]+abs(H[i]-H[i-1]))
print((DP[N])) | N = int(eval(input()))
h = [*list(map(int, input().split()))]
dp = [0, abs(h[1] - h[0])] + [0] * (N - 2)
for i in range(2, N):
dp[i] = min(abs(h[i] - h[i-1]) + dp[i-1],abs(h[i] - h[i-2]) + dp[i-2])
print((dp[N-1])) | 9 | 6 | 296 | 206 | from sys import stdin as I
from sys import stdout as O
N = int(I.readline())
H = [None] + list(map(int, I.readline().split()))
DP = [None for i in range(N + 1)]
DP[1] = 0
DP[2] = abs(H[2] - H[1])
for i in range(3, N + 1):
DP[i] = min(DP[i - 2] + abs(H[i] - H[i - 2]), DP[i - 1] + abs(H[i] - H[i - 1]))
print((DP[N])... | N = int(eval(input()))
h = [*list(map(int, input().split()))]
dp = [0, abs(h[1] - h[0])] + [0] * (N - 2)
for i in range(2, N):
dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2])
print((dp[N - 1]))
| false | 33.333333 | [
"-from sys import stdin as I",
"-from sys import stdout as O",
"-",
"-N = int(I.readline())",
"-H = [None] + list(map(int, I.readline().split()))",
"-DP = [None for i in range(N + 1)]",
"-DP[1] = 0",
"-DP[2] = abs(H[2] - H[1])",
"-for i in range(3, N + 1):",
"- DP[i] = min(DP[i - 2] + abs(H[i] ... | false | 0.130638 | 0.044387 | 2.94317 | [
"s516567159",
"s685963529"
] |
u813098295 | p02693 | python | s587852691 | s056148220 | 22 | 20 | 9,100 | 9,104 | Accepted | Accepted | 9.09 | K = int(eval(input()))
A, B = list(map(int, input().split()))
print(("OK" if A <= (B // K) * K else "NG")) | K = int(eval(input()))
A, B = list(map(int, input().split()))
print(("OK" if A // K != B // K or A % K == 0 else "NG")) | 4 | 4 | 96 | 109 | K = int(eval(input()))
A, B = list(map(int, input().split()))
print(("OK" if A <= (B // K) * K else "NG"))
| K = int(eval(input()))
A, B = list(map(int, input().split()))
print(("OK" if A // K != B // K or A % K == 0 else "NG"))
| false | 0 | [
"-print((\"OK\" if A <= (B // K) * K else \"NG\"))",
"+print((\"OK\" if A // K != B // K or A % K == 0 else \"NG\"))"
] | false | 0.035749 | 0.035141 | 1.017302 | [
"s587852691",
"s056148220"
] |
u777923818 | p03294 | python | s110691587 | s025796090 | 127 | 18 | 3,316 | 3,316 | Accepted | Accepted | 85.83 | eval(input())
A = list(map(int, input().split()))
ans = 0
x = 1
for a in A:
x *= a
for a in A:
ans += (x-1)%a
print(ans)
| def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
print((sum(A)-N)) | 13 | 4 | 139 | 97 | eval(input())
A = list(map(int, input().split()))
ans = 0
x = 1
for a in A:
x *= a
for a in A:
ans += (x - 1) % a
print(ans)
| def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
print((sum(A) - N))
| false | 69.230769 | [
"-eval(input())",
"-A = list(map(int, input().split()))",
"-ans = 0",
"-x = 1",
"-for a in A:",
"- x *= a",
"-for a in A:",
"- ans += (x - 1) % a",
"-print(ans)",
"+def inpl():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+N = int(eval(input()))",
"+A = inpl()",
"+... | false | 0.036511 | 0.062294 | 0.586103 | [
"s110691587",
"s025796090"
] |
u925782032 | p02586 | python | s142890017 | s420770501 | 673 | 504 | 149,884 | 149,816 | Accepted | Accepted | 25.11 | import sys
from collections import defaultdict
range = xrange
input = raw_input
inp = [int(x) for x in sys.stdin.read().split()]; ii = 0
n = inp[ii]; ii += 1
m = inp[ii]; ii += 1
k = inp[ii]; ii += 1
R = inp[ii + 0: ii + 3 * k: 3]
C = inp[ii + 1: ii + 3 * k: 3]
V = inp[ii + 2: ii + 3 * k: 3]
items = ... | import sys
from collections import defaultdict
range = xrange
input = raw_input
inp = [int(x) for x in sys.stdin.read().split()]; ii = 0
n = inp[ii]; ii += 1
m = inp[ii]; ii += 1
k = inp[ii]; ii += 1
R = inp[ii + 0: ii + 3 * k: 3]
C = inp[ii + 1: ii + 3 * k: 3]
V = inp[ii + 2: ii + 3 * k: 3]
items = ... | 42 | 43 | 1,068 | 1,076 | import sys
from collections import defaultdict
range = xrange
input = raw_input
inp = [int(x) for x in sys.stdin.read().split()]
ii = 0
n = inp[ii]
ii += 1
m = inp[ii]
ii += 1
k = inp[ii]
ii += 1
R = inp[ii + 0 : ii + 3 * k : 3]
C = inp[ii + 1 : ii + 3 * k : 3]
V = inp[ii + 2 : ii + 3 * k : 3]
items = [defaultdict(lis... | import sys
from collections import defaultdict
range = xrange
input = raw_input
inp = [int(x) for x in sys.stdin.read().split()]
ii = 0
n = inp[ii]
ii += 1
m = inp[ii]
ii += 1
k = inp[ii]
ii += 1
R = inp[ii + 0 : ii + 3 * k : 3]
C = inp[ii + 1 : ii + 3 * k : 3]
V = inp[ii + 2 : ii + 3 * k : 3]
items = [defaultdict(lis... | false | 2.325581 | [
"+ itemsr = items[r]",
"- if c in items[r]:",
"- for v in items[r][c]:",
"+ if c in itemsr:",
"+ for v in itemsr[c]:",
"- DP0[c] = max(DP0[c], DP1[c], DP2[c], DP3[c])",
"+ DP0[c] = DP1[c] = DP2[c] = DP3[c]"
] | false | 0.047018 | 0.118631 | 0.396341 | [
"s142890017",
"s420770501"
] |
u795245552 | p02918 | python | s149127994 | s755955530 | 50 | 44 | 3,316 | 3,316 | Accepted | Accepted | 12 | N, K = [int(x) for x in input().split()]
S = str(eval(input()))
Unhappy = {}
Unhappy[1] = 0
Unhappy[2] = 0
for i in range(N):
if i == 0:
if S[i] == 'L':
Unhappy[1] += 1
if i == N - 1:
if S[i] == 'R':
Unhappy[1] += 1
else:
if S[i] == 'R' and S[... | N, K = [int(x) for x in input().split()]
S = str(eval(input()))
a=0
for i in range(N - 1):
if S[i]==S[i + 1]:
a += 1
b = min(N - 1, a + 2 * K)
print(b) | 35 | 9 | 726 | 157 | N, K = [int(x) for x in input().split()]
S = str(eval(input()))
Unhappy = {}
Unhappy[1] = 0
Unhappy[2] = 0
for i in range(N):
if i == 0:
if S[i] == "L":
Unhappy[1] += 1
if i == N - 1:
if S[i] == "R":
Unhappy[1] += 1
else:
if S[i] == "R" and S[i + 1] == "L":
... | N, K = [int(x) for x in input().split()]
S = str(eval(input()))
a = 0
for i in range(N - 1):
if S[i] == S[i + 1]:
a += 1
b = min(N - 1, a + 2 * K)
print(b)
| false | 74.285714 | [
"-Unhappy = {}",
"-Unhappy[1] = 0",
"-Unhappy[2] = 0",
"-for i in range(N):",
"- if i == 0:",
"- if S[i] == \"L\":",
"- Unhappy[1] += 1",
"- if i == N - 1:",
"- if S[i] == \"R\":",
"- Unhappy[1] += 1",
"- else:",
"- if S[i] == \"R\" and S[i +... | false | 0.043434 | 0.074935 | 0.579631 | [
"s149127994",
"s755955530"
] |
u654470292 | p03229 | python | s400063183 | s413012724 | 266 | 149 | 46,300 | 79,612 | Accepted | Accepted | 43.98 | import sys
def input():
return sys.stdin.readline()[:-1]
n=int(eval(input()))
a=[int(eval(input())) for i in range(n)]
a.sort()
if n==2:
print((a[1]-a[0]))
quit()
ans=0
for i in range((n-1)//2):
ans-=a[i]
for i in range((n-2)//2):
ans+=a[n-1-i]
ans*=2
if n%2!=0:
ans+=a[n//2]+a[... | import bisect
import copy
import heapq
import math
import 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))
sys.setrecurs... | 36 | 39 | 589 | 879 | import sys
def input():
return sys.stdin.readline()[:-1]
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
a.sort()
if n == 2:
print((a[1] - a[0]))
quit()
ans = 0
for i in range((n - 1) // 2):
ans -= a[i]
for i in range((n - 2) // 2):
ans += a[n - 1 - i]
ans *= 2
if n % 2 != 0:
... | import bisect
import copy
import heapq
import math
import 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))
sys.setrecursionl... | false | 7.692308 | [
"+import bisect",
"+import copy",
"+import heapq",
"+import math",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+def ruiseki(lst):",
"+ return [0] + list(accumulate(lst))",
"+",
"+",
"+sys.setrec... | false | 0.036096 | 0.035617 | 1.013431 | [
"s400063183",
"s413012724"
] |
u020390084 | p03487 | python | s908044962 | s980599469 | 110 | 80 | 27,820 | 24,244 | Accepted | Accepted | 27.27 | #!/usr/bin/env python3
import sys
import collections
def solve(N: int, a: "List[int]"):
counter = collections.Counter(a)
aset = set(a)
answer = 0
for aa in aset:
answer += (counter[aa]-aa) if counter[aa]>=aa else counter[aa]
print(answer)
return
def main():
def iterat... | #!/usr/bin/env python3
import sys
from collections import Counter
def solve(N: int, a: "List[int]"):
counter = Counter(a)
answer = 0
for key,value in list(counter.items()):
if key >value:
answer += value
else:
answer += value-key
print(answer)
re... | 25 | 27 | 629 | 658 | #!/usr/bin/env python3
import sys
import collections
def solve(N: int, a: "List[int]"):
counter = collections.Counter(a)
aset = set(a)
answer = 0
for aa in aset:
answer += (counter[aa] - aa) if counter[aa] >= aa else counter[aa]
print(answer)
return
def main():
def iterate_tokens... | #!/usr/bin/env python3
import sys
from collections import Counter
def solve(N: int, a: "List[int]"):
counter = Counter(a)
answer = 0
for key, value in list(counter.items()):
if key > value:
answer += value
else:
answer += value - key
print(answer)
return
d... | false | 7.407407 | [
"-import collections",
"+from collections import Counter",
"- counter = collections.Counter(a)",
"- aset = set(a)",
"+ counter = Counter(a)",
"- for aa in aset:",
"- answer += (counter[aa] - aa) if counter[aa] >= aa else counter[aa]",
"+ for key, value in list(counter.items()):",... | false | 0.040045 | 0.039361 | 1.017382 | [
"s908044962",
"s980599469"
] |
u935329231 | p02393 | python | s766778012 | s104284959 | 20 | 10 | 4,188 | 6,344 | Accepted | Accepted | 50 | #! /usr/bin/env python
# coding: utf-8
list = sorted(map(int, input().split()))
for i in list:
print(i, end=' ') | #! /usr/bin/env python
# -*- coding: utf-8 -*-
raw_list = sorted(map(int, input().split()))
print(("%d %d %d") % (raw_list[0], raw_list[1], raw_list[2])) | 6 | 5 | 117 | 160 | #! /usr/bin/env python
# coding: utf-8
list = sorted(map(int, input().split()))
for i in list:
print(i, end=" ")
| #! /usr/bin/env python
# -*- coding: utf-8 -*-
raw_list = sorted(map(int, input().split()))
print(("%d %d %d") % (raw_list[0], raw_list[1], raw_list[2]))
| false | 16.666667 | [
"-# coding: utf-8",
"-list = sorted(map(int, input().split()))",
"-for i in list:",
"- print(i, end=\" \")",
"+# -*- coding: utf-8 -*-",
"+raw_list = sorted(map(int, input().split()))",
"+print((\"%d %d %d\") % (raw_list[0], raw_list[1], raw_list[2]))"
] | false | 0.038445 | 0.036634 | 1.049437 | [
"s766778012",
"s104284959"
] |
u588341295 | p02727 | python | s038994498 | s732641368 | 510 | 442 | 98,336 | 96,424 | Accepted | Accepted | 13.33 | # -*- coding: utf-8 -*-
import sys
from heapq import heapify, heappop, heappush
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d f... | # -*- coding: utf-8 -*-
import sys
from heapq import heapify, heappop, heappush
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d f... | 43 | 40 | 1,060 | 1,006 | # -*- coding: utf-8 -*-
import sys
from heapq import heapify, heappop, heappush
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
retur... | # -*- coding: utf-8 -*-
import sys
from heapq import heapify, heappop, heappush
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
retur... | false | 6.976744 | [
"-C.sort(reverse=1)",
"- mn = heappop(que)",
"- if c > mn:",
"+ if c > que[0]:",
"+ heappop(que)",
"- else:",
"- heappush(que, mn)"
] | false | 0.047506 | 0.148135 | 0.320694 | [
"s038994498",
"s732641368"
] |
u888337853 | p03241 | python | s885655320 | s569974822 | 44 | 40 | 5,564 | 5,092 | Accepted | Accepted | 9.09 | import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
ni = lambda: int(sys.... | import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
ni = lambda: int(sys.... | 54 | 53 | 1,002 | 1,005 | import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
sys.setrecursionlimit(10000001)
INF = 10**16
MOD = 10**9 + 7
ni = lambda: int(sys.stdin.readline())
ns =... | import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
sys.setrecursionlimit(10000001)
INF = 10**16
MOD = 10**9 + 7
ni = lambda: int(sys.stdin.readline())
ns =... | false | 1.851852 | [
"- divisors.sort(reverse=True)",
"+ # divisors.sort(reverse=True)",
"- max_gcd = d",
"- break",
"- print(d)",
"+ max_gcd = max(max_gcd, d)",
"+ print(max_gcd)"
] | false | 0.113077 | 0.00751 | 15.057915 | [
"s885655320",
"s569974822"
] |
u721425712 | p03478 | python | s720164435 | s162086136 | 49 | 31 | 3,404 | 3,060 | Accepted | Accepted | 36.73 | N, A, B = list(map(int, input().split()))
ans = []
def degitsum(x):
string = str(x)
array = list(map(int, string))
return sum(array)
for i in range(N+1):
if A <= degitsum(i) and degitsum(i) <= B:
ans.append(i)
else:
continue
print((sum(ans))) | def degitsum(n):
ans = 0
while n/10 != 0:
ans += n%10
n = int(n/10)
return ans
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
if a <= degitsum(i) <= b:
ans += i
else:
continue
print(ans) | 15 | 17 | 262 | 286 | N, A, B = list(map(int, input().split()))
ans = []
def degitsum(x):
string = str(x)
array = list(map(int, string))
return sum(array)
for i in range(N + 1):
if A <= degitsum(i) and degitsum(i) <= B:
ans.append(i)
else:
continue
print((sum(ans)))
| def degitsum(n):
ans = 0
while n / 10 != 0:
ans += n % 10
n = int(n / 10)
return ans
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
if a <= degitsum(i) <= b:
ans += i
else:
continue
print(ans)
| false | 11.764706 | [
"-N, A, B = list(map(int, input().split()))",
"-ans = []",
"+def degitsum(n):",
"+ ans = 0",
"+ while n / 10 != 0:",
"+ ans += n % 10",
"+ n = int(n / 10)",
"+ return ans",
"-def degitsum(x):",
"- string = str(x)",
"- array = list(map(int, string))",
"- return s... | false | 0.037684 | 0.046324 | 0.813495 | [
"s720164435",
"s162086136"
] |
u678167152 | p03208 | python | s199346235 | s725224552 | 254 | 189 | 7,472 | 13,084 | Accepted | Accepted | 25.59 | N, K = list(map(int, input().split()))
H = [0]*N
for i in range(N):
H[i] = int(eval(input()))
H.sort()
m = H[-1]-H[0]
for i in range(N-K+1):
m = min(m,H[i+K-1]-H[i])
print(m) | def solve():
N, K = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
H.sort()
ans = float('inf')
for i in range(N):
if i+K>N:
break
ans = min(H[i+K-1]-H[i],ans)
return ans
print((solve())) | 10 | 11 | 176 | 236 | N, K = list(map(int, input().split()))
H = [0] * N
for i in range(N):
H[i] = int(eval(input()))
H.sort()
m = H[-1] - H[0]
for i in range(N - K + 1):
m = min(m, H[i + K - 1] - H[i])
print(m)
| def solve():
N, K = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
H.sort()
ans = float("inf")
for i in range(N):
if i + K > N:
break
ans = min(H[i + K - 1] - H[i], ans)
return ans
print((solve()))
| false | 9.090909 | [
"-N, K = list(map(int, input().split()))",
"-H = [0] * N",
"-for i in range(N):",
"- H[i] = int(eval(input()))",
"-H.sort()",
"-m = H[-1] - H[0]",
"-for i in range(N - K + 1):",
"- m = min(m, H[i + K - 1] - H[i])",
"-print(m)",
"+def solve():",
"+ N, K = list(map(int, input().split()))"... | false | 0.072985 | 0.042076 | 1.734608 | [
"s199346235",
"s725224552"
] |
u941047297 | p03380 | python | s310759234 | s239661668 | 145 | 101 | 21,604 | 23,816 | Accepted | Accepted | 30.34 | def main():
n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
m = A.pop()
B = [[a, abs(a - (m / 2))] for a in A]
B.sort(key = lambda x: x[1])
print(('{} {}'. format(m, B[0][0])))
if __name__ == '__main__':
main()
| def main():
n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = [str((m := A.pop())), ]
m /= 2
A = [(a, abs(a - m)) for a in A]
A.sort(key = lambda x: x[1])
ans.append(str(A[0][0]))
print((' '.join(ans)))
if __name__ == '__main__':
main()
| 11 | 13 | 266 | 306 | def main():
n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
m = A.pop()
B = [[a, abs(a - (m / 2))] for a in A]
B.sort(key=lambda x: x[1])
print(("{} {}".format(m, B[0][0])))
if __name__ == "__main__":
main()
| def main():
n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = [
str((m := A.pop())),
]
m /= 2
A = [(a, abs(a - m)) for a in A]
A.sort(key=lambda x: x[1])
ans.append(str(A[0][0]))
print((" ".join(ans)))
if __name__ == "__main__":
main()
| false | 15.384615 | [
"- m = A.pop()",
"- B = [[a, abs(a - (m / 2))] for a in A]",
"- B.sort(key=lambda x: x[1])",
"- print((\"{} {}\".format(m, B[0][0])))",
"+ ans = [",
"+ str((m := A.pop())),",
"+ ]",
"+ m /= 2",
"+ A = [(a, abs(a - m)) for a in A]",
"+ A.sort(key=lambda x: x[1])",
... | false | 0.041649 | 0.043411 | 0.959423 | [
"s310759234",
"s239661668"
] |
u230621983 | p03048 | python | s103545192 | s526030601 | 1,550 | 1,337 | 2,940 | 2,940 | Accepted | Accepted | 13.74 | R, G, B, N = list(map(int, input().split()))
cnt = 0
for r in range(N//R+1):
Rr = R*r
for g in range((N-Rr)//G+1):
if (N-(R*r + G*g)) % B == 0:
cnt += 1
print(cnt) | R, G, B, N = list(map(int, input().split()))
cnt = 0
for r in range(N//R+1):
Rr = R*r
for g in range((N-Rr)//G+1):
if (N-(Rr + G*g)) % B == 0:
cnt += 1
print(cnt) | 9 | 9 | 194 | 193 | R, G, B, N = list(map(int, input().split()))
cnt = 0
for r in range(N // R + 1):
Rr = R * r
for g in range((N - Rr) // G + 1):
if (N - (R * r + G * g)) % B == 0:
cnt += 1
print(cnt)
| R, G, B, N = list(map(int, input().split()))
cnt = 0
for r in range(N // R + 1):
Rr = R * r
for g in range((N - Rr) // G + 1):
if (N - (Rr + G * g)) % B == 0:
cnt += 1
print(cnt)
| false | 0 | [
"- if (N - (R * r + G * g)) % B == 0:",
"+ if (N - (Rr + G * g)) % B == 0:"
] | false | 0.07768 | 0.181852 | 0.427158 | [
"s103545192",
"s526030601"
] |
u828706986 | p03450 | python | s596462403 | s171739739 | 586 | 536 | 55,268 | 70,064 | Accepted | Accepted | 8.53 | import sys
def main():
n, m = list(map(int, sys.stdin.readline().split()))
g = [[] for i in range(n)]
deg = [0] * n
lines = sys.stdin.read().splitlines()
for line in lines:
l, r, d = list(map(int, line.split()))
g[l - 1].append((r - 1, d))
deg[r - 1] += 1
di... | import sys
def main():
n, m = list(map(int, sys.stdin.readline().split()))
g = [[] for i in range(n)]
deg = [0] * n
for i in range(m):
l, r, d = list(map(int, sys.stdin.readline().split()))
g[l - 1].append((r - 1, d))
deg[r - 1] += 1
dis = [-1] * n
for i in ... | 35 | 34 | 860 | 833 | import sys
def main():
n, m = list(map(int, sys.stdin.readline().split()))
g = [[] for i in range(n)]
deg = [0] * n
lines = sys.stdin.read().splitlines()
for line in lines:
l, r, d = list(map(int, line.split()))
g[l - 1].append((r - 1, d))
deg[r - 1] += 1
dis = [-1] * n... | import sys
def main():
n, m = list(map(int, sys.stdin.readline().split()))
g = [[] for i in range(n)]
deg = [0] * n
for i in range(m):
l, r, d = list(map(int, sys.stdin.readline().split()))
g[l - 1].append((r - 1, d))
deg[r - 1] += 1
dis = [-1] * n
for i in range(n):
... | false | 2.857143 | [
"- lines = sys.stdin.read().splitlines()",
"- for line in lines:",
"- l, r, d = list(map(int, line.split()))",
"+ for i in range(m):",
"+ l, r, d = list(map(int, sys.stdin.readline().split()))"
] | false | 0.09393 | 0.068567 | 1.369888 | [
"s596462403",
"s171739739"
] |
u645250356 | p02719 | python | s550680502 | s448306329 | 315 | 38 | 66,156 | 10,212 | Accepted | Accepted | 87.94 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.s... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.std... | 12 | 12 | 387 | 383 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map... | false | 0 | [
"-from heapq import heappop, heappush, heapify",
"-from bisect import bisect_left",
"-import sys, math, itertools, fractions, pprint",
"+from heapq import heappop, heappush",
"+from bisect import bisect_left, bisect_right",
"+import sys, math, itertools, fractions",
"-print((min(n % k, k - (n % k))))",
... | false | 0.037359 | 0.043263 | 0.863522 | [
"s550680502",
"s448306329"
] |
u902973687 | p03164 | python | s000627023 | s332641934 | 1,563 | 716 | 171,720 | 171,372 | Accepted | Accepted | 54.19 | MAX_V = 100100
MAX_N = 101
INF = pow(2, 64)
N, W = list(map(int, input().split()))
w = [0 for _ in range(N)]
v = [0 for _ in range(N)]
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[INF for _ in range(MAX_V)] for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for sum_v... | MAX_V = 100100
MAX_N = 101
INF = pow(2, 60)
N, W = list(map(int, input().split()))
w = [0 for _ in range(N)]
v = [0 for _ in range(N)]
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[INF for _ in range(MAX_V)] for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for sum_v... | 25 | 25 | 713 | 713 | MAX_V = 100100
MAX_N = 101
INF = pow(2, 64)
N, W = list(map(int, input().split()))
w = [0 for _ in range(N)]
v = [0 for _ in range(N)]
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[INF for _ in range(MAX_V)] for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for sum_v in range(MAX_V... | MAX_V = 100100
MAX_N = 101
INF = pow(2, 60)
N, W = list(map(int, input().split()))
w = [0 for _ in range(N)]
v = [0 for _ in range(N)]
for i in range(N):
w[i], v[i] = list(map(int, input().split()))
dp = [[INF for _ in range(MAX_V)] for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for sum_v in range(MAX_V... | false | 0 | [
"-INF = pow(2, 64)",
"+INF = pow(2, 60)"
] | false | 1.164428 | 1.017117 | 1.144832 | [
"s000627023",
"s332641934"
] |
u079022693 | p03208 | python | s177816847 | s850627184 | 229 | 120 | 7,384 | 7,468 | Accepted | Accepted | 47.6 | def main():
N,K=list(map(int,input().split()))
h=[]
for i in range(N):
a=int(eval(input()))
h.append(a)
h.sort()
result=10**10
count=0
for i in range(N-K+1):
count=h[i+K-1]-h[i]
result=min(result,count)
print(result)
if __name__=="__main... | from sys import stdin
def main():
#入力
readline=stdin.readline
n,k=list(map(int,readline().split()))
h=[0]*n
for i in range(n):
h[i]=int(readline())
h.sort()
ans=float("inf")
for i in range(k-1,n):
s=h[i]-h[i-k+1]
ans=min(s,ans)
print(ans)
... | 16 | 19 | 324 | 353 | def main():
N, K = list(map(int, input().split()))
h = []
for i in range(N):
a = int(eval(input()))
h.append(a)
h.sort()
result = 10**10
count = 0
for i in range(N - K + 1):
count = h[i + K - 1] - h[i]
result = min(result, count)
print(result)
if __name_... | from sys import stdin
def main():
# 入力
readline = stdin.readline
n, k = list(map(int, readline().split()))
h = [0] * n
for i in range(n):
h[i] = int(readline())
h.sort()
ans = float("inf")
for i in range(k - 1, n):
s = h[i] - h[i - k + 1]
ans = min(s, ans)
p... | false | 15.789474 | [
"+from sys import stdin",
"+",
"+",
"- N, K = list(map(int, input().split()))",
"- h = []",
"- for i in range(N):",
"- a = int(eval(input()))",
"- h.append(a)",
"+ # 入力",
"+ readline = stdin.readline",
"+ n, k = list(map(int, readline().split()))",
"+ h = [0]... | false | 0.040675 | 0.037066 | 1.097358 | [
"s177816847",
"s850627184"
] |
u585482323 | p02763 | python | s689695838 | s281407456 | 1,122 | 766 | 285,084 | 101,876 | Accepted | Accepted | 31.73 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in... | 103 | 100 | 2,757 | 2,641 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(... | false | 2.912621 | [
"- def __init__(self, size, default, op=operator.add):",
"+ def __init__(self, size, default, op=operator.or_):",
"- s = [SegmentTree(n, 0) for i in range(m)]",
"+ s = SegmentTree(n, 0)",
"- s[k].update(i, 1)",
"+ k = 1 << k",
"+ s.update(i, k)",
"- k = ord(... | false | 0.036862 | 0.100024 | 0.368531 | [
"s689695838",
"s281407456"
] |
u241190159 | p02803 | python | s718670879 | s533584577 | 1,516 | 767 | 4,080 | 62,292 | Accepted | Accepted | 49.41 | import bisect
import math
from queue import Queue
import sys
from copy import copy, deepcopy
from collections import defaultdict, Counter, deque
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.... | import bisect
import math
from queue import Queue
import sys
from copy import copy, deepcopy
from collections import defaultdict, Counter, deque
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.... | 61 | 58 | 1,669 | 1,647 | import bisect
import math
from queue import Queue
import sys
from copy import copy, deepcopy
from collections import defaultdict, Counter, deque
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readli... | import bisect
import math
from queue import Queue
import sys
from copy import copy, deepcopy
from collections import defaultdict, Counter, deque
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readli... | false | 4.918033 | [
"- maze[h + dh][w + dw] = tmp_ret",
"+ maze[h + dh][w + dw] = \"#\""
] | false | 0.05568 | 0.036327 | 1.532756 | [
"s718670879",
"s533584577"
] |
u562541930 | p02984 | python | s564080733 | s113393151 | 234 | 215 | 12,336 | 11,324 | Accepted | Accepted | 8.12 | def main():
N = int(input())
A = input().split()
S = 0
ans = []
for n in range(N):
ans.append(0)
A[n] = int(A[n])
S += A[n]
ans[0] = S
for n in range(N)[1::2]:
ans[0] -= 2 * A[n]
for n in range(N)[1:]:
ans[n] = 2 * A[n - 1] - ans[n - 1... | def main():
N = int(input())
A = input().split()
S = 0
for n in range(N):
A[n] = int(A[n])
S += A[n]
ans = S
for n in range(N)[1::2]:
ans -= 2 * A[n]
prev = ans
print(str(ans) + " ", end="")
for n in range(N)[1:]:
ans = 2 * A[n - 1] - prev... | 22 | 22 | 500 | 489 | def main():
N = int(input())
A = input().split()
S = 0
ans = []
for n in range(N):
ans.append(0)
A[n] = int(A[n])
S += A[n]
ans[0] = S
for n in range(N)[1::2]:
ans[0] -= 2 * A[n]
for n in range(N)[1:]:
ans[n] = 2 * A[n - 1] - ans[n - 1]
for n i... | def main():
N = int(input())
A = input().split()
S = 0
for n in range(N):
A[n] = int(A[n])
S += A[n]
ans = S
for n in range(N)[1::2]:
ans -= 2 * A[n]
prev = ans
print(str(ans) + " ", end="")
for n in range(N)[1:]:
ans = 2 * A[n - 1] - prev
prev... | false | 0 | [
"- ans = []",
"- ans.append(0)",
"- ans[0] = S",
"+ ans = S",
"- ans[0] -= 2 * A[n]",
"+ ans -= 2 * A[n]",
"+ prev = ans",
"+ print(str(ans) + \" \", end=\"\")",
"- ans[n] = 2 * A[n - 1] - ans[n - 1]",
"- for n in range(N):",
"+ ans = 2 * A[n ... | false | 0.080668 | 0.042649 | 1.89143 | [
"s564080733",
"s113393151"
] |
u869919400 | p02803 | python | s239889388 | s966431176 | 295 | 260 | 47,708 | 45,788 | Accepted | Accepted | 11.86 | H, W = list(map(int, input().split()))
l = [eval(input()) for i in range(H)]
from collections import deque
d = [(1, 0), (-1, 0), (0, 1), (0, -1)]
ans = 0
for i in range(H):
for j in range(W):
if l[i][j] == '#':
continue
ll = [[0] * W for _ in range(H)]
q = deque([(i... | H, W = list(map(int, input().split()))
l = [eval(input()) for i in range(H)]
from collections import deque
d = [(1, 0), (-1, 0), (0, 1), (0, -1)]
ans = 0
for i in range(H):
for j in range(W):
if l[i][j] == '#':
continue
cells = [[None] * W for _ in range(H)]
cells[... | 25 | 25 | 784 | 781 | H, W = list(map(int, input().split()))
l = [eval(input()) for i in range(H)]
from collections import deque
d = [(1, 0), (-1, 0), (0, 1), (0, -1)]
ans = 0
for i in range(H):
for j in range(W):
if l[i][j] == "#":
continue
ll = [[0] * W for _ in range(H)]
q = deque([(i, j)])
... | H, W = list(map(int, input().split()))
l = [eval(input()) for i in range(H)]
from collections import deque
d = [(1, 0), (-1, 0), (0, 1), (0, -1)]
ans = 0
for i in range(H):
for j in range(W):
if l[i][j] == "#":
continue
cells = [[None] * W for _ in range(H)]
cells[i][j] = 0
... | false | 0 | [
"- ll = [[0] * W for _ in range(H)]",
"+ cells = [[None] * W for _ in range(H)]",
"+ cells[i][j] = 0",
"- and (y + dy, x + dx) != (i, j)",
"+ and (",
"+ cells[y + dy][x + dx] is None",
"+ or cells[y ... | false | 0.036881 | 0.054018 | 0.682753 | [
"s239889388",
"s966431176"
] |
u057109575 | p02899 | python | s563623759 | s900047164 | 411 | 205 | 68,140 | 96,172 | Accepted | Accepted | 50.12 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = [i + 1for i, v
in sorted(enumerate(A), key=lambda x: x[1])]
print((*ans))
|
N = int(eval(input()))
X = list(map(int, input().split()))
ans = []
for i, _ in sorted(enumerate(X), key=lambda x: x[1]):
ans.append(i + 1)
print((*ans))
| 6 | 9 | 144 | 161 | N = int(eval(input()))
A = list(map(int, input().split()))
ans = [i + 1 for i, v in sorted(enumerate(A), key=lambda x: x[1])]
print((*ans))
| N = int(eval(input()))
X = list(map(int, input().split()))
ans = []
for i, _ in sorted(enumerate(X), key=lambda x: x[1]):
ans.append(i + 1)
print((*ans))
| false | 33.333333 | [
"-A = list(map(int, input().split()))",
"-ans = [i + 1 for i, v in sorted(enumerate(A), key=lambda x: x[1])]",
"+X = list(map(int, input().split()))",
"+ans = []",
"+for i, _ in sorted(enumerate(X), key=lambda x: x[1]):",
"+ ans.append(i + 1)"
] | false | 0.076252 | 0.08936 | 0.853314 | [
"s563623759",
"s900047164"
] |
u150984829 | p00448 | python | s078631675 | s697203890 | 13,620 | 12,490 | 6,916 | 6,912 | Accepted | Accepted | 8.3 | for e in iter(input,'0 0'):
r,_=list(map(int,e.split()))
d=[int(''.join(x),2)for x in zip(*[input().split()for _ in[0]*r])]
a=0
for i in range(1<<r):
b=0
for j in d:
c=bin(i^j).count('1')
b+=max(c,r-c)
a=max(a,b)
print(a)
| for e in iter(input,'0 0'):
r,_=list(map(int,e.split()))
d=[int(''.join(x),2)for x in zip(*[input().split()for _ in[0]*r])]
a=0
for i in range(1<<r):
b=0
for j in d:
c=bin(i^j).count('1')
b+=[r-c,c][c>r//2]
if b>a:a=b
print(a)
| 11 | 11 | 243 | 248 | for e in iter(input, "0 0"):
r, _ = list(map(int, e.split()))
d = [int("".join(x), 2) for x in zip(*[input().split() for _ in [0] * r])]
a = 0
for i in range(1 << r):
b = 0
for j in d:
c = bin(i ^ j).count("1")
b += max(c, r - c)
a = max(a, b)
print(a)... | for e in iter(input, "0 0"):
r, _ = list(map(int, e.split()))
d = [int("".join(x), 2) for x in zip(*[input().split() for _ in [0] * r])]
a = 0
for i in range(1 << r):
b = 0
for j in d:
c = bin(i ^ j).count("1")
b += [r - c, c][c > r // 2]
if b > a:
... | false | 0 | [
"- b += max(c, r - c)",
"- a = max(a, b)",
"+ b += [r - c, c][c > r // 2]",
"+ if b > a:",
"+ a = b"
] | false | 0.050413 | 0.049893 | 1.010429 | [
"s078631675",
"s697203890"
] |
u124498235 | p03105 | python | s985696984 | s853352950 | 20 | 17 | 3,060 | 2,940 | Accepted | Accepted | 15 | a, b, c = list(map(int, input().split()))
if a*c <= b:
print (c)
else:
print((b//a)) | a, b, c = list(map(int, input().split()))
if a*c < b:
print (c)
else:
print((b//a)) | 5 | 5 | 82 | 82 | a, b, c = list(map(int, input().split()))
if a * c <= b:
print(c)
else:
print((b // a))
| a, b, c = list(map(int, input().split()))
if a * c < b:
print(c)
else:
print((b // a))
| false | 0 | [
"-if a * c <= b:",
"+if a * c < b:"
] | false | 0.096522 | 0.036881 | 2.617091 | [
"s985696984",
"s853352950"
] |
u562935282 | p03040 | python | s780841618 | s635632089 | 780 | 609 | 74,308 | 11,148 | Accepted | Accepted | 21.92 | def main():
from heapq import heappush, heappop, heappushpop
import sys
input = sys.stdin.readline
class Median:
def __init__(self):
self.b = 0
self.l = []
self.sum_l = 0
self.r = []
self.sum_r = 0
def update(se... | def main():
from heapq import heappop, heappush
import sys
input = sys.stdin.readline
Q = int(eval(input()))
left = []
right = []
sum_l = 0
sum_r = 0
cnt = 0
b = 0
for _ in range(Q):
query = list(map(int, input().split()))
t = next(query)
... | 48 | 50 | 1,313 | 1,129 | def main():
from heapq import heappush, heappop, heappushpop
import sys
input = sys.stdin.readline
class Median:
def __init__(self):
self.b = 0
self.l = []
self.sum_l = 0
self.r = []
self.sum_r = 0
def update(self, a: int, b:... | def main():
from heapq import heappop, heappush
import sys
input = sys.stdin.readline
Q = int(eval(input()))
left = []
right = []
sum_l = 0
sum_r = 0
cnt = 0
b = 0
for _ in range(Q):
query = list(map(int, input().split()))
t = next(query)
if t == 1:
... | false | 4 | [
"- from heapq import heappush, heappop, heappushpop",
"+ from heapq import heappop, heappush",
"-",
"- class Median:",
"- def __init__(self):",
"- self.b = 0",
"- self.l = []",
"- self.sum_l = 0",
"- self.r = []",
"- self.sum_r... | false | 0.035895 | 0.046731 | 0.768126 | [
"s780841618",
"s635632089"
] |
u562935282 | p03147 | python | s536660690 | s126781929 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | N = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
i = 0
while i < N:
while h[i] == 0:
i += 1
if i == N: break
j = i
if i == N: break
while h[j] > 0:
h[j] -= 1
j += 1
if j == N: break
ans += 1
print(ans)
| n = int(eval(input()))
h = tuple(map(int, input().split()))
ans = 0
cur = 0
for hh in h:
if cur < hh:
ans += hh - cur
cur = hh
else:
cur = hh
print(ans)
| 18 | 12 | 293 | 191 | N = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
i = 0
while i < N:
while h[i] == 0:
i += 1
if i == N:
break
j = i
if i == N:
break
while h[j] > 0:
h[j] -= 1
j += 1
if j == N:
break
ans += 1
print(ans)
| n = int(eval(input()))
h = tuple(map(int, input().split()))
ans = 0
cur = 0
for hh in h:
if cur < hh:
ans += hh - cur
cur = hh
else:
cur = hh
print(ans)
| false | 33.333333 | [
"-N = int(eval(input()))",
"-h = list(map(int, input().split()))",
"+n = int(eval(input()))",
"+h = tuple(map(int, input().split()))",
"-i = 0",
"-while i < N:",
"- while h[i] == 0:",
"- i += 1",
"- if i == N:",
"- break",
"- j = i",
"- if i == N:",
"- ... | false | 0.043467 | 0.036246 | 1.199203 | [
"s536660690",
"s126781929"
] |
u638795007 | p03325 | python | s901461628 | s049784395 | 186 | 74 | 40,432 | 5,488 | Accepted | Accepted | 60.22 | def examC():
N= I()
A = LI()
cur = 0
for i in A:
while(True):
if i % 2 == 0:
i //= 2
cur += 1
else:
break
print(cur)
import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapi... | def ABC67_B():
N, K = LI()
L = LI()
L.sort(reverse=True)
ans = sum(L[:K])
print(ans)
return
def ABC100_C():
def factorization_2(n):
arr = defaultdict(int)
temp = n
i = 2
if temp % i == 0:
cnt = 0
while temp % i == 0:
... | 27 | 76 | 684 | 1,540 | def examC():
N = I()
A = LI()
cur = 0
for i in A:
while True:
if i % 2 == 0:
i //= 2
cur += 1
else:
break
print(cur)
import sys, copy, bisect, itertools, heapq, math
from heapq import heappop, heappush, heapify
from co... | def ABC67_B():
N, K = LI()
L = LI()
L.sort(reverse=True)
ans = sum(L[:K])
print(ans)
return
def ABC100_C():
def factorization_2(n):
arr = defaultdict(int)
temp = n
i = 2
if temp % i == 0:
cnt = 0
while temp % i == 0:
c... | false | 64.473684 | [
"-def examC():",
"+def ABC67_B():",
"+ N, K = LI()",
"+ L = LI()",
"+ L.sort(reverse=True)",
"+ ans = sum(L[:K])",
"+ print(ans)",
"+ return",
"+",
"+",
"+def ABC100_C():",
"+ def factorization_2(n):",
"+ arr = defaultdict(int)",
"+ temp = n",
"+ ... | false | 0.047317 | 0.048112 | 0.983477 | [
"s901461628",
"s049784395"
] |
u197300773 | p03061 | python | s199633190 | s745996843 | 104 | 47 | 14,588 | 14,588 | Accepted | Accepted | 54.81 | def gcd(a,b):
if b>a:
a,b=b,a
while b:
a,b=b, a%b
return a
def cul(n,x):
l=len(x)
b=[x[i] for i in range(l)]
b.pop(n)
tmp=b[0]
for i in range(1,l-1):
tmp=gcd(tmp,b[i])
return tmp
import sys
import math
p=100
N=int(eval(input()))
a=list(... | def gcd(a,b):
if b>a:
a,b=b,a
while b:
a,b=b, a%b
return a
def cul(n,x):
l=len(x)
b=[x[i] for i in range(l)]
b.pop(n)
tmp=b[0]
for i in range(1,l-1):
tmp=gcd(tmp,b[i])
return tmp
import sys
import math
p=100
N=int(eval(input()))
a=list(... | 48 | 41 | 710 | 634 | def gcd(a, b):
if b > a:
a, b = b, a
while b:
a, b = b, a % b
return a
def cul(n, x):
l = len(x)
b = [x[i] for i in range(l)]
b.pop(n)
tmp = b[0]
for i in range(1, l - 1):
tmp = gcd(tmp, b[i])
return tmp
import sys
import math
p = 100
N = int(eval(input()... | def gcd(a, b):
if b > a:
a, b = b, a
while b:
a, b = b, a % b
return a
def cul(n, x):
l = len(x)
b = [x[i] for i in range(l)]
b.pop(n)
tmp = b[0]
for i in range(1, l - 1):
tmp = gcd(tmp, b[i])
return tmp
import sys
import math
p = 100
N = int(eval(input()... | false | 14.583333 | [
"-R = a[p]",
"-for i in range(p, N):",
"- r = gcd(R, a[i])",
"-if r > ans:",
"- for i in range(p):",
"- s = gcd(cul(i, a[:p]), R)",
"- if s > ans:",
"- ans = s",
"+for i in range(p):",
"+ s = gcd(cul(i, a[:p]), a[p])",
"+ if s > ans:",
"+ ans = s"
] | false | 0.055655 | 0.036562 | 1.522235 | [
"s199633190",
"s745996843"
] |
u890870565 | p03160 | python | s978367332 | s108903307 | 527 | 261 | 23,092 | 23,072 | Accepted | Accepted | 50.47 | import numpy as np
Nmax = 10**5
N = int(eval(input()))
h = [int(x) for x in input().split()]
dp = np.zeros(Nmax + 1)
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i]))
print((int(dp[N-1]))) | import numpy as np
Nmax = 10**5
N = int(eval(input()))
h = [int(x) for x in input().split()]
dp = [0] * (Nmax + 1)
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i]))
print((int(dp[N-1])))
| 15 | 15 | 282 | 281 | import numpy as np
Nmax = 10**5
N = int(eval(input()))
h = [int(x) for x in input().split()]
dp = np.zeros(Nmax + 1)
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))
print((int(dp[N - 1])))
| import numpy as np
Nmax = 10**5
N = int(eval(input()))
h = [int(x) for x in input().split()]
dp = [0] * (Nmax + 1)
dp[0] = 0
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))
print((int(dp[N - 1])))
| false | 0 | [
"-dp = np.zeros(Nmax + 1)",
"+dp = [0] * (Nmax + 1)"
] | false | 0.178511 | 0.036242 | 4.925563 | [
"s978367332",
"s108903307"
] |
u226155577 | p03355 | python | s072965601 | s656492327 | 217 | 39 | 42,332 | 4,464 | Accepted | Accepted | 82.03 | s = eval(input())
K = int(eval(input()))
from heapq import heappush, heappop
Q = set()
u = set()
N = len(s)
for i in range(N):
for j in range(i+1, i+K+1):
ss = s[i:j]
if ss in u:
continue
u.add(ss)
Q.add(ss)
if len(Q) > K:
Q.remove(ma... | s = eval(input())
K = int(eval(input()))
Q = set()
L = len(s)
for i in range(L):
for j in range(K):
if i+j+1 <= L:
Q.add(s[i:i+j+1])
print((sorted(Q)[K-1])) | 19 | 9 | 344 | 174 | s = eval(input())
K = int(eval(input()))
from heapq import heappush, heappop
Q = set()
u = set()
N = len(s)
for i in range(N):
for j in range(i + 1, i + K + 1):
ss = s[i:j]
if ss in u:
continue
u.add(ss)
Q.add(ss)
if len(Q) > K:
Q.remove(max(Q))
l = s... | s = eval(input())
K = int(eval(input()))
Q = set()
L = len(s)
for i in range(L):
for j in range(K):
if i + j + 1 <= L:
Q.add(s[i : i + j + 1])
print((sorted(Q)[K - 1]))
| false | 52.631579 | [
"-from heapq import heappush, heappop",
"-",
"-u = set()",
"-N = len(s)",
"-for i in range(N):",
"- for j in range(i + 1, i + K + 1):",
"- ss = s[i:j]",
"- if ss in u:",
"- continue",
"- u.add(ss)",
"- Q.add(ss)",
"- if len(Q) > K:",
"- ... | false | 0.085043 | 0.039006 | 2.180228 | [
"s072965601",
"s656492327"
] |
u102960641 | p03160 | python | s525262744 | s625774160 | 193 | 159 | 13,928 | 13,976 | Accepted | Accepted | 17.62 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [10 ** 9 + 7 for i in range(100010)]
dp[0] = 0
for i in range(1,n):
dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
if i > 1:
dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
print((dp[n-1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
INF = 10 ** 12
dp = [INF] * (n+1) # 初期化
dp[0] = 0 # 初期条件
for i in range(1,n):
dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
if i > 1:
dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
print((dp[n-1])) | 9 | 11 | 265 | 272 | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [10**9 + 7 for i in range(100010)]
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i > 1:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[n - 1]))
| n = int(eval(input()))
h = list(map(int, input().split()))
INF = 10**12
dp = [INF] * (n + 1) # 初期化
dp[0] = 0 # 初期条件
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
if i > 1:
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[n - 1]))
| false | 18.181818 | [
"-dp = [10**9 + 7 for i in range(100010)]",
"-dp[0] = 0",
"+INF = 10**12",
"+dp = [INF] * (n + 1) # 初期化",
"+dp[0] = 0 # 初期条件"
] | false | 0.071832 | 0.041965 | 1.711711 | [
"s525262744",
"s625774160"
] |
u671060652 | p02947 | python | s904459920 | s292892596 | 699 | 516 | 60,760 | 27,964 | Accepted | Accepted | 26.18 | import math
n = int(eval(input()))
dic = {}
def twoKimuawaseSum(num):
result = 0
for i in range(1, num):
result += i
return result
for i in range(n):
string = eval(input())
sortStr = "".join(sorted(string))
if sortStr in dic:
dic[sortStr] += 1
else:
... | import itertools
import math
from scipy.misc import comb
n = int(eval(input()))
dic = {}
for i in range(n):
string = eval(input())
sortStr = "".join(sorted(string))
if sortStr in dic:
dic[sortStr] += 1
else:
dic[sortStr] = 1
sum = 0
for num in list(dic.values()):
if n... | 27 | 20 | 474 | 404 | import math
n = int(eval(input()))
dic = {}
def twoKimuawaseSum(num):
result = 0
for i in range(1, num):
result += i
return result
for i in range(n):
string = eval(input())
sortStr = "".join(sorted(string))
if sortStr in dic:
dic[sortStr] += 1
else:
dic[sortStr] ... | import itertools
import math
from scipy.misc import comb
n = int(eval(input()))
dic = {}
for i in range(n):
string = eval(input())
sortStr = "".join(sorted(string))
if sortStr in dic:
dic[sortStr] += 1
else:
dic[sortStr] = 1
sum = 0
for num in list(dic.values()):
if num == 1:
... | false | 25.925926 | [
"+import itertools",
"+from scipy.misc import comb",
"-",
"-",
"-def twoKimuawaseSum(num):",
"- result = 0",
"- for i in range(1, num):",
"- result += i",
"- return result",
"-",
"-",
"- sum += twoKimuawaseSum(num)",
"+ sum += comb(num, 2, exact=True)"
] | false | 0.036832 | 0.747349 | 0.049284 | [
"s904459920",
"s292892596"
] |
u133936772 | p02714 | python | s066817222 | s954027099 | 1,564 | 756 | 9,144 | 9,184 | Accepted | Accepted | 51.66 | n,s=open(0);n=int(n);c=s.count;print((c('R')*c('G')*c('B')-sum(len(set(s[i:j+1:j-i>>1]))>2for i in range(n)for j in range(i+2,n,2)))) | n,s=open(0);n=int(n);c=s.count;print((c('R')*c('G')*c('B')-sum(s[i]!=s[j]!=s[i+j>>1]!=s[i]for i in range(n)for j in range(i+2,n,2)))) | 1 | 1 | 131 | 131 | n, s = open(0)
n = int(n)
c = s.count
print(
(
c("R") * c("G") * c("B")
- sum(
len(set(s[i : j + 1 : j - i >> 1])) > 2
for i in range(n)
for j in range(i + 2, n, 2)
)
)
)
| n, s = open(0)
n = int(n)
c = s.count
print(
(
c("R") * c("G") * c("B")
- sum(
s[i] != s[j] != s[i + j >> 1] != s[i]
for i in range(n)
for j in range(i + 2, n, 2)
)
)
)
| false | 0 | [
"- len(set(s[i : j + 1 : j - i >> 1])) > 2",
"+ s[i] != s[j] != s[i + j >> 1] != s[i]"
] | false | 0.037494 | 0.037439 | 1.001476 | [
"s066817222",
"s954027099"
] |
u729133443 | p03657 | python | s704659544 | s248407145 | 160 | 27 | 38,384 | 9,008 | Accepted | Accepted | 83.12 | a,b=list(map(int,input().split()));print((('Imp'*((a%3 and b%3 and(a+b)%3)>0)or'P')+'ossible')) | print(((eval(input().replace(*' *'))%3%2*'Imp'or'P')+'ossible')) | 1 | 1 | 87 | 62 | a, b = list(map(int, input().split()))
print((("Imp" * ((a % 3 and b % 3 and (a + b) % 3) > 0) or "P") + "ossible"))
| print(((eval(input().replace(*" *")) % 3 % 2 * "Imp" or "P") + "ossible"))
| false | 0 | [
"-a, b = list(map(int, input().split()))",
"-print(((\"Imp\" * ((a % 3 and b % 3 and (a + b) % 3) > 0) or \"P\") + \"ossible\"))",
"+print(((eval(input().replace(*\" *\")) % 3 % 2 * \"Imp\" or \"P\") + \"ossible\"))"
] | false | 0.118767 | 0.037822 | 3.140128 | [
"s704659544",
"s248407145"
] |
u222668979 | p03111 | python | s870640710 | s192595705 | 208 | 185 | 78,016 | 77,652 | Accepted | Accepted | 11.06 | from itertools import product
def solve(NUM, LIST):
lst = [l[i] for i, t in enumerate(LIST) if t == NUM]
if len(lst) == 0:
return 10 ** 5
ANS = (len(lst) - 1) * 10
ANS += abs(sum(lst) - tgt[NUM])
return ANS
tgt = list(map(int, input().split()))
l = [int(eval(input())) for _ in r... | from itertools import product
def solve(T, PTTN):
lst = [l[i] for i, t in enumerate(PTTN) if t == T]
if lst:
ANS = (len(lst) - 1) * 10
ANS += abs(sum(lst) - tgt[T])
return ANS
return 10 ** 5
tgt = list(map(int, input().split()))
l = [int(eval(input())) for _ in range... | 18 | 20 | 486 | 482 | from itertools import product
def solve(NUM, LIST):
lst = [l[i] for i, t in enumerate(LIST) if t == NUM]
if len(lst) == 0:
return 10**5
ANS = (len(lst) - 1) * 10
ANS += abs(sum(lst) - tgt[NUM])
return ANS
tgt = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(tgt[0]... | from itertools import product
def solve(T, PTTN):
lst = [l[i] for i, t in enumerate(PTTN) if t == T]
if lst:
ANS = (len(lst) - 1) * 10
ANS += abs(sum(lst) - tgt[T])
return ANS
return 10**5
tgt = list(map(int, input().split()))
l = [int(eval(input())) for _ in range(tgt[0])]
ans =... | false | 10 | [
"-def solve(NUM, LIST):",
"- lst = [l[i] for i, t in enumerate(LIST) if t == NUM]",
"- if len(lst) == 0:",
"- return 10**5",
"- ANS = (len(lst) - 1) * 10",
"- ANS += abs(sum(lst) - tgt[NUM])",
"- return ANS",
"+def solve(T, PTTN):",
"+ lst = [l[i] for i, t in enumerate(PTTN)... | false | 0.287914 | 0.496692 | 0.579662 | [
"s870640710",
"s192595705"
] |
u104171359 | p02384 | python | s018134608 | s720248100 | 30 | 20 | 7,764 | 7,836 | Accepted | Accepted | 33.33 | #!usr/bin/env python3
import sys
class Die:
def __init__(self, pips):
self.pips = pips
def move_die(self, direction):
if direction == 'N':
tmp = self.pips[0]
self.pips[0] = self.pips[1]
self.pips[1] = self.pips[5]
self.pips[5] = s... | #!usr/bin/env python3
import sys
class Die:
def __init__(self, pips):
self.pips = pips
def move_die(self, direction):
if direction == 'N':
tmp = self.pips[0]
self.pips[0] = self.pips[1]
self.pips[1] = self.pips[5]
self.pips[5] = s... | 104 | 95 | 2,628 | 2,432 | #!usr/bin/env python3
import sys
class Die:
def __init__(self, pips):
self.pips = pips
def move_die(self, direction):
if direction == "N":
tmp = self.pips[0]
self.pips[0] = self.pips[1]
self.pips[1] = self.pips[5]
self.pips[5] = self.pips[4]
... | #!usr/bin/env python3
import sys
class Die:
def __init__(self, pips):
self.pips = pips
def move_die(self, direction):
if direction == "N":
tmp = self.pips[0]
self.pips[0] = self.pips[1]
self.pips[1] = self.pips[5]
self.pips[5] = self.pips[4]
... | false | 8.653846 | [
"- def get_upside(self):",
"- return self.pips[0]",
"-",
"- def get_frontside(self):",
"- return self.pips[1]",
"-",
"- def get_rightside(self):",
"- return self.pips[2]",
"-",
"- while die.get_frontside() != q_pips[1]:",
"+ while die.pips[1] != q_pips... | false | 0.041117 | 0.044978 | 0.91414 | [
"s018134608",
"s720248100"
] |
u608088992 | p02757 | python | s801657371 | s428087632 | 494 | 327 | 5,412 | 10,040 | Accepted | Accepted | 33.81 | import sys
def solve():
input = sys.stdin.readline
N, P = list(map(int, input().split()))
S = list(input().strip("\n"))
if P == 2 or P == 5:
count = 0
for i in range(N):
s = int(S[N - 1 - i])
if s % P == 0: count += N - i
print(count)
el... | import sys
from collections import defaultdict
def solve():
input = sys.stdin.readline
N, P = list(map(int, input().split()))
S = input().strip("\n")
modSum = 0
modDict = defaultdict(int)
modDict[0] += 1
ans = 0
if P == 2 or P == 5:
for i in range(N):
... | 33 | 33 | 803 | 706 | import sys
def solve():
input = sys.stdin.readline
N, P = list(map(int, input().split()))
S = list(input().strip("\n"))
if P == 2 or P == 5:
count = 0
for i in range(N):
s = int(S[N - 1 - i])
if s % P == 0:
count += N - i
print(count)
... | import sys
from collections import defaultdict
def solve():
input = sys.stdin.readline
N, P = list(map(int, input().split()))
S = input().strip("\n")
modSum = 0
modDict = defaultdict(int)
modDict[0] += 1
ans = 0
if P == 2 or P == 5:
for i in range(N):
if int(S[i]) %... | false | 0 | [
"+from collections import defaultdict",
"- S = list(input().strip(\"\\n\"))",
"+ S = input().strip(\"\\n\")",
"+ modSum = 0",
"+ modDict = defaultdict(int)",
"+ modDict[0] += 1",
"+ ans = 0",
"- count = 0",
"- s = int(S[N - 1 - i])",
"- if s % P == 0:... | false | 0.037115 | 0.072057 | 0.515078 | [
"s801657371",
"s428087632"
] |
u057109575 | p03212 | python | s089666695 | s041806767 | 228 | 150 | 43,624 | 76,368 | Accepted | Accepted | 34.21 | N = int(eval(input()))
def dfs(value, use):
if int(value) > N:
return 0
res = int(use == 0b111)
res += dfs(value + "7", use | 0b001)
res += dfs(value + "5", use | 0b010)
res += dfs(value + "3", use | 0b100)
return res
print((dfs("0", 0)))
|
N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
res = 1 if all(s.count(c) > 0 for c in "357") else 0
for c in "357":
res += dfs(s + c)
return res
print((dfs("0")))
| 14 | 15 | 280 | 219 | N = int(eval(input()))
def dfs(value, use):
if int(value) > N:
return 0
res = int(use == 0b111)
res += dfs(value + "7", use | 0b001)
res += dfs(value + "5", use | 0b010)
res += dfs(value + "3", use | 0b100)
return res
print((dfs("0", 0)))
| N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
res = 1 if all(s.count(c) > 0 for c in "357") else 0
for c in "357":
res += dfs(s + c)
return res
print((dfs("0")))
| false | 6.666667 | [
"-def dfs(value, use):",
"- if int(value) > N:",
"+def dfs(s):",
"+ if int(s) > N:",
"- res = int(use == 0b111)",
"- res += dfs(value + \"7\", use | 0b001)",
"- res += dfs(value + \"5\", use | 0b010)",
"- res += dfs(value + \"3\", use | 0b100)",
"+ res = 1 if all(s.count(c) > 0 ... | false | 0.115539 | 0.147972 | 0.780817 | [
"s089666695",
"s041806767"
] |
u946424121 | p02923 | python | s048298747 | s351900912 | 89 | 67 | 14,528 | 14,252 | Accepted | Accepted | 24.72 | from itertools import groupby
n = int(eval(input()))
h = list(map(int,input().split()))
h_diff = []
for i in range(len(h)-1):
h_diff.append(h[i+1] - h[i])
result = [sum(item) for val, item in groupby([1 if x > 0 else -1 for x in h_diff])] + [0]
print((-min(result))) | ##模範を受けて自分で書いてみる
n = int(eval(input()))
h = list(map(int,input().split()))
cnt = 0 #移動できる分のカウンター
cnt_list =[] #移動できた分を格納しておくカウンター
for i in range(0,len(h)-1):
if h[i] >= h[i+1]:
cnt += 1 #移動できる場合はカウンターに+1
else:
cnt_list.append(cnt) #移動できなくなったら、リストに保存。カウンターを元に戻す。
cnt = 0
cnt_... | 10 | 14 | 277 | 352 | from itertools import groupby
n = int(eval(input()))
h = list(map(int, input().split()))
h_diff = []
for i in range(len(h) - 1):
h_diff.append(h[i + 1] - h[i])
result = [sum(item) for val, item in groupby([1 if x > 0 else -1 for x in h_diff])] + [
0
]
print((-min(result)))
| ##模範を受けて自分で書いてみる
n = int(eval(input()))
h = list(map(int, input().split()))
cnt = 0 # 移動できる分のカウンター
cnt_list = [] # 移動できた分を格納しておくカウンター
for i in range(0, len(h) - 1):
if h[i] >= h[i + 1]:
cnt += 1 # 移動できる場合はカウンターに+1
else:
cnt_list.append(cnt) # 移動できなくなったら、リストに保存。カウンターを元に戻す。
cnt = 0
cnt... | false | 28.571429 | [
"-from itertools import groupby",
"-",
"+##模範を受けて自分で書いてみる",
"-h_diff = []",
"-for i in range(len(h) - 1):",
"- h_diff.append(h[i + 1] - h[i])",
"-result = [sum(item) for val, item in groupby([1 if x > 0 else -1 for x in h_diff])] + [",
"- 0",
"-]",
"-print((-min(result)))",
"+cnt = 0 # 移動... | false | 0.04431 | 0.074824 | 0.592192 | [
"s048298747",
"s351900912"
] |
u729133443 | p02791 | python | s816486240 | s394052115 | 241 | 134 | 65,904 | 17,808 | Accepted | Accepted | 44.4 | _,p=open(0)
m=10**18
c=0
for p in map(int,p.split()):
c+=p<m
m=min(m,p)
print(c) | _,p=open(0)
m=9e9
c=0
for p in map(int,p.split()):c+=p<m;m=min(m,p)
print(c) | 7 | 5 | 94 | 80 | _, p = open(0)
m = 10**18
c = 0
for p in map(int, p.split()):
c += p < m
m = min(m, p)
print(c)
| _, p = open(0)
m = 9e9
c = 0
for p in map(int, p.split()):
c += p < m
m = min(m, p)
print(c)
| false | 28.571429 | [
"-m = 10**18",
"+m = 9e9"
] | false | 0.052594 | 0.056767 | 0.926499 | [
"s816486240",
"s394052115"
] |
u991567869 | p02678 | python | s263257297 | s331609631 | 691 | 388 | 35,044 | 34,548 | Accepted | Accepted | 43.85 | from collections import deque
n, m = list(map(int, input().split()))
rooms = [[] for i in range(n + 1)] #直接行ける部屋を記録
for i in range(m):
a, b = list(map(int, input().split()))
rooms[a].append(b)
rooms[b].append(a)
route = [-1]*(n + 1)
route[1] = 0
q = deque()
q.append(1)
while q:
v = q... | from collections import deque
import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
R = [[] for i in range(N + 1)]
for i in range(M):
A, B = list(map(int, input().split()))
R[A].append(B)
R[B].append(A)
P = [-1] * (N + 1)
P[... | 26 | 28 | 474 | 561 | from collections import deque
n, m = list(map(int, input().split()))
rooms = [[] for i in range(n + 1)] # 直接行ける部屋を記録
for i in range(m):
a, b = list(map(int, input().split()))
rooms[a].append(b)
rooms[b].append(a)
route = [-1] * (n + 1)
route[1] = 0
q = deque()
q.append(1)
while q:
v = q.popleft()
... | from collections import deque
import sys
input = sys.stdin.readline
def main():
N, M = list(map(int, input().split()))
R = [[] for i in range(N + 1)]
for i in range(M):
A, B = list(map(int, input().split()))
R[A].append(B)
R[B].append(A)
P = [-1] * (N + 1)
P[1] = 0
Q =... | false | 7.142857 | [
"+import sys",
"-n, m = list(map(int, input().split()))",
"-rooms = [[] for i in range(n + 1)] # 直接行ける部屋を記録",
"-for i in range(m):",
"- a, b = list(map(int, input().split()))",
"- rooms[a].append(b)",
"- rooms[b].append(a)",
"-route = [-1] * (n + 1)",
"-route[1] = 0",
"-q = deque()",
"... | false | 0.041724 | 0.07715 | 0.540813 | [
"s263257297",
"s331609631"
] |
u590825760 | p02779 | python | s254493308 | s141605121 | 281 | 100 | 25,172 | 25,172 | Accepted | Accepted | 64.41 | n = int(eval(input()))
li = [int(x) for x in input().split()]
nozoki = sorted(list(set(li)))
li.sort()
if (nozoki == li):
print("YES")
else:
print("NO") | n = int(eval(input()))
li = [int(x) for x in input().split()]
a = len(li)
se = set(li)
b = len(se)
if (a==b):
print("YES")
else:
print("NO") | 9 | 9 | 163 | 150 | n = int(eval(input()))
li = [int(x) for x in input().split()]
nozoki = sorted(list(set(li)))
li.sort()
if nozoki == li:
print("YES")
else:
print("NO")
| n = int(eval(input()))
li = [int(x) for x in input().split()]
a = len(li)
se = set(li)
b = len(se)
if a == b:
print("YES")
else:
print("NO")
| false | 0 | [
"-nozoki = sorted(list(set(li)))",
"-li.sort()",
"-if nozoki == li:",
"+a = len(li)",
"+se = set(li)",
"+b = len(se)",
"+if a == b:"
] | false | 0.037023 | 0.092188 | 0.401604 | [
"s254493308",
"s141605121"
] |
u422104747 | p03329 | python | s740805379 | s748026777 | 524 | 197 | 3,956 | 44,912 | Accepted | Accepted | 62.4 | l=[100000 for i in range(100001)]
l[0]=0
dif=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
for i in range(1,100001):
for j in dif:
if j>i:
break
l[i]=min(l[i],l[i-j]+1)
n=int(eval(input()))
print((l[n])) | dp=[100000 for i in range(100001)]
dp[0]=0
l=[1]
i=6
while i<=100000:
l.append(i)
i*=6
i=9
while i<=100000:
l.append(i)
i*=9
for i in range(1,100001):
for j in l:
if j<=i and dp[i-j]+1<dp[i]:
dp[i]=dp[i-j]+1
print((dp[int(eval(input()))]))
| 10 | 16 | 215 | 287 | l = [100000 for i in range(100001)]
l[0] = 0
dif = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]
for i in range(1, 100001):
for j in dif:
if j > i:
break
l[i] = min(l[i], l[i - j] + 1)
n = int(eval(input()))
print((l[n]))
| dp = [100000 for i in range(100001)]
dp[0] = 0
l = [1]
i = 6
while i <= 100000:
l.append(i)
i *= 6
i = 9
while i <= 100000:
l.append(i)
i *= 9
for i in range(1, 100001):
for j in l:
if j <= i and dp[i - j] + 1 < dp[i]:
dp[i] = dp[i - j] + 1
print((dp[int(eval(input()))]))
| false | 37.5 | [
"-l = [100000 for i in range(100001)]",
"-l[0] = 0",
"-dif = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049]",
"+dp = [100000 for i in range(100001)]",
"+dp[0] = 0",
"+l = [1]",
"+i = 6",
"+while i <= 100000:",
"+ l.append(i)",
"+ i *= 6",
"+i = 9",
"+while i <= 100000:",
"... | false | 1.122667 | 0.789326 | 1.422311 | [
"s740805379",
"s748026777"
] |
u077291787 | p03761 | python | s174244822 | s341163880 | 25 | 20 | 3,768 | 3,060 | Accepted | Accepted | 20 | # ABC058C - 怪文書 / Dubious Document (ARC071C)
from string import ascii_lowercase
def main():
N = int(eval(input()))
S = tuple(eval(input()) for _ in range(N))
ans = ""
for i in ascii_lowercase:
if all(i in s for s in S):
ans += i * min(s.count(i) for s in S)
print(ans... | # ABC058C - 怪文書 / Dubious Document (ARC071C)
def main():
N = int(eval(input()))
S = tuple(eval(input()) for _ in range(N))
ans = ""
for i in "abcdefghijklmnopqrstuvwxyz":
if all(i in s for s in S):
ans += i * min(s.count(i) for s in S)
print(ans)
if __name__ == "__ma... | 16 | 13 | 353 | 326 | # ABC058C - 怪文書 / Dubious Document (ARC071C)
from string import ascii_lowercase
def main():
N = int(eval(input()))
S = tuple(eval(input()) for _ in range(N))
ans = ""
for i in ascii_lowercase:
if all(i in s for s in S):
ans += i * min(s.count(i) for s in S)
print(ans)
if __na... | # ABC058C - 怪文書 / Dubious Document (ARC071C)
def main():
N = int(eval(input()))
S = tuple(eval(input()) for _ in range(N))
ans = ""
for i in "abcdefghijklmnopqrstuvwxyz":
if all(i in s for s in S):
ans += i * min(s.count(i) for s in S)
print(ans)
if __name__ == "__main__":
... | false | 18.75 | [
"-from string import ascii_lowercase",
"-",
"-",
"- for i in ascii_lowercase:",
"+ for i in \"abcdefghijklmnopqrstuvwxyz\":"
] | false | 0.054871 | 0.047559 | 1.153743 | [
"s174244822",
"s341163880"
] |
u285891772 | p02596 | python | s881398376 | s886893506 | 1,993 | 421 | 17,844 | 72,804 | Accepted | Accepted | 78.88 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | 42 | 35 | 1,223 | 1,127 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
gcd,
)
from itertools import (
accumulate,
permutations,
combinations,
... | false | 16.666667 | [
"-tmp = 7",
"-ans = 1",
"-p = 1",
"-mo = tmp % K",
"-checked = [0] * (K + 1)",
"-checked[mo] = 1",
"-while mo != 0:",
"- mo += 7 * pow(10, p, K)",
"- mo %= K",
"- p += 1",
"- if checked[mo]:",
"- print((-1))",
"+a = 0",
"+for i in range(K):",
"+ a = (a + 7 * pow(10,... | false | 0.399052 | 0.38941 | 1.02476 | [
"s881398376",
"s886893506"
] |
u597455618 | p02642 | python | s644091589 | s584853059 | 381 | 250 | 42,956 | 42,956 | Accepted | Accepted | 34.38 | from sys import stdin
n = int(eval(input()))
a = list(map(int, stdin.readline().split()))
a.sort()
amax = max(a)+1
e = [True]*amax
Alice = set()
Bob = set()
ans = 0
for i in range(n):
if e[a[i]] == True:
Alice.add(a[i])
for j in range(a[i], amax, a[i]):
e[j] = False
e... | def main():
from sys import stdin
n = int(eval(input()))
a = list(map(int, stdin.readline().split()))
a.sort()
amax = max(a)+1
e = [True]*amax
Alice = set()
Bob = set()
ans = 0
for i in range(n):
if e[a[i]] == True:
Alice.add(a[i])
... | 20 | 23 | 399 | 532 | from sys import stdin
n = int(eval(input()))
a = list(map(int, stdin.readline().split()))
a.sort()
amax = max(a) + 1
e = [True] * amax
Alice = set()
Bob = set()
ans = 0
for i in range(n):
if e[a[i]] == True:
Alice.add(a[i])
for j in range(a[i], amax, a[i]):
e[j] = False
else:
... | def main():
from sys import stdin
n = int(eval(input()))
a = list(map(int, stdin.readline().split()))
a.sort()
amax = max(a) + 1
e = [True] * amax
Alice = set()
Bob = set()
ans = 0
for i in range(n):
if e[a[i]] == True:
Alice.add(a[i])
for j in ra... | false | 13.043478 | [
"-from sys import stdin",
"+def main():",
"+ from sys import stdin",
"-n = int(eval(input()))",
"-a = list(map(int, stdin.readline().split()))",
"-a.sort()",
"-amax = max(a) + 1",
"-e = [True] * amax",
"-Alice = set()",
"-Bob = set()",
"-ans = 0",
"-for i in range(n):",
"- if e[a[i]] =... | false | 0.03879 | 0.038076 | 1.018766 | [
"s644091589",
"s584853059"
] |
u670180528 | p03945 | python | s922380783 | s375887036 | 27 | 18 | 3,964 | 3,188 | Accepted | Accepted | 33.33 | from itertools import*;print((len([k for k,g in groupby(eval(input()))])-1)) | x=eval(input());print((x.count("WB")+x.count("BW"))) | 1 | 1 | 68 | 44 | from itertools import *
print((len([k for k, g in groupby(eval(input()))]) - 1))
| x = eval(input())
print((x.count("WB") + x.count("BW")))
| false | 0 | [
"-from itertools import *",
"-",
"-print((len([k for k, g in groupby(eval(input()))]) - 1))",
"+x = eval(input())",
"+print((x.count(\"WB\") + x.count(\"BW\")))"
] | false | 0.043414 | 0.04359 | 0.995952 | [
"s922380783",
"s375887036"
] |
u699089116 | p03200 | python | s197823850 | s155587698 | 185 | 107 | 41,180 | 12,580 | Accepted | Accepted | 42.16 | s = eval(input())
ans = 0
b_count = 0
for i,c in enumerate(s):
if c == "W":
ans += b_count
else:
b_count += 1
print(ans) | S = eval(input())
b_cumsum = [0] * len(S)
now = 0
for i in range(len(S)):
if S[i] == "B":
b_cumsum[i] = now + 1
now += 1
else:
b_cumsum[i] = now
S = S[::-1]
b_cumsum = b_cumsum[::-1]
ans = 0
for i, s in enumerate(S):
if s == "W":
ans += b_cumsum[i]
print(... | 11 | 19 | 150 | 319 | s = eval(input())
ans = 0
b_count = 0
for i, c in enumerate(s):
if c == "W":
ans += b_count
else:
b_count += 1
print(ans)
| S = eval(input())
b_cumsum = [0] * len(S)
now = 0
for i in range(len(S)):
if S[i] == "B":
b_cumsum[i] = now + 1
now += 1
else:
b_cumsum[i] = now
S = S[::-1]
b_cumsum = b_cumsum[::-1]
ans = 0
for i, s in enumerate(S):
if s == "W":
ans += b_cumsum[i]
print(ans)
| false | 42.105263 | [
"-s = eval(input())",
"+S = eval(input())",
"+b_cumsum = [0] * len(S)",
"+now = 0",
"+for i in range(len(S)):",
"+ if S[i] == \"B\":",
"+ b_cumsum[i] = now + 1",
"+ now += 1",
"+ else:",
"+ b_cumsum[i] = now",
"+S = S[::-1]",
"+b_cumsum = b_cumsum[::-1]",
"-b_count... | false | 0.044524 | 0.044872 | 0.992255 | [
"s197823850",
"s155587698"
] |
u674574659 | p03775 | python | s396836389 | s576237464 | 101 | 34 | 3,060 | 3,060 | Accepted | Accepted | 66.34 | N = int(eval(input()))
ans = float("inf")
c = 1
while c <= int(N**(1/2)//1):
if N%c == 0:
ans = min(ans,max(len(str(c)),len(str(N//c))))
c += 1
print(ans) | N = int(eval(input()))
ans = float("inf")
for i in range(1,int(N**(1/2)//1)+1):
if N%i == 0:
ans = min(ans,len(str(N//i)))
print(ans) | 8 | 6 | 165 | 138 | N = int(eval(input()))
ans = float("inf")
c = 1
while c <= int(N ** (1 / 2) // 1):
if N % c == 0:
ans = min(ans, max(len(str(c)), len(str(N // c))))
c += 1
print(ans)
| N = int(eval(input()))
ans = float("inf")
for i in range(1, int(N ** (1 / 2) // 1) + 1):
if N % i == 0:
ans = min(ans, len(str(N // i)))
print(ans)
| false | 25 | [
"-c = 1",
"-while c <= int(N ** (1 / 2) // 1):",
"- if N % c == 0:",
"- ans = min(ans, max(len(str(c)), len(str(N // c))))",
"- c += 1",
"+for i in range(1, int(N ** (1 / 2) // 1) + 1):",
"+ if N % i == 0:",
"+ ans = min(ans, len(str(N // i)))"
] | false | 0.073876 | 0.052446 | 1.408596 | [
"s396836389",
"s576237464"
] |
u790710233 | p03645 | python | s279485787 | s967199735 | 639 | 586 | 18,992 | 18,892 | Accepted | Accepted | 8.29 | n, m = list(map(int, input().split()))
transit_a = set()
transit_b = set()
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
transit_b |= {b}
elif b == n:
transit_a |= {a}
print(('POSSIBLE' if len(transit_a & transit_b) else 'IMPOSSIBLE')) | n, m = list(map(int, input().split()))
transit_a = set()
transit_b = set()
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
transit_b.add(b)
elif b == n:
transit_a.add(a)
print(('POSSIBLE' if len(transit_a & transit_b) else 'IMPOSSIBLE'))
| 11 | 11 | 283 | 284 | n, m = list(map(int, input().split()))
transit_a = set()
transit_b = set()
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
transit_b |= {b}
elif b == n:
transit_a |= {a}
print(("POSSIBLE" if len(transit_a & transit_b) else "IMPOSSIBLE"))
| n, m = list(map(int, input().split()))
transit_a = set()
transit_b = set()
for _ in range(m):
a, b = list(map(int, input().split()))
if a == 1:
transit_b.add(b)
elif b == n:
transit_a.add(a)
print(("POSSIBLE" if len(transit_a & transit_b) else "IMPOSSIBLE"))
| false | 0 | [
"- transit_b |= {b}",
"+ transit_b.add(b)",
"- transit_a |= {a}",
"+ transit_a.add(a)"
] | false | 0.038176 | 0.053466 | 0.714033 | [
"s279485787",
"s967199735"
] |
u723711163 | p02803 | python | s067891488 | s920646370 | 594 | 242 | 3,188 | 43,740 | Accepted | Accepted | 59.26 | row,col=list(map(int,input().split()))
maze=[list(eval(input())) for _ in range(row)]
result = []
def create_next_adj_list(point):
cur_x, cur_y, cur_depth = point
return [(cur_x, cur_y+1, cur_depth+1), (cur_x+1, cur_y, cur_depth+1), (cur_x, cur_y-1, cur_depth+1), (cur_x-1, cur_y, cur_depth+1)]
for r in ... | from collections import deque
H,W = list(map(int,input().split()))
maze = []
for _ in range(H):
maze.append(list(eval(input())))
res = 0
move = [(1,0),(0,1),(0,-1),(-1,0)]
for i in range(H):
for j in range(W):
if maze[i][j] == ".":
visited = [[False]*W for _ in range(H) ]
q = deque([(i,... | 29 | 30 | 907 | 771 | row, col = list(map(int, input().split()))
maze = [list(eval(input())) for _ in range(row)]
result = []
def create_next_adj_list(point):
cur_x, cur_y, cur_depth = point
return [
(cur_x, cur_y + 1, cur_depth + 1),
(cur_x + 1, cur_y, cur_depth + 1),
(cur_x, cur_y - 1, cur_depth + 1),
... | from collections import deque
H, W = list(map(int, input().split()))
maze = []
for _ in range(H):
maze.append(list(eval(input())))
res = 0
move = [(1, 0), (0, 1), (0, -1), (-1, 0)]
for i in range(H):
for j in range(W):
if maze[i][j] == ".":
visited = [[False] * W for _ in range(H)]
... | false | 3.333333 | [
"-row, col = list(map(int, input().split()))",
"-maze = [list(eval(input())) for _ in range(row)]",
"-result = []",
"+from collections import deque",
"-",
"-def create_next_adj_list(point):",
"- cur_x, cur_y, cur_depth = point",
"- return [",
"- (cur_x, cur_y + 1, cur_depth + 1),",
"-... | false | 0.041263 | 0.040877 | 1.009446 | [
"s067891488",
"s920646370"
] |
u644907318 | p02755 | python | s375222386 | s785902339 | 188 | 64 | 38,896 | 62,188 | Accepted | Accepted | 65.96 | A,B = list(map(int,input().split()))
a1 = A/0.08
a2 = (A+1)/0.08
X = []
for i in range(13,1263):
if a1<=i<a2:
X.append(i)
b1 = B/0.1
b2 = (B+1)/0.1
x = -1
for y in X:
if b1<=y<b2:
x = y
break
print(x) | A,B = list(map(int,input().split()))
flag = 0
for i in range(1,1001):
if int(i*0.08)==A and int(i*0.1)==B:
ans = i
flag = 1
break
if flag==0:
print((-1))
else:
print(ans) | 15 | 11 | 240 | 208 | A, B = list(map(int, input().split()))
a1 = A / 0.08
a2 = (A + 1) / 0.08
X = []
for i in range(13, 1263):
if a1 <= i < a2:
X.append(i)
b1 = B / 0.1
b2 = (B + 1) / 0.1
x = -1
for y in X:
if b1 <= y < b2:
x = y
break
print(x)
| A, B = list(map(int, input().split()))
flag = 0
for i in range(1, 1001):
if int(i * 0.08) == A and int(i * 0.1) == B:
ans = i
flag = 1
break
if flag == 0:
print((-1))
else:
print(ans)
| false | 26.666667 | [
"-a1 = A / 0.08",
"-a2 = (A + 1) / 0.08",
"-X = []",
"-for i in range(13, 1263):",
"- if a1 <= i < a2:",
"- X.append(i)",
"-b1 = B / 0.1",
"-b2 = (B + 1) / 0.1",
"-x = -1",
"-for y in X:",
"- if b1 <= y < b2:",
"- x = y",
"+flag = 0",
"+for i in range(1, 1001):",
"+ ... | false | 0.078536 | 0.041548 | 1.890239 | [
"s375222386",
"s785902339"
] |
u526094365 | p02659 | python | s449392447 | s641004109 | 27 | 24 | 10,004 | 9,168 | Accepted | Accepted | 11.11 | from decimal import Decimal
A, B = list(map(Decimal, input().split()))
print((int(A*B)))
| A, B = list(map(str, input().split()))
A = int(A)
B = int(''.join(B.split('.')))
print((A*B//100))
| 4 | 5 | 85 | 96 | from decimal import Decimal
A, B = list(map(Decimal, input().split()))
print((int(A * B)))
| A, B = list(map(str, input().split()))
A = int(A)
B = int("".join(B.split(".")))
print((A * B // 100))
| false | 20 | [
"-from decimal import Decimal",
"-",
"-A, B = list(map(Decimal, input().split()))",
"-print((int(A * B)))",
"+A, B = list(map(str, input().split()))",
"+A = int(A)",
"+B = int(\"\".join(B.split(\".\")))",
"+print((A * B // 100))"
] | false | 0.045582 | 0.043999 | 1.035976 | [
"s449392447",
"s641004109"
] |
u814986259 | p03425 | python | s969998267 | s073961229 | 188 | 149 | 12,344 | 10,112 | Accepted | Accepted | 20.74 | import fractions
import itertools
N = int(eval(input()))
M =[]
A = []
R = []
C = []
H = []
for i in range(N):
name = eval(input())
initial = name[0]
if initial == "M":
M.append(name)
elif initial == "A":
A.append(name)
elif initial == "R":
R.append(name)
... | from itertools import combinations
import collections
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
table = collections.defaultdict(int)
for x in S:
table[x[0]] += 1
tmp = ["M", "A", "R", "C", "H"]
ans = 0
for x in combinations(tmp, 3):
ans += table[x[0]]*table[x[1]]*table[x[2]]... | 53 | 16 | 812 | 321 | import fractions
import itertools
N = int(eval(input()))
M = []
A = []
R = []
C = []
H = []
for i in range(N):
name = eval(input())
initial = name[0]
if initial == "M":
M.append(name)
elif initial == "A":
A.append(name)
elif initial == "R":
R.append(name)
elif initial ==... | from itertools import combinations
import collections
N = int(eval(input()))
S = [eval(input()) for i in range(N)]
table = collections.defaultdict(int)
for x in S:
table[x[0]] += 1
tmp = ["M", "A", "R", "C", "H"]
ans = 0
for x in combinations(tmp, 3):
ans += table[x[0]] * table[x[1]] * table[x[2]]
print(ans)
| false | 69.811321 | [
"-import fractions",
"-import itertools",
"+from itertools import combinations",
"+import collections",
"-M = []",
"-A = []",
"-R = []",
"-C = []",
"-H = []",
"-for i in range(N):",
"- name = eval(input())",
"- initial = name[0]",
"- if initial == \"M\":",
"- M.append(name)... | false | 0.039545 | 0.048106 | 0.822032 | [
"s969998267",
"s073961229"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.