problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p04030
s317781434
Accepted
#ABC043-B s = input() result = [] for i in s: if i == '0': result.append('0') elif i == '1': result.append('1') else: if len(result) == 0: continue else: result.pop(-1) print("".join(result))
p02910
s153689118
Wrong Answer
""" abc141-b """ import sys S = input() for i in range(int(len(S))-1): if (i % 2 == 0): if (S[i] == "L"): print("No") sys.exit() else: if (S[i] == "R"): print("No") sys.exit() print("Yes")
p02953
s287038664
Accepted
N = int(input()) H = [i for i in map(int,input().split())] ok=1 for i in range(N-1,0,-1): if H[i-1] > H[i]: H[i-1] -= 1 for i in range(1,N-1): if not H[i-1] <= H[i] <= H[i+1]: ok=0 break if ok: print('Yes') else: print('No')
p04045
s186906396
Accepted
n,k=map(int,input().split()) lst=list(input()) while True: ans=True s=str(n) for i in s: if i in lst: ans=False break if ans==True: print(n) break n+=1
p03380
s740098308
Accepted
n = int(input()) a = list(map(int, input().split())) m = max(a) a = sorted(a) ans = 0 for i in a: if abs(m/2-i) < abs(m/2-ans): ans = i print(m, ans)
p04031
s576415212
Accepted
n = int(input()) a = list(map(int,input().split())) ans = -100 tmp = 10**10 for i in range(-100, 101): t = 0 for j in a: t += (j - i) ** 2 if t < tmp: ans = i tmp = t print(tmp)
p02595
s556830038
Accepted
import math n, d = map(int, input().split()) count = 0 for i in range(n): x, y = map(int, input().split()) a = math.sqrt(x**2 + y**2) if a <= d: count += 1 print(count)
p02629
s997764067
Wrong Answer
n = 123456789 m = {} for i in range(0,26): m[i] = chr(97+i) ans = '' while 1: n -= 1 x = n // 26 y = n % 26 ans = m[y] + ans n = x if n == 0: break print(ans)
p03095
s014253602
Wrong Answer
from collections import Counter n = int(input()) s = list(input()) c = Counter(s) ans = 1 for i in c.values(): ans = ans * ((i+1) % 1000000007) print(ans-1)
p02880
s987704714
Accepted
n = int(input()) k = [] for i in range(1, 10): for j in range(1, 10): if i <= j: k.append(i * j) if n in k: print('Yes') else: print('No')
p03254
s668962396
Accepted
#AGC027-A n,x = map(int,input().split()) a = list(map(int,input().split())) a.sort() cnt = 0 flg = True for i in range(n): if a[i] <= x: x -= a[i] cnt += 1 else: flg = False break if flg and x != 0: cnt -= 1 print(cnt)
p03804
s499524370
Wrong Answer
import numpy as np N, M = map(int, input().split()) As = np.array([["." for n in range(N)] for nn in range(N)]) for n in range(N): As[n,:] = np.array(list(input())) Bs = np.array([["." for n in range(M)] for nn in range(M)]) for m in range(M): Bs[m,:] = np.array(list(input())) ok = False for j in range(N-M): if (As[:M,j:j+M] == Bs).all(): ok = True break if ok: print("Yes") else: print("No")
p03645
s935786317
Accepted
n, m = list(map(int, input().split())) ab = [list(map(int, input().split())) for _ in range(m)] t = [[] for _ in range(n + 1)] for i in ab: t[i[1]].append(i[0]) flag = False for j in t[n]: if 1 in t[j]: flag = True break print("POSSIBLE") if flag else print("IMPOSSIBLE")
p03359
s175186720
Accepted
a,b = map(int,input().split()) if a>b:print(a-1) else:print(a)
p03150
s202287096
Wrong Answer
s = input() key = "keyence" ptr = 0 cnt = 0 f = True if s == key: print("YES") exit() for i in range(len(s)): if ptr != 7 and s[i] == key[ptr]: f = True ptr += 1 else: if f: cnt += 1 f = False print("YES" if ptr == 7 and cnt <= 1 else "NO")
p03785
s687338655
Accepted
N, C, K = map(int,input().split()) T = [int(input()) for i in range(N)] # print(T) T.sort() # print(T) time = T[0] people = 0 bus = 1 for i in T: people += 1 #乗客を乗せようとする if i - time > K or people > C: #乗せられないとき bus += 1 time = i people = 1 #次のバスに客iを乗せる print(bus)
p03854
s193230260
Accepted
import re print("YES" if re.match("^(dream|dreamer|erase|eraser)+$", input()) else "NO")
p02786
s143756727
Wrong Answer
H = int(input()) # INF = float('inf') # dp = [INF for i in range(H+10)] # dp[0] = 0 # dp[1] = 1 # for i in range(1, H+1): # dp[i+1] = min(dp[i+1], dp[(i+1)//2] * 2 + 1) # print(dp[H]) cnt = 0 while H > 1: cnt += 1 H //= 2 print(cnt) ans = 0 for i in range(cnt): ans += 2**i ans += 2**cnt print(ans)
p02881
s315264117
Accepted
# C - Walk on Multiplication Table N = int(input()) start = [1, 1] end = [0, 0] for i in range(1, int(N ** (1 / 2)) + 1): if N % i == 0: end[0] = i end[1] = N // i print((end[0] - start[0]) + (end[1] - start[1]))
p02761
s819645472
Wrong Answer
n,m= map(int,input().split()) Nro=[0]*n for i in range(m): s,c= map(int,input().split()) Nro[s-1]=c if (n>1) and (Nro[0]==0): print(-1) else: print(''.join(map(str, Nro)))
p03679
s161101837
Wrong Answer
X, A, B = map(int, input().split()) if X - A >= 0: print('delicious') elif A - X < 0 and B - A <= X: print('safe') else: print('dangerous')
p02995
s128575900
Accepted
def gcd(a, b): if b == 0: return a return gcd(b, a%b) a, b, c, d = map(int, input().split()) g = gcd(c, d) l = int(c*d/g) print((b - a + 1) - ((b//c - (a-1)//c) + (b//d - (a-1)//d) - (b//l - (a-1)//l)))
p03627
s127634658
Wrong Answer
from collections import Counter N = int(input()) A = list(map(int, input().split())) acnt = Counter(A) b = [k for k, v in acnt.items() if v >= 2] if len(b) < 2: print(0) else: b.sort() print(b[-1]*b[-2])
p02971
s445395822
Accepted
N=int(input()) A=[] for i in range(N): A.append(int(input())) S=sorted(A,key=int) max1=S[-1] max2=S[-2] for i in A: if i==max1: print(max2) else: print(max1)
p03721
s361381989
Accepted
N, K = map(int, input().split()) S = [list(map(int, input().split())) for _ in range(N)] from operator import itemgetter S.sort(key=itemgetter(0)) #timesは今何番目に大きいものを表しているか times=0 #indexは今のインデックス index=0 while True: hoge = times+S[index][1] if hoge < K: times += S[index][1] else: re =S[index][0] break index += 1 print(re)
p03077
s634667292
Wrong Answer
n = int(input()) ls = [int(input()) for _ in range(5)] print(ls) k = n/min(ls) if k % 1 != 0: k = int(k) + 1 else: k = int(k) print(k+4)
p03043
s835382724
Wrong Answer
import math n, k = map(int, input().split()) pro = 0 for i in range(1,n+1): x = i a = 0 while x < k: a += 1 x = x*2**a pro += (1/n) * 0.5**a print(pro)
p03612
s726469753
Accepted
N = int(input()) p = list(map(int,input().split())) ans = 0 continuous_flag= 0 for n in range(N): if p[n] == n+1: if continuous_flag == 0: ans += 1 continuous_flag = 1 else: continuous_flag = 0 else: continuous_flag = 0 print(ans)
p02707
s833264020
Accepted
n = int(input()) b = [0] * n a = list(map(int, input().split())) for i in a: b[i-1] += 1 for i in b: print(i)
p02835
s178364664
Wrong Answer
'''input 10 2 7 6 18 6 16 18 1 17 17 6 9 3 10 9 1 10 1 5 ''' # A coding delight from sys import stdin, stdout import gc gc.disable() import sys, time, threading # main starts arr = list(map(int, stdin.readline().split())) if sum(arr) >= 22: print('burst') else: print('win')
p02848
s776405301
Wrong Answer
N=int(input()) S=input() tmp="" for i in range(len(S)): chtmp=ord(S[i])+N if(chtmp>ord('Z')): chtmp-=(ord('Z') - ord('A')) tmp+=chr(chtmp) print(tmp)
p02630
s764530499
Wrong Answer
from collections import Counter n = int(input()) a = list(map(int, input().split())) A = {} for i in range(n): A = dict(Counter(A) + Counter({a[i]:1})) ans = 0 for x in A.keys(): ans += x * A[x] q = int(input()) for i in range(q): b,c = list(map(int, input().split())) if b in A.keys(): ans -= b * A[b] ans += c * A[b] A = dict(Counter(A) + Counter({c:A[b]})) A = dict(Counter(A) - Counter({b:A[b]})) print(ans)
p03545
s230013373
Accepted
s = input() n = len(s) for i in range(1,2**n): ans = [s[0]] for j in range(1,n): if (i>>j) & 1: ans.append("+") else: ans.append("-") ans.append(s[j]) if eval("".join(ans)) == 7: ans.append("=7") print("".join(ans)) exit()
p02854
s648619508
Accepted
def resolve(): N = int(input()) A = [int(i) for i in input().split()] cumsumA = [0] * (N + 1) cumsumB = [0] * (N + 1) for i in range(N): cumsumA[i + 1] = cumsumA[i] + A[i] cumsumB[N - i - 1] = cumsumB[N - i] + A[N - i - 1] minA = 10**18 for i in range(N + 1): minA = min(minA, abs(cumsumA[i] - cumsumB[i])) print(minA) resolve()
p04033
s094731064
Accepted
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline a, b = map(int, input().split()) if a<=0 and b>=0: print('Zero') exit() if a>0 and b>0: print('Positive') exit() if (b-a)%2 == 0: print('Negative') else: print('Positive')
p03471
s178416153
Wrong Answer
n,y=map(int, input().split()) for i in range(n): for j in range(n): if 10000*i+5000*j+1000*(n-i-j)==y: print(i,j,n-i-j) exit() print('-1 -1 -1')
p03835
s804580426
Accepted
k,s = map(int,input().split()) cnt = 0 for x in range(k+1): for y in range(k+1): if 0<=s - x - y <= k : cnt += 1 print(cnt)
p02833
s667700845
Wrong Answer
n = int(input()) if n % 2: print(0) else: ans = 0 i = 1 while (2 * (5 ** i)) < n: ans += n // (2 * (5 ** i)) i += 1 print(ans)
p03860
s412644590
Wrong Answer
a,b,c = input().split() print(a[0],b[0],c[0])
p02922
s953129777
Accepted
import math A,B = map(int,input().split()) print(math.ceil((B-1)/(A-1)))
p04043
s216097349
Accepted
A = list(map(int, input().split())) A.sort() if A == [5,5,7]: print("YES") else: print("NO")
p03087
s182213555
Wrong Answer
N, Q = map(int, input().split()) S = input() a = [0] * N c = [False] * N for i in range(1, N): if S[i - 1:i + 1] == "AC": a[i] = a[i - 1] + 1 a[i] = True else: a[i] = a[i - 1] for i in range(Q): l, r = map(int, input().split()) if l - 1 == 0: print(a[r - 1]) elif c[l - 1] is True: print(a[r - 1] - a[l - 1] - 1) else: print(a[r - 1] - a[l - 1])
p02832
s923827979
Accepted
N = int(input()) lis = list(map(int, input().split())) cnt = 0 if 1 not in lis: cnt = -1 else: for idx, val in enumerate(lis): if val != idx+1-cnt: cnt += 1 print(cnt)
p02918
s126818901
Accepted
n, k = map(int, input().split()) s = list(input()) lr = 0 rl = 0 ans = 0 for i in range(n-1): if s[i]=='L' and s[i+1]=='R': lr += 1 elif s[i]=='R' and s[i+1]=='L': rl += 1 else: ans += 1 if lr >= k and rl >= k: ans += 2*k elif lr == rl: ans += 2*lr else: num = max(lr, rl) ans += 2*num-1 print(ans)
p02793
s712104888
Accepted
import math mod = 1000000007 def lcm(x, y): return (x * y) // math.gcd(x, y) n=int(input()) a = list(map(int,input().split())) memo = a[0] for i in range(1,n): memo = lcm(memo,a[i]) ans = 0 for i in range(n): ans += memo*pow(a[i], mod-2, mod)%mod ans %= mod print(ans)
p02755
s219403774
Accepted
import sys a, b = map(float, sys.stdin.readline().split()) ans = -1 for i in range(1, 1251): if (int(i * 0.08) == a) and (int(i * 0.1) == b): ans = i break print(ans)
p02759
s801401225
Accepted
n=int(input()) if n%2==0: print(n//2) else: print(n//2 +1)
p02713
s619149291
Accepted
from math import gcd K = int(input()) ans = 0 for i in range(1,K+1): for j in range(1,K+1): for k in range(1,K+1): ans += gcd(i, gcd(j, k)) print(ans)
p03449
s929373460
Accepted
import numpy as np n = int(input()) a = np.array([list(map(int,input().split())) for i in range(2)]) cnt = [0] * (n) for i in range(0, n): cnt[i] = sum(a[0, :i+1]) + sum(a[1, i:]) print(max(cnt))
p03360
s476077407
Wrong Answer
# ABC096B def f(a, b, c, k): abc = sorted([a, b, c]) if k != 0: abc[2] *= 2 * k print(sum(abc)) a, b, c = map(int, input().split()) k = int(input())
p02623
s782672009
Wrong Answer
x = input().split() y = input().split() z = input().split() s = 0 for nn in range(400000): if int(x[2]) < 0: break if int(y[0]) <= int(z[0]) : x[2] = int(x[2]) - int(y[0]) del y[0] y.append(1000000001) s += 1 else: x[2] = int(x[2]) - int(z[0]) del z[0] z.append(1000000001) s += 1 print(s-1)
p03351
s704696303
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')
p03632
s042777779
Accepted
a, b, c, d = map(int, input().split()) print(0 if min(b, d)-max(a, c) < 0 else min(b, d)-max(a, c))
p03011
s175440513
Accepted
l = list(map(int, input().split())) l.sort() print(l[0] + l[1])
p03077
s044357935
Accepted
import sys import math def main(): N = int(input()) A = int(input()) B = int(input()) C = int(input()) D = int(input()) E = int(input()) print(4 + math.ceil(N / min(A, B, C, D, E))) main()
p02831
s871190093
Wrong Answer
a,b = map(int,input().split()) ansl = [] if min(a,b) == 1: print(max(a,b)) else: for i in range(1,min(a,b)//2+1): if a%i == 0 and b%i == 0: ansl.append(i) print(int(a*b/max(ansl)))
p02702
s041345960
Wrong Answer
def main(): s = input() n = len(s) num = 0 for i in range(n-1): for j in range(i+1, n): if int(s[i:j]) % 2019: num += 1 print(num) return num
p03262
s079486727
Accepted
from fractions import gcd from functools import reduce n, x = map(int, input().split()) S_in = list(map(int, input().split())) S = [abs(a-x) for a in S_in] print(reduce(gcd, S))
p03219
s097046234
Accepted
x, y = map(int, input().split()) print(x + y//2)
p03262
s962665041
Accepted
N, X = map(int, input().split()) city = list(map(int, input().split())) city.sort() distant = [abs(X - i) for i in city] def gcd(a, b): mod = 1 while (mod > 0): mod = a % b a = b b = mod return (a) gc = distant[0] for i in range(1, len(distant)): gc = gcd(gc, distant[i]) print(gc)
p02582
s279203104
Accepted
A = input() if 'RRR' in A: print(3) elif 'RR' in A: print(2) elif 'R' in A: print(1) else: print(0)
p02982
s980656277
Accepted
n,d=map(int,input().split()) A=[[0 for i in range(d)]for j in range(n)] for i in range(n): A[i]=list(map(int,input().split())) count=0 for i in range(n-1): for j in range(i+1,n): s=0 for k in range(d): s=s+(A[i][k]-A[j][k])**2 if (int(s**(1/2)))**2==s: count+=1 print(count)
p02694
s359759961
Accepted
X=int(input()) n=100 for i in range(10000): if n>=X: print(i) exit() n+=n//100
p03427
s273556856
Wrong Answer
n = list(input()) n = [int(i) for i in (n)] m = len(n) if m == 1: print(n[0]) else: flg = False for i in range(m): if n[i] != 9: flg = True break if flg: n[0] -= 1 for i in range(1,m): n[i] = 9 print(sum(n))
p02987
s765217391
Wrong Answer
ss=input().strip() d={} for s in ss: d[s]=d.get(s,0)+1 flg=False for s in ss: if d[s]!=2: flg=True print("Yes" if flg else "No")
p03951
s309982003
Accepted
n = int(input()) S = input() T = input() ans = 0 for i in range(n): if S[i:] == T[:n-i]: print(n-i+i*2) break else: print(2*n)
p03210
s394940105
Wrong Answer
X=int(input()) if X==(7 or 5 or 3): print('YES') else: print('NO')
p02552
s237889237
Wrong Answer
print(int(input())+1%2)
p02963
s555090015
Accepted
S = int(input()) Y = -(-S // (10**9)) X = -(S - (Y * (10**9))) print('0 0 {} 1 {} {}'.format(10**9, X, Y))
p03852
s799373929
Wrong Answer
c=input() if c=="a"or c=="i" or c=="u" or c=="e" or c=="o": print("vowel") exit() print("constant")
p02647
s948864240
Wrong Answer
import numpy as np N, K= map(int,input().split()) A = list(map(int,input().split())) p=0 while p<K: B=[0]*(N+1) for i in range(N): l = max(i-A[i],0) r = min(i+A[i]+1,N) B[l] +=1 B[r] -=1 A = np.cumsum(B) p +=1 if min(A[0:N-1])==N: break print(*A[0:N-1])
p03251
s843211200
Wrong Answer
N,M,X,Y = map(int,input().split()) x = list(map(int,input().split())) y = list(map(int,input().split())) x.sort() y.sort() if x[N-1] <= y[0] and X < Y and x[N-1] > X and y[0] < Y: print('No War') else: print('War')
p02706
s402428657
Accepted
# -*- coding: utf-8 -*- def main(): n, m = map(int, input().split()) a_list = list(map(int, input().split())) a_sum = sum(a_list) if n >= a_sum: print(n - a_sum) else: print(-1) if __name__ == "__main__": main()
p03796
s598955371
Wrong Answer
n=int(input()) ans = 1 S=10*9+7 for i in range(n): ans = ans * (i+1) % S print(ans)
p02909
s854475712
Accepted
s = str(input()) w = ['Sunny','Cloudy','Rainy'] print(w[( w.index(s)+1) %3] )
p02694
s818927759
Accepted
import math def main(): x=int(input()) y=100 t=0 while(True): y=math.floor(y*1.01) t+=1 if(x<=y): print(t) return 0 main()
p02689
s870767502
Accepted
n, m = map(int, input().split()) h = list(map(int,input().split())) A = [0] * n for i in range(m): a, b = map(int, input().split()) A[a - 1] = max(A[a - 1], h[b - 1]) #ある展望台とつながる別の展望台の標高の最大値を更新 A[b - 1] = max(A[b - 1], h[a - 1]) ans = 0 for i in range(n): if A[i] < h[i]: ans += 1 print(ans)
p03448
s466391565
Accepted
a = int(input()) b = int(input()) c = int(input()) x = int(input()) ans = 0 for i in range(min(a + 1, x // 500 + 1)): rest1 = x - 500 * i for j in range(min(b + 1, rest1 // 100 + 1)): rest2 = rest1 - 100 * j if 50 * c >= rest2: ans = ans + 1 print(ans)
p03835
s567609600
Accepted
K,S=map(int,input().split()) z = list(range(0,K+1)) ans = [] for i in z: s_z = S - i if s_z < 0: pass elif K < s_z: if (K + 1) > (s_z - K): ans.append(K + 1 - (s_z - K)) else: ans.append(s_z + 1) print(sum(ans))
p02714
s626617669
Wrong Answer
def inN(): return int(input()) def inL(): return list(map(int,input().split())) def inNL(n): return [list(map(int,input().split())) for i in range(n)] n = inN() s = input() r = s.count('R') b = s.count('B') g = s.count('G') #print(r,b,g,r*b*g) print(r*b*g - min(b,g)**2)
p02933
s874829791
Accepted
data1,data2 = [input() for i in range(2)] data1 = int(data1) if data1 >= 3200: print(data2) else: print('red')
p02683
s755782602
Wrong Answer
import itertools N,M,X=map(int,input().split()) ans=10**6 List=[] for _ in range(N): List.append([int(i) for i in input().split()]) for i in range(0,N): for j in itertools.combinations(range(N),i+1): tmp=[0]*(M+1) for k in j: for l in range(M+1): tmp[l]+=List[k][l] if len([m for m in tmp[1:] if m>=X])==M: ans=min(ans,tmp[0]) if ans==10**6: print(-1) else: print(ans)
p04045
s331204546
Accepted
n, k = map(int, input().split()) d = set(input().split()) while True: if not set(str(n)) & d: print(n) break else: n += 1
p03745
s898058834
Wrong Answer
def solve(): ans = 1 N = int(input()) A = list(map(int, input().split())) ud = 0 for i in range(N-1): a = A[i+1]-A[i] if a*ud<0: ans += 1 ud = 0 elif a*ud==0: ud = a return ans print(solve())
p02922
s756522292
Accepted
a,b = map(int,input().split()) count,socket = 0,1 while socket < b: socket += (a - 1) count += 1 print(count)
p04029
s494034862
Wrong Answer
n = int(input()) print((1 + n) * n / 2)
p03338
s177383583
Wrong Answer
import math def main(): n = int(input()) s = input() ans=0 print(int(n/2)+1) for i in range(0,int(n/2)+2): sum=0 x=s[:i+1] y=s[i+1:] while len(x)>0: if x[0] in y : sum+=1 x=x.replace(x[0],'') if sum>ans: ans=sum print(ans) main()
p02678
s567134063
Accepted
import queue N,M = map(int,input().split()) adj = [[]for i in range(N+1)] parent = [-1] * (N+1) for m in range(M): a,b = map(int,input().split()) adj[a].append(b) adj[b].append(a) q = queue.Queue() q.put((1,0)) # 自分、親 while(not q.empty()): x, p = q.get() if parent[x] != -1: continue parent[x] = p for next in adj[x]: if parent[next] == -1: q.put((next,x)) #print (parent) print ('Yes') for p in parent[2:]: print(p)
p02677
s346747413
Accepted
import math A, B, H, M = map(int,input().split()) timeHr = H + (M / 60) angVelA = (1/6) * 180 angVelB = (2) * 180 degA = (angVelA * timeHr) degB = (angVelB * timeHr) degDiff = math.radians(abs(degB - degA)) disX_2 = math.pow(B, 2) + math.pow(A, 2) - (2 * A * B * math.cos(degDiff)) disX = math.sqrt(disX_2) print(disX)
p03474
s845379707
Accepted
# -*- coding: utf-8 -*- a,b = map(int,input().split()) s = list(str(input())) number = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] flag = True for i in range(a): if s[i] not in number: flag = False #print("A") if s[a] != '-': flag = False #print("B") for i in range(a + 1, a + b + 1): if s[i] not in number: flag = False #print("C") if flag: print("Yes") else: print("No")
p03698
s716391613
Wrong Answer
S=input() print("Yes" if len(S)==len(set(S)) else "No")
p03043
s097655215
Wrong Answer
import numpy as np import math n, k = map(int, input().split()) t = 1/n a = 0 for i in range(1, n+1): if i < k: s = (k + i-1) // i t2 = math.ceil(np.log2(s)) print(i, t2) a += t*((1/2) ** t2) else: a += t print(a)
p02693
s322280785
Wrong Answer
k=int(input()) a,b = list(map(int,input().split())) v1 = (a+k-1)//k v2 = (b+k-1)//k if(v1<=v2): print("OK") else: print("NG")
p02699
s401558166
Accepted
# A - Sheep and Wolves s, w = map(int, input().split()) print("unsafe" if w >= s else "safe")
p03485
s142081317
Accepted
import math a,b = map(int,input().split()) print(math.ceil((a+b)/2))
p03327
s072527534
Accepted
n = int(input()) if n <= 999: print('ABC') else: print('ABD')
p03494
s738607031
Accepted
import sys Row = input() List = [int(j) for j in input().split()] for i in range(len(List)): ans = List[i] % 2 if ans == 1: print(0) sys.exit() count = 0 flg = 0 while flg == 0: count = count + 1 for j in range(len(List)): List[j] = List[j] / 2 if List[j]%2: flg = 1 break print(count)
p03637
s751959415
Accepted
n = int(input()) A = list(map(int, input().split())) count1 = 0 count2 = 0 count4 = 0 for a in A: if a % 4 == 0: count4 += 1 elif a % 2 == 0: count2 += 1 else: count1 += 1 count4 -= count1 if count2: count4 -= 1 if count4 >= -1: print('Yes') else: print('No')
p03107
s887725127
Wrong Answer
s=list(map(int,input())) count=0 k=len(s)-2 i=0 while i<=k: if s[i]!=s[i+1]: s.remove(s[i]) s.remove(s[i]) k-=2 count+=2 else: i+=1 print(count)
p03345
s494714867
Accepted
#! /usr/bin/env python3 import sys import numpy as np int1 = lambda x: int(x) - 1 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(500000) A, B, C, K = map(int, readline().split()) print(A - B) if K % 2 == 0 else print(B - A)