problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03555
s131334441
Accepted
a = input() b = input() if a[0] == b[2] and a[1] == b[1] and a[2] == b[0]: print("YES") else: print("NO")
p03131
s201244338
Accepted
K, A, B = map(int, input().split()) add = B - A c = 1 if add > 2: K -= A-1 c += A-1 c += add * (K//2) + K%2 else: c += K print(c)
p03556
s251575453
Accepted
n =int(input()) print(int(((n**(0.5))//1)**2))
p02747
s596597152
Accepted
S = input() if len(S) % 2!=0: print("No") else: for i in range(6): if "hi" * i == S: print("Yes") exit() print("No")
p04019
s025944569
Accepted
S = input() if 'N' in S: if not 'S' in S: print('No') exit() if 'S' in S: if not 'N' in S: print('No') exit() if 'E' in S: if not 'W' in S: print('No') exit() if 'W' in S: if not 'E' in S: print('No') exit() print('Yes')
p02742
s023983320
Wrong Answer
H,W = map(int,input().split()) if (H*W)%2 == 1: print(H*W//2+1) else: print(H*W//2)
p02714
s914167204
Accepted
n = int(input()) s = input() c = s.count('R') * s.count('G') * s.count('B') for i in range(n - 2): for j in range(i + 1, n - 1): k = j + (j - i) if k >= n: continue if s[i] == s[j] or s[j] == s[k] or s[k] == s[i]: continue c -= 1 print(c)
p04020
s529856171
Accepted
from itertools import* _, *a = map(int, open(0)) print(sum(sum(l)//2 for _, l in groupby(a, key=lambda x:x>0)))
p03943
s920309812
Accepted
a,b,c=map(int,input().split()) print("Yes"if a+b==c or a+c==b or a==b+c else "No")
p02946
s766400399
Wrong Answer
k, x = map(int, input().split()) for i in range(-k + 1, k): print(i, end=" ")
p03665
s336108016
Wrong Answer
N,P=map(int,input().split(' ')) A=list(map(int,input().split(' '))) for i in A: if i != 0: print(2**(N-1)) exit() if P ==0: print(2**N) else: print(0)
p03095
s121574345
Wrong Answer
import collections def main(): N = int(input()) S = input() cc = collections.Counter(S) output = 1 for k in cc.keys(): output *= (cc[k] + 1) print(output-1) return if __name__ == '__main__': main()
p02645
s010566463
Accepted
#!/usr/bin/env python3 import sys input = sys.stdin.readline def IS(cb): return cb(input().strip()) def IL(cb): return [cb(s) for s in input().strip().split()] def IR(cb, rows): return [IS(cb) for _ in range(rows)] def ILL(cb, rows): return [IL(cb) for _ in range(rows)] def solve(): S = IS(str) print(S[:3]) solve()
p03494
s530699446
Accepted
n = int(input()) a = list(map(int, input().split())) cnt = 0 while True: test = [a_%2 for a_ in a] if 1 in test: break else: cnt += 1 a = [a_/2 for a_ in a] print(cnt)
p03163
s062007769
Accepted
import numpy as np N, W = map(int, input().split()) dp = np.zeros(W+1) for i in range(N): w, v = map(int, input().split()) dp[w:] = np.maximum(dp[:-w]+v, dp[w:]) print(int(dp[-1]))
p02814
s561447783
Accepted
from functools import reduce from fractions import gcd def lcm(x, y): return x * y // gcd(x, y) N, M = map(int, input().split()) A = [int(x)//2 for x in input().split()] B = [0] * N for i in range(N): a = A[i] cnt = 0 while a % 2 == 0: cnt += 1 a //= 2 B[i] = cnt if len(set(B)) != 1: print(0) exit() c = reduce(lcm, A) if (M // c) % 2 == 0: print(M // c // 2) else: print(M // c // 2 + 1)
p03455
s534090461
Accepted
ls = input().split(" ") a = int(ls[0]) b = int(ls[1]) c = a * b if c % 2 == 1: print("Odd") else: print("Even")
p04011
s104498633
Wrong Answer
n = int(input()) k = int(input()) x = int(input()) y = int(input()) print(x*n + y*(n-k) if n > k else x*n)
p02829
s096360717
Accepted
print(6-sum(map(int, open(0).read().split())))
p02553
s727722628
Wrong Answer
a,b,c,d=map(int,input().split()) if b>0 and d>0: print(b*d) else: if b<=0 and d<=0: print(min(a,b)*min(c,d)) elif a<=0 or b<=0: print(max(a,b)*min(c,d)) else: print(min(a,b)*max(c,d))
p02843
s992132006
Wrong Answer
import math x = int(input()) mod = x%100 quo = x//100 print(mod,quo) if mod==0: print("1") elif quo>=math.ceil(mod/5): print("1") else: print("0")
p02691
s005917119
Accepted
from collections import defaultdict N = int(input()) A = list(map(int, input().split())) ans = 0 ma = defaultdict(int) for i in range(N): ans += ma[i - A[i]] ma[i + A[i]] += 1 print(ans)
p03371
s914546567
Accepted
a, b, c, x, y = map(int, input().split()) ans = 0 if a+b >= c*2: ans = min(x,y)*c*2 if x>y: if a > c*2: ans += c*2*(x-y) else: ans += a*(x-y) else: if b > c*2: ans += c*2*(y-x) else: ans += b*(y-x) else: ans = a*x+b*y print(ans)
p03705
s964356494
Accepted
N,A,B = list(map(int,input().split())) MIN = A*(N-1)+B MAX = A+B*(N-1) print(max(MAX-MIN+1,0))
p03262
s128661541
Wrong Answer
def gcd(a, b): return b if a % b == 0 else gcd(b, a % b) n, k = map(int, input().split()) a = list(map(int, input().split())) a.append(k) a.sort() d = [0] * (n) for i in range(n): d[i] = a[i + 1] - a[i] ans = d[0] for j in range(1, len(d)): ans = gcd(ans, d[i]) print(ans)
p03030
s407979638
Wrong Answer
N=int(input()) d=[input().split() for i in range(N)] name=[] for i in range(N): d[i].append(i+1) name.append(d[i][0]) Name=list(set(name)) Name.sort() d.sort() for i in range(len(Name)): li=[] for j in range(N): if Name[i]==d[j][0]: li.append([d[j][1],d[j][2]]) else: continue li.sort() Li=li[::-1] for k in range(len(li)): print(Li[k][1])
p03986
s752378377
Accepted
x = input() #tのラストとsの最初を知りたい n = len(x) a = [] for i in range(n): if x[i]=="S": a.append(x[i]) else: if len(a)!=0 and a[-1]=='S' : a.pop() else: a.append(x[i]) print(len(a))
p03799
s137853410
Wrong Answer
N, M = map(int, input().split()) res = 0 res += min(N, M//2) M -= N*2 res += M//4 print(res)
p03457
s220652228
Wrong Answer
N=int(input()) tl=[] xl=[] yl=[] al=[] bl=[] cl=[] dl=[] for i in range(N): t,x,y=map(int,input().split()) tl.append(t) xl.append(x) yl.append(y) al.append((x+y)%2) bl.append(t%2) print(x) for i in range(N): c=abs((xl[i]+yl[i])-(xl[i-1]+yl[i-1])) d=tl[i]-tl[i-1] cl.append(c) dl.append(d) if al==bl and (xl+yl)<=tl and cl<=dl: print("Yes") else : print("No")
p03448
s780368531
Accepted
A = int(input()) B = int(input()) C = int(input()) X = int(input()) ans = 0 for a_num in range(A+1): for b_num in range(B+1): for c_num in range(C+1): if (500 * a_num) + (100 * b_num) + (50 * c_num) == X: ans += 1 print(ans)
p03329
s091595424
Accepted
N=int(input()) ans=N for i in range(N+1): cnt=0 t=i while t>0: cnt+=t%6 t//=6 j=N-i while j>0: cnt+=j%9 j//=9 ans = min(ans,cnt) print(ans)
p02629
s826292897
Wrong Answer
N = int(input()) alp = "zabcdefghijklmnopqrstuvwxy" L = "" while(True): ind = int(N%26) N = (N-ind)/26 L = alp[ind] + L if (N==0): break print(L)
p04020
s408072492
Wrong Answer
n = int(input()) a = [int(input()) for _ in range(n)] ans, tmp = 0, 0 for ai in a: ans += (ai + tmp) // 2 tmp = 0 if ai == 0: tmp = (ai + tmp) % 2 print(ans)
p03474
s060666263
Accepted
A, B = map(int, input().split()) S = input().split("-") if len(S[0]) == A and len(S[1]) == B: print("Yes") else: print("No")
p02691
s864731188
Accepted
from collections import defaultdict n=int(input()) A=[int(i) for i in input().split()] d=defaultdict(int) b=[A[i] - (i+1) for i in range(n)] c=[A[i] + (i+1) for i in range(n)] l=[] ans=0 d=defaultdict(int) for i in range(1,n)[::-1]: d[c[i]]+=1 d[b[i]]+=1 ans+= d[-c[i-1]] print(ans)
p03107
s843927271
Accepted
s = input() r = 0 b = 0 for i in range(len(s)): if s[i] == '0': r += 1 else: b += 1 if r > b: print(b*2) else: print(r*2)
p02690
s949059753
Accepted
from bisect import bisect_right import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): x = int(readline()) for a in range(-120, 120): for b in range(-120, 120): if a**5 - b**5 == x: print(a, b) exit() if __name__ == "__main__": main()
p03544
s200857989
Accepted
n = int(input()) luca = [2, 1] for i in range(n-1): luca.append(luca[-2] + luca[-1]) ans = luca[-1] print(ans)
p03252
s776343729
Wrong Answer
s=input() t=input() s=sorted(s) t=sorted(t) if (s==t): print("Yes") else: print("No")
p03474
s555254600
Accepted
a,b = map(int,input().split()) s = input() for i in range(a): if s[i] == '-': print('No') exit(0) if s[a] != '-': print('No') exit(0) for i in range(a+1,a+b): if s[i] == '-': print('No') exit(0) print('Yes')
p02768
s472938040
Accepted
def cmb(n, r, mod): c=1 for i in range(1, r+1): c = (c * (n-i+1) * pow(i, mod-2, mod)) % mod return c n, a, b = map(int, input().split()) MOD = 10**9 + 7 print((pow(2, n, MOD) - cmb(n, a, MOD) - cmb(n, b, MOD) - 1) % MOD)
p02843
s692247578
Accepted
X = int(input()) dp = [0]*(X+1) dp[0] = 1 for i in range(100, X+1): dp[i] = dp[i-100] or dp[i-101] or dp[i-102] or dp[i-103] or dp[i-104] or dp[i-105] print(dp[X])
p03730
s681604633
Wrong Answer
import sys A,B,C = map(int,input().split()) ln = 100//A+1 for i in range(1,ln+1): if (A*i-C)% B == 0: print('YES') sys.exit() print('NO')
p03862
s285469590
Wrong Answer
N, x = map(int, input().split()) a=list(map(int, input().split())) count=0 for i in range(1, N): if a[i]+a[i-1] > x: count += min(a[i] + a[i - 1] - x, a[i]) a[i]=max(0, x-a[i-1]) if a[0]+a[1] > x: count+=a[0]-x a[0]=x print(a) print(count)
p02916
s261341190
Accepted
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split()))+[0] ans=0 bn,ba=0,0 for i in a: ans+=b[i-1] if bn+1==i: ans+=ba bn=i ba=c[i-1] print(ans)
p02848
s573147368
Accepted
#!/usr/bin/env python3 def main(): N, S = map(str, open(0).read().split()) N = int(N) S_rep = [] for i in range(0, len(S)): n = ord(list(S)[i]) if (n + N < 91): S_rep.append(chr(n + N)) else: S_rep.append(chr(n + N + 6)) S_rep = ''.join(S_rep) print(S_rep.upper()) main()
p02663
s521056139
Accepted
h1, m1, h2, m2, k = [int(x) for x in input().split()] ans = (h2 * 60 + m2) - (h1*60 + m1) - k print(max(0, ans))
p03767
s941979869
Accepted
def main(): N = int(input()) A = [int(a) for a in input().split()] A.sort(reverse=True) ans = 0 for i in range(1, 2*N, 2): ans += A[i] print(ans) if __name__ == "__main__": main()
p02989
s463765975
Accepted
N = int(input()) d = list(map(int,input().split())) d_sorted = sorted(d, reverse = False) count = d_sorted[(N-1) //2 + 1] - d_sorted[(N-1) // 2] print(count)
p03695
s303610885
Accepted
def main(): n = int(input()) a = [int(x) for x in input().split()] colors = [0] * 9 for aa in a: index = -1 for i in range(8): if 400 * i <= aa < 400 * (i + 1): index = i colors[index] += 1 answer = 0 for i in range(8): if colors[i] > 0: answer += 1 print(max(answer, 1), answer + colors[-1]) if __name__ == '__main__': main()
p02814
s322089297
Wrong Answer
from fractions import gcd def lcm(a, b): return a * b // gcd(a, b) N, M = map(int, input().split()) A = list(map(int, input().split())) A = list(set(A)) t = 1 for a in A: t = lcm(t, a) if t // 2 > M: print(0) else: print((M - t // 2) // t + 1)
p03448
s337451775
Accepted
A = int(input()) B = int(input()) C = int(input()) X = int(input()) ans = 0 for a in range(A+1): for b in range(B+1): for c in range(C+1): if 500*a + 100*b + 50*c == X : ans += 1 print(ans)
p03329
s782291826
Accepted
import sys N = int(input()) # n 円を引き出すための最小の引き出し回数 table = [i for i in range(0, N + 1)] # 1円ずつ引き出した場合 for base in (6, 9): unit = base # 引き出し単位 while unit <= N: for i in range(unit, N + 1): table[i] = min( table[i], table[i - unit] + 1 ) unit *= base print(table[N])
p03680
s604655206
Accepted
n = int(input()) as_ = [int(input()) - 1 for _ in range(n)] visited = [0] * n index = 0 num_push = 0 goal = False while True: if visited[index] == 1: break visited[index] = 1 if index == 1: goal = True break index = as_[index] num_push += 1 if goal: print(num_push) else: print(-1)
p03659
s200156752
Wrong Answer
def splittingplie(n , a): ans = 10**18 allsum = int(sum(a)) asum = 0 for i in range(n): asum += a[i] b = allsum - asum rldifference = abs(asum - b) ans = min(ans , rldifference) return ans def main(): n = int(input()) a = list(map(int , input().split())) print(splittingplie(n , a)) if __name__ == '__main__': main()
p03126
s702289897
Accepted
n , m = map(int, input().split()) e = 0 d = [] for i in range(1, n + 1): l = list(map(int, input().split())) for a in range(l[0]): b = l[a + 1] d.append(b) for j in range(1, m + 1): c = 0 for k in d: if k == j: c += 1 if c == n: e += 1 print(e)
p02832
s960538082
Wrong Answer
N=int(input()) A=list(map(int,input().split())) x,cnt=1,0 for i in range(N): if A[i]==x: x+=1 else: cnt+=1 print(cnt if cnt>=0 else -1)
p03962
s166552783
Accepted
a=input().split() a.sort() cnt=0 while len(a)>0: i=a.count(a.pop(0)) for j in range(i): a.pop(0) cnt+=1 print(cnt)
p03386
s150122393
Wrong Answer
A, B, K = map(int, input().split()) for i in range(min(K, B - A)): print(A + i) if abs(A - B) >= 2 * K: for j in reversed(range(min(K, B - A))): print(B - j) else: for j in reversed(range(min(K-1, B - A))): print(B - j)
p02623
s411646641
Wrong Answer
N,M,K=map(int,input().split()) A=[0]+list(map(int,input().split())) B=[0]+list(map(int,input().split())) for i in range(N): A[i+1]+=A[i] for i in range(M): B[i+1]+=B[i] idx=N ans=0 for i in range(N): if A[i]>K: idx=i-1 break idx2=0 for i in range(idx,-1,-1): while idx2<M and A[idx]+B[idx2+1]<=K: idx2+=1 ans=max(ans,i+idx2) print(ans)
p03592
s657659411
Accepted
N, M, K = map(int, input().split()) flag = False for j in range(M + 1): for i in range(N + 1): # t = i * j + (N - i) * (M - j) # area = M * N - t area = (M - j) * i + (N - i) * j if area == K: flag = True if flag: print('Yes') else: print("No")
p03136
s018072920
Wrong Answer
N = int(input()) li = list(map(int, input().split())) li.sort() sum = 0 for i in li[:-2]: sum = i + sum Nmax = li[-1] if N <= 2 or li[0] < 1: print("No") elif Nmax < sum and 0 < Nmax: print("Yes") else: print("No")
p03243
s625868139
Wrong Answer
n = list(input()) a = int(''.join(n)) b = [] b.append(int(n[0])) b.append(int(n[1])) b.append(int(n[2])) b = sorted(b) if a % 111 == 0: print(a) else: if int(n[0]) <= b[1]: print(b[1] * 111) elif b[1] < int(n[0]) <= b[2]: print(b[2] * 111)
p04030
s234633323
Wrong Answer
# -*- coding : utf-8 -*- S = str(input()) w = "" for i in range(len(S)): if S[i] == "B": if w == "": w = "" else : w = w.rstrip() else: w = w + S[i] print(w)
p02916
s989530519
Accepted
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) ans=0 for i in range(n-1): if a[i+1]-a[i]==1: ans=ans+c[a[i]-1] print(sum(b)+ans)
p02748
s548940837
Wrong Answer
a=input() a1=input() a2=input() a=a.split() a1=a1.split(" ") a1=sorted(list(map(int,a1))) a2=a2.split() a2=sorted(list(map(int,a2))) l=[] v=a1[0]+a2[0] l.append(v) for i in range(int(a[2])): dis=input() dis=dis.split() dis=list(map(int,dis)) c=a1[dis[0]-1]+a2[dis[1]-1]-dis[2] l.append(c) l1=sorted(set(l)) print(l1[0])
p02678
s702312823
Accepted
N,M = map(int,input().split()) V = [[] for _ in range(N)] for _ in range(M): a,b = map(int,input().split()) a = a-1 b = b-1 V[a].append(b) V[b].append(a) from collections import deque q = deque([0]) ans = [-1]*N ans[0] = 0 while q: v = q.popleft() for nv in V[v]: if ans[nv] == -1: ans[nv] = v + 1 q.append(nv) print("Yes") print(*ans[1:],sep="\n")
p02664
s442407215
Wrong Answer
s = list(input()) n = len(s) if n == 1: print("D") elif n == 2: print("DP") else: for i in range(1,n-1): if s[i] == '?' and s[i+1] == 'D': s[i] = 'P' for i in range(n): if s[i] == '?': s[i] = 'D' print(''.join(s))
p02909
s819783552
Accepted
s = input() if s == "Sunny": print("Cloudy") elif s == "Cloudy": print("Rainy") elif s == "Rainy": print("Sunny")
p02708
s202333184
Accepted
n, k = map(int,input().split()) ans = 0 for select in range(k, n + 2): min_ = select * (select - 1) / 2 max_ = select * (2 * n - select + 1) / 2 ans += (max_ - min_ + 1) print(int(ans % (10**9 + 7)))
p02705
s730468603
Accepted
def resolve(): r = int(input()) print(2 * r * 3.14159265358) resolve()
p02595
s875051940
Accepted
import bisect,collections,copy,heapq,itertools,math,string import sys def S(): return sys.stdin.readline().rstrip() def M(): return map(int,sys.stdin.readline().rstrip().split()) def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) n, d = M() ans = 0 for _ in range(n): x, y = M() if x**2 + y**2 <= d**2: ans += 1 print(ans)
p02663
s057664724
Wrong Answer
h1, m1, h2, m2, k = map(int, input().split()) time = (h2 - h1) * 60 + (m2 - m1) - 1 import math print(math.floor(time // k) * k)
p02706
s877892698
Wrong Answer
import numpy as np N,M=map(int,input().split()) p=list(map(int,input().split())) if np.sum(p)>M: print(-1) else: print(N-np.sum(p))
p02818
s289487682
Accepted
a, b, k = map(int, input().split()) if k - a <= 0: a -= k elif b - (k-a) >= 0: b -= (k-a) a = 0 else: a = 0 b = 0 print(a,b)
p02995
s641331068
Accepted
a,b,c,d = map(int,input().split()) all_val = b-a+1 import fractions def lcm(x, y): return (x * y) // fractions.gcd(x, y) if a%c == 0: c_val = b//c-a//c+1 else: c_val = b//c-a//c if a%d == 0: d_val = b//d-a//d+1 else: d_val = b//d-a//d if a%lcm(c,d) == 0: lcm_val = b//lcm(d,c)-a//lcm(d,c)+1 else: lcm_val = b//lcm(d,c)-a//lcm(d,c) print(all_val-c_val-d_val+lcm_val)
p03073
s874237924
Wrong Answer
s = list(map(int,input())) n = int(len(s)/2) a = [0]*len(s) b = [0]*len(s) for i in range(n): a[2*i] = 0 a[2*i+1] = 1 b[2*i] = 1 b[2*i+1] = 0 if len(s)%2 ==1: a[len(s)-1] = 0 b[len(s)-1] = 1 print(a) print(b) an = 0 bn = 0 for j in range(len(s)): if a[j] != s[j]: an += 1 if b[j] != s[j]: bn += 1 print(min(an, bn))
p03163
s969658965
Accepted
MAX_N = 110 MAX_W = 10 ** 5 + 100 N, W = map(int, input().split()) w = [0] * MAX_N v = [0] * MAX_N for i in range(N): w[i], v[i] = map(int, input().split()) dp = [[0] * (W + 1) for _ in range(N + 1)] for i in range(N): for sum_w in range(W + 1): if sum_w - w[i] >= 0: dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - w[i]] + v[i]) dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w]) print(dp[N][W])
p03524
s515169925
Accepted
import collections s=input() s=list(s) c = collections.Counter(s) score_sorted = sorted(c.items(), key=lambda x:-x[1]) val = [] for i, j in score_sorted: val.append(j) if len(val) == 2: val.append(0) elif len(val) == 1: val.append(0) val.append(0) val.sort() if 0<= val[2]-val[0] <=1: print('YES') else: print('NO')
p02642
s610499915
Accepted
n,*a=map(int,open(0).read().split()) a.sort() b=[0]*(10**6+1) for i in a: b[i]+=1 if b[i]==1: for j in range(2*i,10**6+1,i): b[j]+=100 print(b.count(1))
p02873
s965557950
Wrong Answer
def main(): from itertools import groupby s = list(input()) f = 0 ans = 0 for k,v in groupby(s): d = len(tuple(v)) left = d if k==">" else 0 right = d if k=="<" else 0 ans += -1*f*(f<left) + d*(d+1)//2 -left*(f>left) f = right print(ans) if __name__ == '__main__': main()
p03407
s489593204
Accepted
a, b, c = map(int, input().split()) ans = "Yes" if a + b >= c else "No" print(ans)
p03681
s393869328
Accepted
MOD = 10**9 + 7 n, m = map(int, input().split()) if abs(n - m) > 1: ans = 0 else: ans = 1 for i in range(1, n+1): ans *= i ans %= MOD for i in range(1, m+1): ans *= i ans %= MOD if n == m: ans *= 2 ans %= MOD print(ans)
p02711
s761265411
Accepted
n = list(input()) if "7" in n: print("Yes") else: print("No")
p03773
s896386483
Accepted
A,B = map(int,input().split()) print(A+B-24 if A+B>=24 else A+B)
p03795
s930752323
Wrong Answer
n = int(input()) if n >= 15: print(800 * n - (200 * n // 15)) else: print(800 * n )
p03699
s476332969
Wrong Answer
n = int(input()) s = sorted([int(input()) for _ in range(n)]) print(sum(s))
p02880
s052744271
Wrong Answer
A = int(input()) ans = min([A//i for i in range(2,10) if A%i == 0], default = 0) print("Yes") if 1<=ans<=9 else print("No")
p02778
s461414160
Wrong Answer
S = input() leng = len(S) ans = '' for n in range(leng): ans += '*' print(ans)
p03328
s192406774
Wrong Answer
a, b = map(int, input().split()) n = 1 A = n//2 * (n+1) def snow(x): n = 1 while n / 2 * (n + 1) < x: n += 1 return round(n / 2 * (n + 1)) - x while snow(b+snow(a)) != 0: a += 1 print(snow(a))
p02723
s175520582
Accepted
a=input(); if a[3]==a[2] and a[5]==a[4]: print("Yes"); else: print("No")
p02909
s107338988
Wrong Answer
#!/usr/bin/env python3 #%% for atcoder uniittest use import sys input= lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**9) def pin(type=int):return map(type,input().split()) def tupin(t=int):return tuple(pin(t)) def lispin(t=int):return list(pin(t)) #%%code def resolve(): S=input() W=["Sunny","Cloudy","Rainy"] if S==S[0]:print(W[1]) elif S==S[1]:print(W[2]) else: print(W[-1]) #%%submit! resolve()
p03377
s700071639
Wrong Answer
A, B, X = map(int, input().split()) if 0 < X - A <= B: print("YES") else: print("NO")
p02989
s250784057
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 問題:https://atcoder.jp/contests/abc126/tasks/abc132_c n = int(input()) d = list(map(int, input().strip().split())) d = sorted(d) res = d[n//2] - d[n//2-1] print(res)
p03524
s720144416
Wrong Answer
S = input().strip() C = {"a":0,"b":0,"c":0} for i in range(len(S)): C[S[i]] += 1 x = min(C["a"],C["b"],C["c"]) C["a"] -= x C["b"] -= x C["c"] -= x if C["a"]+C["b"]+C["c"]==1 or C["a"]==C["b"]+C["c"] or C["b"]==C["a"]+C["c"] or C["c"]==C["a"]+C["b"]: print("YES") else: print("NO")
p02836
s104920577
Accepted
#!/usr/bin/env python3 def solve(S: str): return sum([a != b for a, b in zip(S, reversed(S))]) // 2 def main(): S = input().strip() answer = solve(S) print(answer) if __name__ == "__main__": main()
p02831
s187077802
Accepted
from fractions import gcd a, b = [int(i) for i in input().split()] print(int((a*b)/gcd(a,b)))
p02622
s035103236
Accepted
S = list(input()) T = list(input()) ans = 0 for i in range(len(S)): if S[i] != T[i]: ans += 1 print(ans)
p02725
s048885311
Wrong Answer
syu,n=map(int,input().split()) a=[int(i) for i in input().split()] clock=a[n-1]-a[0] han_clock=(a[n-2]-a[1])+(a[0]+syu-a[n-1]) print(min(clock,han_clock))
p02933
s510403985
Accepted
a=int(input()) s=input() if a>=3200: print(s) else: print('red')