problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03493
s003762689
Accepted
s=list(input()) count=0 if s[0]=="1": count+=1 if s[1]=="1": count+=1 if s[2]=="1": count+=1 print(count)
p02796
s928776332
Wrong Answer
N = int(input()) XL = [] for n in range(N): XL.append([int(x) for x in input().split()]) XL = sorted(XL, key=lambda x:(x[0],x[1])) m = -float("inf") ans = 0 for n in range(N): if XL[n][0]-XL[n][1] >= m: ans += 1 m = XL[n][0]+XL[n][1] print(ans)
p02922
s142357128
Wrong Answer
a, b = map(int, input().split()) if a == b: print(1) else: print((b//a)+1)
p02556
s991653439
Accepted
N = int(input()) W = [] S = [] for _ in range(N): x,y = [int(hoge) for hoge in input().split()] wa = x+y sa = x-y W.append(wa) S.append(sa) T = max(W)- min(W) Y = max(S)- min(S) print(max(T,Y))
p02675
s857697775
Wrong Answer
N=int(input()) if N%10==3: print("bon") elif N%10==0 or 1 or 6 or 8: print("pon") else: print("hon")
p03107
s031602406
Accepted
import sys input = sys.stdin.readline def main(): S = input().strip() print(min(list(S).count('1'), list(S).count('0')) * 2) if __name__ == '__main__': main()
p03061
s819929788
Wrong Answer
def gcd(a, b): while b: a, b = b, a % b return a N = int(input()) A = list(map(int, input().split())) L = [0]*(N+1) R = [0]*(N+1) for i in range(N): L[i+1] = gcd(L[i], A[i]) R[N-i-1] = gcd(R[N-i], A[N-i-1]) M = [] for i in range(N-1): M.append(gcd(L[i],R[i+1])) print(max(M))
p02775
s995652949
Accepted
s = map(int,list(raw_input())) dp = [[0,0] for _ in range(len(s))] for i in range(len(dp)): a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i] b = (dp[i - 1][1] if i - 1 >= 0 else 1) + 10 - s[i] dp[i][0] = min(a,b) a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i] + 1 b = (dp[i - 1][1] if i - 1 >= 0 else 1) + 10 - s[i] - 1 dp[i][1] = min(a,b) print dp[-1][0]
p02707
s033170954
Accepted
N = int(input()) A = list(map(int,input().split())) dic = {i+1:0 for i in range(N)} for i in range(N-1): dic[A[i]] = dic[A[i]] +1 for i in range(N): print(dic[i+1])
p03146
s343321450
Wrong Answer
def resolve(): N = int(input()) ans = 1 for i in range(1000000): if N == 1 or N == 2 or N == 4: break elif N % 2 == 0 : N = N//2 ans = ans + 1 else: N = 3*N+1 ans = ans+1 print(ans + 3)
p02646
s392106075
Accepted
A, V = map(int, input().split()) B, W = map(int, input().split()) T = int(input()) if B < A: dist = A - B if dist <= (V - W)*T: print('YES') else: print('NO') else: dist = B - A if dist <= (V - W)*T: print('YES') else: print('NO')
p03696
s130237241
Accepted
n=int(input()) s=input() mn=0 sm=0 for i in range(n): sm+=1 if s[i]=="(" else -1 mn=min(mn,sm) mn*=-1 print("("*mn+s+")"*(sm+mn))
p03329
s895550696
Accepted
n = int(input()) INF = 10**9 dp = [INF] * (n+1) dp[0] = 0 for i in range(n): dp[i+1] = min(dp[i+1], dp[i] +1) six = 6 while i + six <= n: dp[i + six] = min(dp[i+six], dp[i] + 1) six *= 6 nine = 9 while i + nine <= n: dp[i + nine] = min(dp[i+nine], dp[i] + 1) nine *= 9 print(dp[-1])
p02594
s616271841
Accepted
x = int(input()) if x>= 30: print("Yes") else: print("No")
p03251
s184873392
Accepted
n, m, x, y = map(int, input().split()) xx = list(map(int, input().split())) yy = list(map(int, input().split())) for i in range(x+1, y+1): if max(xx) < i <= min(yy): print('No War') exit() print('War')
p03779
s662868935
Wrong Answer
x = int(input()) index = 0 for i in range(1,x+1): if index*2<x: index+=i elif i == (x-index): break # print(index) print(i)
p03106
s473406289
Wrong Answer
A,B,K = map(int,input().split()) result = 0 for i in range(1,100,1): if A%i == 0 and B%i == 0: result = i break print(result*K)
p02732
s727804033
Accepted
from collections import Counter n = int(input()) a = list(map(int,input().split())) b = Counter(a) ans = 0 for i in b: ans += b[i] * (b[i]-1) // 2 for i in a: if b[i] < 2: sa = 0 else: sa = b[i] - 1 print(ans - sa)
p02842
s655843148
Accepted
import math N = int(input()) a = N/1.08 b = (N+1)/1.08 if b-math.ceil(a) <= 0: print(':(') else: print(math.ceil(a))
p02971
s821679391
Accepted
#!/usr/bin/env python3 n,*a=map(int, open(0).read().split()) s = sorted(a) for i in a: if i!=s[-1]: print(s[-1]) else: print(s[-2])
p02835
s699417909
Wrong Answer
A = list(map(int, input().split())) total = sum(A) if total > 22: print("bust") else: print("win")
p02754
s264292792
Accepted
n, a, b = map(int, input().split()) ans = n // (a + b) * a rest = n % (a + b) ans += min(rest, a) print(ans)
p02627
s692247224
Accepted
S=input() if S in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': print('A') else: print('a')
p03328
s386918428
Wrong Answer
a,b=map(int,input().split()) s=0 for i in range(1,b-a+1): s=s+i print(s-a)
p03778
s426324888
Accepted
W,a,b=map(int,input().split()) if a>b: if a<=b+W: print('0') else : print(a-b-W) elif b>a: if b<=a+W: print('0') else : print(b-a-W) else: print('0')
p03711
s690960055
Accepted
x,y=input().split() a=['1','3','5','7','8','10','12'] b=['4','6','9','11'] if x in a and y in a or x in b and y in b: print('Yes') else: print('No')
p03721
s087722511
Wrong Answer
def by_b(n): return n[0] def resolve(): n, k = map(int, input().split()) N = [] for _ in range(n): a, b = map(int, input().split()) N.append([a, b]) sorted(N, key=by_b) cnt = 0 for i in range(n): cnt += N[i][1] if cnt >= k: print(N[i][0]) break resolve()
p02833
s910687117
Wrong Answer
def solve(N): if N%2==1: return 0 N2=(N-N%10)//10 count_zero=N2 x=5 while N2>x: count_zero+=N2//x x*=5 return count_zero N=int(input()) print(solve(N))
p03471
s764505215
Accepted
N, Y = map(int, input().split()) for x in range(N+1): for y in range(N+1-x): z = N - x - y if 10000 * x + 5000 * y + 1000 * z == Y: print(x, y, z) exit() print("-1 -1 -1")
p02629
s989180488
Wrong Answer
n = int(input()) s = [chr(ord("a")+i) for i in range(26)] num, i = 1, 0 while n - num > 0: num = num*27 i += 1 ans = "" while i > 0: tmp = 0 for j in range(1, 27): if n - j*pow(26, i-1) < 0: break tmp = j ans += s[tmp- 1] n -= tmp*pow(26, i-1) i -= 1 print(ans)
p03037
s308802445
Wrong Answer
L,M=map(int,input().split()) a=[0]*L x=[] y=[] for i in range(M): b,c=map(int,input().split()) x.append(b) y.append(c) print(-max(x)+min(y)+1)
p03324
s060523531
Accepted
D,N = map(int,(input().split())) l = [[] for _ in range(3)] for i in range(1,1010001): c = 0 j = i while j%100 == 0: c += 1 j //= 100 if c < 3: l[c].append(i) print(l[D][N-1])
p02572
s236207901
Wrong Answer
n = int(input()) l = input() a = l.split(' ') tmp = 0 tmp2 = 0 for i in range(n): tmp += int(a[i]) for i in range(n): tmp2 += int(a[i])*int(a[i]) #total = int((tmp*tmp-tmp2)/2) print(int(((tmp*tmp-tmp2)/2)%1000000007))
p03627
s009810800
Wrong Answer
N = int(input()) A = list(map(int, input().split())) cnt = {} for a in A: if a not in cnt: cnt[a] = 1 else: cnt[a] += 1 A = [[k, v] for k, v in cnt.items()] A.sort(reverse=True) h = 0 w = 0 for k, v in A: if v >= 4: h = k w = k break elif v >= 2 and h > 0: w = k break elif v >= 2 and h == 0: h = k print(h * w)
p02832
s506062813
Wrong Answer
N = int(input().rstrip()) A = list(map(int,input().rstrip().split())) B = set(A) st = 0 num = 1 count = 0 def destroy(st,num,nlist,count): add = 0 for n in range(st,N): if nlist[n] == num: add += 1 break else : add += 1 count += 1 st += add return count,st for i in range(1,N-1): if st >= N: break else: count,st = destroy(st,i,A,count) if count == 0: print(-1) else : print(count)
p02963
s443706340
Accepted
import math S = int(input()) X1 = 0 Y1 = 0 X2 = 10 ** 9 X3 = 1 Y3 = math.ceil(S / (10 ** 9)) Y2 = X2 * Y3 - S print(X1, Y1, X2, Y2, X3, Y3)
p02939
s717164408
Accepted
s = input() idx = 0 ans = len(s) s_ = "" while idx < len(s): if s_ == s[idx]: ans -= 1 s_ = "" idx += 2 else: s_ = s[idx] idx += 1 print(ans)
p02601
s652172554
Accepted
a, b, c = map(int, input().split()) k = int(input()) def solve(a, b, c, k): while b <= a: b *= 2 k -= 1 while c <= b: c *= 2 k -= 1 return k >= 0 print("Yes" if solve(a, b, c, k) else "No")
p03073
s668057926
Wrong Answer
s=input() print(min(s[::2].count("1")+s[1::2].count("0"),s[::2].count("0")+s[::1].count("1")))
p03437
s332236706
Accepted
x, y = map(int, input().split()) if x == y or y == 1 or x % y == 0: print(-1) exit() for i in range(1, 10**5): if x * i % y != 0: print(x*i) exit()
p03479
s570100422
Accepted
x,y=map(int,input().split()) cnt=0 while x<=y: x*=2 cnt+=1 print(cnt)
p03759
s473791917
Accepted
a,b,c = map(int,input().split()) if b-a == c-b: print("YES") else: print("NO")
p02621
s174443128
Wrong Answer
N = int(input()) ans = (N**2) + (N**3) print(ans)
p03695
s725383973
Accepted
N = int(input()) A = map(int,input().split()) l = [0 for i in range(9)] for a in A: ind = 0 while ind < 8: if a < (ind+1)*400: break ind += 1 l[ind] += 1 ans_max = 0 ans_min = 0 for i in range(0, 8): if l[i] > 0: ans_max += 1 ans_min += 1 if l[-1] > 0: ans_max = ans_max + l[-1] ans_min = max(ans_min, 1) print(ans_min, ans_max)
p03127
s470789070
Accepted
import fractions from functools import reduce N = int(input()) a = list(map(int, input().split())) ans = reduce(fractions.gcd, a) print(ans)
p02647
s851396205
Wrong Answer
n, k = map(int, input().split()) A = list(map(int, input().split())) A2 = [0] * n A3 = [n] * n if k > n: print(*A3) else: for l in range(k): for j in range(n): if A[j] == n: A2[j] =n else: for i in range(n): if A[i] >= abs(i-j): A2[j] += 1 A = A2 A2 = [0] * n if A == [n]*n: break print(*A)
p03548
s177099799
Accepted
x, y, z = map(int, input().split()) print((x - z) // (y + z))
p03435
s357300316
Wrong Answer
#入力(後でいじる) def pin(type=int): return map(type,input().split()) #どっかで最悪計算量の入力データを用意する関数を作ろう? def worstdata(): a=0 return a #solution: def comp(x,y): dp=[0,max(act[0])]*(N+1) #[i]日目のActivity で得られる最大幸福量 return 0 #input C=[sum(pin()) for j in range(3)] #output #print(solution(H,N)) print(["No","Yes"][sum(C)%3==0])
p03679
s659370658
Wrong Answer
x,a,b = map(int, raw_input().split()) print 'delicious' if b - a < x else 'dangerous'
p02775
s286095908
Accepted
s = "0"+input() ans = 0 n = len(s) f = 0 p = 0 for i in range(1,n+1): n = int(s[-i]) # n += f if p+(n>4) > 5: f = 1 else: # ans += f f = 0 n += f ans += min(n,10-n) p = n # ans += f print(ans)
p02615
s068464387
Accepted
from collections import deque N = int(input()) A = list(map(int, input().split())) A_sorted = sorted(A, reverse=True) ans = 0 queue = deque([A_sorted[0]]) for a in A_sorted[1:]: ans += queue.popleft() queue.append(a) queue.append(a) print(ans)
p03862
s361952800
Wrong Answer
n,x=map(int,input().split()) a=list(map(int,input().split())) ans=0 for i in range(n-1): w=a[i]+a[i+1] if w > x: a[i+1]-=(w-x) ans+=(w-x) print(ans)
p04019
s672866566
Wrong Answer
s = input() if len(set(s)) in [3,1]: print("No") else: print("Yes")
p03001
s839800418
Accepted
W, H, x, y = map(int,input().split()) S = W*H / 2 if x == W / 2 and y == H / 2: print(S,1) else: print(S,0)
p02811
s349375593
Wrong Answer
k,x = (int(x) for x in input().split()) print("Yes" if 500 * k > x else "No")
p02714
s466681747
Accepted
N = int(input()) S = input() cnts = [0,0,0] for c in S: if c == 'R': cnts[0] = cnts[0] + 1 if c == 'G': cnts[1] = cnts[1] + 1 if c == 'B': cnts[2] = cnts[2] + 1 ans = cnts[0] * cnts[1] * cnts[2] for j in range(1,N-1): for i in range(0,j): k = j + j - i if k >= N: pass elif S[i] != S[j] and S[j] != S[k] and S[k] != S[i]: ans = ans - 1 print(ans)
p03331
s436105797
Accepted
N=int(input()) a=[0]+[sum(map(int, list(str(i)))) for i in range(1, N+1)] print(min([a[i]+a[N-i] for i in range(1, N//2+1)]))
p02987
s816448474
Accepted
S=set(input()) if len(S)==2: print('Yes') else: print('No')
p03327
s147770215
Accepted
N = int(input()) if N >= 1000: print("ABD") else: print("ABC")
p03059
s475400026
Accepted
A,B,T=map(int, input().split()) print(int((T+0.5)//A*B))
p03657
s635761894
Wrong Answer
a,b = map(int,input().split()) if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0: print('Possible') else: print('Impossibble')
p03221
s255544425
Wrong Answer
import itertools from collections import Counter N, M = list(map(int,input().split())) city_list = [list(map(int,input().split())) +[i+1] for i in range(M)] city_list_sorted = sorted(city_list,key=lambda x: (x[0],x[1]) ) city_list_grouped = itertools.groupby(city_list_sorted,key=lambda x:x[0]) ans = [None for i in range(M)] m =0 for k, v in city_list_grouped: print(k) counter1 = 1 for x1 in v: ans[m] = [x1[2],format(k,'0>6')+format(counter1,'0>6')] counter1 += 1 m+=1 for x in sorted(ans): print(x[1])
p03852
s267186605
Accepted
print('vowel' if input() in 'aeiou' else 'consonant')
p02787
s077160240
Accepted
h, n = map(int, input().split()) ab = [map(int, input().split()) for _ in range(n)] dp = [[float("inf")] * (h + 1) for _ in range(n + 1)] for i in range(n + 1): dp[i][0] = 0 for i, (a, b) in enumerate(ab, 1): for j in range(h + 1): dp[i][j] = min(dp[i-1][j], dp[i][max(j-a, 0)] + b) ans = dp[n][h] print(ans)
p02760
s183351689
Accepted
from collections import OrderedDict a = OrderedDict() for i in range(3): for j in input().split(): a[j] = 0 n = int(input()) for i in range(n): inp = input() if inp in a.keys(): a[inp] = 1 anss = list(a.values()) lines = [(0,1,2), (3,4,5), (6,7,8), (0,3,6), (1,4,7), (2,5,8), (0,4,8), (2,4,6)] for x,y,z in lines: if anss[x] + anss[y] + anss[z] == 3: print("Yes") exit() print("No")
p03339
s600755734
Accepted
n = int(input()) s = input() e = s.count('E') w = 0 for i in s: if i == 'W': n = min(n, w + e) w += 1 else: w -= 1 n = min(n, w + e) print(n)
p02713
s140168941
Accepted
import math K = int(input()) ans = 0 for a in range(1, K+1): for b in range(1, K+1): for c in range(1, K+1): ans += math.gcd(math.gcd(a,b), c) print(ans)
p02923
s736152655
Wrong Answer
N = int(input()) answer = N*(N-1)//2 print(answer)
p02983
s627235044
Accepted
l,r = map(int,input().split()) ans = 2018 for i in range(l,l+2019): for j in range(i+1,min(r+1,i+2019)): ans = min(ans,(i*j)%2019) print(ans)
p03076
s600610770
Wrong Answer
# nabc123_b.py # 調理時間%10=0 をとった後、調理時間%10 が大きい順にとって行く dishes = [int(input()) for i in range(5)] lest_time = 0 ans = 0 for dish in dishes: if dish%10==0: ans += (dish) else: ans += (dish+10-dish%10) if lest_time < 10-dish%10 and dish%10!=0: lest_time = 10-dish%10 print(ans,dish,lest_time) print(ans-lest_time)
p02572
s420086840
Accepted
from collections import deque N = int(input()) A = list(map(int, input().split())) #N=3 #A=[1,2,3] q=deque(A) #print(q) ans=0 sums=sum(q) #print(sums) for i in range(N-1): qwe=q.popleft() ans+=qwe *(sums-qwe) sums-=qwe print(ans%(10**9+7))
p03644
s156096031
Wrong Answer
n = int(input()) count = 0 number = 0 for i in range(n+1): temp = 0 j = i while j > 0 and j % 2 == 0: j //= 2 temp += 1 if temp > count: count = temp number = i print(number)
p03672
s404132536
Accepted
s = list(input()) s.pop(-1) while len(s) % 2 != 0 or s[:len(s)//2] != s[len(s)//2:]: s.pop(-1) print(len(s))
p03160
s850247574
Wrong Answer
a = int(input()) hs = [int(x) for x in input().split()] dp = [1000000000]* len(hs) if a == 0: print(0) exit() if a == 1: print(hs[0]) exit() dp[0] = 0 dp[1] = abs(hs[1] - hs[0]) if a == 2: print(dp[1]) exit() limit_a = max(0, a-2) for i in range(a): if i + 1 < len(hs): dp[i+1] = min(abs(hs[i+1]- hs[i]), dp[i+1]) if(i+2 < len(hs)): dp[i+2] = min(abs(hs[i+2]- hs[i]), dp[i+2]) print(dp[-1])
p03030
s934882561
Wrong Answer
n = int(input()) l = [list(input().split()) for i in range(n)] s,p = [list(i) for i in zip(*l)] p = [int(i) for i in p] z = list(set(s)) z.sort() m = list(p) m.sort(reverse = True) l = [] k = 0 for i in range(len(z)): l.append(k) k += 200 o = [] for i in range(n): w = l[z.index(s[i])] w += m.index(p[i]) o.append(w) r = list(o) r.sort() for i in range(n): print(r.index(o[i]) + 1)
p02723
s532464619
Accepted
s = str(input()) if s[2]==s[3] and s[4]==s[5]: print("Yes") else: print("No")
p03639
s386984573
Accepted
n = int(input()) *a, = map(int, input().split()) b1 = b2 = b4 = 0 for i in a: if i%4==0: b4 += 1 elif i%2==0: b2 += 1 else: b1 += 1 b1 += b2>0 print('Yes' if b1<=b4+1 else 'No')
p03163
s864996454
Accepted
n, m = map(int, input().split()) W, V = [], [] for i in range(n): w, v = map(int, input().split()) W.append(w) V.append(v) A = [0 for j in range(m+1)] for i in range(n): B = [] for j in range(W[i]): B.append(A[j]) for j in range(W[i], m+1): B.append(max(A[j], A[j-W[i]]+V[i])) A = B print(A[m])
p03435
s255377765
Wrong Answer
l =[list(map(int, input().split())) for i in range(3)] total1 = 0 total2 = 0 for i in range(3): total1 += sum(l[i]) total2 += l[i][i] print(total1, total2) if total1 == total2 * 3: print('Yes') else: print('No')
p03998
s134749540
Wrong Answer
a = input() b = input() c = input() first_str = a[0] a = a[1:] if len(a)==0: print('A') exit() while(1): if first_str == 'a': first_str = a[0] a = a[1:] if len(a)==0: print('A') break elif first_str == 'b': first_str = b[0] b = b[1:] if len(b)==0: print('B') break elif first_str == 'c': first_str = c[0] c = c[1:] if len(c)==0: print('C') break
p03043
s010986509
Accepted
n, k = list(map(int,input().split())) c = [] res = 0 for i in range(1, n + 1): cnt = 0 while i <= k - 1: i *= 2 cnt += 1 res += pow(0.5, cnt) print(res/n)
p03351
s158836376
Accepted
a, b, c, d = map(int,input().split()) e = a - b f = b - c g = c - a x = abs(e) y = abs(f) z = abs(g) if x <= d and y <= d or z <= d: print('Yes') else: print('No')
p03105
s931954990
Wrong Answer
A,B,K=map(int,input().split()) cnt=0 num=1 for i in range(100,1,-1): if cnt<K: if A%i==0 and B%i==0: cnt+=1 num=i else: break print(num)
p03435
s647777603
Wrong Answer
c=[] for i in range(3): c.append(list(map(int, input().split()))) #c_sum = sum(c[0]) + sum(c[1]) + sum(c[2]) c_sum = sum(c[0] + c[1] + c[2]) if c_sum % 3 == 0: print("Yes") else: print("No")
p02602
s346675069
Wrong Answer
import numpy as np data = input().split(" ") N = int(data[0]) K = int(data[1]) score = input().split(" ") num = N-K+1 ten = [1]*(num) for i in range(num): temp = [] for j in range(K): temp.append(int(score[K+i-1-j])) ten[i] = temp ten_n = np.array(ten) p = np.prod(ten_n, axis = 1) for i in range(N-K): if p[i] >= p[i+1]: print("No") else: print("Yes")
p03289
s214833106
Wrong Answer
s = str(input()) isOK = True if s[0]=='A': tmp = s[2:-1] cnt = 0 for i in range(len(tmp)): if tmp[i]=='C': cnt += 1 if cnt!=1: isOK = False else: isOK = False if isOK: print('AC') else: print('WA')
p03323
s850071225
Wrong Answer
A,B = map(int,input().split()) if A<=8 and B<=8: print("Yey!") else: print(":(")
p02755
s925685259
Accepted
import math; a,b = map(int,input().split()) x = [] y = [] ans = -1 x.append(math.ceil(a*25/2)) x.append((a+1)*25//2-1) y.append(b*10) y.append((b+1)*10-1) if min(x) < max(y) and min(y) < max(x) and min(y) <= min(x): ans = min(x) elif min(x) < max(y) and min(y) < max(x) and min(x) < min(y): ans = min(y) print(ans)
p04031
s336249884
Accepted
N = int(input()) A = list(map(int, input().split())) min_cost = 10 ** 9 + 7 for i in range(-100, 101): cost = 0 for j in range(N): cost += (A[j] - i) ** 2 min_cost = min(cost, min_cost) print(min_cost)
p03779
s900265750
Wrong Answer
X=int(input()) m=0 for i in range(1,X+1): if X<=m: break if m+i<X: m+=1 print(m)
p02629
s719309846
Wrong Answer
n=int(input()) al=[''] b=[chr(i) for i in range(ord('a'), ord('z')+1)] al+=b c='' while n != 0: i = n%26 n=n//26 c+=al[i] c=c[::-1] print(c)
p03328
s305563275
Accepted
a,b=map(int,input().split()) k=b-a-1 print(k*(k+1)//2-a)
p02783
s389884737
Accepted
h, a = map(int, input().split()) if h%a==0: print(h//a) else: print(h//a+1)
p03592
s395253426
Accepted
# どこを選んでもかまわん n, m, k = map(int, input().split()) for i in range(n + 1): for j in range(m + 1): black = i * m - (j * i) + (n - i) * j if black == k: print("Yes") exit() print("No")
p02677
s227746914
Wrong Answer
import math a,b,h,m = map(int,input().split()) x = abs(30 * h + 0.5 * m - m) if x > 180: x = 360 - x x = x * math.pi / 180 ans = (a**2 + b**2 - 2 * a * b * math.cos(x))**0.5 print(ans)
p03042
s566798387
Accepted
s = input() a = s[:2] b = s[2:] if int(a) == 0 or int(a) > 12: if int(b) == 0 or int(b) > 12: print("NA") else: print ("YYMM") else: if int(b) == 0 or int(b) > 13: print ("MMYY") else: print ("AMBIGUOUS")
p02842
s873282801
Wrong Answer
import math N = float(input()) x = round(N * 100 / 108) if math.floor(x * 1.08) == N : print(x) else : print(':(')
p03126
s640186901
Accepted
n, m=map(int, input().split()) results=[0]*m for i in range(n): check=list(map(int, input().split())) num=check[0] for j in range(1, num+1): results[check[j]-1]+=1 ans=0 for result in results: if result==n: ans+=1 print(ans)
p02952
s534531980
Wrong Answer
N = int(input()) NS = str(N) if len(NS) == 2: print(9) elif len(NS) == 4: print(909) elif len(NS) == 6: print(90909) elif len(NS) == 5: print(N - 9000) elif len(NS) == 3: print(N - 90) else: print(N)
p02982
s414062195
Accepted
import numpy as np def main(): N, D = map(int, input().split()) p = [np.array(list(map(int, input().split()))) for _ in range(N)] ans = 0 for i in range(N - 1): for j in range(i + 1, N): d = np.sqrt(np.sum(np.power(p[i] - p[j], 2))) if d % 1 == 0: ans += 1 print(ans) if __name__ == '__main__': main()