problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02548
s490279479
Accepted
n=int(input()) count=0 for i in range(1,n) : if n%i==0 : count+=(n//i-1) else : count+=n//i print(count)
p03854
s544215736
Accepted
S = input()[::-1] W = [s[::-1] for s in ('dream', 'dreamer', 'erase', 'eraser')] def isOk(): now = 0 while now < len(S): for w in W: if S[now: now + len(w)] == w: now += len(w) break else: return False return True print('YES' if isOk(...
p03208
s870471394
Accepted
N,K=map(int, input().split(' ')) wood = [] difference = [] for i in range (N): wood.append(int(input())) wood.sort() for i in range(N-K+1): difference.append(wood[K + i - 1] - wood[i]) print(min(difference))
p03478
s632085526
Wrong Answer
N,A,B = list(map(int,input().split())) cnt = 0 for n in range(1,N): val = 0 tmp = N while tmp // N > 0: val = tmp % 10 tmp = tmp // 10 if val >= A and val <= B: cnt += 1 print(cnt)
p02730
s242318618
Accepted
s=list(input()) N=len(s) s2=s[:(N-1)//2] s3=s[((N+3)-1)//2:N+1] if s==list(reversed(s)) and s2==list(reversed(s2)) and s3==list(reversed(s3)): print("Yes") else: print("No")
p03437
s128699665
Wrong Answer
x,y = map(int,input().split()) if y%x == 0: print(-1) else: print(x)
p03071
s184564669
Accepted
import sys def MI(): return map(int,sys.stdin.readline().rstrip().split()) A,B = MI() if A == B: print(A+B) else: print(max(A,B)*2-1)
p03387
s009648225
Accepted
arr = list(int(a) for a in input().split()) # 最小値ベースに直して # 2つ選んで2減らす # 1つ選んで1減らす arr.sort() A = 0 B = arr[1] - arr[0] C = arr[2] - arr[0] # 2で何回割り切れるか ans = B // 2 # 残りがいくつあるか B -= ans * 2 C -= ans * 2 ans += B + C print(ans)
p02814
s047123102
Accepted
from fractions import gcd n, m = map(int, input().split()) a = [int(i) // 2 for i in input().split()] def pow2(n): cur, res = n, 0 while cur: if cur % 2 == 0: cur //= 2 res += 1 else: return res def lcm(a, b): return a * (b // gcd(a, b)) b = [pow2(i) fo...
p03105
s467142676
Accepted
a,b,c=map(int,input().split()) d=b//a if (d+1)*a<=b: d+=1 print(min(d,c))
p03821
s826840841
Accepted
import sys import collections import bisect def main(): n = int(input()) A, B = [0] * n, [0] * n cnt = 0 for i in range(n): [A[i], B[i]] = list(map(int, input().split())) for i in range(n): k = B[n - i - 1] - (((A[n - i - 1] + cnt) % B[n - i - 1])) cnt += 0 if k == B[n - i ...
p03285
s525157474
Accepted
n=int(input()) for i in range(14): for j in range(25): if i*7+j*4==n: print('Yes') exit() print('No')
p02778
s252012861
Wrong Answer
S = input() print("s" * len(S))
p02848
s884947707
Accepted
import bisect, copy, heapq, math, sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) def celi(a,b): return -(-a//b) sys.setrecursi...
p02727
s216699436
Wrong Answer
import heapq X, Y, A, B, C = map(int ,input().split(' ')) p = list(map(int ,input().split(' '))) q = list(map(int ,input().split(' '))) R = set(map(int ,input().split(' '))) eat = sorted(p, reverse=True)[:X] heapq.heapify(eat) [heapq.heappush(eat, i) for i in sorted(q, reverse=True)[:Y]] first = min(eat) for r in R:...
p03061
s263643714
Wrong Answer
n=int(input()) a=list(map(int,input().split())) m=max(a) c=0 for i in range(1,m): cnt=0 for j in range(n): if a[j]%i==0: cnt+=1 if cnt>=2: c=i print(c)
p02900
s374385739
Accepted
import fractions import collections A,B = map(int,input().split()) p = fractions.gcd(A,B) #print(p) num = [] for i in range(2,int(p**0.5)+1): while p%i==0: num.append(i) p //= i if p != 1: num.append(p) #print(num) pp = collections.Counter(num) print(len(pp)+1)
p03951
s607562781
Accepted
n=int(input()) s=str(input()) t=str(input()) if s==t: print(n) else: for i in range(1,n+1): x = s + t[-i:] if x[-n:] == t: break print(len(x))
p02948
s702292457
Accepted
from heapq import heappush, heappop import sys input = sys.stdin.buffer.readline N, M = map(int,input().split()) work = [[] for _ in range(10**5+1)] ava = [] ans = 0 for i in range(N): A, B = map(int,input().split()) work[A].append(-B) for i in range(1, M+1): if len(work[i]) > 0: for j in work[i]...
p03817
s148453814
Wrong Answer
x = int(input()) ans = x // 11 * 2 nokori = x % 11 if nokori > 6: print(ans + 2) if nokori == 0: print(ans) else: print(ans + 1)
p03998
s304411075
Wrong Answer
a = list(input()) b = list(input()) c = list(input()) l = a.pop() while True: if l == 'a': if len(a) == 0: break l = a.pop() elif l == 'b': if len(b) == 0: break l = b.pop() elif l == 'c': if len(c) == 0: break l = c.pop() if not a: print('A') elif not b: print('B') else: print('C')
p03524
s625408071
Accepted
from sys import stdin from sys import setrecursionlimit setrecursionlimit(10 ** 7) from collections import Counter s = input() C = Counter(s) a = C["a"] b = C["b"] c = C["c"] li = [a,b,c] li.sort() if li[0]+1 >= li[2]: print("YES") else: print("NO")
p03479
s450664708
Wrong Answer
x,y = list(map(int,input().split())) cnt=0 while x<=y: x=x*2 cnt+=1 print(x) print(cnt)
p04033
s379898407
Wrong Answer
a,b=map(int,input().split()) if (a < b < 0) or (a == b < 0): if (b - a + 1)%2==0: print("Positve") elif (b - a + 1)%2!=0: print("Negative") elif (0 < a == b) or (0 < a < b) : print("Positive") elif 0 in range(a,b+1): print("Zero")
p03013
s960849083
Wrong Answer
from math import factorial as f N, M = map(int, input().split()) broken = [int(input()) for _ in range(M)] + [N+1] tmp = 0 ans = 1 FLG = True for a in broken: if a == 1 or tmp == N: tmp = a + 1 continue if a == tmp: FLG = False break interval = a - tmp - 1 ans *= sum(...
p03309
s670341183
Accepted
import sys import numpy as np import math import copy input = sys.stdin.readline N = int(input()) A = np.array(list(map(int,input().split()))) if N ==1: ans = 0 else: r = np.array(list(range(1,N+1))) B = np.array(sorted(A-r)) ans = float('inf') for i in range(max(N//2-1,0),min(N//2+2,N)): ...
p03136
s557199287
Wrong Answer
n=int(input()) l=list(map(int,input().split())) if max(l)*2 <=sum(l): print("No") exit() print("Yes")
p03331
s902740529
Wrong Answer
N = int(input()) n = N // 2 A = list(str(n)) A = list(int(n) for n in A) ans = 2 * sum(A) if N % 2 == 1: ans += 1 print(ans)
p02628
s060031758
Accepted
n,k = map(int,input().split()) p = list(map(int,input().split())) p.sort() ans = 0 for i in range(k): ans += p[i] print(ans)
p03327
s241993819
Wrong Answer
N = input() if N <= "999": print("ABC") elif "1000" <= N <= "1998": print("ABD") else: print("error")
p02754
s759583519
Accepted
n,a,b=map(int,input().split()) if n<a: print(n) exit() katamari=max(n//(a+b),1) if n>a+b: amari=min(n%(a+b),a) else: amari=0 print(a*katamari+amari)
p03062
s818055913
Wrong Answer
import sys input = sys.stdin.readline N = int(input()) A = list(map(int, input().split())) m = 0 zero = 0 ans = 0 odd = 10**9 for i in A: if i < 0: m += 1 if i == 0: zero = 1 ans += abs(i) if odd > abs(i): odd = abs(i) if m %2 == 0 or zero: print(ans) else: print(ans-odd...
p02693
s159625659
Accepted
import sys k = int(input()) a, b = map(int, input().split()) for i in range(a, b+1): if i % k == 0: print("OK") sys.exit() print("NG")
p03862
s275724611
Accepted
n, x = list(map(int, input().split())) a = list(map(int, input().split())) y = 0 if a[0] > x: y = a[0] - x a[0] = x for i in range(n-1): if a[i] + a[i+1] > x: y += a[i+1] + a[i] - x a[i+1] = x - a[i] print(y)
p03795
s938458743
Accepted
n = int(input()) m = 800 *n n = int(n/15) n *=200 print(m-n)
p03379
s348647335
Wrong Answer
import sys # import math # import bisect # import copy # import heapq # from collections import deque # import decimal # sys.setrecursionlimit(100001) # INF = sys.maxsize # MOD = 10 ** 9 + 7 ni = lambda: int(sys.stdin.readline()) ns = lambda: map(int, sys.stdin.readline().split()) na = lambda: list(map(int, sys.std...
p03282
s405536382
Accepted
# 2^5000000000000000 > 10^135 S = list(input()) K = int(input()) for i in range(len(S)): if S[i] != '1': print(S[i]) exit() elif i == K - 1: print('1') exit()
p03386
s054993208
Accepted
A,B,K = map(int,input().split()) for i in range(A,A+K): if i > B: break print(i) else: for i in range(max(A+K,B-K+1),B+1): print(i)
p03328
s091575282
Accepted
a,b=map(int,input().split()) n=abs(b-a) val=int(n*(n+1)/2) print(val-b)
p02833
s922293581
Accepted
import sys def input(): return sys.stdin.readline().strip() def resolve(): n=int(input()) if n%2==1: print(0) elif n<10: print(0) else: ans=0 for i in range(1,1000000): y=5**i num=(n//y)//2 if num==0: break ...
p03069
s532340443
Accepted
n = int(input()) s = input() x = 0 y = s.count('.') c = min(n-y, y) for i in range(n): t = s[i] == '#' ##であればtがTrueになる x += t y -= 1 - t c = min(c, x+y) print(c)
p02972
s628895438
Accepted
n = int(input()) a = list(map(int,input().split())) ans = [] b = [0]*n for i in range(n-1,-1,-1): if sum(b[i::i+1])%2 == 1:#iから最後までをi+1個おきに if a[i] == 0: b[i] += 1 ans.append(i+1) else: if a[i] == 1: b[i] += 1 ans.append(i+1) print(len(ans)) prin...
p03723
s350657540
Wrong Answer
a, b, c =map(int, input().split()) if a== b and b==c and c==a : print(-1) else: count = 0 while(a%2==0 and b%2==0 and c%2 ==0): new_a, new_b, new_c = b//2 + c//2, a//2 + c//2, a//2 + b//2 a, b, c = new_a, new_b, new_c count+=1 print(count)
p03645
s114247912
Accepted
n, m = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(m)] # n, m = 3, 2 # a = [[1, 2], [2, 3]] pot_starts = [] pot_ends = [] for i in a: if i[0] == 1: pot_starts.append(i[1]) elif i[1] == n: pot_ends.append(i[0]) if set(pot_starts).intersection(set(pot_ends)): ...
p04019
s950889446
Accepted
s = input() sn = not ('N' in s)^('S' in s) ew = not ('E' in s)^('W' in s) if sn and ew: print('Yes') else: print('No')
p02946
s627697972
Wrong Answer
K,X=map(int,input().split()) ans=list(range(X-K+1,X+K)) print(ans)
p03456
s354038184
Accepted
a, b = input().split() n = int(a+b) for i in range(1,1000): if i*i == n: print('Yes') break else: print('No')
p02771
s783593229
Wrong Answer
data=list(map(int,input().split())) data.sort() ans="No" if data[0]==data[1]: if data[1]==data[2]: ans="No" else: ans='Yes' print(ans)
p02795
s300035221
Wrong Answer
H = int(input()) W = int(input()) N = int(input()) for i in range(min(H,W)): N -= max(H, W) if N <= 0: print(i+1)
p02548
s776372144
Accepted
import sys N = int(sys.stdin.readline()) ans = 0 for i in range(1, N): ans += (N - 1) // i print(ans)
p02689
s862516486
Wrong Answer
[n,m] = [int(i) for i in input().split()] h = [int(i) for i in input().split()] table = [[0]*n for i in range(n)] ls = [1] * n for i in range(m): [a,b] = [int(i)-1 for i in input().split()] if h[a] < h[b]: ls[a] = 0 else: ls[b] = 0 print(sum(ls)) #print(ls)
p03037
s955203037
Accepted
n,m=map(int,input().split()) p=[0]*(n+1) for _ in range(m): l,r=map(int,input().split()) p[l-1]+=1 p[r]-=1 for i in range(n): p[i+1]+=p[i] print(p.count(m))
p02922
s140882008
Accepted
# 2:50 a, b = map(int, input().split()) if b == 1: print(0) exit() if a >= b: print(1) else: b -= a cnt = 1 while (b > 0): b -= (a - 1) cnt += 1 print(cnt)
p03557
s491063292
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 = sorted(A) C = sorted(C) ans = 0 for i in range(N): a = bisect.bisect_left(A, B[i]) c = bisect.bisect_right(C, B[i]) ans += a*(N-c) print(ans)
p03329
s606434078
Wrong Answer
N=int(input()) inf=100000 dp=[inf for _ in range(N+1)] dp[0]=0 dp[1]=1 for n in range(N+1): num=100000 i=0 j=0 while 9**(i+1)<n: i+=1 while 6**(j+1)<n: j+=1 for k in range(i+1): num=min(num,dp[n-9**k]+1) for k in range(j+1): num=min(num,dp[n-6**k]+1) dp[n]...
p02743
s421793687
Wrong Answer
import math a,b,c = map(int,input().split()) if math.sqrt(a)+math.sqrt(b) < math.sqrt(c): print('Yes') else: print('No')
p02772
s317771981
Accepted
n=int(input()) a=list(map(int,input().split())) b=0 c=0 for i in range(n): if a[i]%2==0: b+=1 if a[i]%3==0 or a[i]%5==0: c+=1 if b==c: print('APPROVED') else: print('DENIED')
p02814
s424549607
Wrong Answer
n, m = map(int, input().split()) a = list(map(int, input().split())) def half(a, b): return a*(b+0.5) #最大公約数 def gcb(a,b): while b!=0: a,b=b,a%b return a #最小公倍数 def lcm(a,b): return a * b // gcb(a, b) sub = a[0] for i in range(1,n): sub = lcm(sub,a[i]) ans = 0 sub = sub // 2 ra = m // sub ...
p03673
s656638552
Wrong Answer
n=int(input()) a=list(map(int,input().split())) ans=[] for i in range(len(a)): if i%2==0: ans.append(str(a[i])) else: ans[0:0]=str(a[i]) print(" ".join(ans))
p02754
s177155339
Accepted
n, a, b = map(int, input().split()) ans = n//(a+b)*a n %= (a+b) if n > a: ans += a else: ans += n print(ans)
p03611
s441249604
Accepted
import collections N = int(input()) a = list(map(int, input().split())) numbers = [] for i in range(N): numbers.append(a[i]) numbers.append(a[i] + 1) numbers.append(a[i] - 1) num_count = collections.Counter(numbers) print(max(num_count.values()))
p03385
s021066881
Accepted
print("No" if len(set(input()))!=3 else "Yes")
p02660
s507052523
Accepted
import collections n=int(input()) if n==1: print(0) exit() a=[] M=n p=2 while p <= M**0.5: while n%p ==0: a.append(p) n = n//p if n==1: break p += 1 if n!=1: a.append(n) if len(a)==0: a.append(M) c=collections.Counter(a) x=c.most_common() ans...
p04034
s110799908
Accepted
n, m = map(int, input().split()) XY = list(map(int, input().split()) for _ in range(m)) Ball = [1] * n Done = [False] * n Done[0] = True for i in range(m): x, y = XY[i] x -= 1 y -= 1 if Done[x]: Done[y] = True Ball[x] -= 1 Ball[y] += 1 if Ball[x] == 0: Done[x] = False res = 0 for i in range(n): i...
p03994
s520303954
Wrong Answer
def main(): S = list(input()) K = int(input()) N = len(S) k = K for i,c in enumerate(S): distance = ord('z') + 1 - ord(c) if distance <= k: k -= distance S[i] = 'a' S[-1] = chr((ord(S[i]) - ord('a') + k) % 26 + ord('a')) print(''.join(S)) main()
p02843
s876453325
Accepted
x = int(input()) dp = [False] * (x + 106) money_li = [100, 101, 102, 103, 104, 105] dp[0] = True for i in range(x + 1): if dp[i]: for money in money_li: dp[i + money] = True print(1) if dp[x] else print(0)
p02640
s184934356
Accepted
''' In the name of God ''' a, b = map(int, input().split()) if b >= 2*a and b <= 4*a and b % 2 == 0: print('Yes') else: print('No')
p03657
s036282841
Accepted
# 067a A, B = map(int, input().split()) if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0: print('Possible') else: print('Impossible')
p03785
s264647338
Wrong Answer
N, C, K = map(int, input().split()) T = [] for _ in range(N): T.append(int(input())) T = sorted(T) # print(N, C, K) # print(*T, end="\n") # 現在の時刻 count = 0 i = 0 while i < N: ti = T[i] timax = ti + K while i < N and T[i] < timax: i += 1 count += 1 print(count)
p02756
s858596593
Accepted
s = input() q = int(input()) r = False#ひっくり返されたか f = ''#in front of#逆転しているので最後に戻しましょう b = '' #behind for i in range(q): t=list(input().split()) if len(t) == 1:#一つしか入力されていない r = not(r) else: if (t[1] == '1' and r == False): f += t[2] elif (t[1] == '2' and r == True): f += t[2] else: ...
p03038
s067524702
Accepted
n,m = map(int,input().split()) a = [int(i) for i in input().split()] bc = [[int(i) for i in input().split()] for i in range(m)] a.sort() bc.sort(key=lambda x:x[1],reverse=True) d = [] cnt1 = 0 cnt2 = 0 x = 0 for lst in bc: cnt2 = 0 while cnt1 < n and cnt2 < lst[0]: d.append(lst[1]) cnt1 += 1 ...
p02862
s616682429
Accepted
MOD = 10**9+7 fact = [1, 1] for i in range(2, 10**6+1): fact.append((fact[i-1] * i) % MOD) def comb(n, k): return (fact[n] * pow(fact[k], MOD-2, MOD) * pow(fact[n-k], MOD-2, MOD)) % MOD X, Y = [int(x) for x in input().split(" ")] n = (2 * X - Y) / 3 m = (2 * Y - X) / 3 if n < 0 or n != int(n): print(0...
p03545
s379475837
Accepted
S = input() for a in '+-': for b in '+-': for c in '+-': ans = S[0] + a + S[1] + b + S[2] + c + S[3] if eval(ans) == 7: print(ans + '=7') exit()
p02684
s133323535
Wrong Answer
n,k = map(int,input().split()) a_list = list(input().split()) dum = a_list[0] ans_list = "" for i in range(1,k+1): k = k - 1 ans_list = ans_list+dum dum = a_list[int(dum)-1] if ans_list.count(dum) == 1: break ind = ans_list.index(dum) loop = ans_list[ind:] len_loop = len(loop) loop_after = (k)%l...
p02958
s879513833
Wrong Answer
n = int(input()) p = list(map(int, input().split())) judge = 0 for i in range(n): if p[i] != i + 1: judge += 1 if judge >= 3: print('No') else: print('Yes')
p03317
s446029205
Accepted
N, K = map(int, input().split()) A = list(map(int, input().split())) from math import ceil print(ceil((N-1) / (K-1)))
p02547
s388948794
Wrong Answer
n = int(input().strip()) count = 0 for i in range(n): a,b = map(int,input().strip().split()) if a == b and count == 3: print('Yes') exit(0) elif a == b: count += 1 elif(a != b): count = 0 print('No')
p03210
s789104625
Accepted
X = int(input()) if X == 3 or X == 5 or X == 7: print('YES') else: print('NO')
p03456
s148614859
Accepted
a,b=map(int,input().split()) c=int(str(a)+str(b)) if int(c**0.5)**2==c: print("Yes") else: print("No")
p03545
s745266384
Accepted
num = list(input()) for i in range(2**3): n = [] pm = ["+","+","+"] for j in range(3): if ((i >> j) & 1): pm[j] = "-" for k in range(3): n.append(num[k]) n.append(pm[k]) n.append(num[3]) formula = "" for j in range(7): formula += n[j] if eval(...
p02665
s013948946
Accepted
n = int(input()) a = list(map(int,input().split())) b = [0] for i in range(n+1): b.append(b[-1]+a[-1-i]) b.reverse() b.pop() #print(a) #print(b) now = 1 ans = 0 for i in range(n+1): if now > b[i]: now = b[i] ans += now now -= a[i] if now <= 0 and i != n: print(-1) exit() if now < 0 and i == n: ...
p02747
s915487864
Accepted
S = input() n = len(S) s = "hi" * (n // 2) if n % 2 == 0 and s == S: print("Yes") else: print("No")
p03803
s921876382
Accepted
A,B = map(int, input().split()) if A==1: A = 14 if B==1: B = 14 if A>B: print("Alice") elif A<B: print("Bob") else: print("Draw")
p02681
s661153159
Accepted
s = input() t = input() if s==t[0:-1]: print("Yes") else: print("No")
p02801
s745717544
Wrong Answer
x = input("Enter a letter: ").lower() print(chr(ord(x) + 1))
p04045
s132072223
Wrong Answer
import sys import logging logging.basicConfig(level=logging.DEBUG) N,K=list(map(int,input().split())) num=list(input().split()) i=0 while True: for j in str(N+i): #logging.debug('j={}'.format(j)) if j in num: i+=1 break else: print(N+i) sys.exit()
p03472
s235541992
Accepted
import math n,h=map(int,input().split()) a_max=0 b_=[] for i in range(n): a,b=map(int,input().split()) b_.append(b) if a_max<a: a_max=a ans=0 b_=sorted(b_,reverse=True) for i in range(n): if a_max<b_[i]: ans+=1 h-=b_[i] if h<=0: h=0 break print(ans...
p03773
s607015358
Wrong Answer
x, y = map(int,input().split()) z = x+y print(z) if z < 25 else print(z-24)
p03556
s956575924
Accepted
import math n = int(input()) for i in range(n, 0, -1): if float.is_integer(math.sqrt(i)) == True: print(i) exit()
p03910
s875557049
Accepted
N = int(input()) i = 1 while 1: if i * (i-1) // 2 < N and N <= i * (i+1) // 2: max_ans = i break else: i += 1 not_use = max_ans * (max_ans+1) // 2 - N for i in range(1, max_ans+1, 1): if i != not_use: print(i)
p02802
s449682213
Accepted
N,M = [int(x) for x in input().split()] ac = [0]*(N+1) wa = [0]*(N+1) for i in range(M): p,s = input().split() if s =="AC" and ac[int(p)]==0: ac[int(p)]=1 if s=="WA" and ac[int(p)]==0: wa[int(p)]+=1 ans = 0 answa = 0 for i in range(N+1): if ac[i]==1: ans+=1 answa+=wa[i] print(ans,answa)
p03417
s689302769
Accepted
N,M =map(int,input().split()) if N==1 and M==1: print(1);exit() if N==1 and M==2: print(0);exit() if N==2 and M==1: print(0);exit() if N==1: print(M-2);exit() if M==1:print(N-2);exit() if N==2 or M==2:print(0);exit() else: print((N-2)*(M-2))
p02553
s928582291
Accepted
a,b,c,d = map(int,input().split()) print(max(a*c,a*d,b*c,b*d))
p02797
s241090824
Wrong Answer
n, k, s = map(int, input().split()) for i in range(1, n+1): if i <= k+1: if s %2 == 1 and i % 2 == 1: print(s//2 + 1) else: print(s//2) else: if s == 10**9: print(1) else: print(10**9)
p02717
s876693870
Accepted
a,b,c=input().split() print(c,a,b)
p02983
s482073238
Accepted
l,r=map(int,input().split()) import sys mod=2019 ans=float('inf') for i in range(l,r+1): for j in range(i+1,r+1): ans=min((i*j)%mod,ans) if ans==0: print(0) sys.exit() print(ans)
p02642
s574931214
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort() a_max = a[-1] ban = [0]*(a_max+1) count = 0 for i in range(n): if ban[a[i]]: continue else: if i == n-1 or a[i+1] != a[i]: count += 1 x = a[i] while x <= a_max: ban[x] = 1 x += a[i...
p03286
s862855221
Accepted
n = int(input()) ans = [] #now = (-2)^n = 1,-2,4,-8,16.... now = 1 while n != 0: if n % (abs(now) * 2) == 0: ans.append("0") else: ans.append("1") n -= now now *= -2 #print(n, now, ans) if ans == []: print(0) else: out = "" for i in range(len(ans) - 1, -1, -1): ...
p03799
s495452776
Wrong Answer
n, m = map(int, input().split()) if n//2 >= m: print(m) else: print(n+(m-2*n)//4)
p02760
s208704966
Accepted
a = [list(map(int,input().split()))for i in range(3)] raw = [] for i in range(3): raw.append([a[i][0],a[i][1],a[i][2]]) raw.append([a[0][i],a[1][i],a[2][i]]) raw.append([a[0][0],a[1][1],a[2][2]]) raw.append([a[0][2],a[1][1],a[2][0]]) cnt = [0]*8 n = int(input()) for i in range(n): b = int(input()) for j...