problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03817
s873895130
Accepted
n=int(input()) ans=n//11*2 n%=11 if 1<=n<=6:ans+=1 if 7<=n:ans+=2 print(ans)
p02690
s955047432
Accepted
n = int(input()) for a in range(-200, 200): for b in range(-200, 200): if n == a ** 5 - b ** 5: print(a) print(b) quit()
p03943
s407264245
Accepted
a=list(map(int,input().split())) a.sort(reverse=True) if a[0]==a[1]+a[2]: print("Yes") else: print("No")
p02624
s603717856
Wrong Answer
n = int(input()) l = [0 for _ in range(n+1)] l[1] = 1 for i in range(n+1): for j in range(i-1, 0, -1): if i % j == 0: l[i] = l[j] + 1 break ans = 0 for k in range(n+1): ans += (k * l[k]) print(ans)
p03486
s510072917
Wrong Answer
def main(): import sys pin=sys.stdin.readline pout=sys.stdout.write perr=sys.stderr.write s=list(input()) t=list(input()) s.sort() t.sort(reverse=True) if s==t: print("No") return if s in t: print("Yes") return # if(len(s)<len(t)): # print("Yes") # return for i in range(min(len(s),len(t))): if ord(s[i])>ord(t[i]): print("No") return elif ord(s[i])<ord(t[i]): print("Yes") return print("No") return main()
p03221
s786697759
Wrong Answer
n,m=map(int,input().split()) e=[[]for _ in range(n)] py=[] for _ in range(m): p,y=map(int,input().split()) py.append((p,y)) e[p-1].append(y) for i in range(n):e[i].sort() xy=lambda x,y:x*1000000+y d={} for i in range(n): for j in range(len(e[i])): d[xy(i+1,e[i][j])]=str(i+1).zfill(6)+str(j+1).zfill(6) for p,y in py: print(d[xy(p,y)])
p02823
s345033430
Accepted
import sys sys.setrecursionlimit(10**7) readline = sys.stdin.buffer.readline def readstr():return readline().rstrip().decode() def readstrs():return list(readline().decode().split()) def readint():return int(readline()) def readints():return list(map(int,readline().split())) def printrows(x):print('\n'.join(map(str,x))) def printline(x):print(' '.join(map(str,x))) n,a,b = readints() if (b-a)%2==0: print((b-a)//2) else: print(min(n-b+(b-a)//2+1,a-1+(b-a)//2+1))
p03239
s530239578
Accepted
n, T = map(int, input().split()) cost = [] time = [] element = [] ans = 1000 for i in range(n): c, t = map(int, input().split()) cost.append(c) time.append(t) for c, t in zip(cost, time): if t <= T: element.append(c) if len(element) == 0: print('TLE') else: ans = min(element) print(ans)
p03274
s602445355
Accepted
from bisect import bisect_left n, k = map(int, input().split()) candles = list(map(int, input().split())) point_zero = bisect_left(candles, 0) candles.insert(point_zero, 0) ans = float('inf') for i in range(min(k, point_zero) + 1): left = point_zero - i right = point_zero + k - i if (0 <= left) and (right < n + 1): dis = -candles[left] + candles[right] + min(-candles[left], candles[right]) ans = min(ans, dis) print(ans)
p03639
s822770773
Accepted
n=int(input()) a=list(map(int,input().split())) odd=0 ni=0 si=0 for x in a: if x%4==0: si+=1 elif x%2==0: ni+=1 else: odd+=1 ni=ni%2 if odd+ni<=si+1: print("Yes") else: print("No")
p03943
s402756342
Accepted
a=list(map(int,input().split())) print('NYoe s'[sum(a)/2 in a::2])
p03838
s451336568
Wrong Answer
x,y=map(int,input().split()) if x==0: if y<0: print(-1*y+1) else: print(y) elif x>0: if -1*x<y<x: print(y+x+1) elif x<y: print(y-x) else: print(-1*y-x+1) else: if x<y<-1*x: print(y-x) elif y<x: print(-1*y+x+2) else: print(y+x+1)
p03371
s081702857
Accepted
import sys import itertools # import numpy as np import time import math sys.setrecursionlimit(10 ** 7) from collections import defaultdict read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines A, B, C, X, Y = map(int, readline().split()) ans = 10 ** 10 for c in range(2 * 10 ** 5 + 1): a = X - c // 2 b = Y - c // 2 if a < 0: a = 0 if b < 0: b = 0 ans = min(ans, A * a + B * b + C * c) print(ans)
p03696
s929092328
Wrong Answer
N = int(input()) S = list(input()) T = [] while S and S[-1] == '(': T.append(S.pop()) S = S[::-1] T = T + [')'] * len(T) H = [] while S and S[-1] == ')': H.append(S.pop()) S = S[::-1] H = ['('] * len(H) + H l = S.count('(') r = S.count(')') d = l - r S = H + S + T if d > 0: S = S + [')'] * d if d < 0: S = ['('] * (-d) + S print(''.join(S))
p02948
s022895500
Wrong Answer
from collections import deque,defaultdict n,m=map(int, input().split()) ab = [deque() for i in range(m+1)] for i in range(n): a,b=map(int, input().split()) if(not a>m): ab[a-1].append(-1*b) res = 0 cnt = 0 for i in range(m): if(len(ab[i])>0): tmp = min(ab[i])*-1 ab[i].pop() res+=tmp ab[i+1]+=(ab[i]) print(res)
p03711
s104047931
Wrong Answer
d={1:1,3:1,5:1,7:1,8:1,10:1,12:1,4:2,6:2,9:2,11:2,2:3} a=list(map(int,input().split())) if d[a[0]]==d[a[0]]: print('Yes') else: print('No')
p03417
s733913574
Accepted
N, M = map(int, input().split()) if N == 1 and M == 1: print(1) elif (N == 1 and M >= 2) or (M == 1 and N >= 2): print(max(N, M) - 2) else: print((N - 2) * (M - 2))
p02987
s396066320
Accepted
s = input() t = sorted(s) if t[0] == t[1] and t[2] == t[3] and t[0] != t[2]: print('Yes') else: print('No')
p02663
s864410128
Accepted
a = list(map(int,input().split())) b = a[2] * 60 + a[3] - a[0] * 60 - a[1] - a[4] print(b)
p02711
s678970225
Wrong Answer
N = str(input()) # print(N) if '7' in N : print("YES") else: print("NO")
p02748
s325634606
Accepted
def main(): a, b, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) xyc = [list(map(int, input().split())) for _ in [0]*m] ans = min(a)+min(b) for x, y, c in xyc: ans = min(ans, a[x-1]+b[y-1]-c) print(ans) main()
p02882
s969116358
Accepted
from math import atan, degrees a, b, x = map(int, input().split()) vol = a**2*b/2 if x < vol: ans = atan((a*b**2)/(2*x)) elif x > vol: ans = atan((-2/a**3)*(x-a**2*b)) else: ans = atan(b/a) print(degrees(ans))
p04012
s231784441
Wrong Answer
w = str(input()) List = [w[i] for i in range(len(w))] lis = sorted(List) #print(lis) uni = list(set(lis)) #print(uni) ans = [] q = 0 for i in range(len(uni)): p = lis.count(uni[i]) ans.append(p) for j in range(len(ans)): q += ans[j]%2 if q == 0: print("YES") else: print("NO")
p02687
s993448728
Accepted
s = input() if s == 'ABC': print('ARC') else: print('ABC')
p03001
s726020737
Wrong Answer
W, H, x, y = map(int, input().split()) print("{0} {1}".format(H * W / 2, int(x + x == W & y + y == H)))
p03284
s492035090
Accepted
n,k = map(int,input().split()) if n%k == 0: print(0) else: print(1)
p02556
s625198054
Accepted
import sys input = sys.stdin.readline def MI(): return map(int, input().split()) n = int(input()) z=[] w=[] for i in range(n): x,y=MI() z.append(x+y) w.append(x-y) print(max(max(z)-min(z), max(w)-min(w)))
p03472
s002816419
Accepted
import sys n, h = map(int, input().split()) a = [list(map(int, x.split())) for x in sys.stdin.readlines()] a.sort(reverse=True) b = sorted(a, key=lambda x:x[1], reverse=True) cnt = 0 for i in b: if i[1] < a[0][0]: break cnt += 1 h -= i[1] if h <= 0: print(cnt) exit() print(cnt + -(-h//a[0][0]))
p03971
s882687239
Wrong Answer
n, a, b = map(int, input().split()) s = input() all = list(s) count = 0 count_b = 0 for i in all: if i == 'a': if count < a + b: print('Yes') count += 1 else: print('No') elif i == 'b': if (count < a + b) and (count_b <= b): print('Yes') count += 1 count_b += 1 else: print('No') else: print('No')
p02695
s222518138
Accepted
import itertools n, m, q = map(int , input().split(" ")) l = [] for i in range(q): a, b, c, d = map(int, input().split(" ")) l.append((a, b, c, d)) def score(l, t): score = 0 for i in l: a, b, c, d = i if t[b-1] - t[a-1] == c: score = score + d return score print(max([ score(l, t) for t in itertools.combinations_with_replacement(list(range(1, m+1)), n)] ))
p02629
s488982845
Accepted
def main(): n = int(input()) t = 1 ans = '' while n > 0: p = ((n - 1) // t) % 26 ans += chr(ord('a') + p) n -= t * (p+1) t *= 26 ans = ans[::-1] print(ans) if __name__ == '__main__': main()
p03427
s618316412
Wrong Answer
n = int(input()) c = len(str(n)) if c == 1: print(n) else: for i in range(1,10): b = int(str(i)+"9"*(c-1)) if int(str(i)+"9"*(c-1)) >= n: print(9*(c-1)+(i-1)) break
p04045
s171957759
Wrong Answer
import itertools N,K=map(int,input().split()) D=[int(x) for x in input().split()] T=[] answer=10000 for i in range(10): if not i in D: T+=[i] for x in itertools.product(T,repeat=4): for i in range(5): p=x[-1]+x[-2]*10+x[-3]*100+x[-4]*1000 if p>=N: answer=min(p,answer) print(answer)
p02699
s602816659
Accepted
S, W = map(int, input().split()) print('unsafe' if S <= W else 'safe')
p03107
s307314349
Accepted
s=input() c0=s.count("0") c1=s.count("1") print(2*min(c0,c1))
p02707
s875505541
Accepted
n = int(input()) a = [0]*n a = [int(s) for s in input().split()] dic = {} for s in a: if not (s in dic): dic[s] = 1 else: dic[s] += 1 for i in range(n): if not(i+1 in dic): print(0) else: print(dic[i+1])
p02663
s848882473
Wrong Answer
#!/usr/bin/env python3 h1, m1, h2, m2, k = list(map(int, input().split())) if h2*60+m2-h1*60+m1 < 0: print((h2+24)*60+m2-h1*60+m1-k) else: print(h2*60+m2-h1*60+m1-k)
p02657
s769603740
Wrong Answer
A,B=input().split() A=int(A) B=int(100*(float(B)+0.005)) print(int(A*B))
p03211
s592245961
Accepted
def main(): # n = int(input()) # t, a = map(int, input().split()) # h = list(map(int, input().split())) s = input() mini = 10**10 for i in range(len(s)-2): mini = min(mini, abs(int(s[i:i+3]) - 753)) print(mini) if __name__ == '__main__': main()
p03380
s632076612
Wrong Answer
from bisect import bisect_left, bisect_right N = int(input()) *A, = map(int, input().split()) A.sort() m = A[-1] div = m / 2 print(m, min(abs(m - A[bisect_right(A, m / 2)]), abs(m - A[bisect_left(A, m / 2)])))
p02772
s802472707
Accepted
n = int(input()) a = list(map(int, input().split())) for i in a: if i % 2 == 0: if i % 3 == 0: continue elif i % 5 == 0: continue else: print('DENIED') exit() print('APPROVED')
p03680
s007410620
Wrong Answer
N = int(input()) a = {i + 1: int(input()) for i in range(N)} ans = -1 count = 0 nxt = 1 while count < N: nxt = a[nxt] if nxt == 2: ans = count break count += 1 print(ans)
p03219
s741725311
Accepted
X, Y = map(int,input().split()) print(X+Y//2)
p02601
s550659544
Wrong Answer
li = input().split() a=int(input()) magic = 0 for i in range(0,3): if li[0] >= li[1]: li[1] = li[1] * 2 magic = magic + 1 for i in range(0,3): if li[1] >= li[2]: li[2] = li[2] * 2 magic = magic + 1 if a >= magic: print("Yes") else: print("No")
p02584
s679056113
Accepted
x,k,d=map(int,input().split()) x=abs(x) if x>k*d: print(x-k*d) else: k-=x//d x-=(d*(x//d)) ans=[x,abs(d-x)] print(ans[k%2])
p03274
s802925075
Accepted
n, k = map(int, input().split()) X = list(map(int, input().split())) ans = pow(10,9)+7 for i in range(n-k+1): ans = min(ans, min(abs(X[i])+abs(X[i+k-1]-X[i]), abs(X[i+k-1])+abs(X[i]-X[i+k-1]))) print(ans)
p04030
s337975239
Accepted
s = str(input()) n = len(s) ans = [] for i in range(n): if s[i] != 'B': ans.append(s[i]) else: if len(ans) > 0: ans.pop(-1) else: continue print(''.join(ans))
p02694
s401268245
Accepted
x = int(input()) m = 100 res = 0 while(True): m *= 1.01 m = int(m) res += 1 if(m >= x): break print(res)
p03437
s221646388
Accepted
x, y=map(int, input().split()) print(-1 if x%y==0 else x)
p02860
s399977695
Accepted
N = int(input()) S = input() if N % 2 == 0 and S[:N // 2] == S[-N // 2:]: print('Yes') else: print('No')
p03679
s055193377
Wrong Answer
x, a, b = map(int, input().split()) if x > a: if x > b: print('delicious') else: print('safe') else: print('dangerous')
p02836
s056095194
Accepted
s = input() s_right = s[len(s)//2:][::-1] s_left = s[:len(s)//2] count = 0 for i in range(len(s_left)): if s_right[i] != s_left[i]: count += 1 print(count)
p02584
s398852806
Accepted
x, k, d = map(int, input().split()) dx = abs(x) y = dx // d if k >= y: dx = dx - y * d if (k-y) % 2 == 0: print(dx) else: dx = abs(dx - d) print(dx) elif k < y: dx = dx - k * d print(dx)
p03220
s435173796
Wrong Answer
N = int(input()) T,A = list(map(int,input().split())) H = list(map(int,input().split())) MinDif = 1000 for i in range(N): Temp = T - H[i] * 0.006 if abs(Temp - A) == min( MinDif, abs(Temp - A) ): MinDif = abs(Temp - A) ans = i print(ans)
p03665
s089656936
Accepted
N, P = map(int, input().split()) A = list(map(int, input().split())) flag = True for a in A: if a % 2 != 0: flag = False if flag: if P == 0: ans = 2 ** N else: ans = 0 else: ans = 2 ** (N-1) print(ans)
p03617
s821847857
Accepted
q, h, s, d = [int(x) for x in input().split()] n = int(input()) per_l = min(4 * q, 2 * h, s) # 1L買うのに一番安い方法 per_2l = min(2 * per_l, d) # 2Lを買うのに一番安い方法 print(per_2l * (n // 2) + per_l * (n % 2))
p02595
s827006847
Accepted
#abc174_b n,d=map(int,input().split()) def ok(x,y): return x**2+y**2<=d**2 cnt=0 for _ in range(n): a,b=map(int,input().split()) if ok(a,b): cnt+=1 print(cnt)
p03062
s757115775
Accepted
n=int(input()) a=list(map(int,input().split())) cnt=0 ans=0 m=10**9+1 for i in a: if i<0: cnt+=1 ans+=abs(i) if abs(i)<m: m=abs(i) if cnt%2==0: print(ans) else: print(ans-m*2)
p03331
s174849696
Wrong Answer
n = int(input()) if n&1: print(sum(list(map(int, str(n))))) elif n < 10: print(n) else: print(10)
p03000
s011801320
Wrong Answer
n,x = map(int,input().split()) l = list(map(int,input().split())) count = 1 x1 = 0 for i in range(n): if x1 + l[i] <= x: count += 1 x1 += l[i] else: print(count) exit()
p02657
s146560827
Accepted
a,b=map(int,input().split()) print(a*b)
p03994
s014907134
Accepted
original_s = list(input()) s = list(map(lambda x:ord(x)-97-26, original_s)) K = int(input()) ans = original_s for i in range(len(s)): if abs(s[i]) <= K and s[i] != -26: ans[i] = "a" K += s[i] ans[-1] = chr(((ord(ans[-1]) + K) - 97) % 26 + 97) print("".join(ans))
p02615
s503548794
Wrong Answer
n = int(input()) a = list(map(int,input().split())) a.sort(reverse=True) migi = a[1] hidari = a[1] point = a[0] for i in a[2:]: if migi >= hidari: point += migi migi = i else: point += hidari hidari = i print(point)
p03455
s722262795
Wrong Answer
import numpy as np a = 1 b = 2 c = a * b if 1 < c and c < 1000: if c%2 == 0: print("Even") else: print("Odd")
p03338
s716135064
Accepted
N=int(input()) S=input() ans=0 for i in range(N-1): F=set(S[:i+1]) G=set(S[i+1:]) ans=max(ans,len(F&G)) print(ans)
p03860
s781263856
Wrong Answer
a,b,c=input().split() print('A',b[0],'C')
p03821
s025956799
Wrong Answer
N = int(input()) A = [] B = [] for _ in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) cnt = 0 A = A[::-1] B = B[::-1] for a, b in zip(A, B): if a % b == 0: continue cnt += b - ((a + cnt) % b) print(cnt)
p02706
s136514399
Accepted
def main(): n, m = list(map(int, input().split())) works = list(map(int, input().split())) for w in works: n -= w print(-1) if n < 0 else print(n) if __name__ == '__main__': main()
p04005
s118141712
Accepted
t=list(map(int,input().split())) t.sort() a,b,c=t[0],t[1],t[2] if (a*b*c)%2==0: print(0) else: print(a*b)
p03804
s738290956
Accepted
n,m = map(int,input().split()) a = [list(input()) for i in range(n)] b = [list(input()) for i in range(m)] for i in range(n-m+1): for j in range(n-m+1): t = 1 for k in range(m): for l in range(m): if a[i+k][j+l] != b[k][l]: t = 0 if t == 1: print('Yes') exit(0) print('No')
p02813
s929262704
Accepted
from itertools import permutations n = int(input()) p = list(map(int, input().split())) q = list(map(int, input().split())) x = [i for i in range(1, n + 1)] y = [] for i in permutations(x, n): y.append(list(i)) a = b = 0 for i in range(len(y)): if y[i] == p: a = i + 1 if y[i] == q: b = i + 1 print(abs(a - b))
p02832
s793594293
Accepted
#D N=int(input()) A=list(map(int,input().split())) ans=0 num=1 for i in range(N): if A[i]==num: num+=1 else: ans+=1 if num==1: ans=-1 print(ans)
p02911
s742838859
Accepted
N,K,Q = map(int,input().split()) A = [int(input()) for i in range(Q)] num = K-Q point = [num]*N for a in A: point[a-1] += 1 for po in point: if po > 0: print("Yes") else: print("No")
p03043
s813733425
Accepted
#!/usr/bin/env python3 n, k = map(int, input().split()) ans=0 for i in range(1, n+1): a=1/n now=i while(now<k): now*=2 a/=2 ans+=a print(ans)
p03043
s936212516
Wrong Answer
import math N, K = map(int, input().split()) ANS = 0 for i in range(1,N+1): if i < K: ANS += (1/N) * (0.5**(math.ceil(math.log(math.ceil(K/i),2)))) else: ANS += (1/N)*(N-K+1) break print(math.ceil(math.log(math.ceil(K/i),2))) print(ANS)
p03448
s456003117
Wrong Answer
A=(int)(input()) B=(int)(input()) C=(int)(input()) X=(int)(input()) count = 0 a_ = X//500 if a_>A: a_ = A for a in range(a_+1): x = X-a*500 b_ = x//100 if b_>B: b_ = B for b in range(b_+1): x = x-b*100 c_ = x//50 if c_<=C: count = count + 1 print(count)
p02598
s503219543
Accepted
#!/usr/bin/env python3 import sys input = sys.stdin.readline n, k = map(int, input().split()) a = [int(item) for item in input().split()] l = 0; r = 1000000001 while r - l > 1: mid = (l + r) // 2 cnt = 0 for item in a: cnt += (item - 1) // mid # Can be cut in k times if cnt <= k: r = mid else: l = mid print(l + 1)
p02860
s110835081
Accepted
N = int(input()) S = input() if N % 2 == 1: print("No") else: if S[0:N//2] == S[N//2:N]: print("Yes") else: print("No")
p02939
s432348686
Accepted
s = list(input()) before = s[0] ans = 1 tmp = "" for i in range(1, len(s)): tmp += s[i] if tmp != before: ans += 1 before = tmp tmp = "" print(ans)
p03557
s224749109
Accepted
from bisect import bisect_left, bisect_right 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 i in range(n): a_cnt = bisect_left(a, b[i], 0, n) c_cnt = n - bisect_right(c, b[i], 0, n) #print(a_cnt, c_cnt) ans += a_cnt * c_cnt print(ans)
p03455
s132034515
Wrong Answer
# 問題文 # シカのAtCoDeerくんは二つの正整数 a,bを見つけました。 # aとbの積が偶数か奇数か判定してください。 # 制約 # 1 <= a,b <= 10000 # a,bは整数 a, b = map(int, input() .split()) # 積が奇数なら、0dd と偶数なら Even と出力 i = a * b if i % 2 == 0: print('Even') else: print('0dd')
p02553
s416932653
Accepted
a, b, c, d = map(int, input().split()) print(max(a*c, a*d, b*c, b*d))
p02958
s577614343
Accepted
N = int(input()) p = list(map(int,input().split())) c = 0 for i in range (N): if p[i] != i+1: c += 1 if c == 0 or c==2: print("YES") else: print("NO")
p03838
s691663850
Accepted
x, y = map(int, input().split()) d = abs(abs(x) - abs(y)) if 0 <= x < y or x < y <= 0: print(d) elif y <= 0 <= x or x < 0 < y: print(d+1) else: print(d+2)
p02691
s399871329
Wrong Answer
from collections import defaultdict N = int(input()) A = list(map(int, input().split())) D = defaultdict(int) ans = 0 for i, x in enumerate(A, 1): ans += D[i-x] D[x+i] += 1 print(ans, D)
p03317
s137640326
Accepted
n, k = map(int, input().split()) As = list(map(int, input().split())) idx = As.index(min(As)) left = idx n_l = (left + k - 2) // (k - 1) right = n - ((n_l) * (k-1)) - 1 n_r = (right + k - 2) // (k - 1) print(n_l + n_r)
p02972
s436488718
Accepted
# solution data=int(input()) array=list(map(int,input().split())) result=[] box=[0]*data for i in reversed(range(1,data+1)): asum=sum(box[i-1::i]) if asum%2+array[i-1]==1: box[i-1]=1 result.append(i) print(len(result)) print(*result)
p03657
s175793029
Accepted
a,b=map(int,input().split()) print('Possible' if a%3==0 or b%3==0 or (a+b)%3==0 else 'Impossible')
p04012
s940720048
Wrong Answer
N=input() if N.count('a')%2==0: print('Yes')
p03695
s809756541
Wrong Answer
N = int(input()) a = list(map(int, input().split())) b = [val//400 for val in a] #print(b) c = set(b) if b.count(8): M=len(c)-1+b.count(8) m=len(c)-1 if m == 0: m=1 else: M=len(c) m=M print(m, M)
p03371
s624293994
Accepted
import sys IS = lambda: sys.stdin.readline().rstrip() II = lambda: int(IS()) MII = lambda: list(map(int, IS().split())) MIIZ = lambda: list(map(lambda x: x-1, MII())) def main(): a, b, c, x, y = MII() fee = min(a+b,c*2) * min(x,y) if x > y: fee += min(a,c*2)*(x-y) else: fee += min(b,c*2)*(y-x) print(fee) if __name__ == '__main__': main()
p02675
s952279286
Wrong Answer
n = input() a = [int(c) for c in n] if(a[-1] == 3): print('bon') elif(a[-1] == 0 or 1 or 6 or 8): print('pon') else: print('hon')
p02775
s161996228
Wrong Answer
s = input() ans = 0 bef = 0 for i in s[::-1]: v = int(i) if v+bef>=5: ans += 10-(v+bef) bef = 1 else: ans += (v+bef) bef = 0 ans += (v+bef)//10 print(ans)
p03211
s959630805
Accepted
n=int(input()) lst = [] cnt = 1000 while n > 0: lst.append(n%10) n //= 10 # 必須 lst.reverse() for j in range(len(lst)-2): temp=lst[j]*100+lst[j+1]*10+lst[j+2] if abs(temp-753)<cnt: cnt=abs(temp-753) print(cnt)
p03379
s348576011
Wrong Answer
n=int(input()) x=list(map(int,input().split())) a=n//2 b=a+1 for i in range(a): print(x[a]) for i in range(a): print(x[a-1])
p03319
s375218895
Accepted
import math n, k = map(int,input().split()) dat = list(map(int, input().split())) i = dat.index(1) + 1 # 1 origin で i 個目に 1 がある reach = k # 今1で占有した場所 a = math.ceil((n - reach) / (k - 1)) print(1+a)
p02988
s710046223
Wrong Answer
n = int(input()) p = [int(_) for _ in input().split()] cnt = 0 for i in range(0, n-2): print(p[i], p[i+1], p[i+2]) if (p[i] < p[i+1] < p[i+2]) or (p[i] > p[i+1] > p[i+2]): cnt += 1 print(cnt)
p03612
s724355423
Accepted
N = int(input()) p = [int(i) for i in input().split()] count = 0 i = 0 while i < N: if p[i]-1==i: if i+1 != N: if p[i+1]-1==i+1: i += 1 count += 1 else: count += 1 else: count += 1 i += 1 print(count)
p02577
s119625865
Accepted
if sum(int(i) for i in input()) % 9: print('No') else: print('Yes')
p02665
s550127210
Accepted
def main(): N = int(input()) *A, = map(int, input().split()) tot = sum(A) ans = 1 tot -= 1 v = 1 for x in A: v -= x if v < 0: print(-1) return make_v = min(v, tot) tot -= make_v v += make_v ans += v print(ans) if __name__ == '__main__': main()