problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03556
s757116551
Accepted
n = int(input()) ans = 1 for i in range(2, 10**5): if i*i <= n: ans = i*i print(ans)
p02924
s951258703
Accepted
n=int(input()) print(n*(n-1)//2)
p03062
s071451411
Accepted
n=int(input()) a=list(map(int,input().split())) dp=[[0 for i in range(2)] for i in range(n+1)] dp[0][0]=0 dp[0][1]=-10**9+1 for i in range(0,n): dp[i+1][0]=max(dp[i][0]+a[i] , dp[i][1]-a[i]) dp[i+1][1]=max(dp[i][0]-a[i] , dp[i][1]+a[i]) print(dp[n][0]) #解説AC
p02661
s231859847
Accepted
N = int(input()) ab = [list(map(int, input().split())) for i in range(N)] al = [] bl = [] for a,b in ab: al.append(a) bl.append(b) al.sort() bl.sort() if N%2 == 0: ans = (bl[N//2] + bl[N//2 -1]) - (al[N//2] + al[N//2 -1]) +1 else: ans = bl[N//2] - al[N//2] +1 print(ans)
p03479
s493800778
Wrong Answer
import sys sys.setrecursionlimit(10000) x,y = map(int,input().split()) asn = 0 def dfs(x,y,n): n += 1 ans = x*2**n if ans > y: return n else: return dfs(x,y,n) a = dfs(x,y,1) print(a)
p02900
s075782753
Accepted
a, b = map(int, input().split()) def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) return a print(len(set(prime_factorize(a)).intersection(set(prime_factorize(b))))+1)
p03437
s505718843
Accepted
X, Y = map(int, input().split()) print(-1 if X % Y == 0 else X)
p02792
s510765910
Accepted
N=int(input()) ls=[[0]*9 for _ in range(9)] for i in range(1,N+1): a=i while a//10!=0: a//=10 b=i%10 if b!=0: ls[a-1][b-1]+=1 ans=0 for i in range(1,10): for j in range(1,10): ans+=ls[i-1][j-1]*ls[j-1][i-1] print(ans)
p02633
s218625296
Accepted
x=int(input()) ans=1 now=x while now%360!=0: now+=x ans+=1 print(ans)
p02582
s709887464
Accepted
S = input() if S == "RRR": print(3) elif S == "RRS": print(2) elif S == "SRR": print(2) elif S == "RSR": print(1) elif S == "SRS": print(1) elif S == "RSS": print(1) elif S == "SSR": print(1) else: print(0)
p03239
s691024467
Wrong Answer
N,T=map(int,input().split()) CT=[[0,0]]*N i=0 while i<N: CT[i]=list(map(int,input().split())) i+=1 CT=sorted(CT) print(CT) ans='TLE' for x,y in CT: if y<=T: ans=x break print(ans)
p02627
s471178481
Wrong Answer
def main(): S=input() if ord(S)<=65: print(chr(ord(S)+32)) else: print(chr(ord(S)-32)) main()
p03472
s137578414
Accepted
import bisect from math import ceil N,H,*abf = map(int, open(0).read().split()) ab = [abf[i:i+2] for i in range(0, len(abf), 2)] a = sorted([x[0] for x in ab],reverse=True) b = sorted([x[1] for x in ab],reverse=True) br = list(reversed(b)) bs = bisect.bisect_right(br,a[0]) ans = 0 rem = H for i in range(N-bs): rem -= b[i] ans += 1 if rem <= 0: print(ans) break else: ans += ceil(rem/a[0]) print(ans)
p03612
s490287925
Accepted
n=int(input()) p=[int(x) for x in input().split()] cnt=0 for i in range(n-1): if i+1 == p[i]: cnt+=1 p[i+1]=p[i] else: mae=p[i] if p[n-1]==n: print(cnt+1) else: print(cnt)
p02785
s596908362
Wrong Answer
N, K = input().split() H = input().split() H.sort() N = int(N) K = int(K) sum = 0 if(N - K <= 0): sum = 0 else: for i in range(N): if(i < N - K): sum += int(H[i]) print(sum)
p02860
s483835878
Accepted
n = int(input()) s = input() if n%2 == 1: print('No') else: s1, s2 = s[:n//2], s[n//2:] if s1 == s2: print('Yes') else: print('No')
p03836
s146964499
Accepted
sx,sy,tx,ty = map(int, input().split()) y1=ty-sy x1=tx-sx a = "U"*y1+"R"*x1+"D"*y1+"L"*x1+"L"+"U"*(y1+1)+"R"*(x1+1)+"D"+"R"+"D"*(y1+1)+"L"*(x1+1)+"U" print(a)
p02773
s059029370
Accepted
from collections import Counter n = int(input()) s = [input() for i in range(n)] d = Counter(s) m = max(d.values()) ans = [i for i in d if d[i] == m] ans = sorted(ans) for i in ans: print(i)
p02773
s221817020
Accepted
from collections import defaultdict n = int(input()) ss = [input().strip() for _ in range(n)] counts = defaultdict(int) for s in ss: counts[s] += 1 items = list(counts.items()) items = sorted(items, key=lambda c: c[1], reverse=True) max_value = items[0][1] max_items = [item for item in items if item[1] == max_value] keys = [item[0] for item in max_items] keys = sorted(keys) for key in keys: print(key)
p03457
s167947075
Accepted
n = int(input()) P = [[0, 0, 0]] f = True for i in range(n): t, x, y = map(int, input().split()) s = abs(x - P[i][1]) + abs(y-P[i][2]) if s > t-P[i][0] or (t-P[i][0] - s)%2 == 1: f = False P.append([t, x, y]) if f: print("Yes") else: print("No")
p02633
s500021099
Accepted
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) #空白あり def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし X = I() from math import gcd print(360//gcd(360,X))
p02801
s000204086
Wrong Answer
x = ord(input()) ind = (x - ord("A")+1)%26 print(chr(ind+ord("A")))
p02823
s260770627
Accepted
N,A,B = map(int, input().split()) if (B-A)%2==0: print((B-A)//2) else: print(min(A-1,N-B)+1+(B-A-1)//2)
p03106
s398463984
Accepted
A, B, K = map(int, input().split()) result = [] num = A if A > B else B for i in range(1, num+1): if A % i == 0 and B % i == 0: result.append(i) result.sort(reverse=True) print(result[K-1])
p03943
s742470853
Wrong Answer
a,b,c=map(int,input().split()) if a+b==c or a+c==b or b+c==a: print("YES") else: print("NO")
p03481
s706090059
Wrong Answer
X, Y = map(int, input().split()) cnt = 1 calc = X while calc <= Y: cnt += 1 calc = X*(2**cnt) print(cnt)
p03698
s900033317
Accepted
S=input() if len(S) == len(set(S)): print("yes") else: print("no")
p04033
s574881905
Accepted
a,b=map(int, input().split()) ans=1 if a <= 0 and b >= 0: print('Zero') exit(0) if a>0 and b > 0: print('Positive') exit(0) if a <0 and b<0: d=abs(b-a)+1 if d %2==0: print('Positive') exit(0) else: print('Negative') exit(0)
p03161
s769628450
Accepted
import sys data = sys.stdin.readlines() n, k = list(map(int, data[0].split())) h = list(map(int, data[1].split())) dp = [-1] * n dp[0] = 0 for i in range(1, min(n, k)): dp[i] = min([dp[j] + abs(h[i]-h[j]) for j in range(i)]) for i in range(k, n): dp[i] = min([dp[i-j] + abs(h[i]-h[i-j]) for j in range(1, k+1)]) print(dp[n-1])
p03331
s746412605
Accepted
N = int(input()) if (N%10 == 0): print(10) exit() a = [] while N > 0: a.append(N%10) N //= 10 print(sum(a))
p02647
s475162868
Wrong Answer
n,k = map(int,input().split()) a = list(map(int,input().split())) for x in range(k-1): b = [0]*n for x in range(n-1): if a[x] != 0: add = [1]*(a[x]*2+1) b = [x + y for (x, y) in zip(a, b)] a = [x + y for (x, y) in zip(a, b)] print(a)
p03282
s043776112
Accepted
S=input() K=int(input()) for i in range(min(len(S),K)): if S[i]>="2": print(S[i]) exit() print("1")
p04012
s893892920
Accepted
# -*- coding: utf-8 -*- s = input().strip() W_dic={ w:0 for w in s } for w in s: W_dic[w] += 1 for v in W_dic.values(): if v % 2 != 0: print("No") break else: print("Yes")
p03211
s371584854
Accepted
s = input() min_ = 10**18 for i in range(len(s)-2): min_ = min(min_, abs(753 - int(s[i:i+3]))) print(min_)
p03380
s130176318
Accepted
N=int(input()) l=list(map(int,input().split())) A=max(l) mid=(A//2)+1 if A%2!=0 else A//2 dis_min=float("Inf") l.sort() ans=1 for i in l: if dis_min>abs(i-mid): dis_min=abs(i-mid) ans=i print(A,ans)
p02879
s921077886
Wrong Answer
a, b = map(int, input().split()) if 1<a<10 and 1<b<10: print(a*b) else: print(-1)
p02854
s607375684
Accepted
N = int(input()) A = list(map(int,input().split())) for i in range(1,N): A[i] += A[i-1] diff_min = 10**16 for i in range(N): diff_min = min(diff_min,abs(A[N-1]-2*A[i])) print(diff_min)
p03012
s955443887
Accepted
n = int(input()) w = list(map(int, input().split())) center = sum(w)//2 sml = 0 i = 0 while sml < center: sml += w[i] i += 1 i -= 1 smr = sum(w)-sml if sml-smr > smr+w[i]-(sml-w[i]): print(smr+w[i]-(sml-w[i])) else: print(sml-smr)
p02993
s732383686
Wrong Answer
s=input() a=[] n=0 for i in s: a.append(i) result='Good' while n<=3: if a[n]==a[n-1]: result='Bad' n+=1 print(result)
p03282
s226292528
Accepted
import sys import math s=input() k = int(input()) cnt = False ans=0 for i in range(0,k): if s[i] != '1': ans = s[i] cnt = True break if (not cnt): print(1) else: print(ans)
p03481
s267603643
Wrong Answer
import math x, y = list(map(int, input().split())) ans = int(math.log2(y//x)) + 1 print(ans)
p03221
s341675588
Accepted
n, m = [int(x) for x in input().split(' ')] cities = list() for i in range(m): pi, pm = [int(x) for x in input().split(' ')] cities.append([pi, pm, i]) p = [0] * (n+1) for c in sorted(cities, key=lambda city: city[1]): # sort by year p[c[0]] += 1 # city birth order c.append(p[c[0]]) for c in cities: print('{:06d}{:06d}'.format(c[0], c[3]))
p02785
s120228663
Accepted
N, K = list(map(int, input().split())) H = list(map(int, input().split())) def calCount(h): if K > N: return 0 return sum(h[K:]) H.sort(reverse=True) print(calCount(H))
p02971
s728469026
Wrong Answer
import copy N=int(input()) A=[] for _ in range(N): A.append(input()) A_max=max(A) M=[i for i,x in enumerate(A) if x==A_max] if len(M)>=2: for i in range(N): print(A_max) else: for j in range(N): if j!=M[0]: print(A_max) else: B=copy.copy(A) B.remove(A_max) print(max(B))
p02664
s599048214
Accepted
a = ['D' if i == '?' else i for i in input()] print("".join(a))
p02684
s750062418
Accepted
n,k = map(int,input().split()) A = list(map(int,input().split())) t = 0 c = 0 ans = [0] * n L = [] s = 0 for _ in range(k): if ans[t] == 1: n = len(L) - L.index(t) temp = (k-c)%n t = L[L.index(t):][temp] break else: ans[t] = 1 L.append(t) t = A[t]-1 c += 1 print(t+1)
p03673
s198666775
Accepted
from collections import deque d = deque() n = int(input()) a = list(map(int, input().split())) for i in range(n): if i % 2 == 0: d.append(a[i]) else: d.appendleft(a[i]) if n % 2 == 1: d.reverse() for i in d: print(i)
p03282
s411317845
Wrong Answer
S=(input()) s=list(S) K=int(input()) if K==1: print(s[0]) exit() for i in range(len(s)): key=s[i] if key!='1': print(key) exit()
p03698
s680582726
Wrong Answer
s=str(input()) s=list(s) for i in range(0,len(s)): temp=s.count(s[i]) if temp!=1: print("no") else: print("yes")
p03854
s645247544
Wrong Answer
s=input() import re #re.match は複数を対象にすればマッチする該当のものが返される。一つの時ifの後に持ってくると条件式として利用可能。 if re.match("(dream|dreamer|erase|eraser)+",s) : print("YES") else: print("NO")
p02714
s030293926
Accepted
N = int(input()) S = input() r = S.count("R") g = S.count("G") b = S.count("B") ans = r * g * b for i in range(N-2): t = 1 while i + 2 * t < N: if(S[i] != S[i+t] and S[i] != S[i+2*t] and S[i+t] != S[i+2*t]): ans -= 1 t += 1 print(ans)
p02547
s967447344
Accepted
n = int(input()) lis = [list(map(int,input().split())) for _ in range(n)] cnt = 0 flg = 0 for i in lis: if i[0]==i[1]: cnt += 1 if cnt >= 3: flg = 1 else: cnt = 0 if flg == 1: print('Yes') else: print('No')
p02570
s401696343
Accepted
D,T,S=map(int, input().split()) if S*T >= D: print("Yes") else: print("No")
p03862
s054781067
Accepted
n, x = map(int, input().split()) a = list(map(int, input().split())) c = 0 if a[0] > x: c += a[0] - x a[0] = x for i in range(1, n): if a[i - 1] + a[i] > x: c += a[i - 1] + a[i] - x a[i] = x - a[i - 1] print(c)
p03419
s391233810
Accepted
N, M = map(int, input().split()) if N == 1 and M == 1: print(1) elif N == 1 or M == 1: print(max(N, M) - 2) else: print((N - 2) * (M - 2))
p02629
s071420929
Accepted
n = int(input()) - 1 def f(n): p = 0 ans=[] while True: if n >= 26**(p+1): n -=26**(p+1) p+=1 else: for i in range(p+1): ans.append( chr( ord('a') + n%26 ) ) n //= 26 break print(''.join(reversed(ans))) f(n)
p02571
s812730713
Wrong Answer
def main(): min_num = len(T) for i in range(len(S)): count = 0 for j in range(len(T)): if i+j > len(S)-1: break if S[i+j] == T[j]: count += 1 min_num = min_num if min_num < len(T)-count else len(T)-count print(min_num) S = input() T = input() main()
p02642
s307284659
Wrong Answer
n = int(input()) a = list(map(int, input().split())) a.sort() l = [True] * (10**6 + 1) cnt = 0 for i in range(n): d = a[i] if l[d]: if i < n-1 and a[i] != a[i+1]: cnt += 1 elif i == n-1: cnt += 1 for j in range(d, 10**6 + 1, d): l[d] = False print(cnt)
p02847
s312731232
Accepted
li = ["MON","TUE","WED","THU","FRI","SAT","SUN"] s = input() if s=="SUN": print(7) else: i = li.index(s) print(6-i)
p03359
s856674655
Wrong Answer
a, b = map(int, input().split()) ans = 0 for i in range(1, a+1): for j in range(1, b+1): if i==j: ans += 1 print(ans)
p02952
s586622610
Accepted
N = int(input()) cnt = 0 for i in range(1, N+1): i = str(i) if len(i)%2 != 0: cnt += 1 print(cnt)
p02888
s534497807
Accepted
n = int(input()) l = list(map(int,input().split())) l = sorted(l) c=0 import bisect 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)
p04043
s525508093
Accepted
t = list(map(int,input().split())) if t.count(5)==2 and t.count(7)==1: print('YES') else: print('NO')
p02860
s380151852
Accepted
import sys n=int(input()) S=input() if n%2==0: s=S[:n//2] t=S[n//2:] if s==t: print("Yes") sys.exit() print("No")
p02972
s527350913
Accepted
n=int(input()) A=list(map(int,input().split())) B=[0]*(n+1) C,cnt=[],0 for i in range(1,n+1)[::-1]: sum_list=sum([B[j] for j in range(i,n+1,i)]) if sum_list%2!=A[i-1]: B[i]=1 cnt +=1 C.append(i) print(cnt) print(*C[::-1])
p02719
s886021585
Wrong Answer
i = list(map(int, input().split())) N = i[0] K = i[1] for i in range(1000000): if i == 0: min = abs(N-K) min = abs(min-K) if (min-K) < 0: break if min > 5: print('0') else: print(min)
p03017
s249479510
Wrong Answer
N, A, B, C, D = map(int, input().split()) N-=1 A-=1 B-=1 C-=1 D-=1 S = input() massesExist = True overtakeFlag = False if C > D else True proceedableFlag = True if max(A, B, C, D) > N: massesExist = False for i in range(B, D-1): if S[i-1] == "." and S[i] == "." and S[i+1] == ".": overtakeFlag = True for i in range(A, max(C, D)-1): if S[i]=="#" and S[i+1]=="#": proceedableFlag = False if overtakeFlag and proceedableFlag and massesExist: print("Yes") else: print("No")
p02719
s688767601
Wrong Answer
#C N, K = map(int, input().split()) ans = N if N <= abs(N-K): pass else: for i in range(N+1): try: if ((N-i) / K).is_integer(): ans = i break elif ((N+i) / K).is_integer(): ans = i break except: break print(ans)
p03623
s975935118
Accepted
x, a, b = map(int,input().split()) if abs(a - x) < abs(b - x): print('A') else: print('B')
p03774
s513409362
Wrong Answer
N,M = map(int, input().split()) S = [list(map(int,input().split())) for _ in range(N)] C = [list(map(int,input().split())) for _ in range(M)] for a,b in S: distance = 10**10 ans = 0 for c,d in C: #print(abs(a - c) + abs(b - d)) if abs(a - c) + abs(b - d) < distance: distance = abs(a - c) + abs(b - d) ans += 1 print(ans)
p03161
s368084914
Wrong Answer
n,k=map(int,input().split()) h=list(map(int,input().split())) dp=[10**5]*n for i in range(n): if i==0: dp[i]=0 elif i==1: dp[i]=abs(h[1]-h[0]) else: for j in range(1,min(i,k)+1): dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j])) print(dp[-1])
p02820
s753087149
Accepted
n,k=map(int,input().split()) r,s,p=map(int,input().split()) t=list(input()) a=(t.count("r"))*p+(t.count("s"))*r+(t.count("p"))*s for i in range(n-k): if t[i]==t[i+k]: if t[i]=="r": a-=p elif t[i]=="s": a-=r elif t[i]=="p": a-=s t[i+k]=i print(a)
p03250
s651733884
Wrong Answer
a,b,c = map(int,input().split()) l=sorted([a,b,c]) int(str(l[2])+str(l[1]))+l[0]
p03062
s468404889
Wrong Answer
n = int(input()) a_list = list(map(int,input().split())) dp = [[0] * 2 for _ in range(n-1)] dp[0][0] = a_list[0] + a_list[1] dp[0][1] = -1*(a_list[0] + a_list[1]) for i in range(1,n-1): dp[i][0] = max(dp[i-1][0] + a_list[i+1] , dp[i-1][1] + a_list[i+1]) dp[i][1] = max(dp[i-1][0] - a_list[i+1] -2*a_list[i-1], dp[i-1][1] - a_list[i+1]+2*a_list[i-1]) print(max(dp[n-2][0] ,dp[n-2][1]))
p02922
s517073853
Accepted
import math A,B=map(int,input().split()) print(int(math.ceil((B-1)/(A-1))))
p02677
s982999930
Wrong Answer
import math a,b,h,m=map(int,input().split()) h=h*30+(m/60)*30 m=m*6 diff=abs(h-m)*((math.pi)/180) if(diff>180): diff=diff-180 ans=a*a+b*b-2*a*b*abs(math.cos(diff)) print(math.sqrt(ans))
p02701
s717005243
Accepted
from sys import stdin def main(): times = int(stdin.readline()) results = [] for x in range(times): results.append(stdin.readline()) print(len(set(results))) main()
p03617
s447302799
Accepted
Q,H,S,D = map(int, input().split()) N = int(input()) if N >=2: if N%2 == 0: ans = N//2*min([8*Q,4*H,2*S,D]) else: ans = (N-1)//2*min([8*Q,4*H,2*S,D]) + min([4*Q,2*H,S]) else: ans = min([4*Q,2*H,S]) print(ans)
p03723
s431627543
Accepted
a, b, c = map(int, input().split()) ans = 0 if a == b == c and a != 1: ans = -1 else: while a % 2 == b % 2 == c % 2 == 0: x = a // 2 y = b // 2 z = c // 2 if x % 2 == y % 2 == z % 2: a = y + z b = z + x c = z + x ans += 1 else: ans += 1 break print(ans)
p03785
s543073308
Accepted
N, C, K = map(int, input().split()) T = [0 for _ in range(N)] for __ in range(N): T[__] = int(input()) T.sort() bus_count = 1 bus_rest = C bus_depert = T[0]+K for ix in range(N): if T[ix] <= bus_depert and bus_rest > 0: bus_rest -= 1 else: bus_count += 1 bus_depert = T[ix] + K bus_rest = C - 1 print(bus_count)
p03107
s816125335
Accepted
s = input() ans = min(s.count("0"), s.count("1"))*2 print(ans)
p02743
s128336399
Accepted
import math from decimal import Decimal a,b,c = [int(x) for x in input().split()] if (Decimal(a).sqrt() + Decimal(b).sqrt()) < Decimal(c).sqrt(): print("Yes") else: print("No")
p03494
s642952698
Wrong Answer
s = input() ans = 1000000 for i in range(len(s) - 2): ans = min(ans , abs(int(s[i : i + 3]) - 753)) print(ans)
p02790
s540332483
Wrong Answer
a,b=map(int,input().split()) l=[[1,1],[2,11],[3,111],[4,1111],[5,11111],[6,111111],[7,1111111],[8,11111111],[9,111111111]] c=0 d=0 for i in range(9): if l[i][0]==a: c=b*l[i][1] if l[i][0]==b: d=a*l[i][1] print(min(c,d))
p04045
s605538889
Wrong Answer
n,k = map(int,input().split()) d = input().split() for i in range(n,10000): for j in range(k): for l in range(len(str(n))): if str(n)[l] == str(d)[j]: break else: continue break else: print(i) break n += 1
p02917
s373443972
Accepted
n = int(input()) B = list(map(int,input().split())) A = [0]*n A[0] = B[0] for i in range(1,n-1): if B[i-1] >= B[i]: A[i] = B[i] else: A[i] = B[i-1] else: A[n-1] = B[n-2] print(sum(A))
p03485
s658201315
Accepted
import math a,b = map(int, input().split()) print(math.ceil( (a + b) / 2))
p03323
s281142254
Accepted
A,B=map(int,input().split()) if max(A,B) <=8: print("Yay!") else: print(":(")
p03042
s259715531
Accepted
S = input() Month = [] for i in range(1,13): if i < 10: Month.append("0" + str(i)) else: Month.append(str(i)) YYMMpt = 0 MMYYpt = 0 if S[0:2] in Month: MMYYpt += 1 if S[2:4] in Month: YYMMpt += 1 if YYMMpt == 0 and MMYYpt == 0: print("NA") elif YYMMpt == 0 and MMYYpt == 1: print("MMYY") elif YYMMpt == 1 and MMYYpt == 0: print("YYMM") else: print("AMBIGUOUS")
p03486
s213086140
Accepted
s = list(input()) s.sort() t = list(input()) t.sort() t.reverse() print('Yes' if s < t else 'No')
p02754
s306512064
Accepted
n, a, b = map(int, input().split()) rest = n % (a + b) block = (n // (a + b)) * a if a <= rest: print(block + a) else: print(block + rest)
p02880
s321954304
Wrong Answer
import sys n=int(input()) if n<=81: for i in range(1,10): if n%i!=0: print('No') sys.exit() print('Yes') else: print('No')
p03745
s133558746
Accepted
N = int(input()) A = list(map(int, input().split())) L = [A[0]] for i in range(1, N): if A[i] != A[i - 1]: L.append(A[i]) N = len(L) if N == 1: print(1) exit() f = L[1] > L[0] ans = 1 i = 2 while i < N: if (L[i] > L[i - 1]) != f: ans += 1 if i == N - 1: break i += 1 f = L[i] > L[i - 1] i += 1 print(ans)
p03632
s567710181
Accepted
import sys A,B,C,D = map(int,input().split()) if A < 0 or B < 0 or B <= A or A > 100 or B > 100: sys.exit() if C < 0 or D < 0 or D <= C or C > 100 or D > 100: sys.exit() count = 0 for I in range(A,B): for J in range(C,D): if I == J: count += 1 print(count)
p03767
s947279961
Wrong Answer
def getInput(): return [int(i) for i in input().rstrip().split(' ')] N = getInput()[0] a_i = getInput() a_i.sort(reverse=True) lst = [a_i[i] for i in range(len(a_i)-1) if i >= N and i < 2*N] print(sum(lst))
p02615
s031518257
Accepted
from sys import stdin import sys import math from functools import reduce import functools import itertools from collections import deque,Counter,defaultdict from operator import mul import copy # ! /usr/bin/env python # -*- coding: utf-8 -*- import heapq sys.setrecursionlimit(10**6) # INF = float("inf") INF = 10**18 import bisect import statistics mod = 10**9+7 # mod = 998244353 N = int(input()) A = list(map(int, input().split())) A = sorted(A, reverse=True) ans = A[0] for i in range(N-2): ans += A[i//2+1] print(ans)
p03001
s122528031
Accepted
W,H,x,y = map(int,input().split()) if x == W/2 and y == H/2: res = 1 else: res = 0 print(W*H/2,res)
p03673
s399748723
Wrong Answer
import sys input = sys.stdin.readline n = int(input()) a = list(map(int,input().split())) from collections import deque ans = deque([a[0]]) odd = True for i in range(1,n): if odd: ans.appendleft(a[i]) odd = False else: ans.append(a[i]) odd = True ans = list(ans) for i in range(n): print(ans[i],end = ' ')
p02953
s582047496
Accepted
n = int(input()) h_list = [int(x) for x in input().split()] ans = "Yes" h_pre = h_list[0] for h in h_list: if h > h_pre: h -= 1 elif h < h_pre: ans = "No" break h_pre = h print(ans)
p02848
s584779984
Accepted
n=int(input()) s=input() ans="" for i in range(len(s)): tmp=ord(s[i])+n if tmp>90: tmp-=26 ans+=chr(tmp) print(ans)