problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03062
s668781890
Accepted
N=int(input()) A=list(map(int,input().split())) mi=0 ans=0 zero=0 a=abs(A[0]) for i in A: if i<0: mi+=1 a=min(a,abs(i)) ans+=abs(i) if mi%2==0: print(ans) else: print(ans-2*a)
p02608
s220360185
Accepted
n = int(input()) ans = [0]*10001 for i in range(1, 101): for j in range(1, 101): for z in range(1, 101): aaa = i**2+j**2+z**2+i*j+j*z+z*i if aaa <= 10**4: ans[aaa] += 1 for i in range(n): print(ans[i+1])
p03469
s437826890
Accepted
s=str(input()) print("2018"+s[4:])
p02835
s433339949
Accepted
A1,A2,A3=map(int , input().split()) if A1+A2+A3<=21: print("win") else: print("bust")
p03211
s704553926
Accepted
import sys input = sys.stdin.readline def main(): S = input() a = len(S) ans = 10**3 for i in range(a-2): num = int(S[i:i+3]) ans = min(ans,abs(num-753)) print(ans) if __name__ == "__main__": main()
p02688
s019064498
Accepted
N, K = map(int, input().split()) d = [] A_set = set() for i in range(K): d_i = int(input()) A = list(map(int, input().split())) for j in A: A_set.add(j) print(N - len(A_set))
p02618
s340477393
Accepted
D=int(input()) clist=list(map(int,input().split())) smat=[[int(x) for x in input().split()] for _ in range(D)] #print(clist) #print(smat) for i in range(D): print(i%26+1)
p02582
s819059761
Wrong Answer
S=str(input()) ans = 0 for i in S: if i == "R": ans += 1 print(ans)
p02682
s022025470
Wrong Answer
a,b,c,k = map(int,input().split()) ans = 0 if a>=k: ans = a elif a+b>=k: ans = a else: ans = a - (k-a-b) print(ans)
p02789
s046604438
Accepted
n, m = map(int, input().split()) if n == m: print("Yes") else: print("No")
p02963
s310046662
Accepted
N = int(input()) a = -(-N//(10**9)) b = a*10**9-N print(0, 0, 10**9, b, 1, a)
p03338
s451739171
Wrong Answer
n = int(input()) s = input() mxcnt = 0 for i in range(n): xy = set(s[:i]) & set(s[i:]) print(xy) mxcnt = max(mxcnt, len(xy)) print(mxcnt)
p03252
s893135867
Accepted
s=input() t=input() dicST={} dicTS={} for i,j in zip(s,t): if (dicTS.get(j,0) != 0 and dicTS[j] != i) or \ (dicST.get(i,0) != 0 and dicST[i] != j): print("No") break else: dicTS[j] = i dicST[i] = j else: print("Yes")
p02732
s975730169
Accepted
#%% for atcoder uniittest use import sys input= lambda: sys.stdin.readline().rstrip() def pin(type=int):return map(type,input().split()) def tupin(t=int):return tuple(pin(t)) #%%code def resolve(): N=int(input()) A=tupin() from collections import Counter c=Counter(A) total=0 for t in c.items(): ag,b=t total+=(b*(b-1))//2 #print(total) for m in A: a=c[m] print(total-((a*(a-1))//2)+((a-1)*(a-2))//2) #%%submit! resolve()
p03785
s704317349
Accepted
n, c, k = map(int, input().split()) t = [int(input()) for i in range(n)] t.sort() diff = 0 cnt = 1 ans = 0 for i in range(n - 1): diff += abs(t[i + 1] - t[i]) cnt += 1 if diff > k or cnt > c: cnt = 1 diff = 0 ans += 1 print(ans + 1)
p02720
s762920749
Accepted
from collections import deque K = int(input()) queue = deque([1, 2, 3, 4, 5, 6, 7, 8, 9]) x = 1 count = 0 while K != count: x = queue.popleft() if (x % 10) != 0: queue.append(10 * x + (x % 10) - 1) queue.append(10 * x + (x % 10)) if (x % 10) != 9: queue.append(10 * x + (x % 10) + 1) count += 1 print(x)
p03284
s861278265
Wrong Answer
n, k = map(int, input().split()) print(n % k)
p02606
s025210056
Accepted
L,R,d=map(int, input().split()) cnt=0 for _ in range(L, R+1): if _%d==0: cnt +=1 print(cnt)
p02570
s455476566
Accepted
D,T,S=map(int,input().split()) if D/S <=T: print('Yes') else: print('No')
p03067
s431976017
Accepted
A, B, C = map(int,input().split()) if C > min(A, B) and C < max(A, B): print("Yes") else: print("No")
p03607
s838280603
Wrong Answer
n = int(input()) d = dict() for _ in range(n): k = int(input()) if d.get(k) == None: d[k] = 1 else: d[k] = 0 print(sum(d.values()))
p03665
s366109681
Accepted
import sys, math from functools import lru_cache from collections import defaultdict from decimal import Decimal sys.setrecursionlimit(10**9) MOD = 10**9+7 def input(): return sys.stdin.readline()[:-1] def mi(): return map(int, input().split()) def ii(): return int(input()) def i2(n): tmp = [list(mi()) for i in range(n)] return [list(i) for i in zip(*tmp)] def main(): N, P = mi() A = list(mi()) if all(a%2==0 for a in A): print(0 if P else pow(2, N)) else: print(pow(2, N-1)) if __name__ == '__main__': main()
p02802
s308916977
Accepted
N, M = map(int, input().split()) WA = [0] * (10 ** 5 + 1) AC = [False] * (10 ** 5 + 1) for i in range(M): _no , re = input().split() no = int(_no) if re == 'AC': AC[no] = True if not AC[no]: if re == 'WA': WA[no] += 1 pena = 0 for i in range(10 ** 5 + 1): if AC[i]: pena += WA[i] print(AC.count(True), pena)
p02847
s655286862
Accepted
a =["SUN","MON","TUE","WED","THU","FRI","SAT"] b = input() for i in range(7): if a[i]==b: print(7-i) break
p03719
s829583345
Wrong Answer
# A - Between Two Integers # A B C の3つの整数が与えられる # 整数 C が A以上 かつ B以下である時 Yes # そうでないとき No # A B C を標準入力から得る A, B, C = map(int, input().split(maxsplit=3)) if C >= A and A <= B: answer = "Yes" else: answer = "No" # 結果を出力 print(answer)
p03274
s990738063
Accepted
N, K = map(int, input().split()) x = list(map(int, input().split())) answer = float('inf') for l, r in zip(x, x[K - 1:]): # print(l, r) cost = r - l + min(abs(l), abs(r)) answer = cost if cost < answer else answer print(answer)
p03657
s290903175
Accepted
A,B = map(int, input().split()) print('Possible' if A*B*(A + B)%3 == 0 else 'Impossible')
p03774
s238959598
Accepted
n, m = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(n)] cd = [list(map(int, input().split())) for _ in range(m)] for a, b in ab: ans = 10 ** 10 dist = 10 ** 10 for i in range(m): c, d = cd[i] temp = abs(a - c) + abs(b - d) if dist > temp: dist = temp ans = i + 1 print(ans)
p03659
s256141807
Wrong Answer
n = int(input()) a = sorted(list(map(int, input().split())), reverse = True) S = a[0] A = a[n - 1] for i in a[1:n - 1]: if abs(S + i - A) <= abs(S - A - i): S += i else: A += i print(abs(S - A))
p02780
s823755763
Wrong Answer
x=0 N,K=map(int,input().split()) P=list(map(int,input().split())) S=[] for i in range(N): S.append((1+P[i])/2) #print(S) i=1 while i+K<N+1: #T.append(sum(S[i:i+K])) x=max(x,sum(S[i:i+K])) i=i+1 #print(S) #print(T) print("{0:.12f}".format(x))
p02831
s284334377
Wrong Answer
import math a,b = map(int,input().split()) x = math.gcd(a,b) y = a * b ans = y / x print(ans)
p02935
s549636493
Accepted
n = int(input()) v = list(map(int, input().split())) v.sort() total = v[0] for i in range(1, n): total = (total + v[i])/ 2 print(total)
p02727
s263602624
Wrong Answer
from itertools import* x,y,a,b,c=map(int,input().split()) p=sorted(list(map(int,input().split())))[::-1] q=sorted(list(map(int,input().split())))[::-1] r=sorted(list(map(int,input().split())))[::-1] sa=list(accumulate(p))[x-1] sb=list(accumulate(q))[y-1] for i,v in enumerate(r): if x and v>p[x-1]: if p[x-1]<q[y-1] or y==0: sa+=v-p[x-1] x-=1 elif y and v>q[y-1]: sb+=v-q[y-1] y-=1 print(sa+sb)
p04029
s148625580
Accepted
n=int(input()) print(sum([i for i in range(1,n+1)]))
p03545
s891055372
Accepted
A,B,C,D = (int(T) for T in list(input())) ABCD = [A+B+C+D,A+B+C-D,A+B-C+D,A+B-C-D,A-B+C+D,A-B+C-D,A-B-C+D,A-B-C-D] Op = ['+++','++-','+-+','+--','-++','-+-','--+','---'] Disp = list(Op[ABCD.index(7)]) print('{}{}{}{}{}{}{}=7'.format(A,Disp[0],B,Disp[1],C,Disp[2],D))
p03059
s751235847
Accepted
[A,B,T] = list(map(int,input().split())) print(int(((T+0.5) // A) * B))
p02820
s381462662
Accepted
n,k = list(map(int,input().split())) r,s,p = list(map(int,input().split())) t = str(input()) t_list = [] for i in range(k): t_list.append(t[i]) for i in range(k,n): if t[i] != t_list[i-k] or t_list[i-k] == 'all': t_list.append(t[i]) else: t_list.append('all') print(t_list.count('r') * p + t_list.count('s') * r + t_list.count('p') * s)
p03774
s494347165
Wrong Answer
N, M = map(int, input().split()) ab = [list(map(int, input().split())) for i in range(N)] cd = [list(map(int, input().split())) for i in range(M)] ans = [] for i, (a, b) in enumerate(ab): min_dist = 10**20 idx = -1 for j, (c, d) in enumerate(cd): dij = abs(a - c) + abs(b - d) if dij < min_dist: min_dist = dij idx = j ans.append(idx) print(*ans, sep='\n')
p03087
s074021606
Accepted
N,Q = map(int,input().split()) S = input() X = [list(map(int, input().split())) for _ in range(Q)] L =[0]*(N+1) for i in range(N-1): if S[i]=="A" and S[i+1]=="C": L[i+1] = L[i]+1 else: L[i+1] = L[i] L[N] = L[N-1] for x in X: print(L[x[1]-1]-L[x[0]-1])
p02640
s277268307
Accepted
a,f = map(int,input().split(" ")) j = 0 for i in range(a + 1): x = a - i c = (a - i) * 2 + i * 4 if c == f: print("Yes") j = 1 break if j == 0: print("No")
p03359
s696719841
Accepted
a, b=map(int,input().split()) if a<=b: print(a) else: print(a-1)
p03038
s935090246
Accepted
#python3 def main(): n, m = map(int, input().split()) cards = [(int(i), 1) for i in input().split()] for _ in range(m): b, c = map(int, input().split()) cards.append((c, b)) cards.sort(reverse=True) ans = 0 sumv = 0 for i in range(n): v = cards[i][1] cv = cards[i][0] * v ans += cv sumv += v if sumv >= n: ans -= cards[i][0] * (sumv - n) break print(ans) main()
p03479
s153395800
Wrong Answer
import math x,y = map(int,input().split()) y += 1 print(int(math.log2(y/x))+1)
p02571
s418015811
Wrong Answer
a=b=0 for i in range(len(s:=input())-len(t:=input())): for j,c in enumerate(t):b+=(s[i+j]==c) a=max(a,b);b=0 print(len(t)-a)
p02939
s145558516
Wrong Answer
S = input() idx = 1 count = 0 S_b = S[0] while True: if idx == len(S)-1: break S_a = S[idx] if S_a == S_b: count += 1 S_b = S[idx:idx+2] else: S_b = S_a idx += 1 print(len(S)-count)
p03836
s101585455
Wrong Answer
sx,sy,tx,ty=map(int,input().split()) dx,dy=tx-sx,ty-sy print("U"*dy+"R"*dx+"D"*dx+"L"*dy+"L"+"U"*(dy+1)+"R"*(dx+1)+"D"+"R"+"D"*(dy+1)+"L"*(dx+1)+"U")
p02547
s969919946
Wrong Answer
n = int(input()) count = 0 flag = False c = [0]*n while count < n: a, b = map(int, input().split()) count += 1 if a == b and count < n: a, b = map(int, input().split()) count += 1 if a == b and count < n: a, b = map(int, input().split()) count += 1 if a == b and count < n: flag = True print("Yes") break if flag == False: print("No")
p03815
s828843744
Wrong Answer
#!/usr/bin/env python3 x = int(input()) print((x // 11) * 2 + (2 if x % 11 > 6 else 1))
p02888
s884107469
Accepted
import sys read = sys.stdin.read #readlines = sys.stdin.readlines from bisect import bisect_left def main(): n, *l = map(int, read().split()) l.sort() r = n * (n - 1) * (n - 2) // 6 for i1 in range(n - 2): for i2 in range(i1 + 1, n - 1): r -= (n - bisect_left(l, l[i1] + l[i2])) print(r) if __name__ == '__main__': main()
p03545
s117105199
Accepted
def main(): A, B, C, D = input() for i in range(2**3): op = ['+', '+', '+'] for j in range(len(op)): if (i >> j) & 1: op[j] = '-' if eval(A + op[0] + B + op[1] + C + op[2] + D) == 7: print(A + op[0] + B + op[1] + C + op[2] + D + '=7') break if __name__ == '__main__': main()
p03329
s934020100
Accepted
n = int(input()) #dp[j] = j¥を引き出すために必要な操作の最小回数 dp = [float('inf')]*(10**5+1) dp[0] = 0 import math for i in range(1,10**5+1): for j in range(int(math.log(i,9)+0.00001)+1): dp[i] = min(dp[i], dp[i-9**j]+1) for k in range(int(math.log(i,6))+1): dp[i] = min(dp[i],dp[i-6**k]+1) print(dp[n]) #print(dp[n-3:n+1])
p02661
s105213049
Wrong Answer
n = int(input().strip()) ab = [tuple(map(int, input().split())) for _ in range(n)] mid_min = 0 mid_max = 0 ab.sort(key=lambda x: x[0]) if n & 1: mid_min = ab[n // 2][0] else: mid_min = (ab[(n - 1) // 2][0] + ab[n // 2][0]) / 2 ab.sort(key=lambda x: x[1]) if n & 1: mid_max = ab[n // 2][1] else: mid_max = (ab[(n - 1) // 2][1] + ab[n // 2][1]) / 2 if n & 1: print(mid_max - mid_min + 1) else: print(int(mid_max - mid_min) * 2 + 1)
p03103
s296165292
Wrong Answer
n,m = map(int,input().split()) drink = dict() cost = [] ans = 0 for i in range(n): ab = [int(i) for i in input().split()] cost.append(ab[0]) if ab[0] in drink: drink[ab[0]] += ab[1] else: drink[ab[0]] = ab[1] #ここまで入力 cost.sort() for i in cost: if m <= drink[i]: ans += m*i break else: m -= drink[i] ans += i * drink[i] print(ans)
p02684
s423508595
Accepted
def D(): n, k = map(int, input().split()) a = list(map(int, input().split())) next = a[0] path = [1] visited = [True] + [False]*(n-1) while not visited[next-1]: k -= 1 if k==0: print(next) break path.append(next) visited[next-1] = True next = a[next-1] if k!=0: cyclic = path[path.index(next):] print(cyclic[k%(len(cyclic))-1]) D()
p03730
s695883202
Accepted
A, B, C = map(int, input().split()) import fractions c = fractions.gcd(A,B) ans = 'NO' if C % c == 0: ans = 'YES' print(ans)
p03673
s808044312
Accepted
from collections import deque n = int(input()) a = list(input().split()) q = deque() for i in range(n): if n&1: if i&1: q.append(a[i]) else: q.appendleft(a[i]) else: if i&1: q.appendleft(a[i]) else: q.append(a[i]) for i in q: print(i,end=" ")
p02707
s963973634
Accepted
N = int(input()) A = list(map(int,input().split())) ans = [0]*(N+1) for i in range(N-1): ans[A[i]] += 1 for i in range(1,N+1): print(ans[i])
p03137
s092784046
Accepted
n,m = map(int, input().split()) x = sorted(list(map(int, input().split()))) d = [] for i in range(len(x)-1): d.append(x[i+1] - x[i]) d.sort() ans = 0 for i in range(m-n): ans += d[i] print(ans)
p03557
s311466272
Accepted
from bisect import bisect_left,bisect_right 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_left(A,b) c = bisect_right(C,b) ans += a*(N-c) print(ans) if __name__ == "__main__": main()
p03351
s971835428
Accepted
a, b, c, d = map(int, input().split()) if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d): print('Yes') else: print('No')
p02663
s290195490
Wrong Answer
H1,M1,H2,M2,K = map(int,input().split()) print((H2-H1)*60 + (M1 - M2) - K)
p02622
s479957387
Accepted
a = list(input()) b = list(input()) t=0 for i in range(len(a)): if a[i] != b[i]: t+=1 print(t)
p02831
s258126987
Accepted
def lcm(x, y): return x / gcd(x, y) * y def gcd(a, b): if (b == 0): return a return gcd(b, a % b); a, b = [int(i) for i in input().split()] print(int(lcm(a, b)))
p02879
s686485396
Accepted
a, b = map(int, input().split()) if 0 < a < 10 and 0 < b < 10: print(a * b) else: print(-1)
p03043
s026462600
Wrong Answer
from math import ceil N, K = map(int, input().split()) n = 1 while K > 2**n: n += 1 ans = 0.5**n pre = 1 for i in range(n - 1, -1, -1): k = ceil(K / (2**i)) if N >= k: ans += (k - pre) * (0.5 ** i) if N == k: break else: ans += (N - pre) * (0.5 ** i) break pre = k if N > K: ans += N - K print(ans / N)
p02843
s069056386
Wrong Answer
x=int(input()) for i in range(1,1000000): if 100*i<=x<105*i: print(1) exit() print(0)
p02681
s363689651
Accepted
from itertools import zip_longest s = input() j = input() for x,y in zip_longest(s,j): if x != None and x != y: print("No") break if x == None: print("Yes")
p03146
s159471791
Accepted
s = int(input()) apple = [] count = 0 def func_1(a): a = int(a) if a % 2 == 0: return int(a / 2) else: return int(3 * a + 1) while s not in apple: apple.append(s) s = func_1(s) count += 1 else: print(count + 1)
p03637
s331452289
Accepted
n = int(input()) a = list(map(int, input().split())) a4 = [] a2 = [] a1 = [] for i in range(n): if a[i] % 4 == 0: a4.append(a[i]) elif a[i] % 2 == 0: a2.append(a[i]) else: a1.append(a[i]) if len(a4) >= n//2: print("Yes") elif len(a4) + len(a2)//2 >= n//2: print("Yes") else: print("No")
p03860
s193865409
Accepted
s1, s2, s3 = (i for i in input().split()) print(s1[0]+s2[0]+s3[0])
p03493
s781029360
Accepted
print(input().count("1"))
p03107
s207588760
Accepted
S = input() z = S.count("0") o = S.count("1") print(len(S)-abs(z-o))
p03075
s481219159
Accepted
l = [int(input()) for _ in [0] * 6] #print(l) k=l.pop() ##print if l[4] - l[0] > k: print(':(') else: print('Yay!')
p02916
s503535089
Wrong Answer
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = [0]*n t = list(map(int, input().split())) for i in range(n-1): c[i] = t[i] x = 0 y = 0 for i in range(n): y += b[a[i] - 1] + x x = c[a[i] - 1] print(y)
p02572
s731427223
Wrong Answer
import numpy as np mod = 1000000007 n = int(input()) a = list(map(int,input().split())) ans = 0 s = np.zeros(n) s[0] = a[0] for i in range(1,n): s[i] = s[i-1]+a[i] for i in range(n-1): ans += (s[n-1]-s[i])*a[i] ans = ans%mod print(ans)
p02971
s199186591
Accepted
N = int(input()) A = [int(input()) for _ in range(N)] M = max(A) M_index = A.index(M) sub_M = 0 for i in range(N): if i != M_index: sub_M = max(sub_M, A[i]) for i in range(N): if i == M_index: print(sub_M) else: print(M)
p02547
s661904637
Wrong Answer
def solve(n, d): n -= 2 for i in range(n): for j in range(i + 1, n): if all(d[i + k][0] == d[i + k][1] for k in range(3)): return True return False def main(): n = int(input()) d = [list(map(int, input().split())) for _ in range(n)] print("Yes" if solve(n, d) else "No") if __name__ == '__main__': main()
p03030
s186727693
Accepted
N = int(input()) restrante = [input().split() for i in range(N)] for i in range(N): restrante[i].append(i+1) restrante[i][1] = int(restrante[i][1]) sorted_res= sorted(restrante, key = lambda x:(x[1]), reverse=True) sorted_ans = sorted(sorted_res, key = lambda x:(x[0])) for i in range(N): print(sorted_ans[i][2])
p03632
s502649201
Accepted
A,B,C,D=map(int,input().split()) start=max(A,C) end=min(B,D) print(max(0,end-start))
p02622
s623219851
Accepted
S=list(input()) T=list(input()) ans=0 L=len(S) for i in range(L): if S[i]!=T[i]: ans+=1 print(ans)
p03328
s280979280
Wrong Answer
a,b = map(int, input().split()) l= [1] x = 0 for i in range(1,100): x = l[i-1] + i+1 l.append(x) for j in range(len(l)-1): if l[j+1] - l[j] == b-a: print(l[j] - a) break
p03760
s615477017
Wrong Answer
O=input() E=input() for o,e in zip(O,E): print(o+e,end="")
p02911
s981097903
Accepted
n,k,q = map(int, input().split()) x = [k] * (n) for i in range(q): a = int(input()) x[a-1] += 1 for i in range(n): if x[i] - q > 0: print('Yes') else: print('No')
p03693
s896722536
Accepted
r, g, b = map(int,input().split()) RGB = 100*r + 10*g + b if RGB %4 ==0: print("YES") else: print("NO")
p02983
s061818359
Accepted
l, r = map(int, input().split()) if r - l - 1 >= 2019: print(0) else: ans = 2019 for i in range(r - l): for j in range(i + 1, r - l + 1): if ans > ((i + l) * (j + l)) % 2019: ans = ((i + l) * (j + l)) % 2019 print(ans)
p02995
s050940324
Wrong Answer
from fractions import gcd A, B, C, D = map(int, input().split()) A -= 1 lcm = int(C / gcd(C, D) * D) nA = A - (int(A/C) + int(A/D) - int(A/lcm)) nB = B - (int(B/C) + int(B/D) - int(B/lcm)) print(nB - nA)
p03136
s423427753
Wrong Answer
n = int(input()) l = list(map(int,input().split())) if max(l)>= sum(l)-2*max(l): print("No") else: print("Yes")
p02711
s370088025
Accepted
n = input() for i in n: if i=="7": print("Yes") exit() print("No")
p02552
s062652128
Accepted
a = int(input()) if a==0: print(1) else: print(0)
p03137
s607145155
Accepted
N,M = map(int, input().split()) X = list(sorted(map(int, input().split()))) if N >= M: print(0) else: diff = [] for i in range(M-1): diff.append(X[i+1] - X[i]) diff.sort() print(sum(diff[:(M-N)]))
p02861
s604632509
Wrong Answer
import math import itertools n = int(input()) xy = [list(map(int, input().split())) for _ in range(n)] def distance(x1, y1, x2, y2): return math.sqrt((x1 - x2)**2 + (y1 - y2)**2) dist = 0 cnt = 0 for p in itertools.permutations(range(8)): for i in range(n-1): dist += distance(xy[i][0], xy[i][1], xy[i+1][0], xy[i+1][1]) cnt += 1 ans = dist / cnt print(ans)
p03456
s543291955
Accepted
# https://atcoder.jp/contests/abc086/tasks/abc086_b def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) a, b = input().split() i = int(a+b) if (i ** 0.5) % 1 == 0: print("Yes") else: print("No")
p03042
s279206471
Wrong Answer
import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 s = input() a = int(s[0] + s[1]) b = int(s[2] + s[3]) if a <= 12 and b <= 12: print("AMBIGUOUS") elif a <= 12: print("MMYY") elif b <= 12: print("YYMM") else: print("NA")
p02755
s531110811
Wrong Answer
def main(): a, b = map(int, input().split(" ")) a1 = a*100/8 a2 = (a+1)*100/8 b1 = b*10 b2 = (b+1)*10 if a2<b1: print(-1) else: print(int(max(a1,b1))) if __name__ == "__main__": main()
p02972
s174991745
Wrong Answer
n = int(input()) a = list(map(int,input().split())) ans = set() for i in range(n,0,-1): count = 0 for j in range(1,n//i+1): if j in ans: count += 1 if count % 2 != a[i-1] : ans.add(i) ans = list(ans) ans.sort() print(len(ans)) print(" ".join(map(str,ans)))
p03386
s385489228
Wrong Answer
A, B, K = map(int, input().split()) candidate = [i+1 for i in range(B) if i+1 >= A and i+1 <= B] for i in range(len(candidate)): if candidate[i] <= A+K or candidate[i] >= B-K: print(candidate[i])
p03545
s531837707
Accepted
ABCD = list(input()) import itertools for i in itertools.product(['+', '-'], repeat=3): ans = int(ABCD[0]) # print(i) for idx, ii in enumerate(i): if ii == '+': ans += int(ABCD[idx+1]) else: ans -= int(ABCD[idx+1]) # print(ABCD[0]+i[0]+ABCD[1]+i[1]+ABCD[2]+i[2]+ABCD[3], ans) if ans == 7: break print(ABCD[0]+i[0]+ABCD[1]+i[1]+ABCD[2]+i[2]+ABCD[3]+'=7')
p04034
s167969135
Accepted
N, M = map(int, input().split()) colors = ['R'] + ['W'] * (N-1) counts = [1]*N def receive(color, id): counts[id] += 1 if colors[id] == 'E': colors[id] = color elif color != colors[id]: colors[id] = 'M' def send(id): color = colors[id] counts[id] -= 1 if counts[id] == 0: colors[id] = 'E' return color for i in range(M): x, y = map(int, input().split()) c = send(x-1) receive(c, y-1) print(sum([1 for c in colors if c == 'R' or c == 'M']))
p02705
s501456185
Wrong Answer
import math import operator as op from functools import reduce def ncr(n, r): r = min(r, n-r) numer = reduce(op.mul, range(n, n-r, -1), 1) denom = reduce(op.mul, range(1, r+1), 1) return numer / denom """ int(input()) map(int,input().split()) list(map(int,input().split())) """
p02768
s568092442
Wrong Answer
n,a,b=(int(i) for i in input().split()) p = 10 ** 9 + 7 def comb(n,k): nCk = 1 MOD = 10**9+7 for i in range(n-k+1, n+1): nCk *= i nCk %= MOD for i in range(1,k+1): nCk *= pow(i,MOD-2,MOD) nCk %= MOD return nCk r=pow(2,n,p)-comb(n,a)-comb(n,b)-1 if r<0: r+=p print(r)