problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02695
s932210405
Accepted
from itertools import combinations_with_replacement n,m,q = map(int,input().split()) abcd = [list(map(int,input().split())) for _ in range(q)] result = 0 for x in combinations_with_replacement(range(1, m+1), n): t = 0 for a,b,c,d in abcd: if x[b-1] - x[a-1] == c: t += d result = max(result,t) print(result)
p02777
s250311452
Wrong Answer
s,t=(str,input().split()) a,b=(int,input().split()) u=str(input()) if s==u: print (a-1,b) elif t==u: print(a,b-1)
p03013
s305211766
Accepted
N, M = map(int, input().split()) a = list(int(input()) for i in range(M)) DP = [0]*(N+1) pointer = 0 for i in range(N+1): if pointer < M: if i == a[pointer]: DP[i] = 0 pointer += 1 continue if i == 0 or i == 1: DP[i] = 1 else: DP[i] = (DP[i-1]+DP[i-2]) print(DP[-1]%1000000007)
p03136
s642476396
Accepted
INT = lambda: int(input()) INTM = lambda: map(int,input().split()) STRM = lambda: map(str,input().split()) STR = lambda: str(input()) LIST = lambda: list(map(int,input().split())) LISTS = lambda: list(map(str,input().split())) def do(): n=INT() s=LIST() s.sort() a=s.pop(-1) if sum(s)>a: print('Yes') else: print('No') if __name__ == '__main__': do()
p02814
s265055821
Wrong Answer
from fractions import gcd from math import ceil def lcm(a): x = a[0] for i in range(1, len(a)): x = (x * a[i]) // gcd(x, a[i]) return x def solve(N, M, A): num = lcm(A) if num > M: return 0 else: return ceil(M / (num*2)) def main(): N, M = map(int, input().split()) A = list(set(int(x)//2 for x in input().split())) ans = solve(N, M, A) print(ans) if __name__ == "__main__": main()
p02811
s008216629
Wrong Answer
k,x=input().split() if 500*k>x: print('Yes') else: print('No')
p02797
s001777861
Wrong Answer
N,K,S = map(int,input().split(" ")) l = N-K ans = [S for _ in range(K)] for i in range(l): ans.append(S+1) print(*ans)
p02623
s223858063
Accepted
nums=[int(e) for e in input().split()] A=[int(e) for e in input().split()] B=[int(e) for e in input().split()] a, b = [0], [0] for i in range(nums[0]): a.append(a[i]+A[i]) for i in range(nums[1]): b.append(b[i]+B[i]) ans, j = 0, nums[1] for i in range(nums[0]+1): if a[i] > nums[2]: break while b[j] > nums[2] - a[i]: j -= 1 ans = max(ans, i+j) print(ans)
p03360
s518461386
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines a, b, c, k = map(int, read().split()) print((a+b+c)-max(a, b, c)+max(a, b, c)*2**k)
p03274
s985933983
Accepted
n, k = map(int, input().split()) x = list(map(int, input().split())) ans = float('inf') for i in range(n-k+1): l, r = x[i], x[i+k-1] if l < 0 and r < 0: ans = min(ans, max(abs(l), abs(r))) elif l <= 0 and r >= 0: ans = min(ans, min(abs(l), r)*2 + max(abs(l), r)) elif l > 0 and r > 0: ans = min(ans, max(l, r)) print(ans)
p03239
s718556065
Accepted
n,t = map(int, input().split()) y = 10**5 for i in range(n): c,x = map(int,input().split()) if x<=t: y=min(y,c) if y != 10**5: print(y) else: print("TLE")
p03105
s621190444
Wrong Answer
a,b,c= map(int,input().split()) if a*c>b :print(c) else:print(b//a)
p03524
s204481317
Accepted
''' Created on 2020/08/28 @author: harurun ''' def main(): import collections import sys pin=sys.stdin.readline pout=sys.stdout.write perr=sys.stderr.write S=pin()[:-1] a=0 b=0 c=0 for i in S: if i=="a": a+=1 elif i=="b": b+=1 else: c+=1 if max(a,b,c)-min(a,b,c)<=1: print("YES") else: print("NO") return main() #解説AC
p03323
s765579235
Accepted
x,y=map(int,input().split()) if(x<=8 and y<=8): print("Yay!") else: print(':(')
p02681
s060021333
Accepted
#A S = input() T = input() if ((len(T) - len(S)) == 1) and (S == T[0:len(S)]): print("Yes") else: print("No")
p02982
s257142724
Wrong Answer
n, d = map(int,input().split()) points = [] for i in range(n): points.append(list(map(int,input().split()))) def distance(a, b): dist = 0 for a, b in zip(a, b): dist += (a - n) ** 2 if dist == 0: return False return int(dist ** 0.5) ** 2 == dist count = 0 for pa in points: for pb in points: if distance(pa, pb): count += 1 print(count // 2)
p02676
s097934260
Wrong Answer
K = int(input()) S = input() SS = (int(len(S))) if SS-K < 0: print(S) else: print((S[:SS-K])+('.'*K))
p02778
s766552911
Wrong Answer
S=input() a=[] for i in range(len(S)): a.append('×') print(''.join(a))
p03723
s081631564
Wrong Answer
A, B, C = map(int, input().split()) cnt = 0 while A%2 == B%2 == C%2 == 0: x = (B+C)//2 y = (A+C)//2 z = (A+B)//2 A = x B = y C = z cnt += 1 if A == B == C: print(-1) else: print(cnt)
p02577
s167092887
Wrong Answer
N = input() sum = 0 for c in N: sum += int(c) sum = sum % 9 if sum % 9 == 0: ans = "yes" else: ans = "no" print(ans)
p03632
s947846494
Accepted
a,b,c,d = map(int,input().split()) print(max(0,min(b,d)-max(a,c)))
p02682
s205062552
Accepted
a,b,c,k = map(int,input().split()) ans = 0 if a >= k: ans += k print(ans) quit() else: ans += a k -= a if b >= k: print(ans) quit() else: k-=b ans += (-1*k) print(ans)
p03639
s095173197
Wrong Answer
# https://atcoder.jp/contests/arc080/tasks/arc080_a n = int(input()) nums = [int(i) for i in input().split()] fours = 0 twos = 0 odd = 0 for num in nums: if num % 4 == 0: fours += 1 elif num % 2 == 0: twos += 1 else: odd += 1 if fours + 1 >= twos + odd: print('Yes') elif fours + 1 >= odd and twos > 1: print('Yes') elif odd == 0: print('Yes') else: print('No')
p02572
s592975717
Accepted
n = int(input()) A = list(map(int, input().split())) mod = 10**9+7 count = 0 num = sum(A) % mod ans = 0 for a in A[:-1]: num = num-a ans = (ans+a*num) % mod print(ans)
p02989
s235498962
Accepted
n = int(input()) arr = list(map(int, input().split())) arr.sort() ans = arr[n//2] - arr[n//2-1] print(ans)
p03605
s213450137
Accepted
n = input() print('Yes' if '9' in n else 'No')
p02880
s697053563
Accepted
def abc144b(): n = int(input()) start = 1 end = 9 flag = False # シンプルな全探索 for i in range(start, end + 1): for j in range(start, end + 1): if n == i * j: flag = True break if flag: print('Yes') else: print('No') if __name__ == '__main__': abc144b()
p03417
s635532251
Accepted
import sys def I(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def main(): n, m = MI() if n == 2 or m == 2: print(0) sys.exit() h = max(n-2, 1) w = max(m-2, 1) print(h*w) if __name__ == '__main__': main()
p02953
s877980164
Accepted
n = int(input()) h = list(map(int,input().split())) height = h[0] q = 0 for i in h: if i < height: q = 1 break elif i > height: height = i-1 else: height = i if q == 1: print("No") else: print("Yes")
p02909
s789040110
Wrong Answer
W = ["Sunny","Cloudy","Rainy","Sunny"] print(W[W.index(input())])
p03665
s138405686
Wrong Answer
def ii():return int(input()) def iim():return map(int,input().split()) def iil():return list(map(int,input().split())) import math n,p = iim() A = iil() if n > 1: even = 0 odd = 0 for i in A: if i%2 == 0: even += 1 else: odd += 1 p0 = 2**(odd-1) print(2**even*p0) else: print(2 if A[0]%2 == p else 0)
p02862
s972751054
Accepted
x,y=map(int,input().split()) if (2*x-y)%3!=0 or (x-2*y)%3!=0: print(0) exit() a=(2*x-y)//3 b=(2*y-x)//3 if a<0 or b<0: print(0) exit() mod=10**9+7 def comb(x,y): s=1 t=1 for i in range(1,y+1): s=s*(x-i+1)%mod t=t*(i)%mod return (s*pow(t,mod-2,mod))%mod print(comb(a+b,min(a,b)))
p02640
s498531537
Accepted
X, Y = map(int, input().split()) for i in range(X+1): if i*2+(X-i)*4 == Y: print('Yes') exit(0) print('No')
p02987
s326189230
Accepted
from collections import defaultdict S = input() d = defaultdict(int) for c in S: d[c] += 1 b = True for value in d.values(): if value != 2: b = False if b: print("Yes") else: print("No")
p03838
s229272117
Accepted
x,y = map(int,input().split()) res = 10**32 #print(res) cnt = 0 for mask in range(1<<2): #print(mask) _x = x _y = y if mask & 1: _x *= -1 # 最初に反転させる cnt += 1 if mask >> 1 & 1: _y *= -1 # 最後に反転させる cnt += 1 if _x <= _y: cnt += _y-_x res = min(res,cnt) cnt = 0 print(res)
p02720
s084555958
Wrong Answer
import math K=int(input()) a=10 rr=10 if K<10: print(K) else: while K>rr: if a//10-a%10==-1: a+=9 else: a+=1 rr+=1 print(a)
p03705
s748390584
Wrong Answer
n,a,b=map(int,input().split()) if b<a: print(0) exit() if a==b: print(1) exit() n-=2 print(b*n-a*n+1)
p03077
s079211243
Wrong Answer
import math n = int(input()) m = [int(input()) for _ in range(5)] min_m = min(m) x = math.floor(n/min_m) + 5 if n == min_m: print(x-1) else: print(x)
p02719
s626497481
Accepted
N, K = map(int, input().split()) ans = N % K if N % K > abs(N%K-K): ans = abs(N%K-K) print(ans)
p03814
s924272412
Accepted
s = input() print(s.rindex("Z") - s.index("A") + 1)
p02547
s452127274
Accepted
N = int(input()) x = [0] * N y = [0] * N for i in range(N): x[i], y[i] = map(int, input().split()) ansl=[] ans=0 for i in range(N): if x[i]==y[i]: ans+=1 else: ansl.append(ans) ans=0 ansl.append(ans) if max(ansl)>=3: print('Yes') else: print('No')
p02612
s866734371
Wrong Answer
n=int(input()) print(min(n%1000,1000-n%1000))
p03624
s647570177
Accepted
import string s = list(map(str, input())) s = list(set(s)) s.sort() ans = "" arr = [] alp = list(map(str, string.ascii_lowercase)) for char in s: alp.remove(char) if len(alp) == 0: print("None") else: print(alp[0])
p03210
s777430727
Wrong Answer
x = int(input()) if x != 7 and x != 5 and x != 3: print("No") else: print("Yes")
p03720
s968225735
Accepted
N,M = map(int, input().split()) A = [map(int,input().split()) for _ in range(M)] S = [] for i in A: for j in i: S.append(j) for i in range(1,N+1): print(S.count(i))
p02647
s008800976
Accepted
from itertools import accumulate n,k = map(int,input().split()) A = list(map(int,input().split())) for _ in range(min(k,50)): c = [0]*n for i,j in enumerate(A): l = max(0,i-j) r = min(n-1,i+j) c[l] += 1 if r+1 < n: c[r+1] -= 1 A = list(accumulate(c)) print(" ".join(map(str,A)))
p02823
s582933475
Accepted
n,a,b=map(int,input().split()) if (a-b)%2==0: print(abs(a-b)//2) else: a,b=min(a,b),max(a,b) can1=(a)+((b-a)-1)//2 a,b=n-b+1,n-a+1 can2=(a)+((b-a)-1)//2 print(min(can1,can2))
p03127
s482234970
Wrong Answer
import fractions n = int(input()) a = [int(i) for i in input().split()] mn1 = min(a) a.remove(mn1) mn2 = min(a) ko = fractions.gcd(mn2,mn1) print(ko)
p03745
s711678416
Accepted
n = int(input()) a = list(map(int,input().split())) p = 0 ans = 0 for i in range(1,n): if p == 0 and a[i-1] < a[i]: p = 1 elif p == 0 and a[i-1] > a[i]: p = 2 elif p == 1 and a[i-1] > a[i]: p = 0 ans += 1 elif p == 2 and a[i-1] < a[i]: p = 0 ans += 1 print(ans+1)
p02946
s401126583
Accepted
k, x = (int(i) for i in input().split()) list_ans = [] for i in range(0, 2 * k - 1): list_ans.append(str((x + i) - (k - 1))) print(" ".join(list_ans))
p03037
s043518254
Accepted
N, M = map(int, input().split()) a = [] for i in range(M): a.append(list(map(int, input().split()))) b = [0, float("INF")] for i in range(M): b[0] = max(a[i][0], b[0]) b[1] = min(a[i][1], b[1]) if b[0] <= b[1]: print(b[1] - b[0] + 1) else: print(0)
p02759
s530078327
Accepted
N = int(input()) print(sum(divmod(N, 2)))
p02811
s136098329
Wrong Answer
# https://atcoder.jp/contests/abc150/tasks/abc150_a def read_int_n(): return list(map(int, input().split())) K, X = read_int_n() if K*500 > X: print("Yes") else: print("No")
p02571
s380623657
Wrong Answer
S = str(input()) T = str(input()) max_len = 0 for left in range(len(T)): for right in range(left, len(T)): tmp = T[left:right] tmpS = S[left:-(len(T) - right)] # print(tmp, tmpS) if tmp in tmpS: max_len = max(len(tmp), max_len) print(len(T) - max_len)
p02791
s330182921
Accepted
import numpy as np N=int(input()) P=list(map(int,input().split())) ct=0 min_p=P[0] for i in range(N): if P[i]<=min_p: min_p=P[i] ct+=1 print(ct)
p02578
s840150164
Accepted
n = int(input()) a = list(map(int, input().split())) ans = 0 cur_max=0 for x in a: if cur_max > x: ans += cur_max - x cur_max = max(cur_max, x) print(ans)
p03285
s555865719
Accepted
n = int(input()) dp = [False] * (n + 1) dp[0] = True for i in range(n-3): if dp[i]: dp[i+4] = True for i in range(n-6): if dp[i]: dp[i+7] = True if dp[n]: print('Yes') else: print('No')
p02678
s773136536
Accepted
from collections import deque import sys input = sys.stdin.readline n,m = map(int,input().split()) l = [[] for i in range(n)] for i in range(m): a,b = map(int,input().split()) l[a-1].append(b-1) l[b-1].append(a-1) visited = [-1]*n deq = deque([0]) c = 0 visited[0] = 0 while deq: cur = deq.popleft() c += 1 for i in l[cur]: if visited[i] == -1: deq.append(i) visited[i] = cur if c == n: print('Yes') for i in visited[1:]: print(i+1) else: print('No')
p03720
s034086702
Accepted
n, m = [int(x) for x in input().split()] ans = [0] * n for _ in range(m): a, b = [int(x) - 1 for x in input().split()] ans[a] += 1 ans[b] += 1 print(*ans)
p03605
s967261003
Accepted
#!/usr/bin/env python3 if "9" in input(): print("Yes") else: print("No")
p02860
s651441959
Wrong Answer
n = int(input()) s = input() if s[:len(s)//2+1] == s[len(s)//2+1:]: print('Yes') else: print('No')
p03730
s914458211
Accepted
A, B, C = map(int, input().split()) first_amari = A%B next_amari=0 i=2 while(first_amari!=next_amari): next_amari = (A*i) % B if next_amari == C: print("YES") exit() i+=1 print("NO")
p02553
s392079688
Accepted
a,b,c,d = map(int,input().split()) ans=[] for X in [a,b]: for Y in [c,d]: ans.append(X*Y) print(max(ans))
p02713
s222615404
Wrong Answer
import math k = int(input()) memo = [[[None]*k for i in range(k)] for j in range(k)] ans = 0 for p in range(k): for q in range(k): for r in range(k): a = sorted([p,q,r]) if memo[a[0]][a[1]][a[2]] == None: memo[a[0]][a[1]][a[2]] = math.gcd(p,math.gcd(q,r)) ans += memo[a[0]][a[1]][a[2]] print(ans)
p02724
s883561246
Wrong Answer
import sys sys.setrecursionlimit(10 ** 6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(input()) def MI(): return map(int, input().split()) def MI1(): return map(int1, input().split()) def LI(): return list(map(int, input().split())) def LI1(): return list(map(int1, input().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] INF = float('inf') def solve(): x = II() t = x // 500 x = x - 500 * t t2 = x % 5 # print(t, t2) print(1000*t + 5 * t2) if __name__ == '__main__': solve()
p02547
s302451202
Wrong Answer
cnt = int(input()) chain = 0 first = 0 second = 0 for i in range(cnt): nList = list(map(int, input().split())) first = nList.pop() second = nList.pop() if first == second: chain = chain + 1 else: chain = 0 if chain >= 3: print("Yes") else: print("No")
p02756
s766520103
Wrong Answer
S = input() Q = int(input()) for i in range(Q): lists = input().split() if lists[0] == "1": pass else: S = S + lists[2] print(S)
p02957
s193859709
Wrong Answer
A, B = map(int, input().split()) print((A+B)/2 if (A+B) % 2 == 0 else "IMPOSSIBLE")
p03067
s081968173
Accepted
from sys import stdin a,b,c = [int(x) for x in stdin.readline().rstrip().split()] if a < c < b or b < c < a: print("Yes") else: print("No")
p02631
s481618938
Wrong Answer
N = int(input()) A = map(int, input().split()) total = 0 for a in A: total ^= a result = [] for a in A: result.append(total ^ a) print(result)
p03469
s335858794
Accepted
s = input() print(s.replace('2017','2018'))
p03481
s268840522
Accepted
X, Y = map(int, input().split()) a = X cnt = 0 while a <= Y: a *= 2 cnt += 1 print(cnt)
p03293
s846587120
Accepted
s, t = input(), input() for i in range(len(s)): u = s[i:] + s[:i] if u == t: print("Yes") exit(0) print("No")
p02596
s707933892
Accepted
K = int(input()) if K%2==0 or K%5==0: print(-1) elif K == (1 or 7): print(1) else: mod = 7 % K mod_plus = mod i = 0 while mod != 0: i += 1 mod_plus = (mod_plus*10) % K mod = (mod + mod_plus) % K print(i+1)
p03457
s339639950
Accepted
n=int(input()) flag=True for i in range(n): t,x,y=map(int,input().split()) if x+y>t or t%2!=(x+y)%2: flag=False break print("Yes" if flag else "No")
p02958
s339232865
Accepted
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): N = int(readline()) p = [0] + list(map(int, readline().split())) cnt = 0 for i in range(N + 1): if p[i] != i: cnt += 1 if cnt <= 2: print("YES") else: print("NO") if __name__ == '__main__': main()
p03061
s349944136
Wrong Answer
n = int(input()) a = list(map(int,input().split())) left = [0]*n right = [0]*n from fractions import gcd for i in range(1,n-1): left[i] = gcd(left[i-1],a[i-1]) right[n-i-1] = gcd(right[n-i],a[n-i]) ans = 1 for i in range(n): g = gcd(left[i],right[i]) ans = max(ans,g) print(ans)
p02866
s938076684
Accepted
from sys import exit from collections import Counter mod = 998244353 n = int(input()) D = list(map(int, input().split())) m = max(D) C = Counter(D) ans = 1 if C.get(0): if C[0] != 1 or D[0] != 0: print(0) exit() else: print(0) exit() for i in range(0, m): if C.get(i + 1): ans *= (C[i] ** C[i + 1]) % mod ans %= mod else: print(0) exit() print(ans)
p03852
s280582608
Accepted
voin=["a","i","u","e","o"] s=input() if s in voin: print("vowel") else: print("consonant")
p02933
s076770019
Wrong Answer
a = int(input()) s = input if a >= 3200: print(s) else: print("red")
p03162
s175755226
Accepted
n = int(raw_input()) mat = [] for i in range(n): mat.append(map(int,raw_input().split())) dp = [0,0,0] for day in range(n): ndp = [0,0,0] data = mat[day] for i in range(3): for j in range(3): if i != j: ndp[j] = max(ndp[j], dp[i]+data[j]) dp = ndp print max(dp)
p02759
s672685005
Accepted
n = int(input()) a = n //2 b = n % 2 print(a + b)
p03943
s459732880
Accepted
s=sorted(list(map(int,input().split()))) print('Yes' if s[0]+s[1]==s[2] else 'No')
p02727
s839925005
Wrong Answer
def main(): X, Y, A, B, C = map(int, input().split()) aka_list = sorted([int(t) for t in input().split()],reverse=True)[:X] midori_list = sorted([int(t) for t in input().split()],reverse=True)[:Y] mu_list = sorted([int(t) for t in input().split()],reverse=True) j = 0 sum_list = sorted(aka_list + midori_list) for i in range(len(sum_list)): if sum_list[i] < mu_list[j]: sum_list[i] = mu_list[j] if j < C-1: j += 1 print(sum(sum_list)) main()
p03145
s817345596
Wrong Answer
l = sorted(list(map(int, input().split()))) print(l[0] * l[1] / 2)
p02753
s080048399
Accepted
s = input() if s[0] != s[1] or s[1] != s[2]: print("Yes") else: print("No")
p02771
s633606778
Accepted
n = [i for i in input().split()] n = set(n) if len(n) == 2: print("Yes") else: print("No")
p03627
s521131496
Accepted
import collections n = int(input()) a = list(map(int,input().split())) c = sorted(collections.Counter(a).items(),reverse = True) tmp = 0 ans=[] for k in c: if k[1]>=4: tmp = max(tmp,k[0]*k[0]) if k[1]>=2: ans.append(k[0]) else: continue if len(ans)>=2: print(max(ans[0]*ans[1],tmp)) else: print(tmp)
p02578
s964816774
Wrong Answer
N = int(input()) A = list(map(int, input().split())) S = 0 n = A[0] for i in A[1:]: if n < i: S += i - n n = i elif n == i: continue else: n = i print(S)
p02899
s104900722
Wrong Answer
import numpy as np from sys import stdin def main(): n = map(int,input().split()) a = list(map(int, input().split())) print(a[0]) b = np.argsort(a)+1 str_ = "" for i in b: str_ = str_ + "{:d} ".format(i) print(str_) if __name__ == "__main__": main()
p03623
s144869426
Accepted
x,a,b=map(int,input().split()) if(abs(a-x)>abs(b-x)): print('B') else: print('A')
p03254
s775402031
Accepted
n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() ans = 0 if x == sum(a): ans = n elif x > sum(a): ans = n-1 else: for i in range(n): if x - a[i] >= 0: x -= a[i] ans += 1 else: break print(ans)
p03698
s720087286
Wrong Answer
S = str(input()) cnt =0 flg = True for i in range(len(S)-1): if S[i] in S[cnt+1]: flg =False cnt+=1 if flg ==True: print("yes") else: print("no")
p02665
s296344892
Accepted
n,*a=map(int,open(0).read().split()) dp=[0]*(n+1) dp[0]=1 for i,x in enumerate(a): if dp[i]<x: print(-1) exit() if i<n: dp[i+1]=(dp[i]-x)*2 dp[-1]=a[-1] for i in range(n,0,-1): if dp[i-1]>a[i-1]+dp[i]: dp[i-1]=a[i-1]+dp[i] print(sum(dp))
p03543
s931084062
Accepted
n = input() if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]: print("Yes") else: print("No")
p03105
s798479967
Wrong Answer
A,B,C = map(int,input().split()) if B / A >= 1: if C < B / A: print(C) elif B // A < C: print(B // A) else: print(0)
p02952
s946644777
Accepted
def count(n): c = 1 while(n>=10): n = n//10 c += 1 return c s = 0 n = int(input()) x = count(n)-1 for i in range(0,x,+2): s += 9*(10**i) if (x+1) % 2: s += n-pow(10,x)+1 print(s)
p03289
s389438698
Accepted
s = input() length = len(s) cnt = 0 if s[0] != 'A': print('WA') exit() if length == 4: if s[2] == 'C': cnt = 1 else: for i in range(2, length-1): cnt += 1 if s[i] == 'C' else 0 if cnt != 1: print('WA') exit() up_cnt = 0 for c in s: if c.isupper(): up_cnt += 1 if up_cnt != 2: print('WA') exit() print('AC')
p03836
s844258908
Accepted
import sys def main(): input = sys.stdin.readline sx, sy, tx, ty = map(int, input().rstrip().split()) horiz = tx - sx vert = ty - sy first_move = "U"*vert + "R"*horiz + "D"*vert + "L"*horiz second_move_go = "L" + "U"*(vert+1) + "R"*(horiz+1) + "D" second_move_back = "R" + "D"*(vert+1)+ "L"*(horiz+1) + "U" print(first_move + second_move_go + second_move_back) if __name__ == "__main__": main()
p02548
s926590883
Wrong Answer
n = int(input()) result = 0 for i in range(n): for j in range(n): for k in range(n): if n == i * j + k: result += 1 print(result)