problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03617
s475711697
Accepted
q,h,s,d = map(int, input().split()) n = int(input()) # print(min(q*8,h*4,s*2,d),min(q*8,h*4,s*2)) print((n//2 * min(q*8,h*4,s*2,d)) + (n%2 * min(q*4,h*2,s)))
p02754
s751103131
Accepted
#!/usr/bin/env python3 n, a, b = map(int, input().split()) print(n//(a+b)*a + min(n-(n//(a+b)*(a+b)), a))
p03797
s075947886
Accepted
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections MOD = 10**9 + 7 n,m = map(int,input().split()) scc = min(n,m//2) n -= scc m -= scc*2 print(scc + m//4)
p03623
s150579013
Accepted
# coding: utf-8 # Your code here! x,a,b=map(int,input().split()) if abs(x-a)>abs(x-b): print('B') else: print('A')
p03448
s852988026
Accepted
l = [int(input()) for i in range(3)] p = int(input()) ans = 0 for i in range(l[0]+1): for j in range(l[1]+1): for k in range(l[2]+1): if 500*i+100*j+50*k==p: ans += 1 print(ans)
p02973
s788832222
Wrong Answer
N = int(input()) A = [int(input()) for _ in range(N)] ans = 0 m = 10**10 for i in range(N): if m >= A[i]: m = A[i] ans += 1 print(ans)
p03696
s473396915
Accepted
N=int(input()) S=list(input()) count=0 LR=[0,0] for i in range(N): if S[i]=="(": count+=1 else: if count==0: LR[0]+=1 continue count-=1 LR[1]=count for i in range(2): for j in range(LR[i]): if i==0: S.insert(0,"(") else: S.append(")") print("".join(S))
p02911
s574186407
Wrong Answer
#C #入力 N,K,Q=map(int,input().split()) A=[int(input())-1 for i in range(Q)] #処理 B=[0 for i in range(N)] for i in A: B[i]+=1 print(B) for i in B: if Q-i<K: print("Yes") else: print("No")
p02572
s016744114
Accepted
import numpy as np N = int(input()) A = list(map(int ,input().split())) sum=0 ans=0 for i in range (0,N-1): sum=sum+A[i] sum=sum%(1000000000+7) ans=ans+sum*A[i+1] ans=ans%(1000000000+7) print(ans)
p03779
s391665584
Accepted
x = int(input()) cou = 1 kyo = 0 while True: kyo += cou if kyo >= x: print(cou) exit() cou += 1
p02622
s018783271
Wrong Answer
S = input() T = input() c = 0 for s in S: for t in T: if s != t: c += 1 print(c)
p03360
s678125872
Accepted
A = list(map(int,input().split())) K = int(input()) for _ in range(K): A[A.index(max(A))]*=2 print(sum(A))
p03319
s477123429
Accepted
n,k = map(int,input().split()) a = [int(i) for i in input().split()] ans = (n-1)//(k-1) if ans == (n-1)/(k-1): print(ans) else: print(ans+1)
p03437
s309901251
Accepted
x,y=map(int,input().split()) if x%y: print(x*(y-1)) else: print(-1)
p02918
s609217051
Wrong Answer
n,k=map(int,input().split()) s=input() p2=0 p1=0 if n==1: print(1) exit() if s[0]=="L": p1+=1 if s[n-1]=="R": p1+=1 for i in range(1,n): if not (s[i]=="L" and s[i-1]=="R"): continue p2+=1 if k<=p2-1: print(n-2*p2-p1+2*k) elif p2<k<p2+p1: print(n-p1+(k-p2)) else: print(n-1)
p02862
s806283841
Accepted
from functools import reduce def combination2(n, r, MOD=10**9+7): if not 0 <= r <= n: return 0 r = min(r, n - r) numerator = reduce(lambda x, y: x * y % MOD, range(n, n - r, -1), 1) denominator = reduce(lambda x, y: x * y % MOD, range(1, r + 1), 1) return numerator * pow(denominator, MOD - 2, MOD) % MOD X, Y = map(int, input().split()) if (2*X-Y)%3 or (2*Y-X)%3: print(0) exit() x, y = (2*X-Y)//3, (2*Y-X)//3 print(combination2(x+y,x))
p04033
s045634684
Wrong Answer
a = list(map(int, input().split())) s = 1 for i in a: s *= i print("Positive" if s > 0 else "Negative" if s < 0 else 0)
p03146
s380233136
Accepted
s = int(input()) a = {s} b = s for i in range(2,1000001): if b%2==0: b //= 2 else: b = 3*b+1 if b in a: print(i) exit() else: a.add(b)
p02594
s105902923
Accepted
x = int(input()) if x >= 30: print("Yes") else: print("No")
p03385
s164270889
Wrong Answer
S = str,input() if S == "abc": print("Yes") else: print("No")
p02747
s917906487
Accepted
s = input() ans = True if len(s)%2 == 0 else False for i in range(len(s)//2): if i%2 == 1: continue if s[i:i+2] != "hi": ans = False print("Yes" if ans else "No")
p03493
s146106488
Accepted
s = input() count = 0 for i in range(len(s)) : if int(s[i]) == 1 : count += 1 print (count)
p02995
s695693831
Accepted
from fractions import gcd A, B, C, D = map(int, input().split()) num1 = B // C - (A-1) // C num2 = B // D - (A-1) // D gcdCD = C * D // gcd(C, D) num3 = B // gcdCD - (A-1) // gcdCD print(B - A - num1 - num2 + num3 + 1)
p03127
s537021353
Wrong Answer
N = int(input()) A = list(map(int, input().split())) A.sort() ans = A[0] while A[0] > 0: ans = A[0] for i in range(1,N): A[i] -= A[0] A.sort() print(ans)
p02819
s509113559
Accepted
import math as mt s = int(input()) def check(x): a = [i for i in range(2,int(mt.sqrt(x))+1,1)] if all([x%j != 0 for j in a]): return False else: return True f = True while f: f = check(s) s+=1 print(s-1)
p02647
s826087221
Accepted
from itertools import accumulate n,k,*a=map(int,open(0).read().split()) for _ in range(k): b=[0]*n for i in range(n): b[max(0,i-a[i])]+=1 if i+a[i]+1<n:b[i+a[i]+1]-=1 a=list(accumulate(b)) if a==[n]*n:break print(" ".join(map(str,a)))
p02707
s271467875
Wrong Answer
a=int(input()) b=list(map(int,input().split())) for i in range(len(b)): print(b.count(b[i])) print(0)
p02697
s033982350
Accepted
N,M = map(int, input().split()) ans = [] if N%2==1: for i in range(2,N//2+2): ans.append((i,N+2-i)) else: l = 2 r = N while r-l>N//2: ans.append((l,r)) l += 1 r -= 1 l += 1 while r>l: ans.append((l,r)) l += 1 r -= 1 for i in range(M): print(*ans[i])
p03607
s051624043
Accepted
S = set() for _ in range(int(input())): a = int(input()) if a in S: S.remove(a) else: S.add(a) print(len(S))
p03427
s439971876
Wrong Answer
N = int(input()) a = 0 b = 0 while N > 0: if N <= 10: c, N = N, 0 break elif N % 10 != 9: b = 1 N //= 10 a += 1 if b == 1: c -= 1 ans = c + a * 9 print(ans)
p03061
s305436206
Accepted
from fractions import gcd n = int(input()) a = [int(i) for i in input().split()] gcd_to = [0] + a[:] gcd_from = a[:] + [0] for i in range(1, n+1): gcd_to[i] = gcd(gcd_to[i-1], gcd_to[i]) gcd_from[n-i] = gcd(gcd_from[n-i+1], a[n-i]) gcd_exclude = [] for i in range(n): gcd_exclude.append(gcd(gcd_to[i], gcd_from[i+1])) print(max(gcd_exclude))
p02957
s759116476
Accepted
arr = list(map(int, input().split())) a, b = arr[0], arr[1] if (a+b)%2 == 0: print(int((a+b)/2)) else: print("IMPOSSIBLE")
p02946
s479977839
Accepted
k, x = map(int, input().split()) b = [x - k + 1] if k > 1: for i in range(x - k + 2, x + k): b.append(i) print(" ".join(map(str, b)))
p03699
s671863330
Accepted
# C - Bugged N = int(input()) S = [int(input()) for _ in range(N)] S = sorted(S) ans = sum(S) if ans % 10 != 0: pass else: for i in range(N): if S[i] % 10 != 0: ans = ans - S[i] break else: ans = 0 print(ans)
p03471
s002711100
Wrong Answer
import sys N,Y = map(int, input().split()) for x in range(N+1): for y in range(N+1): z = Y - (10000*x+y*5000) z = z // 1000 if z>=0: print(x,y,z) sys.exit() print(-1,-1,-1)
p02971
s950685369
Accepted
n = int(input()) a = [0] * n for i in range(n): a[i] = int(input()) mx=max(a) for i in range(n): if a[i] == mx: mx_index = i break a.sort() for i in range(n): print(a[n-2] if i == mx_index else a[n-1])
p02879
s352979831
Wrong Answer
a, b = map(int, input().split()) if 1 <= a <= b <= 9: print(a*b) else: print(-1)
p03160
s471057810
Accepted
N=110000 dp=[0]*N n=int(input()) h=list(map(int,input().split())) now=[0,0,0] for i in range(1,n): if i==1: dp[i]=dp[i-1]+abs(h[i]-h[i-1]) else: now=[i,i-1,i-2] dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2])) print(dp[n-1])
p03221
s436730922
Accepted
n,m = map(int,input().split()) array = [] for i in range(m): p,y = map(int,input().split()) array.append((p,y,i)) array.sort() ans = [] last_p = -1 index = 1 for i in range(m): p,y,j = array[i] if p != last_p: index = 1 number = str(p).zfill(6) + str(index).zfill(6) ans.append((j,number)) last_p = p index += 1 for t in sorted(ans): print(t[1])
p02761
s757655270
Accepted
N, M = map(int,input().split()) S = "0" * N for i in range(M): s,c = map(int,input().split()) if s == 1 and c == 0 and N != 1: print("-1") quit() elif S[s-1] == "0" or S[s-1] == str(c): S = S[0:s-1] + str(c) + S[s:] else: print("-1") quit() if S[0] == "0" and N != 1: S = "1" + S[1:] print(S)
p03994
s494695422
Wrong Answer
alphabet = 'abcdefghijklmnopqrstuvwxyz' s = input() K = int(input()) ans = '' for i in range(len(s) - 1): s_i = alphabet.index(s[i]) if (26 - s_i < K) & (s_i != 0): K -= 26 - s_i s_i = 0 ans += alphabet[s_i] s_i = (alphabet.index(s[-1]) + K) % 26 ans += alphabet[s_i] print(ans)
p02760
s442603387
Accepted
*t,=map(int,open(0).read().split()) a=t[:9] s={10} for b in t[10:]: if b in a:s|={a.index(b)} print('NYoe s'[any(s>={i*3,i*3+1,i*3+2}or s>={i,i+3,i+6}for i in(0,1,2))or s>={0,4,8}or s>={2,4,6}::2])
p03545
s332508879
Accepted
A=list(input()) b=[] for i in range(2**3): b.clear() for j in range(3): if (i>>j)&1: b.append("+") else: b.append("-") c=eval(A[0]+b[0]+A[1]+b[1]+A[2]+b[2]+A[3]) if c==7: print(A[0]+b[0]+A[1]+b[1]+A[2]+b[2]+A[3]+"=7") exit()
p03637
s494303143
Accepted
n = int(input()) *a, = map(int, input().split()) *b, = filter(lambda x: x%4 != 0, a) mul_4 = n-len(b) *c, = filter(lambda x: x%2 != 0, b) mul_2 = (len(b)-len(c))//2 print("Yes" if n//2 <= mul_4+mul_2 else "No")
p02793
s013083902
Accepted
n = int(input()) arr = list(map(int,input().split())) N = pow(10,9)+7 def gcd(a,b): if a==0:return b return gcd(b%a,a) def lcm(a,b): tmp = (a*b)//gcd(a,b) return tmp hcm = arr[0] for i in range(1,n): hcm = lcm(hcm,arr[i]) res = 0 for num in arr: res += (hcm//num) print(res%N)
p03371
s025815800
Wrong Answer
[a,b,c,x,y] = [int(i) for i in input().split()] ans = a * x + b * y cnt = 1 while x != 0 or y != 0: x = max(x - 1, 0) y = max(y - 1, 0) ans = min(ans,a*x+b*y+c*2*cnt) cnt += 1 print(ans)
p02695
s501618684
Wrong Answer
N, M, Q = map(int, input().split()) ABCD = [list(map(int, input().split())) for i in range(Q)] ABCD.sort(key=lambda x: x[3]) A = [1 for _ in range(N)] for i in range(Q): if not(A[ABCD[i][0]-1] + ABCD[i][2] > M): A[ABCD[i][1]-1] = A[ABCD[i][0]-1] + ABCD[i][2] ans = 0 for i in range(Q): if A[ABCD[i][1]-1] == A[ABCD[i][0]-1] + ABCD[i][2]: ans += ABCD[i][3] print(ans)
p03951
s116989673
Accepted
n = int(input()) s = input() t = input() c = 0 for i in range(n): d = t[:i] if d in s: c = i if s == t: print(n) else: print(2*n-c)
p03105
s208095748
Accepted
A, B, C = map(int, input().split()) if B < C: print(0) elif A * C < B: print(C) else: print(B//A)
p03817
s422946391
Wrong Answer
x = int(input()) ans = x//11 * 2 if 0 < x%11 <= 5: ans += 1 elif x % 11 >= 6: ans += 2 print(ans)
p03962
s420582909
Accepted
abc=sorted(list(map(int,input().split()))) if abc[0]==abc[2]: print(1) elif abc[0]==abc[1] or abc[1]==abc[2]: print(2) else: print(3)
p03073
s420260962
Accepted
s = input() res = 0 previous = s[0] for i in range(1, len(s)): if s[i] == previous: res += 1 previous = str((int(previous) + 1) % 2) else: previous = s[i] print(res)
p02754
s392963738
Accepted
n, a, b = map(int, input().split()) ans = n // (a + b) * a rem = n % (a + b) ans += min(a, rem) # ansとremを比較することでnの位置よって処理を変えられる print(ans)
p03448
s944810106
Accepted
a = int(input()) b = int(input()) c = int(input()) x = int(input()) count = 0 for i in range(a + 1): for j in range(b + 1): for k in range(c + 1): if 500 * i + 100 * j + 50 * k == x: count += 1 print(count)
p03095
s240991162
Accepted
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpln(n): return list(int(sys.stdin.readline()) for i in range(n)) n = inp() s = input() c = Counter(s) res = 1 for key in list(c): res *= c[key]+1 res %= mod print((res-1)%mod)
p03998
s629408655
Accepted
S = [input() for _ in range(3)] i = 0 while True: head = S[i][0:1] if len(S[i]) == 0: if i == 0: print("A") elif i == 1: print("B") elif i == 2: print("C") exit() else: S[i] = S[i][1:] if head == "a": i = 0 elif head == "b": i = 1 elif head == "c": i = 2
p02640
s171177942
Accepted
a,b = map(int,input().split()) exist_flg = False for kame in range(a+1): tsuru = a - kame if (kame*4+tsuru*2)==b: exist_flg = True break if exist_flg: print("Yes") else: print("No")
p02697
s678691252
Wrong Answer
import sys input = sys.stdin.readline def main(): n,m = map(int,input().split()) ans = [[n//2,n//2+1]] for _ in range(m-1): ans.append([ans[-1][0]-1,ans[-1][1]+1]) for a in ans: print(*a) if __name__ == "__main__": main()
p02690
s775690239
Wrong Answer
x = int(input()) i = 2 j = 1 while x > i ** 5: if x % (i ** 5) == 0: j *= i x //= i ** 5 i = 2 else: i += 1 else: y = x // j for a in range(int(y ** 0.2) + 1): b = int((a ** 5 - y).real) if a ** 5 - b ** 5 == y: print(a * j, b * j) break
p02848
s382264584
Accepted
N = int(input()) S = str(input()) ans = [] lst = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] for i in range(len(S)): tmp = lst.index(S[i]) tmp += N if tmp > 25: tmp -= 26 ans.append(lst[tmp]) print(''.join(ans))
p03329
s513461651
Accepted
N = int(input()) ans = N for i in range(N+1): x = 0 y = i while y: x += y%6 y //= 6 y = N-i while y: x += y%9 y //= 9 ans = min(x, ans) print(ans)
p03862
s963564976
Accepted
n,x=map(int,input().split()) c=0 l=list(map(int,input().split())) for i in range(1,n): if(l[i-1]+l[i]>x): c+=l[i-1]+l[i]-x l[i]=max(0,l[i]-(l[i-1]+l[i]-x)) print(c)
p03799
s616493680
Wrong Answer
n, m = map(int, input().split()) if m <= 2 * n: ans = n else: ans = n + (m - 2 * n) // 4 print(ans)
p03657
s698210432
Accepted
arr = input().split() arr = list(map(int,arr)) a = arr[0] b = arr[1] if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0: print('Possible') else: print('Impossible')
p03145
s376576903
Wrong Answer
x,y,z=map(int,input().split()) print(x*y/2)
p02601
s402172266
Accepted
a,b,c = map(int, input().split()) k = int(input()) key = 0 for i in range(0,k+1): if i == 0: cc = c else: cc = c*(2**i) if k-i == 0: bb = b else: bb = b*(2**(k-i)) if cc > bb and bb > a: key = 1 break if key == 1: print("Yes") else: print("No")
p03457
s372063951
Accepted
import numpy as np N = int(input()) txy = [[0,0,0]] for i in range(N): txy.append(list(map(int,input().split()))) out='Yes' for i in range(1,N+1): x = np.array(txy[i]) y = np.array(txy[i-1]) mv = abs(x-y) # print(mv) dam = mv[0] - (mv[1] + mv[2]) if dam%2==1 or dam<0: out='No' print(out)
p03524
s674690470
Wrong Answer
# https://atcoder.jp/contests/cf17-final/tasks/cf17_final_b s = input() a = b = c = 0 for i in range(len(s)): if s[i] == 'a': a += 1 elif s[i] == 'b': b += 1 else: c += 1 t = [a, b, c] t.sort(reverse=True) if t[0] > t[1] + t[2]: print('No') else: print('Yes')
p02744
s624226253
Wrong Answer
n = int(input()) ans = ['a'] for j in ans: if len(j) < n: c = ord(j[-1]) #print(c) for i in range(97,c+2): l = str(j + chr(i)) ans.append(l) chk = [] for i in ans: if len(i) == n: chk.append(i) for i in chk: print(i)
p03077
s154450244
Accepted
import math n = int(input()) a = [int(input()) for i in range(5)] print(math.ceil(n/min(a))+4)
p03457
s273132677
Accepted
N = int(input()) data = [[int(__) for __ in input().split()] for _ in range(N)] data.insert(0, [0, 0, 0]) canTravel = True for i in range(1, N+1): absT = abs(data[i][0] - data[i-1][0]) absX = abs(data[i][1] - data[i-1][1]) absY = abs(data[i][2] - data[i-1][2]) distance = absX + absY if absT < distance or absT % 2 != distance % 2: canTravel = False break if canTravel: print('Yes') else: print('No')
p02778
s767842053
Wrong Answer
def resolve_B(): s = input() l = len(s) print("x" * l) resolve_B
p03274
s337491606
Accepted
N, K = map(int, input().split()) X = list(map(int, input().split())) check_X = X[0:K] def calc_distance(check_X): if check_X[0] * check_X[-1] < 0: result = min(abs(check_X[0]*2)+abs(check_X[-1]), abs(check_X[0])+abs(check_X[-1]*2)) else: result = max(abs(check_X[0]),abs(check_X[-1])) return result ans = calc_distance(check_X) for i in range(K, len(X)): check_X.pop(0) check_X.append(X[i]) ans = min(ans, calc_distance(check_X)) print(ans)
p04029
s222596801
Wrong Answer
N=int(input()) print(N*(N+1)/2)
p02772
s240318458
Accepted
n = int(input()) a = list(map(int,input().split())) for i in range(n): if a[i]%2 == 0: if (a[i]%3)*(a[i]%5) != 0: print("DENIED") quit() print("APPROVED")
p04044
s279864561
Accepted
N, L = map(int, input().split()) words = sorted([input() for _ in range(N)]) print(*words, sep="")
p02854
s317854933
Accepted
import sys input = sys.stdin.readline def main(): N = int(input()) A = list(map(int, input().split())) sum_A = sum(A) center = sum_A / 2 total = 0 near_center = 0 for a in A: total += a if abs(total - center) < abs(near_center - center): near_center = total ans = abs((sum_A - near_center) - near_center) print(ans) if __name__ == "__main__": main()
p03285
s159218005
Wrong Answer
N = int(input()) cake = N//4 donuts = N//7 for i in range(cake): for j in range(donuts): if (4*(i+1)+7*(j+1)) == N: print("Yes") exit() print("No")
p02761
s862504319
Accepted
N, M = map(int, input().split()) sc = [[int(i) for i in input().split()] for _ in range(M)] if N == 1 : start = 0 else : start = 10 ** (N - 1) ret = float('inf') for i in range(start, 10 ** N) : i = str(i) for s, c in sc : if int(i[s - 1]) != c : break else : ret = min(ret, int(i)) if ret == float('inf') : print(-1) else : print(ret)
p03605
s034805698
Accepted
ary = list(input()) print("Yes") if ary.count("9") > 0 else print("No")
p03730
s420242954
Accepted
a,b,c = map(int, input().split()) for i in range(1, b+1): if (a * i) % b == c: print('YES') exit() print('NO')
p03485
s881847611
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()) a, b = M() print(math.ceil((a+b)/2))
p02819
s249374557
Accepted
import math n=int(input()) def prime_judge(n): if n == 2: return True if n < 2 or n % 2 == 0: return False for i in range(3, int(math.sqrt(n)) + 1, 2): if n % i == 0: return False return True while prime_judge(n)==False: n+=1 print(n)
p02615
s387137709
Wrong Answer
N=int(input()) A=list(map(int,input().split())) A.sort() ans=A[-1]+(N-2)*A[-2] print(ans)
p03860
s630381076
Accepted
print("A"+input()[8]+"C")
p03779
s242878110
Accepted
X = int(input()) a = [i for i in range(1, 10**5)] import bisect from collections import deque s = deque([]) s.append(0) i = 0 while s[i] < 10 ** 9: s.append(s[i] + a[i]) i += 1 print(bisect.bisect_left(s, X))
p02705
s457843034
Accepted
import math R = int(input()) print(2*math.pi*R)
p02987
s696247532
Accepted
S=input() if len(set(S)) == 2 and S.count(S[0]) == 2: print("Yes") else: print("No")
p03611
s014507405
Wrong Answer
""" """ n = int(input()) a = list(map(int, input().split())) maxA = max(a) cntA = [0] * (maxA + 1) cnt3 = [0] * (maxA + 1) for _a in a: cntA[_a] += 1 for i in range(1,maxA): cnt3[i] += cntA[i-1] + cntA[i] + cntA[i+1] # print(cntA) # print(cnt3) ans = max(cnt3) print(ans)
p03211
s322064417
Accepted
s = input() ans = 999 for i in range(len(s)-2): n = int(s[i:i+3]) if abs(n-753) < ans: ans = abs(n-753) print(ans)
p02817
s964164177
Wrong Answer
s , t = map(str, input().strip().split()) list = [s, t] list.sort() print(list[0]+list[1])
p02718
s294755667
Wrong Answer
nm = input('') n = int(nm.split(' ')[0]) m = int(nm.split(' ')[1]) alist = input('').split(' ') t = 0 for i in range(n): t += int(alist[i]) s = 0 for i in range(n): a = int(alist[i]) if a*4*m > t: s+=1 if s >= m: print('Yes') else: print('No')
p03624
s838458030
Accepted
s = input() base = "abcdefghijklmnopqrstuvwxyz" L = [i for i in base] L = set(L) s = set(s) ans = list(L-s) try: print(sorted(ans)[0]) except: print("None")
p02957
s364564264
Accepted
# -*- coding: utf-8 -*- def main(): A, B = map(int, input().split()) if (A + B) % 2 == 0: ans = (A + B) // 2 else: ans = 'IMPOSSIBLE' print(ans) if __name__ == "__main__": main()
p02862
s726205519
Accepted
#組み合わせ総数 mod = 10 ** 9 + 7 def comb(n, k): res = 1 for i in range(n - k + 1, n + 1): res = res * i % mod for i in range(1, k + 1): res = res * pow(i, mod - 2, mod) % mod return res x,y = map(int,input().split()) if (x + y) % 3 != 0: print(0) exit() m = (2 * x - y) // 3 n = x - 2 * m if n >= 0 and m >= 0: print(comb(m + n,min(m,n))) else: print(0)
p02743
s461024237
Accepted
a,b,c = map(int,input().split()) d = c-a-b if d>0 and 4*a*b<d*d: print("Yes") else: print("No")
p03545
s706773643
Wrong Answer
import sys,math,collections,itertools input = sys.stdin.readline a,b,c,d =list(input().rstrip()) op_lis = itertools.product('+-*/',repeat=3) for op in op_lis: try: if eval(a+op[0]+b+op[1]+c+op[2]+d) == 7: print(a+op[0]+b+op[1]+c+op[2]+d+'=7') exit() except ZeroDivisionError: continue
p03469
s988416643
Accepted
s1, s2, s3 = input().split("/") s1 = 2018 print(s1, s2, s3, sep="/")
p02775
s103819732
Wrong Answer
x = int(input()) y = str(x) a = list(map(int, y)) for i in range(len(a)): if a[i] > 5: a[i] = 10 - a[i] if a[-1] == 0: print(sum(a)) else: print(sum(a)+1)
p02684
s187185950
Wrong Answer
n, k = map(int, input().split()) a = list(map(int, input().split())) cnt = [1] jun = 0 i = 0 while len(cnt) == len(set(cnt)): cnt.append(a[i]) i = a[i]-1 x = cnt.pop() id = cnt.index(x) k -= id cnt = cnt[id:] print(cnt[k%len(cnt)])