problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03693
s829108225
Wrong Answer
r,g,b=input().split() l=(r+g+b) L=int(l) if L%4==0: print('YES') else: print('No')
p03137
s972966437
Wrong Answer
# わからない
p02744
s374990825
Wrong Answer
n=int(input()) def dfs(s,st): if len(s)==n: return print(s) else: for i in range(ord('a'),ord(st)+1): dfs(s+chr(i),chr(i+1)) dfs('','a')
p03038
s591883108
Accepted
N, M = map(int, input().split()) A = list(map(int, input().split())) A.sort() D = [] for i in range(M): B, C = map(int, input().split()) D.append([C, B]) D.sort(reverse=True) E = [] j = 0 for i in range(N): if j < M: if D[j][1] == 0: j += 1 if j == M: E.append(0) else: E.append(D[j][0]) D[j][1] -= 1 else: E.append(0) S = 0 for i in range(N): S += max(A[i], E[i]) print(S)
p03767
s042572785
Wrong Answer
n=int(input()) a=list(map(int,input().split())) a.sort() print(sum(a[n:2*n]))
p02577
s516370186
Accepted
def is_nine(x): res = 0 while x > 0: t = x % 10 res += t x //= 10 return res if __name__ == '__main__': N = list(input()) e = 0 for i in N: e += int(i) if (e % 9 == 0): print("Yes") else: print("No")
p03474
s660772039
Wrong Answer
a,b=map(int,input().split()) s=input() ans="No" if len(s)==a+b+1: if s[a]=="-": if s[0:a].isdigit() and s[b:len(s)].isdigit(): ans="Yes" print(ans)
p02989
s714256408
Accepted
# C n = int(input()) d = list(map(int, input().split())) d.sort() if n%2 == 1: print(0) else: mi = n//2-1 ml = d[mi] mr = d[mi+1] print(mr-ml)
p03109
s205466014
Accepted
print('TBD'if input()>'2019/04/30'else'Heisei')
p03457
s234310703
Wrong Answer
N = int(input()) ti_xi_yi = [map(int, input().split(' ')) for n in range(N)] for ti, xi, yi in ti_xi_yi: if not (abs(xi+yi) <= abs(ti) and abs(xi)+abs(yi) <= abs(ti) and ti%2 == (xi+yi)%2): print('No') exit() print('Yes')
p03076
s963266152
Accepted
import itertools import math import fractions import functools import copy a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) original = [a,b,c,d,e] sum = 0 minimum = 10 index = 0 for i in range(len(original)): if original[i] % 10 != 0: sum += original[i]//10 * 10 + 10 if original[i]%10 < minimum: index = i minimum = original[i]%10 else: sum += original[i] if minimum != 10: print(sum-(original[index]//10 * 10 + 10)+original[index]) else: print(a+b+c+d+e)
p03211
s996308122
Wrong Answer
comp=753 s=input() ans=1000000000 for i in range(7,0,-1): if s.count(str(i)): left = s.find(str(i)) while left!=-1 and left<=len(s)-3: tmp = int(s[left:left+3]) ans = min(ans, abs(comp-tmp)) left = s.find(str(i),left+1) print(ans)
p03417
s064615873
Accepted
N, M = map(int, input().split()) if N == 1: if M == 1: ans = 1 else: ans = M-2 else: if M == 1: ans = N-2 else: ans = (N-2)*(M-2) print(ans)
p03719
s619027343
Accepted
a, b, c = map(int, input().split()) if a <= c and c <= b: print('Yes') else: print('No')
p02642
s574254966
Accepted
n=map(int,input().split()) a=list(map(int,input().split())) m=1000000 c=[0]*(m+1) for i in a:c[i]+=1 for i in range(1,m+1): if c[i] == 0:continue for j in range(i*2,m+1,i): c[j]+=1 ans=0 for i in a: if c[i]==1:ans+=1 print(ans)
p02682
s271881804
Accepted
A, B, C, K = map(int, input().split()) backup = K AB = A + B flag = False ans = 0 if K <= A: print(K) else: if A < K: K = K - A ans = ans + (A * 1) if B <= K: K = K - B flag = True if K > 0 and flag: ans = ans + (-1) * (backup - AB) print(ans)
p03285
s213345525
Accepted
n = int(input()) count = 0 for i in range(26): for j in range(15): if 4 * i + 7 * j == n: count += 1 break else: pass if count == 0: print("No") else: print("Yes")
p02555
s418378873
Wrong Answer
S = int(input()) S_m = S - 3 import math num_set = S_m // 3 h = 3 result = 0 for h in range(int(S_m / 3) +1): if num_set < h: continue else: rest = S_m - (h * 3) A = math.factorial(h + rest) // (math.factorial(h) * math.factorial(rest)) result += A if S == 6: print(3) else: print(result% (10**9+7))
p03208
s882473790
Wrong Answer
import heapq def main(): n,k = map(int,input().split()) tree_heights = [] for i in range(n): tree_heights.append(int(input())) tree_heights.sort() print(tree_heights) mn = 1000000000000000000000000000000 for i in range(n-k+1): print(i,abs(tree_heights[i]-tree_heights[i+k-1])) mn = min(abs(tree_heights[i]-tree_heights[i+k-1]),mn) print(mn) #print(tree_heights) #print(tree_diffs) #print(sum(tree_diffs[0:k])) if __name__ == '__main__': main()
p02970
s298892064
Accepted
# B - Golden Apple n, d = map(int, input().split()) if n%(2*d+1)==0: print(n//(2*d+1)) else: print(n//(2*d+1)+1)
p03339
s755395603
Wrong Answer
n = int(input()) s = input() ecounter = [0 for _ in range(n)] wcounter = [0 for _ in range(n)] ecounter[0] = (s[0]=='E') wcounter[n-1] = (s[n-1]=='W') ans = n for i in range(1,n): ecounter[i] = ecounter[i-1] + (s[i]=='E') wcounter[n-1-i] = wcounter[n-i] + (s[n-1-i]=='W') cnt = n-(ecounter[i]+wcounter[i]) ans = min(ans,cnt) print(ans)
p02823
s145923484
Wrong Answer
N, A, B = [int(item) for item in input().split()] if (B-A) % 2 == 0: print(int((B-A)/2)) else: d = min(N-B, A-1) print(int(d+1+(B-A-1)/2))
p02628
s595875146
Accepted
a,b = map(int, input().split()) #a,bに[5 3]みたいな入力を格納できる cost = sorted(map(int, input().split())) # 入力をソート ans = 0 for i in range(0, b): ans = ans + cost[i] print(ans)
p03543
s137803814
Wrong Answer
# 4桁の数字で3つ以上連続するか判定 N = input() if N[0] == N[1]: if N[1] == N[2] or N[0] == N[3]: print("Yes") else: print("No") else: print("No")
p03852
s906767326
Accepted
A=input() X=["a","i","u","e","o"] if A in X: print("vowel") else: print("consonant")
p02729
s868438775
Wrong Answer
n,m = map(int, input().split()) print(int(((n+m)*(n+m-1)-n*m)/2))
p03127
s263147397
Wrong Answer
n = int(input()) A = sorted (list(map(int,input().split()))) a = A[0] while True: for v in A: x = v%a if (x != 0) and x < a: a = x continue print (a) exit ()
p03495
s459550189
Accepted
n,k = map(int,input().split()) A = list(map(int,input().split())) ans = 0 import collections c = collections.Counter(A) c = c.most_common() m = len(set(A)) if m > k: for i in range(m-k): ans += c[-1-i][1] print(ans)
p02860
s565653679
Accepted
n = int(input()) s = list(input()) i = 0 l = [] while i < n / 2: l.append(s[i]) i += 1 if l * 2 == s: print("Yes") else: print("No")
p02618
s260468425
Wrong Answer
D = int(input()) c = list(map(int, input().split())) s = [] for i in range(D): s.append(list(map(int, input().split()))) a = [0]*26 total = 0 for i in range(D): saiteki = 0 p = 0 for j in range(1, 26): a[j-1] = i+1 cs = sum([x * (i+1 - y) for x, y in zip(c, a)]) pp = s[i][j-1] - cs if p < pp: p = pp saiteki = j else: total = total + p print(saiteki)
p03745
s925580198
Accepted
# AGC 013 A - Sorted Arrays n = int(input()) a = list(map(int, input().split())) up, down = 0, 0 ans = 0 for i in range(1, n): if a[i] > a[i-1]: up += 1 if a[i-1] > a[i]: down += 1 if up * down > 0: ans += 1 up = 0 down = 0 print(ans + 1)
p04011
s170337006
Accepted
N=int(input()) K=int(input()) X=int(input()) Y=int(input()) print(N * X if N <= K else K*X + (N-K)*Y)
p02723
s544561570
Accepted
S = input() if S[2] == S[3] and S[4]==S[5]: print('Yes') else: print('No')
p02823
s000354046
Accepted
n, a, b = map(int, input().split()) if (b - a) % 2 == 0: print((b - a) // 2) else: print(min(a - 1, n - b) + (b - a) // 2 + 1)
p03785
s147139754
Accepted
n,c,k = map(int,input().split()) T = sorted([int(input()) for _ in range(n)]) #print(T) cnt = 0 i = 0 while i < n: start = i m = 1 cnt += 1 while i < n: if i - start < c and T[i] - T[start] <= k: i += 1 else: break print(cnt)
p03219
s473022911
Accepted
x, y = map(int, input().split()) print(int(x + y/2))
p03419
s274858653
Wrong Answer
n,m = map(int,input().split()) print((n-2)*(m-2))
p02699
s458369434
Accepted
s, w = map(int,input().split()) if w >= s: print('unsafe') else: print('safe')
p03471
s297614084
Wrong Answer
n,y = map(int, input().split()) n10, n5, n1 = -1, -1, -1 for i in range(n+1): for j in range(i, n+1): if i*10000 + (j-i)*5000 + (n - j)*1000 == y: n10 = i n5 = j-i n1 = n-i break print(n10, n5, n1)
p04005
s151459534
Wrong Answer
a = list(map(int,input().split())) f = 0 for i in a: if i % 2 == 0: f = 1 if f: ans = 0 else: tmp = [] for i in range(2): for j in range(i+1,2): tmp.append(a[i] * a[j]) ans = min(tmp) print(ans)
p02775
s814252493
Wrong Answer
n = int(input()) l = [int(x) for x in list(str(n))] l.reverse() dasu=0 turi=0 for num in l: num_kuri=num if num_kuri <=5: dasu+=num else: dasu+=1 turi+=10-num #print(dasu,turi) print(dasu+turi)
p03419
s580379402
Wrong Answer
N, M = map(int, input().split(" ")) print((N - 2) * (M - 2))
p03632
s770314896
Accepted
a, b, c, d = map(int, input().split()) l, r = max(a, c), min(b, d) print(max(0, r - l))
p03150
s801556966
Accepted
import sys input = sys.stdin.readline from collections import * S = input()[:-1] if S=='keyence': print('YES') exit() for i in range(len(S)): for j in range(i, len(S)): T = S[:i]+S[j+1:] if T=='keyence': print('YES') exit() print('NO')
p02596
s181461655
Accepted
def main(): K = int(input()) visited = [False]*K r = 0 for i in range(1, K+1): r = r*10 + 7 r %= K if r == 0: print(i) exit() if visited[r]: print(-1) exit() visited[r] = True if __name__ == "__main__": main()
p02661
s979419065
Wrong Answer
N = int(input()) AB = [tuple(map(int, input().split())) for i in range(N)] A = [AB[i][0] for i in range(N)] B = [AB[i][1] for i in range(N)] A.sort() B.sort() if N % 2 == 1: id = (N+1)//2 print(B[-id] - A[id-1] + 1) else: id = N // 2 print(B[-id] - A[id-1] + 1)
p03061
s703360822
Accepted
import fractions from functools import reduce from collections import deque n = int(input()) a = deque(map(int,input().split())) #累積GCD left = deque([0]) right = deque([0]) for i in range(n): left.append(fractions.gcd(left[i],a[i])) right.appendleft(fractions.gcd(right[0],a[n - 1 - i])) ans = 0 for i in range(n): ans = max(ans,fractions.gcd(left[i],right[i + 1])) print(ans)
p03612
s939553138
Accepted
n = int(input()) P = list(map(int, input().split())) ans = 0 for i in range(n-1): if i+1 == P[i]: P[i], P[i+1] = P[i+1], P[i] ans+=1 if P[n-1]==n: ans += 1 print(ans)
p02691
s148610229
Wrong Answer
import sys N = int(sys.stdin.readline().rstrip()) As = list(map(int, sys.stdin.readline().rstrip().split())) ll = [0] * N lr = [0] * N for i in range(N): ll[i] = i + 1 + As[i] lr[i] = i + 1 - As[i] print(ll, lr) ans = 0 for l in ll: ans += lr.count(l) print(ans)
p02683
s170885405
Accepted
n, m, x = map(int, input().split()) a = [list(map(int, input().split())) for i in range(n)] ans = 12*(10**5) + 1 for j in range(2**n): mlist = [0]*m money = 0 for k in range(n): if (j >> k) & 1 == 1: money += a[k][0] for l in range(1, m+1): mlist[l-1] += a[k][l] if min(mlist) >= x: ans = min(ans, money) if ans == 12*(10**5) + 1 : print(-1) else: print(ans)
p02792
s076918476
Wrong Answer
import sys if sys.platform =='ios': sys.stdin=open('input_file.txt') N=int(input()) cnt=0 for i in range(1,N): for j in range(1,i-1): if str(i)[0]==str(j)[-1] and str(i)[-1]==str(j)[0]: cnt+=2 for i in range(1,N): if str(i)[0]==str(i)[-1]: cnt+=1 print(cnt)
p02939
s336343699
Accepted
s=list(input()) wd="" bef="" ans=0 for i in s: wd+=i if bef!=wd: ans+=1 bef=wd wd="" print(ans)
p02647
s677936754
Accepted
import sys input = sys.stdin.readline n,k = map(int,input().split()) A = list(map(int,input().split())) # n = 2*10**5 # k = 40 # A = [0] * n if k >= 41: print(*([n] * n)) else: for ii in range(k): B = [0] * (n+1) for i in range(n): B[max(0, i-A[i])] += 1 B[min(n, i+A[i]+1)] -= 1 for i in range(1,len(B)): B[i] += B[i-1] A = B[:n] print(*A)
p02924
s340681208
Accepted
n = int(input()) ans = (n-1)*n//2 print(ans)
p03796
s482761038
Accepted
N = int(input()) power = 1 for i in range(1, N + 1): power = power * i if power > 1000000000: power = power % 1000000007 print(power % 1000000007)
p03427
s787886583
Accepted
N = int(input()) x = 9 order = 0 for i in range(16): if x > N: break x = x*10+9 order = i+1 ans = x for i in range(10): ans -= 10**order if ans <= N: break ret = 0 while True: if ans == 0: break ret += ans % 10 ans = ans//10 print(ret)
p03705
s415781458
Wrong Answer
def answer(n, a, b): if (a > b) or (n < 2): return 0 n = n-2 small = a*n big = b*n return big - small + 1 n, a, b = map(int, input().split()) print(answer(n, a, b))
p03285
s348662483
Accepted
print("Yes" if [4*x+7*y for y in range(101) for x in range(101)].count(int(input())) else "No")
p03730
s657751379
Accepted
A, B, C = map(int, input().split()) for i in range(100): if A*i%B == C: print("YES") exit() print("NO")
p02862
s474807255
Accepted
X, Y = map(int, input().split()) mod = pow(10, 9) + 7 m = (2*Y - X)/3 n = (2*X - Y)/3 if m.is_integer() == False or n.is_integer() == False: print(0) exit() if m < 0 or n < 0: print(0) exit() def comb(n, k): if k > n - k: return comb(n, n - k) mul, div = 1, 1 for i in range(k): mul = mul * (n - i) % mod div = div * (k - i) % mod return mul * pow(div, mod-2, mod) % mod ans = comb(int(n+m), int(n)) print(ans)
p02988
s032762477
Accepted
N = int(input()) P = list(map(int,input().split())) ans = 0 for i in range(1,N-1): a = P[i-1:i+2] a.sort() if P[i]==a[1]: ans += 1 print(ans)
p02677
s355067483
Accepted
#!/usr/bin/env python3 import sys import collections import math sys.setrecursionlimit(10 ** 7) # 1 ✕ N A, B, C, D = list(map(int, input().rstrip().split())) ar = (360 / 12) * C + D * 0.5 br = (360 / 60) * D print(math.sqrt(A * A + B * B - (2 * A * B * math.cos(math.radians(abs(ar - br))))))
p02684
s193060707
Wrong Answer
N,K = map(int, input().split()) A = list(map(int, input().split())) for i in range(N): A[i] = A[i] -1 G = 0 lis = [0]*N lis[0] = 1 roop = [] cnt = 0 while True: G = A[G] cnt +=1 lis[G] += 1 if lis[G] == 2: roop.append(G) elif lis[G] == 3: break roop_cn = len(roop) diff = cnt - roop_cn*2 K_n = K - diff amari = K_n % roop_cn print(roop[amari]+1)
p03449
s669472275
Wrong Answer
n = int(input()) A = [] A.append(list(map(int, input().split()))) A.append(list(map(int, input().split()))) print(A) up = A[0][0] bottom = A[1][0] + up for i in range(n-1): up += A[0][i+1] bottom = max(up, bottom) + A[1][i+1] print(bottom)
p03293
s446734155
Accepted
s = list(input()) t = list(input()) for i in range(len(s)): if s == t: print('Yes') exit(0) a = s[-1] s.pop(-1) s[0:0] = a print('No')
p02832
s652831849
Accepted
n = int(input()) blocks = list(map(int,input().split())) i = 1 count = 0 for e in blocks: if e == i: count += 1 i += 1 if count == 0: print(-1) else: print(n-count)
p02747
s042082956
Wrong Answer
def solve(): s=list(input()) for i in range(len(s)): if (i%2==0 and s[i]!='h'): print("No") return elif(i%2==1 and s[i]!='i'): print("No") return print("Yes") solve()
p02628
s356021066
Wrong Answer
N,K = map(int, input().split()) pi= list(map(int, input().split())) print(sum(sorted(pi)[:N]))
p02553
s349819797
Accepted
a, b, c, d = map(int, input().split()) print(max(a * c, a * d, b * c, b * d))
p02963
s374210883
Accepted
import numpy as np s=int(input()) x2=int(np.ceil(np.sqrt(s))) y3=x2 res=x2*y3-s print('0 0 {} 1 {} {}'.format(x2,res,y3))
p03385
s351321991
Accepted
a = list(input()) a.sort() #sortメソッドを使って、順番に並べる。 # たとえbcaでもcbaでもabcの順にしてくれる if a[0] == 'a' and a[1] == 'b' and a[2] == 'c': print("Yes") else: print("No")
p03556
s344873762
Wrong Answer
n = int(input()) answer = 0 for i in range(1,n//2): next = i**2 if next <= n: answer = i**2 else : break print(answer)
p03804
s317026997
Wrong Answer
n,m = map(int,input().split()) list_A = list(input() for i in range(n)) list_B = list(input() for i in range(m)) k = "No" for i in range(n-m+1): for t in range(n-m+1): for v in range(m): if list_A[v+i][t:t+m]!=list_B[v][0:m]: break k = "Yes" print(k)
p03095
s081572091
Accepted
from collections import Counter N = int(input()) S = str(input()) c = Counter(S) l = list(c.values()) ans = 1 for n in l: ans *= n+1 ans %= (10**9+7) print(ans-1)
p02909
s186905041
Accepted
S = input() if S == 'Sunny': print('Cloudy') elif S == 'Cloudy': print('Rainy') else: print('Sunny')
p03860
s431966210
Accepted
A, s, C = input().split() print("{}{}{}".format(A[0],s[0],C[0]))
p02661
s371282113
Wrong Answer
N = int(input()) A = [] B = [] for n in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) #AB = sorted(AB, key=lambda x: x[0]) #print(AB) A.sort() B.sort() if N % 2 == 1: print(int(B[N//2] - A[N//2] + 1)) elif N % 2 == 0: print(int((B[N//2] - A[N//2])/(1/2) + 1)) else: print('RE')
p02700
s863221622
Accepted
A, B , C , D = map(int, input().split()) while True: C -= B if C <= 0: print("Yes") break A -= D if A <= 0: print("No") break
p03797
s249118080
Accepted
n, m = map(int, input().split()) if n * 2 >= m: print(m // 2) else: m -= n * 2 print(n + (m // 4))
p03339
s768167960
Accepted
N = int(input()) S = input() E_lst = [] cnt = 0 for i in range(N): if S[i] == 'E': cnt += 1 E_lst.append(cnt) min = N + 1 for i in range(N): nw = 0 #i番目の人の左側にいるWの人数 if i > 0: nw = i - E_lst[i - 1] ne = E_lst[N - 1] - E_lst[i] if nw + ne < min: min = nw + ne print(min)
p02766
s422687592
Wrong Answer
N,K=(int(x) for x in input().split()) k=0 a=K while a<=N: k=+1 a=K*10**k print(k)
p03160
s043219324
Accepted
def resolve(): N = int(input()) h = [int(i) for i in input().split()] dp = [float("inf")] * N dp[0] = 0 dp[1] = abs(h[1] - h[0]) for i in range(2, N): dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1])) print(dp[-1]) resolve()
p02866
s535585915
Accepted
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 998244353 def resolve(): n = int(input()) D = list(map(int, input().split())) tree = [0 for _ in range(max(D) + 1)] for i in range(n): idx = D[i] tree[idx] += 1 if D[0] != 0 or tree[0] != 1 or 0 in tree: print(0) exit() res = 1 for i in range(len(tree) - 1): res *= pow(tree[i], tree[i + 1], mod) print(res % mod) if __name__ == '__main__': resolve()
p02618
s098902318
Accepted
import sys input=sys.stdin.readline D=int(input().rstrip('\n')) cs=[int(x) for x in input().rstrip('\n').split()] S={} for i in range(D): S[i] = [int(x)-y for x,y in zip(input().rstrip('\n').split(),cs)] for i in range(D): s1 = S[i] s1_s=sorted(s1,reverse=True) if i!=D-1: s2=S[i+1] if s2.index(max(s2))==s1.index(max(s1)): print(s1.index(s1_s[1])+1) else: print(s1.index(s1_s[0])+1) print(S[D-1].index(max(S[D-1]))+1)
p02747
s790913481
Accepted
str = input() if(len(str)%2 != 0): print("No") exit() for i in range(len(str)): if(i % 2 == 0): if(str[i]!='h'): print("No") exit() if(i % 2 == 1): if(str[i]!='i'): print("No") exit() print("Yes")
p03438
s853588427
Wrong Answer
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) cnt = sum(B) - sum(A) for i in range(N): if A[i] < B[i]: cnt -= (B[i]-A[i])//2 if cnt < 0: print("No") break else: print("Yes")
p02795
s141547554
Accepted
import math a = int(input()) b = int(input()) n = int(input()) dum = max(a,b) ans = n/dum print(math.ceil(ans))
p03380
s307426817
Wrong Answer
n=int(input()) a=list(map(int,input().split())) a.sort() ai=max(a) if n%2==0: jj=n//2-1 else: jj=n//2 aj=a[jj] print(ai,aj)
p03623
s365843289
Accepted
x,a,b=map(int,input().split()) print('A'if abs(x-a)<abs(x-b) else 'B')
p02556
s669414263
Wrong Answer
n=int(input()) a=[] for i in range(n): x,y=list(map(int,input().split())) a.append(x+y) print(abs(max(a))-abs(min(a)))
p03327
s556071705
Wrong Answer
contest_num = int(input()) if contest_num <= 999: print('ABC' + str(contest_num).zfill(3)) elif contest_num >= 1000: over_thousand_num_fix = contest_num - 999 print('ABD' + str(over_thousand_num_fix).zfill(3))
p02778
s535962608
Accepted
# AtCoder Beginner Contest 154: B (2020/02/09) S = str(input()) T = '' for i in range(len(S)): T = T + 'x' print(T)
p03386
s078763548
Wrong Answer
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) INF = float('inf') A, B, K = map(int, input().split()) l = [] for i in range(A, min(A+K, B+1)): l.append(i) for i in range(max(B-K, A+1), B): l.append(i) l = list(set(l)) l.sort() print(*l, sep="\n")
p03612
s969684645
Accepted
N=int(input()) P=list(map(lambda x : int(x)-1,input().split())) ans=0 flag=False for i in range(N): if flag: flag=False pass elif P[i]==i: ans+=1 flag=True print(ans)
p03486
s852385169
Accepted
def main(): s = input() t = input() S = ''.join(sorted(s)) T = ''.join(sorted(t, reverse=True)) if S < T: print('Yes') else: print('No') if __name__ == "__main__": main()
p02823
s914956850
Accepted
def main(N, A, B): if abs(A - B) % 2 == 0: return abs(A - B) // 2 A, B = min(A, B), max(A, B) res1 = A+(B-A-1)//2 A, B = N - B + 1, N - A + 1 res2 = A+(B-A-1)//2 return min(res1, res2) if __name__ == "__main__": N, A, B = map(int, input().split()) ans = main(N, A, B) print(ans)
p04034
s685936138
Wrong Answer
n,m = map(int,input().split()) dic = {} ls = [1]*(n+1) ls[0] = 0 ans = 0 for i in range(m): a,b = map(int,input().split()) a -= 1 b -= 1 ls[a] -= 1 ls[b] += 1 if dic.get(b,0) == 0: dic[b] = 1 for j in range(n+1): if ls[j] > 0 and dic.get(j,0) != 0: ans += 1 print(ans)
p03773
s097838547
Accepted
import sys import os def main(): if os.getenv("LOCAL"): sys.stdin = open("input.txt", "r") A, B = list(map(int, sys.stdin.buffer.readline().split())) print((A+B)%24) if __name__ == '__main__': main()
p03435
s855398836
Wrong Answer
import itertools grid = [] for _ in range(3): grid.append(list(map(int,input().split()))) sum = sum(list(itertools.chain.from_iterable(grid))) if sum % 3 == 0: print('Yes') else: print('No')
p02766
s317260707
Accepted
import math n,k = map(int,input().split()) print(int(math.log(n,k))+1)