problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p02946
|
s642995217
|
Accepted
|
k, x = map(int, input().split())
a = []
for i in range(x-(k-1), x+(k-1+1)):
a.append(i)
for i in range(len(a)):
print(str(a[i]) + ' ', end = "")
|
p04044
|
s159926594
|
Accepted
|
s = input().split()
#s[0]ๆๅญๅใฎๅๆฐใs[1]ๆๅญๅใฎ้ทใ
wordCNT = int(s[0])
mylist = []
for num in range(wordCNT):
mylist.append(input())
mylist.sort()
print(''.join(mylist))
|
p02879
|
s575156107
|
Wrong Answer
|
A, B = map(int, input().split())
if A > 9 and B > 9:
print(-1)
else:
print(A*B)
|
p03852
|
s561567387
|
Accepted
|
# -*- coding: utf-8 -*-
v_l = ['a', 'e', 'i', 'o', 'u']
if str(input()) in v_l:
print('vowel')
else:
print('consonant')
|
p03339
|
s380829014
|
Accepted
|
n=int(input())
S=input()
a=S.count("E")
m=a
for s in S:
if s=="E":
a-=1
m=min(m,a)
if s=="W":
a+=1
print(m)
|
p02665
|
s750408592
|
Wrong Answer
|
from itertools import accumulate
n = int(input())
A = list(map(int, input().split()))
bound = list(accumulate(A[::-1]))
bound.reverse()
ans = 1
node = 1
for i in range(n):
node -= A[i]
if (i < n and node <= 0) or node < 0:
print(-1)
exit(0)
node = min(node * 2, bound[i+1])
ans += node
print(ans)
|
p02983
|
s264548804
|
Accepted
|
def LI():
return [int(s) for s in input().split()]
L,R = LI()
if R - L > 2019:
R = L + 2019
min_mod = 2020
for i in range(L,R):
for j in range(i+1,R+1):
if (i*j) % 2019 < min_mod:
min_mod = (i*j) % 2019
print(min_mod)
|
p03835
|
s528049506
|
Wrong Answer
|
K,S=map(int,input().split())
ans=0
for X in range(K+1):
for Y in range(X,K+1):
for Z in range(Y,K+1):
if X+Y+Z==S:
if X==0 and Y==0:
ans=ans+3
elif X==0:
ans=ans+3
else:
ans=ans+1
print(ans)
|
p02767
|
s487593649
|
Accepted
|
N=int(input())
X=list(map(int,input().split()))
Q=0
A=[]
for i in range(min(X),max(X)+1):
for j in X:
Q+=(j-i)**2
A.append(Q)
Q=0
print(min(A))
|
p03455
|
s376358463
|
Wrong Answer
|
a,b = map(int, input().split())
if a*b % 1==0:
print('Even')
else:
print('Odd')
|
p02778
|
s218824693
|
Wrong Answer
|
import sys
input = sys.stdin.readline
print(len(input()) * 'x')
|
p03286
|
s901550048
|
Accepted
|
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n = ni()
ans = ''
while n != 0:
r = n % 2
if r < 0:
r += 2
n = (n - r) // (-2)
ans += str(r)
if ans == '':
print(0)
else:
print(ans[::-1])
|
p03037
|
s143929860
|
Accepted
|
n,m=map(int,input().split())
max_ = 0
min_ = n+1
for i in range(m):
a,b=map(int, input().split())
max_ = max(max_, a)
min_ = min(min_, b)
#print(max_, min_)
if(min_ < max_):print(0)
else:print(min_-max_+1)
|
p03434
|
s483951036
|
Accepted
|
n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse = True)
print(sum(a[::2]) - sum(a[1::2]))
|
p03555
|
s487867670
|
Wrong Answer
|
row1 = input()
row2 = input()
if row1[0] == row2[2] and row1[1] == row2[1] and row1[2] == row2[0]:
print("Yes")
else:
print("No")
|
p03438
|
s269132333
|
Accepted
|
def resolve():
import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
suma = 0
dab = 0
dba = 0
for i in range(n):
suma += b[i]-a[i]
if a[i] < b[i]:
dab += math.ceil((b[i]-a[i])/2)
else:
dba += a[i]-b[i]
if max(dba, dab) > suma:
print("No")
else:
print("Yes")
resolve()
|
p03495
|
s788989677
|
Accepted
|
N,K = map(int,input().split())
A = list(map(int,input().split()))
tmp = [0]*N
tmp_2 = [0]*N
Cnt=0
result = 0
for i in range(N):
tmp[A[i]-1]+= 1
tmp_2[A[i]-1] = 1
m = sum(tmp_2)-K
if m>0:
tmp = sorted(tmp)
for i in range(N):
if tmp[i]!=0:
result += tmp[i]
Cnt +=1
if Cnt == m:
break
print(result)
|
p03814
|
s055346023
|
Accepted
|
s = input()
start = -1
end = -1
for i in range(len(s)):
if start < 0 and s[i] == 'A':
start = i
if s[i] == 'Z':
end = i
print(end - start + 1)
|
p02765
|
s348465669
|
Wrong Answer
|
n,r = map(int,input().split())
if n >= 10:
print(r)
else:
k = 10 - n
print(100 * k)
|
p02615
|
s467443459
|
Accepted
|
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
ans = A[0]
cnt = 1
for a in A[1:]:
if cnt + 1 < N:
ans += a
cnt += 1
if cnt+ 1 < N:
ans += a
cnt += 1
print(ans)
|
p02682
|
s731265839
|
Wrong Answer
|
A, B, C, K = map(int, input().split())
score = 0
if K - (A + B) > 0:
# C ใๅใ
score = A - (K - (A + B))
else:
# C ใๅใใชใ
score = A
print(score)
|
p03069
|
s696626494
|
Accepted
|
n =int(input())
s=input()
white =[0]
black=[0]
for i in range(n):
white.append(white[i]+int(s[i]=='.'))
black.append(black[i]+int(s[i]=='#'))
ans = 300000
for i in range(n+1):
if ans>black[i]+white[n]-white[i]:
ans=black[i]+white[n]-white[i]
print(ans)
|
p02935
|
s781397666
|
Accepted
|
N = int(input())
V = list(map(int,input().split()))
V.sort(reverse=True)
while len(V)>=2:
a = V.pop()
b = V.pop()
V.append((a+b)/2)
print(V[0])
|
p02607
|
s114734668
|
Wrong Answer
|
N=int(input())
a=[0]*N
a=list(map(int,input().split()))
ans=0
for i in range(1,N+5,2):
if(N-1<i):
break
if(a[i]%2==1):
ans=ans+1
print(ans)
|
p03804
|
s269504562
|
Wrong Answer
|
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
l = []
for i in a:
for j in b:
if l == b:
print('Yes')
exit()
elif j in i:
l.append(j)
print('No')
|
p03103
|
s402413575
|
Wrong Answer
|
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x:x[0])
ans = 0
cnt = 0
for a, b in AB:
if cnt+b <= M:
cnt += b
ans += a*b
continue
ans += a * (M - cnt)
print(ans)
|
p02888
|
s786622957
|
Accepted
|
import bisect
n = int(input())
*L, = map(int, input().split())
# n = 4
# L = [3, 4, 2, 1]
# n = 7
# L = [218, 786, 704, 233, 645, 728, 389]
L.sort()
c = 0
for i in range(n-2):
for j in range(i+1, n-1):
c += bisect.bisect_left(L, L[i]+L[j])-(j+1)
print(c)
|
p03485
|
s650199639
|
Accepted
|
# 1ๅ็ฎ้ก้ก3
a,b = map(int, input().split())
print((a+b+1)//2)
|
p02729
|
s140531487
|
Accepted
|
N, M = map(int, input().split())
print(int((N * (N - 1) + M * (M-1)) / 2))
|
p02713
|
s006689992
|
Wrong Answer
|
from math import gcd
k = int(input())
a = 0
for i in range(1,k+1):
for j in range(1,k+1):
s = gcd(i,j)
for l in range(1,k+1):
m = gcd(s,k)
a = a + m
print(a)
|
p03910
|
s457822325
|
Accepted
|
N = int(input())
W = 0
for i in range(1, N+1):
W += i
if W >= N:
for j in range(1, i+1):
if j != (W - N):
print(j)
break
|
p02577
|
s860653678
|
Accepted
|
if int(input())%9:
print("No")
else:
print("Yes")
|
p03835
|
s773048110
|
Accepted
|
K, S = map(int, input().split())
ans = 0
for X in range(K+1):
for Y in range(K+1):
if 0 <= S-X-Y <= K:
ans += 1
print(ans)
|
p03605
|
s587155721
|
Accepted
|
s = input()
if '9' in s:
print('Yes')
else:
print('No')
|
p03493
|
s263815717
|
Wrong Answer
|
nums = [int(i) for i in input().split()]
ans = 0
while True:
if [i for i in nums if i % 2 == 1]:
break
nums = [i//2 for i in nums]
ans += 1
print(ans)
|
p03106
|
s114028583
|
Wrong Answer
|
a, b, k = (int(i) for i in input().split())
list_ComDiv = []
for i in range(1, max(a, b) + 1):
if a % i == 0 and b % i == 0:
list_ComDiv.append(i)
print(list_ComDiv[k - 1])
|
p03854
|
s126980927
|
Wrong Answer
|
init = input()
words = [
'dream',
'dreamer',
'erase',
'eraser'
]
def reverseWord(str):
return str[::-1]
def elimTheWord(str):
for word in reversed_words:
if str.find(word) == 0:
str = str[len(word):]
return str
reversed_words = list(map(reverseWord, words))
# main
target = reverseWord(init)
while True:
pivot = elimTheWord(target)
if pivot == '':
print('Yes')
break
if pivot == target:
print('No')
break
target = pivot
|
p02823
|
s747026737
|
Wrong Answer
|
n, a, b = map(int, input().split())
x = a//2 + 1 if a%2 == 0 else (a+1)//2
y = b//2 + 1 if b%2 == 0 else (b+1)//2
print(2 if x == y else y-x)
|
p03037
|
s842850066
|
Wrong Answer
|
N,M = map(int,input().split())
L,R = map(int,input().split())
pass_card = R - L + 1
for _ in range(M-1):
L_now,R_now = map(int,input().split())
if L_now > L:
pass_card -= (L_now - L)
L = L_now
if R_now < R:
pass_card -= (R - R_now)
R = R_now
print(pass_card)
|
p03448
|
s708003142
|
Accepted
|
A=int(input())
B=int(input())
C=int(input())
X=int(input())
cnt=0
for i in range(0,A+1):
for j in range(0,B+1):
for k in range(0, C+1):
if 500*i+100*j+50*k==X:
cnt+=1
else:
continue
print(cnt)
|
p03721
|
s906171355
|
Wrong Answer
|
n,k = map(int, input().split())
num = []
for i in range(n):
a,b = map(int, input().split())
for i in range(b):
num.append(a)
print(num[k-1])
|
p03681
|
s072458735
|
Wrong Answer
|
n, m = map(int, input().split())
MOD = 10**9+7
ans = 1
if abs(n-m) > 1:
print(0)
exit()
elif abs(n-m) == 0:
for i in range(1, n+1):
ans = ans * i % MOD
else:
ans = ans ** 2 * 2 % MOD
else:
cnt_n = 1
cnt_m = 1
for i in range(1, n+1):
cnt_n = cnt_n * i % MOD
for i in range(1, m+1):
cnt_m = cnt_m * i % MOD
else:
ans = cnt_n * cnt_m
print(ans)
|
p03286
|
s868217982
|
Wrong Answer
|
N = int(input())
S = ""
while N != 0:
if N % 2 != 0:
N -= 1
S = "0" + S
else:
S = "1" + S
N //= (-2)
print(S if S != "" else "0")
|
p02696
|
s909130130
|
Accepted
|
A, B, N = map(int, input().split(" "))
if N < B :
print ( int(A*N/B) )
else :
print ( int(A*(B-1)/B) )
|
p02842
|
s911892669
|
Accepted
|
import math
n = int(input())
x = math.ceil(n / 1.08)
print(':(' if int(x * 1.08) != n else x)
|
p02705
|
s825587175
|
Accepted
|
import math
r=int(input())
print(r*2*math.pi)
|
p02753
|
s341960434
|
Accepted
|
s = input()
s1 = s[0]
s2 = s[1]
s3 = s[2]
if s1 == s2:
if s1 == s3:
print('No')
exit()
print('Yes')
|
p03013
|
s475316740
|
Wrong Answer
|
n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
mod = 1000000007
dp = [0]*(n+1)
dp[0] = 1
if 1 in a:
dp[1] = 0
dp[2] = 1
else:
dp[1] = 1
for i in range(1,n+1):
if i in a:
dp[i] = 0
else:
dp[i] = dp[i-1] + dp[i-2]
ans = dp[n] % mod
print(ans)
|
p03062
|
s326021953
|
Accepted
|
n = int(input())
L = list(map(int,input().split()))
L1 = len([x for x in L if x < 0])
L.sort()
for i in range(n):
if L[i] < 0:
L[i] = -L[i]
#print(L)
if L1%2 == 0:
print(sum(L))
else:
print(sum(L)-2*min(L))
|
p02832
|
s619677871
|
Accepted
|
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n = int(readline())
a = list(map(int, readline().split()))
ans = 0
cnt = 1
for i in range(n):
if a[i] == cnt:
cnt += 1
else:
ans += 1
if ans == n:
print(-1)
else:
print(ans)
|
p02608
|
s358570155
|
Wrong Answer
|
N = int(input())
def perfect_number(x, y, z):
n = x**2 + y**2 + z**2 + x*y + y*z + z*x
return n
l = []
for x in range(1, N):
for y in range(1, N):
for z in range(1, N):
n = perfect_number(x,y,z)
if n > N:
break
else:
l.append(n)
counts = [l.count(x) for x in sorted(set(l))]
d = dict(zip(l, counts))
for i in range(1, N+1):
if i in d:
print(d[i])
else:
print(0)
|
p04005
|
s806098246
|
Accepted
|
#! /usr/bin/env python3
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
A, B, C = map(int, readline().split())
if (A % 2 == 0) or (B % 2 == 0) or (C % 2 == 0):
print(0)
else:
tmp = [A, B, C]
tmp = sorted(tmp)
print(tmp[0] * tmp[1])
|
p03821
|
s805285598
|
Wrong Answer
|
n = int(input())
ab = [0]*n
ans = 0
for i in range(n):
a,b = map(int,input().split())
ans += (b-(a+ans))%b
print(ans)
|
p02909
|
s050116713
|
Wrong Answer
|
wet = ["Sunny","Cloudy","Rainy"]
s = wet.index(input())
print(wet[s+1] if s != 2 else wet[1])
|
p03624
|
s916386507
|
Accepted
|
s = list(input())
abc = list('abcdefghijklmnopqrstuvwxyz')
abc_exist = [False] * 26
for i in range(len(s)):
for j in range(26):
if s[i] == abc[j]:
abc_exist[j] = True
r = 'None'
for k in range(26):
if abc_exist[k] == False:
r = abc[k]
break
print(r)
|
p03427
|
s328635555
|
Accepted
|
N = int(input())
N2 =str(N)[0]+(len(str(N))-1)*"9"
ans = 0
for n in N2:
ans+=int(n)
if int(N2) > N:
ans-=1
print(ans)
|
p03548
|
s423863485
|
Accepted
|
x,y,z = map(int,input().split())
print((x - z) // (y + z))
|
p02642
|
s793648399
|
Accepted
|
n = int(input())
A = list(map(int, input().split()))
A.sort()
cnt = [0] * (10**6+1)
for a in A:
if cnt[a] != 0:
cnt[a] += 1
continue
for i in range(10**6+1)[a::a]:
cnt[i] += 1
ans = 0
for a in A:
if cnt[a] == 1:
ans += 1
print(ans)
|
p03351
|
s486338749
|
Accepted
|
a,b,c,d= map(int,input().split())
print('Yes' if -d<=c-a<=d or (-d<=b-a<=d and -d<=c-b<=d) else 'No')
|
p02732
|
s120081869
|
Accepted
|
import collections
N = int(input())
A = list(map(int, input().split()))
wlists = collections.Counter(A)
sum_num = 0
for i in wlists:
sum_num += wlists[i] * (wlists[i] - 1) // 2
for i in range(N):
num = sum_num - wlists[A[i]] * (wlists[A[i]] - 1) // 2
if wlists[A[i]] > 1:
num += (wlists[A[i]] - 1) * (wlists[A[i]] - 2) // 2
print(num)
|
p02624
|
s822400332
|
Wrong Answer
|
N = int(input())
ans = 0
for i in range(1,N+1):
ans += i
for j in range(1,int(i**0.5)+1):
if i % j == 0:
ans += i
else:
pass
print(ans)
|
p02838
|
s088102114
|
Wrong Answer
|
n = int(input())
a = list(map(int, input().split()))
bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(20):
c = 0
for j in range(n):
c += int(a[j] & 1)
a[j] //= 2
ans = (ans + c * (n - c) * (2 ** i)) % mod
print(ans)
|
p02939
|
s888208957
|
Accepted
|
def main():
s = input()
ans = 0
i = 0
prev = ''
while i < len(s):
c = s[i]
if c == prev:
i += 1
if i == len(s):
break
c += s[i]
prev = c
i += 1
ans += 1
print(ans)
if __name__ == "__main__":
main()
|
p03607
|
s023077777
|
Accepted
|
from collections import Counter
n = int(input())
a = Counter([int(input()) for i in range(n)])
ans = 0
for num, c in a.items():
if c%2==1:
ans+=1
print(ans)
|
p03815
|
s019055823
|
Accepted
|
import sys
def I(): return int(sys.stdin.readline().rstrip())
x = I()
q = (x-1)//11
r = (x-1) % 11
print(2*q+1 if r <= 5 else 2*q+2)
|
p02706
|
s750506718
|
Accepted
|
# coding: utf-8
N, M = map(int, input().split())
A = list(map(int, input().split()))
homeworkDays = sum(A)
if homeworkDays > N:
print("-1")
else:
print(N - homeworkDays)
|
p03087
|
s557147451
|
Accepted
|
from itertools import accumulate
n, q = map(int, input().split())
s = input()
t = [0] * n
for i in range(n - 1):
if s[i] + s[i + 1] == "AC":
t[i] = 1
a = [0] + list(accumulate(t))
for i in range(q):
l, r = map(int, input().split())
print(a[r - 1] - a[l - 1])
|
p03695
|
s908154539
|
Wrong Answer
|
n = int(input())
A = list(map(int,input().split()))
col = [0 for _ in range(9)]
for a in A:
if a >= 3200:
col[8] += 1
continue
col[a//400] = 1
print(sum(col[:-1]), sum(col))
|
p02657
|
s255627585
|
Wrong Answer
|
import random
A = random.randint(1,100)
B = random.randint(1,100)
print(A * B)
|
p03360
|
s410862272
|
Wrong Answer
|
line = input()
a, b, c = [int(n) for n in line.split()]
k = int(input())
max_val = max(a, b, c)
max_val_mem = max_val
amax = False
bmax = False
cmax = False
for _ in range(k):
max_val *= 2
if max_val_mem == a:
amax = True
print(str(max_val+ b+ c))
if max_val_mem == b:
bmax = True
print(str(max_val+ a+ c))
if max_val_mem == c:
cmax = True
print(str(max_val+ a+ b))
|
p02779
|
s677587814
|
Accepted
|
def A():
temp = input().split()
S = temp[0]
T = temp[1]
temp = [int(i) for i in input().split()]
A = temp[0]
B = temp[1]
U = input()
if U == S:
print(A-1, B)
else:
print(A, B-1)
def B():
print('x'*len(input()))
def C():
N = int(input())
A = [int(i) for i in input().split()]
if N > len(set(A)):
print('NO')
else:
print('YES')
C()
|
p02843
|
s860236218
|
Accepted
|
def solve(X:int) -> int:
if(X < 100):return 0
first = int(str(X)[-1])
seccond = int(str(X)[-2])
ans = 0
if(first >= 6):
ans += first + 200
elif(first > 0):
ans += first + 100
ans += (seccond * 2) * 105
return 1 if(ans <= X) else 0
def main():
X = int(input())
print(solve(X))
if __name__ == "__main__":
main()
|
p02768
|
s280899438
|
Accepted
|
mod = 10 ** 9 + 7
# permutation
def prm(n,k,mod=10**9+7):
res = 1
for i in range(k):
res = res * (n-i) % mod
return res
def cmb(n,k,mod=10**9+7):
return prm(n,k) * pow(prm(k,k),mod-2,mod) % mod
n, a, b = map(int, input().split())
#ไฝใ้ธใฐใชใ1้ใใ้คใ
ans = pow(2,n,mod) - 1 - cmb(n,a) - cmb(n,b)
print(ans % mod)
|
p03759
|
s387004071
|
Accepted
|
a,b,c = map(int,input().split())
print("YES" if b-a == c-b else "NO")
|
p03478
|
s190182216
|
Accepted
|
N, A, B = map(int,input().split())
su =0
for i in range(1,N+1):
si = str(i)
c = 0
for s in si:
c += int(s)
if A <= c <= B:
su += i
print(su)
|
p03239
|
s732195046
|
Wrong Answer
|
N,T=map(int,input().split())
a=T+1
for i in range(N):
c,t=map(int,input().split())
if t<=T and c<a:a=c
print(a if a!=T+1 else 'TLE')
|
p03077
|
s898104788
|
Accepted
|
n=int(input())
p=float("INF")
for i in range(5):
p=min(p,int(input()))
if n%p==0:
print(n//p+4)
else:
print(n//p+5)
|
p02687
|
s830239639
|
Accepted
|
taikai = input()
if taikai == 'ARC':
print('ABC')
elif taikai == 'ABC':
print('ARC')
|
p03377
|
s834500709
|
Wrong Answer
|
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
A,B,X = LI()
if A + B >= X:
print('Yes')
else:
print('No')
|
p04045
|
s382875522
|
Wrong Answer
|
N, K = map(int, input().split())
D = set(map(int, input().split()))
digits = list({0, 1, 2, 3, 4, 5, 6, 7, 8, 9} - D)
N = str(N)
res = 0
for c in N:
n_digit = int(c)
if n_digit <= digits[0]:
res = res*10 + digits[0]
continue
if len(digits):
for i in range(1, 10-K):
if n_digit <= digits[i] and n_digit > digits[i-1]:
res = res*10 + digits[i]
break
print(res)
|
p03327
|
s548331837
|
Accepted
|
N = int(input())
if N > 999:
print('ABD')
else:
print('ABC')
|
p03071
|
s941794732
|
Accepted
|
a, b = map(int, input().split())
if a == b:
print(a*2)
else:
print(max(a, b)*2-1)
|
p02556
|
s726989220
|
Accepted
|
n = int(input())
X_min = float("inf")
X_max = -float("inf")
Y_min = float("inf")
Y_max = -float("inf")
for _ in range(n):
x, y = map(int, input().split())
X = x - y
Y = x + y
X_min = min(X_min, X)
X_max = max(X_max, X)
Y_min = min(Y_min, Y)
Y_max = max(Y_max, Y)
print(max(X_max-X_min, Y_max-Y_min))
|
p02645
|
s073934293
|
Accepted
|
name = input()
print(name[:3])
|
p03030
|
s696604562
|
Accepted
|
n = int(input())
sp = []
for i in range(n):
s, p = input().split()
sp.append((s, -int(p), i))#sortedใๆ้ ใซใชใใใpใ-ใซใใ
res = sorted(sp)
for i in range(n):
print(res[i][2]+1)
|
p02658
|
s398528654
|
Accepted
|
N=int(input())
As=list(map(int,input().split()))
Ans=1
if As.count(0):
print(0)
exit()
else:
for A in range(N):
if Ans>10**18:
Ans=-1
print(Ans)
exit()
else:
NewAns=Ans*As[A]
Ans=NewAns
if Ans>10**18:
Ans=-1
print(Ans)
|
p03380
|
s181984102
|
Accepted
|
import bisect
n = int(input())
a = list(map(int, input().split()))
a.sort()
ci = a[-1]
index = bisect.bisect_left(a, ci/2)
if abs(a[index]-ci/2)<abs(a[index-1]-ci/2):
print(ci, a[index])
else:
print(ci, a[index-1])
|
p02547
|
s671760744
|
Wrong Answer
|
num = int(input())
count = 0
tmp = 0
for i in range(num):
d1, d2 = map(int,input().split())
if d1 == d2 and tmp == 0:
count = 1
tmp += 1
elif d1 == d2 and tmp > 0:
count += 1
tmp += 1
else:
tmp = 0
print("Yes" if count >= 3 else "No")
|
p03745
|
s837403482
|
Accepted
|
N = int(input())
A = list(map(int,input().split()))
ans = 1
mode = 0
for i in range(N-1):
if mode == 0:
if A[i] < A[i+1]:
mode = 1
elif A[i] > A[i+1]:
mode = -1
else:
mode = 0
if mode == 1:
if A[i] > A[i+1]:
ans += 1
mode = 0
elif mode == -1:
if A[i] < A[i+1]:
ans += 1
mode = 0
else:
pass
print(ans)
|
p02935
|
s634717761
|
Accepted
|
N = int(input())
v_list = sorted(list(map(int,input().split())))
sum = 0
a = 0
if N == 1:
sum += v_list[0]
elif N == 2:
sum += (v_list[0] + v_list[1])/2
else:
sum += (v_list[0] + v_list[1]) * 2 ** (-N + 1)
for i in range(N-2):
sum += v_list[i+2] * 2 ** (-N + i + 2)
print(sum)
|
p02554
|
s456332483
|
Accepted
|
n = int(input())
mod = 10**9+7
print((10**n-2*(9**n)+(8**n))%mod)
|
p02712
|
s885544547
|
Accepted
|
N = int(input())
numbers = [n for n in range(1, N + 1) if n % 3 != 0 and n % 5 != 0]
print(sum(numbers))
|
p03106
|
s067313207
|
Accepted
|
A, B, K = map(int, input().split())
l = []
for i in range(1, min(A, B) + 1):
if A % i == 0 and B % i == 0:
l.append(i)
print(l[-K])
|
p03804
|
s542205667
|
Wrong Answer
|
n,m = map(int, input().split())
al = [list(input()) for _ in range(n)]
bl = [list(input()) for _ in range(m)]
def same(h,w):
for hi in range(m):
for wi in range(m):
if al[h+hi][w+wi]!=bl[hi][wi]:
return False
return True
for hi in range(n-m):
for wi in range(n-m):
if same(hi,wi):
print("Yes")
exit()
print("No")
|
p02833
|
s060417864
|
Accepted
|
n = int(input())
if n % 2 == 1:
print(0)
exit()
n = n // 10
score = n
while n > 4:
n //= 5
score += n
print(score)
|
p02993
|
s067120175
|
Accepted
|
S = input()
f = False
for i in range(len(S)-1):
if S[i] == S[i + 1]:
f = True
break
if f:
print("Bad")
else:
print("Good")
|
p02718
|
s498356784
|
Wrong Answer
|
N,M = map(int,input().split())
A = list(map(int,input().split()))
sumOfA = sum(A)
condition = sumOfA//(4*M)
flag = 0
for i in A:
if(i >= condition):
flag += 1
else:
continue
if(flag==M):
print("Yes")
break
if(flag < M):
print("No")
|
p02831
|
s520134130
|
Wrong Answer
|
num1, num2 = map(int, input().split())
def factor(num):
l = []
for i in range(2,num+1):
if num%i==0:
l.append(i)
return l
l1 = factor(num1)
l2 = factor(num2)
l1 = l1+l2
l = set(l1)
ans = 1
for _ in l:
ans = ans * _
print(ans)
|
p02612
|
s053008677
|
Wrong Answer
|
n=int(input())
print(min(n%1000,1000-n%1000))
|
p03351
|
s496765745
|
Wrong Answer
|
a, b, c, d = map(int, input().split())
if abs(a-b) < d and abs(b-c) < d:
print("Yes")
print("No")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.