problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02860
s191214467
Accepted
n = int(input()) s = input() if s[n//2:] == s[:n//2]: print("Yes") else: print("No")
p02989
s613353584
Wrong Answer
n=int(input()) a=list(map(int,input().split())) for i in range(1,n+1): print(a.count(i))
p02719
s293289804
Wrong Answer
N, K = input().split(); N = int(N); K = int(K); amari = N % K; hu = amari - K; max_N = max(amari,hu); print(max_N);
p02600
s502910623
Accepted
X = int(input()) print(10 - X//200)
p03210
s706496338
Accepted
#!/usr/bin/env python3 x = int(input()) if x == 3 or x == 5 or x == 7: print("YES") else: print("NO")
p02970
s158223934
Accepted
N , D = map(int, input().split()) print(-(-N//((D*2)+1)))
p03774
s473546524
Accepted
n,m=map(int,input().split()) ab=[[int(j) for j in input().split()] for i in range(n)] cd=[[int(j) for j in input().split()] for i in range(m)] for a,b in ab: l=[abs(a-c)+abs(b-d) for c,d in cd] print(l.index(min(l))+1)
p02939
s959608077
Wrong Answer
S = input() ans = 1 tmp = S[0] for i in range(len(S)-1): if tmp == S[i+1]: tmp += S[i+1] else: tmp = S[i+1] ans += 1 if ans <= len(S)//2: if len(S)%2 == 0: print((len(S)//2)+1) else: print((len(S)//2)+2) else: print(ans)
p03385
s682683276
Wrong Answer
s = str(input()) if s[0] != s[1] and s[0] != s[2]: print('Yes') else: print('No')
p03438
s469557979
Accepted
import sys, math from functools import lru_cache from collections import deque def input(): return sys.stdin.readline()[:-1] def mi(): return map(int, input().split()) def ii(): return int(input()) def i2(n): tmp = [list(mi()) for i in range(n)] return [list(i) for i in zip(*tmp)] def main(): N = ii() a = list(mi()) b = list(mi()) K = sum(b) - sum(a) if sum(max(0, (b[i]-a[i]+1)//2) for i in range(N)) <= K: print('Yes') else: print('No') if __name__ == '__main__': main()
p03495
s357917227
Accepted
_, k = map(int, input().split()) d = {} for i in map(int, input().split()): if i in d: d[i] += 1 else: d[i] = 1 d = sorted(d.values(), reverse=True) print(sum(v for v in d[k:]))
p03998
s650915389
Accepted
S={c:list(input()) for c in "abc"} s="a" while S[s]:s=S[s].pop(0) print(s.upper())
p03061
s522087147
Accepted
n = int(input()) l = list(map(int, input().split())) #print(l) l2 = list(reversed(l)) #print(l2) #from itertools import combinations #a = list(combinations(l, n-1)) #print(a) from fractions import gcd L, R = [0], [0] for i in range(n): L.append(gcd(L[i],l[i])) R.append(gcd(R[i],l2[i])) #print(L) R = list(reversed(R)) #print(R) g = [] for j in range(n): g.append(gcd(L[j],R[j+1])) print(max(g)) #from functools import reduce #def gcd_list(numbers): # return reduce(gcd, numbers)
p03219
s393677567
Wrong Answer
X,Y = map(int,input().split()) print(X+Y/2)
p03264
s053740981
Wrong Answer
N=int(input()) if N%2==0: print(N/2**2) else: print((N//2)*((N//2)+1))
p02647
s436977253
Wrong Answer
### import math n,k = map(int, input().split()) a = list(map(int, input().split())) for i in range(k): b = [0] * (n+1) #print(b) for j in range(n): l = max(0, j-a[j]) r = min(j+a[j]+1, n) b[l] += 1 b[r] -= 1 print(b) for j in range(n): b[j+1] += b[j] b.pop() if(a == b): break a = b ans = " ".join(map(str, a)) print(ans)
p02912
s861251787
Wrong Answer
n, m = (int(x) for x in input().split()) a = [int(x) for x in input().split()] print(a) for _ in range(m): idx = a.index(max(a)) a[idx] //= 2 print(sum(a))
p02597
s253863296
Accepted
n = int(input()) c = list(input()) r = 0 w = 0 for i in range(len(c)): if(c[i]=="R"): r += 1 ans = max(r,w) for i in range(len(c)): if(c[i]=="R"): r -= 1 else: w += 1 now = max(r,w) ans = min(ans,now) print(ans)
p02983
s230045595
Accepted
import sys l,r = map(int,input().split()) ans = int(2018) if(r-l > 2020): print(0) sys.exit() else: for i in range(l,r): for j in range(l+1,r+1): if((i*j)%2019 < ans): ans = (i*j)%2019 print(ans)
p02748
s322541067
Wrong Answer
refN, renN, disN = map(int, input().split()) ref = list(map(int,input().split())) ren = list(map(int,input().split())) dis = [input().split() for _ in range(disN)] minCost = 0 for kk in range(disN): cost = ref[int(dis[kk][0])-1] + ren[int(dis[kk][1])-1] - int(dis[kk][2]) if minCost == 0 or cost < minCost: minCost = cost ref.sort() ren.sort() cost = ren[0] + ref[0] if cost < minCost: minCost = cost print(minCost)
p04033
s937423897
Accepted
a, b = map(int, input().split()) ans = 1 if a > 0 and b > 0: print("Positive") elif a == 0: print("Zero") elif a < 0 and b > 0: print("Zero") elif b == 0: print("Zero") elif a < 0 and b < 0: diff = b - a if diff % 2 == 0: print("Negative") elif diff % 2 != 0: print("Positive")
p03487
s534921274
Accepted
import collections N = int(input()) A = [int(x) for x in input().split()] c = collections.Counter(A) tmp = 0 for k, v in c.items(): if v < k: tmp += v else: tmp += (v - k) print(tmp)
p03087
s197409244
Accepted
import sys import math N, Q = map(int, input().split()) S = input() a = [0 for _ in range(N)] for i in range(1, N): if S[i-1]+S[i] == "AC": a[i] += 1 + a[i-1] else: a[i] += a[i-1] for _ in range(Q): l, r = map(int, sys.stdin.readline().strip().split()) print(a[r-1] - a[l-1])
p02768
s244193489
Wrong Answer
import math n,a,b = map(int,input().split()) numbers = [] for i in range(1,n+1): numbers.append(i) numbers.remove(a) numbers.remove(b) if len(numbers) == 0: print('0') else: sum_kinds = 0 for i in numbers: a_kinds = math.factorial(n)/(math.factorial(i) * math.factorial(n-i)) sum_kinds = sum_kinds + a_kinds print(sum_kinds % (10**9+7))
p03106
s958379145
Accepted
a,b,k = map(int,input().split()) l = [] for i in range(100,0,-1): if a%i == 0 and b%i == 0: l.append(i) print(l[k-1])
p03043
s023739394
Accepted
N, K = map(int, input().split()) cnt = 0 for i in range(1, N+1): p = 0 while i < K: i = i*2 p += 1 cnt += 1/2**p print (cnt/N)
p03281
s824824940
Accepted
N = int(input()) ans = 0 for n in range(1,N+1,2): sm = sum(n % i == 0 for i in range(1,n+1)) if sm == 8: ans += 1 print(ans)
p03639
s127610260
Wrong Answer
n = int(input()) a = list(map(int, input().split())) l = (n - a.count(2) + 1) // 2 count = 0 for i in a: if i % 4 == 0: count += 1 if l <= count: print('Yes') else: print('No')
p03611
s640828170
Accepted
from collections import Counter N = int(input()) A = list(map(int,input().split())) C = Counter(A) ans = 0 for i in range(10**5): c = C[i-1] + C[i] + C[i+1] ans = max(c,ans) print(ans)
p03624
s076126828
Wrong Answer
S = input() lis_S = list(S) a = "abcdefghijklmnopqrstuvwxyz" for i in lis_S: a = a.strip(i) if len(a) == 0: print("None") else: print(a[0])
p03069
s494919496
Accepted
from collections import Counter N = int(input()) S = list(input()) ans = 10 ** 9 hash = [0] * (N + 1) memo = 0 for i in range(N): if S[i] == "#": memo += 1 hash[i + 1] = memo dot = [0] * (N + 1) memo = 0 for i in range(N - 1,-1,-1): if S[i] == ".": memo += 1 dot[i] = memo for i in range(N + 1): ans = min(ans, hash[i] + dot[i]) print(ans)
p02618
s756079155
Accepted
import sys input = lambda: sys.stdin.readline().rstrip("\r\n") import random D = int(input()) c = [int(x) for x in input().split()] s = [] for _ in range(D): s.append([int(x) for x in input().split()]) t = [random.randint(1, 26) for x in range(D)] last = [0]*26 ans = 0 for i in range(1, D + 1): ans += s[i - 1][t[i - 1] - 1] last[t[i - 1] - 1] = i for j in range(26): ans -= c[j]*(i - last[j]) #print(ans) print(*t, sep="\n")
p02725
s675600197
Accepted
K, N = map(int, input().split()) A = list(map(int, input().split())) dA = [] for i in range(1, N): dA.append(A[i] - A[i-1]) if i == N - 1: dA.append(A[0] - (A[i] - K)) dA = sorted(dA) print(sum(dA[:N-1]))
p03680
s010978752
Accepted
n = int(input()) a = [0] for i in range(n): a.append(int(input())) b = 1 for i in range(n): b = a[b] if b == 2: print(i + 1) break else: print(-1)
p02796
s916736627
Wrong Answer
N = int(input()) A = [list(map(int,input().split())) for i in list(range(N))] B = [[i[0]-i[1], i[0]+i[1]] for i in A] B.sort() prev=B[0] cnt=N for i in range(1,N): if prev[1]>B[i][0]: cnt-=1 else: prev=B[i] print(cnt)
p02792
s912142138
Accepted
N = int(input()) pair = [[0] * 10 for i in range(10)] for num in range(1,N + 1): temp = str(num) temp1 = int(temp[0]) temp2 = int(temp[-1]) pair[temp1][temp2] += 1 total = 0 for i in range(1,10): for j in range(1,10): total += pair[i][j] * pair[j][i] print(total)
p02971
s402366140
Accepted
N = int(input()) A = [int(input()) for _ in range(N)] left_max = [0] * (N + 1) right_max = [0] * (N + 1) for index, a in enumerate(A, start=1): left_max[index] = max(left_max[index - 1], a) for index, a in enumerate(reversed(A), start=1): right_max[index] = max(right_max[index - 1], a) for i in range(N): print(max(left_max[i], right_max[N - i - 1]))
p03469
s473592858
Accepted
print('2018/01/{}'.format(input()[8:]))
p03835
s588723299
Accepted
k,s=map(int,input().split()) ans=0 for i in range(k+1): for j in range(k+1): z=s-i-j if 0<=z<=k: ans+=1 print(ans)
p03835
s801381281
Accepted
K, S = map(int, input().split()) ans = 0 for x in range(K + 1) : if x > S : continue for y in range(K + 1) : if 0 <= S - x - y <= K : ans += 1 print(ans)
p02642
s404616575
Accepted
M = 10 ** 6 + 1 N = int(input()) A = list(map(int, input().split())) A.sort() numbers = range(M) not_divisible = [True] * (M) result = 0 for i in range(N): target = A[i] if not_divisible[target]: if i+1 <= N-1 and A[i+1] == A[i]: pass else: result += 1 for j in range(target, M, target): not_divisible[j] = False print(result)
p02629
s435089203
Accepted
N = int(input()) def num2alpha(num): if num<=26: return chr(64+num) elif num%26==0: return num2alpha(num//26-1)+chr(90) else: return num2alpha(num//26)+chr(64+num%26) print(num2alpha(N).lower())
p04043
s927825809
Wrong Answer
nums = list(map(int, input().split())) if nums.count(5) == 2 and nums.count(7) == 2: print("YES") else: print("NO")
p02570
s735728179
Wrong Answer
D, T, S = map(int,input().split()) X = D/S if T > X: print("Yes") else: print("No")
p03146
s642416768
Wrong Answer
def main(): s = int(input()) #s = input() #s = input().split() #s = list(map(int,input().split())) #a = [input() for i in range(n)] #a = [int(input()) for i in range(n)] #a = [input().split() for i in range(n)] #a = [list(map(int,input().split())) for i in range(n)] ans = 0 count = 0 lis = [] while s >= 1: if s == 1: count += 1 break elif s % 2 == 0: s //= 2 count += 1 else: s = s*3 + 1 count += 1 print(count+1) if __name__ == '__main__': main()
p02947
s491967775
Accepted
N = int(input()) ans = 0 word = {} for i in range(N): S_word = sorted(input()) key = "".join(S_word) if key in word: word[key] += 1 ans += word[key] else: word[key] = 0 print(ans)
p03471
s533313335
Wrong Answer
n, y = map(int, input().split()) for i in range(1, n+1): for j in range(1, n+1): if ( i*10000 + j*5000 + (n-i-j)*1000 ) == y: print(i,j,(n-i-j)) exit() if i+j+1 == n: break print('-1 -1 -1')
p02702
s647434729
Wrong Answer
import sys from collections import deque from collections import defaultdict import math import copy #input = sys.stdin.readline sys.setrecursionlimit(20000000) s = input() s = s[::-1] n = len(s) dp = [0]*(n+1) k = 1 a = defaultdict(int) a[0]+=1 for i in range(n): dp[i] = (dp[i-1]+int(s[i])*k)%2019 k*=10 k%=2019 a[dp[i]] += 1 ans = 0 for i in a.keys(): ans += a[i]*(a[i]-1)/2 print(ans)
p02727
s023192577
Accepted
x, y, a, b, c = map(int, input().split()) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) p = p[:x] q.sort(reverse=True) q = q[:y] apples = p + q + r apples.sort(reverse=True) print(sum(apples[:x+y]))
p02823
s032925403
Accepted
n,a,b = map(int,input().split()) if (b-a)%2 == 0: print(min((b-a)//2,b-1,n-a)) else: print(min(b-1,n-a,a+(b-a-1)//2,n-b+1+(b-a-1)//2))
p04012
s857028577
Wrong Answer
w = input() for i in range(len(w)): if w.count(w[i])%2 !=0: print("No") break else: print("Yes") break
p03293
s746689114
Wrong Answer
s = input() t = input() flag = False for i in range(len(s)): if s == t: flag =True s = s[-1] + s[::len(s)-1] if flag: print("Yes") else: print("No")
p03745
s274790788
Accepted
N = int(input()) A = list(map(int, input().split())) def solve(N,A): ans = 1 lis = [] lis.append(A[0]) a = A[0] for i in range(1,N): if len(lis)==1 or prev==0: prev = A[i]-a elif (A[i]-a)*prev<0: ans += 1 lis = [] lis.append(A[i]) a = A[i] return ans print(solve(N,A))
p03773
s910314789
Wrong Answer
x,y = map(int,input().split()) if (x+y)<=23: print((x+y)%24) else: print(x+y)
p02578
s864089379
Accepted
n = int(input()) a = list(map(int,input().split())) t = a[0] ans = 0 for i in range(1,n): if a[i] < t: ans += t-a[i] else: t = a[i] print(ans)
p03252
s950171863
Wrong Answer
s=input() t=input() d={} for i in range(len(s)): si=s[i] ti=t[i] if si in d: d[si]+=[ti] else: d[si]=[ti] for k in d.keys(): if len(set(d[k]))!=1: print('No') exit() print('Yes')
p02987
s802351014
Accepted
s = input() tmp = set(s) if len(tmp) == 2: for c in tmp: if s.count(c) != 2: print('No') exit() print('Yes') else: print('No')
p02624
s419382206
Wrong Answer
def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr.append([n, 1]) return arr n = int(input()) s = 1 for i in range(2, n+1): ls = factorization(i) for j in ls: s += i*(j[1]+1) print(s)
p02795
s555109107
Wrong Answer
H = int(input()) W = int(input()) N = int(input()) if H >= W: if H%2 != 0:print(N//H + 1) else: print(N//H) else: if W%2 != 0:print(N//W + 1) else: print(N//W)
p03001
s211493298
Wrong Answer
W, H, x, y = map(int, input().split()) print(W * H / 2, int((0 < x < W)&(0 < y < H)))
p02658
s342362540
Accepted
N = int(input()) A = list(map(int, input().split())) result = 1 if 0 in A: print(0) else: for i in range(N): result *= A[i] if result > 10**18: print(-1) quit() print(result)
p02695
s197257757
Wrong Answer
import itertools n, m, q = map(int, input().split()) nums = [] for _ in range(q): nums.append(list(map(int, input().split()))) total = 0 l = [1,2,3,4,5,6,7,8,9,10] for v in itertools.combinations_with_replacement(l, n): scores = [] for a,b,c,d in nums: if v[b-1]-v[a-1] == c: scores.append(d) if total <= sum(scores): total = sum(scores) print(total)
p03239
s452774189
Wrong Answer
import sys import os def main(): if os.getenv("LOCAL"): sys.stdin = open("input.txt", "r") N, T = list(map(int, sys.stdin.readline().split())) ct = [list(map(int, sys.stdin.readline().split()))for i in range(N)] ret = float('inf') for n in range(N): if T >= ct[n][1] and ret > ct[n][0]: ret = ct[n][0] print('LTE' if ret == float('inf') else ret) if __name__ == '__main__': main()
p03774
s067098656
Accepted
N,M = map(int,input().split()) place = [list(map(int,input().split())) for _ in range(N)] check = [list(map(int,input().split())) for _ in range(M)] for x,y in place: tmp = 10**9 for i in range(M): dis = abs(x-check[i][0]) + abs(y-check[i][1]) if tmp > dis: tmp = dis ans = i+1 print(ans)
p02947
s673409840
Accepted
N = int(input()) words = [] for i in range(N): s_in = str(input()) s_sort = ''.join(sorted([ch for ch in s_in])) words.append(s_sort) #print(words) # Counterクラス: key=要素, val=出現回数 from collections import Counter cntr = Counter(words) #print(cntr) # 出現回数2個以上は組み合わせ数を足す ans = 0 for cnt in cntr.values(): if cnt > 1: ans += cnt * (cnt - 1) // 2 print(ans)
p02900
s501036194
Wrong Answer
import fractions a,b=list(map(int,input().split())) def f(a,b): max=fractions.gcd(a,b) re=[1,max] for i in range(2,max): if a%i==0 and b%i==0:re.append(i) return re def g(n): if n==0:return False for i in range(2,n): if n%i==0:return False else:return True ans=[g(n) for n in f(a,b)] print(ans.count(True))
p02793
s757704524
Accepted
import math import fractions def lcm(x, y): return (x * y) // fractions.gcd(x, y) def main(): mod = 10**9 +7 n = int(input()) ls = list(map(int,input().split())) t = ls[0] for a in ls: t = lcm(t,a) ans = 0 for a in ls: ans += t//a print(ans%mod) if __name__ == '__main__': main()
p02642
s131478849
Accepted
n = int(input()) a = list(map(int,input().split())) cnt = [0]*(10**6+1) for elem in a: cnt[elem] += 1 unique = [] for i in range(10**6+1): if cnt[i] == 1: unique.append(i) cnt = [0]*(10**6+1) a = list(set(a)) for elem in a: for m in range(elem*2,10**6+1,elem): cnt[m] = 1 ans = 0 for elem in unique: if cnt[elem] == 0: ans += 1 print(ans)
p03730
s941318485
Accepted
from sys import exit a, b, c = map(int, input().split()) for i in range(1, b+1): if (a * i) % b == c: print('YES') exit() print('NO')
p02859
s915623882
Accepted
n = int(input()) print(int(n * n))
p04019
s626894357
Accepted
S=input() if 'S' in S and 'N' not in S: print('No') elif 'N' in S and 'S' not in S: print('No') elif 'E' in S and 'W' not in S: print('No') elif 'W' in S and 'E' not in S: print('No') else: print('Yes')
p03319
s115342822
Accepted
N, K = map(int, input().split()) A_list = list(map(int, input().split())) tmp = K time = 1 while(tmp<N): tmp += K-1 time += 1 print(time)
p03799
s539746855
Accepted
n,m = map(int, input().split()) if n >= m//2: print(min(n,m//2)) else: print(n + (m - 2*n)//4)
p03699
s936894796
Accepted
_,*l=map(int,open(0)) s=b=0 m=100 for i in l: s+=i if i%10: b=1; m=min(m,i) print((s-m*(s%10<1))*b)
p02765
s711837892
Accepted
N, R = map(int, input().split()) if N >= 10: print(R) else: print(R + 100*(10-N))
p03797
s981607200
Accepted
n,m = map(int,input().split()) r = min(n, m//2) m -= r*2 if m <= 3: pass else: r += m//4 print(r)
p03814
s268270204
Accepted
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits def input(): return sys.stdin.readline().strip() def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) sys.setrecursionlimit(10 ** 9) INF = float('inf') MOD = 10 ** 9 + 7 s = input() print(len(s)-s[::-1].index("Z")-s.index("A"))
p03377
s882960693
Accepted
a,b,x=map(int,input().split()) if x>=a and x<=a+b: print('YES') else: print('NO')
p02687
s700391648
Accepted
s=input() if s=="ABC": print("ARC") else: print("ABC")
p02862
s606056842
Accepted
x, y = map(int, input().split()) m = (-x+2*y)//3 n = (2*x-y)//3 mod = 10**9+7 def c(n, r): p, q = 1, 1 for i in range(r): p = p*(n-i)%mod q = q*(i+1)%mod return p * pow(q, mod-2,mod)%mod if (x+y)%3 !=0 or m*n < 0: print(0) else: print(c(m+n,n))
p03627
s404068618
Accepted
N = int(input()) A = list(map(int, input().split())) A.sort() A = A[::-1] # print(A) cnt = 1 length = [] for i in range(1, N): if A[i] == A[i-1]: cnt += 1 if cnt >= 2: length.append(A[i]) cnt = 0 if len(length) >= 2: break elif cnt == 0: cnt = 1 else: length = [0, 0] print(length[0] * length[1])
p04030
s431178660
Accepted
S = input() while True: if '0B' in S or '1B' in S: S = S.replace('0B','').replace('1B','') else: S = S.replace('B','') break print(S)
p03705
s333216507
Accepted
n,a,b = [int(x) for x in input().split()] if a > b: print(0) elif n == 1: if a != b: print(0) else: print(1) else: print((b-a)*(n-2)+1)
p03351
s799744711
Wrong Answer
a,b,c,d=map(int,input().split()) if abs(a-c)<=d: print('Yes') elif abs(a-b)<=d and abs(b-c): print('Yes') else: print('No')
p02963
s247585760
Accepted
S = int(input()) MAX_V = 10 ** 9 X3 = -S % MAX_V Y3 = (S + X3) // MAX_V print(0, 0, MAX_V, 1, X3, Y3)
p02995
s333864126
Accepted
from fractions import gcd def lcm(x,y): return (x * y) // gcd(x,y) A,B,C,D = map(int,input().split()) cnt = 0 cnt += ((B // C) - ((A-1) // C)) cnt += ((B // D) - ((A-1) // D)) tmp = ((B//lcm(C,D)) - ((A-1)//lcm(C,D))) ans = B-A+1-cnt+tmp print(ans)
p03001
s380293277
Accepted
w,h,x,y = map(int,input().split()) if w/2 == x and h/2 == y: print(w*h/2,end=' ') print(1) else: print(w*h/2,end=' ') print(0)
p02547
s350253972
Wrong Answer
n = int(input()) c = 0 for _ in range(n): d, e = map(int,input().split()) if d == e: c += 1 if c >= 3 : print('Yes') else: print('No')
p02993
s475117059
Wrong Answer
S = input() print(len(S)) for i in range(len(S)-1): if S[i] == S[i+1]: print("Bad") exit() print("Good")
p03030
s431666006
Accepted
N = int(input()) items = [] for i in range(N): item = list(input().split()) item[1] = abs(100 - int(item[1])) item.append(i+1) items.append(item) items = sorted(items) for i in items: print(i[2])
p02861
s279912237
Accepted
import itertools import math n=int(input()) lis=[list(map(int,input().split())) for i in range(n)] num=[j for j in range(n)] new=list(itertools.permutations(num)) ans=0 for i in range(len(new)): for j in range(n-1): a=new[i][j] b=new[i][j+1] ans+=math.sqrt((lis[a][0]-lis[b][0])**2+(lis[a][1]-lis[b][1])**2) print(ans/len(new))
p03345
s332630485
Wrong Answer
A,B,C,K = map(int,input().split()) for i in range(min(K,10**5)): A,B,C = B+C,C+A,A+B if abs(A-B)>=10**18: print("Unfair") else: print(A-B)
p02989
s371698608
Accepted
N=int(input()) L=sorted(list(map(int,input().split()))) print(L[int(N/2)]-L[int(N/2)-1])
p02802
s766613438
Wrong Answer
n,m=map(int,input().split()) cnt1=0 cnt2=0 flag=[-1]*(n+1) for _ in range(m): p,s=map(str,input().split()) p=int(p) if flag[p]==1: continue else: if s=='AC': cnt1+=1 flag[p]=1 else: cnt2+=1 print(cnt1,cnt2)
p03943
s796468452
Accepted
abc=list(map(int,input().split())) abc.sort() if abc[0]+abc[1]==abc[2]: print("Yes") exit() print("No")
p02684
s000671786
Wrong Answer
n, k = map(int,input().split()) a = list(map(int,input().split())) kaisuu = k % n ans = a[kaisuu] print(a[ans])
p02618
s896063020
Accepted
D = int(input()) C = list(map(int, input().split())) S = [list(map(int, input().split())) for _ in range(D)] N = 26 L = [0] * N for d in range(1, D + 1): mx = -10**18 nx = -1 for i, (c, l) in enumerate(zip(C, L)): r = c * (d - l) if mx < r: mx = r nx = i L[nx] = d print(nx + 1)
p02618
s405801799
Wrong Answer
import numpy as np d = int(input()) c = list(map(int, input().split())) sd = np.zeros((d, 26), dtype=np.int) for i in range(d): s = list(map(int, input().split())) s_array = np.array(s) sd[i, :] = s_array pp = np.zeros(26, dtype=np.int) for i in range(d): pp += c pp_max = np.argmax(pp)+1 pp_max_val = np.max(pp) sd_max = np.argmax(sd[i,:])+1 sd_max_val = np.max(sd[i,:]) if pp_max_val >= sd_max_val: t = pp_max -1 pp[pp_max-1] = 0 else: t = sd_max print(t)
p03001
s416515819
Wrong Answer
w,h,x,y=map(int,input().split()) if w/2==x and h/2==y: print(0.5,1) else: print(0.5,0)
p03481
s875087374
Wrong Answer
X,Y = map(int,input().split()) a = 1 x = X mul = min(X,2) cnt = 1 for i in range(10000): x *= mul if x>Y: cnt+=i break print(cnt)