problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03672 | s598184650 | Wrong Answer | s = input()
length = 0
if len(s) % 2 == 0:
length = len(s) // 2 - 1
else:
length = len(s) // 2
top = -1
for i in range(length):
flag = True
for j in range(i):
if s[i - j] != s[i + j + 1]:
flag = False
if flag :
top = (i+1) * 2
print(top)
|
p03817 | s947494695 | Accepted | x = int(input())
if (x-1)%11<6:
print(2*((x-1)//11)+1)
else:
print(2*((x-1)//11) +2)
|
p02756 | s919895947 | Wrong Answer | S=input()
Q=int(input())
rev=1
for i in range(Q):
t=input()
if t=='1':
rev+=1
rev=rev%2
else:
_,F,C=t.split(" ")
if (int(F)+rev)%2==1:
S=C+S
else:
S=S+C
if rev==1:
print(S[::-1])
else:
print(S)
|
p04011 | s523994665 | Accepted | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
print(n*x)
else:
print(k*x+(n-k)*y) |
p03437 | s216306121 | Wrong Answer | x,y=map(int,input().split())
if y%x == 0:
print(-1)
else:
print(x) |
p03633 | s477495883 | Wrong Answer | import sys
sys.setrecursionlimit(200000000)
N = int(input())
NUMS = [int(input()) for _ in range(N)]
NUMS = list(set(NUMS))
def gcd(num1, num2):
if num2 == 0:
return num1
else:
return gcd(num2, num1 % num2)
res = NUMS[0]
for num in NUMS[1:]:
res = res * num / max(gcd(res, num), 1)
print... |
p03210 | s826482994 | Accepted | idade = int(input())
if(idade == 7 or idade == 5 or idade == 3):
print("YES")
else:
print("NO") |
p02659 | s822050838 | Accepted | from decimal import Decimal
a, b = map(Decimal, input().split())
print(int(a*b))
|
p02631 | s902476593 | Accepted | import sys
from functools import reduce
read = sys.stdin.read
n, *lst = map(int, read().split())
lst_xor = reduce(lambda x, y: x ^ y, lst)
print(*[lst_xor ^ i for i in lst]) |
p02796 | s238008409 | Wrong Answer | import sys
input = sys.stdin.readline
def main():
N = int(input())
robo = []
for i in range(N):
x, l = [int(x) for x in input().split()]
robo.append((x-l, x+l))
robo.sort()
robo.sort(key=lambda x: x[1])
ans = N
l, r = robo[0]
for i in range(1, N):
if robo[i][0]... |
p03037 | s773277253 | Accepted | N, M = map(int,input().split())
left = 1
right = N
for _ in range(M):
L, R = map(int,input().split())
if L > left:
left = L
if R < right:
right = R
a = right - left
print(max(0, a + 1)) |
p03557 | s927524320 | Accepted | from bisect import bisect_left, bisect_right
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
ans = 0
for b in B:
a = bisect_left(A, b)
c = N - bisect_right(C, b)
ans += a * c
print(ans) |
p03323 | s897240079 | Wrong Answer | A, B = map(int,input().split())
if A <=8 and B <=8:
print('Yey')
else:
print(':(') |
p03210 | s124206865 | Accepted | X = int(input())
if X == 7 or X == 5 or X == 3:
print('YES')
else:
print('NO') |
p02696 | s616340621 | Accepted | a, b, n = map(int, input().split())
x = min(b-1, n)
print((a*x)//b) |
p02989 | s380256758 | Accepted | n = int(input())
d = list(map(int, input().split()))
d.sort()
a = n//2
if d[a] == d[a-1]:
print(0)
exit()
print(d[a] - d[a-1]) |
p02786 | s242771308 | Wrong Answer | h = int(input())
print(h**2-1)
|
p02624 | s044037857 | Accepted | N=int(input())
ans=0
for i in range(1,N+1):
for j in range(i,N+1,i):
ans=ans+j
print(ans) |
p02899 | s583140521 | Accepted | N = int(input())
A = [int(i) for i in input().split()]
A_tupple = [(idx+1, value) for idx, value in enumerate(A)]
A_tupple.sort(key=lambda x:x[1])
for a in A_tupple:
print(a[0], end=" ")
|
p02684 | s468777810 | Accepted | n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
curr = 0
arr = []
visited = [False]*n
while(not visited[curr]):
visited[curr] = True
arr.append(curr)
curr = a[curr]-1
visited = [False]*n
cycleSize = 0
while(not visited[curr]):
visited[curr] = True
cycleSize+=1
c... |
p02748 | s665131169 | Accepted | A, B, M = map(int, input().split())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
# 割引券使わない
ans = min(A_list) + min(B_list)
# 割引券読み込み
for i in range(1, M + 1):
x, y, c = map(int, input().split())
price = A_list[x - 1] + B_list[y - 1] - c
ans = min(ans, price)
print(an... |
p02777 | s803215951 | Accepted | S, T = input().split()
A, B = map(int, input().split())
U = input()
Balls = {}
Balls[S] = A
Balls[T] = B
Balls[U] -= 1
print(Balls[S], Balls[T])
|
p03160 | s889576154 | Accepted | n = int(input())
h = list(map(int, input().split()))
INF = 10**8
dp = [INF]*n
dp[0] = 0
for i in range(n-1):
if i == 0:
dp[i+1] = abs(h[i+1]-h[i])
else:
dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]), dp[i-1]+abs(h[i+1]-h[i-1]))
print(dp[n-1])
|
p03250 | s651598340 | Accepted | a,b,c=sorted(map(int,input().split(' ')))
print(c*10+b+a) |
p03821 | s659118805 | Wrong Answer | from collections import deque
n=int(input())
A=deque()
B=deque()
ans=0
for i in range(n):
a,b=map(int,input().split())
A.appendleft(a)
B.appendleft(b)
for i in range(n):
k=B[i]-(A[i]%B[i])
ans+=k
for j in range(i,n):
A[j]+=k
print(ans) |
p02583 | s234836876 | Accepted | import itertools
N = int(input())
L = [int(_) for _ in input().split()]
ans = 0
for i, j, k in itertools.combinations(range(N), 3):
a, b, c = sorted([L[i], L[j], L[k]])
if a + b > c and a != b and b != c:
ans += 1
print(ans)
|
p02690 | s094596093 | Accepted | X = int(input())
flag = 0
for a in range(-1000, 1000):
for b in range(-1000, 1000):
if a**5 - b**5 == X:
print(a, b)
flag = 1
break
if flag == 1:
break |
p03986 | s150739111 | Accepted | import sys
from collections import deque
input = sys.stdin.readline
def main():
X = input().rstrip()
stack = deque()
for s in X:
if s == "S":
stack.append(s)
else:
if len(stack) == 0 or stack[-1] == "T":
stack.append(s)
else:
... |
p03612 | s620885453 | Accepted | n = int(input())
a = list(map(int, input().split()))
ans = 0
switch = 0
for i in range(n):
if switch == 0:
if a[i] == i+1:
ans += 1
switch = 1
else:
switch = 0
print(ans) |
p02983 | s077319873 | Accepted | import sys
L, R = map(int, input().split())
P = 2019
if R - L >= 2019:
print(0)
sys.exit()
elif (R % P) - (L % P) < 0:
print(0)
sys.exit()
R %= P
L %= P
ans = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
ans = min(ans, (i * j) % P)
print(ans)
|
p03433 | s692241524 | Wrong Answer | N=int(input())
A=int(input())
mod=N%500
if mod>A:
print('Yes')
else:
print('No') |
p02760 | s082265171 | Accepted | A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
for _ in range(N):
B = int(input())
for i in range(3):
for j in range(3):
if A[i][j] == B:
A[i][j] = 0
bingo = False
for row in A:
if sum(row) == 0:
bingo = True
for col in zip(*A):
if sum(c... |
p03038 | s067149233 | Accepted | n,m = map(int,input().split())
a = list(map(int,input().split()))
import heapq
heapq.heapify(a)
BC=[list(map(int,input().split())) for _ in range(m)]
BC.sort(reverse=True,key=lambda x:x[1])
for i in range(m):
while BC[i][0]>0:
if BC[i][1] > a[0]:
minA = heapq.heappop(a)
heapq.heappus... |
p03592 | s536336157 | Accepted | n, m, k = map(int, input().split())
for i in range(n + 1):
for j in range(m + 1):
if i * m + j * n - 2 * i * j == k:
print("Yes")
exit()
print("No")
|
p03210 | s073218294 | Accepted | X = int(input())
if X == 7 or X == 5 or X == 3:
print("YES")
else:
print("NO") |
p03836 | s551285330 | Accepted | def resolve():
s_x, s_y, t_x, t_y = map(int, input().split())
d_x = t_x - s_x
d_y = t_y - s_y
p_1 = 'U'*d_y + 'R'*d_x
p_2 = 'D'*d_y + 'L'*d_x
p_3 = 'L' + 'U' * (d_y+1) + 'R' * (d_x+1) + 'D'
p_4 = 'R' + 'D' * (d_y+1) + 'L' * (d_x + 1) + 'U'
print(p_1+p_2+p_3+p_4)
if __name__ == '__main... |
p03289 | s991157963 | Accepted | s = list(input())
if s[0] == "A" and "C" in s[2:-1]:
s.remove("A")
s.remove("C")
for i in s:
if i.isupper():
print("WA")
exit()
print("AC")
else:
print("WA") |
p02789 | s954252798 | Wrong Answer | N, M = map(int, input().split())
if N == 1 and M == 1:
print("Yes")
else:
print("No") |
p02833 | s613961384 | Accepted | n = int(input())
if n % 2 == 1:
print(0)
exit()
ans = 0
ex = 1
while True:
expo = 2 * 5**ex
if n // expo == 0:
break
ans += n // expo
ex += 1
print(ans) |
p04031 | s187841802 | Wrong Answer | import math
N=int(input())
A=list(map(int,input().split()))
ans = []
AV=math.ceil(sum(A)/N)
for i in A:
ans.append((i-AV)**2)
print(sum(ans)) |
p03359 | s952279705 | Accepted | a,b=map(int,input().split())
print(a) if a<=b else print(a-1) |
p02842 | s573802058 | Wrong Answer | import math
n = int(input())
x1 = math.ceil(n/1.08)
x2 = math.floor((n+1)/1.08)
print(':(' if x2<x1 else x1) |
p03565 | s521724939 | Accepted | s = list(input())
t = input()
for i in range(len(s) - len(t), -1, -1):
for j in range(len(t)):
if s[i+j] != t[j] and s[i+j] != '?':
break
else:
for j in range(len(t)):
s[i+j] = t[j]
for j in range(len(s)):
if s[j] == '?':
s[j] = 'a'
... |
p03327 | s799772925 | Accepted | n=int(input())
if n>=1000:
print('ABD')
else:
print('ABC') |
p02717 | s252397213 | Wrong Answer | a, b, c = map(int,input().split())
print('c'+' a'+' b') |
p02939 | s589114391 | Accepted | def main():
S = input()
ans = 0
tmp = ''
pre = ''
for s in S:
tmp += s
if tmp != pre:
pre = tmp
tmp = ''
ans += 1
print(ans)
if __name__ == "__main__":
main()
|
p03206 | s786792028 | Wrong Answer | d = int(input())
D = "Christmas"
D_1 = "Chrismas Eve"
D_2 = "Christmas Eve Eve"
D_3 = "Christmas Eve Eve Eve"
if d == 25:
print(D)
elif d == 24:
print(D_1)
elif d == 23:
print(D_2)
else:
print(D_3)
|
p02959 | s138319588 | Accepted | n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(n):
if a[i]>b[i]:
ans+=b[i]
else:
ans+=a[i]
if a[i+1]>(b[i]-a[i]):
ans+=b[i]-a[i]
a[i+1]-=(b[i]-a[i])
else:
ans+=a[i+1]
a[i+1]=0
... |
p03778 | s764140596 | Accepted | W,A,B = map(int,input().split())
print(max(abs(A-B)-W,0)) |
p03723 | s168785555 | Accepted | *a,=map(int,input().split())
b=[bin(a[i+1]-a[i])[::-1].find('1')for i in (0,1)]
print((max(b) if b[0]*b[1]<0 else min(b))*(1-sum(a)%2)) |
p03943 | s441525430 | Wrong Answer | n = input().split()
a = int(n[0])
b = int(n[1])
c = int(n[2])
if (a + b) == c:
print('Yes')
elif (a + b) == c:
print('Yes')
elif (a + c) == b:
print('Yes')
else:
print('No') |
p03073 | s156272080 | Wrong Answer | S = input()
S_int = map(int, S)
if len(S) == 1:
print(0)
else:
s = list(S_int)
def reverse_count(s, initial):
count = 0
c = initial
for i in range(len(s) - 1):
if s[i] != c:
count += 1
c = (c + 1) % 2
return count
### 0スター... |
p03250 | s520744460 | Wrong Answer | A,B,C=map(int, input().split()) #複数数値入力 「A B」みたいなスペース空いた入力のとき
if A==max(A,B,C):
print(A*10+B+C)
elif B==max(A,B,C):
print(B*10+A+C)
if C==max(A,B,C):
print(C*10+B+A) |
p02702 | s273474616 | Accepted | import sys
input = sys.stdin.readline
mod = 2019
s = input().rstrip()
n = len(s)
mod_list = [0]
for i in range(n - 1, -1, -1):
mod_list.append((mod_list[-1] + int(s[i]) * pow(10, n - 1 - i, mod)) % mod)
from collections import Counter
c = Counter(mod_list)
ans = 0
for i in c.keys():
ans += c[i] * (c[i] - 1) // ... |
p02594 | s253789227 | Accepted | print('Yes' if int(input()) >= 30 else 'No') |
p03011 | s206496397 | Wrong Answer | s = list(map(int,input().split()))
s.sort
set(s)
print(sum(s[:2]))
|
p03126 | s787474066 | Wrong Answer | n,m = list(map(int,input().split()))
ka = [list(map(int,input().split())) for _ in range(n)]
for i in ka:
del(i[0])
flag_1 = False
count = 0
for i in range(1,m):
for j in ka:
if j.count(i) >= 1:
flag_1 = True
else:
flag_1 = False
break
if flag_1:
c... |
p02813 | s919370841 | Accepted | from functools import reduce
n = int(input())
def r(n, m, l):
if n == 1:
return [m * 10 + l[0]]
return reduce(lambda a, b: a + b, [r(n-1, m * 10 + l[i], l[:i] + l[i + 1:]) for i in range(0, n)])
d = r(n, 0, list(range(1, n+1)))
p = int(reduce(lambda a, b: a + b, input().split()))
q = int(reduce(lambda a... |
p02775 | s753406735 | Accepted | N = input()[::-1]
l = len(N)
n0 = int(N[0])
dp = [[0, 0] for i in range(l)]
dp[0] = [n0, 11-n0]
for i, n in enumerate(N[1:], 1):
n = int(n)
dp[i][0] = min(dp[i-1][0]+n, dp[i-1][1]+n)
dp[i][1] = min(dp[i-1][0]+1+(10-n), dp[i-1][1]+(9-n))
print(min(dp[-1])) |
p02793 | s095668830 | Accepted | N = input()
A = list(map(int, input().split()))
def lcm(x, y):
return (x * y) // gcd(x, y)
def gcd(x, y):
if y == 0:
return x
return gcd(y, x%y)
l = 1
for i in A:
l = lcm(l, i)
ans = 0
for i in A:
ans += l // i
print(ans%1000000007) |
p02775 | s804854659 | Accepted | N = input().replace("\n", "")
L = len(N)
dp = [[0 for _ in range(2)] for i in range(L+1)]
dp[0][1] = 1
for i in range(L):
n = int(N[i])
dp[i+1][0] = min(dp[i][0]+n, dp[i][1]+(10-n))
dp[i+1][1] = min(dp[i][0]+n+1, dp[i][1]+(9-n))
print(dp[L][0])
|
p02879 | s797474324 | Wrong Answer | A, B = map(int, input().split())
if A>=9 or B>=9:
print(-1)
else:
print(A*B)
|
p02946 | s246772934 | Accepted | k, x = map(int, input().split())
print(' '.join(map(str, range(x-k+1, x+k))))
|
p02755 | s001941778 | Accepted | a,b=map(int,input().split())
import math
ans=0
for i in range(1,1001):
aa=math.floor(i*0.08)
bb=math.floor(i*0.1)
if aa==a and bb==b:
print(i)
break
else:
print(-1) |
p02717 | s241633427 | Accepted | x, y, z = map(int, input().split())
print(z, x, y)
|
p02646 | s206995478 | Wrong Answer | a, v = input().split(' ')
a = int(a)
v = int(v)
b, u = input().split(' ')
b = int(b)
u = int(u)
t = int(input())
if a + v * t >= b + u * t :
print('YES')
else:
print('NO') |
p02755 | s695337850 | Wrong Answer | A, B = map(int, input().split())
for i in range(1000):
if int(i*0.08)==A and int(i*0.1)==B:
print(i)
exit()
print(-1) |
p02833 | s940347018 | Accepted | def main():
N=int(input())
if N%2!=0:
print(0)
exit()
k=10
ans=0
while(k<=N):
ans+=N//k
k*=5
print(ans)
if __name__=="__main__":
main() |
p02784 | s501556734 | Accepted | h,n=map(int,input().split())
a=[0]*n
a=list(map(int,input().split()))
print("Yes" if (h<=sum(a)) else "No") |
p02779 | s538979800 | Wrong Answer | N = int(input())
l = sorted([int(x) for x in input().split()])
ans = 'YES'
for i in range(N-1):
if l[0] == l[1]:
ans = 'NO'
print(ans) |
p02707 | s439202956 | Accepted | N = int(input())
A = list(map(int, input().split()))
dic = {}
for i in range(1, N+1):
dic[i] = 0
for i in A:
dic[i] += 1
for ans in dic.values():
print(ans)
|
p03161 | s641857581 | Wrong Answer | def solve(a,k,dp):
for i in range(2,n+1):
for j in range(i-1, max(0, i-k-1), -1):
# print(i,j)
dp[i] = min(dp[i], dp[j] + abs(a[i]-a[j]))
# print(dp[j], i, j)
# print(dp[i])
n,k = map(int, input().split())
a = list(map(int, input().split()))
a.insert(0,0)
dp = [99999 for i in range(n+2)]
dp[1] = 0
... |
p03944 | s330136910 | Accepted | w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(n)]
w1 = 0
w2 = w
h1 = 0
h2 = h
for x, y, a in xya:
if a == 1:
w1= max(w1, x)
if a == 2:
w2 = min(w2, x)
if a == 3:
h1 = max(h1, y)
if a == 4:
h2 = min(h2, y)
print(max(0, ... |
p03637 | s062945326 | Accepted | N = int(input())
A=list(map(int,input().split()))
odd_num=0
bai_four=0
for i in range(N):
if A[i]%2==1:
odd_num=odd_num+1
elif A[i]%4==0:
bai_four=bai_four+1
if N%2==0:
if odd_num <= bai_four:
print('Yes')
else:
print('No')
else:
if odd_num <= bai_four+1:
prin... |
p02547 | s150835576 | Accepted | n=int(input())
s=0
l=0
for i in range(n):
b,c=map(int,input().split())
if b==c:
l+=1
else:
l=0
if l>=3:
s+=1
if s==0:
print("No")
else:
print("Yes") |
p03592 | s058934159 | Accepted | H,W,target = map(int,input().split())
res = 'No'
for w in range(0,W+1):
for h in range(0,H+1):
num_black = w * h + (W-w)*(H-h)
if num_black == target:
res = 'Yes'
print(res) |
p02727 | s957810284 | Accepted | X, Y, A, B, C = map(int, input().strip().split())
p = list(map(int, input().strip().split()))
q = list(map(int, input().strip().split()))
r = list(map(int, input().strip().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p=p[:X]
q=q[:Y]
lst=p+q+r
lst.sort(reverse=True)
ans=sum(lst[:X+Y])
pri... |
p03759 | s361871287 | Wrong Answer | a,b,c=map(int,input().split())
print("Yes" if b-a==c-b else "No") |
p02766 | s989136813 | Accepted | N, K = map(int, input().split())
ans = 1
while K ** ans <= N:
ans += 1
print(ans) |
p03000 | s326463290 | Accepted | inputted = list(map(int, input().split()))
N = inputted[0]
X = inputted[1]
L = list(map(int, input().split()))
x = 0
number_of_bounds = 0
for _i, Li in enumerate(L):
number_of_bounds = _i + 1
x += Li
if x > X: break
if x <= X:
number_of_bounds += 1
print(number_of_bounds)
|
p03286 | s299266464 | Accepted | N = int(input())
a = ""
if N == 0:
a = 0
while N != 0:
if N % 2 != 0:
N -= 1
a = "1" + a
else:
a = "0" + a
N = N // -2
print(a)
|
p03109 | s678458113 | Wrong Answer | a, b, c = (int(i) for i in input().split('/'))
n = a*1e7 + b*1e3 + c*10
if n > 20190430:
print('TBD')
else:
print('Heisei') |
p02817 | s544969646 | Accepted | s,t = input().split()
print(t+s)
|
p03146 | s492691071 | Accepted | import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
return sys.stdin.readline().rstrip()
def main():
s=int(input())
S=set()
S.add(s)
n=s
for i in range(2,10**7):
if n%2:
n=3*n+1
else:
n=n//2
if n in S:
print(i)
... |
p02912 | s847503166 | Wrong Answer | import sys
import heapq
stdin = sys.stdin
n,m = map(int, stdin.readline().split())
# 最大値を取得するために、マイナス各値にマイナスをかける。
an = [i*(-1) for i in map(int, stdin.readline().split())]
#print(an)
# リストのheap化
heapq.heapify(an)
# heapから最大値を取り出して、半分にしてヒープに戻すことをm回。
for _ in range(m):
b = heapq.heappop(an)
heapq.heappush(an,... |
p02957 | s747260339 | Wrong Answer | #--Harmony
a, b = map(int, input().split())
N = a + b
if (N % 2 == 0):
print(N/2)
else:
print("IMPOSSIBLE")
|
p02578 | s055344872 | Wrong Answer | def main():
N = map(int, input().split())
A = list(map(int, input().split()))[::-1]
cont = 0
ans_val = 0
for i in range(len(A) - 1):
if A[i] <= A[i+1]:
cont += 1
diff = A[i+1] - A[i]
ans_val += diff * cont
else:
cont = 0
return ans_... |
p02729 | s862080560 | Accepted |
n,m = map(int,input().split())
x = (n*(n-1))/2
y = (m*(m-1))/2
print(int(x+y))
|
p02607 | s156519498 | Accepted | N=int(input())
A=list(map(int,input().strip().split()))
c=0
for i in range(N):
if (i+1)%2!=0 and A[i]%2!=0:
c+=1
print(c) |
p02595 | s470852259 | Accepted | n, d = map(int, input().split())
total = 0
for i in range(n):
x, y = map(int, input().split())
if (x**2 + y**2)**0.5 <= d:
total += 1
print(total) |
p02720 | s578192022 | Accepted | k=int(input())
result = []
def dfs(pos, val):
result.append(val)
if pos == 10:
return
for i in range(-1,2):
add_num = (val % 10) + i
if 0 <= add_num <= 9:
dfs(pos+1, val*10+add_num)
for i in range(1,10):
dfs(1,i)
result.sort()
print(result[k-1]) |
p02706 | s975650508 | Wrong Answer | N, M = map(int, input().split())
A = [int(i) for i in range(M)]
B = sum(A)
if N <= B:
print(N-B)
else:
print('-1') |
p03455 | s680863922 | Accepted | a,b = map(int,input().split())
if (a*b)%2 == 0:
print("Even")
else:
print("Odd") |
p03062 | s941812721 | Accepted | N = int(input())
a = list(map(int, input().split()))
minus_cnt=0
zero_flag=False
mn = 10**10
sm = 0
for i in range(N):
if a[i] == 0:
zero_flag=True
if a[i] < 0:
minus_cnt+=1
if mn > abs(a[i]):
mn = abs(a[i])
sm+=abs(a[i])
if zero_flag or minus_cnt%2==0:
print(sm)
else:
... |
p03435 | s624202131 | Accepted | c11,c12,c13 = map(int, input().split())
c21,c22,c23 = map(int, input().split())
c31,c32,c33 = map(int, input().split())
if c21-c11==c22-c12==c23-c13 and c31-c21==c32-c22==c33-c23:
print("Yes")
else:
print("No") |
p03041 | s160797855 | Accepted | n,k=map(int,input().split())
s = list(input())
s[k-1]=s[k-1].lower()
print(''.join(s)) |
p02760 | s807609546 | Accepted | from itertools import combinations
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
ans = []
for i in b:
for x in range(3):
for y in range(3):
if i == a[x][y]:
ans.append(3*x+y)
if len(ans) <= 2:
print("No")
exit()
ans.sort()
for i,j,k ... |
p02583 | s772643575 | Accepted | n = int(input())
l = list(map(int, input().split(" ")))
l.sort()
ans = 0
for i in range(n):
for j in range(i+1, n):
for k in range(j+1, n):
if l[i] != l[j] != l[k]:
if l[i] + l[j] > l[k]:
ans += 1
print(ans) |
p02664 | s888933460 | Wrong Answer | T = input()
ans = ""
for i in range(len(T)):
if(T[i] == "?"):
if(i != len(T)-1 and T[i+1] == "D"):
ans += "P"
continue
elif(i != len(T)-1 and T[i+1] == "?"):
ans += "P"
continue
ans += "D"
else:
ans += T[i]
print(ans) |
p02829 | s008904153 | Accepted | def main():
A = int(input())
B = int(input())
print(6-(A+B))
if __name__ == "__main__":
main() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.