problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02665
s352840549
Accepted
c=sum(a:=[*map(int,[*open(0)][1].split())]) s=b=1 for a in a:b=min(c:=c-a,b-a<<1);s+=b print(max(-1,s))
p02983
s077977281
Wrong Answer
L,R=map(int,input().split()) l=L%2019 r=R%2019 if l<r: c=2020 a=list(range(l,r+1)) for i in range(len(a)-1): for j in range(i+1,len(a)): s_=a[i]*a[j] s=s_%2019 c=min(c,s) else: r+=2019 c=2020 a=list(range(l,r+1)) for i in range(len(a)-1): for j in range(i+1,len(a)): s_=a[i]*a[j] s=s_%2019 c=min(c,s) print(c)
p02779
s381308970
Accepted
''' INPUT SHORTCUTS N, K = map(int,input().split()) N ,A,B = map(int,input().split()) string = str(input()) arr = list(map(int,input().split())) N = int(input()) ''' N = int(input()) arr = list(map(int,input().split())) arr.sort() ans = 0 for i in range(N-1): if arr[i]==arr[i+1]: ans = 1 break if ans: print("NO") else: print("YES")
p03286
s256566124
Wrong Answer
import itertools N = int(input()) if N == 0: print(0) exit() ans = [] while N !=0: ans.append(N%2) N = -(N-N%2)//2 print("".join(list(map(str,ans))))
p03323
s162237897
Accepted
a,b = map(int,input().split()) print("Yay!") if a<9 and b<9 else print(":(")
p02953
s654129447
Accepted
n = int(input()) h = list(map(int, input().split())) ans = 'Yes' for i in range(1, n)[::-1]: if h[i] - h[i-1] == -1: h[i-1] -= 1 elif h[i] - h[i-1] < -1: ans = 'No' print(ans)
p02554
s432751356
Accepted
N = int(input()) m = 10**9 + 7 def pos(x, n, m): if n == 0: return 1 res = pos(x*x%m, n//2, m) if n%2 == 1: res = res*x%m return res s = pos(10, N, m) t = pos(9, N, m) u = pos(8, N, m) ans = s + u - t - t ans = ans % m print(ans)
p03761
s666073041
Accepted
from collections import Counter n = int(input()) l = [] for i in range(n): s = input() l.append(Counter(s)) cnt = l[0] for i in range(1,n): cnt = cnt & l[i] print("".join(sorted(cnt.elements())))
p02618
s760105580
Wrong Answer
D = int(input()) c = list(map(int, input().split())) s = [] for i in range(D): tmp = list(map(int, input().split())) s.append(tmp) ans = 0 for l in s: l.sort() ans += l[0] print(ans)
p02691
s832584228
Accepted
n = int(input()) a = list(map(int, input().split())) ans = 0 """ ai + i = j - aj """ cnt = [0] * (n + 1) for i in range(n): if 0 <= a[i] + i < n+1: cnt[a[i] + i] += 1 for i in range(n): if i - a[i] >= 0: ans += cnt[i - a[i]] print(ans)
p02755
s131663776
Wrong Answer
import math tax_8, tax_10 = map(int, input().split()) price_8_min = tax_8 / 0.08 price_8_max = (tax_8 + 0.99) / 0.08 price_10_min = tax_10 / 0.1 price_10_max = (tax_10 + 0.99) / 0.1 if price_8_min <= price_10_max or price_10_min <= price_8_max: print(math.ceil(max(price_8_min, price_10_min))) else: print('-1')
p03077
s008385873
Wrong Answer
import math n = int(input()) a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) bn = min([a, b, c, d, e]) if bn == n: print(5) exit() print((n // bn) + 5)
p02939
s907203524
Accepted
S = input() N = len(S) bef = '' i = 0 count = 0 while i < N: s = S[i] while s == bef: i += 1 if i >= N: print(count) exit() else: s += S[i] bef = s i += 1 count += 1 print(count)
p02771
s630920474
Wrong Answer
a,b,c = map(int, input().split()) if (a == b) : print('Yes') elif (a ==c): print('Yes') elif (b == c): print('Yes') else: print('No')
p03457
s737168773
Accepted
N = int(input()) TXY = [list(map(int,input().split())) for _ in range(N)] t = 0 x = 0 y = 0 for txy in TXY: T = txy[0] X = txy[1] Y = txy[2] if (T-t) - abs(X-x) - abs(Y-y) >= 0 and ((T-t) - abs(X-x) - abs(Y-y)) % 2 == 0: t = T x = X y = Y else: print('No') exit() print('Yes')
p02706
s415102644
Wrong Answer
# abc136 n,m = map(int,input().split()) days = list(map(int,input().split())) ans = n - sum(days) if ans < 0: ans = 0 print(ans)
p02583
s627254777
Accepted
N = int(input()) L = list(map(int, input().split())) ans = 0 for i in range(N - 2): for j in range(i + 1, N - 1): for k in range(j + 1, N): if L[i] != L[j] and L[i] != L[k] and L[j] != L[k]: sum_L = L[i] + L[j] + L[k] max_L = max(L[i], L[j], L[k]) if sum_L - max_L > max_L: ans += 1 print(ans)
p02556
s060964474
Accepted
def main(): n = int(input()) d1 = [] d2 = [] for _ in range(n): x, y = map(int, input().split()) d1.append(x + y) d2.append(x - y) d1.sort() d2.sort() print(max(d1[-1] - d1[0], d2[-1] - d2[0])) if __name__ == '__main__': main()
p02759
s901678012
Accepted
N = int(input()) print(-(-N//2))
p02744
s445392984
Accepted
from collections import deque def main(): N = int(input()) av = ord('a') def to_s(ary): ans = "".join(map(lambda v: chr(v + av), ary)) return ans def search(i, v, ary): if i == N: print(to_s(ary)) return for u in range(0, v + 2): ary[i] = u search(i + 1, max(u, v), ary) ary = [0] * N search(0, -1, ary) if __name__ == "__main__": main()
p02553
s409146882
Wrong Answer
a,b,c,d=map(int,input().split()) ans=[a*c,a*d,b*c,b*d] if ((a<0 and b>0) and d<0) or ((c>0 and d>0) and b<0): print(0) else: print(max(ans))
p02861
s415803711
Accepted
import itertools import math N = int(input()) XY = [list(map(int,input().split())) for i in range(N)] L = 0#経路長の和 for i in list(itertools.permutations(XY)):#順列に対し distance = 0 for n in range(N-1):#経路長を求める distance += math.sqrt((i[n+1][0]-i[n][0])**2 + (i[n+1][1]-i[n][1])**2) L += distance print(L/math.factorial(N))
p03456
s563337703
Accepted
n=int(input().replace(' ','')) a=int(n**.5) print('Yes' if n==a**2 else 'No')
p03778
s197687761
Accepted
w,a,b=map(int,input().split()) #a,a+w b,b+w if b<=a<=b+w or a<=b<=a+w: print(0) else: print(min(abs(b-a-w),abs(b+w-a)))
p02823
s904982340
Accepted
n,a, b = map(int, input().split( )) if (a-b)%2==0: print(abs(a-b)//2) exit() if a<b: a,b = b,a ans1 = b-1+(a-b+1)//2 ans2 = (n-a) + (n-(b+n-a)+1)//2 print(min(ans1,ans2))
p03760
s930944817
Accepted
#58B A=list(input()) B=list(input()) x=A[0]+B[0] for i in range(1,len(B)): x=x+A[i]+B[i] if len(A)>len(B): x=x+A[-1] print(x)
p03545
s988254685
Wrong Answer
li = [] s = input() li2 = [] for i in range(4): li.append(int(s[i])) n1 = 4 def func(n, t): if n == 0: if t == 0: return True else: return False elif func(n-1, t+li[n-1]): li2.append('-') return True elif func(n-1, t-li[n-1]): li2.append('+') return True else: return False if func(n1, 7): print("{0}{4}{1}{5}{2}{6}{3}=7".format(li[0], li[1], li[2], li[3], li2[0], li2[1], li2[2]))
p02554
s506251482
Accepted
n = int(input()) MOD = 10**9+7 def f(num): return pow(num, n, MOD) print((f(10)-f(9)-f(9)+f(8))%MOD)
p02701
s312336909
Wrong Answer
n=int(input()) s = [input() for i in range(n)] num = 0 for i in range(len(s)): if i-1<0 or s[i] != s[i-1]: num = num + 1 print(num)
p03131
s029704410
Wrong Answer
K, A, B = map(int, input().split()) bisket = 1 money = 0 if B / A > 2: remain = K - A + 1 bisket = A bisket += remain // 2 * (B - A) if remain % 2 == 1: bisket += 1 else: bisket += K print(bisket)
p03481
s311153460
Wrong Answer
a = list(map(float,input().split())) x = a[0] y = a[1] n = a[0] count = 0 while n <= y: n = n * 2 count += 1 print(str(count))
p03639
s986092955
Wrong Answer
n=int(input()) a=list(map(int,input().split())) b=0 c=0 for i in range(n): if a[i]%2==0: if a[i]%4==0: c+=1 else: b+=1 print("Yes") if n<= b+3*c-1 else print("No")
p02939
s426079416
Wrong Answer
s = list(input()) a = s[0] cou = 0 i = 0 while i!=len(s)-1 and i!=len(s)-2: if s[i]!=a: cou += 1 a = s[i] i += 1 # print(0,a,cou,i) else: a = "".join(s[i:i+2]) cou += 1 i += 2 # print(10,a,cou,i) if s[-1]==a: print(cou) else: print(cou+1)
p02959
s136840768
Accepted
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) res = 0 rem = 0 for i in range(N): mobs_rem = min(A[i], rem) A[i] -= mobs_rem mobs = min(A[i], B[i]) rem = B[i] - mobs res += (mobs+mobs_rem) res += min(A[N], rem) print(res)
p03448
s491002754
Accepted
a = int(input()) b = int(input()) c = int(input()) x = int(input()) count = 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: count += 1 print(count)
p03106
s765323899
Wrong Answer
a,b,c=map(int,input().split()) cnt=0 for i in range(1,min(a,b)+1): if a%i==0 and b%i==0: cnt+=1 if cnt==c: print(i) break
p02711
s079375022
Accepted
n = input() if '7' in n: print('Yes') else: print('No')
p03644
s156854096
Accepted
N = int(input()) count = 0 num = 1 while N >= num: count += 1 num *= 2 print(num // 2)
p03076
s147242122
Accepted
import numpy as np l = np.array([int(input()) for _ in range(5)]) m = ((l+9)//10)*10 n = max(m-l) #print(l) #print(m) #print(n) print(sum(m)-n)
p02866
s297681183
Wrong Answer
N = int(input()) D = list(map(int, input().split())) D.sort() if D.pop(0) != 0: ans = 0 else: ans = 1 num = 1 before = 1 after = 0 for i in D: if i == num: after += 1 elif i == num+1: ans *= before**after num += 1 before = after after = 1 else: ans = 0 ans *= before**after print(ans)
p03254
s147502989
Accepted
N, X = map(int, input().split()) A = list(map(int, input().split())) A.sort() res = 0 for a in A: if a > X: break res += 1 X -= a else: if X > 0: res -= 1 print(max(res, 0))
p02663
s976386079
Accepted
H1, M1, H2, M2, K = map(int, input().split()) H1 = H1 * 60 H2 = H2 * 60 print(((H2 + M2)-K)-(H1+M1))
p02760
s534512090
Accepted
import numpy as np A=[list(map(int, input().split())) for _ in range(3)] N=int(input()) B=[int(input()) for _ in range(N)] for b in B: for i in range(3): for j in range(3): if A[i][j]==b:A[i][j]=0 ans_axis0=np.sum(np.array(A),axis=0) ans_axis1=np.sum(np.array(A),axis=1) ans_naname=[A[0][0]+A[1][1]+A[2][2],A[0][2]+A[1][1]+A[2][0]] #print(A,ans_axis0,ans_axis1,ans_naname) if 0 in ans_axis0 or 0 in ans_axis1 or 0 in ans_naname: print("Yes") else: print("No")
p03262
s493266659
Accepted
def gcd(a, b): while b: a, b = b, a % b return a def main(): N, X, *xn = map(int, open(0).read().split()) ans = None for x in xn: div = abs(X - x) if ans is None: ans = div elif div % ans: ans = gcd(ans, div) print(ans) return main()
p03131
s641727249
Accepted
import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) k,a,b = MI() if a+2 >= b: print(1+k) elif a >= k+2: print(1+k) elif (k-a+1)%2 == 0: print((k-a+1)//2*(b-a)+a) else: print((k-a+1)//2*(b-a)+a+1)
p02847
s783892186
Accepted
s = input() day = {'SUN':7, 'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1} print(day[s])
p03077
s021341733
Wrong Answer
import math n,*l=map(int,open(0).read().split()) print(n+math.ceil(n//min(l)))
p03565
s511291057
Wrong Answer
S = input() T = input() ansind = None def solve(i): flag = True for j in range(len(T)): if i+j < len(S) and (S[i+j] == "?" or S[i+j] == T[j]): continue else: flag = False break return flag for i in range(len(S)): if solve(i): ansind = i if ansind: ans = S[:ansind] + T + S[ansind+len(T):] ans = ans.replace("?", "a") else: ans = "UNRESTORABLE" print(ans)
p02754
s585688433
Wrong Answer
n,b,r = map(int,input().split()) syo = n//(b+r) amari = n%(b+r) if amari == 0: print(b*syo) else: if amari <= b: print(b*syo + amari) else: print(b*syo - (b-amari))
p02785
s363256067
Accepted
n, k = map(int, input().split()) h = sorted(list(map(int, input().split()))) if k == 0: print(sum(h)) else: print(sum(h[:-k]))
p03645
s634140053
Accepted
n, m = map(int, input().split()) list_AB = [ list(map(int,input().split(" "))) for i in range(m)] list_MAP = [0]*(n+1) for l in list_AB: l.sort() if l[0] == 1: list_MAP[l[1]] += 1 if l[1] == n: list_MAP[l[0]] += 1 ans = "IMPOSSIBLE" for num in list_MAP: if num > 1: ans = "POSSIBLE" print(ans)
p03449
s353854854
Accepted
N=int(input()) p=[0] q=[0] A1=list(map(int,input().split())) A2=list(map(int,input().split())) for i in range(N): p.append(p[i]+A1[i]) q.append(q[i]+A2[N-i-1]) ans=0 for j in range(N): ans=max(ans,p[j+1]+q[N-j]) print(ans)
p02547
s866734210
Accepted
import sys N = int(input()) D = [] for i in range(N): D.append(input().split()) cnt = 0 for i in range(N): if D[i][0] == D[i][1]: cnt += 1 if cnt == 3: print("Yes") sys.exit() else: cnt = 0 print("No")
p02546
s653497112
Accepted
s = input("") if s[-1] == 's': print(s + 'es') else: print(s + 's')
p03434
s402766541
Accepted
n = int(input()) a = sorted(list(map(int, input().split())), reverse = True) d = 0 for i in range(n): d += ((-1)*a[i]) if i%2 else a[i] print(d)
p03773
s566237187
Wrong Answer
A, B = map(int, input().split()) sum = A + B if sum > 24: sum = sum - 24 print(sum)
p03239
s377576693
Accepted
# abc112_b.py N, T = map(int,input().split()) C = [map(int,input().split()) for i in range(N)] ans = 10001 for c,t in C: if t <= T and ans > c: ans = c if ans <1001: print(ans) else: print("TLE")
p03607
s328933655
Wrong Answer
ans=0 n=int(input()) a=[int(input()) for _ in range(n)] a.sort() res=a[0] cnt=1 for i in a[1:]: if res==i: cnt+=1 else: if cnt%2!=0: ans+=1 res=i cnt=1 else: res=i cnt=1 print(ans)
p02924
s394079539
Wrong Answer
def main(): n = int(input()) ans = 0 ans += (n) * (n + 1) / 2 print(int(ans) - n) if __name__ == '__main__': main()
p02547
s603249043
Wrong Answer
N = int(input()) mulArr = [] for _ in range(N): arr = list(map(int, input().split(" "))) mulArr.append(arr) print(mulArr) result = 0 for i in range(0, len(mulArr) - 2): print(i) if mulArr[i][0] == mulArr[i][1] and mulArr[i + 1][0] == mulArr[i + 1][1] and mulArr[i + 2][0] == mulArr[i + 2][1]: result += 1 print(result) if result != 0: print("Yes") else: print("No")
p03360
s005047061
Accepted
a,b,c = map(int, input().split()) k = int(input()) n = max(a,b,c) ans = sum([a,b,c]) - n for _ in range(k): n *= 2 print(ans+n)
p03105
s954767603
Accepted
# ABC 120: A – Favorite Sound a, b, c = [int(s) for s in input().split()] print(c if b // a > c else b // a)
p02629
s102140490
Accepted
n=int(input()) alphabet = [chr(i) for i in range(97, 97+26)] ans=[] while n>0: n-=1 ans.append(alphabet[n%26]) n//=26 ans.reverse() print(''.join(ans))
p03262
s236743087
Accepted
N,X=map(int,input().split()) x=[abs(int(i)-X) for i in input().split()] import fractions as math ans=x[0] for j in range(1,N): ans=math.gcd(ans,x[j]) print(ans)
p02995
s134281893
Wrong Answer
A,B,C,D = map(int,input().split()) import math numC = 0 numD_C = 0 cA = math.ceil(A/C) cB = math.ceil(B/C) dA = math.ceil(A/D) dB = math.ceil(B/D) i = 1 num = 0 while A <= C*D*i <=B: num += 1 i += 1 ans = B-A +1-(abs(cB-cA) + abs(dB-dA) - num) print(ans)
p03469
s385330774
Accepted
S=input() day=S[-6:] print("2018"+day)
p02600
s023547065
Accepted
X = int(input()) if (400<=X<=599): print(8) elif (600<=X<=799): print(7) elif (800<=X<=999): print(6) elif (1000<=X<=1199): print(5) elif (1200<=X<=1399): print(4) elif (1400<=X<=1599): print(3) elif (1600<=X<=1799): print(2) elif (1800<=X<=1999): print(1) else: print(0)
p03679
s294187382
Wrong Answer
import numpy as np import fractions as fra x,a,b=map(int,input().split()) if(a>=b): print("delicious") elif(x>=b): print("safe") else: print("dangerous")
p02623
s675770614
Wrong Answer
from sys import stdin input = lambda: stdin.readline().rstrip("\r\n") from collections import defaultdict as vector, deque as que read = lambda: list(map(int,input().split())) from bisect import bisect from heapq import heappush as hpush,heappop as hpop n,m,k=read() A=read() B=read() a,b=[0],[0] for i in range(n): a.append(a[i]+A[i]) for i in range(m): b.append(b[i]+B[i]) ans=0 for i in range(1,n+1): curr=a[i] j=m if curr>k: break while(b[j]>k-curr): j-=1 ans=max(ans,i+j) print(ans)
p03471
s679238321
Wrong Answer
li = input().split() count = int(li[0]) price = int(li[1]) / 1000 errorText = '-1 -1 -1' ans = True flag = False for a in range(count+1): for b in range(count - a +1): c = count - a-b fee = a*10 + b*5 + c*1 if fee == price and a+b+c == count: print(str(a) + " " + str(b) + " " + str(c)) ans = False # flag = True break if flag: break if ans is not False: print(errorText)
p02570
s344720119
Wrong Answer
D, T, S = map(int, input().split()) if D / S <= T: print('yes') else: print('no')
p02571
s319585644
Wrong Answer
s = input() t = input() N = len(s) n = len(t) m = 0 for i in range(N-n): cnt = 0 S = list(s)[i:i+n] T = list(t) for j in range(n): if S[j] == T[j]: cnt += 1 if m < cnt: m = cnt print(n-m)
p02687
s489717867
Accepted
def main(): s=input() if s == "ABC" : print("ARC") else: print("ABC") main()
p02578
s282985910
Accepted
n = int(input()) a = list(map(int,input().split())) res = 0 pre = a[0] for i in range(1, n): if pre <= a[i]: pre = a[i] continue res += pre - a[i] print(res)
p02767
s438438080
Accepted
N = int(input().strip()) X = sorted([int(v) for v in input().strip().split()]) c = 100000000000000000 for p in range(X[0], X[-1] + 1): P = sum([pow(x - p, 2) for x in X]) if P >= c: break c = P print(c)
p02911
s206764190
Accepted
def main(): n, k, q = map(int, input().split()) point = [0]+[k-q]*n for a in range(q): point[int(input())] += 1 for i in point[1:]: if i <= 0: print("No") else: print("Yes") if __name__ == '__main__': main()
p02835
s853169931
Accepted
cards = [int(i) for i in input().split(" ")] print("bust" if sum(cards) >= 22 else "win")
p03146
s444637660
Accepted
s = int(input()) n = 1 while 1: if s == 1 or s == 2 or s == 4: print(n+3) break if s % 2 == 1: s = 3 * s + 1 else: s //= 2 n += 1
p03379
s172282162
Accepted
ni = lambda: int(input()) nm = lambda: map(int, input().split()) nl = lambda: list(map(int, input().split())) n=ni() x=nl() sx = sorted(x)[::-1] c = n//2 for i in range(n): if x[i] > sx[c]: print(sx[c]) else: print(sx[c-1])
p02681
s988325139
Wrong Answer
n =str(input()) r =str(input()) s = len(n) if n== r[0:s+1] : print('Yes') else : print('No')
p03254
s521406886
Accepted
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): n, x = map(int, readline().split()) a = list(map(int, readline().split())) a.sort() rem = x ans = 0 for i in range(n - 1): if rem >= a[i]: rem -= a[i] ans += 1 if a[n-1] == rem: ans += 1 print(ans) if __name__ == '__main__': main()
p02712
s608634950
Accepted
N = int(input()) i = 1 li = [] for j in range(N): if ((i % 3) == 0) or ((i % 5) == 0): i = i + 1 else: li.append(i) i = i + 1 print(sum(li))
p03211
s881149540
Accepted
s = list(input()) ans = [] for i in range(0,len(s)-2): d = int("".join(s[i]+s[i+1]+s[i+2])) ans.append(abs(d-753)) print(min(ans))
p02748
s724181643
Wrong Answer
A, B, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) l = [input().split() for i in range(m)] ans = min(a) + min(b) for i in range(m): ai = a[int(l[i][0]) - 1] bi = b[int(l[i][1]) - 1] ci = int(l[i][2]) nc = ai + bi - ci ans = min(ans, nc) print(nc)
p02701
s081619421
Accepted
n = int(input()) S = [input() for _ in range(n)] import hashlib base1 = 1007 mod1 = 10**9+7 dic = {} for s in S: hs = hashlib.md5(s.encode()).hexdigest() dic.setdefault(hs, s) print(len(dic))
p02606
s852586998
Wrong Answer
L, R, d = [int(x) for x in input().split()] mod = (L+d) % d # print((R - L - mod) // d) lst = list(range(L+mod, R+1, d)) print(list(lst)) print(len(lst))
p03385
s306473406
Wrong Answer
s = input() if 'a' in s and 'b' in s and 'c' in s: print("Yes") else: print("NO")
p03289
s687451816
Accepted
S = input() cnt = 0 if S[0] == "A": for i in S[2: len(S) - 1]: if i == "C": cnt += 1 sr = S.replace("A", "") src = sr.replace("C", "") if src.islower() and cnt == 1: print("AC") else: print("WA")
p02784
s846207735
Accepted
import numpy as np H, N = map(int, input().split()) A = list(map(int, input().split())) A = np.array(A) A_all = np.sum(A) if H <= A_all: print('Yes') else: print('No')
p02727
s148109795
Accepted
x, y, a, b, c = map(int, input().split()) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p = sorted(p, reverse=True)[:x] q = sorted(q, reverse=True)[:y] total = sorted(p+q+r, reverse=True)[:x+y] print(sum(total))
p02767
s908496794
Wrong Answer
N=int(input()) X=list(map(int,input().split())) p=sum(X)//len(X) ans=0 for i in range(len(X)): ans+=(X[i]-p)**2 print(ans)
p02791
s397296912
Wrong Answer
n=int(input()) p=list(map(int,input().split())) minnumber=100001 count=0 for i in p: if i<=minnumber: count+=1 minnumber=i print(count)
p02621
s821279342
Accepted
a = int(input()) print(a + a **2 + a **3)
p03433
s298559704
Wrong Answer
N = int(input())#支払額 A = int(input())#1円の所持数 B = N % 500 if A > B: print("Yes") else: print("No")
p03386
s702488680
Accepted
a, b, k = map(int, input().split()) lst = range(a, b+1) for i in sorted(set(lst[:k]) | set(lst[-k:])): print(i)
p02720
s488391481
Accepted
from collections import deque K = int(input()) q = deque([i for i in range(1, 10)]) # print(q) for i in range(K): x = q.popleft() if x % 10 != 0: q.append(10*x+x % 10-1) q.append(10*x+x % 10) if x % 10 != 9: q.append(10*x+x % 10+1) print(x)
p03632
s905701901
Accepted
A, B, C, D = map(int, input().split()) ans = -1 AB = [i for i in range(A, B+1)] CD = [i for i in range(C, D+1)] for sec in AB: if sec in CD: ans += 1 if ans == -1: print(0) else: print(ans)
p02571
s988635297
Accepted
s = list(input()) t = list(input()) ans = len(t) if len(s) == len(t): icchi = 0 for i in range(len(s)): if s[i] == t[i]: icchi += 1 ans = len(t)-icchi else: for i in range(len(s)-len(t)): a = s[i:i + len(t)] icchi = 0 for j in range(len(t)): if a[j] == t[j]: icchi += 1 ans = min(ans, len(t)-icchi) print(ans)
p03042
s138907198
Accepted
def check_month(n): return 1 <= n <= 12 def check_year(n): return 0 <= n <= 99 S = input() Y = int(S[:2]) M = int(S[2:]) if check_month(Y) and check_month(M): print('AMBIGUOUS') elif check_month(Y) and check_year(M): print('MMYY') elif check_year(Y) and check_month(M): print('YYMM') else: print('NA')
p03524
s744403491
Accepted
import sys import math from collections import Counter 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()) s = input() S = Counter(s) a = S["a"] b = S["b"] c = S["c"] if abs(a-b) <= 1 and abs(a-c) <= 1 and abs(c-b) <= 1: print("YES") else: print("NO")