problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03000
s916014951
Wrong Answer
n, x = list(map(int, input().split())) l = list(map(int, input().split())) d = 0 ans = 1 for num in range(n) : d = d + l[num] if d <= x: ans += 1 else: print(ans) break
p03285
s292417695
Wrong Answer
n = int(input()) ans = False for c in range(1,101): for d in range(1,101): if (4 * c) + (7 * d) == n: ans = True break if ans: print("Yes") else: print("No")
p02982
s029149589
Accepted
n,d=list(map(int,input().split())) x=[input().split() for i in range(n)] result=[] result_hikaku=[] for j in range(n-1): for k in range(j+1,n): cnt=0 for l in range(d): cnt +=(int(x[j][l])-int(x[k][l]))**2 result.append((cnt)**(1/2)) result_hikaku.append(round((cnt)**(1/2))) count=0 for m in range(len(result)): if result[m]==result_hikaku[m]: count+=1 print(count)
p02823
s470791536
Wrong Answer
#n=int(input()) n,a,b=map(int,input().split()) #al=list(map(int,input().split())) #l=[list(map(int,input().split())) for i in range(n)] dif=b-a-1 if dif%2==0: print(min(b-1,n-a)) else: print(dif//2+1)
p02994
s708820640
Accepted
n, l = map(int, input().split()) ans = [l+i-1 for i in range(1, n+1)] mn = min(ans, key=lambda x: abs(x)) print(sum(ans) - mn)
p02924
s495426189
Accepted
n = int(input()) print((n-1)*n//2)
p03107
s655805378
Accepted
import math from math import gcd INF = float("inf") import sys input=sys.stdin.readline sys.setrecursionlimit(500*500) import itertools from collections import Counter,deque def main(): s = list(input().rstrip()) zero = 0 one = 0 for i in s: if i == "0": zero += 1 else: one += 1 print(2*min(zero,one)) if __name__=="__main__": main()
p03997
s777734788
Accepted
# 台形の面積 # (上底 + 下底)* 高さ / 2 # 入力 a = int(input()) b = int(input()) h = int(input()) # 処理 answer = int((a + b) * h / 2) print(answer)
p03785
s661728260
Accepted
n,c,k = [int(i) for i in input().split()] start = [] end = [] for i in range(n): t = int(input()) start.append(t) end.append(t+k) start.sort() end.sort() ind = 0 cnt = 0 while(ind<n): time = end[ind] for i in range(1,c+1): next_ind = ind + i if next_ind==n or start[next_ind]>time: break ind = next_ind cnt += 1 print(cnt)
p03637
s518303499
Accepted
input() a=list(map(int,input().split())) l=[1 if i%2==1 else 4 if i%4==0 else 2 for i in a] print('YNeos'[(2 in l and l.count(1)>l.count(4)) or (2 not in l and l.count(1)>l.count(4)+1)::2])
p02700
s993107707
Accepted
a,b,c,d=map(int,input().split()) if (c+b-1)//b<=(a+d-1)//d:print("Yes") else:print("No")
p03821
s856194825
Accepted
N = int(input()) A = [] B = [] for i in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) count = 0 for i in range(N): # print(count+A[N-i -1], B[N-i -1], (count+A[N-i -1]) % B[N-i -1]) if (count+A[N-i -1]) % B[N-i -1] == 0: continue else: count += B[N-i -1] - ((count+A[N-i -1]) % B[N-i -1]) print(count)
p02772
s470026844
Accepted
N = int(input()) xs = map(int,input().split()) ans = "APPROVED" for x in xs: if x%2 == 1 or x%3 == 0 or x%5 == 0: continue; ans ="DENIED" print(ans)
p03037
s807885844
Wrong Answer
N, M = map(int, input().split()) L_list = [] for i in range(M): A = list(map(int, input().split())) L_list.append(A) min_range = L_list[0][0] max_range = L_list[0][1] for i in range(i, M): if L_list[i][0] >= min_range: min_range = L_list[i][0] if L_list[i][1] <= max_range: max_range = L_list[i][1] print(max_range-min_range+1)
p02862
s861242905
Accepted
from functools import reduce X,Y = map(int,input().split()) x = (-X+2*Y) /3 y = (2*X-Y) /3 #ans=0のときをどっかで書く。indentめんどいからどうする? MOD = 10**9+7 if int(x) == x and int(y) == y and x>=0 and y>=0 : sum1 = int(x+y) bunbo = min([int(x),int(y)]) n1 = reduce(lambda a,b : (a*b) % MOD ,range(sum1,sum1-bunbo,-1),1) n2 = reduce(lambda a,b : (a*b) % MOD ,range(bunbo,1,-1),1) n2inv = pow(n2,MOD-2,MOD) print((n1*n2inv) % MOD) else: print(0)
p03774
s563062561
Wrong Answer
N, M = map(int, input().split()) ab = [tuple(map(int, input().split())) for i in range(N)] cd = [tuple(map(int, input().split())) for i in range(M)] for a, b in ab: ret = -1 dis = 10**20 for i, x in enumerate(cd): c, d = x if dis > (c-a)**2 + (d-b)**2: dis = (c-a)**2 + (d-b)**2 ret = i print(ret+1)
p02933
s647794128
Accepted
a=int(input()) s=str(input()) if a<3200: print('red') else: print(s)
p03150
s926942225
Wrong Answer
import sys def input(): return sys.stdin.readline().rstrip() def main(): s=input() ke="keyence" cunt=0 for i in range(len(s)): if s[i]==ke[cunt]: cunt+=1 if cunt==7: print("YES") break else:print("NO") if __name__=='__main__': main()
p03317
s007318867
Accepted
n, k = map(int, input().split()) a = list(map(int, input().split())) # 1以外の要素n-1個を、k-1で割る(1項ずつ重複させるため)。余りは1回と数えるので、切り上げる print(-((-n+1) // (k-1)))
p03041
s824979693
Wrong Answer
n,k=map(int,input().split()) s=input() s=s.replace(s[k-1],s[k-1].lower()) print(s)
p03695
s735379833
Wrong Answer
N = int(input()) a = list(map(int, input().split())) #print(a) ans = [0] * 8 free = 0 for r in a: if r > 3199: free += 1 else: ans[r // 800] = 1 min_ = max(sum(ans), 1) #max_ = min(sum(ans) + free, 8) max_ = sum(ans) + free print(min_, max_)
p03611
s533633975
Accepted
from collections import Counter N = int(input()) a = list(map(int, input().split())) b = Counter(a) ans = 0 X = 0 for i in b.keys(): if X < b[i-1] + b[i] + b[i+1]: X = b[i-1] + b[i] + b[i+1] print(X)
p02848
s581320369
Accepted
N=int(input()) S=list(input()) x=N-((N//26)*26) empty=[] for i in S: if ord(i)+x>90: a=chr(ord(i)+x-26) empty.append(a) else: a=chr(ord(i)+x) empty.append(a) y=''.join(empty) print(y)
p03345
s153834647
Accepted
a, b, c, k = map(int, input().split()) if (k % 2 == 1): print(-1 * (a - b)) else: print(a-b)
p02691
s410516047
Wrong Answer
from collections import Counter N = int(input()) A = list(map(int, input().split())) p = [i+Ai for i, Ai in zip(range(1, N+1), A)] q = [j-Aj for j, Aj in zip(range(1, N+1), A)] pc = Counter(p) qc = Counter(q) r = sum(pc[k]*qc[k] for k in pc.keys() & qc.keys())
p03815
s885456763
Accepted
x = int(input()) s = x // 11 a = x % 11 #print(s, a) if 1 <= a <=6: print(2*s + 1) elif 7 <= a < 11: print(2*s + 2) elif a == 0: print(2*s)
p03711
s142701596
Accepted
x, y = map(int, input().split()) a = [1, 3, 5, 7, 8, 10, 12] b = [4, 6, 9, 11] c = [2] if (x in a and y in a) or (x in b and y in b) or (x in c and y in c): print('Yes') else: print('No')
p03767
s318887868
Wrong Answer
N = int(input()) a = sorted(list(map(int, input().split())), reverse=True) total = 0 for i in range(1, 1 + N + 1, 2): total += a[i] print(total)
p03329
s728613425
Wrong Answer
# coding: utf-8 # https://atcoder.jp/contests/abc099/tasks # 15:00- def main(): N = int(input()) ans = 0 while True: if N < 6: ans += N return ans n = 0 while 9**(n+1) <= N: n += 1 m = 0 while 6**(m+1) <= N: m += 1 N -= max(9**n, 6**m) ans += 1 print(main())
p02861
s720125479
Accepted
from math import sqrt from itertools import permutations def dict(p, q): return sqrt((p[0]-q[0])**2 + (p[1]-q[1])**2) n = int(input()) coord = [] for _ in range(n): coord.append([int(i) for i in input().split()]) sum = cnt = 0 for c in permutations(coord): for i in range(n-1): sum += dict(c[i], c[i+1]) cnt += 1 print(sum/cnt)
p03241
s599321379
Accepted
from math import sqrt from bisect import bisect_left N,M = map(int,input().split()) t = M #約数全列挙 for i in range(1,int(sqrt(M))+2,1): if M % i ==0: count = 0 if M % i == 0: if N <= i and i <= t: t = i if N <= M//i and M//i <= t: t = M//i print(M//t)
p03838
s239679745
Accepted
a, b= map(int, input().split()) num = abs(abs(a)-abs(b)) if a * b < 0: num += 1 elif a * b == 0 and a > b: num += 1 elif a * b > 0: if a < 0 and abs(a) < abs(b): num += 2 elif a > 0 and abs(a) > abs(b): num += 2 print(num)
p02882
s268890773
Accepted
import math a, b, x = map(int, input().split()) c = (2*x)/(a**2)-b if c <= 0: c = (2*x)/(a*b) print(math.degrees(math.atan2(b, c))) else: print(math.degrees(math.atan2(b-c, a)))
p02714
s347622456
Accepted
n=int(input()) s=input() r=s.count("R") g=s.count("G") b=s.count("B") ct=r*g*b for i in range(n-2): for j in range(i+1,n-1): k=2*j-i if k<=n-1: if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]: ct-=1 print(ct)
p02988
s869532430
Wrong Answer
n = int(input()) p = list(map(int,input().split())) count = 0 for i in range(1,n-1): tmp = sorted([p[i-1],p[i],p[2]]) if tmp[1] == p[i]: count+=1 print(count)
p02953
s521121840
Wrong Answer
def main(n: int, h: list): m = h[0] for i in h: if i - 1 > m: print('No') return elif i + 1 > m: m = i print('Yes') if __name__ == "__main__": n = int(input()) m = list(map(int, input().split())) main(n, m)
p03360
s155108127
Wrong Answer
abc = list(map(int, input().split())) k = int(input()) abc.sort() abc[2] = abc[2] * 2 * k print(sum(abc))
p02790
s982191557
Accepted
a, b = [i for i in input().split()] A = a*int(b) B = b*int(a) if A > B: print(B) exit() print(A)
p02958
s645697279
Wrong Answer
n = int(input()) plst = list(map(int,input().split())) cnt = 0 for i in range(len(plst)-1): if plst[i+1] - plst[i] != 1: cnt += 1 if cnt <= 2: print("YES") else: print("NO")
p03377
s634616276
Accepted
def main(): A, B, X = map(int, input().split()) if A + B < X: print('NO') elif A > X: print('NO') else: print('YES') main()
p03323
s951957352
Wrong Answer
a,b = map(int,input().split()) if min(a,b)*2+(max(a,b)-min(a,b))*2<=16: print('Yey!') else: print(':(')
p02631
s551822371
Accepted
n=int(input()) arr=list(map(int,input().split())) xors=0 for val in arr: xors^=val ans=[] for i in range(n): ans.append(xors^arr[i]) print(*ans)
p02939
s582539053
Accepted
S = input() ans = 0 prev, now = "", "" for i in range(len(S)): now += S[i] if now != prev: ans += 1 prev, now = now, "" print(ans)
p02754
s485531632
Wrong Answer
n,a,b = map(int,input().split()) dars = n // (a+b) amari = n % (a+b) if b == 0: print(n) exit() if amari < b: ans = dars*a + amari else: ans = dars*a + a print(ans)
p02823
s333571834
Accepted
N, A, B = [int(i) for i in input().split()] ans = (B-A)//2 if (B-A) % 2 == 1: ans += min(A-1, N-B)+1 print(ans)
p03012
s307875596
Wrong Answer
n = int(input()) w = list(map(int, input().split())) m = sum(w)//2 for i in range(1,n): if sum(w[:i]) >= m: print(abs(sum(w[:i]) - sum(w[i:]))) exit()
p03012
s113345779
Accepted
def solve(): N = int(input()) A = list(map(int, input().split())) c = 10 ** 9 for i in range(1, N): a = A[:i] b = A[i:] c = min(c, abs(sum(a) - sum(b))) return c print(solve())
p02765
s449113995
Accepted
n, r = map(int, input().split()) if n<10: print(100*(10-n) + r) else: print(r)
p02836
s840365752
Accepted
s = list(input()) if len(s)%2!=0: point = int((len(s)-1)/2) count = 0 for i in range(0,int((len(s)-1)/2+1)): if s[point-i]!=s[point+i]: count += 1 print(count) exit() elif len(s)%2==0: point1 = int(len(s)/2-1) point2 = int(len(s)/2) count = 0 for i in range(0,int(len(s)/2)): if s[point1-i]!=s[point2+i]: count += 1 print(count)
p03386
s845577875
Accepted
a,b,k= map(int, input().split()) c = min(k, b-a+1) x = [a+i for i in range(c)] y = [b-i for i in range(c)] z = sorted(list(set(x+y))) for i in z: print(i)
p02768
s225080937
Wrong Answer
n,a,b=map(int,input().split()) p=10**9+7 sub=((n*(n+1))/2)%p sub=(sub*(n-1)/3)%p sub1=(a*(a-1)/2)%p sub2=(b*(b-1)/2)%p print((sub-sub1-sub2)%p)
p02947
s673716030
Wrong Answer
import math n = int(input()) d = {} for i in range(n): s = "".join(sorted(input())) if s in d: d[s] += 1 else: d[s] = 0 _ans = 0 for k, v in d.items(): if v == 0: continue _ans += math.factorial(v + 1) // 2 print(_ans)
p02836
s357313956
Accepted
S=str(input()) count=0 for i in range(len(S)//2): if S[i]!=S[-(i+1)]: count+=1 print(count)
p02791
s990660636
Accepted
import sys stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().rstrip() # ignore trailing spaces n = ni() p = na() m = p[0] ans = 0 for i in range(n): #print(m, p[i]) if m >= p[i]: ans += 1 m = min(m, p[i]) print(ans)
p02726
s556562616
Accepted
N, X, Y = list(map(int, input().split())) L = [0] * N for i in range(1, N): for j in range(i + 1, N + 1): k = j - i k = min(k, abs(X - i) + 1 + abs(Y - j)) L[k] += 1 for i in range(1, N): print(L[i])
p02866
s737395042
Accepted
n = int(input()) d = list(map(int,input().split())) m = 998244353 import collections c = collections.Counter(d) if c[0] == 1 and d[0] == 0: ans = 1 else: ans = 0 d = sorted(d) for i in range(1,n): ans *= c[d[i]-1] ans %= m print(ans)
p02802
s571798776
Wrong Answer
n,m = map(int,input().split()) ac, wa=[], {} for i in range(m): p,s = map(str, input().split()) if s=='AC': ac.append(p) elif (s=='WA') and (p not in ac): if p not in wa.keys(): wa[p]=1 else: wa[p]+=1 penalty = sum(wa.values()) clear = len(ac) print('%d %d'%(clear,penalty))
p03721
s603596602
Wrong Answer
n, k = map(int, input().split()) ab = [tuple(map(int, input().split())) for _ in range(n)] sm = 0 for a, b in ab: sm += b if sm >= k: print(a) break
p02647
s477171808
Accepted
from itertools import accumulate import sys n, k = map(int, input().split()) arr = list(map(int, input().split())) for cnt in range(k): tmp = [0] * (n + 2) for i in range(n): power = arr[i] left = max(0, i - power + 1) right = min(n + 1, i + power + 2) tmp[left] += 1 tmp[right] -= 1 arr = list(accumulate(tmp))[1:-1] if cnt > 40: arr = [n] * n print(*arr) sys.exit() print(*arr)
p03434
s069073581
Accepted
import math n = int(input()) li=list(map(int,input().split())) li.sort(reverse = True) al = 0 bo = 0 for i in range(0, n, 2): al += li[i] if (n % 2 == 1 and i == n - 1): break bo += li[i + 1] print(al-bo)
p04029
s961795982
Accepted
N=int(input()) ans=(N+1)*(N/2) print(int(ans))
p03817
s499334059
Wrong Answer
""" 回転した後に得られる点数 = 上と下を向いている面以外の面に書かれている数 6→5→6→...と選んでいけばよさそう。 """ X = int(input()) if X < 6: print(1) elif X < 11: print(2) else: cnt = X // 11 X -= cnt * 11 if X == 0: print(cnt * 2) elif X < 6: print(cnt * 2 + 1) else: print(cnt * 2 + 2)
p03479
s048804932
Wrong Answer
import math x, y = map(int, input().split()) print(int(math.log2(y//x) + 1))
p02677
s839984785
Accepted
import math a, b, h, m = map(int, input().split()) m_a = m * 6 h_a = h * 30 if m > 0: h_a = h_a + m * 0.5 print(math.sqrt(a ** 2 + b ** 2 - (2 * a * b * math.cos(math.radians(max(m_a, h_a) - min(m_a, h_a))))))
p03474
s958800275
Accepted
a, b = map(int, input().split()) s = input() flg1 = s[:a].isdecimal() flg2 = s[a] == "-" flg3 = s[-b:].isdecimal() flg = flg1 and flg2 and flg3 print(["No", "Yes"][flg])
p02879
s616512346
Accepted
a, b = map(int, input().split()) if 1 <= a <= 9: if 1 <= b <= 9: print(a * b) else: print(-1) else: print(-1)
p04044
s272583519
Wrong Answer
from sys import stdin, stdout from time import perf_counter import sys sys.setrecursionlimit(10**9) mod = 10**9+7 n,l = map(int, input().split()) s = [input() for _ in range(n)] s.sort() result = ''.join(s) print(s)
p02792
s199453451
Accepted
n = int(input()) arr = [[0 for _ in range(10)] for _ in range(10)] for i in range(1,n+1): bot=i%10 if bot==0: continue top=i while top>=10: top=top//10 arr[top][bot]+=1 ans=0 for i in range(10): for j in range(10): ans+=arr[i][j]*arr[j][i] print(ans)
p03693
s706374059
Wrong Answer
# -*- coding: utf-8 -*- # スペース区切りの整数の入力 b, c, d = map(int, input().split()) #3桁の数 cin = 100*b+10*c+d #倍数判定 if cin % 3==0: print('YES') elif cin % 4==0: print('YES') else: print('NO')
p02909
s595027291
Wrong Answer
S = input() if S == 'Sunny': print('cloudy') elif S == 'cloudy': print('Rainy') elif S == 'Rainy': print('Sunny')
p03723
s829463629
Wrong Answer
## A - Cookie Exchanges A, B, C = map(int, input().split()) if A == B == C: ans = -1 else: ans = 0 while A%2 == B%2 == C%2 == 0: a = (B+C) // 2 b = (C+A) // 2 c = (A+B) // 2 A = a B = b C = c ans += 1 print(ans)
p02747
s834998892
Accepted
S = input() hitachi = ['hi'*i for i in range(1,6)] if S in hitachi: print('Yes') else: print('No')
p03612
s095843041
Accepted
import sys from collections import * import heapq import math import bisect from itertools import permutations,accumulate,combinations,product from fractions import gcd def input(): return sys.stdin.readline()[:-1] mod=10**9+7 n=int(input()) p=list(map(int,input().split())) now=0 ans=0 for i in range(n): if now==1: now=0 if (i+1)==p[i]: ans+=1 else: ans+=1 elif (i+1)==p[i]: now=1 print(ans+now)
p03760
s766849245
Accepted
o = input() e = input() ans = "" for i in range(len(e)): ans += o[i] + e[i] if len(o) != len(e): ans += o[-1] print(ans)
p04045
s544982661
Accepted
import sys import math sys.setrecursionlimit(10 ** 7) def input() : return sys.stdin.readline().strip() def INT() : return int(input()) def MAP() : return map(int,input().split()) def LIST() : return list(MAP()) def NIJIGEN(H): return [list(input()) for i in range(H)] N,K=MAP() L=list(input().split()) L=set(L) for i in range(N,100000): if set(str(i))&L==set(): print(i) exit()
p02720
s553049993
Wrong Answer
K=int(input()) i=0 current_num=0 while (i<K) : current_string=str(current_num) flag=True for k in range(len(current_string)-1) : if abs(int(current_string[k])-int(current_string[k+1]))>1 : flag=False break if flag==True : i+=1 current_num+=1 print(current_num)
p03611
s276605590
Accepted
import numpy as np N = int(input()) A = np.array(input().split(), dtype = np.int32) counter = np.bincount(A) if len(counter) <= 2: answer = counter.sum() else: answer = (counter[2:] + counter[1:-1] + counter[:-2]).max() print(answer)
p02675
s209949763
Accepted
N=input() if N[-1]=='3': print('bon') elif N[-1]=='0' or N[-1]=='1' or N[-1]=='6' or N[-1]=='8': print('pon') else: print('hon')
p03360
s019212204
Wrong Answer
a, b, c = map(int, input().split()) k = int(input()) max_value = max([a, b, c]) res = max_value * k + a + b + c print(res)
p02624
s382295950
Accepted
def solve(n): su = 0 for i in range(1, n+1): m = n//i su += m*(2*i + (m-1)*i)//2 return su n = int(input()) print(solve(n))
p02783
s756905357
Accepted
h,a=map(int,input().split());print((h+a-1)//a)
p02963
s666604267
Wrong Answer
s = int(input()) a = s//10**9+1; b = 10**9-s%10**9 print(0, 0, 1, a, 10**9, b)
p02596
s611593015
Wrong Answer
n = int(input()) ans,c = 0,0 while 1: c+=1 f=0 for i in range(10): if ((ans%10)+((n%10)*i)%10)%10==1: ans += n*i #print(ans,i) f=1 break if f==0: print(-1) exit() ans = ans//10 if ans==0: break print(c)
p03076
s181253855
Accepted
a=int(input()) b=int(input()) c=int(input()) d=int(input()) e=int(input()) l=[a,b,c,d,e] s=[] t=[] x=0 for i in range(5): s.append(l[i]%10) for i in range(5): if s[i]==0: t.append(l[i]) else: t.append((l[i]//10+1)*10) for i in range(1,10): if s.count(i)>0: x=10-i break print(sum(t)-x)
p02714
s013434019
Wrong Answer
n = int(input()) s = input() ans = 0 for k in range(n): for j in range(k + 1): for i in range(j + 1): if j - i != k - j: if s[k] != s[j] != s[i]: ans = ans + 1 print(ans)
p02783
s014340350
Accepted
h, a = map(int, input().split()) ttk = h // a if h%a != 0: ttk += 1 else: ttk = ttk print(ttk)
p02724
s209942773
Accepted
n = int(input()) ans = (n//500) * (1000) rem = ((n%500)//5) * 5 ans = ans + rem print(ans)
p03696
s600904040
Accepted
from collections import deque N = int(input()) S = list(input()) res = deque() pcnt = 0 for s in S: if s == '(': pcnt += 1 else: if pcnt: pcnt -= 1 else: res.appendleft('(') res.append(s) if pcnt: res.append(')' * pcnt) print(*res, sep='')
p02726
s420407695
Accepted
import collections as col n,x,y = map(int,input().split()) dist = [] for i in range(1,n+1): for j in range(i+1,n+1): a = abs(i - j) b = abs(i - x) + 1 + abs(j - y) c = abs(i - y) + 1 + abs(j - x) dist.append(min(a,b,c)) cnt = col.Counter(dist) for i in range(1,n): print(cnt[i])
p03852
s579767069
Wrong Answer
a = ['a','e','i','u','e'] if input() in a: print('vowel') else: print('consonant')
p03774
s123617413
Wrong Answer
N, M = map(int, input().split()) man = [[int(x) for x in input().split()] for _ in range(N)] check = [[int(x) for x in input().split()] for _ in range(M)] for a, b in man: tmp = 1000000000 ans = 1 for i, (c, d) in enumerate(check): if tmp > (abs(a-c) + abs(b-d)): tmp = min(tmp, abs(a-c) + abs(b-d)) print(ans)
p03419
s675609017
Accepted
N, M = map(int, input().split()) if N == 1 and M == 1: print(1) elif N == 1: print(M-2) elif M == 1: print(N-2) else: print((N-2)*(M-2))
p03437
s575079900
Accepted
import sys input = sys.stdin.readline # A - Two Integers x, y = map(int, input().split()) if x % y == 0: print(-1) else: i = 2 while True: if (x * i) % y != 0: print(x * i) break else: i += 1
p02744
s459549228
Accepted
N=int(input()) L=['a','b','c','d','e','f','g','h','i','j'] Ans = [L[0]] Backup = [] for k in range(N-1): Backup = Ans Ans = [i+L[j] for i in Backup for j in range(len(set(i))+1)] for i in Ans: print(i)
p03208
s507194552
Accepted
n,k=map(int,input().split()) h=[int(input()) for _ in range(n)] h.sort() l=[] for i in range(n-k+1): l.append(h[i+k-1] - h[i]) print(min(l))
p03481
s919182464
Wrong Answer
a, b = map(int,input().split()) if b < 2*a: print(1) else: print((b-a)//a+1)
p03625
s572940660
Accepted
N = int(input()) A = list(map(int,input().rstrip().split(" "))) A.sort() lis = [] for i in range(len(A) - 1): if A[i] == A[i + 1]: lis.append(A[i]) A[i + 1] = 0 if len(lis) < 2: print(0) else: print(lis[-1] * lis[-2])
p02646
s382873142
Accepted
a,v = map(int,input().split()) b,w = map(int,input().split()) t = int(input()) if w < v and (v-w)*t >= abs(a-b): print("YES") else: print("NO")
p03379
s779406694
Accepted
N = int(input()) X = list(map(int, input().split())) x = sorted(X) ans_1 = x[N // 2 - 1] ans_2 = x[N // 2] ans = [] for i in range(N): if X[i] <= ans_1: ans.append(ans_2) else: ans.append(ans_1) print(*ans, sep="\n")
p02879
s068543198
Accepted
a,b = map(int,input().split()) if a<=9 and b<=9: print(a*b) else: print(-1)