problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03262
s777988455
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from fractions import gcd n, x = map(int, readline().split()) xx = list(map(int, readline().split())) gcd_ans = abs(x - xx[0]) for i in range(1, n): gcd_ans = gcd(gcd_ans, abs(x - xx[i])) print(gcd_ans)
p04043
s916083539
Accepted
class A: def solve(self): [a, b, c] = sorted([int(x) for x in input().split(" ")]) if a == 5 and b == 5 and c == 7: print("YES") else: print("NO") A().solve()
p02665
s932750504
Accepted
#!/usr/bin/env python3 n = int(input()) a = list(map(int, input().split())) if n == 0: print([-1, 1][a[0] == 1]) exit() if a[0] > 0: print(-1) exit() s = sum(a) ans = 1 dp = [0] * (n + 1) dp[0] = 1 for i in range(n): dp[i + 1] = min(s, 2 * dp[i]) ans += dp[i + 1] dp[i + 1] -= a[i + 1] s -= a[i + 1] if dp[i] <= 0: print(-1) exit() if dp[-1] < 0: print(-1) exit() print(ans)
p02797
s313201801
Wrong Answer
from sys import stdin n, k, s = map(int, stdin.readline().rstrip().split()) flag = 0 ans = 1 for i in range(n): print(ans) if flag < k: ans = s - ans flag += 1 else: ans = s + 1
p02597
s197970991
Accepted
import sys from collections import Counter sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline def solve(): _ = int(rl()) c = rl().rstrip() counter = Counter(c) red = counter['R'] white = counter['W'] red -= c[:red].count('R') white -= c[-white:].count('W') print(min(red, white)) if __name__ == '__main__': solve()
p02983
s596909651
Wrong Answer
L,R=[int(x) for x in input().strip().split()] ans=10**9+1 for i in range(L%2019,R%2019+1): for j in range(L%2019,R%2019+1): if i<j: ans=min((i*j)%2019,ans) print(ans)
p03030
s844230387
Accepted
(N,),*sp = [s.split() for s in open(0)] sp = [(s,-int(p),i+1) for i,(s,p) in enumerate(sp)] for _,_,i in sorted(sp): print(i)
p03474
s801019356
Wrong Answer
a,b=map(int,input().split()) s=input() if len(s) != a+b+1: print('No') else: if s[a] != '-': print('No') else: print('Yes')
p03434
s855943086
Accepted
import numpy as np n = int(input()) a = np.array(list(map(int, input().split()))) * (-1) a.sort() print(-1 * (sum(a[0::2]) - sum(a[1::2])))
p02779
s225448562
Wrong Answer
n = input() l = list(map(int,input().split())) l.sort() if len(l) == len(set(l)): print('Yes') else: print('No')
p02881
s814993698
Accepted
n=int(input()) def make_divisors(n): divisors = [0,0] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors[0]=(i) divisors[1]=(n//i) return divisors a=make_divisors(n) print(a[0]+a[1]-2)
p03339
s704971975
Wrong Answer
N = int(input()) S = list(input()) count = [(0, 0)] for i in range(1, N + 1): if S[i - 1] == 'E': count.append((count[-1][0] + 1, count[-1][1])) else: count.append((count[-1][0], count[-1][1] + 1)) # print('count', count) ans = 10**6 for i in range(N): e1, w1 = count[i] e2, w2 = count[-1] v = w1 + (e2 - e1) # print('v', v) ans = min(ans, v) print(ans)
p03262
s992318891
Wrong Answer
import math N,X = map(int,input().split()) x = list(map(int,input().split())) print(math.gcd(min(x)-X,max(x)-X))
p02951
s980707180
Accepted
A, B, C = map(int, input().split()) if B + C > A: print(C-(A-B)) else: print(0)
p03011
s375527566
Wrong Answer
P, Q, R = map(int, input().split()) list_m = [P+Q,R+Q,P+R,Q+R,R+P,Q+P] min = 100 for i in range(0,len(list_m)): if min > int(list_m[i]): min = list_m[i] print(min)
p02772
s261331970
Accepted
def solve(string): n, *a = map(int, string.split()) a = [_a % 2 == 1 or _a % 6 == 0 or _a % 10 == 0 for _a in a] return "APPROVED" if all(a) else "DENIED" if __name__ == '__main__': import sys print(solve(sys.stdin.read().strip()))
p02711
s607413891
Wrong Answer
N=input() if N in "7": print("Yes") else: print("No")
p03075
s919949364
Accepted
a = [int(input()) for i in range(6)] f = True for i in range(5): if a[4] - a[0] > a[5]: f = False if f: print('Yay!') else: print(':(')
p03261
s107568685
Wrong Answer
def main(): n = int(input()) result = True used = {str(input()): 0} for order in range(1,n): word = str(input()) if word in used or list(used.keys())[order - 1][-1] != word[0]: result = False print('No') break else: used.setdefault(word,0) if result: print('Yes') if __name__ == "__main__": main()
p02689
s157280489
Wrong Answer
#coding: utf-8 #coding: utf-8 N, M = map(int, input().split()) H = list(map(int, input().split())) d = {i:H[i-1] for i in range(1, N+1)} for i in range(M): a, b = map(int, input().split()) d[a] = max(d[a], H[b-1]) d[b] = max(d[b], H[a-1]) ans = 0 # print(d.values()) for i in range(N): if d[i+1] == H[i]: ans += 1 print(ans)
p03994
s738760132
Wrong Answer
s = input() k = int(input()) s = [i for i in s] for i,v in enumerate(s): if v == 'a': break if k <= 0: break if ord('z') - ord(v) + 1 <= k: s[i] = 'a' k -= ord('z') - ord(v) + 1 k %= 26 s[-1] = chr(ord(s[-1])+k) print(''.join(s))
p03427
s250195314
Wrong Answer
import math def maxdigit(N): digit=len(str(N)) if N==1: return 1 elif N==10**(digit-1): return 9*(digit-1) else: if digit==1: return N else: return 9*(digit-1)+int(str(N)[0])-1 N=int(input()) print(maxdigit(N))
p03038
s059567299
Wrong Answer
n, m = map(int, input().split()) a = list(map(int, input().split())) l = [] for i in range(m): l.append(list(map(int, input().split()))) l.sort(reverse=True) cnt = 0 for i in range(m): a += [l[i][1]] * l[i][0] cnt += l[i][0] if cnt >= n: break a.sort(reverse=True) print(sum(a[:n]))
p03944
s997862746
Accepted
w, h, n = list(map(int, input().split())) left = 0 right = w lower = 0 upper = h for i in range(n): x, y, a = list(map(int, input().split())) if a == 1: left = max(left, x) elif a == 2: right = min(x, right) elif a == 3: lower = max(lower, y) elif a == 4: upper = min(y, upper) if left > right or lower > upper: print(0) else: print((right-left)*(upper-lower))
p02814
s505874222
Accepted
from functools import reduce from fractions import gcd N, M, *A = map(int, open(0).read().split()) def lcm(x, y): return x * y // gcd(x, y) def sub_by_2(n): cnt = 0 while n % 2 == 0: n //= 2 cnt += 1 return cnt lcm_2 = [sub_by_2(n // 2) for n in A] if all(lcm_2[0] == v for v in lcm_2): num = reduce(lcm, [v // 2 for v in A]) res = M // num print(res // 2 + res % 2) else: print(0)
p03951
s146350443
Accepted
n=int(input()) s=input() t=input() for i in range(n): if s[i]==t[0]: if s[i:]==t[:n-i]: print(n+i) break else: print(2*n)
p03327
s279983518
Accepted
N = [int(_) for _ in input().split()][0] if N>=1000: print('ABD') else: print('ABC')
p03043
s215208561
Accepted
from math import log2 import decimal N, K = map(int, input().split()) decimal.getcontext().prec = 28 ans = decimal.Decimal(0) for i in range(1, N+1): if i < K: power = -(-(log2(K) - log2(i))//1) prob = decimal.Decimal(1/((2**power) * N)) else: prob = decimal.Decimal(1/N) #print(prob) ans = decimal.Decimal(ans + prob) #print(ans) print(ans)
p02970
s278718533
Wrong Answer
N, D = map(int, input().split()) D = 2*D + 1 print(N//D)
p02899
s521182525
Accepted
def main(): n = int(input()) a = [int(x) for x in input().split()] ans = [None] * n for idx, ea in enumerate(a): ans[ea-1] = idx+1 print(*ans) if __name__ == '__main__': main()
p03639
s094363810
Wrong Answer
import sys N = int(input()) A = list(map(int,input().split())) k = 0 l = 0 m = 0 for i in range(N): if A[i] % 4 == 0: m += 1 elif A[i] % 2 == 0: l += 1 else: k += 1 if N <= 3: if m > 0: print('Yes') sys.exit() if k > 0: print('No') sys.exit() else: print('Yes') sys.exit() if k <= m: print('Yes') else: print('No')
p03284
s547975867
Wrong Answer
N ,K = map(int,input().split()) print(N%K)
p03815
s037235623
Accepted
x = int(input()) ans = x//11*2 t = x%11 if t > 6: ans += 2 elif t > 0: ans += 1 print(ans)
p03557
s988416358
Wrong Answer
import bisect N = int(input()) al = list(map(int,input().split())) bl = list(map(int,input().split())) cl = list(map(int,input().split())) cnt = 0 for b in range(N): al_idx = bisect.bisect(al,bl[b]) cnt_ab = al_idx cl_idx = bisect.bisect(cl,bl[b]) cnt_bc = len(cl) - cl_idx cnt += cnt_ab*cnt_bc print(cnt)
p02598
s653617359
Wrong Answer
# coding: utf-8 def solve(*args: str) -> str: n, k = map(int, args[0].split()) A = tuple(map(int, args[1].split())) l, r = 0, max(A) while l+1 < r: m = (l+r)/2 cnt = 0 for a in A: cnt += -int(-a//m)-1 if k < cnt: l = m else: r = m return str(-int(-l//1)) if __name__ == "__main__": print(solve(*(open(0).read().splitlines())))
p03377
s586950587
Accepted
def main(): a, b, x = map(int, input().split()) if a <= x <= a + b: print("YES") else: print("NO") if __name__ == "__main__": main()
p03665
s811021180
Wrong Answer
N,P = map(int, input().split()) A = list(map(int, input().split())) even_num=0 odd_num=0 for a in A: if a%2==0: even_num+=1 else: odd_num+=1 ev_case = 2**even_num from math import factorial res=0 for i in range(P,odd_num+1,2): res += factorial(odd_num) / factorial(i) / factorial(odd_num - i) print(ev_case*res)
p02615
s016381985
Wrong Answer
n=int(input()) a=list(map(int,input().split())) print(sum(a)-min(a))
p03759
s240051986
Accepted
a, b, c = map(int,input().split()) if b - a == c - b: print("YES") else: print("NO")
p02786
s859199291
Accepted
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): H = int(readline()) cur = 1 cnt = 1 while 2 * cur <= H: cur *= 2 cnt *= 2 cnt += 1 print(cnt) if __name__ == '__main__': main()
p03779
s895271798
Wrong Answer
x = int(input()) time = 1 total = 0 while True: total += time if total > x: total -= time time -= 1 print(time + (x - total)) break elif total == x: print(time) break time += 1
p02789
s887363193
Accepted
n,m = map(int,input().split()) if (n==m): print("Yes") else: print("No")
p03293
s140003305
Wrong Answer
s=list(input()) t=list(input()) x=len(s) ch1=0 ch=0 for i in range(x): if s[i]==t[x-1-i]: ch+=1 for j in range(x): if s[j]==t[j]: ch1+=1 print('Yes') if ch==x or ch1==x else print('No')
p02880
s997087295
Wrong Answer
n = int(input()) for i in range(1,11): for j in range(1,11): if i*j == n: print("Yes") exit() print("No")
p02748
s443935148
Wrong Answer
import numpy as np A, B, M = map(int,input().split()) a = np.array([int(num) for num in input().split()]) a_min = np.min(a) b = np.array([int(num) for num in input().split()]) b_min = np.min(b) total_min= a_min + b_min for i in range(0, M): x, y, c = map(int,input().split()) min_can = a[x-1] + b[y-1] -c if total_min > min_can: taotal_min = min_can print(min_can)
p03471
s392007934
Wrong Answer
otoshidama = list(map(int,input().split())) flg = True while flg: for i in range(otoshidama[0]+1): yukichi =i for n in range(otoshidama[0]-yukichi+1): higuchi =n noguchi = otoshidama[0]-yukichi - higuchi if 10000*yukichi+5000*higuchi+1000*noguchi==otoshidama[1]: print("{} {} {}".format(yukichi,higuchi,noguchi)) flg = False if flg: print("-1 -1 -1")
p03105
s396207551
Accepted
a,b,c = map(int,input().split()) # b/aの商がcより大きければcを出力 if b // a > c: print(c) # そうでなければb/aの商を出力 else: print(b // a)
p02983
s232255194
Accepted
def main(): l, r = map(int, input().split()) ans = 2019 for i in range(l, r): for j in range(i + 1, r + 1): ans = min(ans, i * j % 2019) if ans == 0: break if ans == 0: break print(ans) if __name__ == "__main__": main()
p02628
s759197617
Wrong Answer
N, K = map(int, input().split()) price = input().split() price.sort() total = 0 for i in range(K): total = total + int(price[i]) print(total)
p03107
s560941276
Accepted
s=input() print(2*min(s.count("0"), s.count("1")))
p02664
s161829385
Accepted
T = str(input()) ans = "" for i in range(len(T)): if T[i] == "?": ans = ans + "D" else: ans = ans + T[i] print(ans)
p03206
s890678535
Accepted
C={25:'Christmas',24:'Christmas Eve',23:'Christmas Eve Eve',22:'Christmas Eve Eve Eve'} print(C[int(input())])
p02789
s200503408
Accepted
import sys input = sys.stdin.readline n, m = map(int, input().split()) if n == m: print("Yes") else: print("No")
p02959
s815885096
Accepted
N = int(input()) A = list(map(int,input().split())) ASUM = sum(A) B = list(map(int,input().split())) for i,b in enumerate(B): if A[i] > b: A[i] -= b continue else: b -= A[i] A[i] = 0 b -= A[i] if A[i+1] > b: A[i+1] -= b else: A[i+1] = 0 print(ASUM-sum(A))
p03076
s292817900
Accepted
import copy a = [list(map(int, input().split())) for _ in range(5)] b = copy.deepcopy(a) #二次元配列だと単純なコピーでは参照が残る。 a2 = [] diff = 0 total = 0 for i in range(5): b[i][0] = (0 - (-b[i][0]//10)*10) a2.append(b[i][0]) total = sum(a2) for i in range(5): diff1 = b[i][0] - a[i][0] diff = max(diff, diff1) ans = total - diff print(ans)
p02552
s220133453
Wrong Answer
x = int(input()) if x >= 0: print("1") else: print("0")
p02916
s906801182
Wrong Answer
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) anker=-1 ans=0 for i in range(1,n+1): cuisine=a.index(i) if cuisine-anker==1: print("おいしい") ans += c[i-2] anker = cuisine ans += sum(b) print(ans)
p02621
s803623782
Accepted
a = int(input()) print(a*(1+a+a*a))
p03804
s616938136
Wrong Answer
n, m = map(int, input().split()) a = [list(input()) for _ in range(n)] b = [list(input()) for _ in range(m)] flag = True for i in range(n): for j in range(n): if i + m > n and j + m > n: a[i : i + m][j : j + m] == b print('Yes') flag = False break if flag: print('No')
p02861
s830702619
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))
p03076
s438110556
Wrong Answer
abcde = [] abcde.append(int(input())) abcde.append(int(input())) abcde.append(int(input())) abcde.append(int(input())) abcde.append(int(input())) minVal = 0 total = 0 for x in abcde: mod = x % 10 if minVal == 0 and mod != 0: minVal = mod if minVal != 0 and mod != 0 and mod < minVal: minVal = mod if mod == 0: total += x - mod else: total += x + 10 - mod total += minVal - 10 print(total)
p03407
s144523970
Wrong Answer
a,b,c=map(int,raw_input().split()) if a+b>c: print "yes" else: print "no"
p03146
s394857280
Wrong Answer
s=int(input()) l=[] while (s not in l): l.append(s) if s%2==0: s//=2 else: s=3*s+1 print(l) print(len(l)+1)
p03943
s354519855
Wrong Answer
#abc047 a a,b,c=map(int,input().split()) if (a+b+c)%3==0: print("Yes") else: print("No")
p02778
s990650226
Accepted
S=list(input()) n=len(S) for i in range(n): S[i]="x" ans="".join(map(str,S)) print(ans)
p03644
s698778909
Accepted
#ABC068.B N = int(input()) for x in range(7): if 2**x <= N < 2**(x+1): print(2**x) break
p03773
s694999463
Accepted
a, b = map(int, input().split()) print(a+b-24 if a+b >= 24 else a+b)
p03380
s842389773
Accepted
n=int(input()) a=list(map(int,input().split())) m=max(a) r=0 for i in range(n): if abs(m/2-a[i])<abs(m/2-r): r=a[i] print(m,r)
p02676
s706377826
Wrong Answer
k = int(input()) s = input() l = len(s) if k <= l: print(s) if k > l: print(s[0:k]+"...")
p03220
s566903187
Wrong Answer
n=int(input()) t,a=map(int,input().split()) h=list(map(int,input().split())) ans=[] for i in range(n): ans.append(abs(int(abs(a)-abs(t-h[i]*0.006)))) print(ans.index(min(ans))+1)
p02912
s774411137
Accepted
import bisect import heapq n,m = map(int,input().split()) A = list(map(int,input().split())) A = list(map(lambda x: x*(-1), A)) heapq.heapify(A) for _ in range(m): a = -heapq.heappop(A)//2 heapq.heappush(A,-a) print(-sum(A))
p03137
s917006791
Accepted
n, m, *a = map(int, open(0).read().split()) a.sort() print(sum(sorted([a[i + 1] - a[i] for i in range(m - 1)])[:max(0, m - n)]))
p03760
s531555836
Accepted
o=list(input()) e=list(input()) k=[] for i in range(len(e)): k.append(o[i]) k.append(e[i]) if len(o)!=len(e):print(''.join(k)+o[-1]) else:print(''.join(k))
p02694
s996816135
Wrong Answer
X = int(input()) deposit = 100 count = 0 while deposit < X: deposit = deposit + (deposit * 0.01) int(deposit) count += 1 print(count)
p03161
s164791334
Wrong Answer
n,k = map(int,input().split()) h = list(map(int,input().split())) dp = [100000 for i in range(n)] dp[0] = 0 for i in range(n): for j in range(k+1): if i+j<n: dp[i + j] = min(dp[i] + abs(h[i] - h[i + j]), dp[i + j]) print(dp[n-1])
p02639
s967925749
Accepted
x = list(map(int,input().split())) for i in range(len(x)): if x[i] == 0: print(i+1)
p03017
s376752584
Accepted
N, A, B, C, D = map(int, input().split()) S = input() if '##' in S[A-1:max(C, D)]: print('No') elif C < D or ('...' in S[B-2:D+1]): print('Yes') else: print('No')
p03711
s217160290
Accepted
x, y = map(int, input().split()) A = set([1, 3, 5, 7, 8, 10, 12]) B = set([4, 6, 9, 11]) C = set([2]) for S in [A, B, C]: if x in S and y in S: print('Yes') break else: print('No')
p02917
s046008863
Accepted
N = int(input()) B = list(map(int,input().split())) A = [0]*N A[0] = B[0] A[N-1] = B[N-2] for i in range(1,N-1): if B[i] >= B[i-1]: A[i] = B[i-1] else: A[i] = B[i] print(sum(A))
p03627
s684619951
Wrong Answer
N=int(input()) *A,=map(int,input().split()) d={} for a in A: d[a] = d.get(a, 0)+1 s=sorted([k for k,v in d.items() if 2<=v], reverse=True) if len(s)<2: print(0) else: print(s[0]*s[1])
p02577
s766099526
Wrong Answer
n=input() t=0 for i in n: t+=int(i) if t//9==0: print('Yes') else: print('No')
p03435
s023561748
Accepted
c = [list(map(int, input().split())) for i in range(3)] res = 0 ans = 0 for i in range(3): res += sum(c[i]) ans += c[i][i]*3 if res == ans: print('Yes') else: print('No')
p03627
s232685700
Accepted
n = int(input()) l = list(map(int,input().split())) l1 = [0,0] from collections import Counter c = Counter(l) for i in c.items(): if i[1]>=2 : l1.append(i[0]) if i[1]>=4 : l1.append(i[0]) l1.sort() print(l1[-1]*l1[-2])
p02699
s165128856
Wrong Answer
S, W = list(map(int, input().split())) if S < W : print("unsafe") if S > W : print("safe")
p02706
s536921211
Accepted
#!/usr/bin/env python3 import sys import math def main(): N,M = map(int, input().split()) A = list(map(int, input().split())) print(max(-1, N-sum(A))) if __name__ == '__main__': main()
p02618
s748008505
Accepted
def solve(): D = int(input()) C = list(map(int, input().split())) S = [list(map(int, input().split())) for _ in range(D)] ans = [0]*D points = [0]*26 last = [-1]*26 for d in range(D): for i in range(26): points[i] = S[d][i]+C[i]*(d-last[i])*(d-last[i]+1)//2 maxi = 0 for i in range(26): if points[i]>maxi: con = i maxi = points[i] ans[d] = con+1 last[con] = d return ans print(*solve(),sep='\n')
p03486
s440565263
Accepted
import sys input = sys.stdin.readline def read(): S = input().strip() T = input().strip() return S, T def solve(S, T): s = ''.join(sorted(S)) t = ''.join(reversed(sorted(T))) return "Yes" if s < t else "No" if __name__ == '__main__': inputs = read() outputs = solve(*inputs) if outputs is not None: print("%s" % str(outputs))
p02802
s267484835
Accepted
n, m = map(int, input().split()) listAC = [0] * n listWAAC = [0] * n listWA = [0] * n for i in range(m): p, s = map(str, input().split()) p = int(p) - 1 if listAC[p] == 1: continue if s == 'AC': listAC[p] += 1 listWAAC[p] += listWA[p] continue listWA[p] += 1 print(sum(listAC), sum(listWAAC))
p02843
s918100157
Wrong Answer
x = int(input()) dp = [0]*200000 def max_sum(): global dp for i in range(x): for j in range(6): dp[i+100+j] += 1 return max_sum() print(min(dp[x], 1))
p02971
s445891027
Accepted
n = int(input()) a = [int(input()) for _ in range(n)] b = sorted(a,reverse=True) for i in range(n): if a[i] == b[0]: print(b[1]) else: print(b[0])
p04043
s613103878
Wrong Answer
I=input().split() if I[0]=="5" and I[1]=="7" and I[2]=="5": print("YES") else: print("NO")
p02819
s925230726
Wrong Answer
def is_prime(n): if n == 1: return False i = 2 while True: if i ** 2 >= n: return True if n % i == 0: return False i += 1 x = int(input()) for i in range(x+1, x ** 2): if is_prime(i): print(i) break
p03419
s904013152
Wrong Answer
_N, _M = map(int, input().split()) N = max(_N, _M) M = min(_N, _M) if N >= 3 or M >= 3: long = max(1, N - 2) short = max(1, M - 2) print(long * short) else: print(0)
p02606
s150915497
Accepted
l, r, d = map(int, input().split()) count = 0 for i in range(l, r+1): if i % d == 0: count += 1 print(count)
p03011
s362024963
Accepted
A = list(map(int, input().split())) ans = 10**1000 tmp = 0 for i in range(2): for j in range(i+1, 3): tmp = A[i] + A[j] ans = min(ans, tmp) print(ans)
p03720
s440305738
Wrong Answer
n, m = map(int , input().split()) am = [list(map(int,input().split())) for _ in range(m)] route = {} for a in am: if a[0] in route: route[a[0]] += 1 else : route[a[0]] = 1 if a[1] in route: route[a[1]] += 1 else : route[a[1]] = 1 routes = sorted(route.items()) for r in routes: print(r[1])
p02629
s064671739
Accepted
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(int(input())).lower())
p02556
s301865940
Wrong Answer
n = int(input()) c = [[int(i) for i in input().split()] for i in range(n)] x_0 = c[0][0] y_0 = c[0][1] x_1 = c[1][0] y_1 = c[1][1] l = abs(x_0 - x_1) + abs(y_0 - y_1) for i in range(1,n): x = c[i][0] y = c[i][1] l0 = abs(x_0 - x) + abs(y_0 - y) if l < l0: l = l0 x_0 = x y_0 = y print(l)
p02813
s296542066
Wrong Answer
import collections n = int(raw_input()) p = map(int,raw_input().split(' ')) q = map(int,raw_input().split(' ')) elems = range(1, n+1) res = {} c = [0] def perms(i, elems,res, c): if i == len(elems): res[tuple(elems)] = c[0] c[0]+=1 return for j in range(i, len(elems)): elems[j], elems[i] = elems[i], elems[j] perms(i+1, elems, res, c) elems[j], elems[i] = elems[i], elems[j] perms(0, elems, res, c) print abs((res[tuple(p)] - res[tuple(q)]))
p03759
s986262202
Accepted
a, b, c = map(int, input().split()) if b - a == c - b: print('YES') else: print('NO')