problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02706
s503397498
Wrong Answer
N, M = map(int,input().split()) #M 夏休み期間 M 宿題数 A = list(map(int, input().split())) A_sum = 0 for i in range(0, M): A_sum += A[i] # A_sum 宿題全日数 x = N - A_sum if x > N: print("-1") else: print(x)
p03076
s280524681
Accepted
import numpy as np a = input() b = input() c = input() d = input() e = input() l = np.array(list(map(int, [a[-1], b[-1], c[-1], d[-1], e[-1]]))) idx = np.argmin(np.where(l == 0, 10, l)) times = list(map(int, [a, b, c, d, e])) ans = 0 for i, t in enumerate(times): if i == idx: ans += t else: ans += np.c...
p02577
s655560455
Accepted
list_N =list(map(int,list(input()))) total = 0 for i in list_N: total += i if total % 9 == 0: print("Yes") elif total % 9 != 0: print("No") else: pass
p02577
s361150386
Accepted
N = int(input()) if N % 9 == 0: print("Yes") else: print("No")
p03252
s741992819
Accepted
a = input() b = input() relsa = {} relsb = {} possible = True for i in range(len(a)): if a[i] not in relsa: relsa[a[i]] = b[i] else: if relsa[a[i]] != b[i]: possible = False if b[i] not in relsb: relsb[b[i]] = a[i] else: if relsb[b[i]] != a[i]: possible = False if possible: ...
p03416
s869540593
Accepted
a,b = map(int, input().split()) num = 0 for i in range(a,b+1): i = str(i) if i[0] == i[4] and i[1] == i[3]: num += 1 print(num)
p02819
s056708306
Accepted
n = int(input()) x=0 while(1): if n ==2: break for i in range (int((-(-n**0.5//1)))): if n%(i+1)==0: x=x+1 if x==1: break else: x=0 n=n+1 print(n)
p02772
s338348550
Accepted
num = int(input()) num_list = [int(x) for x in input().split()] cnt = 0 for i in range(num): if num_list[i] % 2 == 0: if not (num_list[i] % 3 == 0 or num_list[i] % 5 == 0): cnt += 1 if cnt != 0: print("DENIED") else: print("APPROVED")
p04030
s527944077
Accepted
a=input() b='' for i in range(len(a)): if a[i]=='0': b=b+'0' elif a[i]=='1': b=b+'1' else: if b!='': b=b[:-1] print(b)
p03759
s940822041
Accepted
a, b, c = map(int, input().split()) if b - a == c - b: print('YES') else: print('NO')
p02879
s935776274
Accepted
A, B = map(int, input().split()) ans = -1 if 0 < A and A < 10 and 0 < B and B < 10: ans = A * B print(ans)
p02754
s149059292
Wrong Answer
n, a, b = map(int, input().split()) c = 0 while n >= 0: if n >= a+b: n -= (a+b) c += 1 else: if n <= a: print(a*c + n) else: print(a*c) break
p02756
s292136194
Accepted
s = input() q = int(input()) sg = 1 fr = [] ba = [] for x in range(q): query = [s for s in input().split()] if query[0] == '1': sg *= -1 else: if int(query[1])*2 + sg == 3: fr.append(query[2]) else: ba.append(query[2]) if sg == 1: fr.reverse() frn = ''.join(fr) ban = ''.join(ba) ...
p02755
s088938401
Accepted
import math t8,t10=map(int,input().split(" ")) mint8=t8/0.08 maxt8=(t8+1)/0.08 mint10=t10/0.1 maxt10=(t10+1)/0.1 ans=list(set(range(math.ceil(mint8),int(maxt8))) & set(range(math.ceil(mint10),int(maxt10)))) if len(ans)==0: print(-1) else: print(min(ans))
p02767
s654206405
Accepted
n=int(input()) li = list(map(int,input().split())) ans=[] i=1 while i<=101: for j in range(n): cost=[(li[j]-i)**2 for j in range(n)] ans.append(sum(cost)) i+=1 print(min(ans))
p02994
s292743959
Accepted
n, l = list(map(int, input().split(' '))) m = 9999999999 apples = [] for i in range(n): if abs(m) > abs(i+l): m = i+l apples.append(i+l) print(sum(apples) - m)
p02708
s540159224
Accepted
MODULO = 10**9+7 n, k = map(int, input().split()) ans = 0 for num_add in range(k, n+2): min_res = (0 + num_add-1) * num_add // 2 max_res = (n-num_add+1 + n) * num_add // 2 ans += (max_res - min_res + 1) % MODULO ans %= MODULO # print("ans", ans) print(ans)
p02577
s722469266
Accepted
N = input() nli = [] for i in range(len(N)): nli.append(N[i]) print("No" if sum(map(int, nli)) % 9 else "Yes")
p03838
s920696898
Accepted
st, gl = map(int, input().split()) ans = 0 if gl == -st: ans = 1 elif st >= 0: if gl > st: ans = gl - st elif gl < -st: ans = - st - gl + 1 elif gl > 0: ans = st - gl + 2 else: ans = gl + st + 1 elif st < 0: if gl > -st: ans = gl + st + 1 elif gl < st: ans = st - gl + 2 elif gl ...
p02995
s110765349
Accepted
import fractions as fr a,b,c,d=map(int,input().split()) def div(x,y): return y//x def div2(x): return div(x,b)-div(x,a-1) print(b-a+1-div2(c)-div2(d)+div2(c*d//fr.gcd(c,d)))
p02759
s088769274
Accepted
n = int(input()) print(-(-n//2))
p03017
s527127294
Accepted
n,a,b,c,d=map(int,input().split());s=input() if c<=d: if "##"in s[a-1:c] or"##"in s[b-1:d]:print("No") else:print("Yes") else: if "..." not in s[max(0,b-2):d+1]:print("No");exit() if "##"in s[a-1:c] or"##"in s[b-1:d]:print("No") else:print("Yes")
p03479
s039956188
Wrong Answer
# https://atcoder.jp/contests/abc083/tasks/arc088_a import math x, y = map(int, input().split()) print((int(math.log2(y / x))) + 1)
p03814
s354829507
Wrong Answer
s = input() a_index = 0 z_index = 0 for i in range(0, len(s)): if s[i] == "A": a_index = i break for i in range(0, len(s)): if s[len(s)-i-1] == "Z": z_index = len(s)-i break print(z_index - a_index + 1)
p02606
s176468964
Wrong Answer
L, R, d = map(int, input().split()) if L % d == 0: print((R - L) // d + 1) else: print((R - L) // d)
p02988
s615433134
Accepted
n = input() p = map(int,raw_input().split()) res = 0 for i in xrange(0,n-2): nl = [p[i],p[i+1],p[i+2]] if sorted(nl)[1] == nl[1]: res +=1 print res
p03379
s348949121
Accepted
N=int(input()) X=list(map(int,input().split())) Y=sorted(X) alpha=Y[N//2-1] beta=Y[N//2] S=[0]*N for k in range(N): x=X[k] if x<=alpha: S[k]=beta else: S[k]=alpha print("\n".join(map(str,S)))
p03779
s182150274
Accepted
n = int(input()) cnt = 0 p = 0 for i in range(n+1000): cnt += i if cnt >= n: p = i break print(p)
p03239
s897409611
Accepted
N, T = list(map(int,input().split())) c = [0 for i in range(N)] t = [0 for i in range(N)] for i in range(N): c[i], t[i] = input().split() c[i] = int(c[i]) t[i] = int(t[i]) ans = float('inf') for i in range(N): if t[i] <= T and c[i] < ans: ans = c[i] if ans == float('inf'): print('TLE') else: print(ans)
p02612
s381449173
Wrong Answer
n = int(input()) print(1000 - n % 1000)
p03012
s631355751
Accepted
n=int(input()) l=list(map(int,input().split())) ans=[] for i in range(len(l)): c=abs(sum(l[:i])-sum(l[i:])) ans.append(c) print(min(ans))
p04044
s769207686
Wrong Answer
n,l = map(int,input().split()) s = sorted([i for i in range(n)]) print(*s,sep="")
p02695
s343278347
Wrong Answer
import itertools n,m,q=map(int,input().split()) List = [[int(j) for j in input().split()] for i in range(q)] total = 0 d = 0 lis = list(range(1,m+1)) for pair in itertools.combinations(lis, n): for i in range(q): if pair[List[i][1]-1] - pair[List[i][0]-1] == List[i][2]: total += List[i][3] ...
p03951
s639697960
Wrong Answer
n = int(input()) s = input() t = input() ans = s+t for i in range(n): if s == t: ans = s if s[i:] == t[:n-i]: ans = s+t[-i:] print(len(ans))
p02971
s939492064
Accepted
import sys n, *lst = map(int, sys.stdin.read().split()) copy = sorted(lst) max1, max2 = copy[-1], copy[-2] if max2 < max1: for j in lst: if j != max1: print(max1) else: print(max2) else: for j in lst: print(max1)
p02760
s593906464
Accepted
A=[] B=[] for i in range(3): A.extend(list(map(int,input().split()))) n=int(input()) for i in range(n): b=int(input()) try: A[A.index(b)]=0 except: continue if A[0]==A[1]==A[2] or A[3]==A[4]==A[5] or A[6]==A[7]==A[8] or A[0]==A[3]==A[6] or A[1]==A[4]==A[7] or A[2]==A[5]==A[8] or A[0]==A[4]==A[8] or A[...
p02627
s327694499
Accepted
s = input() if s.isupper(): print('A') else: print('a')
p02881
s486242468
Accepted
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) n = in...
p02835
s565285784
Accepted
A1,A2,A3 = map(int,input().split()) if A1+A2+A3 >21: print("bust") else: print("win")
p03633
s841114786
Accepted
import math from functools import reduce def lcm_base(x,y): return (x*y)//math.gcd(x,y) def lcm_list(numbers): return reduce(lcm_base,numbers,1) n=int(input()) nums=[int(input()) for i in range(n)] print(lcm_list(nums))
p02702
s962443067
Accepted
s=input() n=len(s) s=s[::-1] cnt_mod=[0] m=0 d=1 for i in range(n): m+=int(s[i])*d m%=2019 d*=10 d%=2019 cnt_mod.append(m) from collections import Counter c=Counter(cnt_mod) ans=0 for v in c.values(): ans+=v*(v-1)//2 print(ans)
p02918
s150217214
Wrong Answer
N, K = map(int, input().split()) S = input() x = sum(S[i] == "R" and S[i + 1] == "L" for i in range(N - 1)) y = int(S[0] == "L") + int(S[-1] == "R") res = N - 2 * x - y ans = res + 2 * min(K, x) if K - x > 0 and y > 0: ans += 1 print(ans)
p03037
s758891841
Wrong Answer
N,M=map(int,input().split()) interval=[[0,0] for i in range(M)] for i in range(M): interval[i][0],interval[i][1]=map(int,input().split()) L=[interval[i][0] for i in range(M)] R=[interval[i][1] for i in range(M)] L_max=max(L) R_min=min(R) print(R_min-L_max+1)
p02646
s133395335
Accepted
a,v,b,w,t=map(int,open(0).read().split()) print('YNEOS'[v-w<abs(a-b)/t::2])
p02726
s304617860
Wrong Answer
array = list(map(int, input().split())) miniDis = [] for i in range(1,array[0]): for j in range(i+1,array[0]+1): miniDis.append(min(j-i,abs(array[1]-i)+1+abs(array[2]-j))) for i in range(1,array[0]-1): print(miniDis.count(i))
p02628
s426492794
Wrong Answer
n, k = map(int, input().split()) p = list(map(int, input().split())) p.sort() # print(p) sum = 0 cnt = 0 for i in p: sum += i cnt += 1 if cnt == 3: break print(sum)
p04012
s917414382
Accepted
s = input() l = [] for i in range(len(s)): l.append(s.count(s[i])) r = [] for x in l: if(x%2!=0): r.append(False) else: r.append(True) if(all(r)): print("Yes") else: print("No")
p02612
s121862549
Accepted
N = int(input()) M = N // 1000 if N % 1000 != 0: M += 1 print(1000 * M - N)
p03485
s869260217
Wrong Answer
a,b=map(int,input().split()) x=(a+b)/2 if x*10%10==5: print(x*10//10+1) else: print(x)
p02677
s792644416
Wrong Answer
import math import decimal a,b,h,m = map(float,input().split()) if h==0: hh = 360 else: hh = 360*(h/12)+(30*m/60) if m==0: mm = 360 else: mm = 360*(m/60) x = float(abs(mm-hh)) a2 = a**2 b2 = b**2 ans = math.sqrt((a2+b2)-(2*a*b*math.cos(math.radians(x)))) print(format(ans,'.15f') )
p02814
s594751824
Accepted
from fractions import gcd def solve(n, m, aaa): lcm = 1 for a in aaa: a //= 2 lcm *= a // gcd(lcm, a) if lcm > m: return 0 for a in aaa: if int(lcm / a) == lcm / a: return 0 return (m // lcm + 1) // 2 n, m = list(map(int, input().split())) aaa ...
p02718
s619401718
Accepted
n, m = map(int, input().split()) a = list(map(int, input().split())) ans = "Yes" a.sort(reverse=True) for i in range(m): if a[i] < sum(a)*(1/(4*m)): ans = "No" break print(ans)
p02859
s114889566
Wrong Answer
number = int(input()) r = number / 1 print(r)
p02730
s793502917
Accepted
s = input() s_r = s[::-1] ans = "No" if s == s_r: ss = s[:int((len(s) - 1) / 2)] ss_r = ss[::-1] if ss == ss_r: sss = s[int((len(s) + 3) / 2) - 1:] sss_r = sss[::-1] if sss == sss_r: ans = "Yes" print(ans)
p04030
s443420813
Accepted
s = input() ans = "" for i in s: if i == "B": ans = ans[:-1] else: ans += i print(ans)
p03001
s000513996
Accepted
w, h, x, y = map(int, input().split()) a = 1 if x*2 == w and y*2 == h else 0 print(w*h/2, a)
p03475
s594398219
Accepted
N = int(input()) l = [] for i in range(N-1): s = [int(x) for x in input().split()] l.append(s) for i in range(N-1): t = 0 for j in range(i,N-1): t = max(t,l[j][1]) if t % l[j][2] == 0: t += l[j][0] else: t += l[j][2]- t % l[j][2] +l[j][0] print(t) print(0)
p03433
s706038051
Wrong Answer
a=int(input()) b=int(input()) if a%500 <b: print("NO") else: print("YES")
p03041
s200337858
Accepted
n,k = map(int,input().split()) #print(n,k) S=list(input()) #print(S) s=S.pop(k-1) #print(s) s=s.lower() #print(s) S.insert(k-1, s) print(''.join(S))
p02577
s944891201
Accepted
n = input() total = sum(list(map(int, n))) while True: if int(n) == 0: print('Yes') break if len(str(total)) != 1: total = sum(list(map(int, str(total)))) elif total == 9: print('Yes') break else: print('No') break
p03524
s267513648
Accepted
#!/usr/bin/env python3 import sys, math, itertools, heapq, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') sys.setrecursionlimit(10**8) inf = float('inf') ans = count = 0 S=input() C=collections.Counter(S) C["a"]=C["a"] C["b"]=C["b"] C["c"]=C["c"] print("YES" if max(C.values...
p02785
s366474074
Accepted
N, K = map(int,input().split()) H = list(map(int,input().split())) H.sort(reverse = True) if K <= N: for i in range(K): H[i] = 0 else: for i in range(N): H[i] = 0 print(sum(H))
p02724
s706063313
Accepted
money = int(input()) thousand = money//500 money = money - thousand*500 five = money//5 print(thousand*1000+five*5)
p03474
s650062590
Accepted
a, b = map(int, input().split()) s = input() t = s.split('-') print('Yes' if s[a] == '-' and len(t) == 2 else 'No')
p02987
s048866718
Accepted
S = input() print('Yes' if len(set(S))==2 else 'No')
p02707
s253181808
Accepted
from collections import Counter def main(): n = int(input()) A = [int(e) for e in input().split()] D = Counter(A) for i in range(1, n + 1): print(D[i]) if __name__ == '__main__': main()
p02838
s945034636
Wrong Answer
# coding: utf-8 MOD = 10^9+7 N = int(input()) A = [int(a) for a in input().split()] ans = 0 for i in range(N-1): for j in range(i+1, N): ans = (ans + (A[i] ^ A[j])) % MOD print(ans)
p03385
s742380449
Accepted
S = str(input()) S1 = ["a", "b", "c"] if S.count(S1[0]) == 1 and S.count(S1[1]) == 1 and S.count(S1[2]) == 1: print("Yes") else: print("No")
p03161
s923097062
Accepted
[n,k] = [int(i) for i in input().split()] h = [int(i) for i in input().split()] """ 初期条件 dp[0] = 0 dp[1] = h[1] - h[0] """ dp = [10 ** 9 + 7] * n dp[0] = 0 dp[1] = abs(h[1] - h[0]) if n > 2: for i in range(2,n): for j in range(1,min(i - 0,k)+1): dp[i] =min(dp[i - j] + abs(h[i]-h[i - j]),dp[i])...
p03285
s974908032
Accepted
N = int(input()) for i in range(25): for j in range(15): if N == 4*i + 7*j: print('Yes') exit() print('No')
p02765
s328358046
Accepted
N,R=map(int,input().split()) ans=R+(100*(10-N)) if N>=10: print(R) else: print(ans)
p02988
s308863701
Wrong Answer
n=int(input()) list=input().split() for f in list: f=float(f) def sec(a, b, c): l=[a, b, c] xxx=min(l) xx=max(l) l.remove(xx) l.remove(xxx) return l[0] count=1 c=0 for i in range(n-2): if sec(list[count], list[count+1], list[count-1])==list[count]: c=c+1 count=count+1 print(c...
p03221
s294257878
Accepted
from collections import defaultdict from bisect import bisect_left n, m = map(int, input().split()) years = defaultdict(list) sorted_years = defaultdict(list) PY = [] for i in range(m): prefecture, year = map(int, input().split()) years[prefecture].append(year) PY.append((prefecture, year)) for prefecture...
p02607
s464948846
Wrong Answer
N = int(input()) a = list(map(int,input().split())) a.insert(0,0) counter = 0 for i in range(0,N,2): if a[i] % 2 == 1: counter += 1 print(counter)
p02553
s212867157
Accepted
a,b,c,d = map(int,input().split()) x = a*c if b*d > x: x = b*d if a*d > x: x = a*d if b*c > x: x = b*c print(x)
p02748
s526370392
Wrong Answer
A,B,M = map(int, input().split()) la = list(map(int, input().split())) lb = list(map(int, input().split())) d = [] for i in range(M): d.append(list(map(int, input().split()))) for i in range(M): d[i] = la[(d[i][0]-1)] + lb[(d[i][1]-1)] - d[i][2] print(min(d))
p02761
s947386699
Wrong Answer
N, M = map(int, input().strip().split()) A = [None for _ in range(N)] for _ in range(M): s, c = map(int, input().strip().split()) if A[s-1] is None: A[s-1] = c else: if A[s-1] != c: A[s-1] = min(c, A[s-1]) if A[0] is None or (len(A) >= 2 and A[0] == 0): print(-1) exit() A = [str(e) if e else '0...
p02971
s274426609
Accepted
import numpy as np n = int(input()) a = np.array([int(input()) for _ in range(n)]) a1n = a.argmax() a_s = sorted(a) a1 = a_s[-1] a2 = a_s[-2] for i in range(n): if i == a1n: print(a2) else: print(a1)
p02663
s722644479
Wrong Answer
from sys import stdin h1, m1, h2, m2, k = [int(x) for x in stdin.readline().rstrip().split()] allMin1 = h1 * 60 allMin2 = h2 * 60 diff = (allMin2 + m2 - allMin1 + m1) # if diff < 0 : # diff += 24 * 60 ans = diff - k if ans >= 0 : print(ans) else : print(0)
p02971
s662685365
Accepted
N = int(input()) A = [int(input()) for _ in range(N)] left_max = [0] right_max = [0] for a in A: left_max.append(max(left_max[-1], a)) for a in reversed(A): right_max.append(max(right_max[-1], a)) for i in range(N): print(max(left_max[i], right_max[N - i - 1]))
p02725
s591694965
Accepted
k, n = map(int, input().split()) a = list(map(int, input().split())) diff = [] for i in range(n - 1): diff.append(a[i + 1] - a[i]) diff.append(k - a[-1] + a[0]) print(k - max(diff))
p03319
s254191833
Accepted
N, K = map(int, input().split()) A = list(map(int, input().split())) if (N-K) % (K-1) == 0: ans = 1 + (N-K) // (K-1) else: ans = 2 + (N-K) // (K-1) print(ans)
p04011
s715469032
Accepted
N=int(input()) K=int(input()) X=int(input()) Y=int(input()) print(N*X if K>N else (X*K)+(Y*(N-K)))
p02700
s468757680
Accepted
a, b, c, d = map(int, input().split()) while True: c -= b if c <= 0: print("Yes") break a -= d if a <= 0: print("No") break
p03385
s022808981
Wrong Answer
s = input() if s[0] != s[1] and s[0] != s[2]: print('Yes') else: print('No')
p03455
s334696983
Accepted
import sys sys.setrecursionlimit(10 ** 8) ini = lambda: int(sys.stdin.readline()) inm = lambda: map(int, sys.stdin.readline().split()) inl = lambda: list(inm()) ins = lambda: sys.stdin.readline().rstrip() debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) def solve(): a, b =...
p03637
s195391053
Accepted
n = int(input()) a = list(map(int,input().split())) odd = 0 mul2 = 0 mul4 = 0 for i in a: if i%4==0:mul4+=1 elif i%2==0:mul2+=1 else:odd+=1 ans = 'Yes' if n==mul4+odd: if mul4+1<odd:ans='No' else: if mul4<odd:ans='No' print(ans)
p04030
s096782137
Accepted
s= input() ans = '' for i in s: if(i=='0' or i=='1'): ans+=i else: if(len(ans)>=1): ans = ans[0:len(ans)-1] print(ans)
p03607
s338470618
Wrong Answer
N=int(input()) A = [] for i in range(N): new = int(input()) A.append(new) A.sort() A.append(0) start=A[0] cnt=1 anscnt=0 for i in range(1,len(A)): if A[i]==start: cnt+=1 elif A[i]!=start: if cnt%2==0: anscnt+=cnt cnt=1 start=A[i] print(N-anscnt)
p04045
s208200556
Accepted
n, k = map(int, input().split()) d = list(map(str, input().split())) while (1): c = [x for x in str(n)] ok = 1 for x in c: if x in d: ok = 0 break if ok == 1: break n += 1 print(n)
p02726
s707894066
Accepted
n,x,y = map(int,input().split()) def dist(i,j): return min(j-i, abs(x-i) + abs(y-j) + 1, abs(x-j) + abs(y-i) + 1) listlist = [0]*(n-1) for i in range(1,n): for j in range(i+1,n+1): distance = dist(i,j) listlist[distance-1] = listlist[distance-1] + 1 for k in listlist: print(k)
p02755
s028842634
Wrong Answer
a, b = map(int, input().split()) if a * 100 % 8 == 0: low = max(a * 100 // 8, b * 10) else: low = max(a * 100 // 8 + 1, b * 10) high = min(100 * (a + 1) // 8, 10 * (b+1)) if low <= high: print(low) else: print(-1)
p03943
s125658073
Accepted
import sys def input(): return sys.stdin.readline().strip() def mp(): return map(int,input().split()) def lmp(): return list(map(int,input().split())) l=sorted(lmp()) if l[0]+l[1]==l[2]: print("Yes") else: print("No")
p02683
s887574058
Accepted
import numpy as np import itertools N,M,X=map(int,input().split()) a=[] b=[] seq=[] for i in range(0,N): seq.append(i) for _ in range(0,N): a.append(list(map(int,input().split()))) a=np.array(a) ans=10**7+1 for j in range(1,N+1): alist=list(itertools.combinations(seq,j)) for k in range(len(alist)): ...
p02838
s348147200
Accepted
import numpy as np mod = 1000000007 n = int(input()) a = np.array(list(map(int, input().split()))) bit = 1 ans = 0 for i in range(60): a_and = a & 1 cnt_one = np.count_nonzero(a_and) ans += (cnt_one * (n - cnt_one) * bit) % mod ans %= mod a >>= 1 bit *= 2 bit % mod print(ans)
p03799
s528674806
Accepted
n, m = map(int, input().split()) if n >= m//2: print(m//2) else: print(n+(m-2*n)//4)
p03774
s485464957
Wrong Answer
n,m=map(int,input().split()) ab=[list(map(int,input().split())) for _ in range(n)] cd=[list(map(int,input().split())) for _ in range(m)] for i in range(n): mn=100000000 ans=0 for j in range(m): d=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]) if d<mn: mn=d ans=j+1 print(ans)
p02622
s900855206
Wrong Answer
print(sum(map(lambda x, y: 1 if x!=y else 0,input().split(), input().split())))
p03076
s493377690
Accepted
from itertools import permutations a = [int(input()) for i in range(5)] p = permutations(a,5) ans = 10**9 for l in p: now = 0 for i,item in enumerate(l): if i == 4: now += item else: now += item + int(bool(item%10))*10 - item%10 ans = min(ans,now) print(ans)
p03827
s697363866
Accepted
N = int(input()) S = input() ans = 0 x = 0 for c in S: if c=='I': x+=1 else: x-=1 if ans < x: ans = x print(ans)