problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02660 | s537565619 | Wrong Answer | import math
N=int(input())
ans,n = 0,N
for i in range(2,int(math.sqrt(N))+1):
ii=i
if n%ii==0:
ans+=1
n=n//ii
ii*=i
if n==N:
ans=1
if N==1:
ans=0
print(ans) |
p03795 | s486679566 | Accepted | N=int(input())
print(800*N-(N//15)*200) |
p02772 | s544707599 | Accepted | N=int(input())
A=list(map(int,input().split()))
for a in A:
if a%2==0:
if a%3==0 or a%5==0:
continue
else:
print("DENIED")
exit()
print("APPROVED")
|
p03627 | s657085352 | Accepted | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c = Counter(a)
m1=0
m2=0
m3=0
for k,v in c.items():
if v>1:
if k>=m1:
m2=m1
m1=k
elif m2<k:
m2=k
if v>3 and k>m3:
m3=k
print(max(m1*m2,m3**2))
|
p02873 | s962876434 | Accepted | S = input()
ans = 0
tmpl = 0
tmpr = 0
for i in range(len(S) - 1):
if S[i] == '<':
tmpl += 1
else:
tmpr += 1
if S[i + 1] == '<':
x = max(tmpl, tmpr)
y = min(tmpl, tmpr)
ans += (1 + x) * x // 2 + y * (y - 1) // 2
tmpl = 0
tmpr = 0
if S[-1] == '<':
tmpl += 1
else:
tmpr += 1
x = max(tmpl, tmpr)
y = min(tmpl, tmpr)
ans += (1 + x) * x // 2 + y * (y - 1) // 2
print(ans) |
p02866 | s212953662 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N = int(input())
Ds = list(mapint())
if Ds[0]!=0:
print(0)
exit(0)
Ds.sort()
mod = 998244353
from collections import Counter
c = Counter(Ds)
dmax = Ds[-1]
if c[0]>1:
print(0)
else:
ans = 1
for i in range(1, dmax+1):
ans *= pow(c[i-1], c[i], mod)
ans %= mod
print(ans) |
p02699 | s311431987 | Accepted | [S, W] = list(map(int, input().split()))
if S > W:
print("safe")
else:
print("unsafe")
|
p03352 | s512953450 | Accepted | x = int(input())
print(sorted([b ** p if b ** p <= x else 1 for b in range(1, 1001) for p in range(2, 11)])[-1])
|
p03745 | s370502062 | Accepted | N = int(input())
A = list(map(int, input().split()))
ans = 1
inc = None
for i in range(N-1):
if inc is None:
if A[i] != A[i+1]:
inc = A[i] < A[i+1]
continue
if inc:
if A[i] > A[i+1]:
ans += 1
inc = None
else:
if A[i] < A[i+1]:
ans += 1
inc = None
print(ans)
|
p03607 | s863893685 | Wrong Answer | N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
odd = 0
count = 1
a = A[0]
for i in A[1:]:
if i == a:
count += 1
else:
a = i
if count % 2 == 1:
odd += 1
count = 1
print(odd)
|
p02882 | s742823572 | Wrong Answer | import math
a, b, x = map(int, input().split())
if x >= a*a*b/2:
l = 2*(b - (x/a**2))
theta = math.atan(l/a)
else:
l = x / (a*b)
theta = math.atan(b/l)
print(math.degrees(theta))
|
p02832 | s940479672 | Accepted | n = int(input())
a = list(map(int,input().split()))
r = 0
index = 0
ans = 0
for i in range(n) :
r += 1
for j in range(n) :
if index >= n :
break
if a[index] == r :
index += 1
break
ans += 1
index += 1
if ans == n :
print(-1)
else :
print(ans) |
p02847 | s905606324 | Accepted | s = input()
if s == 'SUN':
print(7)
elif s == 'MON':
print(6)
elif s == 'TUE':
print(5)
elif s == 'WED':
print(4)
elif s == 'THU':
print(3)
elif s == 'FRI':
print(2)
else:
print(1) |
p02924 | s663083042 | Wrong Answer | N = int(input())
print(int(N*(N-1)/2))
|
p02553 | s738028306 | Accepted | a,b,c,d = map(int,input().split())
ac = a*c
bc = b*c
ad = a*d
bd = b*d
print(max([ac,bc,ad,bd])) |
p02755 | s067116939 | Wrong Answer | A,B = map(int,input().split())
x = int((100*A)/8)
y = int((100*B)/10)
while (int((x-1)*0.08) == A)&(int((x-1)*0.1) == B):
x -= 1
while (int((y-1)*0.08) == A)&(int((y-1)*0.1) == B):
y -= 1
if(int(x*0.08) == A)&(int(x*0.1) == B):
print(x)
elif(int(y*0.08) == A)&(int(y*0.1) == B):
print(y)
else:
print("-1") |
p02861 | s290057108 | Accepted | import math
from itertools import permutations
def f(i, j):
return ((XY[i][0] - XY[j][0]) ** 2 + (XY[i][1] - XY[j][1]) ** 2) ** .5
n = int(input())
XY = [list(map(int, input().split())) for _ in range(n)]
ptn = permutations(range(n))
diff = 0
for p in ptn:
diff += sum([f(i, j) for i, j in zip(p, p[1:])])
ans = diff / math.factorial(n)
print(ans) |
p02866 | s150985776 | Wrong Answer | #! /usr/bin/env python3
from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
ans = lambda x : x % 998244353
N = int(input())
D = [int(_) for _ in input().split()]
c = Counter(D)
bef = 1
ret = 1 * (not D[0])
for i in range(len(c)):
if c[i] == 0:
ret = 0
ret *= bef ** c[i]
ret = ans(ret)
bef = c[i]
print(ret)
|
p03254 | s292555456 | Accepted | N, x = map(int, input().split())
A = sorted(map(int, input().split()))
count = 0
for i in range(len(A)):
if (x >= 0):
x = x - A[i]
count += 1
else:
break
if (x > 0):
print(count - 1)
elif(x == 0):
print(count)
elif(x < 0):
print(count - 1)
|
p03962 | s449545310 | Accepted | a,b,c=map(int,input().split())
if(a==b and b==c):
print(1)
else:
if(a==b and b!=c):
print(2)
elif(b==c and c!=a):
print(2)
elif(c==a and a!=b):
print(2)
else:
print(3)
|
p02900 | s253711633 | Accepted | a,b = map(int, input().split())
def gcd(a, b):
while b:
a, b = b, a % b
return a
def factorization(n):
arr = {1}
tmp = n
for i in range(2,int(tmp**0.5)+1,1):
while tmp % i == 0:
tmp //= i
arr.add(i)
if tmp != 1:
arr.add(tmp)
return arr
g = gcd(a,b)
arr = factorization(g)
print(len(arr))
|
p02725 | s875334864 | Accepted | k,n = list(map(int,input().split(" ")))
A = list(map(int,input().split(" ")))
max_dist = 0
for i in range(len(A)-1):
if A[i+1]-A[i] > max_dist:
max_dist = A[i+1]-A[i]
if A[0]+k-A[-1] > max_dist:
max_dist = A[0]+k-A[-1]
print(k-max_dist)
|
p03284 | s624536791 | Wrong Answer | n,k = map(int,input().split())
print(n % k) if n > k else print(1) |
p03611 | s999426933 | Accepted | N = int(input())
A = list(map(int,input().split()))
counts = {}
for a in A:
for i in [a-1, a, a+1]:
if not i in counts:
counts[i] = 0
counts[i] += 1
counts = sorted(counts.items(), key=lambda x:x[1], reverse=True)
print(counts[0][1]) |
p02732 | s814343480 | Accepted | import collections
import math
def C(n):
return n * (n-1) // 2
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
d = {}
sm = 0
for k,v in c.most_common():
d[k] = v
sm += C(v)
for a in A:
print (sm - C(d[a]) + C(d[a]-1))
|
p02700 | s844069334 | Accepted | A,B,C,D = map(int,input().split())
while True:
C =C-B
if C <=0:
print ('Yes')
break
A =A-D
if A <=0:
print ('No')
break |
p03475 | s047840540 | Accepted | from math import ceil
def train(i, t):
if i == n - 1:
return t
c, s, f = d[i]
tt = f * ceil(t / f) if t > s else s
return train(i + 1, tt + c)
if __name__ == '__main__':
n = int(input())
d = [[int(i) for i in input().split()] for _ in range(n - 1)]
print(*[train(i, 0) for i in range(n)], sep="\n") |
p03548 | s704449195 | Wrong Answer | def isu(x , y , z):
ans = x // (y + z)
return ans if (x % (y + z) * (y + z)) + z <= x else ans - 1
def main():
x , y , z = map(int , input().split())
print(isu(x , y , z))
if __name__ == '__main__':
main() |
p02645 | s993844321 | Wrong Answer | import random
s = str(input())
t = random.randint(0, len(s)-2)
print(s[t:t+3]) |
p03730 | s844285772 | Accepted | import sys
A, B, C = map(int, input().split())
for i in range(1, B):
if i * A % B == C:
print('YES')
sys.exit()
print('NO') |
p03645 | s503251570 | Accepted | import sys
from collections import defaultdict
N, M = map(int, input().split())
inter = []
goalable = defaultdict(lambda: False)
for i in range(M):
start, end = map(int, input().split())
if start == 1:
inter.append(end)
else:
if end == N:
goalable[start] = True
for i in inter:
if goalable[i]:
print("POSSIBLE")
sys.exit()
print("IMPOSSIBLE") |
p03544 | s369991283 | Accepted | l = [2,1]
for i in range(100):
l.append(l[-1] + l[-2])
print(l[int(input())])
|
p02783 | s439694002 | Accepted | h, a =map(int, input().split())
print(h//a + 1 if h % a != 0 else h//a) |
p03254 | s947401791 | Wrong Answer | N, x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
# print(N, x)
# print(A)
count = 0
for i in range(N):
if x >= A[i]:
count += 1
x -= A[i]
if count > 0 and x > 0:
count -= 1
print(count) |
p03075 | s932725594 | Wrong Answer | def main():
#n = int(input())
#s = input()
#s = input().split()
#a,b = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(6)]
#a = [int(input()) for i in range(6)]
ans = 0
for i in range(5):
if a[i] > a[5]:
print(":(")
exit()
print("Yay!")
if __name__ == '__main__':
main() |
p02784 | s360216544 | Wrong Answer | h, a = map(int, input().split())
count = 0
while h > 0:
h -= a
count += 1
print(count) |
p03408 | s540515123 | Accepted | n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
s_set = set(s)
t_set = set(t)
ans = 0
for i in s_set:
p = s.count(i)
q = t.count(i)
ans = max(ans,p-q)
print(ans) |
p03251 | s899335188 | Accepted | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
_, _, x, y = rl()
maxx = max(rm())
miny = min(rm())
if maxx < miny and x<miny and maxx<y:
print('No War')
else:
print('War')
|
p02993 | s945147681 | Wrong Answer | s=input()
ans=''
for i in range(2):
if s[i]==s[i+1]:
ans='Bad'
break
else:
ans='Good'
print(ans) |
p02922 | s173844411 | Wrong Answer | import math
a, b = map(int, input().split())
print(math.ceil(b-1)/(a-1)) |
p04012 | s818112829 | Accepted | import collections
W=collections.Counter(x for x in input())
for i,v in W.items():
if v%2!=0:
print('No')
break
else:
print('Yes') |
p03719 | s637491669 | Accepted | A,B,C=map(int,input().split())
print("Yes" if A<=C<=B else "No") |
p03137 | s228494777 | Accepted | N,M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
D = [abs(X[i] - X[i+1]) for i in range(M-1)]
D.sort(reverse=True)
print(sum(D[N-1:]))
|
p03252 | s776921936 | Accepted |
s=list(input())
t=list(input())
l=len(s)
henkan1 = {chr(ord("a")+i) : set() for i in range(26) }
henkan2 = {chr(ord("a")+i) : set() for i in range(26) }
for i in range(l):
# if s[i]!=t[i]:
henkan1[s[i]].add(t[i])
henkan2[t[i]].add(s[i])
if all(len(h) <=1 for h in henkan1.values()) and all(len(h) <=1 for h in henkan2.values()):
print("Yes")
else:
print("No") |
p02813 | s998388853 | Accepted | import itertools
n = int(input())
p = tuple(i for i in input().split())
q = tuple(i for i in input().split())
pi = 0
qi = 0
for i,j in enumerate(itertools.permutations(str(i) for i in range(1,n+1))):
if p == j:
pi = i
if q == j:
qi = i
print(abs(pi-qi)) |
p02866 | s593679266 | Accepted | import collections
N=int(input())
D=list(map(int,input().split()))
mod=998244353
data=collections.Counter(D)
if D[0]==0 and data[0]==1:
count=1
for i in range(1,len(data)):
count*=data[i-1]**data[i]
count%=mod
print(count)
else:
print(0)
|
p02624 | s079379760 | Wrong Answer | #D
n = int(input())
#約数の数を求める>>倍数であり、n以下であるものの総和を求める
ans = 0
for i in range(1, n + 1):
#iの倍数の数を求める
m = n // i
#初項i:公差i:m項までの等比数列の和
ans += n * (2 * i + i * (n - 1)) *0.5
print(int(ans)) |
p03338 | s399390313 | Accepted | n = int(input())
s = str(input())
ans = 0
for i in range(1,n):
l = list(s[0:i])
r = list(s[i:n])
dup = len(set(l)&set(r))
if ans < dup:
ans = dup
print(ans)
|
p03543 | s529313765 | Wrong Answer | import sys
n=input()
cnt=0
for i in range(1,len(n)):
if n[i]==n[i-1]:
cnt+=1
if cnt >=2:
print("Yes")
sys.exit
print("No") |
p03695 | s463219970 | Accepted | N = int(input())
R = list(map(int, input().split()))
X = [0]*8
p = 0
for r in R:
if r >= 3200:
p += 1
else:
X[r//400] = 1
s = sum(X)
if s == 0:
print(str(1) + " " + str(p))
else:
print(str(s) + " " + str(s + p))
|
p03623 | s175573099 | Wrong Answer | n=input().rstrip().split()
n=[int(x) for x in n]
if abs(n[1]-n[0])>abs(n[2]-n[0]):
print("A")
else:
print("B") |
p02598 | s467519062 | Wrong Answer | n,k = map(int, raw_input().split())
ais = map(int, raw_input().split())
def p(m,ais,k):
t = [ m, ais, k]
for ai in ais:
k-= ai / m
return k >=0
lo,hi = 1, max(ais)
print lo,hi
while(lo < hi):
med = (lo + hi)/2
if p(med, ais, k):
hi = med
else:
lo = med + 1
print lo
|
p03797 | s925640244 | Accepted | N, M = map(int, input().split())
n = N
m = M // 2
ans = 0
if n >= m:
ans += m
else:
ans += n
m -= n
ans += m // 2
print(ans) |
p03910 | s568178445 | Accepted | n = int(input())
# 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...
# 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, ...
A = [0] * (n + 1)
A[1] = 1
for i in range(1, n):
A[i + 1] = A[i] + i
from bisect import bisect_left
idx = bisect_left(A, n)
if n == A[idx]:
for i in range(1, idx + 1):
if i == idx - 1: continue
print(i)
else:
for i in range(1, idx):
if i == idx - 1 - (n - A[idx - 1] + 1): continue
print(i) |
p02689 | s533586878 | Accepted | n, m = map(int, input().split())
h = list(map(int, input().split()))
edge = [[] for _ in range(n)]
## 接している各頂点をまとめる
for i in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
edge[a].append(b)
edge[b].append(a)
cnt = 0
for node in range(n):
good = True
for neighbor in edge[node]:
if h[node] <= h[neighbor]:
good = False
break;
if good:
cnt += 1
print(cnt) |
p03605 | s528005461 | Accepted | N = input()
print("Yes" if N[0]=="9" or N[1]=="9" else "No") |
p02773 | s440738910 | Accepted | N=int(input())
D={}
for i in range(N):
s=input()
if s in D:
D[s]+=1
else:
D[s]=1
m=max(D.values())
d=list(D.values())
k=list(D.keys())
ans=[]
for i in range(len(D)):
if m==d[i]:
ans.append(k[i])
ans=sorted(ans)
for a in ans:
print(a) |
p02707 | s040304085 | Accepted | import collections
n = int(input())
dic = collections.Counter(input().split())
for i in range(n):
print(dic[str(i+1)]) |
p02958 | s299470107 | Accepted | def inpl(): return list(map(int, input().split()))
N = int(input())
P = inpl()
Q = sorted(P)
for i in range(N):
for j in range(i, N):
R = [p for p in P]
R[i], R[j] = R[j], R[i]
for k in range(N):
if R[k] != Q[k]:
break
else:
print("YES")
exit()
else:
print("NO") |
p02552 | s101631917 | Wrong Answer | x = input()
if x == 0:
print(1)
elif x==1:
print(0) |
p02714 | s515048119 | Wrong Answer | n=int(input())
s=input()
counter=0
for i in range(1,n+1):
for j in range(i+1,n+1):
for k in range(j+1,n+1):
if 2*j==i+k:
break
else:
if s[i-1]!=s[j-1] and s[i-1]!=s[k-1] and s[j-1]!=s[k-1]:
counter+=1
print(counter) |
p02823 | s789450808 | Accepted | def solve(N, A, B):
if A % 2 == B % 2:
return (B - A) // 2
return min(A-1, N-B) + 1 + (B - A -1)//2
if __name__ == "__main__":
n, a, b = map(int, input().split())
print(solve(n, a, b))
|
p02873 | s637356818 | Accepted | s = input()
n = len(s)
ans = 0
l = 0
ll = [0] * (n + 1)
r = 0
rl = [0] * (n + 1)
for i in range(n):
if s[i] == '<':
l += 1
ll[i+1] = l
else:
l = 0
if s[n-1-i] == '>':
r += 1
rl[n-i-1] = r
else:
r = 0
for i in range(n + 1):
ans += max(rl[i], ll[i])
print(ans) |
p04020 | s372750672 | Wrong Answer | R = list()
L = list()
N = int(input())
R.append(-1)
for i in range(N):
k = int(input())
L.append(k)
if k == 0:
R.append(len(L))
R.append(N)
S = sum(L)
for i in range(len(R) - 1):
if sum(L[R[i] + 1 : R[i + 1]]) % 2 == 1:
S = S - 1
print(S // 2)
|
p02724 | s465715123 | Accepted | X = int(input())
hund = X // 500
X -= (500 * hund)
five = X // 5
print(hund * 1000 + five * 5)
|
p03211 | s661088909 | Wrong Answer | s = input()
ans = 753
for i in range(len(s)-3):
subs = int(s[i:i+3])
ans = min(abs(ans-subs),ans)
print(ans) |
p02754 | s831663708 | Accepted | n, a, b = map(int, input().split())
q, mod = divmod(n, (a+b))
if mod > a:
print(q*a+a)
else:
print(q*a+mod) |
p03821 | s787908404 | Accepted | n = int(input())
ab=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in reversed(range(n)):
a,b=ab[i]
a+=cnt
if a%b==0:
continue
if a<=b:
cnt+=(b-a)
continue
cnt += -(-a//b) * b - a
print(cnt) |
p02880 | s420929875 | Accepted | N=int(input())
for num in range(1,10):
if (N/num).is_integer() and 1<=(N/num)<=9:
print("Yes")
break
else:
print("No") |
p02935 | s883539514 | Wrong Answer | A=int(input())
B=list(map(int, input().split()))
print(sum(B)/2-max(B)/2) |
p02695 | s629023640 | Accepted | import itertools
n, m, q = map(int, input().split())
queries = [list(map(int, input().split())) for _ in range(q)]
ans = 0
nums = list(range(1, m+1))
seqs = list(itertools.combinations_with_replacement(nums, n))
for seq in seqs:
point = 0
for query in queries:
a, b, c, d = query
if seq[b-1] - seq[a-1] == c:
point += d
if point > ans:
ans = point
print(ans)
|
p04005 | s437809757 | Accepted | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
A, B, C = map(int, readline().split())
if A%2==0 or B%2==0 or C%2==0:
ans = 0
else:
ans = min(A*B, B*C, C*A)
print(ans)
if __name__ == '__main__':
main() |
p02775 | s037128920 | Accepted | N = list(map(int, input()))
# print(N)
ans = 0
DP = [0] *2
DP[0] = 0
DP[1] = 1
for i in N:
a, b = DP[0] ,DP[1]
DP[0] = a + i if a+i < b +(10-i) else b +(10-i)
DP[1] = a + i+1 if a + i+1 < b + (9-i) else b + (9-i)
# print(DP)
print(DP[0] if DP[0] <= DP[1]+1 else DP[1] +1) |
p03011 | s448112500 | Accepted | P,Q,R=map(int,input().split())
print(min(P+Q,Q+R,R+P)) |
p03854 | s064339178 | Wrong Answer | s = input()
s = s[::-1]
n = len(s)
cur = 0
while cur < n:
if s[cur:cur+5:] == "maerd" or "esare":
cur += 5
continue
if s[cur:cur+6:] == "resare":
cur += 6
continue
if s[cur:cur+7:] == "remaerd":
cur += 7
continue
print("NO")
exit()
print("YES") |
p03795 | s325479701 | Wrong Answer | n = int(input())
a = n // 15
print(n * 800 + a * 200) |
p03254 | s668462281 | Wrong Answer | N, x = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
children = [0] * N
a.sort()
kashi = 0
while kashi < x:
for i in range(0,N):
kashi += a[i]
children[i] += 1
if kashi > x:
kashi -= a[i]
children[i] -= 1
break
if kashi == 0:
break
print(N - children.count(0)) |
p02935 | s970349422 | Accepted | N = int(input())
v = list(map(int, input().split()))
ans = min(v)
v.remove(min(v))
for i in range(N-1):
ans = (ans + min(v)) /2
v.remove(min(v))
print(ans) |
p02792 | s366516209 | Accepted | MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)
def main():
N = int(input())
presuf = [[0] * 10 for _ in range(10)]
for i in range(1,N + 1):
pre = int(str(i)[0])
suf = i%10
presuf[pre][suf] += 1
ans = 0
for i in range(10):
for j in range(10):
ans += presuf[i][j]*presuf[j][i]
print(ans)
if __name__ == '__main__':
main()
|
p02664 | s565340369 | Accepted | t = input()
for i in range(len(t)):
if t[i] == "?":
print("D",end="")
else:
print(t[i],end="")
print() |
p03672 | s361273882 | Accepted | s = input()
n = len(s)-1
if n%2!=0:
n-=1
while n>1:
if s[0:int(n/2)]==s[int(n/2):n]:
print(n)
break
else:
n-=2
|
p02554 | s604373698 | Wrong Answer |
N = int(input())
if N < 2:
print(0)
exit()
N = N - 2
result = 2 * (10 ** N)
result = result % ((10 ** 9)+ 7)
print(result) |
p03612 | s745344537 | Accepted | def main():
n = int(input())
P = list(map(int, input().split()))
ans = 0
next = 0
on = False
for i in range(n):
if P[i] == i + 1:
ans += 1
if on:
next += 1
on = False
else:
on = True
else:
on = False
print(ans - next)
if __name__ == '__main__':
main()
|
p02547 | s860858718 | Accepted | def func():
count = 0
for _ in range(N):
a, b = map(int, input().split())
if a == b:
count += 1
else:
count = 0
if count >= 3:
return "Yes"
return "No"
N = int(input())
print(func())
|
p02552 | s476094143 | Wrong Answer | x=input()
if x:
print('0')
else:
print('1') |
p02594 | s202541645 | Wrong Answer | k = int(input())
i = 0
s = 0
ans = -1
for z in range(k):
i += 1
s = 7 + 10*s
if s % k != 0:
s = s % k
else:
ans = i
break
print(ans) |
p04012 | s704228508 | Wrong Answer | w = sorted(input())
count = 0
ans = 'Yes'
for i in range(len(w)-1):
count += 1
if w[i]!=w[i+1]:
if count%2!=0:
ans = 'No'
break
else:
count = 0
print(ans) |
p04012 | s400779460 | Accepted | w=input()
ans={}
k=0
for i in w:
if i not in ans:
ans[i]=1
else :
ans[i]+=1
for i in ans:
if ans[i]%2==1:
print("No")
break
else :
print("Yes") |
p02847 | s126766641 | Accepted | s = input()
days_of_the_week = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
n = days_of_the_week.index(s)
print(7 - days_of_the_week.index(s)) |
p03665 | s985013541 | Wrong Answer | n,p=map(int,input().split())
a=list(map(int,input().split()))
temp1=0
temp0=0
for i in range(n):
if a[i]%2==0:
temp0=temp0+1
else:
temp1=temp1+1
if p%2==0:
print(2**(n-1))
else:
if temp1==0:
print(0)
else:
print(2**(n-1))
|
p02682 | s301597731 | Accepted | a, b, c, k = map(int,input().split())
if a >= k:
print(k)
elif a < k and a+b >= k:
print(a)
elif a+b < k:
print(a-(k-a-b)) |
p03632 | s716415723 | Accepted | A,B,C,D = map(int,input().split())
s = max(A,C)
e = min(B,D)
print(e-s if e-s>0 else 0) |
p03705 | s657050810 | Wrong Answer | N, A, B = map(int, input().split())
if N == 1:
if A == B:
ans = 1
else:
ans = 0
elif N == 2:
ans = 1
else:
ans = (N - 2) * B - (N - 2) * A + 1
print(ans) |
p02694 | s084349441 | Accepted | X=int(input())
sum=0
A=100
while A<X:
A=(A*101)//100
sum+=1
print(sum) |
p02546 | s160048104 | Wrong Answer | S = input()
if S[-1] == 's':
S = S + 's'
else:
S = S + 'es'
print(S) |
p02623 | s072395722 | Accepted | N, M, K = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
AD = [0]
for i in range(N):
AD.append(AD[i]+A[i])
BD = [0]
for i in range(M):
BD.append(BD[i]+B[i])
ans = 0
for i in range(N+1):
if K < AD[i]:
break
else:
while BD[M] > K - AD[i]:
M -= 1
ans = max(ans, i + M)
print(ans)
|
p03360 | s872696429 | Wrong Answer | A,B,C =map(int,input().split())
K = int(input())
l = [A,B,C]
sl = sorted(l)
#print(sl)
for i in range(K):
if sl[-1] <= 25:
sl[-1] *= 2
elif sl[-2] <= 25:
sl[-2] *= 2
elif sl[-3] <= 25:
sl[-3] *= 2
else:
pass
#print(sl)
print(sum(sl))
|
p02791 | s084688260 | Wrong Answer | N = int(input())
Plist = list(map(int, input().split()))
now = Plist[0]
ans = 0
for p in Plist:
if p <= now:
ans += 1
else:
break
now = p
print(ans)
|
p02922 | s801643672 | Accepted | A,B = map(int,input().split())
num = 1
res = 0
while num < B:
res += 1
num += A-1
print(res)
|
p03555 | s530443213 | Accepted | a = input()
b = input()[::-1]
if a == b:
print("YES")
else:
print("NO") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.