problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03107
s686213900
Wrong Answer
import collections S = input() c = collections.Counter(S) c.values() print(2 * min(c.values()))
p03069
s221695592
Accepted
n = int(input()) s = input() cnt = s.count(".") ans = cnt for c in s: if c == "#": cnt += 1 else: cnt -= 1 ans = min(ans, cnt) print(ans)
p02832
s961890057
Accepted
N = int(input()) a = list(map(int, input().split())) prev = 1 crash = 0 if not 1 in a: print("-1") else: for i in range(N): if a[i] == prev: prev += 1 else: crash += 1 else: print(crash)
p03860
s840727739
Accepted
# A - AtCoder *** Contest a,s,b=list(input().split()) print('A'+s[0]+'C')
p02724
s453208637
Accepted
X = int(input()) coin_500 = X//500 coin_5 = (X%500)//5 print(coin_500*1000 + coin_5*5)
p03495
s214282987
Accepted
import collections n, k = map(int, input().split()) list = input().split() c_list = collections.Counter(list) sorted_c_list = sorted(c_list.values(),reverse=True) print(sum(sorted_c_list[k:]))
p02600
s810760772
Wrong Answer
X=int(input()) initial=400 kyu=8 for add in range(1,9): if X<initial+add*200: print(kyu) break kyu-=1
p04019
s432478580
Accepted
from collections import Counter s = input() c = Counter(s) if len(c) == 4: print('Yes') elif len(c) == 3: print('No') elif len(c) == 1: print('No') elif len(c) == 2: if c['N'] > 0 and c['S'] > 0: print('Yes') elif c['W'] > 0 and c['E'] > 9: print('Yes') else: print('No')
p03319
s549288500
Accepted
n,k=map(int,input().split()) _=list(map(int,input().split())) print((n-1+k-2)//(k-1))
p03262
s729979792
Accepted
from fractions import gcd from functools import reduce n, x, *X = map(int, open(0).read().split()) X = sorted(X + [x]) Y = [x1-x0 for x0, x1 in zip(X, X[1:])] print(reduce(gcd, Y))
p03986
s586058594
Accepted
x = input() s = list() cnt = 0 for c in x: if c == "S": s.append(c) elif c == "T" and len(s) != 0: s.pop() cnt += 1 print(len(x)-cnt*2)
p03565
s875937622
Wrong Answer
s=input() t=input() l=[] import sys if len(t)>len(s) or (len(t)==len(s) and t!=s): import sys print("UNRESTORABLE") exit() for i in range(len(s)-len(t)+1): z=s[:i] for j in range(i,i+len(t)): if s[j]!=t[j-i] and s[j]!="?": break else: z+=t[j-i] else: z+=s[i+len(t):] l.append(z.replace("?","a")) l.sort() print(l[0] if len(l) else "UNRESTORABLE")
p02646
s174292167
Accepted
A,V=map(int,input().split()) B,W=map(int,input().split()) T=int(input()) if A>B: D=A-B else: D=B-A if V<=W: print("NO") elif (V-W)*T>=D: print("YES") else: print("NO")
p03062
s169748896
Wrong Answer
n = int(input()) a = list(map(int,input().split())) i = 10**9 s = 0 z = 0 c = 0 for b in a: if b < 0: s += 1 elif b == 0: z += 1 break if abs(b) < i: i = abs(b) c += abs(b) if z > 0 or s%2 == 0: print(c) else: print(c-2*i)
p02771
s078988191
Wrong Answer
s = input().split() ans = "NO" if s[0] == s[1] == s[2] else "YES" print(ans)
p03767
s239369611
Accepted
N = int(input()) a = sorted(list(map(int, input().split())), reverse=True) num = len(a)//3 ans = sum([a[2*x+1] for x in range(num)]) print(ans)
p02711
s773292311
Accepted
n = input() ans = 'No' for i in n: if i == '7': ans = 'Yes' break print(ans)
p03136
s120677379
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort() if sum(l[0:-1]) > l[-1]: print("Yes") else: print("No")
p02702
s054432303
Wrong Answer
a = input() counter = 0 s_length = len(a) for i in range(s_length - 2): current_mod = int(a[i:i+4])%2019 for j in range(i+4, s_length ): if current_mod%2019 == 0: counter += 1 print(current_mod) current_mod= (current_mod * 10 + int(a[j]))%2019 print(counter+1)
p02640
s120303481
Accepted
#!/usr/bin/env python3 x, y = map(int, input().split()) for i in range(x+1): if 2*i+4*(x-i) == y: print("Yes") quit() print('No')
p03286
s510291174
Accepted
n = int(input()) ans = '' while n!=0: bit = '0' if n%2: n -= 1 bit = '1' ans = bit + ans n//=-2 if ans == '': ans = '0' print(ans)
p02630
s229011989
Accepted
import collections n = int(input()) a = list(map(int, input().split())) count = collections.Counter(a) ans = sum(a) q = int(input()) for _ in range(q): b, c = map(int, input().split()) diff = (c - b) * count[b] count[c] += count[b] count[b] = 0 ans += diff print(ans)
p02695
s796172030
Accepted
import itertools N,M,Q = map(int,input().split()) a = [0]*Q b = [0]*Q c = [0]*Q d = [0]*Q for i in range(Q): a[i],b[i],c[i],d[i] = map(int,input().split()) ans = 0 for A in itertools.combinations_with_replacement(range(1,M+1),N): value = 0 for i in range(Q): if A[b[i]-1] - A[a[i]-1] == c[i]: value += d[i] ans = max(ans,value) print(ans)
p03493
s973936559
Wrong Answer
print(input().count("0"))
p03481
s704344503
Accepted
X, Y = map(int, input().split()) r = 0 A = X while True: if A > Y: break A *= 2 r += 1 print(r)
p02578
s874670750
Wrong Answer
n = int(input()) a = list(map(int, input().split())) res = a[0] ans = 0 for i in range(n-1): if a[i]-a[i+1]>=0: ans += res-a[i+1] else: res = a[i+1] print(ans)
p02971
s793707534
Accepted
N=int(input()) A=[int(input())for _ in range(N)] A2=sorted(A,reverse=True) for i in range(N): if A[i]==A2[0]: print(A2[1]) else: print(A2[0])
p02787
s969107019
Wrong Answer
H,N = map(int,input().split()) p = [] for i in range(N): t = list( map( int, input().split() ) ) p.append(t) a = sorted(p, key = lambda x:x[1] , reverse = True)[0][0] dp = [10**9] * (H+1+a) dp[0] = 0 for i in range(H+1+a): for j in range(N): if i-p[j][0] >= 0: dp[i] = min(dp[i],dp[i-p[j][0]]+p[j][1]) print(min(dp[H:H+a]))
p02783
s535336165
Accepted
H, A = map(int, input().split()) if H % A == 0: ans = H // A else: ans = H // A + 1 print(ans)
p02952
s001187929
Accepted
N = int(input()) if 1 <= N < 10: print(N) elif 10 <= N < 100: print(9) elif 100 <= N < 1000: print(9 + N - 99) elif 1000 <= N < 10000: print(909) elif 10000 <= N < 100000: print(N - 9999 + 909) elif N == 100000: print(90909)
p02552
s288888000
Accepted
x = int(input()) if x == 1: print(0) else: print(1)
p02766
s755475069
Accepted
# -*- coding: utf-8 -*- N, K = map(int, input().split()) def f(x, n): if int(x / n): return f(int(x / n), n) + str(x % n) return str(x % n) ans = f(N, K) print(len(ans))
p03434
s039391054
Accepted
N=int(input()) a=[int(x) for x in input().split()] Alice=0 Bob=0 for i in range(N): if i%2==0: Alice=Alice+max(a) a.remove(max(a)) else: Bob=Bob+max(a) a.remove(max(a)) print(Alice-Bob)
p02664
s422737820
Accepted
base_txt = input() base_txt_to_P = base_txt.replace("?","P") base_txt_to_D = base_txt.replace("?","D") index_count_base_txt_to_P = base_txt_to_P.count("D") + base_txt_to_P.count("PD") index_count_base_txt_to_D = base_txt_to_D.count("D") + base_txt_to_D.count("PD") if index_count_base_txt_to_P >index_count_base_txt_to_D: print(base_txt_to_P) else: print(base_txt_to_D)
p02627
s127312918
Wrong Answer
n = input() if n.isupper: print("A") elif n.islower: print("a")
p03282
s856735015
Wrong Answer
s = input() k = int(input()) for i in range(min(k,len(s))): if s[i] != 1: print(s[i]) exit() else: print(1)
p02682
s678227447
Accepted
def main(): A, B, C, K = map(int, input().split()) if A > K: print(K) elif A + B >= K: print(A) else: print(A - (K - A - B)) main()
p02989
s573759739
Wrong Answer
N = int(input()) d = list(map(int, input().split())) same = N / 2 d.sort() distribution = [0] * d[len(d) - 1] total = 0 for di in d: num = d.count(di) distribution[di - 1] = num # total = 0 # totals = [0] * d[len(d) - 1] # num = 0 # for i in range(len(distribution)): # total += distribution[i] # totals[i] = total # if totals[i] == same: # num += 1 # elif num >= 1: # break print(1)
p04044
s289253202
Accepted
n,l = list(map(int,input().split())) a = [input() for i in range(n)] b = sorted(a) print(''.join(b))
p02831
s706483286
Accepted
a,b=map(int,input().split()) def gcd(x,y): if x==y: return x elif x>y: r=-1 while r!=0: r=x%y x=y y=r return x else: r=-1 while r!=0: r=y%x y=x x=r return y print(a*b//gcd(a,b))
p02780
s110130250
Accepted
import sys input = sys.stdin.readline (n, k), s, res, sm = map(int, input().split()), list(map(lambda x: (int(x) + 1) / 2, input().split())), 0, 0 for i in range(n): if i < k: sm += s[i] else: sm += s[i]; sm -= s[i-k] res = max(res, sm) print(f'{res:.10f}') # print(f'{max([sum(s[i:i+k]) for i in range(n - k + 1)]):.10f}')
p03624
s879784340
Accepted
s=set(input()) for i in range(97,97+26): c=chr(i) if not c in s: print(c) exit() print('None')
p03730
s409313044
Wrong Answer
a, b, c = map(int, input().split()) ans = 'NO' for n in range(1, b+1): if (a*n -1) % b == 0: ans = 'YES' break print(ans)
p02602
s188213050
Wrong Answer
a = [(input()) for i in range(2)] tmp=a[0].split(' ') tmp_s=a[1].split(' ') score=[] for i in range(int(tmp[0])-int(tmp[1])): t=1 for j in range(int(tmp[1])): t=t*int(tmp_s[j]) score.append(t) for i in range(len(score)-1): if score[i]<score[i+1]: print('yes') else: print('no')
p02753
s217724211
Wrong Answer
print("Yes" if input() in "A" else "No")
p03162
s454284225
Accepted
if __name__=='__main__': N=int(input()) happiness=[] for i in range(N): cost=list(map(int,input().split())) happiness.append(cost) dp=[[0 for j in range(3)] for i in range(N+1)] #j:0 is from A, 1 is from B, 2 is from C for i in range(N): for j in range(3): for k in range(3): if j != k: dp[i+1][k] = max(dp[i+1][k], dp[i][j]+happiness[i][k]) else: continue print(max(dp[-1]))
p03971
s825834453
Accepted
n,a,b = map(int,input().split(" ")) s = input() accept = a+b for i in range(len(s)): if s[i] == "c": print("No") elif accept <= 0: print("No") elif s[i] == "a": print("Yes") accept -= 1 elif s[i] == "b" and b > 0: print("Yes") b -= 1 accept -= 1 else: print("No")
p02784
s739676600
Accepted
h, n = map(int, input().split()) a = list(map(int, input().split())) if h <= sum(a): print('Yes') else: print('No')
p03760
s599499605
Accepted
O = input() E = input() a = str() if len(O)==len(E): for i in range(len(O)): a += O[i] + E[i] else : for i in range(len(O)-1): a += O[i] + E[i] a += O[-1] print(a)
p02630
s470722291
Accepted
from collections import defaultdict N = int(input()) d = defaultdict(int) A = list(map(int, input().split())) for a in A: d[a] += 1 Q = int(input()) ans = 0 for k, v in d.items(): ans += k * v for _ in range(Q): B, C = map(int, input().split()) d[C] += d[B] ans -= B * d[B] ans += C * d[B] del d[B] print(ans)
p03417
s972017381
Accepted
N_gyou, M_retu = map(int, input().split()) if (N_gyou == 2 or M_retu == 2): ans = 0 elif (N_gyou == 1 and M_retu == 1): ans = 1 elif (N_gyou == 1): ans = M_retu - 2 elif (M_retu == 1): ans = N_gyou - 2 else: ans = (N_gyou - 2) * (M_retu - 2) print(ans)
p03281
s593284081
Accepted
import sys input = sys.stdin.buffer.readline #input = sys.stdin.readline def II(): return int(input()) def MI(): return map(int,input().split()) def LI(): return list(map(int,input().split())) # mod=10**9+7 # rstrip().decode('utf-8') # map(int,input().split()) def main(): n=II() li=[105,135,165,189,195] ans=0 for i in range(n+1): if i in li: ans+=1 print(ans) if __name__ == "__main__": main()
p02820
s086469797
Accepted
N, K = map(int, input().split()) R, S, P = map(int, input().split()) T = list(input()) ans = 0 commands = [''] * N for i, t in enumerate(T): if t == 'r': command = 'p' point = P elif t == 's': command = 'r' point = R elif t == 'p': command = 's' point = S if (i - K >= 0) and (commands[i - K] == command): command = '' point = 0 ans += point commands[i] = command print(ans)
p03994
s068292268
Accepted
import string S = input() K = int(input()) LEN = len(S) ans = '' for pos, s in enumerate(S, 1): idx = string.ascii_lowercase.find(s) if pos < LEN: if idx > 0 and 26-idx <= K: ans += 'a' K -= (26 - idx) else: ans += s else: # 残りのKをすべて消費する ans += string.ascii_lowercase[(idx + K)%26] print(ans)
p03077
s809282983
Accepted
import math n = int(input()) li = [] for i in range(5): li.append(int(input())) if min(li) >= n: print(5) else: print(math.ceil(n/min(li)) + 4)
p03657
s024933778
Accepted
A, B = map(int, input().split()) if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0: print('Possible') else: print('Impossible')
p03059
s933937536
Wrong Answer
A, B, T = map(int, input().split()) print(int(B/A * T))
p03221
s955005064
Wrong Answer
import numpy as np n,m = list(map(int, input().split())) info = list(list(map(int, input().split())) for i in range(m)) info = np.array(info) p,y = info[:,0],info[:,1] y[np.argsort(y)] = np.arange(1,m+1) for num in range(1,n+1): filt = (p==num) if sum(filt): y[filt] -= min(y[filt])-1 for i in range(m): print(str(p[i]).zfill(6) + str(y[i]).zfill(6))
p02983
s821618727
Wrong Answer
l,r = map(int, input().split()) def solve(l,r): num = float("inf") for i in range(l, r): current = (i*(i+1)) % 2019 num = min(num,current) if num == 0: print(num) return print(num) solve(l,r)
p02629
s860525750
Accepted
n=int(input()) i=0 pl=list() while True: i=i+1 if (26*(1-26**(i-1)))/(1-26)+1<=n and n<=(26*(1-26**(i-1)))/(1-26)+26**i: break a=n-(26*(1-26**(i-1)))/(1-26)-1 for l in range (i): a,b=divmod(a,26) pl.insert(0,(chr(int(b)+97))) print("".join(pl))
p03109
s941408951
Wrong Answer
import datetime t = datetime.datetime.strptime("2019/04/30","%Y/%m/%d") s = datetime.datetime.strptime(input(),"%Y/%m/%d") print("Heise") if t>=s else print("TBD")
p02744
s154155997
Accepted
n = int(input()) def dfs(s, i): if i == n: print(s) else: for j in range(ord("a"), max(map(ord, list(s))) + 2): dfs(s + chr(j), i + 1) dfs("a", 1)
p03109
s104256827
Wrong Answer
S=str(input()) if int(S[5:7])<=4: print('HEISEI') else: print('TBD')
p03220
s245462435
Accepted
n=int(input()) t,a=map(int,input().split()) h=list(map(int,input().split())) idx=0 m=1000000000 for i in range(n): tmp=t-(h[i]*0.006) if abs(a-tmp)<m: idx=i m=abs(a-tmp) print(idx+1)
p02777
s877709431
Wrong Answer
S,T=map(str,input().split()) A,B=map(int,input().split()) U=str(input()) if "S"=="U": print(A-1,B) else: print(A,B-1)
p03160
s338292278
Accepted
n=int(input()) li=list(map(int,input().split())) dp=[0]*(n) dp[0]=0 dp[1]=dp[1]+abs(li[1]-li[0]) for i in range(2,n): dp[i]=min((dp[i-1]+abs(li[i]-li[i-1])),dp[i-2]+abs(li[i]-li[i-2])) print(dp[n-1])
p03673
s869328684
Wrong Answer
import collections def solve(): n = int(input()) a = list(map(int, input().split())) b = collections.deque() for i in range(n): if i % 2 == n % 2: b.append(a[i]) else: b.appendleft(a[i]) if n % 2 == 1: b.reverse() b = map(str, b) print(" ".join(b)) return 0 if __name__ == "__main__": solve()
p02814
s042523030
Accepted
import fractions from functools import reduce def lcm_base(x, y): return (x * y) // fractions.gcd(x, y) def lcm(numbers): return reduce(lcm_base, numbers, 1) n,m = map(int, input().split()) a = list(map(int, input().split())) lcm_a = a[0] for i in a[1:]: lcm_a = lcm_a * i // fractions.gcd(lcm_a,i) if lcm_a > m * 2: print(0) exit() if all([(lcm_a // i) % 2 for i in a]): ans = (m - lcm_a // 2) // lcm_a + 1 print(ans) else: print(0)
p03627
s269261665
Accepted
from collections import Counter n=int(input()) a=list(map(int,input().split())) a.sort(reverse=True) A=Counter(a) s=set(a) S=sorted(list(s)) S.reverse() h=0 w=0 for i in S: res=A[i] if res>=4: if h==0: h=i if w==0: w=i elif 2<=res<4: if w==0: w=i elif w!=0 and h==0: h=i print(h*w)
p03434
s768223488
Accepted
N = int(input()) a = list(map(int,input().split())) b = sorted(a, reverse=True) Alice = 0 Bob = 0 for i in range(N): if i % 2 == 0: Alice += b[i] else: Bob += b[i] print(Alice - Bob)
p03680
s130095282
Wrong Answer
# -*- coding: utf-8 -*- N = int(input()) a = [] for i in range(N): a.append(int(input())) ans = pos = 0 flag = [0] * N while True: #print(pos,a[pos]-1) pos = a[pos] - 1 ans += 1 if a[pos] == 2: ans += 1 break if flag[pos] > 0: ans = -1 break else: flag[pos] = 1 print(ans)
p03417
s753669751
Wrong Answer
n,m = map(int,input().split()) if (n>=2)and(m>=2): print((n-2)*(m-2)) else: print(m*n-2)
p02910
s543403425
Wrong Answer
S = input() c1 = [s in ['R', 'U', 'D'] for s in S[::2]] c2 = [s in ['L', 'U', 'D'] for s in S[1::2]] print('Yes' if c1 and c2 else 'No')
p03162
s602586979
Wrong Answer
n = int(input()) a = [[0] * 3 for i in range(n+1)] dp = [[0] * 3 for i in range(n+1)] for i in range(n): a[i] = list(map(int,input().strip().split())) for i in range(n): for j in range(3): for k in range(3): if j == k: continue else: dp[i+1][j] = max(dp[i+1][j],dp[i][j]+ a[i][k]) print(max(dp[n]))
p03785
s652316394
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n, c, k = map(int, readline().split()) t = [int(readline()) for _ in range(n)] t.sort() ans = 1 tmp = [t[0], 0] for tt in t: if tmp[0] + k < tt or tmp[1] + 1 > c: ans += 1 tmp = [tt, 0] tmp[1] += 1 print(ans)
p03479
s114706446
Accepted
x, y = map(int, input().split()) nx = x*2 if nx > y: print(1) else: i = 2 while nx*2 <= y: nx = nx*2 i += 1 print(i)
p02646
s754255905
Wrong Answer
A, V =map(int, input().split()) B, W =map(int, input().split()) T=int(input()) d=abs(B-A) dv=V-W if dv<=0: print("NO") elif d%dv !=0 : print("NO") elif d/dv > T-1: print("NO") else: print("YES")
p02598
s226478940
Wrong Answer
N, K = map(int,input().split()) A = sorted(map(int,input().split())) start = 0 end = A[-1] l = (start + end)/2 while end - start >= 1: l = (start + end)/2 count = 0 for i in range(N): count += (A[i]-1)//l if count > K: start = l else: end = l print(int(l)+1)
p02813
s095844984
Accepted
N = int(input()) P = tuple(map(int,input().split())) Q = tuple(map(int,input().split())) import itertools A = [i+1 for i in range(N)] all_permutation_list = list(itertools.permutations(A)) a = all_permutation_list.index(P) b = all_permutation_list.index(Q) print(abs(a - b))
p03854
s790105511
Wrong Answer
s = input() t_list = ['dreamdream', 'dreamdreamer', 'dreamerase', 'dreameraser', 'dreamerdream', 'dreamerdreamer', 'dreamererase', 'dreamereraser', 'erasedream', 'erasedreamer', 'eraseerase', 'eraseeraser', 'eraserdream', 'eraserdreamer', 'erasererase', 'erasereraser'] if s in t_list: print('YES') else: print('NO')
p02657
s696283174
Wrong Answer
unit_price=300 quantity=5 # unit_price:単価/quantity:量 total_price=unit_price*quantity print(total_price) print(300*5)
p03836
s101094844
Accepted
sx, sy ,tx, ty = map(int,input().split()) momo="" xz = abs(tx-sx) yz = abs(ty-sy) momo += "U" * yz + "R" * xz + "D" * yz + "L" * xz momo += "L" * 1 + "U" * (yz+1) + "R" * (xz+1) + "D" * 1 momo += "R" * 1 + "D" * (yz+1) + "L" * (xz+1) + "U" * 1 print(momo)
p02630
s022339562
Wrong Answer
from collections import Counter n = int(input()) a_L = list(map(int,input().split())) q = int(input()) L = Counter(a_L) all_sum = sum(a_L) print(0) # ans_L = [] # for i in range(q): # b,c = map(int,input().split()) # if L[b] != 0: # diff = (c-b) * L[b] # all_sum = all_sum+diff # L[c] += L[b] # ans_L.append(all_sum+1) # for i in ans_L: # print(i)
p02951
s995683519
Accepted
a, b, c = map(int, input().split()) d = a-b e = c-d if e>0: print(e) else: print("0")
p02633
s505593673
Accepted
x = int(input()) for i in range(1, 360+1): if (x*i)%360 == 0: print(i) exit()
p03136
s318931200
Accepted
N=int(input()) L=list(map(int,input().split())) a=sum(L) flag=True for i in range(N): if a<=2*L[i]: flag=False break if flag: print('Yes') else: print('No')
p04031
s111554428
Accepted
n=int(input()) a=list(map(int,input().split())) inf=float('inf') ans=inf for b in range(-100,101): ch=0 for i in range(n): ch+=(b-a[i])**2 ans=min(ans,ch) print(ans)
p02879
s728001309
Wrong Answer
a,b=map(int,input().split()) if a*b >81: print(-1) else: print(a*b)
p03087
s059084405
Wrong Answer
n, q = list(map(int, input().split())) s = input() a = [0]*n for i in range(1, n): if s[i-1] == "A": if s[i] == "C": a[i] = a[i-1]+1 else: a[i] = a[i-1] for i in range(q): b, c = list(map(int, input().split())) print(a[c-1]-a[b-1])
p02789
s829600596
Wrong Answer
a, b = map(int,input().split()) if b >= a: a = str(a) print(a*b) else: b = str(b) print(b*a)
p03338
s900207732
Wrong Answer
N = int(input()) S = input() answer = 0 for i in range(1,N-1): X = S[:i] Y = S[i:] Z = 0 for c in 'abcdefghijklmnopqrstuvwxyz': if c in X and c not in Y or c in Y and c not in X: Z += 1 answer = max(answer,Z) print(answer)
p04033
s538041513
Accepted
a, b = map(int, input().split()) if a <= 0 and b >= 0: print('Zero') else: if a > 0 and b > 0: print('Positive') elif a < 0 and b < 0: if (b - a) % 2: print('Positive') else: print('Negative')
p03639
s827102245
Accepted
n = int(input()) A = list(map(int, input().split())) a = [] c = [0,0,0] for a_i in A: cnt = 0 while a_i % 2 == 0: a_i //= 2 cnt = min(2,cnt+1) c[cnt] += 1 a.append(cnt) if (c[2] + c[1] // 2) >= (n // 2): print("Yes") else: print("No")
p02996
s073101070
Accepted
n = int(input()) ab = [list(map(int, input().split())) for i in range(n)] ab.sort(key=lambda x: x[1]) s = 0 for i in ab: s += i[0] if s > i[1]: print("No") exit() print("Yes")
p02922
s247407022
Accepted
a,b=map(int,input().split()) if b==1: print(0) else: ans=1 bb=b-a while bb>0: bb=bb-(a-1) ans+=1 print(ans)
p02681
s589603376
Wrong Answer
#--------------- # argv.py #--------------- import sys # コマンドライン引数を変数argsに代入 args = sys.argv print(args)
p03264
s778841718
Wrong Answer
n=int(input()) print((n/2)*((n+1)/2))
p02713
s982627561
Accepted
k = int(input()) from math import gcd s = 0 for a in range(1, k+1): for b in range(1, k+1): g = gcd(a, b) for c in range(1, k+1): s += gcd(g, c) print(s)
p02700
s222540401
Wrong Answer
import math List = input().split() HP_T = int(List[0]) AT_T = int(List[1]) HP_A = int(List[2]) AT_A = int(List[3]) result = 0 Turn_T = math.ceil(HP_A/AT_T) Turn_A = math.ceil(HP_T/AT_A) print(Turn_T, Turn_A) if Turn_T - Turn_A == 0: result = "Yes" if Turn_T - Turn_A < 0: result = "Yes" if Turn_T - Turn_A > 0: result = "No" print(result)
p02689
s813856032
Accepted
N, M = [ int(i) for i in input().strip().split(' ') ] H = [ int(i) for i in input().strip().split(' ') ] paths = [] max_neighbor = [ 0 for _ in range(N)] for _m in range(M): path = input().strip().split(' ') path = int(path[0]), int(path[1]) max_neighbor[path[0]-1] = max(max_neighbor[path[0]-1], H[path[1]-1]) max_neighbor[path[1]-1] = max(max_neighbor[path[1]-1], H[path[0]-1]) count = 0 for n in range(N): if max_neighbor[n] < H[n]: count += 1 print(count)