problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02727
s810316227
Wrong Answer
import bisect x,y,a,b,c=map(int,input().split()) A=sorted(list(map(int,input().split())))[::-1] B=sorted(list(map(int,input().split())))[::-1] C=sorted(list(map(int,input().split())))[::-1] l=A[:x]+B[:y] l=sorted(l) lim=l[0] for tt in C: if lim>tt: continue index=bisect.bisect_left(l,tt) l.insert(index,tt) lim=l[-x-y+1] l=l[::-1] print(sum(l[:x+y]))
p02785
s488657943
Accepted
N, K = [int(i) for i in input().split(" ")] H = [int(i) for i in input().split(" ")] H.sort() monster = H[0:N-K] if K >= N: print(0) else: print(sum(monster))
p02801
s111282865
Accepted
print(chr(ord(input())+1))
p03474
s163359498
Accepted
A, B = map(int, input().split()) S = input() print("Yes" if S[A]=="-" and (S[:A]+S[A+1:]).isdecimal() else "No")
p02546
s178055203
Accepted
s = input() if s[-1] == "s": print(s + "es") else: print(s + "s")
p03804
s347333299
Accepted
n,m=map(int,input().split()) a=[input() for _ in range(n)] b=[input() for _ in range(m)] if n==m: print('Yes' if a==b else 'No') exit() for i in range(n-m): for k in range(n-m): if all(b[j] in a[i+j][k:k+m+1] for j in range(m)): print('Yes') exit() print('No')
p02971
s405943732
Accepted
N = int(input()) A = [int(input()) for _ in range(N)] B = sorted(A,reverse=True) x = B[1] y = B[0] m = A.index(max(A)) for i in range(N): if i == m: print(x) else: print(y)
p02615
s198406070
Accepted
from functools import reduce from fractions import gcd import math import bisect import itertools import sys sys.setrecursionlimit(10**7) input = sys.stdin.readline INF = float("inf") # 処理内容 def main(): N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) ans = 0 cnt = 1 i = 0 for n in range(N-1): ans += A[i] cnt += 1 if cnt == 2: i += 1 cnt = 0 print(ans) if __name__ == '__main__': main()
p03371
s851258160
Accepted
A, B, C, X, Y = map(int, input().split()) C = min(2*C, A+B) ans = 0 ans += C*min(X, Y) if X > Y: ans += min(C, A) * abs(X-Y) else: ans += min(C, B) * abs(X-Y) print(ans)
p02597
s698551500
Accepted
n = int(input()) C = [c for c in input()] ans = 0 l,r = 0, n-1 while(l < r): while(C[l] == 'R'): l += 1 if (n == l): break while(C[r] == 'W' or -1 == r): r -= 1 if (-1 == r): break if (l < r): ans += 1 l += 1 r -= 1 print(ans)
p02691
s646785670
Wrong Answer
N = int(input()) A = list(map(int, input().split())) Asort = sorted(A) Amin = sum(Asort[:2]) Amax = min(sum(Asort[-2:]), N - 1) cnt = 0 for i in range(N): for j in range(Amin, Amax + 1): if i - j >= 0 and j == A[i - j] + A[i]: cnt += 1 elif i + j <= N - 1 and j == A[i] + A[i + j]: cnt += 1 print(cnt // 2)
p03543
s790792217
Accepted
n=input() x=[int(i) for i in n] if (x[0]==x[1] and x[1]==x[2]) or (x[1]==x[2] and x[2]==x[3]): print("Yes") else: print("No")
p03479
s399805299
Accepted
from sys import stdin input = stdin.readline def main(): X, Y = list(map(int, input().split())) cnt = 1 while True: X *= 2 if X > Y: break cnt += 1 print(cnt) if(__name__ == '__main__'): main()
p02779
s029654192
Accepted
n = int(input()) print("YES" if len(set(input().split())) == n else "NO")
p03862
s048481891
Accepted
n,x=map(int,input().split()) a=list(map(int,input().split())) s=0 for i in range(1,n): b=a[i-1]+a[i]-x if b>0: s+=b a[i]=max(a[i]-b,0) print(s)
p02712
s534337153
Accepted
a = int(input()) sum = 0 for i in range(1,a+1): if i%5 != 0 and i%3 != 0: sum += i print(sum)
p02706
s642399545
Wrong Answer
n, m = map(int, input().split()) a = list(map(int, input().split())) p = sum(a) if n>p: print(n-p) else: print(-1)
p03387
s052910563
Accepted
A, B, C = map(int, input().split()) if A%2 == B%2 == C%2: nums = sorted([A, B, C]) print((nums[2]*2 - (nums[0]+nums[1]))//2) else: if A%2 == B%2: A += 1 B += 1 elif A%2 == C%2: A += 1 C += 1 else: B += 1 C += 1 nums = sorted([A, B, C]) print((nums[2]*2 - (nums[0]+nums[1]))//2 + 1)
p02838
s441355180
Accepted
N = int(input()) MOD = 10**9+7 nums = list(map(int, input().split())) B = [0 for _ in range(60)] for num in nums: for i in range(60): if num>>i&1: B[i] += 1 answer = 0 for i, b in enumerate(B): if b > 0: answer = (answer+b*(N-b)*2**i)%MOD print(answer)
p02900
s055113515
Wrong Answer
import math A,B = map(int, input().split()) # 最大公約数の算出 y = max(A,B) x = min(A,B) while y%x != 0: tmp = x x = y%x y = tmp # 素因数分解 p = [] for n in range(2,int(math.sqrt(x))+1): if x % n == 0: x /= n p.append(n) else: p.append(int(x)) p = list(set(p)) print(len(p))
p03012
s584204749
Accepted
N=int(input()) W=list(map(int,input().split())) sa=[] for i in range(N-1): S1=sum(W[:i+1]) S2=sum(W[i+1:]) #print(S1,S2) sa.append(abs(S2-S1)) print(min(sa))
p02597
s572872866
Accepted
from collections import Counter n = int(input()) C = input() c = Counter(C) numR = 0 for i in range(c['R']): if C[i] == 'R': numR += 1 print(c['R']-numR)
p04034
s843001648
Accepted
#!/usr/bin/env python3 #import #import math #import numpy as np N, M = map(int, input().split()) Q = [list(map(int, input().split())) for _ in range(M)] R = [False] * (N + 1) num = [1] * (N + 1) R[1] = True for x, y in Q: R[y] = R[x] or R[y] num[x] -= 1 num[y] += 1 if num[x] <= 0: R[x] = False print(R.count(True))
p02832
s366248496
Accepted
n = input() list = map(int, input().split()) num = 1 a = 0 for i in list: if i == num: num = num +1 else: a = a + 1 if num == 1: print(-1) else: print(a)
p03126
s941730756
Accepted
n,m=map(int,input().split()) l=[] for i in range(n): p=list(map(int,input().split())) for j in range(1,p[0]+1): l.append(p[j]) cnt=0 for k in l: if l.count(k)==n: cnt+=1 print(cnt//n)
p03013
s271192614
Wrong Answer
import sys n,m = map(int, input().split()) a = [int(input()) for i in range(m)] a.append(n) a.insert(0, 0) def nCr(n, r): num = 1 for i in range(r+1, n+1): num *= i return num P = 1 for i in range(m): if a[i] + 1 == a[i+1]: print(0) sys.exit() for i in range(1, m+2): step = a[i] - a[i-1] - 1 pattern = 1 for j in range(1, int(step/2+1)): pattern += nCr(step-j, j) P *= pattern print(P%1000000007)
p02939
s996663438
Accepted
S = str(input()) ans = '' ans2 = '' con = 0 for s in S: ans += s if ans != ans2: con += 1 ans2 = ans ans = '' print(con)
p02791
s221876258
Accepted
n = int(input()) p = list(map(int,input().split())) mn = 2*10**5+1 count = 0 for i in range(n): if p[i] < mn: count += 1 mn = p[i] print(count)
p02862
s471941036
Wrong Answer
import sys X, Y = map(int, input().split()) MOD = 1000000007 if (2*X-Y)%3!=0: print(0) sys.exit() A = int((2*X-Y)/3) B = int(Y-2*A) if A<0 or B<0: print(0) sys.exit() ans = 1 inv = 1 for i in range(B): ans = ans * (A+B-i) %MOD inv = inv * (i+1) %MOD ans = ans * pow(inv, MOD-2, MOD) %MOD print(ans)
p03555
s752149091
Wrong Answer
a = list(map(str, input())) b = list(map(str, input())) if a[0] == b[0] and a[1] == b[1] and a[2] == b[2]: print('YES') else: print('NO')
p02767
s522796007
Wrong Answer
n = int(input()) xi = list(map(int, input().split())) cost = [] for p in range(max(xi)): tmp = 0 for i in xi: tmp += pow((p - i), 2) cost.append(tmp) print(min(cost))
p03455
s019484746
Accepted
a, b = map(int, input().split()) if a * b % 2: print('Odd') else: print('Even')
p03086
s836576660
Wrong Answer
S = input() count = 0 count_max = 0 for i in range(len(S)): if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T': count += 1 continue else: if count_max <= count: count_max = count print(count_max)
p02897
s626554499
Accepted
n = int(input()) if n % 2 == 0: a = n // 2 else: a = n // 2 + 1 print(a / n)
p02973
s969814949
Accepted
import bisect N = int(input()) A = [int(input()) for i in range(N)] def lis(S): from bisect import bisect_right L = [S[0]] for s in S[1:]: if s >= L[-1]: L.append(s) else: L[bisect_right(L, s)] = s return len(L) print(lis(A[::-1]))
p03417
s201556992
Accepted
N, M = map(int, input().split()) if N == 2 or M == 2: print(0) elif N == 1: print(abs(M-2)) elif M == 1: print(abs(N-2)) else: print((N-2) * (M-2))
p02711
s904922776
Wrong Answer
n = str(input()) if n[0] or n[1] or n[2] != 7: print("No") else: print("Yes")
p03416
s234046841
Accepted
a, b = map(int, input().split()) s = 0 for n in range(a,b+1): n = str(n) l = len(n) for i in range(int((l+1)/2)): if n[i] != n[l-1-i]: break elif n[i] == n[l-1-i] and i == (l-1)/2: s+= 1 else: continue print(s)
p04031
s214854898
Wrong Answer
if __name__ == '__main__': n = int(input()) lst = list(map(int, input().split())) ans = 100 for i in range(-100,101): mn = 0 for c in lst: mn += (i-c)*(i-c) ans = min(ans,mn) print(ans)
p03644
s519360166
Accepted
n = int(input()) a=0 for i in range(10): x = 2 ** i if x <=n: a=x print(a)
p03262
s749397524
Accepted
from fractions import gcd N,X=map(int,input().split()) x=list(map(int,input().split())) z=list(map(lambda i: abs(X-i),x)) ans=z[0] for i in range(1,N): ans=gcd(ans,z[i]) print(ans)
p03038
s738731744
Accepted
n, m = map(int, input().split()) a = list(map(int, input().split())) a.sort() l = [] for i in range(m): b, c = map(int, input().split()) l.append((b, c)) l = sorted(l, key=lambda x: x[1], reverse=True) cnt = 0 b = 0 ans = 0 for i in a: if cnt == m and b == 0: ans += i continue if b == 0: b, c = l[cnt] cnt += 1 ans += max(c, i) b -= 1 print(ans)
p03286
s083688396
Accepted
N = int(input()) if N==0: print(0) exit() ans = '' while N!=1: d = N%2 ans += str(d) N -= d N //= -2 ans += '1' print(ans[::-1])
p04011
s104231957
Accepted
import sys input = sys.stdin.readline N = int(input()) K = int(input()) X = int(input()) Y = int(input()) if K >= N: print(X * N) else: print(X * K + (N - K) * Y)
p03001
s579594086
Wrong Answer
w,h,x,y=map(int,input().split()) if x==w//2 and y==h//2: a=1 else: a=0 print(w*h/2,a)
p03220
s206905778
Wrong Answer
from bisect import bisect_left N = int(input()) T, A = map(int, input().split()) H = sorted([T-(int(a)*0.006) for a in input().split()]) ans = bisect_left(H, A) print(ans)
p02694
s135975248
Wrong Answer
X = int(input()) money = 100 count = 0 while money < X: count += 1 money = int(money * 1.01) print(count)
p02987
s196348469
Wrong Answer
S=list(map(str,input())) cnt1=0 cnt2=0 if S[0]!=S[1]: for i in range(1,4): if S[0]==S[i]: cnt1 +=1 for j in range(2,4): if S[1]==S[j]: cnt2 +=1 if cnt1==1 and cnt2==1: print("Yes") else:print("No") else: if S[2]==S[3]: print("Yes") else: print("No")
p03351
s459139925
Accepted
a,b,c,d=map(int, input().split()) if (abs(a-b)<=d and abs(b-c)<=d) or abs(a-c)<=d: print("Yes") else: print("No")
p02618
s962242200
Wrong Answer
ans = [1]*365 for i in range(365): ans[i]=i%26 + 1 for i in range(200,250): ans[i]=i%52 //2 + 1 for i in range(365): print(i,ans[i])
p03243
s206170402
Wrong Answer
n=list(input()) n1=int("".join(n)) l=[] for i in n: l.append(int(i*3)) idx=-1 a=99999 for i in range(0,3): if a>abs(l[i]-n1) and l[i]>=n1: idx=i a=abs(l[i]-n1) print(l[idx])
p02601
s140518425
Accepted
def resolve(): A, B, C = list(map(int, input().split())) K = int(input()) cnt = 0 while cnt < K: if A >= B: B *= 2 cnt += 1 continue if B >= C: C *= 2 cnt += 1 continue cnt += 1 if A < B < C: print('Yes') else: print('No') return resolve()
p04029
s078236093
Accepted
def main(): n = int(input()) print((n * (n + 1)) // 2) if __name__ == '__main__': main()
p02773
s592564157
Accepted
N = int(input()) S_list = [] for n in range(N): S_list.append(input()) dic = dict() for s in S_list: if s in dic: dic[s] += 1 else: dic[s] = 1 dict_sorted = sorted(dic.items(), key=lambda x: x[1], reverse=True) outs = [] max = None for (out, num) in dict_sorted: if max is None: outs.append(out) max = num elif max == num: outs.append(out) else: break for out in sorted(outs): print(out)
p03487
s033356271
Accepted
from collections import Counter n = int(input()) a = [int(i) for i in input().split()] counter = Counter(a) cnt = 0 for k, v in counter.items(): cnt += v if k > v else v - k print(cnt)
p02910
s469164363
Accepted
s = input() x = s[0::2] y = s[1::2] if ('L' in x or 'R' in y): print('No') else: print('Yes')
p03617
s599014238
Wrong Answer
q, h, s, d = map(int, input().split()) n = int(input()) q4 = 4*q h2 = 2*h minimum = min(q4, h2, s) ans = 0 tmp = n//2 tmp2 = n % 2 ans += tmp * d ans += tmp2 *minimum print(ans)
p03711
s878246316
Wrong Answer
a,b = map(int, input().split()) if a == 2 or b == 2: print('No') elif a == (4 or 6 or 9 or 11): if b == (4 or 6 or 9 or 11): print('Yes') else: print('No') else: if b == (4 or 6 or 9 or 11): print('No') else: print('Yes')
p02842
s880676852
Wrong Answer
import math N = int(input()) count = 0 ans = 0 for i in range(N): money = 0 money = math.floor(i*1.08) if money == N: count += 1 ans = i break if count == 0: print(":(") else: print(ans)
p03795
s706600116
Wrong Answer
N = int(input()) print(N*800-15//N*400)
p03309
s479085666
Accepted
n=int(input()) a=list(map(int,input().split())) for i in range(n): a[i]=a[i]-(i+1) import numpy as np an=np.array(a) b=int(np.median(an)) ans=0 for i in a: ans+=abs(i-b) print(ans)
p02910
s927869549
Wrong Answer
S = input() odd = list(S[::2]) even = list(S[1::2]) x = "No" for i in range(len(odd)): if odd[i] == "L" or "U" or "D": x = "Yes" else: continue for i in range(len(even)): if even[i] == "R" or "U" or "D": x = "Yes" else: continue print(x)
p02657
s031548816
Wrong Answer
import math A,B = map(float,input().split()) if A == int(A) and 0<=A<=10**15 and 0<=B<10: d = A*B c = math.floor(d) print(c)
p03611
s574903942
Accepted
n=int(input()) a=list(map(int,input().split())) x=[0]*10**5 for i in a: x[i]+=1 ans=0 for i in range(10**5-2): ans=max(ans,x[i]+x[i+1]+x[i+2]) print(ans)
p03644
s550923851
Wrong Answer
l = [1, 2, 4, 8, 16, 32, 64] n = int(input()) l.append(n) l.sort() print(l[l.index(n)-1])
p02701
s461387438
Accepted
N = int(input()) list = [] for i in range(N): list.append(input()) print(len(set(list)))
p03284
s810122221
Wrong Answer
N, K = map(int, input().split()) print(N%K)
p02623
s976560066
Accepted
N,M,K = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) 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,j = 0,M for i in range(N+1): if a[i]>K: break while b[j]>K-a[i]: j -= 1 ans = max(ans,i+j) print(ans)
p03779
s277176948
Wrong Answer
x = int(input()) dis = 0 time = 0 for i in range(1,10**10): if x - dis -i>= i+1: time += 1 dis += i else: print(x-dis) exit()
p02952
s783445087
Wrong Answer
import math import collections import itertools def resolve(): N=int(input()) ans=0 for i in range(1,N): if(10<=i<99 or 1000<=i<9999 or 100000<=i<999999): continue ans+=1 print(ans) resolve()
p03633
s828183385
Wrong Answer
import sys read = sys.stdin.read from math import gcd def main(): n = int(input()) t = [int(input()) for _ in range(n)] if n == 1: print(t[0]) sys.exit() r = (t[0] * t[1]) // gcd(t[0], t[1]) if n == 2: print(r) sys.exit() for i1 in range(2, n): r = (r * t[i1]) // gcd(r, t[1]) print(r) if __name__ == '__main__': main()
p03943
s849971007
Accepted
a,b,c=map(int,input().split()) temp=[a,b,c] temp.sort() if temp[0]+temp[1]==temp[2]: print("Yes") else: print("No")
p03427
s656852435
Wrong Answer
n = input() if set(list(n)) == {'9'}: print(len(list(n))*9) exit() tmp = '' for i in range(1,len(n)): if n[i] == '9': tmp += n[i-1] print(tmp) else: n[i]!= '9' tmp += str(int(n[i-1])-1) + '9'*(len(n)-i) break else: tmp += '9' ans=0 for i in range(len(tmp)): ans += int(tmp[i]) print(ans)
p03861
s359157919
Accepted
a, b, x = map(int, input().split()) ans = int(b//x) - int(a//x) if a%x ==0: ans += 1 print(ans)
p02900
s951631584
Accepted
import sys from fractions import gcd input = sys.stdin.readline def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n //= i table.append(i) i += 1 if n > 1: table.append(n) return table a, b = map(int, input().split()) g = gcd(a, b) print(len(set(prime_decomposition(g))) + 1)
p03799
s345177989
Wrong Answer
n, m = map(int, input().split()) m += n * 2 if m <= 3: print(0) else: print(m // 4)
p03745
s029532404
Accepted
N = int(input()) A = list(map(int,input().split())) cnt = 1 flag = "" for i in range(1,N): if A[i - 1] > A[i] and flag == "": flag = "+" elif A[i - 1] < A[i] and flag == "": flag = "-" elif flag == "+" and (A[i - 1] < A[i]): cnt += 1 flag = "" elif flag == "-" and (A[i - 1] > A[i]): cnt += 1 flag = "" print(cnt)
p03860
s393624648
Wrong Answer
l=input().split() print(l[0]+l[1][0]+l[2])
p04019
s945028917
Wrong Answer
s = list(input()) if len(set(s))%2==1: print('No') if len(set(s))==4: print('Yes') if len(set(s))==2: if list(set(s))==['N','S']: print('Yes') elif list(set(s))==['E','W']: print('Yes') else: print('No')
p02645
s609872119
Accepted
name = input() print(name[:3])
p03821
s308680998
Wrong Answer
n=int(input()) ans=0 for i in range(n): a,b=map(int,input().split()) ans += (b-a%b)%b print(ans)
p03103
s579736815
Accepted
N,M = map(int,input().split()) C = [[0 for _ in range(2)]for _ in range(N)] for n in range(N): C[n][0], C[n][1] = map(int,input().split()) C.sort() cost = 0 for n in range(N): if C[n][1] <= M: cost += C[n][1]*C[n][0] else: cost += C[n][0]*M break M -= C[n][1] if M <= 0: break print(cost)
p03289
s878468821
Accepted
S=input() Sdash=[] for i in range(2,len(S)-1): Sdash.append(S[i]) a=0 for i in range(len(S)): if S[i].islower()==True: a+=1 if S[0]=='A' and Sdash.count('C')==1 and a==len(S)-2: print('AC') else: print('WA')
p03745
s798791092
Wrong Answer
n = int(input()) a_ls = list(map(int, input().split())) times1 = 0 i = 1 while 1 <= i < n-1: if a_ls[i-1] < a_ls[i] > a_ls[i+1] or a_ls[i-1] > a_ls[i] < a_ls[i+1]: times1 += 1 i += 1 i += 1 times2 = 0 i = n-2 while 1 <= i < n-1: if a_ls[i-1] < a_ls[i] > a_ls[i+1] or a_ls[i-1] > a_ls[i] < a_ls[i+1]: times2 += 1 i -= 1 i -= 1 times = min(times1,times2) print(times+1)
p02951
s967888162
Accepted
a, b, c = map(int, input().split()) ans = c-(a-b) print(ans if ans >= 0 else 0)
p03360
s644175669
Accepted
a,b,c = map(int,input().split()) k = int(input()) ans = sum([a,b,c])-max(a,b,c) ans += max(a,b,c) * (2**k) print(ans)
p03286
s991045525
Accepted
def main(): i = int(input()) if i == 0: print(0) exit() ans = "" while i: p = i % 2 ans += str(p) i = - (i // 2) print(ans[::-1]) if __name__ == '__main__': main()
p03693
s154724900
Accepted
r, g, b = (int(x) for x in input().split()) s = 100*r+10*g+b if s%4 == 0: print("YES") else: print("NO")
p03160
s860226163
Wrong Answer
import math import os import random import re import sys def dpfindpath(a): dpath=[int(0) for _ in range(len(a))] print(len(dpath)) dpath[0]=0 dpath[1]=abs(a[1]-a[0]) for i in range(2,len(a)): dpath[i]=min(abs(a[i]-a[i-1])+dpath[i-1],abs(a[i]-a[i-2])+dpath[i-2]) return dpath[len(a)-1] n=int(input()) a=input().split() for i in range(n): a[i]=int(a[i]) print (dpfindpath(a))
p04034
s326562338
Accepted
n,m = map(int, input().split()) ''' d = dict() for i in range(1,n+1): d[str(i)] = 1 from collections import deque ans = deque('1')''' box = [1 for i in range(n)] ans = [0 for i in range(n)] ans[0] = 1 for _ in range(m): x,y = map(int,input().split()) box[x-1] -= 1 box[y-1] += 1 if ans[x-1]==1 and ans[y-1]==0: ans[y-1] = 1 if box[x-1]==0 and ans[x-1]==1: ans[x-1] = 0 print(sum(ans))
p02661
s701094845
Accepted
# -*- coding: utf-8 -*- import sys N, *AB = map(int, sys.stdin.buffer.read().split()) A = sorted(AB[::2]) B = sorted(AB[1::2]) center = N//2 if N%2==1: print(B[center]-A[center]+1) else: print((B[center]+B[center-1])-(A[center]+A[center-1])+1)
p02880
s281790461
Accepted
n = int(input()) flag = 0 for i in range(1,10): for j in range(1,10): if i*j == n: flag = 1 if flag == 1: print('Yes') else: print('No')
p03131
s065502391
Accepted
k, a, b = map(int, input().split()) if a + 1 >= b: print(1 + k) else: if k < a + 1: print(1 + k) else: a1 = b #a+1回 if (k - (a + 1)) % 2 == 0: a2 = ((k - (a + 1)) // 2) * (b - a) else: a2 = ((k - (a + 1) - 1) // 2) * (b - a) + 1 print(a1 + a2)
p02813
s199679379
Accepted
from itertools import permutations n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) for n, i in enumerate(permutations(sorted(p))): if i == p: pn = n for n, i in enumerate(permutations(sorted(q))): if i == q: qn = n print(abs(pn-qn))
p03407
s690626861
Accepted
A, B, C = map(int, input().split()) if (A + B) >= C: print('Yes') else: print('No')
p03469
s540235868
Accepted
s = input() print('2018' + s[4:])
p02838
s142981136
Accepted
n=int(input()) a=list(map(int,input().split())) bit_l=[0 for _ in range(60)] for x in a: for i in range(60): if ((x>>i)&1): bit_l[i]+=1 ans=0 mod=10**9+7 for y in range(len(bit_l)): r=2**y k=(n-bit_l[y])*bit_l[y] ans+=r*k%mod print(ans%mod)
p03109
s738009016
Accepted
def main(): S = list(map(int, input().split('/'))) if S[0] < 2019: print('Heisei') elif S[0] == 2019: if S[1] <= 4: print('Heisei') else: print('TBD') else: print('TBD') main()
p03774
s772168775
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 = [] for c,d in cd: ans.append(abs(a-c)+abs(b-d)) print(ans.index(min(ans))+1)
p03035
s031552997
Wrong Answer
A, B = map(int, input().split(' ')) if A >= 13: print(B) elif A >=6: print(B/2) else: print(0)