problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02963 | s414808385 | Accepted | S = int(input())
v = 10 ** 9
x = (v - S % v) % v
y = (S + x) // v
print("0 0 1000000000 1 {} {}".format(x, y))
|
p03797 | s934429865 | Wrong Answer | N,M = map(int, open(0).read().split())
X = int((M-2*N)/2)
print(int((2*N+X)/2)) |
p03481 | s662435440 | Accepted | import math
X, Y = map(int, input().split())
c = math.log2(Y // X)
if 2 ** int(c) <= Y // X:
print(int(c) + 1)
else:
print(int(c)) |
p03815 | s468154850 | Accepted | N=int(input())
ans1=N//11*2
ans2=(0<N%11)+(6<N%11)
print(ans1+ans2) |
p02577 | s415694870 | Wrong Answer | n=input()
n=str(n)
Sum=0
for i in range(len(n)):
Sum=Sum+int(n[i])
if Sum%9==0:
print("yes")
else:
print("no")
|
p03659 | s600504670 | Accepted | import sys
sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()
N = ni()
A = nl()
def solve():
tot = sum(A)
ans = 1 << 60
s = 0
for i, x in enumerate(A):
if... |
p03773 | s815827500 | Wrong Answer | a,b = map(int,input().split())
if (a+b > 24):
print((a+b)-24)
else:
print(a+b) |
p03607 | s789123735 | Accepted | import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split(... |
p03556 | s039819894 | Accepted | import math
N = int(input())
N = math.floor(math.sqrt(N))
print(N**2) |
p03131 | s210270997 | Wrong Answer | k, a, b = map(int, input().split())
if b - a <= 2:
print(k + 1)
else:
cnt = k - (a - 1)
print(max(k + 1, (b - a) * cnt // 2 + 1 * cnt % 2 + a)) |
p02982 | s370428141 | Wrong Answer | n,d = map(int,input().split())
l = [list(map(int,input().split()))for _ in range(n)]
ans = 0
for i in range(n):
for j in range(i+1,n):
r = 0
for k in range(d):
r += (l[i][k]-l[j][k])**2
r = r**0.5
if r == int(r):
ans += 1
print(ans) |
p03286 | s151557517 | Accepted | from collections import *
from heapq import *
N=int(input())
if N==0:
print(0)
exit()
num=0
count=0
lst=[]
while N:
if N%2==1:
lst.append(1)
N-=1 * (-1 if count%2 else 1)
else:
lst.append(0)
count+=1
N//=2
lst=list(reversed(lst))
print("".join([str(i) for i in lst]))
|
p02714 | s904517866 | Accepted | #D
n = int(input())
s = input()
s_l = list(s)
a = s_l.count('R') * s_l.count('G') * s_l.count('B')
cnt = 0
#i,j,kがそれぞれ異なり、j-i = k-jであるものを求める
for i in range(n-2):
for j in range(i,n-1):
if 2*j - i < n:
if s_l[i] != s_l[j] and s_l[i] != s_l[2*j-i] and s_l[j] != s_l[2*j-i]:
cnt += ... |
p03761 | s606608579 | Accepted | from collections import Counter
n=int(input())
s=Counter(input())
for i in range(n-1):
s&=Counter(input())
print("".join(sorted(s.elements()))) |
p03474 | s255909036 | Accepted | a,b = map(int,input().split())
s = input()
if s.count('-') == 1:
S = s.split('-')
if len('-'.join(S)) == a+b+1 and len(S[0]) == a and len(S[1]) == b:
print('Yes')
else:
print('No')
else:
print('No') |
p03408 | s033810245 | Accepted | N = int(input())
blue = {}
for i in range(N):
a = input()
if a not in blue:
blue[a] = 1
else:
blue[a] += 1
M = int(input())
#red = {}
for i in range(M):
a = input()
if a not in blue:
blue[a] = -1
else:
blue[a] -= 1
print(max(0, max(blue.values()))) |
p03803 | s532809768 | Accepted | A, B = map(int,input().split())
if A == B: print("Draw")
elif (A-2)%13 < (B-2)%13 : print("Bob")
else: print("Alice") |
p03041 | s120380999 | Wrong Answer | n,m=map(int,input().split())
s=input()
t=str.lower(s[m-1])
print(s.replace(s[m-1],t)) |
p02819 | s327011561 | Accepted | def prime(X):
if X<2:
return False
if X==2:
True
for i in range(2,X):
if X%i==0:
return False
return True
X=int(input())
p=False
while p==False:
p=prime(X)
X+=1
print(X-1)
|
p03146 | s072884152 | Wrong Answer | s = int(input())
a = set([s])
p = s
n = 0
cnt = 0
while True:
if n in a:
print(cnt)
exit()
if p&1:
n = 3*p +1
else:
n = p//2
cnt += 1
a.add(n)
p = n
|
p03779 | s610122330 | Accepted | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
x = int(input())
k = 0
while k*(k+1)//2 < x:
k += 1
ans = k
print(ans) |
p03457 | s393980279 | Wrong Answer | import sys
N = int(input())
T = [list(map(int, input().split())) for i in range(N)]
x, y = 0, 0
for i in range(N):
t1 = T[i][0]
x1 = T[i][1]
y1 = T[i][2]
if t1 < abs(x1 - x) + abs(y1 - y):
print('No')
sys.exit()
t1 -= abs(x1 - x) + abs(y1 - y)
if t1 % 2 != 0:
print('No')... |
p02881 | s216322096 | Accepted | from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools
import queue
from collections import deque
from fractions import Fraction
def main():
num = int(input())
ans =... |
p02714 | s203033875 | Wrong Answer | n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(1,n//2+10):
j = 0
while j+2*i <= n-1:
print([j, j+i, j+2*i])
if s[j] != s[j+i] and s[j] != s[j+2*i] and s[j+i] != s[j+2*i]:
ans -= 1
j += 1
print(ans) |
p02761 | s673468897 | Wrong Answer | N, M = map(int, input().split())
a = [0]*N
for i in range(M):
s, c = map(int, input().split())
d = a[s-1]
if d != 0:
a[s-1] = min(c, d)
else:
a[s-1] = c
if a[0] != 0:
print(*a, sep="")
else:
print("-1") |
p02994 | s362015218 | Accepted | n,l=map(int,input().split())
ls=[]
for i in range(1,n+1):
ls.append(abs(l-1+i))
mi=ls.index(min(ls))
print(n*(l-1)+sum(range(1,n+1))-l-mi) |
p03038 | s145064531 | Wrong Answer | n, m = map(int, input().split())
from collections import defaultdict
cb = defaultdict(int)
for a in input().split():
cb[int(a)] += 1
for _ in range(m):
b, c = map(int, input().split())
cb[c] += b
cbl = sorted(cb.items())
res = n
ans = 0
while res > 0:
c, b = cbl.pop()
ncount = min(res, b)
... |
p02711 | s353349083 | Accepted | n = input()
s_flg = 0
for i in range(len(n)):
if n[i] == '7':
s_flg = 1
if s_flg:
print('Yes')
else:
print('No') |
p02702 | s500223890 | Wrong Answer | import math
def comb_count(n, r):
return math.factorial(n) // math.factorial(r) * math.factorial(n - r)
S = input()[::-1]
ans = 0
mods = [0] * 2019 #余りが0~2018
mods[0] = 1
current = 0
tmp = 1
for i in range(len(S)):
current = int(S[i]) * tmp + current % 2019
mod = current % 2019
mods[mod] += 1
tm... |
p02982 | s869230784 | Accepted | import math
N,D = map(int,input().split())
k = []
ans_2 = 0
ans_1 = 0
now = 0
for i in range(N):
k.append(list(map(int,input().split())))
for i in range(0,N):
for j in range(i+1,N):
for _ in range(D):
now += (k[i][_]-k[j][_])**2
ans_1 = math.sqrt(now)
if ans_1%1 == 0:
... |
p03624 | s839931334 | Accepted | s = input()
for i in range(26):
x = chr(i + 97)
if not x in s:
print(x)
exit()
print('None')
|
p02687 | s231207372 | Wrong Answer | print(input()) |
p03220 | s339414761 | Accepted | n = int(input())
t, a = map(int, input().split())
H = list(map(int, input().split()))
ans = []
for i in range(n):
average_tmp = t - H[i] * 0.006
diff = abs(a - average_tmp)
ans.append(diff)
print(ans.index(min(ans)) + 1)
|
p03243 | s804540309 | Accepted | n = int(input())
while not (n%10 == (n//10)%10 == n//100):
n += 1
print(n) |
p02603 | s652051362 | Accepted | n = int(input())
a = [int(x) for x in input().split()]
ans = 1000
for i in range(n-1):
ans += (ans//a[i])*max(0, (a[i+1]-a[i]))
print(ans) |
p02629 | s946605528 | Wrong Answer | n = int(input())
c = ord("a")
l = ""
while n > 26:
a = n % 26
n = (n-a)//26
l = l+chr(c+a-1)
l = l+chr(c+n-1)
print(l[::-1])
|
p03485 | s090796406 | Wrong Answer |
A, B = input().split()
M = (int(A) + int(B)) / 2
print(round(M)) |
p02760 | s139339258 | Accepted | A = []
for _ in range(3):
A += list(map(int,input().split()))
n = int(input())
ans = [0]*9
for _ in range(n):
b = int(input())
if b in A:
i = A.index(b)
if i != -1:
ans[i] = 1
bingo = [0b111000000,0b000111000,0b000000111,0b100100100,0b010010010,0b001001001,0b100010001,0b001010100]
f = 0
sheet = 0
fo... |
p03494 | s135139174 | Wrong Answer | n=int(input())
a=input()
def c(x):
return (x.count('1')),(x.count('2')),(x.count('3')),(x.count('4'))
print(max(c(a)))
print(min(c(a)))
|
p02690 | s028100065 | Accepted | x=int(input())
for a in range(-10**3,10**3):
for b in range(-10**3,10**3):
if a**5-b**5==x:
print(a,b)
exit() |
p02583 | s637408704 | Accepted | from collections import Counter
N = int(input())
L = list(map(int, input().split()))
c = Counter(L)
L = list(set(list(L)))
L.sort()
res = 0
for i in range(len(L) - 2):
k = i
for j in range(i + 1, len(L) - 1):
while k < len(L) and L[k] < L[i] + L[j]:
k += 1
#print(i, j, k)
for p in range(j + 1... |
p02701 | s026307736 | Accepted | n = int(input())
s = [input() for _ in range(n)]
ss = set(s)
ans = len(ss)
print(ans) |
p03665 | s155604485 | Accepted | N,P = map(int,input().split())
A = list(map(int,input().split()))
odd = 0
for i in range(N):
if A[i]%2 != 0:
odd += 1
if odd == 0:
if P == 0:
ans = 2**N
else:
ans = 0
else:
ans = 2**(N-1)
print(ans) |
p02922 | s022678051 | Wrong Answer | a, b = map(int, input().split())
result = 0
result += a
cnt = 1
while b < result:
result += a - 1
cnt += 1
print(cnt) |
p02555 | s225682763 | Accepted | s = int( input() )
mod = 10 ** 9 + 7
fact = [ 1, 1 ]
inv = [ 1, 1 ]
inv_fact = [ 1, 1 ]
for k in range( 2, 2000 ):
fact.append( fact[ k-1 ] * k % mod )
inv_k = ( - inv[ mod % k ] * ( mod // k ) % mod ) % mod
inv.append( inv_k )
inv_fact.append( inv_fact[ k - 1 ] * inv_k % mod )
# print( inv_fact[:5] ... |
p03309 | s417564016 | Wrong Answer | import math
N = int(input())
A = list(map(int, input().split()))
b = [x[1] - x[0] for x in enumerate(A,1)]
mean = sum(b) // N
c = [(x-mean)**2 for x in b]
disp1 = math.floor(math.sqrt(sum(c)/N))
disp2 = math.ceil(math.sqrt(sum(c)/N))
disp3 = disp1 * (-1)
disp4 = disp2 * (-1)
c1 = [abs(x-disp1) for x in b]
c2 = [abs(x-... |
p02693 | s346111587 | Accepted | K=int(input())
A,B=map(int,input().split())
if (A-1)//K == B//K:
print('NG')
else:
print('OK')
|
p03745 | s053983719 | Accepted | n = int(input())
a = list(map(int, input().split()))
cnt = 0
if n == 1:
print (1)
exit()
c = 0
for i in range(n-1):
if c == 2 and a[i+1] < a[i]:
cnt += 1
c = -1
elif c == 1 and a[i+1] > a[i]:
cnt += 1
c = -1
else:
if c < 1:
if a[i+1] > a[i]:
c = 2
elif a[i+1] == a[i]:
... |
p02988 | s456892858 | Accepted | n=int(input())
p=list(map(int, input().split()))
ans=0
for i in range(1, n-1):
if (p[i]-p[i-1])*(p[i+1]-p[i])>0:
ans+=1
print(ans) |
p02983 | s804657660 | Accepted | l, r = [int(x) for x in input().split()]
ans = 2200
for i in range(l, r):
if i % 2019 == 0:
ans = 0
break
else:
for j in range(i+1, r+1):
if i == j:
continue
elif j % 2019 == 0:
ans = 0
break
else:
... |
p02639 | s013958238 | Accepted | from sys import stdin
import sys
import math
# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
A = list(map(int, input().split()))
# U = input().split()
for i,v in enumerate(A):
if v==0:
print(i+1)
|
p02888 | s045141343 | Wrong Answer | N = int(input())
L_list = list(map(int, input().split()))
L_list = sorted(L_list)
count = 0
for i in range(N-2):
for j in range(i+1, N-1):
for k in range(j+1, N):
if L_list[i] + L_list[j] > L_list[k]:
print(L_list[i], L_list[j], L_list[k])
count += 1
... |
p03779 | s194583976 | Accepted | def kangaru(x):
count = 0
i = 0
while count < x:
count += i
i += 1
# while count != x:
# if count + (i * 2 + 1) <= x:
# count += i
# elif count + i == x:
# count += i
# i += 1
return i - 1
def main():
x = int(input())
print(kangaru(x... |
p03262 | s593187184 | Accepted | import fractions
from functools import reduce
def gcd_list(numbers):
return reduce(fractions.gcd, numbers)
def myAnswer(N:int,X:int,x:list) -> int:
ans = []
for a in x:
ans.append(abs(a-X))
return gcd_list(ans)
def modelAnswer():
return
def main():
N,X = map(int,input().split())
x = list(... |
p03417 | s971498472 | Accepted | N,M = map(int,input().split())
if N == 1 and M == 1:
print(1)
else:
print(abs((N-2)*(M-2))) |
p02973 | s565170359 | Accepted | n=int(input())
A=[int(input()) for i in range(n)]
l=[-A[0],1]#-にして小さい順から並ぶようにする
from bisect import *
for a in A[1:]:
idx=bisect_left(l,-a+1)
p=-l[idx]
if p==-1:
l[-1]=-a
l.append(1)
else:
l[idx]=-a
print(len(l)-1) |
p03854 | s398354491 | Wrong Answer | s = input()[::-1]
n = len(s)
words = ['maerd', 'remaerd', 'esare', 'resare']
p = 1
while p <= n:
if s[:p] in words:
s = s[p:]
p += 1
print('NO' if s else 'YES')
|
p03352 | s608437733 | Wrong Answer | import math
X = int(input())
print((int(math.sqrt(X)))**2) |
p02681 | s572967543 | Accepted | import sys
import math # noqa
import bisect # noqa
import queue # noqa
def input():
return sys.stdin.readline().rstrip()
def main():
S = input()
T = input()
if S == T[:-1]:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
|
p03435 | s953126592 | Wrong Answer | c = [[0, 0, 0] for _ in range(3)]
for i in range(3):
c[i] = list(map(int, input().split()))
a = [0, 0, 0]
b = [0, 0, 0]
for a1 in range(min(c[0])+1):
b = [c[i][0] - a1, c[i][1] - a1, c[i][2] - a1]
if c[1][0] - b[0] == c[1][1] - b[1] == c[1][2] - b[2]:
if c[2][0] - b[0] == c[2][1] - b[1] == c[2][2]... |
p02911 | s216309869 | Wrong Answer | from collections import defaultdict
N, K, Q = map(int,input().split())
d = defaultdict(int)
for _ in range(Q):
a = int(input())
d[a]+=1
for i in range(1,N+1):
if K-Q+d[i]>=0:
print('Yes')
else:
print('No') |
p02881 | s595654452 | Accepted | import math
N = int(input())
min_move_count = 10**13
for i in range(1, int(math.sqrt(N)) + 1):
if N % i == 0:
move_count = i + (N // i) - 2
if move_count < min_move_count:
min_move_count = move_count
ans = min_move_count
print(ans)
|
p02717 | s045022277 | Accepted | x,y,z = map(int,input().split())
print(z,x,y) |
p03998 | s255416332 | Wrong Answer | a=input()
b=input()
c=input()
from collections import deque
da=deque(list(a))
db=deque(list(b))
dc=deque(list(c))
now=da.popleft()
while (1):
if now=="a":
if da:
now=da.popleft()
else:
break
elif now=="b":
if db:
now=db.popleft()
else:
break
elif now=="c":
if dc:
... |
p03723 | s625011737 | Accepted | a, b, c = map(int, input().split())
ans = 0
if a == b == c and a % 2 == 0:
print(-1)
else:
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
total = a + b + c
a = (total - a) / 2
b = (total - b) / 2
c = (total - c) / 2
ans += 1
print(ans) |
p02607 | s103915627 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(1, len(a), 2):
if a[i]%2 == 1:
cnt += 1
print(cnt )
|
p03720 | s673640027 | Accepted | N, M = map(int, input().split())
load = []
for i in range(M):
load.append(input().split())
num = [0] * N
for j in range(N):
for k in range(M):
if str(j+1) == load[k][0] or str(j+1) == load[k][1]:
num[j] += 1
print(num[j])
|
p03910 | s835452606 | Accepted | n=int(input())
a=[1]
b=2
s=1
def pr(x):
for i in range(len(x)):
print(x[i])
while s<=n:
a.append(b)
s+=b
b+=1
if s==n:
pr(a)
else:
c=s-n
a.remove(c)
pr(a) |
p03035 | s929870540 | Accepted | a,b = map(int,input().split())
if a >= 13: print(b)
elif 6 <= a:print(b//2)
else:print(0)
|
p03860 | s301059527 | Accepted | S=list(map(str,input().split()))
print("A"+S[1][0]+"C") |
p03220 | s092961161 | Accepted | #!/usr/bin/env python3
n, t, a, *h = map(int, open(0).read().split())
h = list(map(lambda x: abs(a-(t-x*0.006)), h))
a = list(enumerate(h))
a.sort(key=lambda x: x[1])
print(a[0][0]+1)
|
p03611 | s364716515 | Wrong Answer | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
amin = min(a)
amax = max(a)
for x in range(amin, amax+1):
if x == 0:
continue
ans = max(ans, c[x-1]+c[x]+c[x+1])
print(ans)
|
p02608 | s250480479 | Accepted | n = int(input())
ans = [0]*10001
for a in range(1,101):
for b in range(1,101):
for c in range(1,101):
x = a**2+b**2+c**2+a*b+b*c+a*c
if x<10001:
ans[x] += 1
else:
break
for i in range(1,n+1):
print(ans[i]) |
p03494 | s057291597 | Accepted | n = int(input())
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
A = [a / 2 for a in A]
count += 1
print(count)
|
p03487 | s120979386 | Wrong Answer | import math
line1 = int(input())
line2 = str(input()).split(" ")
for index in range(len(line2)):
line2[index] = int(line2[index])
keepTrack = dict()
keys = []
for element in line2:
if element in keys:
keepTrack[element] += 1
else:
keepTrack[element] = 1
keys.append(element)
sum = 0... |
p02664 | s822496074 | Accepted | t=list(input())
pre_p=False
for i,tt in enumerate(t):
if tt == 'P':
pre_p=True
elif tt == 'D':
pre_p=False
elif pre_p:
t[i] = 'D'
elif i < len(t)-1:
if t[i+1] == 'D':
t[i] = 'P'
else:
t[i] = 'D'
else:
t[i] = 'D'
print(''.join(t)) |
p03012 | s964340492 | Accepted | n = int(input())
s = list(map(int, input().split()))
res = 10**9
for i in range(1,n):
a = sum(s[:i])
b = sum(s[i:])
res = min(res, abs(a-b))
print(res)
|
p03001 | s260288097 | Accepted | w,h,x,y = map(int, input().split())
if (x,y) == (w/2, h/2): print(w*h/2, 1)
else: print(w*h/2, 0) |
p02838 | s672334621 | Wrong Answer | import numpy as np
N=int(input())
A=np.array([int(x) for x in input().split()])
ans=0
M=pow(10,9)+7
for i in range(100):
one=np.sum((A>>i)&1)
zero=N-one
ans+=(one*zero)*pow(2,i)
ans%=M
#print(one,zero)
print(int(ans)) |
p03486 | s464807965 | Accepted | a=input()
b=input()
la,lb = len(a), len(b)
if a==b:
print('No')
elif (la< lb and set(a)==set(b)):
print('Yes')
else:
sa = sorted(a)
sb = sorted(b, reverse = True)
if (sa[:lb] < sb):
print('Yes')
else:
print('No') |
p03543 | s392720029 | Accepted | n = input()
if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]:
print('Yes')
else:
print('No')
|
p03785 | s638962046 | Accepted | def main():
n,c,k=map(int,input().split())
t=[]
for i in range(n):
ti=int(input())
t.append(ti)
t.sort()
ans=0
i=0
while i<n:
j=1
while j<c and i+j<n:
if t[i+j]>t[i]+k:
break
j+=1
ans+=1
i+=j
print(an... |
p03220 | s391003443 | Wrong Answer | n = int(input())
t, a = map(int,input().split())
min = 10000
h = list(map(int, (input().split())))
for i in range(n):
if(min > a - (t - h[i]*0.006)):
min = a - (t - h[i]*0.006)
ans = i+1
print(ans) |
p03796 | s971671655 | Accepted | import math
N = int(input())
print(math.factorial(N) % (10**9+7)) |
p03243 | s462797423 | Accepted | n = int(input())
if n % 111 == 0:
x = n
while n % 111 != 0:
x = n+1
n += 1
print(x) |
p02665 | s015697129 | Accepted | N = int(input())
A = [int(i) for i in input().split()]
total = []
num = 0
for i in reversed(range(N+1)):
num += A[i]
total.append(num)
total.reverse()
if A[0] == 1 and N == 0:
print(1)
exit()
if A[0] != 0:
print(-1)
exit()
ans = 1
num = 1
for i in range(1,N+1):
num = min(2*num, total[i])
... |
p02948 | s913921098 | Accepted | import heapq
n, m = map(int, input().split())
ab = []
for i in range(n):
ab.append(list(map(int, input().split())))
ab.sort()
ans = 0
num = 0
queue = []
heapq.heapify(queue)
for i in range(1, m + 1):
if num < n:
while ab[num][0] <= i:
heapq.heappush(queue, [-ab[num][1], ab[num][0]])
... |
p02639 | s509801996 | Wrong Answer | x = list(map(int,input().split()))
zero = 0
for i in range(5):
if x[i] == 0:
zero += 1
print(zero)
|
p03545 | s250730265 | Accepted |
ns=input()
for i in range(2**(len(ns))):
ops=["+"]*(len(ns)-1)
for j in range(len(ops)):
if((i>>j)&1):
ops[j]="-"
siki=""
for x,y in zip(ns,ops+[""]):
siki+=x+y
if eval(siki)==7:
print(siki+"=7")
break |
p03075 | s524831857 | Accepted | A = sorted([int(input()) for _ in range(5)])
k = int(input())
print('Yay!' if A[4]-A[0] <= k else ':(')
|
p02682 | s570938587 | Wrong Answer | a,b,c,k = map(int, input().split())
if a >= k:
an = k
bn = 0
cn = 0
elif a+b >= k:
an = a
bn = k - (a)
cn = 0
else:
an = a
bn = b
cn = k - (a+b+c)
print(an-cn)
|
p04030 | s147324000 | Wrong Answer | import re
text = input()
b_length = int(re.sub('B', '', text))
for _ in range(b_length):
text = re.sub('(0|1)??B', '', text, 1)
print(text) |
p03264 | s064811955 | Accepted | def main():
k = int(input())
if k % 2 == 0:
even = k // 2
odd = even
else:
even = k // 2
odd = k - even
print(even * odd)
if __name__ == "__main__":
main()
|
p03994 | s816919474 | Wrong Answer | S = list(input())
N = int(input())
'''
ordの位置
#z = 122
#a = 97
左の文字からNで'a'に出来るかを確認
aに出来るならaにして使った分をNから引く
繰り返して行き一番最後にあまりをすべて使う'''
for i, s in enumerate(S):
if ord(s) - 97 > 0 and 122 - ord(s) < N:
S[i] = "a"
N -= 123 - ord(s)
else:
print(chr(ord(S[i]) + N % 122 ))
print("".join(S)) |
p02777 | s565452736 | Accepted | #入力
S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())
#出力
if S == U:
print( A-1,B )
else:
print( A, B-1 ) |
p02948 | s293551604 | Accepted | from heapq import heappop,heappush
n,m=map(int,input().split())
L=[[] for _ in range(m)]
for _ in range(n):
a,b=map(int,input().split())
if a<=m:
L[m-a].append(b)
s=0
h=[]
for i in range(m-1,-1,-1):
for l in L[i][::-1]:
heappush(h,-l)
if len(h)>0:
s-=heappop(h)
print(s)
|
p03543 | s782254722 | Accepted | import re
n = input()
if re.search(r'(\d)\1{2,}', n):
print('Yes')
else:
print('No') |
p02952 | s340654263 | Accepted | n = int(input())
x = len(str(n))
ans = 0
if x%2 == 0:
for i in range(1,x+1,2):
ans += 10**i*(9/10)
else:
for i in range(1,x,2):
ans += 10**i*(9/10)
ans += n-10**(x-1)+1
print(int(ans)) |
p03095 | s397984034 | Accepted | #AGC031 A Colorful Subsequence
# Answer
N = int(input())
S = input()
alpha = [0]*26
mod = 10**9+7
for n in S:
num = ord(n)-97
alpha[num] += 1
ans = 1
for i in range(26):
ans *= (alpha[i]+1)
# ans %= mod
print((ans-1)%mod) |
p02572 | s643560902 | Wrong Answer | n=int(input())
import itertools
a=list(map(int,input().split()))
s=0
for i in itertools.combinations(a,2):
if i[0]==i[1]:
continue
else:
s+=i[0]*i[1]
print(s%(10**9+7))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.