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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s699421589 | p03110 | u853185302 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 220 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | N = int(input())
list_m = [input().split() for _ in range(N)]
money = 0
for i in range(N):
if list_m[i][1] == 'JPY':
money += float(list_m[i][0])
else:
money += float(list_m[i][0])*380000.0
print(int(money)) | s119178503 | Accepted | 17 | 2,940 | 155 | N = int(input())
o = [list(input().split()) for _ in range(N)]
ans = 0
for x,u in o:
if u == "JPY": ans+=int(x)
else: ans += 380000*float(x)
print(ans) |
s024756528 | p03555 | u955251526 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 113 | 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. | a = input()
b = input()
for i in range(3):
if a[i] != b[2-i]:
print('No')
exit()
print('Yes') | s262261112 | Accepted | 17 | 2,940 | 113 | a = input()
b = input()
for i in range(3):
if a[i] != b[2-i]:
print('NO')
exit()
print('YES') |
s936909166 | p02420 | u427088273 | 1,000 | 131,072 | Wrong Answer | 30 | 7,584 | 203 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | while True:
string = input()
if string == '-':
break
num = -1
ind = len(string)
for _ in range(int(input())):
num += int(input())
print(string[num//ind:]+string[0:num//ind]) | s710338595 | Accepted | 20 | 7,608 | 182 | while True:
string = input()
if string == '-':
break
for i in range(int(input())):
num = int(input())
string = string[num:] + string[:num]
print(string) |
s535211888 | p03351 | u641406334 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 152 | 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())
if abs(a-b)<=d or abs(b-c)<=d:
print("YES")
elif abs(a-b)<=d and abs(b-c)<=d:
print("Yes")
else:
print("No") | s997508399 | Accepted | 17 | 2,940 | 121 | a, b, c, d = map(int,input().split())
if (abs(a-b)<=d and abs(b-c)<=d) or abs(a-c)<=d:
print("Yes")
else:
print("No") |
s868205104 | p03170 | u348481445 | 2,000 | 1,048,576 | Wrong Answer | 1,803 | 5,872 | 241 | There is a set A = \\{ a_1, a_2, \ldots, a_N \\} consisting of N positive integers. Taro and Jiro will play the following game against each other. Initially, we have a pile consisting of K stones. The two players perform the following operation alternately, starting from Taro: * Choose an element x in A, and remove... | n,k=map(int,input().split())
a=list(map(int,input().split()))
dp=[False]*(k+1)
for i in range(0,k+1):
for j in a:
if i>=j and dp[i-j]==False:
dp[i]=True
print(dp)
print ("First" if dp[k] else "Second") | s110598681 | Accepted | 1,708 | 3,828 | 232 | n,k=map(int,input().split())
a=list(map(int,input().split()))
dp=[False]*(k+1)
for i in range(0,k+1):
for j in a:
if i>=j and dp[i-j]==False:
dp[i]=True
print ("First" if dp[k] else "Second") |
s849145545 | p03129 | u709970295 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 88 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n,k = map(int,input().split())
if n//2+ n%2 >= k:
print('Yes')
else:
print('No') | s485637338 | Accepted | 17 | 2,940 | 89 | n,k = map(int,input().split())
if n//2+ n%2 >= k:
print('YES')
else:
print('NO')
|
s664851793 | p03695 | u812803774 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 1,024 | 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... | number = int(input())
rate = [int(i) for i in input().split()]
counter = {}
for r in rate:
if 1 <= r < 400:
counter["grey"] = counter.get("grey", 0) + 1
if 400 <= r < 800:
counter["brown"] = counter.get("brown", 0) + 1
if 800 <= r < 1200:
counter["green"] = counter.get("green", 0) +... | s178328084 | Accepted | 17 | 3,064 | 1,114 | number = int(input())
rate = [int(i) for i in input().split()]
# In[7]:
counter = {}
for r in rate:
if 1 <= r < 400:
counter["grey"] = counter.get("grey", 0) + 1
if 400 <= r < 800:
counter["brown"] = counter.get("brown", 0) + 1
if 800 <= r < 1200:
counter["green"] = counter.get("g... |
s052296487 | p03623 | u218838821 | 2,000 | 262,144 | Wrong Answer | 30 | 9,008 | 131 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | S = input()
S_set = set(S)
for i in range(97,123):
if chr(i) not in S_set:
print(chr(i))
exit()
print("None")
| s200659472 | Accepted | 25 | 9,092 | 91 | x, a, b = map(int,input().split())
if abs(a-x) > abs(b-x):
print("B")
else:
print("A") |
s067701382 | p02578 | u784450941 | 2,000 | 1,048,576 | Wrong Answer | 175 | 33,948 | 602 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | # cording:utf-8
N = int(input())
N_i = [0] * N
N_i = list(map(int, input().split()))
print(N_i)
Sum = 0
for i in range(1, N):
Sum_i = 0
if (N_i[i-1] + Sum_i) > N_i[i]:
Sum_i = N_i[i-1] - N_i[i]
N_i[i] = N_i[i] + Sum_i
Sum = Sum + Sum_i
pri... | s650477836 | Accepted | 153 | 33,632 | 581 | # cording:utf-8
N = int(input())
N_i = [0] * N
N_i = list(map(int, input().split()))
Sum = 0
for i in range(1, N):
Sum_i = 0
if N_i[i-1] > N_i[i]:
Sum_i = N_i[i-1] - N_i[i]
N_i[i] = N_i[i] + Sum_i
Sum = Sum + Sum_i
print(Sum)
|
s016156067 | p03826 | u283846680 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 64 | There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D. Print the area of the r... | a, b, c, d = list(map(int, input().split()))
print(min(a*b,c*d)) | s273641117 | Accepted | 17 | 2,940 | 65 | a, b, c, d = list(map(int, input().split()))
print(max(a*b,c*d))
|
s053699657 | p03860 | u172035535 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | 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... | print("AtCoder",input(),"Contest") | s611254569 | Accepted | 17 | 2,940 | 45 | a,b,c = input().split()
print(a[0]+b[0]+c[0]) |
s742338472 | p02419 | u744506422 | 1,000 | 131,072 | Wrong Answer | 20 | 5,556 | 167 | Write a program which reads a word W and a text T, and prints the number of word W which appears in text T T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive. | st=input()
count=0
while(True):
s=input()
if s=="END_OF_TEXT":
break
t=s.split()
for k in t:
if k==s:
count+=1
print(count) | s584208437 | Accepted | 20 | 5,556 | 176 | st=input()
count=0
while(True):
s=input()
if s=="END_OF_TEXT":
break
t=s.split()
for k in t:
if k.lower()==st:
count+=1
print(count) |
s231065969 | p00011 | u379956761 | 1,000 | 131,072 | Wrong Answer | 30 | 6,788 | 352 | Let's play Amidakuji. In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines. In the starting points (top of the figure), numbers are assigned to vertical lines in ascending order from left to right. At the first step,... | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
import math
w = int(input())
n = int(input())
s = []
for _ in range(n):
x = input().split(',')
s.append((int(x[0]), int(x[1])))
result = [i for i in range(1, w+1)]
print(len(result))
for x, y in s:
result[x-1], result[y-1] = result[y-1], result[x-1... | s563667379 | Accepted | 30 | 6,784 | 333 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
import math
w = int(input())
n = int(input())
s = []
for _ in range(n):
x = input().split(',')
s.append((int(x[0]), int(x[1])))
result = [i for i in range(1, w+1)]
for x, y in s:
result[x-1], result[y-1] = result[y-1], result[x-1]
for x in result:... |
s139430215 | p03457 | u854685063 | 2,000 | 262,144 | Wrong Answer | 344 | 17,580 | 967 | 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
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) fo... | s576485796 | Accepted | 188 | 17,564 | 968 | import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) fo... |
s759066779 | p02928 | u445624660 | 2,000 | 1,048,576 | Wrong Answer | 1,832 | 21,620 | 573 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... |
n, k = map(int, input().split())
a = list(map(int, input().split()))
x, y = 0, 0
for i in range(n - 1):
for j in range(i + 1, n):
if a[i] > a[j]:
x += 1
for i in range(n - 1, 0, -1):
for j in range(i - 1, -1, -1):
if a[j] < a[i]:
print("yes i, j={}, {}".format(i, j))
... | s592943800 | Accepted | 539 | 9,272 | 1,082 |
#
# 3 4 2 1 2 -> 3+3+1+0+0 = 7
# 3 4 2 1 2 | 3 4 2 1 2 -> (3*2)+(1*1+3*2)+(1*2)+0+(1*1) + 7 = 16 + 7
# 3 4 2 1 2 | 3 4 2 1 2 | 3 4 2 1 2 -> (3*3)+(2*1+3*3)+(1*3)+0+(2*1) + 16+7 = 25+16+7
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10**9 + 7
base = 0
for i in range(n):
for j i... |
s316933590 | p03860 | u115877451 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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=input().split(' ')
b=a[1]
c=list(str(b))
print(c)
d=c[0]
print('A',d,'C',sep='')
| s079120769 | Accepted | 17 | 2,940 | 75 | a=input().split(' ')
b=a[1]
c=list(str(b))
d=c[0]
print('A',d,'C',sep='')
|
s857813744 | p03485 | u546440137 | 2,000 | 262,144 | Wrong Answer | 26 | 8,968 | 61 | 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. | a,b=map(int,input().split())
c=(a+b-1)/b
d=int(c)
print(d) | s994440806 | Accepted | 25 | 9,124 | 197 | a,b=map(int,input().split())
if a%2==0 and b%2==0:
print(int((a+b)/2))
elif a%2==1 and b%2==1:
print(int((a+b)/2))
elif a%2==0 and b%2==1:
print(int((a+b+1)/2))
else:
print(int((a+b+1)/2)) |
s787024181 | p03657 | u003501233 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 94 | 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+B % 3 == 0:
print("Possible")
else:
print("Impossible") | s436438025 | Accepted | 17 | 2,940 | 112 | A,B=map(int,input().split())
if A%3==0 or B%3==0 or (A+B)%3==0:
print("Possible")
else:
print("Impossible") |
s645179376 | p03448 | u136395536 | 2,000 | 262,144 | Wrong Answer | 53 | 3,060 | 268 | 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()) #500
B = int(input()) #100
C = int(input()) #50
X = int(input())
count = 0
for i in range(1,A+1):
for j in range(1,B+1):
for k in range(1,C+1):
if (X%(500*i+100*j+50*k)==0):
count = count + 1
print(count)
| s233241453 | Accepted | 57 | 3,060 | 269 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
summy = 500*i + 100*j + 50*k
if summy == X:
count = count + 1
print(count) |
s741599857 | p02259 | u496045719 | 1,000 | 131,072 | Wrong Answer | 20 | 7,500 | 361 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | def main():
element_num = int(input())
elements = [int(s) for s in input().split()]
swap_count = 0
for i in range(1, element_num):
for j in reversed(range(i, element_num)):
if elements[j-1] > elements[j]:
elements[j-1], elements[j] = elements[j], elements[j-1]
swap_count += 1
print... | s234658876 | Accepted | 40 | 7,676 | 424 | def main():
element_num = int(input())
elements = [int(s) for s in input().split()]
swap_count = 0
for i in range(1, element_num):
for j in reversed(range(i, element_num)):
if elements[j-1] > elements[j]:
elements[j-1], elements[j] = elements[j], elements[j-1]
swap_count += 1
print... |
s503966778 | p03993 | u403355272 | 2,000 | 262,144 | Wrong Answer | 160 | 14,008 | 171 | There are N rabbits, numbered 1 through N. The i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_i≠i. For a pair of rabbits i and j (i<j), we call the pair (i,j) a _friendly pair_ if the following condition is met. * Rabbit i likes rabbit j and rabbit j likes rabbit i. Calculat... | N = int(input())
jk =0
le = list(map(int,input().split()))
le = [0] + le
for i in range(N):
print(le[le[i]])
if le[le[i]] == i:
jk += 1
print(le[le[i]])
| s751803049 | Accepted | 63 | 13,880 | 148 | N = int(input())
jk =0
le = list(map(int,input().split()))
le = [0] + le
for i in range(N):
if le[le[i]] == i:
jk += 1
print(jk // 2)
|
s984210656 | p03228 | u334535590 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 267 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | # -*- coding-UTF-8 -*-
A, B, K = map(int, input().split())
i = 0
while True:
i += 1
if A%2:
A -= 1
A /= 2
B += A
if i == K:
break
i += 1
if B%2:
B -= 1
B /= 2
A += B
if i == K:
break
print(A,B) | s093059107 | Accepted | 18 | 3,060 | 277 | # -*- coding-UTF-8 -*-
A, B, K = map(int, input().split())
i = 0
while True:
i += 1
if A%2:
A -= 1
A /= 2
B += A
if i == K:
break
i += 1
if B%2:
B -= 1
B /= 2
A += B
if i == K:
break
print(int(A),int(B)) |
s505689310 | p03394 | u843135954 | 2,000 | 262,144 | Wrong Answer | 38 | 9,476 | 631 | 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... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
n = ni()
import math
a = [2,3]
now = 30000
for i in range(n-2):
if i == n-3:
total = su... | s916613417 | Accepted | 43 | 10,112 | 991 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
n = ni()
import math
if n==3:
print(2,5,63)
exit()
a = [2,3,5]
now = 30000
for i in range(... |
s276137710 | p03457 | u975966195 | 2,000 | 262,144 | Wrong Answer | 416 | 27,300 | 416 | 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... | n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
info.insert(0, [0, 0, 0])
x_diff, y_diff = 0, 0
for i in range(n):
dt = info[i+1][0] - info[i][0]
x_diff = abs(info[i+1][1] - info[i][1])
y_diff = abs(info[i+1][2] - info[i][2])
if dt < x_diff + y_diff:
print('NO')
... | s673571527 | Accepted | 319 | 2,940 | 163 | n = int(input())
for i in range(n):
t, x, y = map(int, input().split())
if (x + y) > t or (x + y + t) % 2:
print('No')
exit()
print('Yes')
|
s094210718 | p03433 | u381572327 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 130 | 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, A = int(input()), int(input())
print(N, A)
while N >= 500:
N = N - 500
if A >= N:
print("Yes")
else:
print("No")
| s452197295 | Accepted | 18 | 2,940 | 118 | N, A = int(input()), int(input())
while N >= 500:
N = N - 500
if A >= N:
print("Yes")
else:
print("No")
|
s412995760 | p03730 | u762420987 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 239 | 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())
A_ = A
counter = 0
while True:
if A_%B == C:
print("Yes")
break
A_ += A
counter += 1
if counter > B:
print("No")
break
#go
| s847983441 | Accepted | 17 | 2,940 | 239 | A,B,C = map(int,input().split())
A_ = A
counter = 0
while True:
if A_%B == C:
print("YES")
break
A_ += A
counter += 1
if counter > B:
print("NO")
break
#go
|
s002407435 | p02613 | u785728112 | 2,000 | 1,048,576 | Wrong Answer | 163 | 16,320 | 329 | 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 = []
a = 0
t = 0
w = 0
r = 0
for _ in range(n):
S.append(input())
for i in range(n):
if S[i]=="AC":
a += 1
elif S[i]=="TLE":
t += 1
elif S[i]=="WA":
w += 1
else:
r += 1
a = str(a)
w = str(w)
t = str(t)
r = str(r)
print("ACx"+a)
print("WAx"+w)
print("TLE"+t)
print("REx"+r)
... | s755986579 | Accepted | 170 | 16,132 | 328 | n = int(input())
S = []
a = 0
t = 0
w = 0
r = 0
for _ in range(n):
S.append(input())
for i in range(n):
if S[i]=="AC":
a += 1
elif S[i]=="TLE":
t += 1
elif S[i]=="WA":
w += 1
else:
r += 1
a = str(a)
w = str(w)
t = str(t)
r = str(r)
print("AC x "+a)
print("WA x "+w)
print("TLE x "+t)
print("R... |
s702584901 | p02613 | u695329583 | 2,000 | 1,048,576 | Wrong Answer | 149 | 9,096 | 204 | 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())
for _ in range(n) :
l = list(input())
print('AC x ' + str(l.count('AC')))
print('WA x ' + str(l.count('WA')))
print('TLE x ' + str(l.count('TLE')))
print('RE x ' + str(l.count('RE'))) | s615206278 | Accepted | 148 | 16,204 | 211 | n = int(input())
l = []
for i in range(n) :
l.append(input())
print('AC x ' + str(l.count('AC')))
print('WA x ' + str(l.count('WA')))
print('TLE x ' + str(l.count('TLE')))
print('RE x ' + str(l.count('RE'))) |
s747024276 | p03472 | u797550216 | 2,000 | 262,144 | Wrong Answer | 411 | 29,812 | 565 | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d... | import bisect
import sys
n,h = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]
b = [ab[i][1] for i in range(n)]
if n == 1:
if h <= ab[0][1]:
print(1)
sys.exit()
else:
print(1+(h-ab[0][1])//ab[0][0])
sys.exit()
max_a = 0
for i in ran... | s438404593 | Accepted | 417 | 29,716 | 727 | import bisect
import sys
import math
n,h = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]
b = [ab[i][1] for i in range(n)]
if n == 1:
if h <= ab[0][1]:
print(1)
sys.exit()
else:
if ab[0][1] >= ab[0][0]:
print(1+(math.ceil((h-ab[0... |
s794096434 | p03251 | u622570247 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,024 | 224 | 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... | n, m, x, y = map(int, input().split())
xx = tuple(map(int, input().split()))
yy = tuple(map(int, input().split()))
if x > y:
print('War')
exit(0)
if min(yy) - max(xx) > 1:
print("No War")
else:
print("War") | s635146210 | Accepted | 27 | 9,108 | 221 | n, m, x, y = map(int, input().split())
xx = tuple(map(int, input().split())) + (x,)
yy = tuple(map(int, input().split())) + (y,)
maxx = max(xx)
miny = min(yy)
if maxx >= miny:
print('War')
else:
print('No War')
|
s242413297 | p02694 | u332317213 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,176 | 245 | 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... | import math
def main():
X = input()
X = int(X)
output = 100
year = 0
while output <= X:
output = int(output * 1.01)
math.floor(output)
year += 1
print(year)
if __name__ == "__main__":
main() | s361846155 | Accepted | 22 | 9,156 | 244 | import math
def main():
X = input()
X = int(X)
output = 100
year = 0
while output < X:
output = int(output * 1.01)
math.floor(output)
year += 1
print(year)
if __name__ == "__main__":
main() |
s899714241 | p02972 | u830054172 | 2,000 | 1,048,576 | Wrong Answer | 108 | 6,880 | 379 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | n = int(input())
a = input()
al = list(map(int, a.split()))
ans = [al.index(i)+1 for i in al if i == 1]
if set(al) == 0:
print(0)
else:
if sum(al)%2 != al[0]:
print(-1)
else:
for i in range(2,n):
if sum(al[i::i])%2 != al[i]:
print(-1)
break
... | s972113901 | Accepted | 552 | 22,324 | 665 | N = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(N)]
def check(i):
n = i
cnt = 0
while n <= N:
cnt += b[n-1]
n += i
return cnt
for i in range(N-1, -1, -1):
if (a[i]+check(i+1))%2 == 1:
b[i] = 1
ans = sum(b)
ll = []
for i in rang... |
s831940631 | p03637 | u549383771 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 338 | 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. | a_list = list(map(int,input().split()))
cntn = 0
cnt2 = 0
cnt4 = 0
for i in a_list:
if i%4 == 0:
cnt4 += 1
elif i%2 == 0:
cnt2 += 1
else:
cntn += 1
cnt4seat = cnt4*2
flag = True
cnt4seat -= cntn
if cnt2 == 1:
cnt4seat -= 1
if cnt4seat >= 0:
print('Yes')
els... | s459720246 | Accepted | 64 | 15,020 | 421 | n = int(input())
a_list = list(map(int,input().split()))
cntn = 0
cnt2 = 0
cnt4 = 0
for i in a_list:
if i%4 == 0:
cnt4 += 1
elif i%2 == 0:
cnt2 += 1
else:
cntn += 1
flag = True
if cnt4+ 1 >= cntn :
flag = True
else:
flag = False
if cnt2 >= 1:
if cnt4 >= cntn :... |
s541697852 | p02751 | u340781749 | 2,000 | 1,048,576 | Wrong Answer | 19 | 6,004 | 155 | We have a grid with (2^N - 1) rows and (2^M-1) columns. You are asked to write 0 or 1 in each of these squares. Let a_{i,j} be the number written in the square at the i-th row from the top and the j-th column from the left. For a quadruple of integers (i_1, i_2, j_1, j_2) such that 1\leq i_1 \leq i_2\leq 2^N-1, 1\leq ... | n, m = map(int, input().split())
ans = []
ans.append('0' + '1' * (2 ** m - 2))
ans.extend(['1' + '0' * (2 ** m - 2)] * (2 ** n - 2))
print('\n'.join(ans))
| s240355641 | Accepted | 22 | 6,840 | 559 | n, m = map(int, input().split())
ans = [0, 1]
for i in range(1, min(n, m)):
k = 1 << i
x = (1 << k) - 1
slide = [a << k for a in ans]
new_ans = [s | a for s, a in zip(slide, ans)]
new_ans.extend(s | (a ^ x) for s, a in zip(slide, ans))
ans = new_ans
if n > m:
ans *= 1 << (n - m)
elif n < m:
... |
s878859719 | p02388 | u318393460 | 1,000 | 131,072 | Wrong Answer | 20 | 5,572 | 27 | Write a program which calculates the cube of a given integer x. | x =int(input())
print(x^3)
| s618690861 | Accepted | 20 | 5,576 | 29 | x = int(input())
print(x**3)
|
s377432341 | p02795 | u306950978 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 72 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | h = int(input())
w = int(input())
n = int(input())
print(min(n//h,n//w)) | s015776233 | Accepted | 18 | 3,064 | 80 | h = int(input())
w = int(input())
n = int(input())
print(min(-(-n//h),-(-n//w))) |
s835343138 | p03599 | u540307496 | 3,000 | 262,144 | Wrong Answer | 29 | 3,064 | 622 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | a,b,c,d,e,f=map(int,input().split())
ans_wat = 0
ans_sug = 0
ans_rate = 0
maxrate = 100 * e / (e + 100)
for i in range(31):
for j in range(31):
water = (i * a + j * b) * 100
if (water <= f and water):
nsug = min(f - water, water)
for k in range(nsug):
l = (... | s809998280 | Accepted | 21 | 3,064 | 588 | a,b,c,d,e,f=map(int,input().split())
ans_wat = 0
ans_sug = 0
ans_rate = 0
for i in range(31):
for j in range(31):
water = (i * a + j * b) * 100
if (water <= f and water):
nsug = min(water * e // 100, f - water)
for k in range(nsug//c+1):
l = (nsug - k*c)//d
... |
s101540717 | p03360 | u818655004 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 117 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a, b, c = map(int, input().split())
k = int(input())
m = max(max(a, b), c)
sum_ = a + b + c
res = sum_ - m + m*(2**k) | s933931218 | Accepted | 17 | 2,940 | 128 | a, b, c = map(int, input().split())
k = int(input())
m = max(max(a, b), c)
sum_ = a + b + c
res = sum_ - m + m*(2**k)
print(res) |
s537457263 | p03502 | u074220993 | 2,000 | 262,144 | Wrong Answer | 29 | 9,112 | 95 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | N = input()
f = lambda X:sum(int(x) for x in X)
print('Yes' if f(N)%int(N) == 0 else 'No')
| s283695804 | Accepted | 27 | 9,072 | 167 |
def harshad(n):
if n % sum(map(int, list(str(n)))) == 0:
return True
else:
return False
N = int(input())
print('Yes' if harshad(N) else 'No') |
s838288594 | p01839 | u046108504 | 8,000 | 524,288 | Wrong Answer | 20 | 5,596 | 364 | 時は進んで 2060 年,共に 70 歳を迎える前田さんと後藤さんは長い付き合いの友人であり,大学時代にACM-ICPCで共に戦った仲間でもある. 二人は今でもよく一緒にお茶を飲みつつ,競技プログラミングの話で盛り上がっている. 二人で一緒にお茶を飲む時,前田さんが 1 回`A`と言うと,その発言の後に後藤さんがちょうど 1 回`Un`と返事をする習慣がいつのまにか出来た. しかし最近後藤さんは物忘れや勘違いをすることが多く,前田さんが`A`と言っても,後藤さんはたまに`Un`の返事を忘れたり,余計に返事をしたりする. ついこの間も前田さんと後藤さんはお茶を飲みながら,二人のお気に入りのデータ構造について話し込んでいたようだ... | def solve():
N = int(input())
S = [input() for _ in range(N)]
a_count = 1 if S[0] == "A" else -1
if N == 1 and a_count == -1:
return "NO"
for i in range(1, N):
if a_count > 0:
a_count += 1 if S[i] == "A" else -1
else:
return "NO"
return "YES"
if ... | s894127621 | Accepted | 20 | 5,604 | 424 | def solve():
N = int(input())
S = [input() for _ in range(N)]
a_count = 1 if S[0] == "A" else -1
# if N == 1 and a_count == -1:
# return "NO"
for i in range(1, N):
if a_count >= 0:
a_count += 1 if S[i] == "A" else -1
else:
return "NO"
if a_count ==... |
s263021908 | p03544 | u819710930 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 66 | 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) | a,b=2,1
n=int(input())
for i in range(n-1):
a,b=b,a+b
print(a) | s464422012 | Accepted | 17 | 2,940 | 62 | a,b=2,1
for i in range(int(input())):
a,b=b,(a+b)
print(a) |
s124435374 | p03370 | u681323954 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 91 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | n,x=map(int,input().split())
M=[int(input()) for _ in range(n)]
print(x-sum(M) + x//min(M)) | s743628030 | Accepted | 18 | 2,940 | 93 | n,x=map(int,input().split())
l=[int(input()) for _ in range(n)]
print(n+((x-sum(l))//min(l))) |
s928391895 | p03478 | u172569352 | 2,000 | 262,144 | Wrong Answer | 37 | 3,552 | 189 | 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 = [int(i) for i in input().split()]
b = []
for i in range(N+1):
a = [int(j) for j in list(str(i))]
if A <= sum(a) <=B:
b.append(i)
print(b)
print(sum(b))
| s540688209 | Accepted | 37 | 3,296 | 170 | N, A, B = [int(i) for i in input().split()]
b = []
for i in range(N+1):
a = [int(j) for j in list(str(i))]
if A <= sum(a) <=B:
b.append(i)
print(sum(b)) |
s145164899 | p03407 | u721970149 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 135 | 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. |
A, B, C = map(int, input().split())
if A == C or B == C or (A+B) == C :
print("Yes")
else :
print("No")
| s503280810 | Accepted | 17 | 2,940 | 115 |
A, B, C = map(int, input().split())
if (A+B) >= C :
print("Yes")
else :
print("No")
|
s292424319 | p03149 | u981767024 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 397 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". | # 2019/01/13
# Input
n = [0, 0, 0, 0]
val = [1, 9, 7, 4]
valflg = [0, 0, 0, 0]
n[0], n[1], n[2], n[3] = map(int,input().split())
for idx in range(4):
for idx2 in range(4):
if n[idx] == val[idx2]:
valflg[idx2] = 1
if valflg[0] + valflg[1] + valflg[2] + valflg[3] == 4:
ans = "Yes"
else:
... | s531825360 | Accepted | 19 | 3,064 | 400 | # 2019/01/13
# Input
n = [0, 0, 0, 0]
val = [1, 9, 7, 4]
valflg = [0, 0, 0, 0]
n[0], n[1], n[2], n[3] = map(int,input().split())
for idx in range(4):
for idx2 in range(4):
if n[idx] == val[idx2]:
valflg[idx2] = 1
if valflg[0] + valflg[1] + valflg[2] + valflg[3] == 4:
ans = "YES"
els... |
s880179805 | p03417 | u690536347 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 97 | There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of these cards can be distinguished, and initially every card faces up. We will perform the following op... | a,b=map(int,input().split())
if b==1:
print(b-2)
elif b==2:
print(b+2)
else:
print((b-2)*a) | s921567975 | Accepted | 17 | 3,060 | 130 | l=list(map(int,input().split()))
N=min(l)
M=max(l)
if N==1 and M==1:
print(1)
elif N==1:
print(M-2)
else:
print((M-2)*(N-2)) |
s915161750 | p03693 | u019053283 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 194 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | from sys import stdin
A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
total = str(A) + str(B) + str(C)
print(total)
if int(total) % 4 == 0:
print('Yes')
else:
print('No') | s305801551 | Accepted | 18 | 2,940 | 181 | from sys import stdin
A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
total = str(A) + str(B) + str(C)
if int(total) % 4 == 0:
print('YES')
else:
print('NO') |
s662752867 | p03471 | u391819434 | 2,000 | 262,144 | Wrong Answer | 28 | 9,180 | 206 | 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,Y=map(int,input().split())
x=y=z=0
while N and 5000*N<Y:
Y-=10000
N-=1
x+=1
while N and 1000*N<Y:
Y-=5000
N-=1
y+=1
z=N
if z*1000==Y:
print(x,y,z)
else:
print(-1,-1,-1) | s404728089 | Accepted | 660 | 9,116 | 196 | N,Y=map(int,input().split())
x=y=z=0
ans=[-1,-1,-1]
while x<=N:
y=0
while x+y<=N:
if 10000*x+5000*y+1000*(N-x-y)==Y:
ans=[x,y,N-x-y]
y+=1
x+=1
print(*ans) |
s908130694 | p02606 | u050017042 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,072 | 99 | How many multiples of d are there among the integers between L and R (inclusive)? | l,r,d=map(int,input().split())
ans=0
for i in range(l,r+1):
if d%i==0:
ans+=1
print(ans)
| s688549062 | Accepted | 23 | 9,012 | 94 | l,r,d=map(int,input().split())
ans=0
for i in range(l,r+1):
if i%d==0:
ans+=1
print(ans) |
s787145290 | p03730 | u886297662 | 2,000 | 262,144 | Wrong Answer | 2,103 | 2,940 | 127 | 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())
k = 1
while a * k < b:
if a * k % b == c:
print('YES')
break
else:
print('NO') | s563392405 | Accepted | 17 | 2,940 | 200 | a, b, c = map(int, input().split())
k = 1
cnt = 0
while True:
amari = a * k % b
if amari == c:
cnt += 1
if amari == 0:
break
k += 1
if cnt == 0:
print('NO')
else:
print('YES')
|
s402263389 | p02396 | u186282999 | 1,000 | 131,072 | Wrong Answer | 140 | 8,000 | 260 | 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... | input_list = []
flag = True
while flag:
input_value = input()
if input_value == "0":
flag = False
input_list.append(input_value)
print("Hello")
for i in range(0, len(input_list)-1):
print("Case {0}:{1}".format(i, input_list[i])) | s560517939 | Accepted | 70 | 8,044 | 245 | input_list = []
flag = True
while flag:
input_value = input()
if input_value == "0":
flag = False
input_list.append(input_value)
for i in range(0, len(input_list)-1):
print("Case {0}: {1}".format(i+1, input_list[i])) |
s421680520 | p03836 | u821588465 | 2,000 | 262,144 | Wrong Answer | 30 | 9,416 | 462 | 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())
ans = []
for i in range(ty-sy):
ans.append('U')
for i in range(tx-sx):
ans.append('R')
for i in range(abs(sy-ty)):
ans.append('D')
for i in range(abs(sx-tx)):
ans.append('L')
ans.append('L')
for i in range(ty+1-sy):
ans.append('U')
for i in range(tx-sx+1)... | s284762759 | Accepted | 28 | 9,280 | 512 | sx, sy, tx, ty = map(int, input().split())
ans = []
for i in range(ty-sy):
ans.append("U")
for i in range(tx-sx):
ans.append("R")
for i in range(abs(sy-ty)):
ans.append("D")
for i in range(abs(sx-tx)):
ans.append("L")
ans.append("L")
for i in range(ty-sy+1):
ans.append("U")
for i in range(tx-sx+1)... |
s365692267 | p00003 | u600263347 | 1,000 | 131,072 | Wrong Answer | 40 | 5,600 | 278 | 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. | def main():
n = int(input())
for i in range(n):
Array = list(map(int,input().split()))
Array.sort()
if Array[2]**2 == Array[0]**2 + Array[1]**2:
print("yes")
else:
print("No")
if __name__ == '__main__':
main() | s031911519 | Accepted | 40 | 5,604 | 278 | def main():
n = int(input())
for i in range(n):
Array = list(map(int,input().split()))
Array.sort()
if Array[2]**2 == Array[0]**2 + Array[1]**2:
print("YES")
else:
print("NO")
if __name__ == '__main__':
main() |
s188211607 | p03698 | u946424121 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
if [x for x in s] == set([x for x in s]):
print("yes")
else:
print("no")
| s542688589 | Accepted | 17 | 2,940 | 62 | s = input()
print("yes" if len(s) == len(set(s)) else "no")
|
s773005407 | p03637 | u282228874 | 2,000 | 262,144 | Wrong Answer | 67 | 14,252 | 337 | 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(map(int,input().split()))
num4 = []
num2 = []
num1 = []
for a in A:
if a%4 == 0:
num4.append(a)
elif a%2 == 0:
num2.append(a)
else:
num1.append(a)
if len(num1)-1 > len(num4):
print("No")
elif len(num2)==1 and len(num4)<len(num1)+1:
print("No")
else:
... | s618888138 | Accepted | 66 | 14,252 | 357 | n = int(input())
A =list(map(int,input().split()))
num4 = 0
num2 = 0
num1 = 0
for a in A:
if a%4 == 0:
num4 += 1
elif a%2 == 0:
num2 += 1
else:
num1 += 1
if num2 == 0:
if num4 >= num1-1:
print("Yes")
else:
print("No")
else:
if num4 >= num1:
print(... |
s155026830 | p02415 | u498511622 | 1,000 | 131,072 | Wrong Answer | 20 | 7,328 | 26 | Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string. | x=input().lower()
print(x) | s824783306 | Accepted | 20 | 7,396 | 25 | print(input().swapcase()) |
s304189342 | p02613 | u810787773 | 2,000 | 1,048,576 | Wrong Answer | 145 | 16,204 | 444 | 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())
S = [input() for _ in range(N)]
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
if S[i] == 'AC':
AC += 1
elif S[i] == 'WA':
WA += 1
elif S[i] == 'TLE':
TLE += 1
else:
RE += 1
pr... | s955632708 | Accepted | 142 | 16,244 | 440 | def main():
N = int(input())
S = [input() for _ in range(N)]
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
if S[i] == 'AC':
AC += 1
elif S[i] == 'WA':
WA += 1
elif S[i] == 'TLE':
TLE += 1
else:
RE += 1
pr... |
s272302984 | p02255 | u428229577 | 1,000 | 131,072 | Wrong Answer | 20 | 7,332 | 254 | 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 ... | leng = input()
ind = input()
indsprit = ind.split(" ")
print(indsprit)
for i in range(len(indsprit)):
v = indsprit[i]
j = i -1
while j >= 0 and indsprit[j] > v:
indsprit[j+1] = indsprit[j]
j -= 1
indsprit[j+1] = v
print(indsprit)
print(indsprit) | s048507332 | Accepted | 20 | 8,016 | 180 | N = int(input())
A = list(map(int, input().split()))
print(*A)
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) |
s367119247 | p02600 | u320304481 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,068 | 89 | 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())
if 400 <= X <= 599:
print(8)
else:
t = X//200 -1
print(8-t) | s621599139 | Accepted | 28 | 9,024 | 34 | X = int(input())
print(10-X//200) |
s433370622 | p02245 | u960937651 | 1,000 | 131,072 | Wrong Answer | 30 | 6,012 | 910 | The goal of the 8 puzzle problem is to complete pieces on $3 \times 3$ cells where one of the cells is empty space. In this problem, the space is represented by 0 and pieces are represented by integers from 1 to 8 as shown below. 1 3 0 4 2 5 7 8 6 You can move a piece toward the empty space at one st... | from collections import deque
MOVE = {'U': (0, -1), 'D': (0, 1), 'L': (-1, 0), 'R': (1, 0)}
def next(numbers):
for d in 'UDLR':
z = numbers.index(0)
tx, ty = z % 3 + MOVE[d][0], z
if 0 <= tx < 3 and 0 <= ty < 3:
t = ty * 3 + tx
result = list(numbers)
re... | s226518475 | Accepted | 3,830 | 55,808 | 927 | from collections import deque
MOVE = {'U': (0, -1), 'D': (0, 1), 'L': (-1, 0), 'R': (1, 0)}
def next(numbers):
for d in 'UDLR':
z = numbers.index(0)
tx, ty = z % 3 + MOVE[d][0], z // 3 + MOVE[d][1]
if 0 <= tx < 3 and 0 <= ty < 3:
t = ty * 3 + tx
result = list(number... |
s672454775 | p04029 | u503111914 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 55 | 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? | a = 0
for i in range(1,int(input())):
a += i
print(a) | s964817210 | Accepted | 18 | 2,940 | 59 | a = 0
for i in range(1,int(input())+1):
a += i
print(a) |
s030798386 | p03378 | u603234915 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 255 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c... | l = list(map(int,input().split()))
a = list(map(int,input().split()))
b = []
c = []
for n in a:
if n > l[2]:
b.append(n)
else:
c.append(n)
if l[2] - l[1] <= l[1]:
print('{}'.format(len(c)))
else:
print('{}'.format(len(b)))
| s952086211 | Accepted | 17 | 2,940 | 203 | l = list(map(int,input().split()))
a = list(map(int,input().split()))
b = []
c = []
for n in a:
if n > l[2]:
b.append(n)
else:
c.append(n)
print('{}'.format(min(len(b),len(c))))
|
s119332459 | p03814 | u167681750 | 2,000 | 262,144 | Wrong Answer | 18 | 3,500 | 62 | 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()
l = s.find("A")
r = s.rfind("Z")
print(l - r + 1)
| s192765253 | Accepted | 18 | 3,500 | 61 | s = input()
l = s.find("A")
r = s.rfind("Z")
print(r - l + 1) |
s201582413 | p03068 | u580004585 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 77 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | n = int(input())
s = input()
k = int(input())
print(s.replace(s[k -1], '*')) | s831610092 | Accepted | 17 | 2,940 | 147 | n = int(input())
s = input()
k = int(input())
res = ""
for i in s:
if i == s[k - 1]:
res += i
else:
res += "*"
print(res) |
s640236480 | p04043 | u920621778 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | 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 ... | a, b , c = map(int, input().split())
print(a*b*c==175 and a+b+c==17) | s940843427 | Accepted | 17 | 2,940 | 100 | a, b , c = map(int, input().split())
flag = a*b*c==175 and a+b+c==17
print('YES' if flag else 'NO') |
s731682193 | p03860 | u099212858 | 2,000 | 262,144 | Wrong Answer | 27 | 9,112 | 41 | 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+b[0]+c) | s940544520 | Accepted | 29 | 8,900 | 67 | a = list(map(str,input().split()))
x = a[1]
print("A"+ x[0] + "C")
|
s534369476 | p03556 | u103902792 | 2,000 | 262,144 | Wrong Answer | 27 | 2,940 | 79 | 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. | n = int(input())
for i in range(n+1):
if i**2 > n:
print(i-1)
exit(0) | s152849194 | Accepted | 27 | 2,940 | 134 | n = int(input())
for i in range(n+1):
if i**2 >= n:
if i **2 == n:
print(i**2)
else:
print((i-1)**2)
exit(0) |
s928158265 | p02690 | u368249389 | 2,000 | 1,048,576 | Wrong Answer | 1,011 | 9,512 | 869 | 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 factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append([i, cnt])
if temp!=1:
arr.append([temp, 1])
if arr==[]:
... | s602090711 | Accepted | 544 | 9,092 | 309 |
# input
X = int(input())
ans_list = [0, 0]
# count
for a in range(-500, 501):
for b in range(-500, 501):
if a**5-b**5==X:
ans_list[0] = a
ans_list[1] = b
break
# output
print(" ".join(map(str, ans_list)))
|
s079799708 | p03814 | u503111914 | 2,000 | 262,144 | Wrong Answer | 18 | 3,500 | 45 | 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()
print(S.rindex("Z")-S.index("A")) | s139599342 | Accepted | 18 | 3,500 | 51 | S = input()
print(S.rindex("Z") - S.index("A") + 1) |
s351047728 | p03352 | u024340351 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,192 | 1,273 | 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. | s = int(input())
snooker =[0]*1000
for p in range (1, 100):
for q in range (1, 10):
if p**q<=10000:
snooker[10*(p-1)+q-1]=p**q
snooker = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46... | s655022834 | Accepted | 18 | 3,064 | 938 | s = int(input())
snooker =[0]*1000
for p in range (1, 100):
for q in range (2, 10):
if p**q<=10000:
snooker[10*(p-1)+q-1]=p**q
snooker = [1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841,... |
s063365744 | p02694 | u090729464 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,116 | 201 | 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... | import math
X = int(input())
deposit = 100
cnt = 0
for i in range(1,100**18):
deposit = math.floor(deposit * 1.01)
cnt += 1
if deposit >= X:
print(deposit)
break
print(cnt)
| s559357583 | Accepted | 21 | 9,088 | 178 | import math
X = int(input())
deposit = 100
cnt = 0
for i in range(1,100**18):
deposit = math.floor(deposit * 1.01)
cnt += 1
if deposit >= X:
break
print(cnt)
|
s687414058 | p03544 | u159703196 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 121 | 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) | i=int(input())
L=[0,1,1]
for j in range(2,i):
a=L[j-1]+L[j]
L.append(a)
print(a)
A = 2*L[i-1]+L[i]
print(A)
| s447991233 | Accepted | 17 | 2,940 | 147 | i=int(input())
L=[0,1,1]
if i==1:
A=1
else:
for j in range(2,i):
a=L[j-1]+L[j]
L.append(a)
A = 2*L[i-1]+L[i]
print(A)
|
s749258474 | p02678 | u638902622 | 2,000 | 1,048,576 | Wrong Answer | 535 | 63,344 | 2,170 | 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... | import sys
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d... | s710896969 | Accepted | 551 | 63,320 | 2,187 | import sys
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d... |
s942710116 | p03455 | u195177386 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | 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())
print('Odd' if (a*b) % 2 == 0 else 'Even') | s953264348 | Accepted | 17 | 2,940 | 75 | a, b = map(int, input().split())
print('Even' if (a*b) % 2 == 0 else 'Odd') |
s469472789 | p03360 | u732159958 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a, b, c = map(int, input().split())
k = int(input())
print(pow(2, k) * max(a, b, c)) | s511089260 | Accepted | 17 | 2,940 | 99 | a = list(map(int, input().split()))
k = int(input())
a.sort()
print(pow(2, k) * a[2] + a[1] + a[0]) |
s837113148 | p03720 | u612721349 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 197 | 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? | from collections import defaultdict
n, k = map(int, input().split())
d = defaultdict(int)
for _ in [0]*k:
a, b = map(int, input().split())
d[a] += 1
d[b] += 1
for i in range(n):
print(d[i]) | s367894565 | Accepted | 20 | 3,316 | 199 | from collections import defaultdict
n, k = map(int, input().split())
d = defaultdict(int)
for _ in [0]*k:
a, b = map(int, input().split())
d[a] += 1
d[b] += 1
for i in range(n):
print(d[i+1]) |
s425332008 | p03472 | u310678820 | 2,000 | 262,144 | Wrong Answer | 527 | 30,840 | 475 | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d... | def solve():
N, H = map(int, input().split())
katana = []
for i in range(N):
a, b = map(int, input().split())
katana.append((a, 0, i))
katana.append((b, 1, i))
katana = sorted(katana, reverse = True)
ans = 0
for i in range(N*2):
k = katana[i]
#print(H, ans... | s350985734 | Accepted | 533 | 30,824 | 493 | import math
def solve():
N, H = map(int, input().split())
katana = []
for i in range(N):
a, b = map(int, input().split())
katana.append((a, 0, i))
katana.append((b, 1, i))
katana = sorted(katana, reverse = True)
ans = 0
for i in range(N*2):
k = katana[i]
#... |
s493022309 | p02742 | u289288647 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,088 | 117 | 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 W == 1:
print(1)
elif W%2 == 1:
print(H*W//2+1)
else:
print(H*W//2)
| s130142835 | Accepted | 29 | 9,000 | 134 | H, W = map(int, input().split())
if W == 1 or H == 1:
print(1)
elif H%2 == W%2 == 1:
print(H*W//2+1)
else:
print(H*W//2)
|
s444380858 | p02608 | u585963734 | 2,000 | 1,048,576 | Wrong Answer | 84 | 9,660 | 425 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | import sys
readline = sys.stdin.buffer.readline
N=int(readline())
n=int(pow(N//3,0.5))
cnt=[0]*(N+1)
for i in range(1,n):
for j in range(i,n):
for k in range(j,n):
if pow(i,2)+pow(j,2)+pow(k,2)+i*j+j*k+k*i<=N:
if i==j and j==k and k==i:
cnt[pow(i,2)+pow(j,2)+pow(k,2)+i*j+j*k+k*i]+=1
... | s943587324 | Accepted | 753 | 78,744 | 313 | import sys
import itertools as itr
readline = sys.stdin.buffer.readline
N=int(readline())
n=int(pow(N,0.5))
chk=list(itr.product(range(1,n),repeat=3))
cnt=[0]*(N+1)
for c in chk:
i=c[0]
j=c[1]
k=c[2]
if i*i+j*j+k*k+i*j+j*k+k*i<=N:
cnt[i*i+j*j+k*k+i*j+j*k+k*i]+=1
for i in range(1,N+1):
print(cnt[i]) |
s424241947 | p02390 | u216229195 | 1,000 | 131,072 | Wrong Answer | 20 | 7,564 | 75 | 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. | x = int(input())
h = x//(60*60)
m = x%(60*60)
s = x%60
print(h,m,s,sep=":") | s983231581 | Accepted | 60 | 7,620 | 76 | x = int(input())
h = x//(60*60)
m = (x//60)%60
s = x%60
print(h,m,s,sep=":") |
s771339541 | p02975 | u239528020 | 2,000 | 1,048,576 | Wrong Answer | 50 | 14,120 | 181 | Snuke has N hats. The i-th hat has an integer a_i written on it. There are N camels standing in a circle. Snuke will put one of his hats on each of these camels. If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print `Yes`; otherwise, print `No... | ### A
N = int(input())
a_all = list(map(int, input().split()))
print(a_all)
if N!=3:
print("No")
elif (a_all[0]^a_all[1]==a_all[2]):
print("Yes")
else:
print("No") | s491627057 | Accepted | 61 | 14,212 | 766 | ### A
N = int(input())
a_all = list(map(int, input().split()))
t = list(set(a_all))
if len(t)==3:
if (t[0]^t[1]==t[2]):
a=0
b=0
c=0
for i in a_all:
if i==t[0]:
a+=1
elif i==t[1]:
b+=1
else:
c+=1
... |
s386093851 | p03860 | u884795391 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 32 | 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 = input()
print('A'+a[8]+'B') | s839527470 | Accepted | 17 | 2,940 | 32 | a = input()
print('A'+a[8]+'C') |
s264469258 | p03854 | u768896740 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 428 | 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()
s_2 = s[::-1]
t = []
count = 0
# word_list = ['dream', 'dreamer', 'erase', 'eraser']
word_list = ['maerd', 'remaerd', 'esare', 'resare']
for i in range(10000):
if count == len(s):
break
if s_2[count:count+5] in word_list:
count += 5
continue
elif s_2[count:count+6] i... | s940159072 | Accepted | 51 | 4,652 | 398 | s = input()
s = list(s)
s = s[::-1]
word_list = ['maerd', 'remaerd', 'esare', 'resare']
i = 0
while i != len(s):
a = s[i:i+5]
a = ''.join(a)
b = s[i:i+6]
b = ''.join(b)
c = s[i:i+7]
c = ''.join(c)
if a in word_list:
i += 5
elif b in word_list:
i += 6
elif c in word_l... |
s807930717 | p03054 | u892251744 | 2,000 | 1,048,576 | Wrong Answer | 424 | 37,024 | 986 | We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,s_c). Takahashi and Aoki will play a game, where each player has a st... | H,W,N = map(int, input().split())
Sr, Sc = map(int, input().split())
S = input()
T = input()
atk_U = [0]*N
atk_D = [0]*N
atk_L = [0]*N
atk_R = [0]*N
u = 0
d = 0
l = 0
r = 0
for i in range(N):
if S[i] == 'U':
u += 1
if S[i] == 'D':
d += 1
if S[i] == 'L':
l += 1
if S[i] == 'R':
r += 1
atk_U[i] ... | s348896981 | Accepted | 523 | 36,188 | 1,122 | H,W,N = map(int, input().split())
Sr, Sc = map(int, input().split())
S = input()
T = input()
atk_U = [0]*N
atk_D = [0]*N
atk_L = [0]*N
atk_R = [0]*N
u = 0
d = 0
l = 0
r = 0
for i in range(N):
if S[i] == 'U':
u += 1
if S[i] == 'D':
d += 1
if S[i] == 'L':
l += 1
if S[i] == 'R':
r += 1
atk_U[i] ... |
s734290316 | p03730 | u430478288 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 133 | 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(1000):
if (A * i) % B == C:
print('YES')
break
print('NO') | s454909085 | Accepted | 154 | 2,940 | 169 | A, B, C = map(int, input().split())
def check():
for i in range(1000000):
if (A * i) % B == C:
return 'YES'
return 'NO'
print(check())
|
s946968637 | p03636 | u865413330 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 51 | 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 = input()
print(s[0] + str(len(s[0:-1])) + s[-1]) | s562569054 | Accepted | 17 | 2,940 | 51 | s = input()
print(s[0] + str(len(s[1:-1])) + s[-1]) |
s982673235 | p03470 | u743154453 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 108 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... | N = int(input())
d = []
for i in range(N):
d.append(int(input()))
print(d[i])
print(len(set(d)))
| s802379708 | Accepted | 17 | 3,064 | 92 | N = int(input())
d = []
for i in range(N):
d.append(int(input()))
print(len(set(d)))
|
s613981376 | p02397 | u108130680 | 1,000 | 131,072 | Wrong Answer | 30 | 5,616 | 128 | Write a program which reads two integers x and y, and prints them in ascending order. | while True:
a,b = map(int, input().split())
if a == 0 and b == 0: break
if a > b:
print(b, a)
else:
print(a, b)
| s878771677 | Accepted | 60 | 5,612 | 141 | while True:
x,y = map(int, input().split())
if x == 0 and y == 0:break
if x > y:
print(y, x)
else:
print(x, y)
|
s638020275 | p02610 | u858742833 | 2,000 | 1,048,576 | Wrong Answer | 786 | 59,516 | 437 | We have N camels numbered 1,2,\ldots,N. Snuke has decided to make them line up in a row. The happiness of Camel i will be L_i if it is among the K_i frontmost camels, and R_i otherwise. Snuke wants to maximize the total happiness of the camels. Find the maximum possible total happiness of the camel. Solve this probl... | import heapq
def main():
T = int(input())
for _ in range(T):
N = int(input())
KLR = [tuple(map(int, input().split())) for _ in range(N)]
KLR.sort()
H = []
s = 0
for k, l, r in KLR:
s += r
heapq.heappush(H, (l - r, k))
while len... | s518721244 | Accepted | 931 | 65,744 | 734 | import heapq
def main():
T = int(input())
for _ in range(T):
N = int(input())
KLR = [tuple(map(int, input().split())) for _ in range(N)]
KLR.sort()
H = []
T = []
s = 0
for k, l, r in KLR:
s += r
if l - r >= 0:
heapq... |
s820079935 | p03813 | u599547273 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 36 | Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. | print("A{'BR'[int(input())<1200]}C") | s740651905 | Accepted | 17 | 2,940 | 35 | print("AARBCC "[input()<"1200"::2]) |
s538501469 | p03609 | u863442865 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 19 | We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand. How many grams of sand will the upper bulb contains after t seconds? | print(input()[::2]) | s911587231 | Accepted | 17 | 2,940 | 74 | x,t = map(int, input().split())
if x>=t:
print(x-t)
else:
print(0) |
s652185605 | p03998 | u040298438 | 2,000 | 262,144 | Wrong Answer | 28 | 8,932 | 171 | 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. * ... | a, b, c = (input() for _ in range(3))
d = {"a": a, "b": b, "c": c}
nex = "a"
while len(d[nex]) != 0:
tmp = d[nex][0]
d[nex] = d[nex][1:]
nex = tmp
print(nex) | s165818443 | Accepted | 30 | 9,020 | 180 | a, b, c = (input() for _ in range(3))
d = {"a": a, "b": b, "c": c}
nex = "a"
while len(d[nex]) != 0:
tmp = d[nex][0]
d[nex] = d[nex][1:]
nex = tmp
print(nex.upper())
|
s244390215 | p03543 | u094191970 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | n=input()
print('Yes' if n[:3]==n[1:] else 'No') | s647940888 | Accepted | 17 | 2,940 | 72 | n=input()
print('Yes' if n[0]==n[1]==n[2] or n[1]==n[2]==n[3] else 'No') |
s566796148 | p03449 | u363407238 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 205 | 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())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a1.append(0)
suml = []
for i in range(n):
suml.append([sum(a1[:-i - 1]) + sum(a2[-i - 1:])])
print(max(suml))
| s927634601 | Accepted | 19 | 3,060 | 208 | n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a1.append(0)
suml = []
for i in range(n):
suml.append([sum(a1[:-i - 1]) + sum(a2[-i - 1:])])
print(max(suml)[0])
|
s436958800 | p03575 | u623687794 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 1,045 | You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges. The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i. An edge whose removal disconnects the graph is called a _bridge_. Find the number of the edges that are bridges among the M ... | n,m=map(int,input().split())
graph=[[False]*n for i in range(n)]
node=[None for i in range(m)]
visited=[False]*n
for i in range(m):
a,b=map(int,input().split())
graph[a-1][b-1],graph[b-1][a-1]=True,True
node[i]=[a-1,b-1]
def dfs(v):
visited[v]=True
for i in range(n):
if graph[v][i]==False:... | s272765290 | Accepted | 27 | 3,064 | 1,160 | n,m=map(int,input().split())
graph=[[False]*n for i in range(n)]
node=[None for i in range(m)]
visited=[False]*n
for i in range(m):
a,b=map(int,input().split())
graph[a-1][b-1],graph[b-1][a-1]=True,True
node[i]=[a-1,b-1]
def dfs(v):
visited[v]=True
for i in range(n):
if graph[v][i]==False:... |
s503063524 | p02399 | u435300817 | 1,000 | 131,072 | Wrong Answer | 40 | 7,692 | 97 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | values = input()
a, b = [int(x) for x in values.split()]
print(a // b)
print(a % b)
print(a / b) | s121193827 | Accepted | 20 | 7,684 | 111 | values = input()
a, b = [int(x) for x in values.split()]
print('{0} {1} {2:.5f}'.format(a // b, a % b, a / b)) |
s429258416 | p03550 | u214617707 | 2,000 | 262,144 | Wrong Answer | 17 | 3,316 | 215 | We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w... | N, Z, W = map(int, input().split())
a = list(map(int, input().split()))
a = a[::-1]
print(a)
if N == 1:
print(a[0]-W)
elif abs(a[0]-a[1]) > abs(a[0] - W):
print(abs(a[0]-a[1]))
else:
print(abs(a[0] - W)) | s491704452 | Accepted | 17 | 3,188 | 211 | N, Z, W = map(int, input().split())
a = list(map(int, input().split()))
a = a[::-1]
if N == 1:
print(abs(a[0]-W))
elif abs(a[0]-a[1]) > abs(a[0] - W):
print(abs(a[0]-a[1]))
else:
print(abs(a[0] - W)) |
s312969354 | p02422 | u682153677 | 1,000 | 131,072 | Wrong Answer | 20 | 5,612 | 617 | Write a program which performs a sequence of commands to a given string $str$. The command is one of: * print a b: print from the a-th character to the b-th character of $str$ * reverse a b: reverse from the a-th character to the b-th character of $str$ * replace a b p: replace from the a-th character to the b-t... | # -*- coding: utf-8 -*-
s = list(input())
q = int(input())
for i in range(q):
n = list(input().split())
if 'print' in n:
for i in range(int(n[1]), int(n[2])):
print(str(s[i]), end='')
print()
elif 'reverse' in n:
for i in range(int(int(n[2]) / 2)):
s[in... | s081076036 | Accepted | 40 | 5,816 | 644 | # -*- coding: utf-8 -*-
import math
s = list(input())
q = int(input())
for i in range(q):
n = list(input().split())
if 'print' in n:
for j in range(int(n[1]), int(n[2]) + 1):
print(str(s[j]), end='')
print()
elif 'reverse' in n:
for k in range(math.floor((int(n[2]) - ... |
s315412007 | p03044 | u665038048 | 2,000 | 1,048,576 | Wrong Answer | 782 | 49,556 | 456 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | from collections import deque
n = int(input())
es = [[] for _ in range(n)]
for _ in range(n-1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
es[u].append((v, w))
es[v].append((u, w))
print(es)
clr = [None]*n
clr[0] = 0
dq = deque()
dq.append(0)
while dq:
v = dq.popleft()
for nv, w in ... | s038879764 | Accepted | 681 | 94,624 | 414 | import sys
sys.setrecursionlimit(10**5)
n = int(input())
t = {i:{} for i in range(n)}
ans = [-1]*n
for _ in range(n-1):
u ,v, w = map(int, input().split())
t[u-1][v-1] = w
t[v-1][u-1] = w
def dfs(x):
for y in t[x]:
del t[y][x]
ans[y] = ans[x] if t[x][y] % 2 == 0 else 1 - ans[x]
... |
s134857948 | p04045 | u686036872 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 244 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | N, K = map(int, input().split())
D = list(map(int, input().split()))
L=[]
for i in range(0, 10):
if i not in D:
L.append("i")
i = N
while True:
if set(list(str((i)))) <= set(L):
print(i)
break
i += 1 | s757687568 | Accepted | 107 | 3,060 | 256 | N, K = map(int, input().split())
D = list(map(int, input().split()))
L=[]
for i in range(0, 10):
if i not in D:
L.append(str(i))
L.sort()
i = N
while True:
if set(list(str((i)))) <= set(L):
print(i)
break
i += 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.