problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03076
s456799611
Accepted
import math def C(x): return math.ceil(x/10)*10 def I(): return int(input()) def S(x): s=str(x) if s[-1]!='0': return 10-int(s[-1]) else: return 0 a,b,c,d,e=I(),I(),I(),I(),I() sum=C(a)+C(b)+C(c)+C(d)+C(e) x=max(S(a),max(S(b),max(S(c),max(S(d),S(e))))) print(sum-x)
p02951
s649700326
Wrong Answer
A, B, C = map(int, input().split()) print(C - (A - B))
p02601
s822991726
Accepted
a, b, c = list(map(int, input().split())) k = int(input()) ans = False for i in range(k): if c <= b: c *= 2 elif b <= a: b *= 2 else: ans = True break if c > b and b > a: ans = True if ans: print("Yes") else: print("No")
p03475
s647057939
Accepted
n = int(input()) csf = [list(map(int,input().split())) for i in range(n-1)] t = [[0] * n for i in range(n)] for i in range(n-1): cc, cs, cf = csf[i][0], csf[i][1], csf[i][2] t[i][i] = cs for j in range(1+i): cs = csf[i][1] while t[j][i] > cs: cs += cf t[j][i+1] = cs + cc for i in range(n): print(t[i][n-1])
p02777
s530015522
Accepted
a,b=[i for i in input().split()] n,m=[int(i) for i in input().split()] s=input() if s == a: n-=1 else: m-=1 print(n,m)
p03986
s086990367
Wrong Answer
X = input().rstrip() + "#" s0 = X[0] P = [] cnt = 1 for s in X[1:]: if s==s0: cnt += 1 else: P.append(cnt) cnt = 1 s0 = s res = 0 if X[0] == "T": res = P[0]*2 if X[-2] == "S": res = max(P[-1]*2, res) print(res)
p03062
s654016428
Accepted
N = int(input()) A = list(map(int, input().split())) abss = [abs(A[i]) for i in range(N)] minus = [A[i] for i in range(N) if A[i] < 0] if len(minus) % 2 == 0: ans = sum([abs(A[i]) for i in range(N)]) print(ans) else: abss.sort() ans = -abss[0] + sum(abss[1:]) print(ans)
p02835
s960436301
Accepted
a, b, c = map(int, input().split()) if a + b + c >= 22: print("bust") elif a + b + c <= 21: print("win")
p03126
s638861244
Accepted
n, m = map(int, input().split()) an = [] for i in range(n): l = [int(num) for num in input().split()] an.append(l[1:]) check = {} for i in an: for j in i: if j not in check: check[j] = 1 else : check[j] += 1 answer = 0 for v in check.values() : if v == n: answer +=1 print(answer)
p03699
s114152856
Accepted
N = int(input()) s_10 = [] s_not_10 = [] for _ in range(N): s = int(input()) if s % 10 == 0: s_10.append(s) else: s_not_10.append(s) if len(s_not_10) == 0: print(0) exit(0) s_not_10_sum = sum(s_not_10) if s_not_10_sum % 10 != 0: print(s_not_10_sum+sum(s_10)) exit(0) s_not_10.sort() print(s_not_10_sum+sum(s_10)-s_not_10[0])
p02829
s229081084
Accepted
a = int(input()) b = int(input()) lst = [1, 2, 3] for i in lst: if a != i and b != i: print(i)
p03657
s828941800
Wrong Answer
A,B = map(int,input().split()) if (A+B)%3==0 or A>=3 or B >=3: print("Possible") else: print("Impossible")
p03103
s383904901
Wrong Answer
n, m = map(int, input().split()) drink = {} for i in range(n): a, b = map(int, input().split()) drink[a] = b ans = 0 for ai, bi in sorted(drink.items(), key=lambda x:x[0]): ans += ai * min(drink[ai], m) m -= drink[ai] if m <= 0: break print(ans)
p03073
s749351815
Accepted
x = input() N = len(x) x1 = "01" * (N//2) x2 = "10" * (N//2) if N%2 == 1: x1 = x1 + "0" x2 = x2 + "1" count1 = 0 count2 = 0 for x, y, z in zip(x, x1, x2): if x != y: count1 += 1 if x != z: count2 += 1 count = min(count1, count2) print(count)
p03264
s460100303
Accepted
N = int(input()) print((N//2)*((N-1)//2+1))
p03324
s844061040
Wrong Answer
D,N = map(int, input().split()) if N == 100: n = 2 else: n = 0 print(N*(100**(D-n)))
p03220
s934566977
Accepted
n = int(input()) t, a = map(int, input().split()) h = list(map(int, input().split())) for i in range(n): i_temperature = t - h[i]*0.006 dif_a = abs(a - i_temperature) if i == 0: champ = dif_a if champ >= dif_a: champ = dif_a ans = i+1 print(ans)
p03557
s374076245
Accepted
import bisect n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) a.sort() b.sort() c.sort() sum = 0 for i in range(n): l = bisect.bisect_left(a,b[i]) r = bisect.bisect_right(c,b[i]) sum += l*(n-r) print(sum)
p03457
s487571778
Wrong Answer
N = int(input()) now = [0,0] tnow = 0 ans = 'Yes' for i in range(N): t,x,y = map(int,input().split()) dis = abs(x-now[0]) + abs(y-now[1]) if t-tnow < dis: ans = 'No' break tnow = t now = [x,y] print(ans)
p04031
s178125607
Accepted
n = int(input()) a = list(map(int, input().split())) aa = 10 ** 9 for i in range(min(a), max(a) + 1): ans = 0 for j in a: ans += (j - i) ** 2 aa = min(aa, ans) print(aa)
p04033
s711620339
Accepted
# https://atcoder.jp/contests/agc002/tasks/agc002_a a, b = map(int, input().split()) if a > 0 and b > 0: print('Positive') elif a <= 0 and 0 <= b: print('Zero') else: d = b - a if d % 2 == 0: print('Negative') else: print('Positive')
p02597
s441529246
Accepted
a = int(input()) l=list(input()) b = l.count("R") s = 0 for i in range(b): if l[i]=="W": s = s+1 print(s)
p03419
s627613440
Accepted
n,m = sorted(list(map(int, input().split()))) if n==1: if m==1: print(1) else: print(m-2) elif n==2: print(0) else: print((n-2)*(m-2))
p02900
s374864865
Wrong Answer
from math import gcd A, B = map(int, input().split()) D = gcd(A, B) d = D ans = 1 i = 2 while i <= pow(D, 1/2): if d%i == 0: ans += 1 while d%i == 0: d //= i i += 1 print(ans)
p03761
s814464986
Wrong Answer
from collections import Counter n = int(input()) s = [input() for _ in range(n)] ct = {} ans = '' for i in s: C = Counter(i) for j in C.items(): ct[j[0]] = min(ct.get(j[0], 27), j[1]) for j in ct.items(): ct[j[0]] = min(j[1], C.get(j[0], 0)) ct = sorted(ct.items()) for i in ct: ans += i[0] * i[1] print(ans)
p02612
s884011906
Wrong Answer
#n,m=map(int,input().split()) a=int(input()) print(1000-(a%1000))
p02681
s848089832
Wrong Answer
s = input() t = input() if s[0:-1] == t[0:-2]: print("Yes") else: print("No")
p03126
s452034710
Accepted
N, M = map(int, input().split()) cnt = [0] * M for i in range(N): line = list(map(int, input().split()))[1:] for j in line: cnt[j-1] += 1 ans = sum([1 if i == N else 0 for i in cnt]) print(ans)
p02548
s213771069
Wrong Answer
n=int(input()) ar=3 sv=[0]*(10**6+2) for i in range(2,len(sv)): if not sv[i]: sv[i]=i for j in range(2*i,len(sv),i): sv[j]=i def di(x): an=1 if sv[x]==x: return 2 while x>1: ct=0;cr=sv[x] while x%cr==0: ct+=1;x//=cr an*=(ct+1) return an for i in range(4,n+1): ar=ar+di(i-1) print(ar)
p02848
s845931898
Accepted
N=int(input()) S=input() print(*[chr((ord(c)-65+N)%26+65) for c in S],sep='')
p02571
s949275031
Wrong Answer
s = input() t = input() ans = len(t) for i in range(len(s) - len(t)): dif = 0 for j in range(len(t)): if t[j] != s[i + j]: dif = dif + 1 ans = min(ans, dif) print(ans)
p02754
s811811281
Accepted
n, a, b = map(int, input().split()) s = a + b n_s = n // s l = n - s * n_s if l <= a: ans = a * n_s + l else: ans = a * n_s + a print(ans)
p03329
s187523630
Wrong Answer
from math import log n = int(input()) def make_list(n, x): return [x ** i for i in range(1, int(log(n, x))+1)] sixes = make_list(n, 6) nines = make_list(n, 9) nums = [1] + sixes + nines dp = [float('inf')] * (n+1) for num in nums: for i in range(1, n+1): if i == num: dp[i] = 1 else: dp[i] = min(dp[i], dp[i-num]+1) print(dp[n])
p03163
s377006059
Accepted
import numpy as np N, W = map(int, input().split()) dp = np.zeros(W + 1, dtype=np.int) for _ in range(N): w, v = map(int, input().split()) dp[w:] = np.maximum(dp[w:], dp[:-w] + v) print(dp[W])
p02766
s601890772
Wrong Answer
n,k=map(int,input().split()) n=0 while n>=k**n: n+=1 print(n)
p02833
s584038523
Accepted
N = int(input()) ans = 0 if N % 2 == 1: print(0) exit() N = N // 2 while (N >= 5): N = N // 5 ans += N print(ans)
p03773
s250263419
Accepted
a,b=map(int,input().split()) x=a+b if x<24:print(x) else:print(x-24)
p02629
s566770064
Wrong Answer
# coding: utf-8 import sys from math import log stdin = sys.stdin ns = lambda: stdin.readline().rstrip() # ignore trailing spaces ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) def main(): ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz' n = ni() m = int(log(n,26)) ans = '' for i in range(m+1): ans += ascii_lowercase[n%26-1] n //= 26 print(ans[::-1]) return if __name__ == '__main__': main()
p03137
s529124866
Accepted
n,m = map(int,input().split()) x=list(map(int,input().split())) """ 2 5 10 12 1 2 14 1 2 10 12 14 ->5 3 7 -10 -3 0 9 -100 2 17 -100 -10 -3 0 2 9 17 ->19 100 1 -100000 ->0 """ if n >= m: print(0) else: x.sort() xd=[] xp=x[0] for xi in x[1:]: xd.append(xi-xp) xp=xi xd.sort(reverse=True) print(sum(xd[n-1:]))
p03239
s425178797
Accepted
#!/usr/bin/env python3 n, t = list(map(int, input().split())) ct = [list(map(int, input().split())) for _ in range(n)] ct = sorted(ct, key=lambda x: x[0]) # print(n, t) # print(ct) for i in ct: if i[1] <= t: print(i[0]) exit() print("TLE")
p03416
s471451006
Wrong Answer
A,B = map(int,input().split()) d = [] for i in range(1,10): for j in range(10): for k in range(10): d.append(10001*i+1010*j+100*k) d.sort() import bisect print(bisect.bisect_right(d,B)-bisect.bisect_right(d,A))
p03861
s075499532
Wrong Answer
a,b,x = [int(i) for i in input().split()] d = b//x - a//x a = a/x if a.is_integer(): d+=1 print(d)
p04029
s918978493
Accepted
# A - キャンディーとN人の子供イージー def main(): n = int(input()) cnt = 0 for i in range(1, n+1): cnt += i else: print(cnt) if __name__ == "__main__": main()
p03073
s441066724
Accepted
s = input() check = True count = 0 for i in s: if check: if i != "0": count += 1 else: if i != "1": count += 1 check = not check check = False count2 = 0 for i in s: if check: if i != "0": count2 += 1 else: if i != "1": count2 += 1 check = not check print(min(count, count2))
p03673
s322085520
Accepted
import bisect,copy,heapq,itertools,math,string from collections import * import sys def input() : return sys.stdin.readline().strip() def INT() : return int(input()) def MAP() : return map(int,input().split()) def LIST() : return list(MAP()) n = INT() a = LIST() b = deque() for i in range(n): if(i%2==0): b.append(i) else: b.appendleft(i) if(n%2==1): b.reverse() c = [a[b[i]] for i in range(n)] print(*c)
p03254
s062688338
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) a.sort(reverse=False) count = 0 for i in a: if x>=i: count += 1 x -= i else: break print(count)
p02618
s896858420
Accepted
d=int(input()) c=list(map(int,input().split())) s=[] for i in range(d): t=list(map(int,input().split())) s.append(t) for i in range(d): print(i%26+1)
p03799
s773855976
Wrong Answer
s,c = map(int,input().split()) print((2*s+c)//4)
p03971
s990783469
Accepted
n, a, b = list(map(int, input().split())) s = list(input()) sum = a + b passingD = 0 # 国内 passingF = 0 # 海外 flag = 'No' for i, student in enumerate(s, 1): if student == 'a' and (passingD + passingF) < sum: passingD = passingD + 1 flag = 'Yes' elif student == 'b' and (passingD + passingF) < sum and passingF < b: passingF = passingF + 1 flag = 'Yes' else: flag = 'No' print(flag)
p02939
s185045710
Accepted
s = input() ansL = [s[0]] ans = "" for i in s[1:]: ans += i if ansL[-1] != ans: ansL.append(ans) ans = "" print(len(ansL))
p02996
s701024789
Accepted
N = int(input()) dic = {} B = [] for i in range(N): a, b = map(int,input().split()) B.append(b) if '{}'.format(b) in dic: dic['{}'.format(b)] += a else: dic['{}'.format(b)] = a Bs = sorted(list(set(B))) time = 0 for i, num in enumerate(Bs): time += dic['{}'.format(num)] if num < time: print('No') break if i == len(Bs)-1: print('Yes')
p02873
s580831589
Accepted
import itertools S = input() RevS = reversed(S) L = [0]#左の< R = [0]#右の> cur = 0 for s in S: if s == "<": cur += 1 else: cur = 0 L.append(cur) cur = 0 for r in RevS: if r == ">": cur += 1 else: cur = 0 R.append(cur) R.reverse() ans = 0 for n in range(len(S)+1): ans += max(L[n],R[n]) print(ans)
p02603
s536739144
Accepted
import sys N = int(sys.stdin.readline()) A = list(map(int, sys.stdin.readline().split())) yen = 1000 for i in range(1, N): if A[i-1] < A[i]: yen += (A[i] - A[i-1]) * (yen // A[i-1]) print(yen)
p03860
s602371702
Accepted
input1 = input().split() A = input1[0] s = input1[1] C = input1[2] listA = [str(x) for x in A] listS = [str(y) for y in s] listC = [str(z) for z in C] print(listA[0] + listS[0] + listC[0])
p02879
s285956152
Accepted
a, b = [int(x) for x in input().split()] if a <= 9 and b <= 9: print(a * b) else: print(-1)
p03011
s640318496
Wrong Answer
A,B,C = map (int, input ().split ()) if A>B>C or A>C>B: print (B+C) elif B>A>C or B>C>A: print (A+C) else: print (A+B)
p03077
s405491700
Accepted
import numpy as np N=int(input()) A=[int(input()) for i in range(5)] t=0 x=np.argmin(A) t+=x t+=(N+A[x]-1)//A[x] t+=4-x print(t)
p04029
s078386419
Accepted
n=int(input()) print(n*(n+1)//2)
p03659
s957715397
Accepted
n = int(input()) data = list(map(int, input().split())) total = sum(data) x = 0 ans = 2 * 10**9 + 1 last = data[-1] for i in range(len(data)-1): x += data[i] score = abs(2*x - total) if score < ans: ans = score print(ans)
p02555
s111420731
Wrong Answer
S = int(input()) slen = int(S/3) Ans = 0 for i in range(1,slen+1): szan = S - 3*i Ans += i**szan # print(i**szan) print(Ans%(10**9+7))
p02660
s363499912
Wrong Answer
N = int(input()) #nの約数列挙 def divisor(n): ass = [] for i in range(1,int(n**0.5)+1): if n%i == 0: ass.append(i) if i**2 == n: continue ass.append(n//i) ass.sort() return ass #sortされていない D = divisor(N) ans = 0 for d in D: if d == 1: continue if N >= d and N%d == 0: N //= d ans += 1 print(ans)
p03095
s444192920
Accepted
from collections import Counter from functools import reduce MOD = 10 ** 9 + 7 n = int(input()) s = input() c = Counter(s) ans = reduce(lambda total, x: total * (x+1) % MOD, c.values(), 1) print(ans-1)
p02802
s560681131
Accepted
N,M = (int(x) for x in input().split()) cor = 0 mis = 0 numList = [0] * N misList = [0] * N for _ in range(M): num,ans = input().split() if ans == 'WA': misList[int(num)-1] += 1 else: if numList[int(num)-1] == 0: mis += misList[int(num)-1] cor += 1 numList[int(num)-1] = 1 print(cor,mis)
p02622
s716887858
Wrong Answer
def main(): s=input() t=input() res=0 for i in range(len(s)): if(s[i]==t[i]): res+=1 print(res) if __name__ == '__main__': main()
p03379
s833716333
Accepted
N = int(input()) X = list(map(int, input().split())) A = sorted(X) mid = (A[N//2] + A[N//2-1]) / 2 for x in X: if x < mid: print(A[N//2]) else: print(A[N//2-1])
p02911
s435760109
Wrong Answer
import collections n, k, q = map(int, input().split()) a = [input() for i in range(q)] p = [] max_v = 0 if k > q: for i in range(n): print("Yes") else: count = collections.Counter(a) max_v = max(count.values()) result = [key for key, val in count.items() if val == max_v] for i in range(n): if str(i + 1) in result: print("Yes") else: print("No")
p03799
s311515467
Accepted
n,m = map(int,input().split()) if n >= m: print(m // 2) else: m = m // 2 z = (n + m) // 2 z = z - n n += z m -= z print(min(n,m))
p02970
s960178624
Accepted
import math import time from collections import defaultdict, deque from sys import stdin, stdout from bisect import bisect_left, bisect_right n,d=map(int,stdin.readline().split()) print(math.ceil(n/(d+d+1)))
p03659
s614923630
Accepted
n=int(input()) a=[int(i) for i in input().split()] sunuke=0 araiguma=sum(a) min_sa=100000000000000 for i in range(n-1): sunuke+=a[i] araiguma-=a[i] min_sa=min(min_sa,abs(araiguma-sunuke)) print(min_sa)
p03077
s374477685
Accepted
n = int(input()) a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) import math ans = math.ceil(n/a) if a<=b: ans += 1 else: ans = math.ceil(n/b)+1 if b<=c: ans += 1 else: ans = math.ceil(n/min(c,a))+2 if c<=d: ans += 1 else: ans = math.ceil(n/min(d,b,a))+3 if d<=e: ans += 1 else: ans = math.ceil(n/min(e,a,b,c))+4 print(ans)
p02618
s704128159
Wrong Answer
import numpy as np d = int(input()) c = list(map(int, input().split())) s = np.array([list(map(int, input().split())) for _ in range(d)]) init = np.ones(d) print(*init, sep="\n")
p02916
s338193536
Wrong Answer
n = int(input()) a_input = input() a = a_input.split(" ") b_input = input() b = b_input.split(" ") c_input = input() c = c_input.split(" ") b_sum = 0 for i in range(n): b_sum += int(b[i]) c_sum = 0 for i in range(n-1): if int(a[i]) != n: c_sum += int(c[int(a[i])-1]) else: c_sum += 0 sum = b_sum + c_sum print(sum)
p03611
s688048902
Wrong Answer
N = int(input()) A = list(map(int, input().split())) A.sort() cnt = 1 Mcnt = 0 for i in range(0,N-1): for j in range(i+1,N): if A[j] - A[i] <= 2: cnt += 1 else: if Mcnt < cnt: Mcnt = cnt cnt = 1 print(Mcnt)
p02817
s238018730
Accepted
m, n = (map(str, input().split())) print(n+m)
p03030
s960223123
Accepted
n=int(input()) sp=[] for i in range(n): s,p=input().split() sp.append([s,int(p),i+1]) sp.sort(key=lambda sp:(sp[0],-sp[1])) for i in sp:print(i[2])
p03251
s082623073
Wrong Answer
N, M, X, Y = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) print("No War" if max(x) < min(y) else "War")
p02597
s102841160
Accepted
n = int(input()) c = input() left = 0 right = n - 1 cnt = 0 while left < right: while left < right: if c[left] == "W": break; left += 1 while left < right: if c[right] == "R": break; right -= 1 if left < right: cnt += 1 left += 1 right -= 1 # print(cnt)
p03943
s213406435
Accepted
i=list(map(int,input().split())) i.sort() print('Yes' if i[0]+i[1]==i[2] else 'No')
p02641
s787821628
Wrong Answer
import sys sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline def solve(): X, N = map(int, rl().split()) p = set(map(int, rl().split())) ans = -1 d_min = 1000 for i in range(101): if i not in p: if abs(X - i) < d_min: d_min = abs(X - i) ans = i print(ans) if __name__ == '__main__': solve()
p03469
s928774342
Wrong Answer
# coding: utf-8 S = input() S = S.replace("7","8") print(S)
p02952
s432801802
Accepted
N = int(input()) s = len(str(N)) t = 0 for i in range(0,s//2): t = t+9*10**(i*2) if s%2 == 1: t = t+N-10**(s-1)+1 print (t)
p03435
s019974195
Accepted
grid = [list(map(int,input().split()))for i in range(3)] for a1 in range(-10000,10001): b1 = grid[0][0] - a1 a2 = grid[1][0] - b1 a3 = grid[2][0] - b1 b2 = grid[0][1] - a1 b3 = grid[0][2] - a1 if a2+b2 == grid[1][1] and a2+b3 == grid[1][2] and a3+b2 == grid[2][1] and a3+b3 == grid[2][2]: print('Yes') break else:print('No')
p02917
s506366028
Accepted
N = int(input()) B = list(map(int, input().split())) r = B[0] + B[N-2] for i in range(N-2): r += B[i+1] if B[i] > B[i+1] else B[i] print(r)
p02647
s390688761
Accepted
from itertools import accumulate n, k = map(int, input().split()) a = list(map(int, input().split())) for _ in range(k): b = [0] * n for i in range(n): b[max(0, i-a[i])] += 1 tmp = i + a[i] + 1 if tmp < n: b[tmp] -= 1 a = list(accumulate(b)) if a == [n] * n: break print(*a)
p02888
s553540537
Accepted
import bisect n = int(input()) l_li = list(map(int,input().split())) l_li.sort() ans = 0 for i in range(n-2): for j in range(i+1,n-1): ind = bisect.bisect_left(l_li,l_li[i]+l_li[j]) num = ind-1 - j if num > 0: ans += num print(ans)
p03145
s260573585
Accepted
c,a,b=map(int,input().split()) print(a*c//2)
p02630
s379350923
Wrong Answer
from collections import defaultdict N = int(input()) raw_numbers = list(map(int, input().split())) numbers = defaultdict(int) for num in raw_numbers: numbers[num] += 1 total = sum(raw_numbers) Q = int(input()) for _ in range(Q): a, b = list(map(int, input().split())) numbers[b] += numbers[a] total -= a * numbers[a] total += b * (numbers[b] - numbers[a]) numbers[a] = 0 print(total)
p02723
s440670231
Accepted
li = list(input()) if(li[2] == li[3] and li[4] == li[5]): print("Yes") else: print("No")
p02688
s743195585
Accepted
N,K=map(int,input().split()) P= [list(map(int,input().split())) for i in range(2*K)] count=0 Q=[] for t in range(1,2*K,2): Q.append(P[t]) R=[] for u in range(0,len(Q)): for s in range(0,len(Q[u])): R.append(Q[u][s]) for j in range(1,N+1): if j not in R: count=count+1 else: count=count print(count)
p02697
s992632714
Accepted
N,M=map(int,input().split()) if N%2==1: S=1 L=N for i in range(M): print(S+i,L-i) else: S=1 L=N for i in range(M): if S+i>N/4: print(S+i,L-i-1) else: print(S+i,L-i)
p03419
s767344115
Wrong Answer
N, M = map(int, input().split()) print(N * M -(2 * N + 2 * M - 4))
p03262
s659650070
Accepted
from fractions import gcd n, x = list(map(int, input().split())) l = [int(i) for i in input().split()] m = [abs(i - x) for i in l] res = 0 for i in range(0, len(m)): res = gcd(res, m[i]) print(res)
p02621
s902329150
Accepted
a = int(input()) a2 = a*a a3 = a2 * a print(a + a2 + a3)
p03254
s099743674
Accepted
import sys input = lambda :sys.stdin.readline().rstrip() N, x = map(int, input().split()) A = sorted(list(map(int, input().split()))) if x > sum(A): cnt = -1 else: cnt = 0 for i in range(N): if x - A[i] >= 0: cnt += 1 x -= A[i] if x <= 0: break #print(cnt, x) print(cnt)
p04005
s761253012
Accepted
A, B, C = map(int, input().split()) if (A*B*C) % 2 == 0: print(0) else: print(min(A*B, B*C, C*A))
p03695
s992111401
Accepted
n = int(input()) a = [int(i)//400 for i in input().split() if int(i)<3200] x = len(set(a)) y = n-len(a) if x == 0: print(1,y) else: print(x,x+y)
p02681
s968428748
Accepted
s = input() t = input() if t.startswith(s): print("Yes") else: print("No")
p03854
s299764701
Accepted
#!/usr/bin/env python3 import re s = input() s = re.sub(r'erase(r|)',"", s) s = re.sub(r'dream(er|)',"", s) print('YNEOS'[s!=""::2])
p02629
s245274273
Wrong Answer
def num2str(n): # 1,2,3... -> a,b,c,... if n == 0: return 'z' else: return chr(ord('a') + n-1) N = int(input()) ans = '' while N > 26: ans = num2str(N%26) + ans N = int(N/26) ans = num2str(N%26) + ans print(ans)
p03796
s873789431
Accepted
a=1 for i in range(int(input())): a*=i+1;a%=10**9+7 print(a)