problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02882
s124395441
Accepted
import math a,b,x = map(int,input().split()) l = 2/a**2*(a**2*b-x) if x >= a**2*b/2: if l != 0: print(90-math.degrees(math.atan(a/l))) else: print(0) else: k = 2*x/(b*a) print(90-math.degrees(math.atan(k/b)))
p03146
s162461039
Accepted
s=[int(input())] i=2 while(1): j=s[-1] if j%2: f=3*j+1 else: f=j//2 if s.count(f): break else: s.append(f) i+=1 print(i)
p02873
s622233469
Accepted
S=input() a=[0]*(len(S)+1) for i in range(len(S)): if S[i]=="<": a[i+1]=max(a[i+1],a[i]+1) for i in range(len(S)-1,-1,-1): if S[i]==">": a[i]=max(a[i],a[i+1]+1) print(sum(a))
p02701
s585994909
Wrong Answer
n=int(input()) s = list() count=0 for i in range(n): a = input() if not(a in s): s.append(s) count+=1 print(count)
p02842
s577515742
Accepted
n=int(input()) for i in range(50000): if(int(i*1.08)==n): print(i) exit() print(':(')
p02724
s721883673
Accepted
if __name__ == "__main__": X = int(input()) U = 0 U += (X // 500) * 1000 X = X % 500 U += (X // 5) * 5 print(U)
p02982
s657087950
Accepted
import math n,d=map(int,input().split()) x = [] for _ in range(n): l = list(map(int, input().split())) x.append(l) cnt = 0 for i in range(n): for j in range(i+1, n): tmp = 0 for k in range(d): tmp += (x[i][k] - x[j][k])**2 if math.sqrt(tmp) == int(math.sqrt(tmp)): cnt += 1 print(cnt)
p02765
s819435602
Accepted
N,R=map(int,input().split()) if N>=10: print(R) else: print(R+100*(10-N))
p03434
s068389522
Accepted
import sys import itertools input = sys.stdin.readline N = int(input()) a = sorted([int(i) for i in input().split()], reverse=True) bob_filter = [i % 2 for i in range(len(a))] alice_filter = [not i for i in bob_filter] result = sum(list(itertools.compress(a, alice_filter))) \ - sum(list(itertools.compress(a, bob_filter))) print(result)
p03994
s553439964
Accepted
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): s = list(input()) k = int(readline()) l = len(s) rem = k for i in range(l): char = s[i] diff = (ord("z") - ord(s[i]) + 1) % 26 if rem >= diff: rem -= diff s[i] = "a" rem = rem % 26 s[l - 1] = chr(ord(s[l - 1]) + rem) print("".join(s)) if __name__ == '__main__': main()
p02910
s843369184
Wrong Answer
import sys list=input() def split(a): return [char for char in a] list=split(list) even_count=0 odd_count=0 for i in list: if even_count%2==0: even_count+=1 continue if list[even_count]=="R": print("NO") sys.exit() even_count+=1 for i in list: if odd_count%2==1: odd_count+=1 continue if list[odd_count]=="L": print("NO") sys.exit() odd_count+=1 print("YES")
p02729
s800952899
Wrong Answer
N,M=map(int, input().split()) if M == 1: answer = N * N-1 elif N == 1: answer = M * M-1 else: answer = (N * (N-1))//2 + (M * (M-1))//2 print(answer)
p02724
s651052673
Wrong Answer
X = int(input()) happiness = (X//500)*1000+((X%100)//5)*5 print (happiness)
p03435
s822540053
Wrong Answer
cl = list(list(map(int, input().split())) for _ in range(3)) c_sum = 0 for c in cl: c_sum += sum(c) count = 0 for i in range(2, c_sum+1): if c_sum % i == 0: count += 1 if count == 1: print('No') else: print('Yes')
p02640
s172179101
Accepted
number = input().split(" ") X = int(number[0]) Y = int(number[1]) if Y % 2 == 1: print("No") else: if X * 4 >= Y: if X * 2 <= Y: print("Yes") else: print("No") else: print("No")
p03548
s643866160
Accepted
X,Y,Z=map(int,input().split()) print(X//(Y+Z) if (X%(Y+Z))>=Z else (X//(Y+Z))-1)
p03944
s645020330
Accepted
# -*- coding: utf-8 -*- w, h, n = map(int, input().split()) wn = 0 hn = 0 for i in range(n): x, y, a = map(int, input().split()) if a == 1 and wn < x: wn = x elif a == 2 and w > x: w = x elif a == 3 and hn < y: hn = y elif a == 4 and h > y: h = y if (w - wn) > 0 and (h - hn) > 0: print((w - wn) * (h - hn)) else: print(0)
p03556
s193533753
Accepted
a = int(input()) ans = 0 b = 0 while ans <= a: b += 1 ans = b**2 print((b-1)**2)
p03359
s011448971
Wrong Answer
a, b = map(int, input().split()) if b > 13: print(a) else: print(b)
p03803
s750874575
Wrong Answer
a,b = map(int, input().split()) if a>b and b!=1: print("Alice") elif a==1: print("Alice") elif a==b: print("Draw") else: print("Bob")
p02572
s699010555
Wrong Answer
N = int(input()) A = input().split() ss = 0 for i in range(N - 1): j = i +1 ss += int(A[i]) * int(A[j]) ss += int(A[N -1]) print(ss % 1000000007)
p04005
s508345202
Accepted
x=input().split() dim=[int(x[0]),int(x[1]),int(x[2])] if (dim[0]*dim[1]*dim[2])%2==0: print(0) else: dim.remove(max(dim)) print(dim[0]*dim[1])
p02730
s537540882
Wrong Answer
s = list(input()) thresh_1 = int((len(s) - 1) / 2) thresh_2 = int((len(s) + 3) / 2) s_1 = s[:thresh_1] s_2 = s[thresh_2 - 1:] print(s_1) print(s_2) if s == s[::-1] and s_1 == s_1[::-1] and s_2 == s_2[::-1]: print('Yes') else: print('No')
p03838
s913030872
Accepted
a, b = map(int, input().split()) if a * b > 0: ans = abs(b - a) if a > b: ans += 2 else: ans = abs(a - b) if a > b: ans += 1 tmp = abs(abs(a) - abs(b)) + 1 ans = min(ans, tmp) print(ans)
p03274
s390501009
Accepted
N, K = map(int, input().split()) x = list(map(int, input().split())) ans = 10**10 for i in range(N-K+1): ans = min(ans, abs(x[i]) + abs(x[i] - x[i+K-1])) ans = min(ans, abs(x[i+K-1]) + abs(x[i+K-1] - x[i])) print(ans)
p02646
s126973640
Wrong Answer
a,v = map(int, input().split()) b,w = map(int, input().split()) t = int(input()) oni = v*t + a nige = w*t +b if v and w >0: if oni > nige: print("YES") else: print("NO") elif v and w <0: if oni < nige: print("YES") else: print("NO")
p03208
s704174121
Accepted
import math n, k = list(map(int, input().split())) h = [int(input()) for _ in range(n)] h.sort() ans = math.inf for i in range(n - k + 1): ans = min(ans, h[i + k - 1] - h[i]) print(ans)
p03673
s926037400
Accepted
N = int(input()) A = [int(x) for x in input().split()] t = [] for i in range(N)[::-1]: if i%2!=(N%2): t.append(A[i]) for i in range(N): if i%2==(N%2): t.append(A[i]) print(*t)
p03711
s263758676
Accepted
g = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]] x, y = map(int, input().split()) for i in range(len(g)): if x in g[i]: xg = i if y in g[i]: yg = i if xg == yg: print('Yes') else: print('No')
p02699
s573022550
Wrong Answer
a, b = map(int, input().split()) if a<b: print('unsafe') else: print('safe')
p03555
s814900087
Accepted
if input() == input()[::-1]: print('YES') else: print('NO')
p02594
s180675362
Wrong Answer
temp = int(input()) print("No" if temp >= 30 else "Yes")
p02791
s084351776
Wrong Answer
n=int(input()) lista= [int(i) for i in input().split()] len=len(lista) ans=1 for i in range(1,len-1): if lista[i-1]>=lista[i]: ans=ans+1 print(ans)
p02645
s576788888
Accepted
name = input() print(name[:3])
p02909
s683032419
Wrong Answer
s = input() ans = 'No' for i in range(len(s)): if i%2!=0 and s[i] == 'R': ans = 'Yes' elif i%2==0 and s[i] == 'L': ans = 'Yes' print(ans)
p03624
s814611561
Accepted
n=input() l=[chr(ord('a') + i) for i in range(26)] for k in l: if k not in n: print(k) exit() print("None")
p03862
s974866243
Accepted
N, x = map(int, input().split()) A = list(map(int, input().split())) ans = 0 i = 0 while i < N-1: if A[i]+A[i+1] > x: d = A[i]+A[i+1]-x ans += d A[i+1] = 0 if A[i+1] < d else A[i+1]-d i += 1 print(ans)
p03433
s191327202
Accepted
n = int(input()) a = int(input()) q, r = divmod(n, 500) if r <= a: print('Yes') else: print('No')
p02953
s445028773
Accepted
N = int(input()) H = list(map(int, input().split())) h = H[-1] ans = "Yes" for i in range(N-1, -1, -1): if H[i] <= h+1: h = min(h, H[i]) else: ans = "No" break print(ans)
p02972
s797361284
Accepted
# Python3 (3.4.3) import sys input = sys.stdin.readline # ------------------------------------------------------------- # function # ------------------------------------------------------------- # ------------------------------------------------------------- # main # ------------------------------------------------------------- N = int(input()) A = list(map(int,input().split())) B = [0]*(N+1) Ans = [] for k in range(N,0,-1): cnt = 0 for i in range(k,N+1,k): cnt += B[i] cnt %= 2 if A[k-1] != cnt: B[k] = 1 Ans.append(k) print(len(Ans)) if Ans: print(*Ans)
p03607
s824414414
Wrong Answer
n = int(input()) C = {} for _ in range(n): a = input() if a not in C: C[a] = 0 C[a] += 1 print(C) for i in C.keys(): C[i] %= 2 print(sum(C.values()))
p02918
s741538417
Wrong Answer
n_k = list(map(int,input().split())) chr_lr = list(input()) cnt_rl = 0 cnt_con = 0 for i in range(n_k[0]-1): if(chr_lr[i] == chr_lr[i+1]): cnt_con += 1 elif(chr_lr[i] == 'R' and chr_lr[i+1] == 'L'): cnt_rl += 1 if n_k[1] <= cnt_rl: sum = cnt_con + (n_k[1]*2) else: sum = cnt_con + (cnt_rl*2) if(chr_lr[0] != chr_lr[n_k[0]-1]): sum += 1 print(sum)
p02748
s121824842
Accepted
A, B, M = [int(i) for i in input().split()] a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] xyc = [[int(i) for i in input().split()] for _ in range(M)] ans = min(a) + min(b) for z in xyc: x, y, c = z ans = min(a[x - 1] + b[y - 1] - c, ans) print(ans)
p03286
s625018748
Wrong Answer
n = int(input()) if n == 0: print(0) exit() s = "" while True: if n == 0: break if n%2 == 0: s += "0" n = n//(-2) else: s += "1" n = (n-1)//(-2) print(s)
p02627
s079472755
Accepted
a = input() if a.isupper(): print("A") else: print("a")
p02970
s161905722
Accepted
n, d = map(int, input().split()) c = 0 while True: t = n-d n = t-d-1 c += 1 if n <= 0: break print(c)
p02699
s760689267
Accepted
s,w = map(int,input().split()) if w >= s: print("unsafe") else: print("safe")
p03997
s277020064
Accepted
a = [int(input()) for i in range(3)] print(int((a[0]+a[1])*a[2]/2))
p03475
s305449176
Wrong Answer
n = int(input()) CSF = [tuple(map(int, input().split())) for _ in range(n - 1)] for i in range(n): t = 0 for c, s, f in CSF[i:]: if t < s: t = s else: t += t % f t += c print(t)
p04030
s218626697
Accepted
s=input() ans="" for c in s: if c=='B': if ans: ans=ans[0:-1] else: ans+=c print(ans)
p03274
s633069731
Accepted
n,k=map(int,input().split()) x=list(map(int,input().split())) print(min([x[i+k-1]-x[i]+min(abs(x[i]),abs(x[i+k-1])) for i in range(n-k+1)]))
p03435
s333275698
Wrong Answer
c1 = list(map(int, input().split())) c2 = list(map(int, input().split())) c3 = list(map(int, input().split())) result = 'No' if sum(c1[:2]) == c1[2] or c1[0] == c1[2]: if sum(c2[:2]) == c2[2] or c2[0] == c2[2]: if sum(c2[:2]) == c3[2] or c3[0] == c3[2]: result = 'Yes' print(result)
p03126
s521645821
Accepted
n,m=map(int,input().split()) S=set(range(1,m+1)) for i in range(n): K,*A=map(int,input().split()) S&=set(A) print(len(S))
p02923
s283441209
Accepted
n=int(input()) hl=list(map(int,input().split())) count=0 temp_count=0 for i in range(n-1): if hl[i]>=hl[i+1]: temp_count+=1 else: if count<temp_count: count=temp_count temp_count=0 if count<temp_count: count=temp_count print(count)
p04034
s121277467
Accepted
N,M = map(int,input().split()) rboxes = [False]*N rboxes[0] = True ballC = [1]*N for i in range(M): x, y = map(int, input().split()) if rboxes[x-1]: rboxes[y-1] = True ballC[x-1] -= 1 ballC[y-1] += 1 if ballC[x-1] == 0: rboxes[x-1] = False c = 0 for i in range(N): if rboxes[i]: c+=1 print(c)
p02678
s392166717
Wrong Answer
N,M = map(int, input().split()) A = [] B = [] tree = [[]] * N for i in range(M): tempA,tempB = map(int, input().split()) A.append(tempA) B.append(tempB) tree[tempA - 1] = tree[tempA - 1]+[tempB] tree[tempB - 1] = tree[tempB - 1]+[tempA] for i in range(N): if i == 0: print("Yes") continue for i2,v in enumerate(tree): if i + 1 in v: print(i2 + 1) break
p03145
s768428363
Wrong Answer
a, b, c = map(int, input().split()) print(a*b/2)
p02823
s806685274
Accepted
N,A,B=map(int,input().split()) if (B-A)%2==0: ans=(B-A)//2 else: #2人のどちらかが卓1,Nのいずれかに到達するのに必要なラウンド数 #1は偶奇を調整するためのラウンド #(B-A-1)/2は偶奇の調整後に2人が出会うまでのラウンド数 ans=min(A-1,N-B)+1+(B-A-1)//2 print(ans)
p03693
s318068331
Accepted
a,b,c=map(int, input().split()) if (10*b+c)%4 == 0: print('YES') else: print('NO')
p02628
s892372483
Wrong Answer
N, K = map(int, input().split()) p = list(map(int,input().split())) print(sum(list(set(p))))
p02645
s395359335
Accepted
import random S = input() n = len(S) i = 0+int(random.random()*(n-3)) print(S[i]+S[i+1]+S[i+2])
p03657
s603232001
Wrong Answer
print('Possible' if sum(map(int, input().split()))%3==0 else 'Impossible')
p03077
s616549824
Accepted
n, *a = map(int, open(0).read().split()) b = min(a) print(4 + (n + b - 1) // b)
p03481
s094964046
Accepted
x, y = map(int, input().split()) A = [] while (x <= y): A.append(x) x *= 2 print(len(A))
p03796
s472558994
Accepted
MOD = 10**9+7 N = int(input()) ans = 1 for i in range(1,N+1): ans = (ans*i)%MOD print(ans)
p02747
s025437722
Wrong Answer
s = input() if len(s)%2 != 0: print('No') else: for x in range(0,len(s), 2): if s[x:x+2] != 'hi': print('No') exit() print('Yes')
p02702
s507736070
Wrong Answer
s = input() s_len = len(s) num = '' ans = 0 j = 0 for i in range(s_len): while j < s_len: num += s[j] if int(num) % 2019 == 0: ans += 1 j += 1 j = i + 3 if j > s_len: break num = '' print(ans)
p02660
s436600900
Accepted
from collections import Counter n = int(input()) a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) c = Counter(a) ans = 0 loop = True for i in c.values(): x = 1 while loop == True: if x * (x + 1) // 2 <= i < (x + 1) * (x + 2) // 2: break x += 1 ans += x print(ans)
p02623
s838123631
Accepted
N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] for i in range(N): a.append(a[i] + A[i]) for i in range(M): b.append(b[i] + B[i]) ans, j = 0, M for i in range(N + 1): if a[i] > K: break while b[j] > K - a[i]: j -= 1 ans = max(ans, i + j) print(ans)
p02773
s657466485
Accepted
def main(): N = int(input()) S = {} for _ in range(N): s = input() if s not in S: S[s] = 1 else: S[s] += 1 v_max = max(S.values()) keys = [k for k, v in S.items() if v == v_max] keys.sort() for k in keys: print(k) if __name__ == "__main__": main()
p03471
s435930612
Wrong Answer
n, result = map(int, input().split()) for x in range(n + 1): for y in range(n - x + 1): if 10000 * x + 5000 * y + 1000 * (n - x - y) == result: print(x, y, (n - x - y)) exit() print("-1,-1,-1")
p02743
s736150810
Accepted
a, b, c = map(int, input().split()) if (c-a-b)**2 > 4*a*b and c-a-b>0: print('Yes') else: print('No')
p02726
s005882129
Accepted
N, X, Y = map(int, input().split()) dists = [0] * N for i in range(1, N): for j in range(i + 1, N + 1): d = min(j - i, abs(X - i) + abs(Y - j) + 1) dists[d] += 1 for k in range(1, N): print(dists[k])
p02760
s776154384
Wrong Answer
a11, a12, a13 = map(int, input().split()) a21, a22, a23 = map(int, input().split()) a31, a32, a33 = map(int, input().split()) N = int(input()) num = [] for _ in range(N): num.append(int(input())) row1 = a11 + a12 + a13 row2 = a21 + a22 + a23 row3 = a31 + a32 + a33 col1 = a11 + a21 + a31 col2 = a12 + a22 + a32 col3 = a13 + a23 + a33 cross1 = a11 + a22 + a33 cross2 = a13 + a22 + a31 if 0 in [row1, row2, row3, col1, col2, col3, cross1, cross2]: print("Yes") else: print("No")
p03043
s640954358
Accepted
N,K = map(int,input().split()) a = 0 for i in range(1,N+1): nankai = 0 while 2**(nankai)*i < K : nankai += 1 a += 1/(N*(2**nankai)) print(a)
p02646
s469552395
Accepted
a,v=map(int,input().split()) b,w=map(int,input().split()) t=int(input()) gap=abs(a-b) if v>w: c=gap/(v-w) if t>=c: print('YES') else: print('NO') else: print('NO')
p02718
s888088057
Accepted
inputs = input().split(' ') inputs2 = input().split(' ') inp1=[int(a) for a in inputs] inp2=[int(a) for a in inputs2] # inp1 = [12,3] # inp2 = [4,56,78,901,2,345,67,890,123,45,6,789] sums = sum(inp2) rest = 1/(4*inp1[1]) inp2.sort() inp2.reverse() result = [] for i in range(inp1[1]): if inp2[i] > sums*rest or inp2[i] == sums*rest: result.append(int(inp2[i])) if len(result)>inp1[1] - 1: print("Yes") else: print("No")
p03695
s343183256
Wrong Answer
import sys input=sys.stdin.readline def atc(atc): result=["1","2","3","4","5","6","7","8","9","9","9","9","9","9","9","9","9"][atc//400] return result num=0 L1=[] n=int(input()) L=list(map(int,input().split())) for i in L: a=atc(i) if a=="9": num+=1 else:L1.append(a) b=len(set(L1)) c=b+num if c>9: c=9 else:c print(b,c)
p04005
s991780637
Wrong Answer
a,b,c = map(int,input().split()) print(a*b*c//max(a,b,c))
p03328
s510792186
Accepted
a, b =map(int,input().split()) cnt=[i for i in range(b-a)] print(sum(cnt)-a)
p02777
s560834925
Accepted
from decimal import* from fractions import* import math import functools import sys sys.setrecursionlimit(10 ** 7) read = sys.stdin.buffer.read inputt = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines s,t=input().split() a,b=input().split() u=input() if(u==s): a=int(a)-1 else: b=int(b)-1 print(a,end=" ") print(b)
p02775
s206055164
Wrong Answer
N=list(input()) N.insert(0,0) ans=0 for i in range(len(N)-1,-1,-1): n=int(N[i]) if n//10>=1: N[i-1]=str(int(N[i-1])+1) continue if n==5: if int(N[i-1])>=4: N[i-1]=str(int(N[i-1])+1) ans+=5 elif n>=6: ans+=10-n N[i-1]=str(int(N[i-1])+1) else: ans+=n print(ans)
p03408
s099702557
Accepted
N=int(input()) S=list() for i in range(N): S.append(input()) M=int(input()) T=list() for i in range(M): T.append(input()) A=set(S) ans=0 for i in A: s=0 s=S.count(i)-T.count(i) if s>ans: ans=s print(ans)
p02957
s993480213
Wrong Answer
def main(): a, b = map(int, input().split()) if a == 0 or b == 0: print("IMPOSSIBLE") else:print( int((a + b) / 2)) if __name__ == "__main__": main()
p03796
s246142170
Wrong Answer
import math print(math.factorial(int(input())))
p02861
s115106111
Wrong Answer
from itertools import permutations from math import hypot, factorial n=int(input()) a=[list(map(int,input().split()))for _ in range(n)] d = lambda x1,y1,x2,y2: ((x1-x2)**2 + (y1-y2)**4)**0.5 x = 0 for i in permutations(a): for j in range(n-1): x += d(i[j][0],i[j][1], i[j+1][0],i[j+1][1]) #for i in range(n): f*=i+1 print(x / factorial(n))
p03106
s027333853
Accepted
a,b,k = map(int,input().split()) c = 0 i = max(a,b) while i > 0: if a % i == 0: if b % i == 0: c += 1 if c == k: print(i) break i -= 1
p02732
s586746772
Accepted
from operator import mul from functools import reduce import collections def cmb(n,r): r = min(n-r,r) if r == 0: return 1 over = reduce(mul, range(n, n - r, -1)) under = reduce(mul, range(1,r + 1)) return over // under N = int(input()) M = input().split() c = collections.Counter(M) A = 0 for i in c.values(): if i >= 2: A += cmb(i, 2) for j in M: print(A - (c[j]-1))
p02777
s525349239
Accepted
import sys input = sys.stdin.readline S, T = input().rstrip().split() A, B = [int(x) for x in input().split()] U = input().rstrip() if U == S: print(A - 1, B) else: print(A, B - 1)
p02601
s615757387
Accepted
A, B, C = list(map(int, input().split())) K = int(input()) flag = False for i in range(K): b = (2 ** i) * B c = (2 ** (K - i)) * C if A < b < c: flag = True if flag: print('Yes') else: print('No')
p03327
s584348109
Wrong Answer
a=int(input()) if a < 1000: print('ABC'+(str(a))) elif len(str(a-999)) == 2: print('ABD'+'0'+(str(a-999))) elif len(str(a-999)) == 1: print('ABD'+'00'+(str(a-999))) else: print('ABD'+(str(a-999)))
p02859
s204452518
Accepted
r = int(input()) print (r*r)
p02606
s093935833
Wrong Answer
a,b,c=map(int,input().split()) n=a//c y=b//c x=y-n if n//c==0 or y//c==0: print(x+1) else: print(x) if c==1: print(x+1)
p02553
s181757836
Accepted
import numpy as np a, b, c, d = map(int, input().split()) hoge = [] hoge.append(a*c) hoge.append(a*d) hoge.append(b*c) hoge.append(b*d) print(max(hoge))
p02882
s365161830
Accepted
import math def main(): a,b,x=map(int,input().split()) if a**2*b/2<x : theta=math.atan(2*(a**2*b-x)/a**3) else : theta=math.pi/2-math.atan(2*x/(a*b**2)) print(theta*180/math.pi) main()
p02761
s750448707
Wrong Answer
N,M = map(int, input().split()) d = ['x']*N flg = 0 for i in range(M): s,c = map(int, input().split()) s -= 1 if d[s] == 'x': d[s] = c if d[s] != c or (s==0 and c==0 and N>1): flg = -1 ans = 0 for j in range(N): N-=1 if d[j]=='x': if j == 0: d[j] = 1 else: d[j] = 0 ans += d[j]*(10**N) print(flg if flg == -1 else ans)
p02861
s385637364
Accepted
cin = open(0).read().strip().split('\n') n = int(cin[0]) xy = [tuple(map(int, a.split(' '))) for a in cin[1:]] import itertools, math ret = 0 case = 0 for cases in itertools.permutations(xy): case += 1 for idx in range(n-1): ret += math.sqrt((cases[idx][0]-cases[idx+1][0])**2 + (cases[idx][1]-cases[idx+1][1])**2) print(ret/case)
p03910
s015907899
Accepted
N=int(input()) sum=0 for i in range(N): sum+=i+1 if sum>=N: break for j in range(1,i+2): if j!=sum-N: print(j)
p03145
s658072168
Accepted
# A - Right Triangle a,b,c=list(map(int,input().split())) print((a*b)//2)
p03672
s381419922
Accepted
S = input() N = len(S) for i in range(N-1,0,-1): if i % 2 == 1: continue if S[:i//2] == S[i//2:i]: ans = i break print(ans)