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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s527439223 | p02694 | u821775079 | 2,000 | 1,048,576 | Wrong Answer | 2,205 | 9,084 | 136 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | X=int(input())
ans=0
yokin=100
for i in range(1,X+1):
yokin=int(yokin*i/100)
if yokin <= X:
ans+=1
else:
break
print(ans) | s937624128 | Accepted | 23 | 9,204 | 151 | X=int(input())
ans=0
yokin=100
for i in range(1,X+1):
yokin=yokin+int(yokin*0.01)
if yokin < X:
ans+=1
else:
ans+=1
break
print(ans) |
s047507634 | p03712 | u622011073 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 95 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | h,w=map(int,input().split())
print('#'*-~w)
for _ in[0]*h:print('#'+input()+'#')
print('#'*-~w) | s399165895 | Accepted | 18 | 3,060 | 96 | h,w=map(int,input().split());w+=2
print('#'*w)
for _ in[0]*h:print('#'+input()+'#')
print('#'*w) |
s201383130 | p03449 | u023762741 | 2,000 | 262,144 | Wrong Answer | 20 | 3,064 | 448 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... |
N = int(input())
input_line = input()
Line = input_line.split()
Line1 = [int(s) for s in Line]
input_line = input()
Line = input_line.split()
Line2 = [int(s) for s in Line]
print(Line1)
print(Line2)
point = 9999
max_candy = 0
for i in range(N):
on_candy = sum(Line1[0:i+1]) + sum(Line2[i:N])
# print(sum(Line... | s091538499 | Accepted | 17 | 3,064 | 421 |
N = int(input())
input_line = input()
Line = input_line.split()
Line1 = [int(s) for s in Line]
input_line = input()
Line = input_line.split()
Line2 = [int(s) for s in Line]
point = 9999
max_candy = 0
for i in range(N):
on_candy = sum(Line1[0:i+1]) + sum(Line2[i:N])
# print(sum(Line1[0:i+1]),sum(Line2[i:N]))
... |
s738176812 | p03090 | u226155577 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,444 | 239 | 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... | import sys
N = int(sys.stdin.readline())
ans = ["%d\n" % (N*(N-1)//2 - N//2)]
K = N+(N&1)^1
for i in range(1, N+1):
for j in range(i+1, N+1):
if i + j != K:
ans.append("%d %d\n" % (i, j))
sys.stdout.writelines(ans) | s448252830 | Accepted | 20 | 3,444 | 241 | import sys
N = int(sys.stdin.readline())
ans = ["%d\n" % (N*(N-1)//2 - N//2)]
K = N+((N&1)^1)
for i in range(1, N+1):
for j in range(i+1, N+1):
if i + j != K:
ans.append("%d %d\n" % (i, j))
sys.stdout.writelines(ans) |
s216680606 | p03644 | u306412379 | 2,000 | 262,144 | Wrong Answer | 27 | 9,140 | 73 | 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... | N = int(input())
c = 0
while N % 2 == 0:
N = N//2
c += 1
print(c)
| s080194440 | Accepted | 30 | 9,112 | 346 | N = int(input())
list2 = []
list1 =[int(i) for i in range(1,N+1)]
for i in range(N):
list2.append([i, list1[i]])
for i in range(N):
if len(list2) == 1:
ans = list2[0][0]
print(ans+1)
break
for a in list2:
if a[1] % 2 != 0:
list2.remove(a)
for j in range(len(list2)):
l... |
s937397062 | p03369 | u638282348 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 32 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | print(700 + input().count("o"))
| s721807628 | Accepted | 17 | 2,940 | 38 | print(700 + input().count("o") * 100)
|
s169993158 | p03672 | u747602774 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 392 | 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=list(input())
print(S)
lenS=len(S)
print(lenS)
ans=0
if lenS%2==0:
for l in range(lenS//2-1):
check=0
for k in range(l+1):
if S[k]==S[k+l+1]:
check+=1
if check==l+1:
ans=check*2
print(ans)
else:
for l in range(lenS//2):
check=0
for k in range(l+1):
if S[k]==S[k+l... | s518315176 | Accepted | 18 | 2,940 | 198 | S = input()
if len(S)%2:
S = S[:len(S)-1]
else:
S = S[:len(S)-2]
N = len(S)
while True:
now = S[:N]
L = len(now)
if now[:L//2] == now[L//2:]:
break
N -= 2
print(N)
|
s321568660 | p03816 | u263830634 | 2,000 | 262,144 | Wrong Answer | 46 | 14,564 | 77 | Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of... | N = int(input())
lst = list(map(int, input().split()))
print (len(set(lst))) | s211086971 | Accepted | 46 | 14,564 | 100 | N = int(input())
lst = list(map(int, input().split()))
s = len(set(lst))
print ((s - 1)//2 * 2 + 1) |
s360423901 | p03079 | u253952966 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 84 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | a, b, c = map(int, input().split())
if a == b and a == c:
print('Yes')
print('No') | s700621930 | Accepted | 17 | 2,940 | 92 | a, b, c = map(int, input().split())
if a == b and a == c:
print('Yes')
else:
print('No') |
s134393610 | p03485 | u646412073 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 123 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | lst = list(map(int, input().split()))
sum = lst[0] + lst[1]
if sum%2 == 0:
x = int(sum/2)
else:
x = int(sum + 1)
| s481273960 | Accepted | 17 | 2,940 | 54 | a, b = map(int, input().split())
print(int((a+b+1)/2)) |
s179550336 | p02612 | u937396845 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,144 | 28 | 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())
print(N%1000) | s281372692 | Accepted | 36 | 9,152 | 69 | N=int(input())
Na=N%1000
if Na==0:
print(Na)
else:
print(1000-Na) |
s298804939 | p02396 | u580227385 | 1,000 | 131,072 | Wrong Answer | 140 | 5,600 | 114 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | i = 0
while True:
x = int(input()); i += 1
if x == 0:
break
print("case {}: {}".format(i, x))
| s431825378 | Accepted | 140 | 5,604 | 114 | i = 0
while True:
x = int(input()); i += 1
if x == 0:
break
print("Case {}: {}".format(i, x))
|
s721759896 | p03155 | u859897687 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 55 | It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board. The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns. How many ways are there to choose where ... | n=int(input())
print((n-int(input()))*(n-int(input()))) | s300141370 | Accepted | 17 | 2,940 | 59 | n=int(input())
print((n-int(input())+1)*(n-int(input())+1)) |
s152194837 | p02401 | u498511622 | 1,000 | 131,072 | Wrong Answer | 20 | 7,340 | 72 | 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:
x=input()
if '?' in x:
break
print(int(eval(x))) | s431631937 | Accepted | 30 | 7,640 | 282 | while True:
a,b,c = input().split()
if b == "?":
break
elif b == "+":
s = int(a)+int(c)
elif b == "-":
s = int(a)-int(c)
elif b == "*":
s = int(a)*int(c)
else :
s = int(a)/int(c)
print(int(s)) |
s944895538 | p03090 | u896741788 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 73 | 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())
print(n-1)
for i in range(n-1):
print(n-1,i+1,sep=" ") | s979193585 | Accepted | 25 | 3,612 | 330 | n=int(input())
if n%2:
print(2*(n//2)**2)
for i in range(1,n+1):
for j in range(i+1,n+1):
if i+j==n:continue
print(i,j,sep=" ")
else:
s=n//2
print(2*(s-1)*s)
for i in range(1,n+1):
for j in range(i+1,n+1):
if i+j==n+1 :continue
print(i,... |
s621485177 | p03455 | u268698968 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | import math
a, b = input().split()
n = int(a+b)
if math.sqrt(n)%1 == 0:
print("Yes")
else:
print("No") | s314768297 | Accepted | 17 | 2,940 | 101 | a, b = map(int, input().split())
if (a%2 == 0 or b%2 == 0):
print("Even")
else:
print("Odd") |
s007073590 | p03545 | u995861601 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 357 | 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... |
n = input()
a = int(n[0])
for i in range(8):
x = "{0:03b}".format(i)
s = a
ss = "{0}".format(a)
for j in range(3):
if x[j] == '0':
s -= int(n[j+1])
ss += "-{0}".format(int(n[j+1]))
else:
s += int(n[j+1])
ss += "+{0}".format(int(n[j+1]))
... | s416890520 | Accepted | 17 | 3,064 | 361 | n = input()
a = int(n[0])
for i in range(8):
x = "{0:03b}".format(i)
s = a
ss = "{0}".format(a)
for j in range(3):
if x[j] == '0':
s -= int(n[j+1])
ss += "-{0}".format(int(n[j+1]))
else:
s += int(n[j+1])
ss += "+{0}".format(int(n[j+1]))
... |
s728898106 | p02850 | u405660020 | 2,000 | 1,048,576 | Wrong Answer | 863 | 76,648 | 665 | Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i. Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different. Among the colo... | n=int(input())
import sys
sys.setrecursionlimit(10 ** 7)
graph = [[] for _ in range(n)]
for i in range(n - 1):
a, b = map(int, input().split())
graph[a - 1].append((b - 1, i))
graph[b - 1].append((a - 1, i))
print(graph)
max_color=0
for graph_i in graph:
max_color=max(max_color, len(graph_i))
# print... | s943315242 | Accepted | 645 | 74,684 | 665 | n=int(input())
import sys
sys.setrecursionlimit(10 ** 7)
graph = [[] for _ in range(n)]
for i in range(n - 1):
a, b = map(int, input().split())
graph[a - 1].append((b - 1, i))
graph[b - 1].append((a - 1, i))
# print(graph)
max_color=0
for graph_i in graph:
max_color=max(max_color, len(graph_i))
print... |
s078223841 | p03377 | u686036872 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, X = map(int, input().split())
print("YES" if X <= A+B <= X else "NO") | s215723086 | Accepted | 17 | 2,940 | 92 | A, B, X = map(int, input().split())
if 0 <= X-A <= B:
print("YES")
else:
print("NO") |
s989817373 | p03860 | u367130284 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 52 | 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... | a,b,s=input().split()
print(list(a)[0]+b+list(s)[0]) | s510911651 | Accepted | 17 | 3,064 | 45 | n,*s,=zip(*input().split());print("".join(n)) |
s180365567 | p03556 | u209619667 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 53 | 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. | A = int(input())
A = A ** 0.5
int(A)
A = A*A
print(A) | s475251657 | Accepted | 17 | 2,940 | 33 | print(int(int(input())** 0.5)**2) |
s588168327 | p02318 | u196653484 | 1,000 | 131,072 | Wrong Answer | 20 | 5,568 | 580 | Find the edit distance between given two words s1 and s2. The disntace is the minimum number of single-character edits required to change one word into the other. The edits including the following operations: * **insertion** : Insert a character at a particular position. * **deletion** : Delete a character at a p... |
import sys
def search(a,b):
na=len(a)
nb=len(b)
array = [[0]*(nb+1) for _ in range(na+1)]
for i in range(na):
array[i][0]=i
for j in range(nb):
array[0][j]=j
for i,x in enumerate(a,1):
prerow=array[i-1]
row=array[i]
for j,y in enumerate(b,1):
if x... | s424453918 | Accepted | 510 | 41,888 | 505 |
def search(a,b):
na=len(a)
nb=len(b)
array = [[0]*(nb+1) for _ in range(na+1)]
for i in range(na+1):
array[i][0]=i
for j in range(nb+1):
array[0][j]=j
for i,x in enumerate(a,1):
prerow=array[i-1]
row=array[i]
for j,y in enumerate(b,1):
if x ==... |
s203695321 | p02413 | u498462680 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 321 | 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())
data = [[0] * (c+1) for i in range(r)]
for row in range(r):
data[row] = [int(i) for i in input().split()]
for row in range(r):
for column in range(c+1):
if column == (c):
print(sum(data[row]))
else:
print("%d " %data[row][column],end = "")... | s744257495 | Accepted | 40 | 6,188 | 766 | r,c = map(int,input().split())
data = [[0] * (c+1) for i in range(r)]
for row in range(r):
data[row] = [int(i) for i in input().split()]
data[row].append(sum(data[row]))
for row in range(r):
for column in range(c+1):
if column == (c):
print(data[row][column])
else:
p... |
s758924801 | p03089 | u770009793 | 2,000 | 1,048,576 | Wrong Answer | 518 | 3,668 | 779 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | N = int(input())
list_b = list(map(int, input().split()))
aaa = []
ans = []
for i in range(N):
if i == 0:
aaa.append(1)
ans.append(1)
elif i == 1:
s = []
f = []
for h in range(i+1):
a = aaa.copy()
b = ans.copy()
a.insert(h, h+1)
b.append(h+1)
s.append(a)
f.app... | s221899575 | Accepted | 18 | 3,064 | 424 | N = int(input())
list_b = list(map(int, input().split()))
ans = [0 for i in range(N)]
finish = False
for i in range(N-1, -1, -1):
mx = -1
for k in range(i+1):
if list_b[k] == k+1:
mx = max(mx, k+1)
if mx == -1:
finish = True
break
else:
ans[i] = mx
for j in range(mx-1, i):
list... |
s537251232 | p03455 | u479638406 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 138 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = input().split()
ab = a + b
ans = 'No'
for i in range(1,100):
sq = i**2
if int(ab) == sq:
ans = 'Yes'
break
print(ans) | s518586549 | Accepted | 17 | 2,940 | 85 | a,b = map(int, input().split())
if a*b %2 == 0:
print('Even')
else:
print('Odd') |
s507599816 | p03836 | u377989038 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 170 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx, sy, tx, ty = map(int, input().split())
y = ty - sy
x = tx - sx
print(len("U"*y+"R"*x+"D"*y+"L"*x+"L"+"U"*(y+1) +
"R"*(x+1)+"D"+"R"+"D"*(y+1)+"L"*(x+1)+"U")) | s918520060 | Accepted | 20 | 3,060 | 161 | sx, sy, tx, ty = map(int, input().split())
y = ty - sy
x = tx - sx
print("U"*y+"R"*x+"D"*y+"L"*x+"L"+"U"*(y+1) +
"R"*(x+1)+"D"+"R"+"D"*(y+1)+"L"*(x+1)+"U") |
s193395133 | p03697 | u288948615 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. | A, B = map(int, input().split())
print(A+B if A+B >= 10 else 'error') | s071532001 | Accepted | 17 | 2,940 | 69 | A, B = map(int, input().split())
print(A+B if A+B < 10 else 'error') |
s654303404 | p00003 | u412890344 | 1,000 | 131,072 | Wrong Answer | 40 | 7,704 | 501 | Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so. | #-*-coding:utf-8-*-
def get_input():
for i in range(int(input())):
yield "".join(input())
print()
if __name__ == "__main__":
array = list(get_input())
for i in range(len(array)):
a,b,c = array[i].split()
if int(a)^2 + int(b)^2 == int(c)^2:
print("YES")
... | s526735685 | Accepted | 40 | 7,792 | 500 | #-*-coding:utf-8-*-
def get_input():
for i in range(int(input())):
yield "".join(input())
if __name__ == "__main__":
array = list(get_input())
for i in range(len(array)):
a,b,c = array[i].split()
if int(a)**2 + int(b)**2 == int(c)**2:
print(u"YES")
... |
s862987075 | p02690 | u337751290 | 2,000 | 1,048,576 | Wrong Answer | 121 | 9,120 | 361 | 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. | def main():
X = int(input())
for B in range(0, 1000):
for A in range(B, 1000):
if A**5 - B**5 == X:
print(A, B, sep=" ")
return
if A**5 + B**5 == X:
print(A, B, sep=" ")
return
if __name__ == '__main__':
main... | s234164747 | Accepted | 119 | 9,168 | 362 | def main():
X = int(input())
for B in range(0, 1000):
for A in range(B, 1000):
if A**5 - B**5 == X:
print(A, B, sep=" ")
return
if A**5 + B**5 == X:
print(A, -B, sep=" ")
return
if __name__ == '__main__':
mai... |
s026878386 | p03730 | u089142196 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 118 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | A,B,C=map(int,input().split())
for i in range(1,B+1):
if (i*A)%B==C:
print("Yes")
break
else:
print("No") | s119051944 | Accepted | 17 | 2,940 | 118 | A,B,C=map(int,input().split())
for i in range(1,B+1):
if (i*A)%B==C:
print("YES")
break
else:
print("NO") |
s179792787 | p03433 | u513390431 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 91 | 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())
n-=(n%500)
if (n<a) :
print("yes")
else :
print("no") | s919410810 | Accepted | 18 | 2,940 | 91 | n=int(input())
a=int(input())
n=(n%500)
if (n<=a) :
print("Yes")
else :
print("No") |
s041579292 | p03657 | u987164499 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | a,b = map(int,input().split())
if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
print("possible")
else:
print("impossible") | s213362144 | Accepted | 17 | 2,940 | 120 | a,b = map(int,input().split())
if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
print("Possible")
else:
print("Impossible") |
s348672652 | p03457 | u524870111 | 2,000 | 262,144 | Wrong Answer | 254 | 3,064 | 523 | 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... | import sys
stdin = sys.stdin
mod = 10**9 + 7
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]
n = ni()
ans = "YES"
tpre, xpre, ypre = 0, 0, 0
for _ in range(n):
t, x, y = ... | s663320863 | Accepted | 244 | 3,064 | 438 | import sys
stdin = sys.stdin
from itertools import accumulate, groupby
mod = 10**9 + 7
def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))
n = ni()
tp, xp, yp = 0, 0, 0
for _ in range(n):
t, x, y = na()
ta, l = t-tp, abs(x - xp) + abs... |
s983479489 | p02747 | u034777138 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 309 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | S = str(input())
flag = False
if len(S) % 2 == 1:
flag = False
else:
for count in range(int(len(S)/2)):
if S[count] != "h" and S[count + 1] != "i":
flag = False
break
else:
flag = True
if flag == True:
print("Yes")
else:
print("No")
| s849680259 | Accepted | 17 | 2,940 | 312 | S = str(input())
flag = False
if len(S) % 2 == 1:
flag = False
else:
for count in range(int(len(S)/2)):
if S[count*2] != "h" or S[count*2 + 1] != "i":
flag = False
break
else:
flag = True
if flag == True:
print("Yes")
else:
print("No")
|
s385599875 | p03815 | u023229441 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 67 | Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° t... | n=int(input())
if n%11>6:
print(n//11*2+1)
else:
print(n//11*2) | s273279086 | Accepted | 17 | 2,940 | 100 | n=int(input())
if n%11>6:
print(n//11*2+2)
elif n%11>0:
print(n//11*2+1)
else:
print(n//11*2)
|
s357633080 | p03637 | u626468554 | 2,000 | 262,144 | Wrong Answer | 69 | 14,252 | 313 | 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())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))
n = int(input())
a = list(map(int,input().split()))
li = [0,0]
for i in range(n):
if a[i]%4 == 0:
li[0] += 1
elif a[i]%2 == 1:
li[1] += 1
if li[0] >= li[1]+1:
print("Yes")
else:
print("No")
| s750094195 | Accepted | 79 | 15,020 | 391 | #n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))
n = int(input())
a = list(map(int,input().split()))
li = [0,0,0]
for i in range(n):
if a[i]%4 == 0:
li[0] += 1
elif a[i]%2 == 1:
li[1] += 1
elif a[i]%2 == 0:
li[2] += 1
if (li[0] >= li[1]-1 and ... |
s394320714 | p03920 | u950708010 | 2,000 | 262,144 | Wrong Answer | 2,116 | 198,292 | 167 | 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... | n = int(input())
ans = []
for i in range(10**7):
ans.append(i+1)
su = i+1*(i+2)//2
if su > n:
ans.remove(su-n)
break
elif su == n:
break
print(*ans) | s121564450 | Accepted | 23 | 3,572 | 180 | n = int(input())
ans = []
for i in range(10**7):
ans.append(i+1)
su = (i+1)*(i+2)//2
if su > n:
ans.remove(su-n)
break
elif su == n:
break
for i in ans:
print(i) |
s334653988 | p03251 | u759651152 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 392 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | #-*-coding:utf-8-*-
def main():
n, m, x, y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
for z in range(x + 1, y+1):
if all(x < z for x in x_list) and all(y >= z for y in y_list):
print('No War')
print(z)
... | s669164956 | Accepted | 19 | 3,060 | 371 | #-*-coding:utf-8-*-
def main():
n, m, x, y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
for z in range(x + 1, y+1):
if all(x < z for x in x_list) and all(y >= z for y in y_list):
print('No War')
exit()
... |
s976283013 | p03563 | u363992934 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 33 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | print(input() * -1 + input() * 2) | s897266091 | Accepted | 17 | 2,940 | 43 | print(int(input()) * -1 + int(input()) * 2) |
s212735219 | p03377 | u951492009 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 97 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, C = map(int, input().split())
if A<=C and C<= A+B:
print("Yes")
else:
print("NO")
| s372737431 | Accepted | 17 | 2,940 | 97 | A, B, C = map(int, input().split())
if A<=C and C<= A+B:
print("YES")
else:
print("NO")
|
s236293022 | p03796 | u940102677 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 90 | 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
i = 1
while i<=n:
ans = ans*i%(1000000007)
i=+1
print(ans)
| s281786553 | Accepted | 46 | 2,940 | 92 | n = int(input())
ans = 1
i = 1
while i<=n:
ans = ans*i%(1000000007)
i += 1
print(ans)
|
s656361589 | p03386 | u514118270 | 2,000 | 262,144 | Wrong Answer | 2,228 | 2,034,072 | 121 | 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())
C = [i for i in range(A,B+1)]
N = len(C)
L = set(C[N-K:]+C[:K])
for l in L:
print(l) | s238313807 | Accepted | 17 | 3,060 | 191 | A,B,K = map(int,input().split())
if B-A+1 <= K*2:
for i in range(A,B+1):
print(i)
else:
for i in range(A,A+K):
print(i)
for i in range(B-K+1,B+1):
print(i) |
s372150492 | p03339 | u704001626 | 2,000 | 1,048,576 | Wrong Answer | 60 | 3,672 | 107 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | n=int(input())
s=input()
w = 0
e = 0
for i in s:
if i =="W":
w +=1
else:
e +=1
print(min(w,e)) | s322995742 | Accepted | 183 | 3,700 | 180 | n=int(input())
s=input()
w = 0
e = 0
for i in s:
if i =="W":
pass
else:
e +=1
n=e
for i in s:
if i=="E":
e-=1
n = min(n,e+w)
if i =="W":
w+=1
print(n)
|
s739061976 | p03007 | u852690916 | 2,000 | 1,048,576 | Wrong Answer | 259 | 27,420 | 425 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | N=int(input())
A=list(map(int,input().split()))
A.sort()
xy=[]
l=0
r=N-1
for i in range(N-1):
if (N-1-i)&1:
x=A[r]
y=A[l]
A[r]-=y
l+=1
else:
x=A[l]
y=A[r]
A[l]-=y
r-=1
xy.append((x,y))
print(A[r])
print('\n'.join([' '.join(m... | s759473217 | Accepted | 244 | 28,088 | 307 | N=int(input())
A=list(map(int,input().split()))
A.sort()
xy=[]
for i in range(N-2,0,-1):
y=A[i]
if y>0:
x=A[0]
A[0]-=y
else:
x=A[N-1]
A[N-1]-=y
xy.append((x,y))
print(A[N-1]-A[0])
xy.append((A[N-1],A[0]))
print('\n'.join([' '.join(map(str,t)) for t in xy])) |
s465240171 | p03860 | u055687574 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 43 | 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... | a, s, c = input().split()
print(a, s[0], c) | s679139972 | Accepted | 17 | 2,940 | 66 | a, s, c = input().split()
print("{}{}{}".format(a[0], s[0], c[0])) |
s501067897 | p03494 | u697386253 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 135 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | input()
A = list(map(int, input().split()))
count = 1
while all(a%2 == 0 for a in A):
A = [a/2 for a in A]
count += 1
print(count) | s267143772 | Accepted | 19 | 2,940 | 134 | input()
A = list(map(int, input().split()))
count = 0
while all(a%2==0 for a in A):
A = [a/2 for a in A]
count += 1
print(count)
|
s858522652 | p03471 | u385167811 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 190 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | N,E = map(int,input().split(" "))
x,y,z = 0,0,0
x = int(E / 10000)
E = E - 10000 * x
y = int(E / 5000)
E = E - 5000 * y
z = int(E / 1000)
E = E - 1000 * z
if N < x+y+z:
print("-1 -1 -1") | s866862008 | Accepted | 895 | 3,064 | 306 | N,Y = map(int,input().split(" "))
M10000,M5000,M1000 = -1,-1,-1
for a in range(N+1):
for b in range(N-a+1):
c = N - a - b
total = 10000 * a + 5000 * b + 1000 * c
if total == Y:
M10000 = a
M5000 = b
M1000 = c
ans = str(M10000) + " " + str(M5000) + " " + str(M1000)
print(ans) |
s690743460 | p03760 | u693048766 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 144 | 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... | a = list(input())
b = list(input())
b.append("__DUMMY__")
c = sum(map(list, zip(a, b)), [])
print(c)
print("".join(c).replace("__DUMMY__", ""))
| s441175516 | Accepted | 17 | 2,940 | 135 | a = list(input())
b = list(input())
b.append("__DUMMY__")
c = sum(map(list, zip(a, b)), [])
print("".join(c).replace("__DUMMY__", ""))
|
s545106294 | p03129 | u106181248 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 82 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | x, y = map(int,input().split())
if x > y:
print("Yes")
else:
print("No") | s419790321 | Accepted | 17 | 2,940 | 87 | x, y = map(int,input().split())
if x >= y*2-1:
print("YES")
else:
print("NO") |
s314974837 | p03371 | u811730180 | 2,000 | 262,144 | Time Limit Exceeded | 2,116 | 137,472 | 198 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | a, b, c, x, y= map(int, input().split())
price = []
for i in range(10000000):
price.append(i * 2*c + max(0,x-i) * a + max(0,y-i) * b)
print(min(price)) | s061985623 | Accepted | 103 | 7,096 | 155 | a, b, c, x, y= map(int, input().split())
price = []
for i in range(10**5+1):
price.append(i * 2*c + max(0,x-i) * a + max(0,y-i) * b)
print(min(price)) |
s380269733 | p02416 | u908651435 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 136 | Write a program which reads an integer and prints sum of its digits. | while True:
x=int(input())
if x==0:
break
i=x%10
j=(x-i)%100/10
k=(x-j*10-i)%1000/100
print(int(i+j+k))
| s858290039 | Accepted | 20 | 5,624 | 113 | while True:
n=input()
if n=='0':
break
s=list(n)
a=[int(i) for i in s]
print(sum(a))
|
s002853728 | p03637 | u609738635 | 2,000 | 262,144 | Wrong Answer | 65 | 14,252 | 439 | 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. | # -*- coding: utf-8 -*-
def main(N,A):
count4 = count2 = count = 0
for a in A:
if(a%4==0):
count4 += 1
elif(a%2==0):
count2 += 1
else:
count += 1
if(count-1<=count4 and count2!=1):
print("Yes")
else:
print("No")
... | s598937319 | Accepted | 64 | 14,252 | 555 | # -*- coding: utf-8 -*-
def main(N,A):
count4 = count2 = count = 0
for a in A:
if(a%4==0):
count4 += 1
elif(a%2==0):
count2 += 1
else:
count += 1
if(count2==0):
if(count-1<=count4):
print("Yes")
else:
... |
s702870249 | p04029 | u167908302 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | 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? | #coding:utf-8
n = int(input())
print((n*(n-1))//2) | s123140804 | Accepted | 17 | 2,940 | 51 | #coding:utf-8
n = int(input())
print((n*(n+1))//2) |
s446359247 | p02398 | u400765446 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 214 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | def main():
inp = input()
[x, y, z] = list(map(int, inp.split()))
count = 0
for i in range(x, y + 1):
count += 1 if x % i == 0 else 0
print(count)
if __name__ == '__main__':
main()
| s324378461 | Accepted | 20 | 5,596 | 123 | a, b, c = map(int, input().split())
count = 0
for i in range(a, b+1):
if c % i == 0:
count += 1
print(count)
|
s129471448 | p00059 | u024715419 | 1,000 | 131,072 | Wrong Answer | 20 | 5,584 | 391 | 底辺が x 軸に対して平行な 2 つの長方形があります。長方形 A の左下の座標 (xa1, ya1) と右上の座標 (xa2, ya2)、長方形 B の左下の座標 (xb1, yb1) と右上の座標 (xb2, yb2) を読み込んで、長方形 A と長方形 B が一部でも重なっていれば YES を、まったく重なっていなければ NO を出力するプログラムを作成してください。ただし、長方形 A と長方形 B は同じものではないとします。また、接しているものも重なっているとみなします。 | while True:
try:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, input().split())
dx = abs((xa2 - xa1) - (xb2 - xb1))
dy = abs((ya2 - ya1) - (yb2 - yb1))
w = (xa2 - xa1)/2 + (xb2 - xb1)/2
h = (ya2 - ya1)/2 + (yb2 - yb1)/2
if dx <= w or dy <= h:
print("... | s727485577 | Accepted | 20 | 5,576 | 260 | while True:
try:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, input().split())
if (xa1 <= xb2 and xb1 <= xa2) and (ya1 <= yb2 and yb1 <= ya2):
print("YES")
else:
print("NO")
except:
break
|
s198739926 | p03418 | u711539583 | 2,000 | 262,144 | Wrong Answer | 44 | 9,048 | 103 | Takahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten. He remembers that the remainder of a divided by b was greater than or equal to K. Find the number of possible pairs that he may have had. | n, k = map(int, input().split())
ans = 0
for b in range(k+1,n+1):
ans += (n-k) // b + 1
print(ans) | s893051035 | Accepted | 80 | 9,180 | 179 | n, k = map(int, input().split())
ans = 0
for b in range(k+1,n+1):
s = n // b
a = n % b
ans += s * (b - k)
ans += max(a - k + 1, 0)
if k == 0:
ans -= 1
print(ans)
|
s536087440 | p02927 | u796867346 | 2,000 | 1,048,576 | Wrong Answer | 19 | 2,940 | 296 | Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq... | # -*- coding: utf-8 -*-
M, D = map(int, input().split())
result =0
for i in range(4,M):
for j in range(22, D):
d1 =(j % 10)
d2 =(j // 10)
if d1 <2 or d2<2 or (d1*d2!=i):
continue
result += 1
print(result)
| s926714028 | Accepted | 19 | 2,940 | 300 | # -*- coding: utf-8 -*-
M, D = map(int, input().split())
result =0
for i in range(4,M+1):
for j in range(22, D+1):
d1 =(j % 10)
d2 =(j // 10)
if d1 <2 or d2<2 or (d1*d2!=i):
continue
result += 1
print(result)
|
s022267984 | p03673 | u787449825 | 2,000 | 262,144 | Wrong Answer | 2,106 | 26,180 | 112 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n = int(input())
a = list(map(int, input().split()))
s = []
for i in a:
s.append(i)
s.reverse()
print(s) | s976329569 | Accepted | 206 | 25,416 | 232 | from collections import deque
n = int(input())
a = list(map(int, input().split()))
s = deque([])
for i in range(n):
if i%2==1:
s.appendleft(a[i])
else:
s.append(a[i])
if n%2 == 1:
s.reverse()
print(*s)
|
s517502718 | p03434 | u748377775 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 188 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | N=int(input())
x_list=list(map(int,input().split()))
x_list=sorted(x_list)
a,b=0,0
for i in range(N):
if((i+1)%2!=0):
a+=x_list[i]
else:
b+=x_list[i]
print(a-b) | s686955379 | Accepted | 19 | 3,060 | 201 | N=int(input())
x_list=list(map(int,input().split()))
x_list=sorted(x_list,reverse=True)
a,b=0,0
for i in range(N):
if((i+1)%2!=0):
a+=x_list[i]
else:
b+=x_list[i]
print(a-b) |
s828188174 | p03478 | u003475507 | 2,000 | 262,144 | Wrong Answer | 36 | 2,940 | 145 | 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())
cnt=sum=0
for i in range(1,n+1):
for j in list(str(i)):sum+=int(j)
if a <= sum <= b:cnt+=1
print(cnt)
| s785919300 | Accepted | 37 | 3,060 | 142 | n,a,b = map(int,input().split())
res=0
for i in range(1,n+1):
c = sum(list(map(int,list(str(i)))))
if a <= c <= b:res+=i
print(res)
|
s092432122 | p03469 | u851704997 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 38 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | S = input()
print(S.replace(S[3],"8")) | s071590492 | Accepted | 17 | 2,940 | 44 | S = input()
print(S.replace("2017","2018"))
|
s329456579 | p03067 | u243572357 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 89 | 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())
print('Yes' if max(a, b) <= c <= min(a, b) else 'No') | s257835408 | Accepted | 17 | 2,940 | 89 | a, b, c = map(int, input().split())
print('Yes' if min(a, b) <= c <= max(a, b) else 'No') |
s326464313 | p03695 | u781262926 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 142 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | n, *A = map(int, open(0).read().split())
B = [0] * 9
for a in A:
if a < 3200:
B[a // 400] = 1
else:
B[8] += 1
print(min(8, sum(B))) | s410595920 | Accepted | 17 | 2,940 | 154 | n, *A = map(int, open(0).read().split())
B = [0] * 9
for a in A:
if a < 3200:
B[a // 400] = 1
else:
B[8] += 1
print(max(sum(B[:8]), 1), sum(B)) |
s403358712 | p03658 | u156383602 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | n,m=map(int,input().split())
a=sorted([int(i) for i in input().split()])
print(sum(a[-m:]),a[-m:]) | s613105719 | Accepted | 18 | 2,940 | 91 | n,m=map(int,input().split())
a=sorted([int(i) for i in input().split()])
print(sum(a[-m:])) |
s620313312 | p03434 | u431981421 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 283 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | a=int(input())
li = list(map(int,input().split()))
sortedList = sorted(li, reverse=True)
print(sortedList)
alice = 0
bob = 0
turn = 1
while(len(sortedList)):
if turn % 2 == 1:
alice += sortedList.pop(0)
else:
bob += sortedList.pop(0)
turn += 1
print(alice - bob) | s636587240 | Accepted | 17 | 3,064 | 265 | a=int(input())
li = list(map(int,input().split()))
sortedList = sorted(li, reverse=True)
alice = 0
bob = 0
turn = 1
while(len(sortedList)):
if turn % 2 == 1:
alice += sortedList.pop(0)
else:
bob += sortedList.pop(0)
turn += 1
print(alice - bob) |
s366109438 | p03524 | u296150111 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 97 | Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`. He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible. | s=input()
if s.count("a")>1 or s.count("b")>1 or s.count("c")>1:
print("NO")
else:
print("YES") | s574734142 | Accepted | 19 | 3,188 | 115 | s=input()
a=s.count("a")
b=s.count("b")
c=s.count("c")
if max(a,b,c)-min(a,b,c)>1:
print("NO")
else:
print("YES") |
s916238316 | p02690 | u542774596 | 2,000 | 1,048,576 | Wrong Answer | 568 | 9,072 | 167 | 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 = input()
print(x)
a = 0
b = 0
for i in range(1000):
for j in range(-500, 500):
if i**5 - j**5 == x:
a = i
b = j
break
print(a, b)
| s808253214 | Accepted | 549 | 9,100 | 158 | x = int(input())
a = 0
b = 0
for i in range(1000):
for j in range(-500, 500):
if i**5 - j**5 == x:
a = i
b = j
break
print(a, b) |
s662231289 | p03386 | u222207357 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 194 | 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())
num = []
for i in range(K+1):
if A+i <+ B:
num.append(A+i)
if B-i >= A:
num.append(B-i)
ans = set(num)
for s in ans:
print(s) | s642846179 | Accepted | 17 | 3,060 | 196 | A,B,K = map(int,input().split())
num = []
for i in range(K):
if A+i <+ B:
num.append(A+i)
if B-i >= A:
num.append(B-i)
ans = sorted(set(num))
for s in ans:
print(s) |
s240064387 | p03721 | u064246852 | 2,000 | 262,144 | Wrong Answer | 403 | 18,016 | 331 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... | from collections import defaultdict
N,K = map(int,input().split())
d = defaultdict(int)
for i in range(N):
a,b = map(int,input().split())
d[a] += b
ls = [(k,d[k]) for k in d.keys()]
ls.sort(key = lambda x:x[0])
print(ls)
cnt = 0
for i in range(N):
cnt += ls[i][1]
if cnt >= K:
print(ls[i][0])
... | s722308213 | Accepted | 377 | 15,324 | 327 | from collections import defaultdict
N,K = map(int,input().split())
d = defaultdict(int)
for i in range(N):
a,b = map(int,input().split())
d[a] += b
ls = [(k,d[k]) for k in d.keys()]
ls.sort(key = lambda x:x[0])
cnt = 0
for i in range(len(ls)):
cnt += ls[i][1]
if cnt >= K:
print(ls[i][0])
... |
s344446208 | p00096 | u150984829 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 128 | 4,000 以下の正の整数 n を入力し、0 〜 1000 の範囲の整数 a, b, c, d の組で a + b + c + d = n を満たすものの組み合わせ数を出力するプログラムを作成して下さい。 | import sys
a=[0]*51
for i in range(19):a[i]=a[36-i]=(i+3)*(i+2)*(i+1)//6-[0,a[i-10]*4][i>9]
for e in sys.stdin:print(a[int(e)])
| s314688767 | Accepted | 20 | 5,636 | 133 | import sys
a=[0]*4001
for i in range(2001):a[i]=a[4000-i]=(i+3)*-~-~i*-~i//6-a[i-1001]*4*(i>999)
for e in sys.stdin:print(a[int(e)])
|
s787255130 | p02697 | u026788530 | 2,000 | 1,048,576 | Wrong Answer | 71 | 9,268 | 74 | You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing fi... | n,m=[int(x) for x in input().split()]
for i in range(m):
print(i+1,n-i) | s826850653 | Accepted | 73 | 9,192 | 241 | n,m=[int(_) for _ in input().split()]
n=2*m+1
if m%2==0:
for i in range(m//2):
print(i+1,m-i)
for i in range(m//2):
print(m+1+i,n-i)
else:
for i in range(m//2):
print(i+1,m-i)
for i in range(m//2+1):
print(m+1+i,n-i) |
s626107078 | p03854 | u953110527 | 2,000 | 262,144 | Wrong Answer | 23 | 3,188 | 165 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s = input()
for word in ["eraser","erase","dreamer","dream"]:
s = s.replace(word,".")
if len(set(s)) == 1:
print("YES")
else:
print("NO") | s568876193 | Accepted | 19 | 3,188 | 149 | s = input()
for word in ["eraser","erase","dreamer","dream"]:
s = s.replace(word,".")
if len(set(s)) == 1:
print("YES")
else:
print("NO") |
s974218261 | p03861 | u334260611 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 140 | 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? | import math
a, b, x = list(map(int, input().split(' ')))
min_ = math.ceil((a - 1) / x) + 1
max_ = math.floor(b / x) + 1
print(max_ - min_) | s074058389 | Accepted | 17 | 2,940 | 159 | a, b, x = list(map(int, input().split(' ')))
if a == 0:
min_ = 0
else:
min_ = (a - 1) // x + 1
max_ = b // x + 1
#print(min_, max_)
print(max_ - min_) |
s295276428 | p02392 | u468794560 | 1,000 | 131,072 | Wrong Answer | 20 | 5,460 | 1 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | s319910800 | Accepted | 20 | 5,588 | 86 | a,b,c = map(int, input().split())
if a < b < c :
print("Yes")
else:
print("No")
| |
s860070447 | p03416 | u133936772 | 2,000 | 262,144 | Wrong Answer | 27 | 9,156 | 52 | 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. | n,m=map(int,input().split())
print(abs((n-2)*(m-2))) | s225082624 | Accepted | 62 | 9,156 | 83 | a,b=map(int,input().split())
print(sum(str(i)==str(i)[::-1] for i in range(a,b+1))) |
s371675916 | p04044 | u171803978 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 205 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | n, l = map(int, input().split())
moji_array = list(map(str, input().split()))
moji_array.sort()
result = ''.join(moji_array)
print(result) | s095167915 | Accepted | 18 | 3,060 | 151 | n, l = map(int, input().split())
array = [input() for _ in range(n)]
array.sort()
result = ''.join(array)
print(result) |
s257692279 | p03351 | u495335272 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 150 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a, b, c, d = map(int,input().split(" "))
ans = "NO"
if abs(c-a) <= d:
ans = "YES"
elif abs(b-a) <= d and abs(c-b) <= d:
ans = "YES"
print(ans) | s330637644 | Accepted | 17 | 2,940 | 150 | a, b, c, d = map(int,input().split(" "))
ans = "No"
if abs(c-a) <= d:
ans = "Yes"
elif abs(b-a) <= d and abs(c-b) <= d:
ans = "Yes"
print(ans) |
s825790724 | p03795 | u357751375 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n = int(input())
bonus = n % 15
bonus = (n - bonus) / 15
print((n * 800) - (bonus * 200)) | s887674470 | Accepted | 17 | 2,940 | 51 | n = int(input())
print((n * 800) - (n // 15 * 200)) |
s410408516 | p03657 | u118147328 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 149 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | A,B = map(int, input().split())
if (A % 3 == 0) or\
(B % 3 == 0) or\
(A+B % 3 == 0):
print("Possible")
else:
print("Impossible") | s459925042 | Accepted | 17 | 2,940 | 151 | A,B = map(int, input().split())
if (A % 3 == 0) or\
(B % 3 == 0) or\
((A+B) % 3 == 0):
print("Possible")
else:
print("Impossible") |
s451739171 | p03338 | u517621096 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 151 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | n = int(input())
s = input()
mxcnt = 0
for i in range(n):
xy = set(s[:i]) & set(s[i:])
print(xy)
mxcnt = max(mxcnt, len(xy))
print(mxcnt)
| s310818226 | Accepted | 18 | 2,940 | 137 | n = int(input())
s = input()
mxcnt = 0
for i in range(n):
xy = set(s[:i]) & set(s[i:])
mxcnt = max(mxcnt, len(xy))
print(mxcnt)
|
s718995775 | p03607 | u803848678 | 2,000 | 262,144 | Time Limit Exceeded | 2,135 | 531,608 | 164 | You are playing the following game with Joisino. * Initially, you have a blank sheet of paper. * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times. * Then, you are asked a question: How many... | n = int(input())
a = [0 for i in range(1000000000)]
for i in range(n):
a[int(input()) + 1] += 1
ans = 0
for i in a:
if i%2 == 1:
ans += 1
print(ans) | s091636944 | Accepted | 237 | 15,068 | 206 | n = int(input())
a = {}
for i in range(n):
b = int(input())
if b in a.keys():
a[b] += 1
else:
a[b] = 1
ans = 0
for i in a.keys():
if a[i]%2 == 1:
ans += 1
print(ans)
|
s489428483 | p03478 | u724892495 | 2,000 | 262,144 | Wrong Answer | 32 | 2,940 | 149 | 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())
ans = 0
for i in range(1, N+1):
num = sum([int(z) for z in str(i)])
if A <= num <= B:
ans += 1
print(ans) | s582547622 | Accepted | 32 | 2,940 | 150 | N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
num = sum([int(z) for z in str(i)])
if A <= num <= B:
ans += i
print(ans)
|
s431553836 | p03351 | u318042624 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 198 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | l = list(map(int, input().split()))
a, b, c, d = [i for i in l]
if abs(a - c) <= d:
print('YES')
exit()
if abs(a - b) <= d and abs(b - c) <= d:
print('YES')
exit()
print('NO') | s389098671 | Accepted | 24 | 3,060 | 194 | l = list(map(int, input().split()))
a, b, c, d = [i for i in l]
if abs(a - c) <= d:
print('Yes')
exit()
if abs(a - b) <= d and abs(b - c) <= d:
print('Yes')
exit()
print('No') |
s991336404 | p04043 | u029929095 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | n=sum(list(map(int,input().split())))
if n==17:
print("yes")
else:
print("no") | s003454677 | Accepted | 17 | 2,940 | 82 | n=sum(list(map(int,input().split())))
if n==17:
print("YES")
else:
print("NO") |
s721064695 | p02255 | u986487972 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 286 | 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 = list(map(int,input().split()))
print(a)
def insertionSort(A,N):
for i in range(1,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)
| s802159013 | Accepted | 20 | 5,604 | 321 |
n = int(input())
a = list(map(int,input().split()))
print(" ".join(list(map(str,a))))
def insertionSort(A,N):
for i in range(1,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(list(map(str,A))))
insertionSort(a,n)... |
s917476612 | p03796 | u035907840 | 2,000 | 262,144 | Wrong Answer | 55 | 2,940 | 98 | 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())
power = 1
for i in range(1, N+1):
power *= i
power %= 1e9 + 7
print(power)
| s047945165 | Accepted | 52 | 2,940 | 100 | N = int(input())
power = 1
for i in range(1, N+1):
power *= i
power %= 1e9 + 7
print(int(power)) |
s426063196 | p03862 | u993622994 | 2,000 | 262,144 | Wrong Answer | 113 | 14,132 | 280 | There are N boxes arranged in a row. Initially, the i-th box from the left contains a_i candies. Snuke can perform the following operation any number of times: * Choose a box containing at least one candy, and eat one of the candies in the chosen box. His objective is as follows: * Any two neighboring boxes con... | N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = [0] * N
for i in range(1, N):
calc = max(0, a[i-1] + a[i] - x)
if calc < a[i-1]:
a[i-1] = calc
ans[i-1] = calc
else:
a[i] -= calc
ans[i] = calc
print(sum(ans)) | s022335903 | Accepted | 126 | 14,132 | 347 | N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = [0] * N
for i in range(1, N):
calc = max(0, a[i-1] + a[i] - x)
if a[i-1] <= calc <= a[i]:
a[i] -= calc
ans[i] = calc
elif a[i] < calc:
a[i] = 0
ans[i] = calc
else:
a[i] -= calc
ans... |
s421673125 | p03698 | u572542887 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 157 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | line = input()
s = list(line)
for i in s:
for j in range(1,len(s)-1,1):
if(i == s[j]):
print("no")
exit()
print("yes")
| s413526123 | Accepted | 17 | 2,940 | 160 | s = input()
for i in range(0,len(s)-1,1):
for j in range(i+1,len(s),1):
if(s[i] == s[j]):
print("no")
exit()
print("yes")
|
s279337043 | p03434 | u482019060 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 474 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | N = int(input())
cards_number = input()
numbers = list(map(int, cards_number.split()))
ordered_numbers = sorted(numbers, reverse=True)
even_indexes = list(num for num in range(0, N) if num % 2 == 0)
odd_indexes = list(num for num in range(0, N) if num % 2 == 1)
alice_cards = list(ordered_numbers[even_index] for even_i... | s623525929 | Accepted | 18 | 3,060 | 436 | N = int(input())
cards_number = input()
numbers = list(map(int, cards_number.split()))
ordered_numbers = sorted(numbers, reverse=True)
alice_cards = []
bob_cards = []
while len(ordered_numbers) != 0:
try:
alice_cards.append(ordered_numbers.pop(0))
bob_cards.append(ordered_numbers.pop(0))
except... |
s545798031 | p00004 | u500396695 | 1,000 | 131,072 | Wrong Answer | 30 | 7,400 | 237 | Write a program which solve a simultaneous equation: ax + by = c dx + ey = f The program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution. | import sys
L = sys.stdin.readlines()
for line in L:
A = line.split()
a, b, c, d, e, f = [float(A[i]) for i in range(6)]
x = (b * f - c * e) / (b * d - a * e)
y = (c * d - a * f) / (b * d - a * e)
print("{:.3f}, {:.3f}".format(x, y)) | s788726767 | Accepted | 30 | 7,404 | 240 | import sys
L = sys.stdin.readlines()
for line in L:
A = line.split()
a, b, c, d, e, f = [float(A[i]) for i in range(6)]
x = (b * f - c * e) / (b * d - a * e)
y = (c * d - a * f) / (b * d - a * e)
print("{:.3f} {:.3f}".format(x+0, y+0)) |
s026531580 | p02690 | u125365353 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,184 | 213 | 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. | import itertools
x = int(input())
c5 = []
for i in range(-100, 100, 1):
c5.append(i**5)
a, b = 0, 0
for i in c5:
for j in c5:
if i - j == x:
a, b = i, j
break
print(a,b) | s991150799 | Accepted | 585 | 9,328 | 282 | x = int(input())
c5 = []
iter5 = []
for i in range(-1000, 1000, 1): # 100
c5.append(i**5)
iter5.append(i)
a, b = 0, 0
for i in range(len(c5)):
for j in range(len(c5)):
if (c5[i] - c5[j]) == x:
a, b = iter5[i], iter5[j]
break
print(a,b) |
s065727333 | p02612 | u210543511 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,084 | 54 | 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. | a = int(input())
b = a // 1000 + 1
print(b + 1000 - a) | s770865360 | Accepted | 29 | 9,144 | 73 | import math
a = int(input())
b = math.ceil(a / 1000)
print(b * 1000 - a)
|
s403852068 | p03394 | u922449550 | 2,000 | 262,144 | Wrong Answer | 47 | 4,840 | 643 | Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers. She thinks that a set S = \\{a_{1}, a_{2}, ..., a_{N}\\} of **distinct** positive integers is called **special** if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of t... | N = int(input())
N -= 3
ans = [2, 3, 4]
odd = []; pair = []; even = []
for i in range(6, 30001):
if i % 6 == 0:
even.append(i)
elif i % 3 == 0:
odd.append(i)
elif i % 2 == 0:
pair.append(i)
pair = pair[::-1]
while N:
if N >= 4:
N -= 4
ans.append(odd.pop())
ans.append(even.pop())
ans... | s119205149 | Accepted | 46 | 4,820 | 619 | N = int(input())
if N == 3:
print(2, 5, 63)
quit()
N -= 4
ans = [2, 3, 4, 9]
odd = []; even = []; mul6 = []
for i in range(6, 30001):
if i in ans:
continue
if i % 6 == 0:
mul6.append(i)
elif i % 3 == 0:
odd.append(i)
elif i % 2 == 0:
even.append(i)
odd = odd[::-1]; even = even[::-1]
while ... |
s754487965 | p03860 | u432805419 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | 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... | a,b,c = input().split()
print(a[:1] + b + c[:1]) | s802119013 | Accepted | 18 | 2,940 | 45 | a,b,c = input().split()
print(a[0]+b[0]+c[0]) |
s623570961 | p03408 | u861814009 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 277 | 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() for i in range(N)]
M = int(input())
t = [input() for j in range(M)]
print(s)
print(t)
newlist =s + t
print(newlist)
count = 0
for k in (newlist):
if k == s:
print(k)
count +=1
if k == t:
count += -1
print(count) | s359583910 | Accepted | 17 | 3,060 | 243 | n = int(input())
s = list()
counter = 0
for i in range(n):
s.append(input())
m = int(input())
t = list()
for i in range(m):
t.append(input())
for word in s:
counter = max(counter,s.count(word) -t.count(word))
print(counter) |
s219422403 | p00016 | u728901930 | 1,000 | 131,072 | Wrong Answer | 30 | 7,696 | 265 | 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... | import sys
import math as mas
x,y,d=0,0,90
for t in sys.stdin:
a,b=map(int,t.split(','))
if a==b==0:break
x+=a*mas.cos(mas.radians(d))
y+=a*mas.sin(mas.radians(d))
d-=b
print(x)
print(y)
# a,b=map(int,i.split())
# print(gcd(a,b),lcm(a,b)) | s272703425 | Accepted | 20 | 7,812 | 275 | import sys
import math as mas
x,y,d=0,0,90
for t in sys.stdin:
a,b=map(int,t.split(','))
if a==b==0:break
x+=a*mas.cos(mas.radians(d))
y+=a*mas.sin(mas.radians(d))
d-=b
print(int(x))
print(int(y))
# a,b=map(int,i.split())
# print(gcd(a,b),lcm(a,b)) |
s501906585 | p02613 | u136843617 | 2,000 | 1,048,576 | Wrong Answer | 145 | 16,208 | 168 | 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 = [input() for _ in range(N)]
print("AC x", S.count("AC"))
print("WA x" ,S.count("WA"))
print("TLE x", S.count("TLE"))
print("TLE x", S.count("RE"))
| s747512407 | Accepted | 136 | 16,172 | 167 | N = int(input())
S = [input() for _ in range(N)]
print("AC x", S.count("AC"))
print("WA x" ,S.count("WA"))
print("TLE x", S.count("TLE"))
print("RE x", S.count("RE"))
|
s525543260 | p03546 | u130900604 | 2,000 | 262,144 | Wrong Answer | 420 | 12,772 | 485 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and... | import numpy
h,w=map(int,input().split())
c=numpy.zeros((10,10))
for i in range(10):
t=list(map(int,input().split()))
for j in range(10):
c[i][j]=t[j]
#print(c)
for i in range(10):
for j in range(10):
for k in range(10):
c[i][j]=min(c[i][k]+c[k][j],c[i][j])
#print(c)
hw=numpy.zeros((h,w))
cost=0
for... | s338083833 | Accepted | 203 | 12,852 | 580 | H,W=map(int,input().split())
import numpy as np
C=np.array([list(map(int,input().split())) for _ in range(10)])
A=[]
for i in range(H):
for a in map(int,input().split()):
if a!=-1:A+=a,
dp=np.array([[None]*10 for _ in range(10)])
for i in range(10):
for j in range(10):
dp[i][j]=C[i][j]
for _ in range... |
s208378751 | p03047 | u251075661 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 233 | Snuke has N integers: 1,2,\ldots,N. He will choose K of them and give those to Takahashi. How many ways are there to choose K consecutive integers? | N, K = [int(x) for x in input().split(' ')]
def factorial(x):
output = 1
for i in range(x, 0, -1):
#print(i)
output *= i
return output
combination = factorial(N) / factorial(K) / factorial(N-K)
print(int(combination)) | s637174586 | Accepted | 17 | 2,940 | 83 | N, K = [int(x) for x in input().split(' ')]
output = N - K + 1
print(int(output)) |
s596998510 | p03544 | u513081876 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,060 | 189 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | N = int(input())
def fib(n):
if n == 1:
return n
if n == 0:
return 2
else:
a = fib(n-1)
b = fib(n-2)
c = a+b
return c
fib(N) | s594814582 | Accepted | 17 | 2,940 | 90 | N = int(input())
L = [2, 1]
for i in range(100):
L.append(L[-1] + L[-2])
print(L[N])
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.