problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03665 | s390325055 | Accepted | N, P = map(int, input().split())
A = list(map(int, input().split()))
odd = [a % 2 == 1 for a in A].count(True)
even = N - odd
C = [[0] * 51 for i in range(51)]
C[0][0] = 1
for i in range(1, 51):
C[i][0] = 1
for j in range(1, i + 1):
C[i][j] = C[i - 1][j - 1] + C[i - 1][j]
if P == 1 and odd == 0:
... |
p03639 | s425301034 | Accepted | N = int(input())
A = tuple(map(int, input().split()))
qut = 0
odd = 0
for a in A:
if a % 2 !=0:
odd += 1
elif a % 4 == 0:
qut += 1
if odd <= qut or (N == odd + qut and odd <= qut + 1):
print("Yes")
else:
print("No") |
p04029 | s096065905 | Wrong Answer | N = int(input())
candy = N * (N+1) / 2
print(candy) |
p03910 | s059382553 | Accepted | n = int(input())
if n == 1:
print(1)
elif n == 2:
print(2)
else:
for x in range(1,n):
tmp = (1+x)*x//2
if tmp >= n:
l = x
break
d = tmp - n
for x in range(1,l+1):
if x != d:
print(x) |
p02947 | s105737216 | Accepted | n=int(input())
sd={}
for i in range(n):
si=''.join(sorted(list(input())))
sd[si]=sd.get(si, 0)+1
ans=0
for v in sd.values():
if(v>1):
ans+=((v*(v-1))//2)
print(ans) |
p02983 | s397675041 | Accepted | l, r = map(int, input().split())
if l//2019<r//2019:
print(0)
else:
ans = 2019
for ll in range(l, r):
for rr in range(ll+1, r+1):
ans = min(ans, (ll*rr)%2019)
print(ans) |
p02882 | s023293467 | Accepted | import math
a,b,x=map(int,input().split())
if x>a*a*b/2:
h=(2*a*a*b-2*x)/(a*a)
print(math.atan(h/a)*(180/math.pi))
else:
h=2*x/(a*b)
print(math.atan(b/h)*(180/math.pi)) |
p03331 | s867628763 | Accepted | n = int(input())
if n == 10 or n == 10 ** 2 or n == 10 ** 3 or n == 10 ** 4 or n == 10 ** 5:
print(10)
else:
ans = 0
a = str(n)
for i in range(len(a)):
ans += int(a[i])
print(ans) |
p03785 | s637002911 | Accepted | N, C, K = map(int, input().split())
T = []
for i in range(N):
T.append(int(input()))
T = sorted(T)
bus_time = False
human = 0
count = 0
for i in range(N):
now = T[i]
if bus_time == False:
bus_time = now + K
human = 1
count += 1
else:
if now <= bus_time and human < C... |
p03637 | s570215488 | Wrong Answer | N = int(input())
*a, = map(int, input().split())
two, four = 0, 0
for i in range(N):
if a[i] % 2 == 0:
two += 1
if a[i] % 4 == 0:
four += 1
if two == N or four >= (N-2) or (two >= (N-2) and four >= 2):
print("Yes")
else:
print("No")
|
p02793 | s958463318 | Accepted | from sys import stdin, stdout
ii = lambda: int(stdin.readline())
mi = lambda: map(int, stdin.readline().strip().split())
li = lambda: list(mi())
mod = int(1e9) + 7
def GCD(x, y):
while(y):
x, y = y, x % y
return x
N = ii()
A = li()
lcm = A[0]
for i in range(1, len(A)):
lcm = (lcm // GCD(lcm, A[i]... |
p03543 | s279040013 | Accepted | n = input()
ans = 'No'
if n[0] == n[1]:
if n[1] == n[2]:
ans = 'Yes'
else:
if n[1] == n[2] and n[2] == n[3]:
ans = 'Yes'
print(ans) |
p03323 | s109352380 | Accepted | a,b = map(int,input().split())
if a<9and b<9:
print('Yay!')
else:
print(':(') |
p02718 | s864562410 | Wrong Answer | import numpy as np
from sys import stdin
def get_result(data):
N, M = data[0]
A = np.array(data[1])
total = sum(A)
pop_goods = A[A > total/(4*M)]
if len(pop_goods) >= M:
return 'Yes'
return 'No'
if __name__ == '__main__':
raw_data = [val.rstrip() for val in stdin.readlines()]
... |
p03241 | s181804015 | Wrong Answer | N,M = map(int,input().split())
n = M // N
if n < 10**5:
for i in range(n):
x = n - i
if M % x == 0:
print(x)
quit()
else:
for i in range(10**5):
x = N + i
if M % x == 0:
print(M//x)
quit() |
p03612 | s714260593 | Accepted | import sys
inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())
n = inint()
P = inintl()
ans = 0
for i in range(n-1):
a = P[i]
b = P[i+1]
... |
p02613 | s920539903 | Accepted | n=int(input())
result={'AC':0,'WA':0,'TLE':0,'RE':0}
for _ in range(n):
result[input()] += 1
for i,j in result.items():
print(f'{i} x {j}') |
p03160 | s529688605 | Accepted | def chmin(a, b):
if a > b:
return b
else:
return a
# input
N = int(input())
h = list(map(int, input().split()))
# dp table
dp = [float('inf')]*(10**5 + 10)
# 初期条件
dp[0] = 0
for i in range(1,N):
dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
if i > 1:
dp[i] = chmin(dp[i], ... |
p03486 | s848390757 | Accepted | s = str(input())
t = str(input())
s = sorted(s)
t = sorted(t, reverse = True)
if(''.join(s) < ''.join(t)):
print('Yes')
else:
print('No') |
p03555 | s187897335 | Accepted |
C1 =str(input())
C2 =str(input())
if C1[0] == C2[2] and C1[1] == C2[1] and C1[2] == C2[0]:
print('YES')
else:
print('NO')
|
p02786 | s255967860 | Wrong Answer | h = int(input())
m = 0 # モンスター数
a = 0 # 分裂回数
i = 0 # ループ回数
while True:
i += 1
# 攻撃して分裂した
if h > 1:
h = int(h/2)
m += 2
a += i
continue
# 1のモンスターを消滅させるまでの回数
else:
print(a+m)
break |
p03075 | s523280981 | Wrong Answer | A = []
dist = 0
for i in range(5):
A.append(int(input()))
if i > 0:
dist = max(dist,A[i]-A[i-1])
k = int(input())
if dist >= k:
print(':(')
else:
print('Yay!')
|
p03665 | s410831652 | Wrong Answer | N, P = map(int, input().split())
odd = sum([int(i) % 2 for i in input().split()])
even = N-odd
if P == 1 and odd == 0:
print(0)
else:
print(2**even * (2**odd//2))
|
p02958 | s836627147 | Accepted | N = int(input())
p = list(map(int,input().split()))
sort_p=sorted(p)
count = 0
for i,j in zip(p,sort_p):
if(i!=j):
count+=1
if(count==2 or count==0):
print('YES')
else:
print('NO') |
p03835 | s171908785 | Accepted | k,s=map(int,input().split())
from math import factorial
def c(n,r):
return factorial(n)//factorial(n-r)//factorial(r)
ans=0
for x in range(k+1):
for y in range(k+1):
if 0<=s-x-y<=k:
ans += 1
print(ans) |
p02553 | s585677432 | Wrong Answer | a,b,c,d = map(int,input().split())
if a*c >= b*d:
print(a*c)
elif a*d >= b*d:
print(a*d)
elif b*c >= b*d:
print(b*c)
else:
print(b*d) |
p02700 | s891478076 | Accepted | import math
a,b,c,d = map(int,input().split())
a = math.ceil(a/d)
b = math.ceil(c/b)
if a<b:
print('No')
else:
print('Yes')
|
p03000 | s899591229 | Accepted | n,x=map(int,input().split())
l=[int(x) for x in input().rstrip().split()]
now=0
cnt=1
for i in range(n):
now+=l[i]
if x<now:
break
cnt+=1
print(cnt) |
p02771 | s589266970 | Accepted | a, b, c = map(int, input().split(" "))
if (a - b) * (b - c) * (c - a) == 0 and not ((a == b) and (a == c)):
print("Yes")
else:
print("No") |
p02765 | s917591579 | Accepted | N, R = map(int, input().split())
if N >= 10:
print(R)
else:
print(R + 100*(10-N)) |
p03011 | s139925971 | Accepted | P, Q, R = map(int, input().split())
print(min([P+Q, Q+R, R+P])) |
p03145 | s326500641 | Accepted | a,b,c = map(int,input().split())
print(a*b//2) |
p03281 | s245880073 | Wrong Answer | n = int(input())
ans = 0
for num in range(1, n+1):
if num%2 == 1:
continue
ls = []
for i in range(1, num+1):
if num%i == 0:
ls.append(i)
if len(ls) == 8:
ans += 1
print(ans) |
p03037 | s006357928 | Wrong Answer | n,m = map(int,input().split())
lmax, rmin = 0, n
for _ in range(m):
l,r = map(int,input().split())
lmax = max(lmax, l)
rmin = min(rmin, r)
print((rmin-lmax)+1) |
p02859 | s929451068 | Wrong Answer | int(input())**2 |
p02767 | s913009279 | Wrong Answer | n=int(input())
x=list(map(int,input().split()))
result=0
for p in range(1,max(x)):
s=0
for i in range(0,n):
s+=(x[i]-p)**2
if p==1:
result=s
else:
if s<result:
result=s
print(result) |
p02755 | s469442839 | Accepted | a,b = map(int,input().split())
ans = -1
#print(a,b)
for i in range(1001):
# print(i,int(i * 0.08),int(i * 0.1))
if int(i * 0.08) == a and int(i *0.1) == b:
ans = i
break
print(ans) |
p03543 | s906038647 | Accepted | a,b,c,d=input()
if a==b==c or b==c==d:
print("Yes")
else:
print("No") |
p03815 | s337610704 | Accepted | import math
x = int(input())
if x <= 11:
count = 0
point = 0
while True:
point += 6
count += 1
if point >= x:
break
point += 5
count += 1
if point >= x:
break
print(count)
else:
count = math.ceil(x/11)*2
if count%2 != 0:
... |
p02677 | s384195266 | Accepted | import math
a, b, h, m = map(int, input().split())
h=h*60+m
ang=abs(h*0.5-m*6)
if ang > 180:
ang = 360-ang
if ang==180:
print(a+b)
elif(ang==0):
print(abs(b-a))
else:
ans=(a**2)+(b**2)-(2*a*b*math.cos(math.radians(ang)))
print(math.sqrt(ans))
|
p03329 | s871824683 | Wrong Answer | N=int(input())
can=set()
can.add(1)
i=0
ans=0
while ans<=100000:
ans=6**i
can.add(ans)
i+=1
j=0
ans=0
while ans<=100000:
ans=9**j
can.add(ans)
j+=1
dp=[0]*(N+1)
dp[1]=1
for k in range(2,N+1):
mini=1000000
for item in can:
if k-item>=1:
mini=min(mini, dp[k-item]+1)
dp[k]=mini
print(dp[-1]... |
p03345 | s877150593 | Wrong Answer | def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
a,b,c,k = iim()
k = k%2
print(int((a-b)*(-1)**(k-1))) |
p02783 | s613710564 | Accepted | import math
def main():
hp, attack = (int(i) for i in input().rstrip().split(' '))
print(str(math.ceil(hp / attack)))
if __name__ == '__main__':
main()
|
p03137 | s825851385 | Accepted | N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))
if N >= M:
print(0)
else:
dists = [X[i+1]-X[i] for i in range(M-1)]
if N == 1:
print( sum(dists) )
else:
print( sum(sorted(dists)[:-(N-1)]) )
|
p02756 | s003623965 | Accepted | s = input()
q = int(input())
jun = 1
f = "";t = ""
for _ in range(q):
tmp = input()
if len(tmp)==1:
jun = 1 if jun==0 else 0
else:
_,ff,c = tmp.split()
if jun+int(ff) ==2:
f = c+f
else:
t += c
if jun==1:
print(f+s+t)
else:
print((f+s+t)[::-1])
|
p03803 | s425979715 | Accepted | A,B = map(int,input().split())
if A == B:
print("Draw")
elif A > B:
if B == 1:
print("Bob")
else:
print("Alice")
elif B > A:
if A == 1:
print("Alice")
else:
print("Bob") |
p02797 | s084389683 | Wrong Answer | N, K, S = map(int, input().split())
A = [S for i in range(K)] + [(int(10e9) if S != int(10e9) else 1)
for i in range(N - K)]
for i in range(N):
if i > 0:
print(' ', end='')
print(A[i], end='')
|
p02836 | s151126779 | Wrong Answer | s = list(input())
n = len(s)-1
count = 0
if s != s[::-1]:
for i in range(0,n//2):
if s[i] != s[n-i]:
count += 1
print(count)
|
p03035 | s715111046 | Accepted | #127 a
a,b=map(int,input().split())
kane=[0,int(b/2),b]
ans=1
if a>=13:
ans=2
elif a<=5:
ans=0
print(kane[ans])
|
p02630 | s464276560 | Accepted | import collections
N = int(input())
A = list(map(int, input().split()))
count = collections.defaultdict(int)
currSum = 0
for a in A:
count[a] += 1
currSum += a
Q = int(input())
for _ in range(Q):
B, C = map(int, input().split())
currSum += (count[B] * (C - B))
count[C] += count[B]
count[B] = 0
print(currS... |
p02996 | s077245134 | Accepted | n = int(input())
t = []
for i in range(n):
a,b = map(int,input().split())
t.append((a,b))
t = sorted(t,key=lambda x: x[1])
ans = 0
for k,v in t:
ans += k
if ans > v:
print("No")
exit()
print("Yes") |
p03449 | s979100263 | Accepted | n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
ans = 0
for i in range(1,n+1):
ans = max(ans,sum(a1[:i])+sum(a2[(i-1):]))
print(ans) |
p02820 | s151377169 | Accepted | n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())
res=0
for i in range(n):
if i>k-1 and t[i-k]==t[i]:
t[i]="n"
if t[i]=="r":
res+=p
elif t[i]=="s":
res+=r
elif t[i]=="p":
res+=s
print(res) |
p03773 | s760741853 | Accepted | a, b = map(int,input().split())
print((a+b)%24) |
p02676 | s856226980 | Accepted | K = int(input())
S = input()
if len(S)<=K:
print(S)
else:
S = S[:K]+'...'
print(S) |
p02935 | s156412403 | Accepted | n = int(input())
v_n = list(map(float, input().split()))
v_n = sorted(v_n)
res = (v_n[0] + v_n[1]) / 2
for i in range(2, n):
res = (v_n[i] + res) / 2
print(res)
|
p02707 | s218576474 | Accepted | def main():
N = int(input())
*a, = map(int, input().split())
ctr = [0] * N
for x in a:
ctr[x - 1] += 1
print(*ctr, sep='\n')
if __name__ == '__main__':
main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstr... |
p03043 | s152654725 | Wrong Answer | n, k = map(int, input().split())
import math
ans = 0
for i in range(1,n+1):
if i < k:
t = int(k/(2*i))
if t == int(t):
ans += 1/(2**(t+1))
else:
ans += 1/(2**t)
else:
ans += 1
print(ans/n) |
p02909 | s078662610 | Accepted | W=["Sunny","Cloudy","Rainy"]
S=W.index(input())
print(W[(S+1)%3]) |
p03323 | s036159544 | Accepted | tmp = input().split(" ")
print(":(") if int(tmp[0]) > 8 or int(tmp[1]) > 8 else print("Yay!")
|
p02606 | s776364945 | Accepted | #from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353
def ddprint(x):
if D... |
p03617 | s954127623 | Accepted | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
q, h, s, d = map(int, input().split())
N = int(input())
one = min([4*q, 2*h, s])
print(min((N//2)*d+one*(N % 2), N*one))
resolve() |
p03284 | s266715996 | Wrong Answer | n,k = map(int,input().split())
print(n%k) |
p03103 | s955142378 | Wrong Answer | n,m=map(int,input().split())
AB=[]
for i in range(n):
a,b=map(int,input().split())
AB.append((b,a))
AB.sort()
cnt=0
ans=0
for b,a in AB:
if cnt==m:
print(ans)
break
temp=min(m-cnt,a)
ans+=b*temp
cnt+=temp |
p03387 | s970506429 | Accepted | abc = list(map(int,input().split()))
maxnum = max(abc)
parity = maxnum%2
ans = 0
for i in abc:
if i%2==parity:
ans+=(maxnum-i)//2+1
else:
ans+=(maxnum-1-i)//2
if abc[0]%2==abc[1]%2 and abc[1]%2==abc[2]%2:
ans-=3
print(ans) |
p03042 | s707864607 | Accepted | S=input()
Y=int(S[:2])
M=int(S[2:])
if Y==0 or Y>12:
#Y!=MANTH
if M==0 or M>12:
print("NA")
else:
print("YYMM")
else:
if M==0 or M>12:
print("MMYY")
else:
print("AMBIGUOUS")
|
p03038 | s747795343 | Accepted | n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
aa = [-1] * (2*n)
bc = []
for i in range(m):
b,c = map(int,input().split())
bc.append((c,b))
bc.sort(reverse = True)
i = 0
for j in range(m):
if i >= n:
break
for k in range(bc[j][1]):
aa[i] = bc[j][0]
i... |
p03163 | s643161574 | Accepted | N,W = map(int,input().split())
dp = [0]*(W+1)
for _ in range(N):
w,v = map(int,input().split())
if w > W:
continue
else:
for j in range(w,W+1)[::-1]:
if dp[j] < dp[j-w]+v:
dp[j] = dp[j-w]+v
print(dp[W]) |
p02854 | s336311566 | Wrong Answer | import numpy as np
import bisect
n = int(input())
A = list(map(int,input().split()))
cs = np.cumsum(A).tolist()
mid = sum(A)//2
idx = bisect.bisect_left(cs, mid)
ans = float('inf')
for i in range(max(1, idx-1), min(idx+2, n)):
x = A[:i]
y = A[i:]
print(x,y)
sum_x = sum(x)
sum_y = sum(y)
ans = mi... |
p02642 | s937247056 | Wrong Answer | N = int(input())
A = [int(x) for x in input().split()]
A = list(set(A))
A.sort()
print(A)
flag = 0
for i in range(1, len(A)):
list=[]
for p in range(1, len(A)):
if A[p] % A[0] == 0:
list.append(A[p])
for p in range(len(list)):
A.remove(list[p])
flag += 1
del A[0]
if len(A) == 1:
flag ... |
p03106 | s428612504 | Wrong Answer | a, b, k = map(int, input().split())
ma = max(a, b)
mi = min(a, b)
ans = []
for i in range(ma // 2, 0, -1):
if ma % i == 0 and mi % i == 0:
ans.append(i)
ans.append(1)
print(ans[k - 1]) |
p02780 | s426250037 | Accepted | N, K = map(int, input().split())
p = list(map(int, input().split()))
s = []
for i in range(K):
s.append(p[i])
m = sum(s)
t = m
for i in range(K, N):
t += p[i] - p[i - K]
if m < t:
m = t
m += K
print(m / 2) |
p03611 | s672634535 | Wrong Answer | n = int(input())
a = [int(i) for i in input().split()]
ans = 0
cnt = [0]*(max(a)+1)
for i in range(n):
cnt[a[i]] += 1
for i in range(len(cnt)-2):
ans = max(ans,cnt[i]+cnt[i+1]+cnt[i+2])
print(ans) |
p03817 | s429202807 | Wrong Answer | x = int(input())
ans = (x//11)*2
if x%11 == 0:
print(ans)
elif x%11 <= 5:
print(ans+1)
else:
print(ans+2)
|
p02912 | s296902049 | Wrong Answer | import math
N,M=map(int,input().split())
S=input().split()
Snum=[]
for i in range(0,N):
Snum.append(int(S[i]))
Snum.sort
Snum.reverse
for i in range(0,M):
j=0
k=math.floor(Snum[0]/2)
while k<Snum[j] and j<N-1:
j=j+1
for l in range(0,j-1):
Snum[l]=Snum[l+1]
Snum[j-1]=math.floor(Snum[0]/2)
print(sum(S... |
p04045 | s792411000 | Accepted | N,K=map(int,input().split())
D=set(input().split())
while set(str(N))&D:
N+=1
print(N) |
p02838 | s699856012 | Accepted | n = int(input())
X = list(map(int, input().split()))
res = 0
MOD = int(1e9 + 7)
bit = 0
for n in range(60):
b1, b0 = 0, 0
for i in range(len(X)):
if X[i] & (1 << bit):
b1 += 1
else:
b0 += 1
res += (b1 * b0 * (1 << bit))
res = res % MOD
bit += 1
print(res) |
p02623 | s440863936 | Accepted | n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
import bisect
cum_a = [0]
for a in A:
cum_a.append(cum_a[-1] + a)
cum = [0]
for b in B:
cum.append(cum[-1] + b)
ans = 0
for i in range(n + 1):
t = cum_a[i]
if t <= k:
bnum = i
els... |
p02917 | s660424141 | Accepted | n=int(input())
b=list(map(int,input().split()))
ans=b[0]+b[n-2]
for i in range(1,n-1):
ans+=min(b[i],b[i-1])
print(ans) |
p02712 | s766275656 | Accepted | n=int(input())
out=0
for i in range (1,n+1):
if i%3!=0 and i%5!=0:
out=out+i
print(out) |
p03705 | s774167673 | Wrong Answer | N, A, B = map(int, input().split())
print((B-A)*(N-2) + 1)
|
p02627 | s888305101 | Accepted | #K = int(input())
#X = list(map(int, input().split()))
#s = input().split()
S = input()
if (S.isupper()):
print("A")
else:
print("a")
|
p03644 | s555736398 | Wrong Answer | N = int(input())
cnt = 0
while True:
if N % 2 <= 1:
break
N /= 2
cnt += 1
print(2**int(cnt)) |
p03474 | s952188205 | Accepted | A, B = map(int, input().split())
S = input()
print('Yes' if S[:A].isdecimal() and S[A + 1:].isdecimal() and S[A] == '-' else 'No') |
p03611 | s360019771 | Accepted | from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
d = defaultdict(int)
for i in A:
d[i] += 1
ans = 0
for i in range(10 ** 5):
ans = max(ans, d[i-1] + d[i] + d[i+1])
print(ans) |
p02832 | s240417391 | Accepted | N = int(input())
a = list(map(int, input().split()))
ans = 0
next = 1
for a in a:
if a == next:
next += 1
else:
ans += 1
if next == 1:
print(-1)
else:
print(ans) |
p02600 | s663128351 | Accepted | x = int(input()) - 400
ans = 8 - x//200
print(ans) |
p02647 | s332583686 | Accepted | from itertools import accumulate
N, K = map(int, input().split())
A = list(map(int, input().split()))
def calc_imos(arr):
imos = [0] * (N + 1)
for i, a in enumerate(arr):
l = max(0, i - a)
r = min(N - 1, i + a)
imos[l] += 1
imos[r + 1] -= 1
new_arr = list(accumulate(imos))[:... |
p03433 | s959225501 | Accepted | n = int(input())
a = int(input())
if n%500 <= a:
print("Yes")
else:
print("No") |
p03555 | s826856923 | Wrong Answer | data1 = list(map(str, input().split()))
data2 = list(map(str, input().split()))
count = len(data1) - 1
sw = 0
i = 0
j = len(data2)-1
while i <= count:
if data1[i] == data2[j]:
sw += 1
i += 1
j -= 1
if sw == len(data1):
print("Yes")
else:
print("No") |
p03730 | s140145921 | Accepted | a,b,c=map(int,input().split())
print("YES" if any((a*i)%b==c for i in range(1,b+1)) else "NO") |
p03221 | s440570127 | Accepted | from collections import defaultdict
n,m = map(int,input().split())
py = []
for i in range(m):
p,y = map(int,input().split())
py.append([p,y])
spy = sorted(py,key=lambda x:x[1])
cnt = [0]*n
id = defaultdict(int)
for i in spy:
p,y = i
cnt[p-1] += 1
id[(p,y)] = str(p).zfill(6)+str(cnt[p-1]).zfill(6)... |
p03860 | s524925836 | Accepted | print("A"+input()[8]+"C") |
p03379 | s096807141 | Accepted | N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
for x in X:
if x <= Y[N // 2 - 1]:
print(Y[N // 2])
else:
print(Y[N // 2 - 1]) |
p02759 | s348957810 | Accepted | print(int((int(input())+1)/2)) |
p03012 | s795756341 | Accepted | n = int(input())
rli = list(map(int,input().split()))
ali = []
for i in range(n-1):
ali.append(abs(sum(rli[:(i+1)])-sum(rli[(i+1):])))
print(min(ali)) |
p02552 | s693898510 | Accepted | n = int(input())
if n == 1:
print(0)
else:
print(1)
|
p03479 | s401349092 | Accepted | def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7
x,y=MI()
ans=1
a=x
for i in range(1000):
a=a*2
if a>y:
break
ans+=1
print(ans)
|
p03475 | s683296804 | Accepted | import math
n = int(input())
c = [0]*(n-1)
s = [0]*(n-1)
f = [0]*(n-1)
for i in range(n-1):
ci,si,fi = map(int,input().split())
c[i] = ci
s[i] = si
f[i] = fi
for i in range(n-1):
x = s[i]
for j in range(i,n-2):
x += c[j]
x = max(s[j+1],math.ceil(x/f[j+1])*f[j+1])
x += c[n-2]
print(x)
print(0)
... |
p02831 | s677225988 | Accepted | import fractions
A,B=map(int,input().split())
print(A*B//fractions.gcd(A,B)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.