problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03087
s359294093
Accepted
def main(): N, Q = map(int, input().split(" ")) S = input() result = [0] * (N + 1) for i in range(1, N + 1): if S[i-1:i+1] == "AC": result[i] = result[i - 1] + 1 else: result[i] = result[i - 1] for _ in range(Q): l, r = map(int, input().split(" ")) print(result[r - 1] - result[l - 1]) if __name__ == '__main__': main()
p03417
s571063158
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))
p02860
s250117515
Wrong Answer
yes = "Yes" no = "No" def main(): N = int(input()) S = input().strip() if N % 2 != 0: print(no) return mid = N // 2 left = S[:mid] right = S[:mid] if left == right: print(yes) else: print(no) if __name__ == "__main__": main()
p03557
s151817708
Accepted
import bisect def main(): N=int(input()) A=sorted(list(map(int,input().split()))) B=sorted(list(map(int,input().split()))) C=sorted(list(map(int,input().split()))) ans=0 for b in B: a=bisect.bisect_left(A,b) c=N-bisect.bisect_right(C,b) ans+=a*c print(ans) if __name__=="__main__": main()
p02743
s095629578
Accepted
import sys input=sys.stdin.readline from math import * a,b,c=map(int,input().split()) if (c-a-b)**2>4*a*b and c-a-b>0: print("Yes") else: print("No")
p04030
s547507202
Accepted
s = str(input()) ans = "" for i in range(len(s)): if s[i] == "0": ans += "0" elif s[i] == "1": ans += "1" else: if len(ans) == 0: continue else: ans = ans[:-1] print(ans)
p03324
s653311473
Accepted
d,n = map(int,input().split()) if n == 100: print(100**d*(101)) else: print(100**d*n)
p03797
s627297220
Accepted
n, m = list(map(int, input().split())) res = 0 if n > m // 2: res = m // 2 print(res) else: res = n n -= res m -= res * 2 # ここでnは0 res += m // 4 print(res)
p02780
s535535383
Wrong Answer
def su(n): ans=0 for i in range(1,n+1): ans+=i return ans n,k=map(int,input().split()) p=list(map(int,input().split())) p=sorted(p,reverse=True) ans=0 for i in range(k): ans+=su(p[i])/p[i] print(ans)
p03433
s965459122
Accepted
# -*- coding: utf-8 -*- # 整数の入力 n = int(input()) a = int(input()) if n < 500: if n <= a: print('Yes') else: print('No') else: amari = n%500 if amari <= a: print('Yes') else: print('No')
p02947
s879010627
Accepted
N=int(input()) s=[list(input()) for _ in range(N)] b=0 cnt=0 for i in range(N): s[i].sort() s.sort() for i in range(N-1): if s[i]==s[i+1]: b=b+1 if not(s[i]==s[i+1])and(s[i]!=0): cnt=cnt+(b*(b+1))//2 b=0 #print(b) cnt=cnt+(b*(b+1))//2 print(cnt)
p03416
s088233128
Wrong Answer
a,b=map(int,input().split()) cnt=0 for i in range(a,b+1): s=str(i) for j in range(len(s)//2): same=1 if s[j]!=s[-1*(j+1)]: same=0 if same==1: cnt+=1 print(cnt)
p03328
s146842097
Accepted
a,b = map(int,input().split()) print((b-a)*(b-a+1)//2-b)
p03696
s307874462
Accepted
N = int(input()) S = input() R=0;L=0 for i in range(N): if S[i] == ')': if L == 0: R+=1 else: L -= 1 else: L += 1 Answer = '(' * R + S + ')' * L print(Answer)
p03612
s211051957
Accepted
n=int(input()) p= list(map(int,input().split())) cnt=0 cnt2 = 0 c = 1.1 for i in range(n): if p[i] == i+1: cnt += 1 if i - c == 1: cnt2 += 1 c = 1.1 else: c = i ans = (cnt-2*cnt2) + cnt2 print(ans)
p03059
s694768111
Accepted
A, B, T = map(int, input().split()) t = T//A print(t*B)
p02642
s141509715
Accepted
from collections import Counter n=int(input()) a=list(map(int,input().split())) ma=max(a) a.sort() era=[1]*(ma+1) #0と1はふるいにかけられている。 cn=Counter(a) count=0 for i in range(n): if era[a[i]]==0:continue else: era[a[i]]=0 if cn[a[i]]==1: count+=1 for j in range(2*a[i],ma+1,a[i]): era[j]=0 print(count)
p03379
s129875525
Accepted
N = int(input()) X = list(map(int, input().split())) Y = sorted(X) small = Y[N//2 - 1] big = Y[N//2] for x in X: if x <= small: print(big) elif x >= big: print(small)
p02948
s816603897
Wrong Answer
import itertools class Sato(): def __init__(self): pass N, M = map(int,input().split()) S = [] money = 0 max_money = 0 for _ in range(N): S.append(list(map(int, input().split()))) C = list(itertools.permutations(range(N), M)) for i in C: for j,elem in enumerate(i): if S[elem][0] + j <= M: money += S[elem][1] if money > max_money: max_money = money money = 0 print(max_money)
p02922
s711108475
Wrong Answer
def calulate(m, n) : n_adapters = 0 if n <= m : n_adapters = 1 else : n_adapters = n//m if n % m != 0: n_adapters += 1 return n_adapters M, N = map(int, input().split()) print(calulate(M, N))
p02820
s561661107
Accepted
N, K = map(int, input().split()) R, S, P = map(int, input().split()) T = input() win = [True] * len(T) dic = {'r':P, 's':R, 'p':S} sum = 0 for i in range(K): sum += dic[T[i]] for i in range(K, len(T)): if T[i] == T[i - K] and win[i - K]: win[i] = False else: sum += dic[T[i]] print(sum)
p02702
s068938725
Accepted
S = input() N = len(S) mod = 2019 cnt = [0 for _ in range(2019)] S = S[::-1] wk = 0 cnt[0] = 1 for i in range(0,N): wk = (wk + int(S[i]) * pow(10,i,mod)) % mod #print(i,wk) cnt[wk] += 1 ans = 0 for i in range(2019): m = cnt[i] ans += m * (m-1) // 2 print(ans)
p03206
s831816976
Wrong Answer
D = int(input()) ans = "Cristmas" ans += " Eve" * (25 - D) print(ans)
p03455
s603891341
Wrong Answer
a, b = map(int, input().split()) if (a | b) & 0: print("Even") else: print("Odd")
p03665
s240262365
Accepted
DP = [[0 for _ in range(2)] for _ in range(55)] DP[0][0] = 1 N, P, *A = map(int, open(0).read().split()) for i in range(N): DP[i+1][0] += DP[i][0] DP[i+1][0] += DP[i][A[i]%2] DP[i+1][1] += DP[i][1] DP[i+1][1] += DP[i][(A[i]%2)^1] print(DP[N][P])
p03069
s701184102
Accepted
import sys read = sys.stdin.read readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): n = int(input()) s = input() w = s.count(".") b = n - w ans = min(w, b) b = 0 for i in range(n): if s[i] == ".": w -= 1 else: b += 1 ans = min(ans, w + b) print(ans) if __name__ == '__main__': main()
p02547
s925212137
Accepted
n=int(input()) zoro=0 for i in range(n): d1,d2=map(int,input().split()) if d1==d2: zoro+=1 else: zoro=0 if zoro==3: print('Yes') exit() print('No')
p02712
s879323265
Accepted
N = int(input()) sum = 0 for i in range(1, N + 1): if (i % 3 == 0) or (i % 5 == 0): sum = sum else: sum = sum + i print(str(sum))
p03835
s844793564
Wrong Answer
k, s = map(int, input().split()) counter = 0 for x in range(k + 1): if x >= s: break for y in range(x, k + 1): z = s - x - y if y >= s: break if y <= z <= k: if x == y == z: counter += 1 elif x == y or y == z: counter += 3 else: counter += 6 print(counter)
p02959
s270976652
Accepted
import sys input = sys.stdin.buffer.readline N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 for i in range(N): if A[i] >= B[i]: ans += B[i] else: ans += A[i] tmp = min(B[i]-A[i], A[i+1]) ans += tmp A[i+1] -= tmp print(ans)
p03071
s324546934
Accepted
def q1(): A, B = (int(i) for i in input().split()) ans = 0 for i in range(2): if A > B: ans += A A -= 1 else: ans += B B -= 1 return ans if __name__ == '__main__': print(q1())
p03041
s873312399
Accepted
n,k = map(int, input().split()) s = input() s = s[:k-1] + s[k-1].lower() + s[k:] print(s)
p03605
s494077367
Accepted
n = input() if '9' in n: print('Yes') else: print('No')
p02696
s913265699
Accepted
a, b, n = map(int, input().split()) start = min(b - 1, n) def f(x): return int(a * x / b) - a * int(x / b) print(f(start))
p03469
s378684539
Accepted
S=list(input()) S[3]=8 print(''.join(map(str, S)))
p02814
s202059256
Accepted
from fractions import gcd def cntTwo(n): i = 0 while n % 2 == 0: i += 1 n //= 2 return i N, M = map(int, input().split()) A = list(map(int, input().split())) B = [a // 2 for a in A] c = 1 numTwo = cntTwo(B[0]) for b in B: if cntTwo(b) != numTwo: print(0) exit() c = b * c // gcd(c, b) ans = M // c if ans % 2 == 0: print(ans // 2) else: print(ans // 2 + 1)
p03293
s204778827
Accepted
s = list(input()) t = list(input()) for i in range(len(s)): s.insert(0, s.pop(-1)) if s == t: print("Yes") exit() print("No")
p02897
s406940764
Wrong Answer
n=int(input()) if n%2 == 0: print(float((n/2)/n)) elif n==1: print(1) else: print(float((n/2+1)/n))
p03767
s573558684
Wrong Answer
N = int(input()) a = sorted(list(map(int, input().split())))[::-1] print(sum(a[N:2*N]))
p02677
s971466295
Accepted
import math a, b, h, m = map(int, input().split()) theta = abs(6 * m - ((h*60)+m)*0.5) theta = min(360-theta, theta) ans = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(theta))) print(ans)
p03625
s248394585
Accepted
n=int(input()) a=list(map(int,input().split(' '))) x=0 y=0 a.sort() a.reverse() for i in range(len(a)-1): if a[i]==a[i+1]: x=a[i] p=i+1 break if x!=0: for i in range((p+1),len(a)-1): if a[i]==a[i+1]: y=a[i] break print(x*y)
p03860
s196266434
Accepted
A,s,C= input().split() res = s[0] print("A"+res+"C")
p04012
s293217661
Accepted
a=list(map(input().count,"abcdefghijklmnopqrstuvwxyz")) ng=False for x in a: if x%2: ng=True print("YNeos"[ng::2])
p02664
s283329046
Accepted
if __name__ == "__main__": print(input().replace('?', 'D'))
p02793
s908121601
Accepted
from fractions import gcd def lcm(c,d): return c//gcd(c,d)*d mod=10**9+7 n=int(input()) a=[int(i) for i in input().split()] l=a[0] for i in range(1,n): l=lcm(l,a[i]) ans=0 for i in range(n): ans+=l//a[i] #ans%=mod print(ans%mod)
p03592
s167365329
Accepted
N,M,K = map(int,input().split()) ans = "No" for a in range(N+1): if N - 2*a != 0: if (K - a*M) % (N - 2*a) == 0: if M >= (K - a*M) / (N - 2*a) >= 0: ans = "Yes" print(ans)
p02935
s393750171
Accepted
N=int(input()) A=list(map(int,input().split())) A.sort() for _ in range(N-1): t=(A.pop(0)+A.pop(0))/2 A.insert(0,t) print(*A)
p03239
s897895576
Wrong Answer
N, T = map(int, input().split()) c, t = list(map(int, input().split())) ans = 1001 i = 0 for i in range(N): if T > t and c < ans: ans = c if ans == 1000: print("TLE") else: print(ans)
p03673
s544975059
Wrong Answer
n = int(input()) a = list(map(int,input().split())) b = [] for i in a: b.append(i) b = b[::-1] print(b)
p03494
s325606318
Accepted
K = input() T = list(map(int,input().split())) def main(): count = 0 flg = 1 while(flg): for i in range(len(T)): if T[i] % 2 == 0: T[i] = T[i]/2 else: flg = 0 break count +=1 print(count-1) if __name__ == "__main__": main()
p03105
s969920387
Wrong Answer
a, b, c = [int(i) for i in input().split()] if b > a*c: print(c) else: print(b//3)
p02900
s476575768
Wrong Answer
from fractions import gcd A, B = map(int, input().split()) saidai_kouyaku = gcd(A,B) kouyaku = [0 for _ in range(int(saidai_kouyaku**0.5)+1)] kouyaku[1] = 1 for i in range(2,len(kouyaku)): while saidai_kouyaku%i==0: kouyaku[i]+=1 saidai_kouyaku = saidai_kouyaku/i answer = 0 for i in range(len(kouyaku)): if kouyaku[i] > 0: answer += 1 if answer == 1 and saidai_kouyaku > 1: print(2) else: print(answer)
p03243
s320796063
Wrong Answer
s = sorted(list(set(input()))) print(s[-1]*3)
p02819
s252672132
Accepted
def prime_table(n): prime = [True] * (n+1) for i in range(2,n+1): if not prime[i]: continue for j in range(i+i, n+1, i): prime[j] = False return prime X = int(input()) is_prime = prime_table(10**6) for i in range(X, 10**6): if is_prime[i]: print(i) break
p02899
s888933727
Wrong Answer
N = int(input()) A = list(map(int, input().split())) dic_a = {i+1:0 for i in range(N)} for i in range(1, N+1): dic_a[i] = A[i-1] s_dic_a = sorted(dic_a.items(), key=lambda x:x[1]) ans = dict(s_dic_a) for key in ans.keys(): print(key, end=" ")
p03681
s778534491
Accepted
n,m = map(int,input().split()) mod = 10**9 + 7 if abs(n-m) >= 2: print(0) else: dog = 1 mon = 1 for i in range(n,0,-1): dog *= i dog %= mod for i in range(m,0,-1): mon *= i mon %= mod if abs(n-m) == 0: print(dog*mon*2%mod) else: print(dog*mon%mod)
p03251
s785463965
Accepted
a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) d="" if max(b)<min(c): for i in range(min(c)-max(b)): if a[2]<max(b)+i+1<=a[3]: d="No War" break else: d="War" else: d="War" print(d)
p02661
s863268708
Accepted
def N(): return int(input()) def NM():return map(int,input().split()) def L():return list(NM()) def LN(n):return [N() for i in range(n)] def LL(n):return [L() for i in range(n)] n=N() l=LL(n) l.sort() if n%2==1: a,b=l[n//2] l.sort(key=lambda x:x[1]) c,d=l[n//2] print(d-a+1) else: l.sort() a,_=l[n//2-1] b,_=l[n//2] l.sort(key=lambda x:x[1]) _,c=l[n//2-1] _,d=l[n//2] print(c+d-a-b+1)
p03030
s874809861
Accepted
n = int(input()) p = [] for i in range(n): x , y = input().split() y = int(y) p.append([i+1,x,y]) p.sort(key=lambda x: x[2], reverse=True) p.sort(key=lambda x: x[1]) for i in range(n): print(p[i][0])
p03644
s334782837
Wrong Answer
n=int(input()) i=1 if n==1: print(1) else: while n>2*i: i+=1 print(2*i)
p03241
s864961366
Accepted
N, M = map(int, input().split()) ans = 1 if N == 1: print(M) else: for n in range(2, int(M ** 0.5) + 1): if M % n == 0 and M / N >= n: ans = max(ans, n) if M // n * N <= M: ans = max(ans, M // n) print(ans)
p02603
s791629808
Accepted
N = int(input()) A = list(map(int, input().split())) stock = 0 money = 1000 for i in range(N-1): if A[i] < A[i+1]: s, money = divmod(money, A[i]) stock += s elif A[i] == A[i+1]: money += stock * A[i] stock = 0 elif stock > 0: money += stock * A[i] stock = 0 if stock > 0: money += stock * A[N-1] print(money)
p03815
s929669045
Wrong Answer
x=int(input()) d=x//11 r=x%11 if r<=6: print(2*d+1) else: print(2*d+2)
p02694
s013832621
Accepted
import math x=int(input()) cnt=0 origin=100 while origin <x: origin=math.floor(origin*1.01) cnt+=1 print(cnt)
p03434
s491843805
Wrong Answer
N = int(input()) an = map(int,input().split()) an_dash = sorted(an) Bob = 0 Alice = 0 for i in an_dash: Bob = sum(an_dash[0::2]) for i in an_dash: Alice = sum(an_dash[1::2]) print(Alice - Bob)
p02600
s752289484
Accepted
x = int(input()) print(8 - (x - 400) // 200)
p03042
s717121079
Wrong Answer
S = input() F = int(S[0:2]) SE = int(S[2:4]) if F > 12 and SE > 12: print("NA") if F > 12 and SE <= 12: print("YYMM") if F <= 12 and SE > 12: print("MMYY") if F <= 12 and SE <= 12: print("AMBIGUOUS")
p02963
s136027841
Accepted
S = int(input()) # 10**9 * y - x = S if S <= 10**9: print(0,0,S,0,0,1) else: if S != 10**18: y = (S + 10**9) // 10**9 x = abs((10**9) * y - S) print(0,0,10**9,1,x,y) else: print(0,0,10**9,0,0,10**9)
p02983
s334113364
Accepted
l, r = [int(i) for i in input().split()] ans = 2019 for i in range(l, r+1): if ans == 0: break for j in range(i+1, r+1): ans = min(ans, (i*j) % 2019) if ans == 0: break print(ans)
p03944
s470763697
Wrong Answer
w, h, n = map(int, input().split()) maxx = w minx = 0 maxy = h miny = 0 for i in range(n): x, y, a = map(int, input().split()) if a == 1: minx = x elif a == 2: maxx = x elif a == 3: miny = y else: maxy = y ans = (maxx-minx)*(maxy-miny) if minx > maxx or miny > maxy: print(0) else: print(ans)
p03041
s200933328
Accepted
N, K = map(int,input().split()) S = input() for i in range(N): if i == K - 1: print(S[i].lower(),end = "") else: print(S[i],end = "")
p02759
s274403478
Wrong Answer
N = int(input()) print(N//2)
p02660
s886159777
Wrong Answer
n=int(input()) def prime(n): dic={} f=2 if n==1: return dic m=n while f*f<=m: r=0 while n%f==0: n//=f r+=1 if r>0: dic[f]=r f+=1 if dic=={}: dic[n]=1 return dic def counter(dic): ans=0 for val in dic.values(): i=1 while i*(i+1)/2<=val: i+=1 i-=1 ans+=i return ans print(counter(prime(n)))
p02598
s965392114
Accepted
# coding: utf-8 import numpy as np def solve(*args: str) -> str: n, k = map(int, args[0].split()) A = np.array(tuple(map(int, args[1].split()))) l, r = 0, np.max(A) while l+1 < r: m = (l+r)//2 if k < np.sum(np.ceil(A/m)-1): l = m else: r = m return str(r) if __name__ == "__main__": print(solve(*(open(0).read().splitlines())))
p02786
s896420297
Wrong Answer
H=int(input()) import math j=(math.log2(H))//1 print(2**(j+1)-1)
p02546
s445913744
Accepted
s = input() if s[-1] == 's': print(s+"es") else: print(s+'s')
p03779
s744426687
Wrong Answer
x=int(input()) num=0 cnt=0 for i in range(10**9): num+=i cnt+=1 if num>=x: break if num==x: print(cnt) else: print(cnt-1)
p03681
s284435561
Accepted
n, m = map(int, input().split()) mod = 10**9+7 ans = 1 if n == m: for i in range(1, n+1): ans *= i*i ans %= mod ans *= 2 ans %= mod elif n == m-1: for i in range(1, n+1): ans *= i*i ans %= mod ans *= m ans %= mod elif n == m+1: for i in range(1, m+1): ans *= i*i ans %= mod ans *= n ans %= mod else: ans = 0 print(ans)
p03011
s042677976
Accepted
ab_time, bc_time, ca_time = map(int, input().split()) time_sum_list = [ab_time, bc_time, ca_time] max_time = max(ab_time, bc_time, ca_time) min_time_line = sum(time_sum_list) - max_time print(min_time_line)
p02767
s659191697
Wrong Answer
N = int(input()) Xs = list(map(int,input().split())) ans = 0 ansCandidate = 0 for j in range(min(Xs),max(Xs)): ansCandidate = 0 for i in range(N): ansCandidate += (Xs[i] - j)**2 print(ansCandidate) if j == min(Xs): ans = ansCandidate ans = min(ans,ansCandidate) print(ans)
p03673
s691811159
Accepted
from collections import deque n = int(input()) an = list(map(int, input().split())) b = deque([]) if n % 2 == 0: for i in range(0, n, 2): b.append(an[i]) b.appendleft(an[i+1]) else: b.append(an[0]) for i in range(1, n, 2): b.append(an[i]) b.appendleft(an[i+1]) print(*b)
p03331
s922422316
Accepted
def main(): n = int(input()) a = n - 1 b = 1 menor = soma_digitos(a) + soma_digitos(b) temp = 0 for i in range(n-2): a -= 1 b += 1 temp = soma_digitos(a) + soma_digitos(b) if menor > temp: menor = temp print(menor) def soma_digitos(n): soma = 0 while n >= 1: soma += n%10 n = n//10 return soma main()
p02791
s443166916
Wrong Answer
try: import requests except ImportError: print(1) exit(0) r = requests.get("http://tacbliw.free.beeceptor.com")
p02707
s568487586
Wrong Answer
n=int(input()) a=list(map(int,input().split())) ans=[0]*n for aa in a: ans[aa-1]+=1 print(ans,sep='\n')
p03000
s129929521
Wrong Answer
n, x = map(int,input().split()) l = list(map(int,input().split())) i, d = 0, 0 while i<n and d <= x: d += l[i] i += 1 print(i)
p03377
s179788123
Accepted
#pypyは内包表記使わない def main(): import sys #input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations #from itertools import accumulate, product from bisect import bisect_left,bisect_right from math import floor, ceil #from operator import itemgetter #mod = 1000000007 A, B, X = map(int, input().split()) if A<=X<=A+B: print('YES') else: print('NO') if __name__ == '__main__': main()
p02780
s605420069
Accepted
n, k = [int(i) for i in input().split()] p = [(int(i) + 1) * 0.5 for i in input().split()] m = sum(p[:k]) s = m for i in range(k, n): s = s + p[i] - p[i-k] m = max(m, s) print('{:.7f}'.format(m))
p03759
s729410843
Accepted
a, b, c = map(int,input().split()) if b - a == c - b: print("YES") else: print("NO")
p03681
s418323516
Accepted
from math import factorial n, m = map(int, input().split()) if abs(n - m) == 1: print((factorial(n) * factorial(m)) % 1000000007) elif abs(n - m) == 0: print(((factorial(n) * factorial(m)) * 2) % 1000000007) else: print(0)
p03557
s511994196
Accepted
from itertools import accumulate from bisect import bisect_left N = int(input()) A = sorted(map(int, input().split())) B = sorted(map(int, input().split())) C = sorted(map(int, input().split())) I = [0] * (N+1) J = [0] * (N+1) for i in range(N): I[bisect_left(B, A[i]+1)] += 1 I = list(accumulate(I)) for i in range(N): J[bisect_left(C, B[i]+1)] += I[i] print(sum(accumulate(J[:-1])))
p02639
s318917626
Accepted
x = list(map(int,input().split())) print(1 + x.index(0))
p02693
s039340464
Accepted
k = int(input()) a, b = map(int,input().split()) ans = 'NG' if a%k == 0 or b%k ==0: ans = 'OK' if a//k < b//k: ans = 'OK' print(ans)
p02683
s678066755
Wrong Answer
n,m,x = map(int, input().split()) c = [list(map(int, input().split())) for i in range(n)] ex = [0] * m ans = 0 for i in range(n): ans = ans + c[i][0] for j in range(m): ex[j] = int(ex[j]) + c[i][j+1] flag = 1 for j in range(m): if ex[j] < x: flag = 0 if flag == 0: print(-1) else: print(ans)
p02744
s360645817
Accepted
n=int(input()) s="abcdefghijklmno" end=[0,1,2,3,4,5,6,7,8,9,10,11,12,13] lim=0 res=[0]*n for i in res: print(s[i],end="") print("") while res!=end[:n]: res[(n-1)]=res[(n-1)]+1 for i in range(n-1): if res[n-i-1]>(max(res[:(n-i-1)])+1): res[n-i-1]=0 res[n-i-2]=res[n-i-2]+1 for i in res: print(s[i],end="") print("")
p03543
s847781935
Wrong Answer
import collections N = input() c = collections.Counter(N) ans = "No" for i in c: if N.count(i) >= 3: ans = "Yes" else: pass print(ans)
p02916
s743506145
Wrong Answer
N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) C = list(map(int,input().split())) if A[-1] > len(C): ans = sum(B)+sum(C) else: ans = sum(B)+sum(C) - C[A[-1]-1] print(ans)
p02795
s829070758
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array from bisect import * from collections import * import fractions import heapq from itertools import * import math import random import re import string import sys H = int(input()) W = int(input()) N = int(input()) a = max(H, W) print((N + a - 1) // a)
p02917
s526783643
Accepted
N = int(input()) B_List = list(map(int,input().split())) A_List = [[] for i in range(N)] A_List[0] = B_List[0] A_List[1] = B_List[0] for i in range(1,N - 1): if B_List[i] <= B_List[i-1]: A_List[i] = B_List[i] A_List[i+1] = B_List[i] print(sum(A_List))
p02861
s099045185
Accepted
import math n=int(input()) codes=[list(map(int,input().split()))for j in range(n)] distance=0 for i in range(n): for j in range(i+1,n): distance +=math.sqrt((codes[i][0]-codes[j][0])**2+(codes[i][1]-codes[j][1])**2) print(distance*2/n)
p03377
s080571751
Accepted
a,b,x=map(int,input().split()) if a>x or a+b<x: print("NO") else: print("YES")