wrong_submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 131k 1.05M | wrong_status stringclasses 2
values | wrong_cpu_time float64 10 40k | wrong_memory float64 2.94k 3.37M | wrong_code_size int64 1 15.5k | problem_description stringlengths 1 4.75k | wrong_code stringlengths 1 6.92k | acc_submission_id stringlengths 10 10 | acc_status stringclasses 1
value | acc_cpu_time float64 10 27.8k | acc_memory float64 2.94k 960k | acc_code_size int64 19 14.9k | acc_code stringlengths 19 14.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s866345341 | p03672 | u814986259 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 167 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | S=input()
for i in reversed(range(len(S))):
if i % 2 == 1:
moji1 = S[0:i//2 + 1]
moji2 = S[i//2 + 1: i+ 1]
if moji1==moji2:
print(i+1)
break | s341367537 | Accepted | 17 | 2,940 | 107 | S = input()
for i in range(len(S)-2, -1, -2):
if S[:i//2] == S[i//2:i]:
print(i)
break
|
s118668180 | p03729 | u231875465 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 164 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a, b, c = input().split()
def check(a, b, c):
if a[-1] == b[0] and b[-1] == c[0]:
return True
return False
print('Yes' if check(a, b, c) else 'No')
| s508958089 | Accepted | 17 | 3,064 | 164 | a, b, c = input().split()
def check(a, b, c):
if a[-1] == b[0] and b[-1] == c[0]:
return True
return False
print('YES' if check(a, b, c) else 'NO')
|
s432689004 | p03568 | u291988695 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 370 | We will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are _similar_ when |x_i - y_i| \leq 1 holds for all i (1 \leq i \leq N). In particular, any integer sequence is similar to itself. You are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N. How man... | i=int(input())
s=input().split()
j=[]
k=[]
a=0
for h in range(i):
j.append(int(s[h])%2)
for g in range(i):
plus=1
if j[g]==0:
if len(k)>0:
for h in k:
plus=plus*h
plus=plus*(3^(9-g))
a+=plus
k.append(2)
else:
if len(k)>0:
for h in k:
plus=plus*h
plus=2*plus*(3... | s059393469 | Accepted | 28 | 9,080 | 188 | n=int(input())
ls=list(map(int,input().split()))
prev=1
ans=0
for i in range(n):
k=ls[i]
if k%2==1:
ans+=prev*2*(3**(n-i-1))
else:
ans+=prev*3**(n-i-1)
prev*=2
print(ans) |
s447826183 | p03140 | u945460548 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 572 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | N = int(input())
A = input()
B = input()
C = input()
cnt = 0
for idx in range(N):
if A[idx] == B[idx] and A[idx] == C[idx] and B[idx] == C[idx]:
print(0)
continue
elif A[idx] == B[idx]:
C = C[:idx] + A[idx] + C[idx+1:]
cnt += 1
elif A[idx] == C[idx]:
B = B[:idx] + A[... | s478579730 | Accepted | 18 | 3,064 | 555 | N = int(input())
A = input()
B = input()
C = input()
cnt = 0
for idx in range(N):
if A[idx] == B[idx] and A[idx] == C[idx] and B[idx] == C[idx]:
continue
elif A[idx] == B[idx]:
C = C[:idx] + A[idx] + C[idx+1:]
cnt += 1
elif A[idx] == C[idx]:
B = B[:idx] + A[idx] + B[idx+1:]
... |
s896805942 | p02255 | u554198876 | 1,000 | 131,072 | Wrong Answer | 30 | 7,684 | 275 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | N = int(input())
A = [int(i) for i in input().split()]
def insertionSort(A, N):
for i in range(N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(A)
insertionSort(A, N) | s927969645 | Accepted | 40 | 7,720 | 303 | N = int(input())
A = [int(i) for i in input().split()]
def insertionSort(A, N):
for i in range(N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(' '.join([str(i) for i in A]))
insertionSort(A, N) |
s949886147 | p03416 | u157085392 | 2,000 | 262,144 | Wrong Answer | 89 | 2,940 | 172 | Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. | a,b = [int(x) for x in input().split()]
def ip(n):
s = list(str(n))
r = s
r.reverse()
return r == s
ans = 0
for i in range(a,b+1):
if ip(i): ans += 1
print(ans) | s239373470 | Accepted | 114 | 3,060 | 175 | a,b = [int(x) for x in input().split()]
def ip(n):
r = list(str(n))
r.reverse()
return r == list(str(n))
ans = 0
for i in range(a,b+1):
if ip(i): ans += 1
print(ans) |
s221209637 | p03477 | u507116804 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 123 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | a,b,c,d=map(int,input().split())
m=a+b
n=c+d
if m>n:
print("left")
elif m==n:
print("balanced")
else:
print("left") | s501259967 | Accepted | 17 | 3,060 | 124 | a,b,c,d=map(int,input().split())
m=a+b
n=c+d
if m>n:
print("Left")
elif m==n:
print("Balanced")
else:
print("Right") |
s424440521 | p03556 | u146714526 | 2,000 | 262,144 | Wrong Answer | 35 | 3,060 | 440 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. |
def main():
N = int(input())
num = 1
for i in range(1,6):
if N >= (10**i)**2 and N < (10**(i+1))**2:
for j in range(10**i, 10**(i+1)):
if j**2 > 10**9 or j**2 > N:
print (num)
return
else:
num = j**2... | s690276980 | Accepted | 35 | 2,940 | 439 |
def main():
N = int(input())
num = 1
for i in range(6):
if N >= (10**i)**2 and N < (10**(i+1))**2:
for j in range(10**i, 10**(i+1)):
if j**2 > 10**9 or j**2 > N:
print (num)
return
else:
num = j**2
... |
s515190176 | p03598 | u252828980 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 146 | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t... | n = int(input())
k = int(input())
li = list(map(int,input().split()))
num = 0
for i in range(n):
num += max(abs(li[i]),abs(k-li[i]))
print(num)
| s586457402 | Accepted | 17 | 2,940 | 147 | n = int(input())
k = int(input())
li = list(map(int,input().split()))
num = 0
for i in range(n):
num += min(abs(li[i]),abs(k-li[i]))
print(num*2) |
s849141159 | p02613 | u392441504 | 2,000 | 1,048,576 | Wrong Answer | 149 | 16,228 | 269 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N = int(input())
S = []
for i in range(N):
S.append((input()))
ac = str(S.count('AC'))
wa = str(S.count('WA'))
tle = str(S.count('TLE'))
re = str(S.count('TLE'))
ans = 'AC x'+' '+ ac + "\n"+'WA x'+' '+ wa + "\n"+'TLE x' +' '+ tle +"\n" + 'RE x'+' '+re
print(ans) | s452357511 | Accepted | 148 | 16,108 | 269 | N = int(input())
S = []
for i in range(N):
S.append((input()))
ac = str(S.count('AC'))
wa = str(S.count('WA'))
tle = str(S.count('TLE'))
re = str(S.count('RE'))
ans = 'AC x'+' '+ ac + "\n"+'WA x'+' '+ wa + "\n"+'TLE x' +' '+ tle +"\n" + 'RE x'+' '+re
print(ans) |
s925558995 | p02806 | u477977638 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,060 | 408 | Niwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, respectively. It is guaranteed that s_1,\ldots,s_N are all distinct. Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, w... | import sys
input = sys.stdin.readline
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
n=int(input())
s=[]
t=[]
for i in range(n):
a,b=input().split()
s.append(a)
t.append(int(b))
x=input()
for i in range(n):
if x==s[i]:
print(sum(t[i+1:]))
ex... | s076773368 | Accepted | 18 | 3,060 | 358 | import sys
# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np
def main():
n=int(input())
s=[]
t=[]
for i in range(n):
a,b=input().split()
s.append(a)
t.append(int(b))
x=input()
for i in range(n):
if x==s[i]:
print(sum(t[i+1:]))
if __name__ == "__main__":
mai... |
s763965514 | p03435 | u881116515 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 208 | We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) ... | a = [list(map(int,input().split())) for i in range(3)]
if a[0][0]-a[1][0] == a[0][1]-a[1][1] == a[0][2]-a[1][2] and a[1][0]-a[2][0] == a[1][1]-a[2][1] == a[1][2] == a[2][2]:
print("Yes")
else:
print("No") | s181624842 | Accepted | 17 | 3,060 | 206 | a = [list(map(int,input().split())) for i in range(3)]
if a[0][0]-a[1][0] == a[0][1]-a[1][1] == a[0][2]-a[1][2] and a[1][0]-a[2][0] == a[1][1]-a[2][1] == a[1][2]-a[2][2]:
print("Yes")
else:
print("No")
|
s400763706 | p03386 | u226912938 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 186 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | a, b, k = map(int, input().split())
X = []
for i in range(a, min(a+k, b)):
X.append(i)
for j in range(max(b-k+1, a+1), b+1):
X.append(j)
X_s = set(X)
for k in X_s:
print(k) | s354002883 | Accepted | 17 | 3,064 | 220 | a, b, k = map(int, input().split())
X = []
for i in range(a, min(a+k, b+1)):
X.append(i)
for j in range(max(b-k+1, a), b+1):
X.append(j)
X = sorted(X)
X_s = sorted(set(X), key=X.index)
for k in X_s:
print(k) |
s242487742 | p03409 | u444856278 | 2,000 | 262,144 | Wrong Answer | 21 | 3,064 | 619 | On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ... | from bisect import bisect
N = int(input())
red, blue = [], []
for _ in range(N):
red.append(tuple(int(i) for i in input().split()))
for _ in range(N):
blue.append(tuple(int(i) for i in input().split()))
pair = []
red.sort(key=lambda x: x[0])
blue.sort(reverse=True,key=lambda x: x[0])
r = [po[0] for po in red]... | s070249329 | Accepted | 19 | 3,064 | 423 | N = int(input())
red, blue = [], []
for _ in range(N):
red.append(tuple(int(i) for i in input().split()))
for _ in range(N):
blue.append(tuple(int(i) for i in input().split()))
ans = 0
red.sort(reverse=True,key=lambda x: x[0])
blue.sort(key=lambda x: x[1])
for bl in blue:
for re in red:
if re[0] <... |
s723518359 | p02261 | u613534067 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 838 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl... | def bubble_sort(c, n):
x = c[:]
for i in range(n):
for k in range(n-1, i, -1):
if x[k][1] < x[k-1][1]:
x[k], x[k-1] = x[k-1], x[k]
return x
def selection_sort(c, n):
x = c[:]
for i in range(n):
mink = i
for k in range(i, n):
if x[k][1]... | s584045275 | Accepted | 30 | 5,616 | 838 | def bubble_sort(c, n):
x = c[:]
for i in range(n):
for k in range(n-1, i, -1):
if x[k][1] < x[k-1][1]:
x[k], x[k-1] = x[k-1], x[k]
return x
def selection_sort(c, n):
x = c[:]
for i in range(n):
mink = i
for k in range(i, n):
if x[k][1]... |
s802692344 | p02600 | u499061721 | 2,000 | 1,048,576 | Wrong Answer | 26 | 8,992 | 194 | M-kun is a competitor in AtCoder, whose highest rating is X. In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given: * From 400 through 599: 8-kyu * From 600 through 799: 7-kyu * From 800 through 999: 6-kyu * Fr... | X = int(input())
up = 599
down = 400
i=8
while(X <= 400 and X >= 1999):
if(X <= up and X >= down):
print(i)
break
else:
up += 200
down += 200
i-=1 | s228003999 | Accepted | 31 | 9,124 | 178 | X = int(input())
up = 599
down = 400
i=8
while(i>=1):
if(X <= up and X >= down):
print(i)
break
else:
up += 200
down += 200
i -= 1 |
s975288222 | p03760 | u598229387 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | o = input()
e = input()
for i,j in zip(o,e):
print(i+j,end='') | s475650832 | Accepted | 17 | 3,064 | 292 | o=list(input())
e=list(input())
ans=[]
if len(o)==len(e):
for i in range(len(o)):
ans.append(o[i])
ans.append(e[i])
print(''.join(ans))
else:
for i in range(len(e)):
ans.append(o[i])
ans.append(e[i])
ans.append(o[-1])
print(''.join(ans))
|
s659451240 | p03141 | u102960641 | 2,000 | 1,048,576 | Wrong Answer | 639 | 33,616 | 245 | There are N dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish 1, Dish 2, ..., Dish N. When Takahashi eats Dish i, he earns A_i points of _happiness_ ; when Aoki eats Dish i, she earns B_i points of happiness. Starting from Takahashi, they alternately choose one dish a... | n = int(input())
a = []
for i in range(n):
a1,a2 = map(int, input().split())
a.append([a1+a2,a1,a2])
a.sort()
a.reverse()
ans = 0
print(a)
for i in range(n):
if i % 2 == 0:
ans += a[i//2][1]
else:
ans -= a[i//2 + 1][2]
print(ans) | s526694071 | Accepted | 574 | 23,260 | 226 | n = int(input())
a = []
for i in range(n):
a1,a2 = map(int, input().split())
a.append([a1+a2,a1,a2])
a.sort()
a.reverse()
ans = 0
for i in range(n):
if i % 2 == 0:
ans += a[i][1]
else:
ans -= a[i][2]
print(ans) |
s559295110 | p02612 | u981884699 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,136 | 41 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N = int(input())
v = (N % 1000)
print(v) | s287186826 | Accepted | 29 | 9,148 | 71 | N = int(input())
v = (N % 1000)
if v != 0:
v = 1000 - v
print(v) |
s116135496 | p03635 | u272377260 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 45 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | n, m = map(int, input().split())
print(n * m) | s422734990 | Accepted | 17 | 2,940 | 54 | n, m = map(int, input().split())
print((n-1) * (m -1)) |
s131822703 | p03352 | u222634810 | 2,000 | 1,048,576 | Wrong Answer | 20 | 2,940 | 89 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | X = int(input())
for i in range(32):
if X < i * i:
print((i-1) * (i-1))
| s729256123 | Accepted | 17 | 2,940 | 210 | import sys
X = int(input())
array = []
for i in range(2, 11):
for j in range(1, 33):
if pow(j, i) > X:
break
else:
array.append(pow(j, i))
print(max(array)) |
s680888870 | p02615 | u525589885 | 2,000 | 1,048,576 | Wrong Answer | 112 | 31,608 | 183 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | n = int(input())
c = list(map(int, input().split()))
c.sort(reverse = True)
a = 0
for i in range(int(n//2+1)):
a += c[i]
if n%2==0:
print(a*2-c[0])
else:
print(a*2-c[0]-c[n//2]) | s250872841 | Accepted | 123 | 31,584 | 185 | n = int(input())
c = list(map(int, input().split()))
c.sort(reverse = True)
a = 0
for i in range(int((n+1)//2)):
a += c[i]
if n%2==0:
print(a*2-c[0])
else:
print(a*2-c[0]-c[n//2]) |
s666061030 | p02854 | u985408358 | 2,000 | 1,048,576 | Wrong Answer | 208 | 26,220 | 319 | Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters. Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be po... | n = int(input())
a= [int(x) for x in input().split(" ",n-1)]
print(a)
s = 0
for x in range(n):
s += a[x-1]
r = 0
l = 0
x = 0
while r < s/2:
r += a[x]
x += 1
y = 1
while l < s/2:
l += a[n-y]
y += 1
if r == s//2:
print(0)
else:
k = min(r,l)
v = k - s/2
m = v // 0.5
print(int(m)) | s026476837 | Accepted | 185 | 26,220 | 310 | n = int(input())
a= [int(x) for x in input().split(" ",n-1)]
s = 0
for x in range(n):
s += a[x-1]
r = 0
l = 0
x = 0
while r < s/2:
r += a[x]
x += 1
y = 1
while l < s/2:
l += a[n-y]
y += 1
if r == s//2:
print(0)
else:
k = min(r,l)
v = k - s/2
m = v // 0.5
print(int(m)) |
s229818205 | p03447 | u474925961 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 134 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | import sys
if sys.platform =='ios':
sys.stdin=open('input_file.txt')
x,a,b=[int(input()) for i in range(3)]
print((x-a)//b) | s561546314 | Accepted | 17 | 2,940 | 144 | import sys
if sys.platform =='ios':
sys.stdin=open('input_file.txt')
x,a,b=[int(input()) for i in range(3)]
print((x-a)-((x-a)//b)*b) |
s358914980 | p02388 | u433250944 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 70 | Write a program which calculates the cube of a given integer x. | x = input()
n = (int(x)**3)
print("n =" ,n)
| s936890257 | Accepted | 20 | 5,576 | 63 | x = input()
n = (int(x)**3)
print(n)
|
s629537484 | p02613 | u630237503 | 2,000 | 1,048,576 | Wrong Answer | 142 | 9,208 | 450 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | def main():
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(0, N):
res = input()
if (res == 'AC'):
ac += 1
if (res == 'WA'):
wa += 1
if (res == 'TLE'):
tle += 1
if (res == 'RE'):
re += 1
prin... | s997105153 | Accepted | 146 | 9,212 | 450 | def main():
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(0, N):
res = input()
if (res == 'AC'):
ac += 1
if (res == 'WA'):
wa += 1
if (res == 'TLE'):
tle += 1
if (res == 'RE'):
re += 1
prin... |
s916230863 | p03130 | u658915215 | 2,000 | 1,048,576 | Wrong Answer | 27 | 8,944 | 177 | There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roa... | l = []
for i in range(3):
l += list(map(int, input().split()))
print(l)
for i in range(4):
if l.count(i) == 3:
print('NO')
break
else:
print('YES') | s917825209 | Accepted | 28 | 9,164 | 172 | l = []
for _ in range(3):
l += list(map(int, input().split()))
for i in range(4):
if l.count(i + 1) == 3:
print('NO')
break
else:
print('YES') |
s956346016 | p03637 | u466105944 | 2,000 | 262,144 | Wrong Answer | 74 | 14,252 | 348 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | n = int(input())
a_list = list(map(int,input().split()))
zero = 0
one = 0
two = 0
for a in a_list:
remain = a%2
if remain == 0:
if a/2 >= 2:
two += 1
elif a/2 == 1:
one += 1
else:
zero += 1
if one:
zero += 1
if zero <= two+1 or zero <= two:
print('... | s502222172 | Accepted | 53 | 15,020 | 217 | n = int(input())
a_list = list(map(int,input().split()))
divs = [a%4 for a in a_list]
mp_of_four = divs.count(0)
mp_of_two = divs.count(2)
if mp_of_four+mp_of_two//2 >= n//2:
print('Yes')
else:
print('No') |
s684686837 | p04030 | u064408584 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | s=input()
a=''
for i in s:
if i=='B':
if len(a)!=0:a=a[:-1]
else:a+=i
print(a,i)
print(a) | s085496371 | Accepted | 17 | 2,940 | 90 | a=''
for i in input():
if i=='B':
if len(a)!=0:a=a[:-1]
else:a+=i
print(a) |
s027460958 | p03142 | u368796742 | 2,000 | 1,048,576 | Wrong Answer | 359 | 28,352 | 510 | There is a rooted tree (see Notes) with N vertices numbered 1 to N. Each of the vertices, except the root, has a directed edge coming from its parent. Note that the root may not be Vertex 1. Takahashi has added M new directed edges to this graph. Each of these M edges, u \rightarrow v, extends from some vertex u to it... | from collections import deque
n,m = map(int,input().split())
e = [[] for i in range(n)]
d = [1]*n
s = [0]*n
for i in range(n+m-1):
a,b = map(int,input().split())
e[a-1].append(b-1)
s[b-1] += 1
if 0 in s:
ans = [-1]*n
p = s.index(0)
ans[p] = 0
q = deque([])
q.append(p)
while q:
... | s401514495 | Accepted | 487 | 46,940 | 701 | from collections import deque
n,m = map(int,input().split())
e = [[] for i in range(n)]
d = [1]*n
s = [0]*n
t = [[] for i in range(n)]
for i in range(n+m-1):
a,b = map(int,input().split())
a -= 1
b -= 1
e[a].append(b)
t[b].append(a)
s[b] += 1
ans = [-1]*n
p = s.index(0)
ans[p] = 0
q = deque([]... |
s924510497 | p02388 | u140168530 | 1,000 | 131,072 | Wrong Answer | 20 | 7,392 | 26 | Write a program which calculates the cube of a given integer x. | def f(x):
return x**3 | s544098268 | Accepted | 40 | 7,688 | 132 | def cube(x):
return x**3
def main():
x = int(input())
ans = cube(x)
print(ans)
if __name__=='__main__':
main() |
s231430661 | p00016 | u436634575 | 1,000 | 131,072 | Wrong Answer | 30 | 6,848 | 218 | When a boy was cleaning up after his grand father passing, he found an old paper: In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". His grand mother says that Sanbonmatsu was standing at t... | from math import radians
from cmath import rect
z = 0
deg = 90
while True:
r, d = map(int, input().split(','))
if r == d == 0: break
z += rect(r, radians(deg))
deg += d
print(-int(z.real), int(z.imag)) | s725657823 | Accepted | 30 | 6,864 | 225 | from math import radians
from cmath import rect
z = 0
deg = 90
while True:
r, d = map(float, input().split(','))
if r == d == 0: break
z += rect(r, radians(deg))
deg -= d
print(int(z.real))
print(int(z.imag)) |
s777794310 | p03910 | u153094838 | 2,000 | 262,144 | Wrong Answer | 23 | 3,572 | 335 | The problem set at _CODE FESTIVAL 20XX Finals_ consists of N problems. The score allocated to the i-th (1≦i≦N) problem is i points. Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve. As problems with higher scores are harder, he wants to minimize the highe... | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 12 20:20:11 2020
@author: NEC-PCuser
"""
N = int(input())
i = 1
li = []
while (N >= (i * (i + 1)) // 2):
li.append(i)
i += 1
value = (i - 1) * i // 2
print(value)
index = len(li) - 1
for i in range(value, N):
li[index] += 1
index -= 1
for i in l... | s773721143 | Accepted | 22 | 3,572 | 322 | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 12 20:20:11 2020
@author: NEC-PCuser
"""
N = int(input())
i = 1
li = []
while (N >= (i * (i + 1)) // 2):
li.append(i)
i += 1
value = (i - 1) * i // 2
index = len(li) - 1
for i in range(value, N):
li[index] += 1
index -= 1
for i in li:
print(... |
s104696765 | p03729 | u181709987 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | A,B,C = input().split()
X = False
if A[-1]==B[0]:
if B[-1] == C[0]:
X = True
if X:
print('Yes')
else:
print('No')
| s134995447 | Accepted | 17 | 2,940 | 137 | A,B,C = input().split()
X = False
if A[-1]==B[0]:
if B[-1] == C[0]:
X = True
if X:
print('YES')
else:
print('NO')
|
s877209381 | p03659 | u163320134 | 2,000 | 262,144 | Wrong Answer | 255 | 24,824 | 203 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | n=int(input())
arr=list(map(int,input().split()))
for i in range(n-1):
arr[i+1]+=arr[i]
print(arr)
ans=10**18
for i in range(n-1):
x=arr[i]
y=arr[n-1]-x
tmp=abs(x-y)
ans=min(ans,tmp)
print(ans) | s108587995 | Accepted | 236 | 24,824 | 193 | n=int(input())
arr=list(map(int,input().split()))
for i in range(n-1):
arr[i+1]+=arr[i]
ans=10**18
for i in range(n-1):
x=arr[i]
y=arr[n-1]-x
tmp=abs(x-y)
ans=min(ans,tmp)
print(ans)
|
s741854044 | p04029 | u050034744 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | n=int(input())
sum=0
for i in range(n):
sum+=(n+1)**2
print(sum)
| s311645905 | Accepted | 17 | 2,940 | 65 | n=int(input())
sum=0
for i in range(n):
sum+=(i+1)
print(sum)
|
s248028126 | p02843 | u088553842 | 2,000 | 1,048,576 | Wrong Answer | 38 | 10,252 | 242 | AtCoder Mart sells 1000000 of each of the six items below: * Riceballs, priced at 100 yen (the currency of Japan) each * Sandwiches, priced at 101 yen each * Cookies, priced at 102 yen each * Cakes, priced at 103 yen each * Candies, priced at 104 yen each * Computers, priced at 105 yen each Takahashi want... | n = int(input())
if n <= 99:
print('No')
exit()
dp = [True] + [False] * n
for i in range(100, n + 1):
if dp[i - 100] or dp[i - 101] or dp[i - 102] or dp[i - 103] or dp[i - 104] or dp[i - 105]:
dp[i] = True
print(['No','Yes'][dp[n]]) | s848906009 | Accepted | 44 | 10,112 | 273 | n = int(input())
if n <= 99:
print(0)
exit()
if 100 <= n <= 105:
print(1)
exit()
dp = [True] + [False] * n
for i in range(100, n + 1):
if dp[i - 100] or dp[i - 101] or dp[i - 102] or dp[i - 103] or dp[i - 104] or dp[i - 105]:
dp[i] = True
print([0, 1][dp[n]]) |
s558453565 | p02401 | u276050131 | 1,000 | 131,072 | Wrong Answer | 30 | 7,600 | 273 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
a,op,b = input().split()
a = int(a)
b = int(b)
if (op == "+"):
print(a + b)
elif(op == "-"):
print(a + b)
elif(op == "/"):
print(a // b)
elif(op == "*"):
print(a + b)
elif(op == "?"):
break | s295592649 | Accepted | 20 | 7,696 | 273 | while True:
a,op,b = input().split()
a = int(a)
b = int(b)
if (op == "+"):
print(a + b)
elif(op == "-"):
print(a - b)
elif(op == "/"):
print(a // b)
elif(op == "*"):
print(a * b)
elif(op == "?"):
break |
s308488582 | p03478 | u104442591 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 259 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n, a, b = map(int, input().split())
def divide(num):
rest = num
sum = 0
while rest > 0:
num /= 10
rest %= 10
sum += rest
return sum
for i in range(n):
temp = divide(i+1)
ans = 0
if temp>= a and temp <= b:
ans += temp
print(ans) | s802264458 | Accepted | 26 | 3,060 | 234 | n, a, b = map(int, input().split())
def divide(num):
sum = 0
while num > 0:
sum += num % 10
num //= 10
return sum
ans = 0
for i in range(n):
temp = divide(i+1)
if temp>= a and temp <= b:
ans += (i+1)
print(ans) |
s484706927 | p03611 | u410717334 | 2,000 | 262,144 | Wrong Answer | 164 | 24,176 | 232 | You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices. | from collections import defaultdict
N=int(input())
a=list(map(int,input().split()))
d=defaultdict(int)
for item in a:
d[item-1]+=1
d[item]+=1
d[item+1]+=1
b=sorted(d.items(),key=lambda x:x[1],reverse=True)
print(b[0][0]) | s185168476 | Accepted | 163 | 24,176 | 232 | from collections import defaultdict
N=int(input())
a=list(map(int,input().split()))
d=defaultdict(int)
for item in a:
d[item-1]+=1
d[item]+=1
d[item+1]+=1
b=sorted(d.items(),key=lambda x:x[1],reverse=True)
print(b[0][1]) |
s141382910 | p02678 | u111473084 | 2,000 | 1,048,576 | Wrong Answer | 1,288 | 33,744 | 412 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | n, m = map(int, input().split())
graph = [[] for _ in range(n+1)]
for i in range(m):
a, b = map(int, input().split())
graph[a].append(b)
graph[b].append(a)
# bfs
milestone = [0] * (n+1)
q = []
q.append(1)
while len(q) != 0:
for i in graph[q[0]]:
if milestone[i] == 0:
milestone[i] ... | s623127703 | Accepted | 1,303 | 33,808 | 425 | n, m = map(int, input().split())
graph = [[] for _ in range(n+1)]
for i in range(m):
a, b = map(int, input().split())
graph[a].append(b)
graph[b].append(a)
# bfs
milestone = [0] * (n+1)
q = []
q.append(1)
while len(q) != 0:
for i in graph[q[0]]:
if milestone[i] == 0:
milestone[i] ... |
s339363453 | p03407 | u977642052 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 202 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | def main(A: int, B: int, C: int):
if A + B <= C:
return 'Yes'
else:
return 'No'
if __name__ == "__main__":
A, B, C = map(int, input().split(' '))
print(main(A, B, C))
| s610916886 | Accepted | 17 | 2,940 | 204 | def main(A: int, B: int, C: int):
if (A + B) >= C:
return 'Yes'
else:
return 'No'
if __name__ == "__main__":
A, B, C = map(int, input().split(' '))
print(main(A, B, C))
|
s552933510 | p03796 | u823458368 | 2,000 | 262,144 | Wrong Answer | 230 | 3,980 | 58 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | import math
n = int(input())
math.factorial(n)%(10**9 + 7) | s777959591 | Accepted | 42 | 2,940 | 87 | ans=1
n=int(input())
for i in range(1,n+1):
ans*=i
ans=ans%(10**9+7)
print(ans) |
s412407708 | p02692 | u367548378 | 2,000 | 1,048,576 | Wrong Answer | 287 | 104,476 | 796 | There is a game that involves three variables, denoted A, B, and C. As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or ... | import sys
sys.setrecursionlimit(1000000)
def F(S,curr,D,res):
if len(S)==curr:
print("Yes")
for c in res:
print(c)
#print("".join(res))
return True
s=S[curr]
a=False
b=False
if D[s[0]]>=1:
D[s[0]]-=1
D[s[1]]+=1
res.appen... | s327443991 | Accepted | 304 | 104,388 | 867 | import sys
sys.setrecursionlimit(1000000)
def F(S,curr,D,res):
if D["A"]<0 or D["B"]<0 or D["C"]<0:
return False
if len(S)==curr:
print("Yes")
for c in res:
print(c)
#print("".join(res))
return True
s=S[curr]
a=False
b=False
if D[s[0]]>=1... |
s270763842 | p03547 | u073139376 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | In programming, hexadecimal notation is often used. In hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters `A`, `B`, `C`, `D`, `E` and `F` are used to represent the values 10, 11, 12, 13, 14 and 15, respectively. In this problem, you are given two letters X and Y. Each X and Y is `A`, `B`, `C`,... | X, Y = input().split()
if X > Y:
print('<')
elif X == Y:
print('=')
else:
print('>') | s531224275 | Accepted | 17 | 3,064 | 91 | X, Y = input().split()
if X > Y:
print('>')
elif X == Y:
print('=')
else:
print('<')
|
s154533348 | p02390 | u193025715 | 1,000 | 131,072 | Wrong Answer | 40 | 6,724 | 97 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | n = int(input())
h = n % 3600
n -= h * 3600
m = n % 60
n -= m
print(str(h)+':'+str(m)+':'+str(n)) | s229799635 | Accepted | 30 | 6,732 | 122 | n = int(input())
h = int(n / 3600)
m = int((n-h*3600) / 60)
s = n - h * 3600 - m * 60
print(':'.join(map(str, [h,m,s]))) |
s646139288 | p03457 | u955907183 | 2,000 | 262,144 | Wrong Answer | 444 | 27,324 | 497 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | c = input()
data = []
for s in range(0,int(c)):
data.append(list(map(int, input().split())) )
nowtime = 0
nowx = 0
nowy = 0
nexttime = 0
nextx = 0
nexty = 0
costtime = 0
diffx = 0
diffy = 0
for s in range(0, len(data)):
nexttime = data[s][0]
nextx = data[s][1]
nexty = data[s][2]
costtime = nexttime - nowt... | s914548940 | Accepted | 417 | 27,400 | 354 | c = input()
data = []
for s in range(0,int(c)):
data.append(list(map(int, input().split())) )
nexttime = 0
nextx = 0
nexty = 0
for s in range(0, len(data)):
nexttime = data[s][0]
nextx = data[s][1]
nexty = data[s][2]
if ( (nexttime < nextx+nexty) or ((((nextx + nexty) ) % 2) != (nexttime % 2) ) ):
prin... |
s799794172 | p03636 | u736479342 | 2,000 | 262,144 | Wrong Answer | 25 | 9,028 | 69 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = list(input())
print(s)
l = len(s)-2
print(s[0] + str(l) + s[-1]) | s146857943 | Accepted | 25 | 9,032 | 60 | s = list(input())
l = len(s)-2
print(s[0] + str(l) + s[-1]) |
s368545813 | p03400 | u474270503 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 189 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | N=int(input())
D, X=map(int,input().split())
A=[]
for i in range(N):
A.append(int(input()))
ans=0
for i in range(N):
if A[i]<=D:
ans+=D//A[i]+1
print(ans)
print(ans+X)
| s787152906 | Accepted | 18 | 3,060 | 203 | N=int(input())
D, X=map(int,input().split())
A=[]
for i in range(N):
A.append(int(input()))
ans=0
for i in range(N):
if A[i]<=D:
ans+=(D-1)//A[i]+1
else:
ans+=1
print(ans+X)
|
s833023235 | p03943 | u048956777 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a, b ,c = map(int, input().split())
if(a+b+c % 3 == 0):
print('Yes')
else:
print('No') | s480647777 | Accepted | 17 | 2,940 | 108 | a, b ,c = map(int, input().split())
if (a+b==c) or (b+c==a) or (a+c==b):
print('Yes')
else:
print('No') |
s328866750 | p03971 | u077337864 | 2,000 | 262,144 | Wrong Answer | 2,102 | 4,528 | 354 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | N, A, B = map(int, input().split())
S = input()
passed = []
for i in range(N):
if S[i] == 'c':
print('No')
elif S[i] == 'a':
if len(passed) <= A+B:
print('Yes')
passed.append('a')
else: print('No')
else:
if len(passed) <= A+B and passed.count('b') <= B:
print('Yes')
passed... | s656707362 | Accepted | 107 | 4,016 | 343 | n, a, b = map(int, input().split())
s = input().strip()
sumy = 0
sumf = 0
for _s in s:
if _s == 'c':
print('No')
elif _s == 'a':
if sumy < a + b:
print('Yes')
sumy += 1
else:
print('No')
else:
if sumy < a + b and sumf < b:
print('Yes')
sumy += 1
sumf += 1
e... |
s215015116 | p03814 | u047197186 | 2,000 | 262,144 | Wrong Answer | 38 | 9,360 | 131 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input()
end = 0
for i in range(len(s) - 1, -1, -1):
if s[i] == 'Z':
end = i + 1
break
print(s[s.index('A'):end]) | s829874876 | Accepted | 36 | 9,256 | 136 | s = input()
end = 0
for i in range(len(s) - 1, -1, -1):
if s[i] == 'Z':
end = i + 1
break
print(len(s[s.index('A'):end])) |
s824004989 | p02742 | u068944955 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 173 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | H, W = map(int, input().split())
if H == 1 or W == 1:
print(1)
exit()
if H % 2 == 0 or W % 2 == 0:
print(H * W / 2)
else:
print(H * (W // 2) + H // 2 + 1)
| s090191878 | Accepted | 21 | 3,064 | 174 | H, W = map(int, input().split())
if H == 1 or W == 1:
print(1)
exit()
if H % 2 == 0 or W % 2 == 0:
print(H * W // 2)
else:
print(H * (W // 2) + H // 2 + 1)
|
s051563454 | p03963 | u576434377 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 61 | There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors. Find the number of the possible ways to paint the balls. | N,K = map(int,input().split())
print(K * ((K - 1) ** N - 1)) | s540665628 | Accepted | 17 | 2,940 | 63 | N,K = map(int,input().split())
print(K * ((K - 1) ** (N - 1))) |
s660051126 | p03495 | u813450984 | 2,000 | 262,144 | Wrong Answer | 2,104 | 26,148 | 390 | Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them. | n, k = map(int, input().split())
nums = list(map(int, input().split()))
def judge(n, k, nums):
original = nums
only = set(nums)
diff = len(only) - k
count = []
ans = 0
if len(only) <= k:
return 0
for i in only:
count.append([original.count(i), i])
count.sort()
print(count)
for i in range(d... | s938724240 | Accepted | 226 | 25,644 | 360 | n, k = map(int, input().split())
l = sorted(list(map(int, input().split())))
counts = []
now = l[0]
count = 1
for i in range(1, n):
if l[i] == now:
count += 1
else:
counts.append(count)
now = l[i]
count = 1
if i == n-1:
counts.append(count)
if len(counts) <= k:
print(0)
else:
counts = ... |
s571254286 | p03644 | u994988729 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 155 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | def two(n):
count=0
while n%2==0:
count+=1
n//=2
return count
n=int(input())
ans=0
for i in range(1, n+1):
ans=max(ans, two(i))
print(ans) | s699099929 | Accepted | 28 | 9,152 | 88 | N = int(input())
x = 1
while True:
if x * 2 > N:
break
x *= 2
print(x) |
s916065193 | p03861 | u884601206 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a,b,x=map(int,input().split())
if a!=0:
print(b%x - (a-1)%x)
else:
print(b%x+1)
| s803422912 | Accepted | 17 | 2,940 | 95 | a,b,x=map(int,input().split())
if a!=0:
print((b//x) - (a-1)//x)
else:
print((b//x)+1)
|
s600839913 | p03998 | u770077083 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 268 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | cards = [list(input().replace("a", "0").replace("b","1").replace("c","2")) for _ in range(3)]
next = 0
while len(cards[0]) * len(cards[1]) * len(cards[2]) != 0:
next = int(cards[next].pop(0))
print("A" if len(cards[0]) == 0 else ("B" if len(cards[1]) == 0 else "C")) | s299614856 | Accepted | 17 | 3,060 | 247 | cards = [list(input().replace("a", "0").replace("b","1").replace("c","2")) for _ in range(3)]
next = 0
while True:
if len(cards[next]) == 0:
print("A" if next == 0 else ("B" if next == 1 else "C"))
exit()
next = int(cards[next].pop(0)) |
s203433256 | p03455 | u262481526 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if a * b % 2 == 0:
print('Yes')
else:
print('No') | s586640354 | Accepted | 17 | 2,940 | 88 | a, b = map(int, input().split())
if a * b % 2 == 0:
print('Even')
else:
print('Odd') |
s287924777 | p02865 | u586577600 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 28 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n = int(input())
print(n//2) | s113196881 | Accepted | 17 | 2,940 | 67 | n = int(input())
if n%2==0:
print(n//2-1)
else:
print(n//2) |
s668123064 | p02612 | u697658632 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,144 | 37 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | print((10000 - int(input())) // 1000) | s001135616 | Accepted | 27 | 9,140 | 36 | print((10000 - int(input())) % 1000) |
s627301498 | p03408 | u644907318 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 251 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | N = int(input())
S = [input().strip() for _ in range(N)]
M = int(input())
T = [input().strip() for _ in range(M)]
cntmax = 0
for s in S:
cnt = 0
for t in T:
if t==s:
cnt += 1
if cnt==0:
cntmax += 1
print(cntmax) | s326072864 | Accepted | 17 | 3,064 | 254 | N = int(input())
S = [input().strip() for _ in range(N)]
M = int(input())
T = [input().strip() for _ in range(M)]
cntmax = 0
for s in S:
cnt = S.count(s)
for t in T:
if t==s:
cnt -= 1
cntmax = max(cntmax,cnt)
print(cntmax) |
s565453527 | p03574 | u466105944 | 2,000 | 262,144 | Wrong Answer | 26 | 3,188 | 684 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... |
h,w = map(int,input().split())
board = [input() for _ in range(h)]
dx = [-1,-1,-1, 0,0, 1,1,1]
dy = [-1, 0, 1,-1,1,-1,0,1]
ans_board = [[0 for _ in range(w)] for _ in range(h)]
for x in range(h):
cnt = 0
for y in range(w):
if board[x][y] == '#':
ans_board[x][y] = '#'
else:
... | s369783371 | Accepted | 31 | 3,188 | 630 | h,w = map(int,input().split())
board = [input() for _ in range(h)]
dx = [-1,-1,-1, 0,0, 1,1,1]
dy = [-1, 0, 1,-1,1,-1,0,1]
ans_board = [[0 for _ in range(w)] for _ in range(h)]
for x in range(h):
for y in range(w):
cnt = 0
if board[x][y] == '#':
ans_board[x][y] = '#'
else:
... |
s857210231 | p03860 | u241190800 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | data = [i for i in input().split(" ")]
print('A#{}C'.format(data[1][0])) | s121842541 | Accepted | 18 | 2,940 | 68 | data = [i for i in input().split()]
print('A{}C'.format(data[1][0])) |
s761618603 | p03448 | u500207661 | 2,000 | 262,144 | Wrong Answer | 47 | 3,060 | 333 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
x = int(input().strip())
count = 0
for a_n in range(a):
for b_n in range(b):
for c_n in range(c):
if x - (a_n * 500) - (b_n * 100) - (c_n * 50) is 0:
count += 1
else:
continue
... | s394615788 | Accepted | 51 | 2,940 | 424 | a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
x = int(input().strip())
if a * 500 + b *100 + c * 50 < x:
print(0)
else:
count = 0
for a_n in range(a+1):
for b_n in range(b+1):
for c_n in range(c+1):
if (a_n * 500) + (b_n * 100) + (c_n * 50) =... |
s918611376 | p03720 | u013408661 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 201 | There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | n,m=map(int,input().split())
city=[[] for i in range(n+1)]
for i in range(m):
a,b=map(int,input().split())
city[a].append(b)
city[b].append(a)
for i in range(1,n+1):
print(len(set(city[i]))-1)
| s686245637 | Accepted | 17 | 3,060 | 193 | n,m=map(int,input().split())
city=[[] for i in range(n+1)]
for i in range(m):
a,b=map(int,input().split())
city[a].append(b)
city[b].append(a)
for i in range(1,n+1):
print(len(city[i])) |
s328048387 | p03796 | u296150111 | 2,000 | 262,144 | Wrong Answer | 42 | 3,064 | 75 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | n=int(input())
ans=1
for i in range(n):
ans*=i
ans=ans%10**9+7
print(ans) | s437640870 | Accepted | 41 | 2,940 | 81 | n=int(input())
ans=1
for i in range(1,n+1):
ans*=i
ans=ans%(10**9+7)
print(ans) |
s863069925 | p03720 | u827202523 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 234 | There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | n,m = list(map(int, input().split()))
cities = [0 for i in range(n)]
for i in range(m):
bridges = list(map(int, input().split()))
cities = [i+1 if i+1 in bridges else i for i in cities]
print("\n".join(list(map(str, cities)))) | s206919010 | Accepted | 17 | 3,060 | 247 | n,m = list(map(int, input().split()))
cities = [0 for i in range(n)]
for i in range(m):
bridges = list(map(int, input().split()))
cities = [x+1 if i+1 in bridges else x for i,x in enumerate(cities)]
print("\n".join(list(map(str, cities)))) |
s438589915 | p03359 | u287880059 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 55 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a,b = map(int,input().split())
if a>b:
a -1
else:
a | s650427997 | Accepted | 17 | 2,940 | 56 | a, b = map(int,input().split())
print(a-1 if a>b else a) |
s583064697 | p03433 | u728307690 | 2,000 | 262,144 | Wrong Answer | 27 | 9,124 | 95 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
r = n % 500
if a >= r:
print("YES")
else:
print("NO") | s110316273 | Accepted | 30 | 9,168 | 94 | n = int(input())
a = int(input())
r = n % 500
if a < r:
print('No')
else:
print('Yes') |
s914474042 | p02659 | u921352252 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,024 | 50 | Compute A \times B, truncate its fractional part, and print the result as an integer. | x,y=map(float,input().split())
print(round(x*y))
| s172118393 | Accepted | 22 | 9,032 | 80 | x,y=map(float,input().split())
x=int(x)
y1=int(round(y*100))
print((x*y1//100))
|
s437256967 | p03555 | u502731482 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 69 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | s = input()
t = input()
s = s[::-1]
print("Yes" if s == t else "No")
| s632067506 | Accepted | 17 | 2,940 | 69 | s = input()
t = input()
s = s[::-1]
print("YES" if s == t else "NO")
|
s965561174 | p02394 | u791170614 | 1,000 | 131,072 | Wrong Answer | 20 | 7,556 | 237 | Write a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given. | W, H, x, y, r = map(int, input().split())
def YesOrNo(W, H , x, y, r):
Xr = x + r
Xl = x - r
Yu = y + r
Yd = y - r
if (W >= Xr and H >= Yu and 0 >= Xl and 0 >= Yd):
return "Yes"
else:
return "No"
print(YesOrNo(W, H, x, y, r)) | s081168635 | Accepted | 20 | 7,676 | 237 | W, H, x, y, r = map(int, input().split())
def YesOrNo(W, H , x, y, r):
Xr = x + r
Xl = x - r
Yu = y + r
Yd = y - r
if (W >= Xr and H >= Yu and 0 <= Xl and 0 <= Yd):
return "Yes"
else:
return "No"
print(YesOrNo(W, H, x, y, r)) |
s882041417 | p03545 | u689322583 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 806 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | #coding: utf-8
S = str(input())
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
shiki = ''
for i in range(2):
for j in range(2):
for k in range(2):
B = B * (-1) ** i
C = C * (-1) ** j
D = D * (-1) ** k
if(A + B + C + D == 7):
shiki +... | s095828117 | Accepted | 17 | 3,064 | 898 | #coding: utf-8
S = str(input())
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
for i in range(2):
for j in range(2):
for k in range(2):
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
B *= (-1) ** i
C *= (-1) ** j
... |
s755150058 | p02260 | u370086573 | 1,000 | 131,072 | Wrong Answer | 20 | 7,656 | 354 | Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A.length-1 2 mini = i 3 for j = i to A.length-1 4 if A[j] < A[mini] 5 mini = j 6 swap A[... | def selectionSort(n, A):
cnt =0
for i in range(n):
minj = i
for j in range(i,n):
if A[minj] > A[j]:
minj = j
A[i],A[minj] = A[minj],A[i]
cnt += 1
print(*A)
print(cnt)
if __name__ == '__main__':
n = int(input())
A = list(map(int, input(... | s626922865 | Accepted | 20 | 7,736 | 384 | def selectionSort(n, A):
cnt =0
for i in range(n):
minj = i
for j in range(i,n):
if A[minj] > A[j]:
minj = j
if i != minj:
A[i],A[minj] = A[minj],A[i]
cnt += 1
print(*A)
print(cnt)
if __name__ == '__main__':
n = int(input()... |
s562072067 | p03067 | u453526259 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,060 | 82 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a,b,c = map(int,input().split())
if a >= c >= b:
print("Yes")
else:
print("No") | s600462655 | Accepted | 17 | 2,940 | 117 | a,b,c = map(int,input().split())
if a >= c >= b:
print("Yes")
elif a <= c <= b:
print("Yes")
else:
print("No") |
s865378247 | p03024 | u209619667 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 130 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | A = input()
count = 0
for i in A:
if i == 'x':
count += 1
b = len(A) - count
if 15-b > 7:
print('Yes')
else:
print('No') | s030956808 | Accepted | 17 | 2,940 | 132 | A = input()
count = 0
for i in A:
if i == 'o':
count += 1
b = len(A) - count
if 15 - b > 7:
print('YES')
else:
print('NO') |
s322469638 | p03501 | u672316981 | 2,000 | 262,144 | Wrong Answer | 27 | 9,056 | 51 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | n, a, b = map(int, input().split())
print(n * a, b) | s218421547 | Accepted | 26 | 9,160 | 56 | n, a, b = map(int, input().split())
print(min(n * a, b)) |
s969109098 | p02646 | u833492079 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,188 | 194 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())
ans = "No"
if v <= w:
print(ans)
exit()
x = abs(v-w)
y = abs(a-b)
if y <= x*t:
ans = "Yes"
print(ans) | s034855645 | Accepted | 23 | 9,128 | 401 | #-------------------------------------------------------------------
import sys
def p(*_a):
#return
_s=" ".join(map(str,_a))
#print(_s)
sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())
... |
s989048110 | p03090 | u352623442 | 2,000 | 1,048,576 | Wrong Answer | 26 | 3,740 | 374 | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved... | n = int(input())
if n%2 == 0:
su = n+1
print((n*(n-1)//2)-n//2)
for i in range(1,n+1):
for k in range(1,n+1):
if i+k != su and i < k:
print(i,k)
if n%2 == 1:
su = n+1
print((n*(n-1)//2)-(n-1)//2)
for i in range(1,n+1):
for k in range(1,n+1):
... | s521307604 | Accepted | 24 | 3,612 | 372 | n = int(input())
if n%2 == 0:
su = n+1
print((n*(n-1)//2)-n//2)
for i in range(1,n+1):
for k in range(1,n+1):
if i+k != su and i < k:
print(i,k)
if n%2 == 1:
su = n
print((n*(n-1)//2)-(n-1)//2)
for i in range(1,n+1):
for k in range(1,n+1):
... |
s488946517 | p02690 | u290886932 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,205 | 9,004 | 367 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | X = int(input())
def modpow(a, n, mod):
ret = 1
while n > 0:
if n % 2 == 1:
ret = ret * a % mod
a *= a
a = a % mod
return ret
i = 0
L = list()
while True:
num = modpow(i,5,X)
if num in L:
j = L.index(num)
ret = '{} {}'.format(i,j)
print(ret... | s992276574 | Accepted | 24 | 9,208 | 453 | X = int(input())
L = list()
i = 0
while True:
if i ** 5 > 10 ** 11:
break
L.append(i ** 5)
i += 1
flag = False
ret = ''
for i in range(len(L)):
if flag:
break
for j in range(i+1, len(L)):
if L[j] - L[i] == X :
ret ='{} {}'.format(j,i)
flag = True
... |
s324853508 | p02601 | u781543416 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,120 | 441 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | abc=list(map(int, input().split()))
k=int(input())
a=abc[0]
b=abc[1]
c=abc[2]
num=0
if(a < b):
if(b < c):
print("Yes")
else:
while num<k:
c=2*c
num=num+1
if(b<c):
print("Yes")
break
print("No")
else:
while num<k:
b=2*b
num=num+1
if(a<b):
while num<k... | s492835711 | Accepted | 30 | 9,060 | 492 | abc=list(map(int, input().split()))
k=int(input())
a=abc[0]
b=abc[1]
c=abc[2]
num=0
if(a < b):
if(b < c):
print("Yes")
else:
while num<k:
c=2*c
num=num+1
if(b<c):
print("Yes")
break
if(b>=c):
print("No")
else:
while num<k:
b=2*b
num=num+1
if(a<b):
... |
s028956156 | p03679 | u368796742 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 126 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x,a,b = map(int,input().split())
if x+a >= b:
print("delicious")
elif x+a+1 == b:
print("safe")
else:
print("dangerous") | s710038901 | Accepted | 19 | 2,940 | 123 | x,a,b = map(int,input().split())
if a >= b:
print("delicious")
elif x+a >= b:
print("safe")
else:
print("dangerous")
|
s529712959 | p03386 | u614314290 | 2,000 | 262,144 | Wrong Answer | 2,238 | 4,084 | 99 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | A, B, K = map(int, input().split())
L = [x for x in range(A, B + 1)]
print(*set((L[:K] + L[-K:])))
| s757865420 | Accepted | 17 | 3,060 | 107 | A, B, K = map(int, input().split())
L = range(A, B + 1)
print(*sorted(set(L[:K]) | set(L[-K:])), sep="\n")
|
s864090133 | p03380 | u672220554 | 2,000 | 262,144 | Wrong Answer | 144 | 15,712 | 320 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | n =int(input())
a = list(map(int,input().split()))
seta = sorted(list(set(a)))
resn = seta[-1]
resr = seta[0]
for sa in seta:
sabun = abs(resn / 2 - sa)
if sabun == 0 or sabun == 0.5:
resr == sa
break
elif sabun < abs(resn / 2 - resr):
resr = sa
print(str(resn) + " " + str(resr)) | s131109641 | Accepted | 146 | 15,712 | 319 | n =int(input())
a = list(map(int,input().split()))
seta = sorted(list(set(a)))
resn = seta[-1]
resr = seta[0]
for sa in seta:
sabun = abs(resn / 2 - sa)
if sabun == 0 or sabun == 0.5:
resr = sa
break
elif sabun < abs(resn / 2 - resr):
resr = sa
print(str(resn) + " " + str(resr)) |
s073022871 | p02389 | u498041957 | 1,000 | 131,072 | Wrong Answer | 40 | 7,416 | 30 | Write a program which calculates the area and perimeter of a given rectangle. | ab = input().split()
print(ab) | s222769708 | Accepted | 20 | 7,672 | 66 | a, b = [int(i) for i in input().split()]
print(a * b, (a + b) * 2) |
s280821018 | p03827 | u762420987 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 121 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | N = int(input())
S = input()
num = 0
for s in S:
if s == "I":
num += 1
else:
num -= 1
print(num)
| s355641221 | Accepted | 17 | 2,940 | 169 | N = int(input())
S = input()
max_num = 0
num = 0
for s in S:
if s == "I":
num += 1
else:
num -= 1
max_num = max(max_num, num)
print(max_num)
|
s513530873 | p03131 | u221345507 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 324 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | K, A, B =map(int,input().split())
import sys
should_actAB = (B-A)
if should_actAB<=2:
print(K+1)
sys.exit()
else:
ans_cookie=1
K_=K-(A-1)
print(K_)
ans_cookie+=(A-1)
print(ans_cookie)
if K_%2==0:
ans_cookie+=should_actAB*(K_)//2
else:
ans_cookie+=should_actAB*(K_-1)/... | s231928131 | Accepted | 18 | 3,060 | 307 | K, A, B =map(int,input().split())
import sys
should_actAB = (B-A)
if should_actAB<=2:
print(K+1)
sys.exit()
else:
ans_cookie=1
K_=K-(A-1)
ans_cookie+=(A-1)
if K_%2==0:
ans_cookie+=should_actAB*(K_)//2
else:
ans_cookie+=should_actAB*(K_-1)//2+1
print(ans_cookie) |
s791965939 | p03408 | u926678805 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 259 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | dic={}
for i in range(int(input())):
s=input()
if s in dic:
dic[s]+=1
else:
dic[s]=1
for i in range(int(input())):
s=input()
if s in dic:
dic[s]-=1
else:
dic[s]=-1
print(min(sorted(dic.values())[-1],0))
| s118767799 | Accepted | 18 | 3,064 | 284 | import sys
sys.setrecursionlimit(100000)
dic={}
for i in range(int(input())):
s=input()
try:
dic[s]+=1
except:
dic[s]=1
for i in range(int(input())):
s=input()
try:
dic[s]-=1
except:
dic[s]=-1
print(max(list(dic.values())+[0])) |
s449048933 | p02315 | u887884261 | 1,000 | 131,072 | Wrong Answer | 20 | 5,616 | 647 | You have N items that you want to put them into a knapsack. Item i has value vi and weight wi. You want to find a subset of items to put such that: * The total value of the items is as large as possible. * The items have combined weight at most W, that is capacity of the knapsack. Find the maximum total value of... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
n, max_w = [int(i) for i in input().split()]#print(n, max_w)
w = []
v = []
for j in range(n):
weight,value=[int(i) for i in input().split()]
w.append(weight)
v.append(value)
dp = [[0 for i in range(max_w+1)] for j in range(n+1)]
for i in range(n):
for c... | s430034555 | Accepted | 940 | 42,268 | 496 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
n, max_w = [int(i) for i in input().split()]#print(n, max_w)
v = []
w = []
for j in range(n):
value,weight=[int(i) for i in input().split()]
v.append(value)
w.append(weight)
dp = [[0 for i in range(max_w+1)] for j in range(n+1)]
for i in range(n):
for c... |
s413808469 | p02612 | u450147945 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,016 | 36 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N = input()
N = int(N)
print(N%1000) | s234962382 | Accepted | 30 | 8,856 | 37 | N = input()
N = int(N)
print(-N%1000) |
s201304121 | p02613 | u024343432 | 2,000 | 1,048,576 | Wrong Answer | 149 | 9,296 | 499 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | from sys import stdin,stdout
import math
from collections import Counter,defaultdict
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
def case():
a=b=c=d=0
for i in range(IN()):
s=S()
if s=="AC":a+=1
elif s=="TLE":b+=1
... | s747387035 | Accepted | 144 | 9,436 | 500 | from sys import stdin,stdout
import math
from collections import Counter,defaultdict
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
def case():
a=b=c=d=0
for i in range(IN()):
s=S()
if s=="AC":a+=1
elif s=="TLE":b+=1
... |
s780943101 | p03846 | u598699652 | 2,000 | 262,144 | Wrong Answer | 69 | 13,880 | 408 | There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the nu... | N = int(input())
A = list(map(int, input().split()))
ans = pow(2, N // 2)
# 0*1 2*2 4*2 2^N/2*2
check = [0 for p in range(0, N // 2 + N % 2)]
for o in A:
check[o // 2] += 1
for q in range(0, N // 2 + N % 2):
if q == 0 & N % 2 == 1:
if check[q] != 1:
ans = 0
break
else:
... | s609392518 | Accepted | 65 | 14,008 | 410 | N = int(input())
A = list(map(int, input().split()))
ans = pow(2, N // 2)
# 0*1 2*2 4*2 2^N/2*2
check = [0 for p in range(0, N // 2 + N % 2)]
for o in A:
check[o // 2] += 1
for q in range(0, N // 2 + N % 2):
if q == 0 and N % 2 == 1:
if check[q] != 1:
ans = 0
break
else:
... |
s326459897 | p03130 | u811000506 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 161 | There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roa... | li = []
for i in range(3):
a,b = map(int,input().split())
li.append(a)
li.append(b)
li.sort()
if li==[1, 2, 2, 2, 3, 4]:
print("YES")
else:
print("NO") | s106486243 | Accepted | 17 | 3,060 | 162 | li = []
for i in range(3):
a,b = map(int,input().split())
li.append(a)
li.append(b)
li.sort()
if li==[1, 2, 2, 3, 3, 4]:
print("YES")
else:
print("NO") |
s181049289 | p02413 | u853619096 | 1,000 | 131,072 | Wrong Answer | 20 | 7,588 | 166 | Your task is to perform a simple table calculation. Write a program which reads the number of rows r, columns c and a table of r × c elements, and prints a new table, which includes the total sum for each row and column. | r, c = map(int, input().split())
for j in range(r):
a = [int(i) for i in input().split()]
for k in a:
print('{} '.format(k),end='')
print(sum(a)) | s774522051 | Accepted | 30 | 7,736 | 338 | r,c=map(int,input().split())
a=[]
for i in range(r):
a+=[list(map(int,input().split()))]
a[i].append(sum(a[i]))
for i in range(len(a)):
print(" ".join(list(map(str,a[i]))))
b=[]
t=[]
d=0
for i in range(c+1):
for j in range(r):
b+=[a[j][i]]
t+=[sum(b)]
b=[]
print(" ".join(list(map(str,t)... |
s168920784 | p03999 | u633548583 | 2,000 | 262,144 | Wrong Answer | 30 | 3,060 | 217 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | s=input()
cnt=len(s)-1
for i in range(2**cnt):
sum=s[0]
for j in range(cnt):
if ((i>>j)&1):
sum+="+"
else:
sum+="-"
sum+=s[j+1]
print(eval(sum))
| s050463837 | Accepted | 27 | 2,940 | 229 | s=input()
cnt=len(s)-1
ans=0
for i in range(2**cnt):
sum=s[0]
for j in range(cnt):
if ((i>>j)&1):
sum+="+"
else:
pass
sum+=s[j+1]
ans+=eval(sum)
print(ans)
|
s730136885 | p02613 | u140084432 | 2,000 | 1,048,576 | Wrong Answer | 154 | 17,464 | 407 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | def main():
N = int(input())
judges = [input() for _ in range(N)]
print(judges)
res_dic = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for judge in judges:
if judge in res_dic:
res_dic[judge] += 1
else:
res_dic[judge] = 0
for k, v in res_dic.ite... | s627228796 | Accepted | 141 | 16,244 | 384 | def main():
N = int(input())
judges = [input() for _ in range(N)]
res_dic = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for judge in judges:
if judge in res_dic:
res_dic[judge] += 1
else:
res_dic[judge] = 0
for k, v in res_dic.items():
prin... |
s001859164 | p03493 | u894348341 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 25 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | print(input().count('a')) | s478304496 | Accepted | 17 | 2,940 | 25 | print(input().count('1')) |
s985046159 | p03853 | u325282913 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 95 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | H, W = map(int, input().split())
for _ in range(H-1):
s = input()
print(s)
print(s) | s299416874 | Accepted | 18 | 3,060 | 157 | H, W = map(int, input().split())
array = []
for _ in range(H):
s = input()
array.append(s)
for i in range(H):
print(array[i])
print(array[i]) |
s700611300 | p03139 | u379692329 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 99 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | N, A, B = map(int, input().split())
ResMax = max(A, B)
ResMin = max(0, A+B-N)
print(ResMax, ResMin) | s397107553 | Accepted | 17 | 2,940 | 99 | N, A, B = map(int, input().split())
ResMax = min(A, B)
ResMin = max(0, A+B-N)
print(ResMax, ResMin) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.