problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03264
s271162079
Wrong Answer
n = int(input()) if n % 2 == 0: print((n**2)//4) else: print(((n-1)//2) * (n // 2))
p02838
s459183970
Accepted
from sys import stdin def main(): n = int(stdin.readline().rstrip()) a = list(map(int,stdin.readline().rstrip().split())) mod = 10**9+7 point = 0 for i in range(61): now = sum(1 for j in a if(j >> i)&1) point += now*(n-now)*(2**i)%mod point %= mod print(point) if __name__ == "__main__": main()
p03673
s570246789
Accepted
from collections import deque x=int(input()) y=list(map(int, input().split())) d = deque() e=[] for i in range (x): if i%2==0: d.append(y[i]) else: d.appendleft(y[i]) if i%2==0: for i in range(x): e.append(d[((-i)-1)]) print(*(list(e))) else: print(*(list(d)))
p03219
s564917115
Wrong Answer
a, b = map(int, input().split()) print(a + b / 2)
p03797
s064274733
Accepted
#055_C n, m = map(int, input().split()) m //= 2 if n > m: print(m) else: print((n + m) // 2)
p02719
s037237517
Wrong Answer
n, k = (int(i) for i in input().split()) if k > n: print(n) elif n % k == 0: print(0) else: q = n % k q = abs(q-k) print(min(k, q))
p03767
s873977509
Accepted
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) print(sum(A[1:2 * N:2]))
p03852
s016300805
Wrong Answer
c = input() if c in "abcde": print("vowel") else: print("consoant")
p03623
s588811097
Wrong Answer
x, a, b = map(int, input().split()) print(min(abs(x-a), abs(x-b)))
p02946
s619816793
Accepted
argList = list(map(int, input().split())) outList = [str(x) for x in range(argList[1]-argList[0]+1,argList[1]+argList[0])] print(" ".join(outList))
p03673
s616733529
Accepted
def ii():return int(input()) def iim():return map(int,input().split()) def iil():return list(map(int,input().split())) def ism():return map(str,input().split()) def isl():return list(map(str,input().split())) n = ii() A = iil() tail = [item for i,item in enumerate(A) if i%2 == 0] head = [item for i,item in enumerate(A) if i%2 == 1] ans = head[::-1]+tail if n%2 == 0 else tail[::-1]+head print(*ans)
p02742
s547269497
Accepted
import math a=input().split(' ') if(int(a[0])==1): print(1) else: if(int(a[1])==1): print(1) else: print(math.ceil(int(a[0])*int(a[1])/2))
p03478
s662100719
Wrong Answer
N, A, B = map(int, input().split()) someSums = 0 for i in range(1, N+1): if A <= (i // 1000 % 10) + (i // 100 % 10) + (i // 10 % 10) + (i % 10) <= B: someSums += i print(i) print(someSums)
p02681
s211627482
Accepted
t=input(" ") k=input(" ") temp=0 for i in range(len(t)): if(t[i]!=k[i]): temp=1 break if(temp): print("No") else: print("Yes")
p03644
s604408305
Wrong Answer
n=int(input()) def f(i): c=0 while i>1: if i%2==0: c=c+1 i=int(i/2) else: break return c t=0 a=0 for i in range(n): fa=f(i+1) if t<fa: t=fa a=i+1 print(a)
p02880
s783266290
Accepted
x=int(input()) t=1 #a=[11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79] for i in range(1,10): for k in range(1,i+1): if k*i==x: print('Yes') t=0 break if t==0:break else:print('No')
p03137
s103802238
Accepted
import numpy as np from collections import deque N, M = map(int, input().split()) X = sorted(list(map(int, input().split()))) done = [0 for _ in range(M)] X = sorted(np.diff(np.array(X)))[::-1] q = deque(X) for i in range(N): if i > 0: try: q.popleft() except: print("0") exit() print(sum(q))
p02706
s726436324
Wrong Answer
M,N=map(int,input().split()) A=list(map(int,input().split())) print(M-sum(A))
p03795
s243125612
Wrong Answer
n = int(input()) power = 1 for i in range(1,n+1): power *= i print(power%(10**9+7))
p03711
s085360541
Accepted
a=[1,3,5,7,8,10,12] b=[4,6,9,11] c=[2] x,y=map(int,raw_input().split()) ans= "No" if x in a and y in a: ans= "Yes" elif x in b and y in b: ans = "Yes" print ans
p03437
s211319281
Wrong Answer
x, y = map(int,input().split()) if y%x == 0: print(-1) else: for i in range(10**9): if i%x == 0 and i%y != 0: print(i) break
p03773
s825379052
Wrong Answer
a,b = map(int,input().split()) ans = a+b if ans > 24: ans = ans -24 print(ans)
p03309
s852512556
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n, *a = map(int, read().split()) for i in range(n): a[i] -= i + 1 a.sort() if n % 2 != 0: b = a[(n - 1) // 2] else: b = (a[(n - 1) // 2] + a[((n - 1) // 2) + 1]) // 2 ans = 0 for v in a: ans += abs(b-v) print(ans)
p02602
s404414158
Accepted
N , K = map(int,input().split()) A = list(map(int,input().split())) P = [0]*(N - K) P0 = 1 for i in range(N-K): if A[i+K] > A[i] : P[i] = 1 for i in range(N-K): if P[i] == 1: print('Yes') else: print('No')
p03760
s683893300
Accepted
A = input() B = input() ans = '' if len(A) == len(B): for i in range(len(A)): ans += A[i] + B[i] else: for i in range(len(B)): ans += A[i] + B[i] ans += A[-1] print(ans)
p02642
s329444207
Accepted
import numpy as np N = int(input()) A = list(map(int, input().split())) A = np.int32(A) vals, cnts = np.unique(A, return_counts=True) if len(vals) == 1: print(0 if cnts[0] > 1 else 1) elif vals[0] == 1: print(0 if cnts[0] > 1 else 1) else: sat = np.ones(vals.max() + 1, dtype=int) for x in vals: sat[2 * x::x] = 0 ans = ((sat[vals] == 1) & (cnts == 1)).sum().item() print(ans) # 5 # 2 2 2 3 3 # 5 # 2 2 2 4 4 # 5 # 1 1 1 1 2
p03435
s785368617
Accepted
c = [] flag = True for i in range(3): c1,c2,c3 = map(int ,input().split()) c.append((c1,c2,c3)) diff1 = abs(c[0][0] - c[0][1]) diff2 = abs(c[0][1] - c[0][2]) for i in range(1,3): d1 = abs(c[i][0] - c[i][1]) d2 = abs(c[i][1] - c[i][2]) if d1 != diff1 or d2 != diff2: flag = False break if flag: print("Yes") else: print("No")
p03324
s400180720
Wrong Answer
D,N = map(int,input().split()) if D == 0: if N != 100: print(N) else: print(101) exit() if D == 1: if N != 100: print(N*100) else: print(10100) exit() if N != 100: print(N*10000) else: print(100010000)
p03799
s040175502
Wrong Answer
N, M = map(int, input().split()) ans = 0 if N > M/2: if M%2 == 0: ans = N else: ans = N-1 else: ans = N M -= 2*N ans += M//4 print(ans)
p02947
s835482906
Accepted
import string import collections n = int(input()) ans=[] for i in range(n): s=input() c = collections.Counter(s) ans.append("".join(map(str,[c[i] for i in string.ascii_lowercase]))) c2 = collections.Counter(ans) cnt=0 for k, v in c2.items(): cnt+=(v-1)*v//2 print(cnt)
p03416
s226327983
Wrong Answer
a, b = map(int, input().split()) ans = 0 for i in range(a, b + 1): s = str(i) if s[:2] == s[3:]: ans += 1 print(ans)
p02946
s089650799
Accepted
K, X = map(int, input().split()) L = X - (K-1) R = X + (K-1) if L < -1000000: L = -1000000 if R > 1000000: R = 1000000 for x in range(L,R+1): print(x, end=" ")
p03632
s016812469
Accepted
A,B,C,D=map(int,input().split()) s=max(A,C) f=min(B,D) if f-s>=0: print(f-s) else: print(0)
p03680
s093616048
Wrong Answer
n = int(input()) a = [int(input()) for i in range(n)] cnt = 0 if 2 not in a: print(-1) x = 1 for i in range(n): if x != a[x-1]: x = a[x-1] cnt += 1 else: print(-1) exit() if x == 2: print(cnt) exit() print(-1)
p02818
s083069491
Accepted
a,b,k = map(int,input().split()) if a > k : print("{} {}".format(a-k,b)) elif a + b > k: print("{} {}".format(0,b+a-k)) elif k >= a+b: print("{} {}".format(0,0))
p02900
s973603755
Wrong Answer
# -*- coding: utf-8 -*- A, B = map(int, input().split()) n = max(A, B) ** 0.5 n = int(n) + 1 is_primes = [True for _ in range(n)] for i in range(2, n): if is_primes[i]: for j in range(i*2, n, i): is_primes[j] = False # print(is_primes) ans = [1] for i in range(2, n): if is_primes[i]: if A % i == 0 and B % i == 0: ans.append(i) # print(ans) print(len(ans))
p02744
s500268330
Accepted
from collections import deque import sys n = int(input()) if n == 1: print('a') sys.exit() q = deque([]) q.append((1, 'a', '1')) cur = 1 while cur != n: num = len(q) j = 0 while j < num: a, b, c = q.popleft() for i in range(1, max(map(int, list(c)))+2): q.append((i, b + chr(96+i), c + str(i))) j += 1 cur += 1 for i in range(len(q)): a, b, c = q.popleft() print(b)
p02766
s094913498
Accepted
n,k = map(int,input().split()) def func_10_to_k(X, n): if (int(X/n)): return func_10_to_k(int(X/n), n)+str(X%n) return str(X%n) r = func_10_to_k(n,k) print(len(r))
p02959
s746295649
Wrong Answer
N = int(input()) A = [int(i) for i in input().split()] B = [int(i) for i in input().split()] B.append(0) ans = 0 for i in range(N+1): taosukazu1 = min(A[i],B[i]) B[i] -= taosukazu1 A[i] -= taosukazu1 ans += taosukazu1 if B[i] > 0: taosukazu2 = min(A[i+1],B[i]) B[i] -= taosukazu2 A[i] -= taosukazu2 ans += taosukazu2 print(ans)
p03437
s017972438
Accepted
X ,Y = map(int,input().split()) if X%Y !=0: print(X) else: print(-1)
p02900
s993708842
Wrong Answer
A, B = map(int, input().split()) A_k, B_k = A, B AB_max = max(A, B) yakusu = {1} for i in range(2, int(AB_max**0.5)): while A_k % i == 0 and B_k % i == 0: A_k = A_k // i B_k = B_k // i yakusu.add(i) count = len(yakusu) print(count)
p03605
s734610519
Wrong Answer
n=input() print(["No","Yes"][n[0]==9 or n[1]==9])
p03493
s632503206
Wrong Answer
import random s1 = random.randint(0,1) s2 = random.randint(0,1) s3 = random.randint(0,1) masu_list = (s1, s2, s3) print(masu_list.count(1))
p02989
s445265330
Accepted
N = int(input()) d = map(int, input().split()) d = sorted(d) if d[N // 2] == d[(N // 2) - 1]: print(0) else: print(d[N//2] - d[(N//2)-1])
p02860
s779790405
Accepted
n=int(input()) s=input() if n%2!=0: print("No") else: if s[:n//2]==s[n//2:]: print("Yes") else: print("No")
p03773
s050742491
Accepted
#ABC057.A A,B = map(int,input().split()) if A+B <24: print(A+B) else: print(A+B-24)
p03261
s972974890
Accepted
n = int(input()) s = [input()for _ in[0]*n] f = 0 for i in range(1,n): f += s[i-1][-1] != s[i][0] print("No"if f or len(set(s))<n else"Yes")
p02706
s148549560
Accepted
from sys import stdin import math import fractions n, m = [int(x) for x in stdin.readline().rstrip().split()] a = [int(x) for x in stdin.readline().rstrip().split()] count = 0 for aa in a: count += aa if n - count < 0: print(-1) else: print(n - count)
p02861
s810543981
Wrong Answer
import math n = int(input()) x = [] y = [] d = 0 for i in range(n): tmp1, tmp2 = map(int, input().split()) x.append(tmp1) y.append(tmp2) for i in range(n): for j in range(i + 1, n): print(i, j) d += math.sqrt((x[i] - x[j]) ** 2 + ((y[i] - y[j]) ** 2)) print(d*2/n)
p02601
s644164106
Wrong Answer
R, G, B = map(int, input().split()) K = int(input()) if G > 2 * R or B > 2 * G: print("Yes") else: print("No")
p02658
s600182491
Accepted
N = int(input()) #A = list(reversed(sorted(list(map(int, input().split()))))) A = sorted(list(map(int, input().split()))) assert len(A) == N mul = 1 for a in A: mul *= a # print(a, mul) if a == 0: print(0) break if mul > (10 ** 18): print(-1) break else: print(mul)
p02546
s789548496
Wrong Answer
s = input() if (s[-1:] == "s"): print(s) else: print(s + "s")
p03994
s796313083
Wrong Answer
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) s = input() k = int(input()) al = [chr(ord('a') + i) for i in range(26)] ans = '' for i in range(len(s) - 1): num = al.index(s[i]) if k + num >= 26: k -= 26 - num ans += 'a' else: ans += s[i] ans += al[(k + al.index(s[-1])) % 26] print(ans)
p02743
s960236095
Accepted
a, b, c = list(map(int, input().split())) y = (a + b - c) ** 2 - 4 * a * b condition = y < 0 if c - a - b < 0: print("No") elif 4 * a * b - (a + b - c) ** 2 < 0: print("Yes") else: print("No")
p03146
s844949688
Accepted
s = int(input()) cou = 1 tmp = 0 flag = 0 List = [s] while(flag == 0): if(cou == 1): if(s % 2 == 0): tmp = s / 2 List.append(tmp) else: tmp = 3 * s + 1 List.append(tmp) cou += 1 else: if(List.count(tmp) == 2): print(str(cou)) break if(tmp % 2 == 0): tmp = tmp / 2 List.append(tmp) else: tmp = 3 * tmp + 1 List.append(tmp) cou += 1
p03455
s178508038
Accepted
a, b = map(int, input().split()) if a * b % 2 == 0: print("Even") else: print("Odd")
p03001
s251665613
Accepted
W, H, x, y = map(int, input().split()) if (x==W/2) and (y==H/2): d = 1 else: d = 0 print(W*H/2, d)
p03161
s115011743
Accepted
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) import bisect import numpy as np N, K = map(int, input().split()) H = np.array(list(map(int, input().split()))) dp = np.ones(N)*float("inf") dp[0] = 0 dp[1] = abs(H[1] - H[0]) for i in range(2, N): start = max(0, i-K) dp[i] = np.min(dp[start:i] + abs(H[start:i] - H[i])) print(int(dp[N-1]))
p03338
s953882266
Wrong Answer
N=int(input()) S=input() max(len(set(S[:i])&set(S[i:])) for i in range(N))
p03161
s821971070
Wrong Answer
N,K=map(int,input().strip().split()) h=list(map(int,input().strip().split())) inf=100000000 dp=[inf for n in range(N)] dp[0]=0 for n in range(1,N): chmin=inf for k in range(1,K+1): if n-k>=0: chmin=min(chmin,dp[n-k]+abs(h[n]-h[n-k])) dp[n]=chmin print(dp[N-1])
p02552
s236737567
Wrong Answer
x = input() if x == 0: print("1") else: print("0")
p02859
s557925469
Accepted
r=int(input()) print(r**2)
p03565
s861438511
Accepted
s = list(input()) T = list(input()) def rplc(s, i, T): s = s[:i] + T + s[i+len(T):] return ''.join(s).replace('?', 'a') ans = 'UNRESTORABLE' for i in range(len(s)-len(T)+1): flg = True for j in range(len(T)): if s[i+j] == '?': continue if s[i+j] != T[j]: flg = False break if flg: ans = rplc(s, i , T) print(ans)
p02690
s269730269
Wrong Answer
x=int(input()) for i in range(-200,200): for j in range(-200,200): if i^5-j^5==x: print(i,j) exit()
p02778
s569261193
Accepted
A = input() B ='' for i in range(len(A)): B = B+'x' print(B)
p03379
s269507955
Accepted
n = int(input()) x = list(map(int, input().split())) y = sorted([(a, i) for i, a in enumerate(x)]) x1 = y[n // 2 - 1][0] x2 = y[n // 2][0] for i in range(n): j = y[i][1] x[j] = (x[j], i) for i in range(n): if x[i][1] < n // 2: print(x2) else: print(x1)
p02572
s695649706
Accepted
#coding: utf-8 MOD = 1000000000 + 7 N = int(input()) A = [int(x) for x in input().split()] s = sum(A) ret = 0 for a in A: s -= a ret += a * s ret %= MOD print(ret)
p02829
s136394161
Accepted
A=int(input()) B=int(input()) C=6-A-B print(C)
p02608
s243050906
Accepted
N = int(input()) cnt = [0] * 10001 for x in range(1,100): for y in range(1,100): for z in range(1,100): value = x*x + y*y + z*z + x*y + y*z + z*x if value <= 10000: cnt[value] += 1 for i in range(1,N+1): print(cnt[i])
p02753
s055372578
Wrong Answer
import sys input = sys.stdin.readline s=input().rstrip() if len(set(s))>1: print('YES') else: print('NO')
p03013
s459302031
Accepted
n,m = map(int,input().split()) a = set([int(input()) for _ in range(m)]) dp = [0]*(n+1) dp[0] = 1 for i in range(1,n+1): dp[i] = (dp[i-1]+dp[i-2])%(10**9+7) if i in a: dp[i]=0 print(dp[n])
p03695
s463047264
Accepted
N=int(input()) A=[int (x) for x in input().split()] rainbow=0 rate=[] for i in A: if (i>=3200): rainbow+=1 else: rate.append(i//400) #print(rate) cnt=len(set(rate)) print(max(1,cnt),cnt+rainbow)
p03607
s230895817
Accepted
N=int(input()) d={} for i in range(N): a=int(input()) d[a] = not(d.get(a, 0)) print(sum(d.values()))
p02663
s230741717
Wrong Answer
H1, M1, H2, M2, K = map(int, input().split()) print(max(60 * (H2 - H1) - (M2 - M1) - K, 0))
p02730
s578688587
Wrong Answer
import math s = input() n = len(s) zen_c = 0 kou_c = 0 z = math.floor((n-1)/2) k = math.floor((n+2)/2) zenhan = s[0:z] kouhan = s[k:n] zen_l = len(zenhan)-1 kou_l = len(kouhan)-1 for i in range(0, zen_l): if zenhan[i] == zenhan[zen_l-i] and i != (zen_l-i): zen_c = 1 for i in range(0, kou_l): if kouhan[i] == kouhan[kou_l-i]: kou_c = 1 print('Yes' if zen_c == 1 and kou_c == 1 else 'No')
p02621
s062633851
Accepted
# Problem A - Calc # input a = int(input()) # output print(a + a**2 + a**3)
p03219
s684838678
Accepted
a,b=map(int,input().split()) print(a+b//2)
p03795
s937911494
Accepted
n = int(input()) print(n * 800 - (n // 15) * 200)
p03324
s099497299
Accepted
D, N = map(int, input().split()) if N == 100: if D == 0: print(101) elif D == 1: print(10100) else: print(1010000) elif D == 0: print(N) elif D == 1: print(100 * N) else: print(10000 * N)
p02778
s559872497
Accepted
S = input() print('x'*len(S))
p02909
s874464185
Accepted
def main(): s = input() d = {'Sunny': 'Cloudy', 'Cloudy': 'Rainy', 'Rainy': 'Sunny'} print(d.get(s)) main()
p03481
s792467480
Accepted
X, Y = map(int, input().split()) res = 0 while X <= Y: res += 1 X *= 2 print(res)
p03698
s941029390
Wrong Answer
S = input() import collections c = collections.Counter(list(S)) ans = "yes" for i in c.values(): print(i) if i == 1: pass else: ans = "no" break print(ans)
p02548
s555528562
Wrong Answer
import math n = int(input()) ab = [] def prime(x): for i in range(1, x+1): if x % i == 0: ab.append([i, int(x/i)]) for c in range(1, n): print(c) prime(n-c) print(len(ab))
p03438
s632031055
Wrong Answer
N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) A=sorted(A) B=sorted(B) x=sum(B)-sum(A) cnt=0 for i in range(N): a=B[i]-A[i] if a>0: cnt+=(a+1)//2 else: cnt+=(-a) if x<cnt: print('No') else: print('Yes')
p03137
s904825343
Accepted
n,m = map(int, input().split()) x = list(map(int, input().split())) x.sort() if m == 1: print(0) else: u = [0] * (100000) for i in range(m-1): u[i] = x[i+1]-x[i] u.sort(reverse=True) c = 0 for i in range(n-1): c += u[i] print(sum(u)-c)
p03136
s561261647
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort() sum = 0 for i in range(n-1): sum += l[i] if l[-1] < sum: print('Yes') else: print('No')
p03456
s568639435
Wrong Answer
a,b = map(str,input().split()) ab = a + b ab1 = int(ab) for i in range(101): if i **2 == ab1: print('Yes') break elif i == 100: print('No')
p03543
s457083355
Accepted
N = input() for i in range(10): if N.count(str(i)*3): print('Yes') exit() print('No')
p04033
s335254400
Wrong Answer
def resolve(): ''' code here ''' a,b = [int(item) for item in input().split()] if a > 0: print('0Positive') else: if a <= 0 and 0 <= b: print('Zero') else: cnt = b - a + 1 if cnt % 2 == 0: print('Posivite') else: print('Negative') if __name__ == "__main__": resolve()
p03427
s687693519
Accepted
n=str(int(input())+1) print(sum(map(int,list(str(int(n[0]+'0'*(len(n)-1))-1)))))
p02789
s452225071
Accepted
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy,copy from string import ascii_lowercase, ascii_uppercase, digits from fractions import gcd def input(): return sys.stdin.readline().strip() def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) sys.setrecursionlimit(10 ** 9) INF = float('inf') mod = 10 ** 9 + 7 def main(): n, m = MAP() if n > m: print('No') else: print('Yes') if __name__=='__main__': main()
p03854
s373872699
Accepted
S=input()[::-1] W=("dream"[::-1],"dreamer"[::-1],"erase"[::-1],"eraser"[::-1]) ind=0 while ind<len(S): for w in W: if S[ind:ind+len(w)]==w: ind+=len(w) break else: print("NO") break else: print("YES")
p03486
s470327287
Accepted
try: s = input() t = input() s_ = sorted(s) t_ = sorted(t, reverse=True) print('Yes' if s_<t_ else 'No') except EOFError: pass
p02622
s022249884
Accepted
S = input() T = input() count = 0 for s, t in zip(S, T): if s != t: count += 1 print(count)
p02953
s876681553
Accepted
N = int(input()) H = list(map(int, input().split())) ans = "Yes" for i in reversed(range(1, N)): if H[i]+1 == H[i-1]: H[i-1] -= 1 elif H[i] >= H[i-1]: continue else: ans = "No" break print(ans)
p02795
s298995139
Accepted
h=int(input()) w=int(input()) n=int(input()) m=max(h,w) print(((n-1)//m)+1)
p02657
s743201725
Accepted
A, B = map(int, input().split()) print(A*B)
p03427
s775500792
Accepted
n = input() if int(n) < 10: print(int(n)) exit() flag = n[1:] != '9' * (len(n) - 1) print(int(n[0]) - flag + 9*(len(n) - 1))
p03136
s093404906
Accepted
n = int(input()) l = list(map(int, input().split())) print("Yes" if max(l) < sum(l) - max(l) else "No")