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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s109978428 | p03815 | u113255362 | 2,000 | 262,144 | Wrong Answer | 29 | 9,120 | 181 | 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())
num = N // 11
res = 0
k = 0
k = res * 11
if N % 11 == 0:
res = num * 2
else:
res = num * 2 + 1
k += 5
if k < N:
res = num * 2 + 1
k += 6
print(res) | s455819002 | Accepted | 27 | 9,108 | 150 | N = int(input())
num = N // 11
res = num * 2
k = num * 11
if 0< N % 11 <= 6:
res += 1
elif 7<= N % 11 <= 10:
res += 2
else:
pass
print(res) |
s527378462 | p03139 | u503111914 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 57 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | N,A,B = map(int,input().split())
print(max(A,B),min(A,B)) | s526865611 | Accepted | 17 | 2,940 | 102 | N,A,B = map(int,input().split())
print(min(A,B),0 if min(A,B)-N+max(A,B) < 0 else min(A,B)-N+max(A,B)) |
s578416297 | p03471 | u409757418 | 2,000 | 262,144 | Wrong Answer | 749 | 3,064 | 356 | 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())
d = y - 1000*n
a = d // 9000
ab = []
for i in range(a+1):
d2 = d - 9000*i
b = d2 // 4000
for j in range(b+1):
d3 = d2 - 4000*j
if d3 == 0:
ab.append(i)
ab.append(j)
if len(ab) == 0:
print(-1,-1,-1)
else:
c = n - ab[0] - ab[1]
if c >= 0:
print(ab[0], a... | s484184871 | Accepted | 1,007 | 3,064 | 183 | n, y = map(int, input().split())
for i in range(n+1):
for j in range(n+1):
if 10000*n - 5000*i - 9000*j == y and n-i-j>=0:
print(n-i-j, i, j)
quit()
print(-1,-1,-1)
|
s436085792 | p03567 | u543954314 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 330 | Snuke built an online judge to hold a programming contest. When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.) Determine whether the judge can return the ... | from collections import deque
s = deque(input())
print(s)
le = len(s)
cnt = 0
while le>1:
if s[0] == s[-1]:
s.pop()
s.popleft()
le -= 2
elif s[0] == "x":
s.popleft()
cnt += 1
le -= 1
elif s[-1] == "x":
s.pop()
cnt += 1
le -= 1
else:
print(-1)
break
print(s)
else:
... | s109679879 | Accepted | 18 | 2,940 | 100 | s = input()
for i in range(len(s)-1):
if s[i:i+2] == "AC":
print("Yes")
exit()
print("No") |
s721517533 | p00186 | u957021183 | 1,000 | 131,072 | Wrong Answer | 470 | 7,792 | 615 | 2008 年 4 月に、会津若松市は長さ20 m 85 cm のやきとり作りに挑戦して成功しました。このとき使われた鶏肉が、会津特産の会津地鶏です。会津地鶏はとてもおいしいのですが、飼育がむずかしいので生産量が少なく、値段が高いのが難点です。 今日は一郎君の家に、遠くから親戚が遊びに来ます。お母さんは鶏肉の水炊きを作って親戚をもてなすことにしました。近くのお肉屋さんでは会津地鶏とふつうの鶏肉の 2 種類の鶏肉を売っています。お母さんは、以下のような指示を一郎君に与えて、お肉屋さんに行って鶏肉を買ってくるように 頼みました。 * 鶏肉が足りなくなると困るので、決められた量以上の鶏肉を買う。 * 予算の許す範囲... |
#
import sys, math, os, bisect
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
def aizu_chicken(q1, b, c1, c2, q2):
for i in range(q2, 0, -1):
cj = i * c1
normal = int((b - cj) / c2)
if i + normal < q1:
continue
... | s124438956 | Accepted | 510 | 7,700 | 616 |
#
import sys, math, os, bisect
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
def aizu_chicken(q1, b, c1, c2, q2):
for i in range(q2, 0, -1):
cj = i * c1
normal = int((b - cj) // c2)
if i + normal < q1:
continue
... |
s062861064 | p03044 | u896451538 | 2,000 | 1,048,576 | Wrong Answer | 932 | 51,476 | 712 | 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... | import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7
N = INT()
G = [dict() for _ in range(N)]
for... | s714727331 | Accepted | 675 | 50,156 | 695 | import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7
N = INT()
G = [dict() for _ in range(N)]
for... |
s475404853 | p02401 | u776758454 | 1,000 | 131,072 | Wrong Answer | 20 | 7,688 | 350 | 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. | def main():
a, op, b = input().split()
a,b = int(a), int(b)
op_dict = {'+': (lambda x,y: x + y),
'-': (lambda x,y: x - y),
'*': (lambda x,y: x * y),
'/': (lambda x,y: x / y),
'?': '?'}
func = op_dict[op]
if func == '?': return 0
print('... | s978558926 | Accepted | 20 | 7,728 | 341 | while True:
a, op, b = input().split()
a,b = int(a), int(b)
op_dict = {'+': (lambda x,y: x + y),
'-': (lambda x,y: x - y),
'*': (lambda x,y: x * y),
'/': (lambda x,y: x // y),
'?': '?'}
func = op_dict[op]
if func == '?': break
print('%... |
s234677541 | p02613 | u132052531 | 2,000 | 1,048,576 | Wrong Answer | 159 | 16,332 | 434 | 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 = []
count_AC = 0
count_WA = 0
count_TLE = 0
count_RE = 0
for _ in range(N):
S.append(input())
for i in S:
if i == "AC":
count_AC += 1
elif i == "WA":
count_WA += 1
elif i == "TLE":
count_TLE += 1
elif i == "RE":
count_RE += 1
else:
pass
print("AC" + "x" + str(count_AC... | s491362096 | Accepted | 151 | 16,140 | 497 | N = int(input())
S = []
count_AC = 0
count_WA = 0
count_TLE = 0
count_RE = 0
for _ in range(N):
S.append(input())
for i in S:
if i == "AC":
count_AC += 1
elif i == "WA":
count_WA += 1
elif i == "TLE":
count_TLE += 1
elif i == "RE":
count_RE += 1
else:
pass
a = "AC" + " " + "x" + " ... |
s702093380 | p03448 | u268279636 | 2,000 | 262,144 | Wrong Answer | 64 | 2,940 | 203 | 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())
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):
sum = 500*i+100*j+50*k
if(x%50==0 and sum == x):
count+=1
| s408356117 | Accepted | 63 | 3,060 | 217 | 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):
sum = 500*i+100*j+50*k
if(x%50==0 and sum == x):
count+=1
print(count)
|
s638333077 | p03544 | u396890425 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | 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) | l0,l1=2,1
for i in range(int(input())-1):
l0,l1=l1,l0+l1
print(l0) | s263465388 | Accepted | 18 | 3,064 | 70 | l0,l1=2,1
for i in range(int(input())):
l0,l1=l1,l0+l1
print(l0) |
s287258594 | p02742 | u499423960 | 2,000 | 1,048,576 | Wrong Answer | 19 | 2,940 | 47 | 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())
print((h * w)/2) | s277280072 | Accepted | 17 | 2,940 | 236 | H,W = map(int, input().split())
def is_odd(num):
return num % 2 ==1
if H == 1 or W == 1:
ans = 1
elif is_odd(H) and is_odd(W):
ans = ((H * W) + 1)/2
else:
ans = (H*W) / 2
print(int(ans))
|
s070493534 | p02854 | u085717502 | 2,000 | 1,048,576 | Wrong Answer | 578 | 26,220 | 297 | Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters. Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be po... | #!/usr/bin/env python
# coding: utf-8
# In[15]:
N = int(input())
A = list(map(int, input().split()))
# In[16]:
total = sum(A)
ans = total
left = 0
for i in A:
left += i
right = total - left
ans = min(ans, abs(left - right))
print(left, right, ans)
print(ans)
# In[ ]:
| s310948592 | Accepted | 176 | 26,060 | 299 | #!/usr/bin/env python
# coding: utf-8
# In[15]:
N = int(input())
A = list(map(int, input().split()))
# In[17]:
total = sum(A)
ans = total
left = 0
for i in A:
left += i
right = total - left
ans = min(ans, abs(left - right))
# print(left, right, ans)
print(ans)
# In[ ]:
|
s497291515 | p03729 | u865413330 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 92 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a, b, c = input().split()
print("YES") if (a[-1] == b[0]) & (b[-1] == a[0]) else print("NO") | s799039519 | Accepted | 18 | 2,940 | 92 | a, b, c = input().split()
print("YES") if (a[-1] == b[0]) & (b[-1] == c[0]) else print("NO") |
s178816792 | p00005 | u584777171 | 1,000 | 131,072 | Wrong Answer | 20 | 7,572 | 189 | Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. | a, b = map(int, input().split())
d = a * b
if a < b:
tmp = a
a = b
b = tmp
c = a % b
while(c != 0):
a = b
b = c
c = a % b
g = b
l = d / g
print(str(g)+" "+str(l)) | s727558420 | Accepted | 20 | 7,644 | 344 | import fileinput
for line in fileinput.input():
tokens = list(map(int, line.strip().split()))
a, b = tokens[0], tokens[1]
d = a * b
if a < b:
tmp = a
a = b
b = tmp
c = a % b
while(c != 0):
a = b
b = c
c = a % b
g = b
l = d / g
print... |
s255427211 | p03626 | u064408584 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 346 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors... | n=int(input())
a=input()
b=input()
c=[]
i=0
while i<n:
if i==n-1:
c.append(1)
i+=1
elif a[i]==a[i+1]:
c.append(0)
i+=2
else:
c.append(1)
i+=1
print(c)
if c[0]==0: count=6
else: count=3
for i in range(len(c)-1):
if c[i]==0 and c[i+1]==1: continue
e... | s552660779 | Accepted | 17 | 3,064 | 356 | n=int(input())
a=input()
b=input()
c=[]
i=0
while i<n:
if i==n-1:
c.append(1)
i+=1
elif a[i]==a[i+1]:
c.append(0)
i+=2
else:
c.append(1)
i+=1
if c[0]==0: count=6
else: count=3
for i in range(len(c)-1):
if c[i]==1: count*=2
elif c[i]==0 and c[i+1]=... |
s242515361 | p03759 | u852790844 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a, b, c = map(int, input().split())
ans = 'Yes' if b-a == c-a else 'No'
print(ans) | s653323578 | Accepted | 17 | 2,940 | 82 | a, b, c = map(int, input().split())
ans = 'YES' if b-a == c-b else 'NO'
print(ans) |
s645605873 | p03478 | u252964975 | 2,000 | 262,144 | Wrong Answer | 45 | 3,060 | 200 | 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())
count = 0
for i in range(N):
sum_ = 0
for k in range(len(str(i))):
sum_ = sum_ + int(str(i)[k])
if sum_ >= A and sum_ <= B:
count = count + 1
print(count) | s273414394 | Accepted | 45 | 2,940 | 205 | N,A,B=map(int, input().split())
count = 0
for i in range(1,N+1):
sum_ = 0
for k in range(len(str(i))):
sum_ = sum_ + int(str(i)[k])
if sum_ >= A and sum_ <= B:
count = count + i
print(count)
|
s140829793 | p03860 | u411255472 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 28 | 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 = ("A"+input()[8]+"C") | s630381076 | Accepted | 17 | 2,940 | 25 | print("A"+input()[8]+"C") |
s012509138 | p02397 | u482227082 | 1,000 | 131,072 | Wrong Answer | 50 | 5,608 | 225 | Write a program which reads two integers x and y, and prints them in ascending order. | for i in range(10000):
a, b = map(int, input().split())
if a == 0 and b == 0:
break
else:
if a > b:
print(a, b)
else:
print(b, a)
#print(min(a,b), max(a,b))
| s030539654 | Accepted | 50 | 5,624 | 255 | #
# 3c
#
def main():
while True:
x, y = map(int, input().split())
if x == y == 0:
break
elif x > y:
print(f"{y} {x}")
else:
print(f"{x} {y}")
if __name__ == '__main__':
main()
|
s233604181 | p03575 | u347640436 | 2,000 | 262,144 | Wrong Answer | 20 | 3,064 | 630 | 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 ... |
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += parent[i]
parent[i] = j
N, M = map(int, input().split())
ab = [[in... | s054215987 | Accepted | 20 | 3,064 | 628 |
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += parent[i]
parent[i] = j
N, M = map(int, input().split())
ab = [[in... |
s188095190 | p03434 | u589432040 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 150 | 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())
L = list(map(int, input().split()))
L.sort()
A = 0
B = 0
for i in range(N):
if i % 2 == 0:
A += i
else:
B += i
print(A-B) | s980659051 | Accepted | 17 | 2,940 | 169 | N = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)
ans = 0
for i in range(N):
if i % 2 == 0:
ans += L[i]
else:
ans -= L[i]
print(ans)
|
s518065159 | p03555 | u030090262 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 80 | 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()
if A == B[::-1]:
print("Yes")
else:
print("No")
| s297696935 | Accepted | 17 | 2,940 | 80 | A = input()
B = input()
if A == B[::-1]:
print("YES")
else:
print("NO")
|
s735983198 | p02619 | u585963734 | 2,000 | 1,048,576 | Wrong Answer | 37 | 9,524 | 413 | Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to che... | D=int(input())
c=list(map(int, input().split()))
s=[list(map(int, input().split())) for i in range(D)]
t=[int(input()) for i in range(D)]
d=[-1]*(26)
v=[0]*(D+1)
for i in range(D):
v[i]=s[i][t[i]-1]
d[t[i]-1]=0
if i>0:
sb=0
for j in range(26):
if d[j]!=-1:
... | s828137412 | Accepted | 35 | 9,400 | 356 | D=int(input())
c=list(map(int, input().split()))
s=[list(map(int, input().split())) for i in range(D)]
t=[int(input()) for i in range(D)]
d=[0]*(26)
v=[0]*(D+1)
for i in range(D):
v[i]=s[i][t[i]-1]
d[t[i]-1]=-1
sb=0
for j in range(26):
d[j]+=1
sb+=d[j]*c[j]
... |
s811299221 | p03657 | u536177854 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | 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())
print('possible' if a%3==0 or b%3==0 or (a+b)%3==0 else 'Impossible') | s300231384 | Accepted | 17 | 2,940 | 98 | a,b=map(int,input().split())
print('Possible' if a%3==0 or b%3==0 or (a+b)%3==0 else 'Impossible') |
s705836535 | p02613 | u903629757 | 2,000 | 1,048,576 | Wrong Answer | 175 | 9,068 | 271 | 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 i in range(N):
S = input().split()
a = list(S)
a.append(S)
i += 1
print("AC" + " x " + str(a.count("AC")))
print("WA"+ " x "+ str(a.count("WA")))
print("TLE" + " x " + str(a.count("TLE")))
print("RE" + " x " + str(a.count("RE")))
| s066704656 | Accepted | 136 | 16,268 | 218 | N = int(input())
list = [input() for i in range(N)]
print("AC x " + str(list.count("AC")))
print("WA x " + str(list.count("WA")))
print("TLE x " + str(list.count("TLE")))
print("RE x " + str(list.count("RE"))) |
s059006718 | p03377 | u886790158 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 172 | 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())
if a == x:
print('Yes')
elif a > x:
print('No')
else:
if a + b >= x:
print('Yes')
else:
print('No')
| s900965386 | Accepted | 17 | 2,940 | 172 |
a, b, x = map(int, input().split())
if a == x:
print('YES')
elif a > x:
print('NO')
else:
if a + b >= x:
print('YES')
else:
print('NO')
|
s812845605 | p00003 | u930302179 | 1,000 | 131,072 | Wrong Answer | 40 | 5,596 | 150 | 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. | d=input()
for a in range(int(d)):
a,b,c=map(int,input().split())
if(max(a,b,c)*2>=a+b+c):
print(False)
else:
print(True)
| s459304892 | Accepted | 40 | 5,596 | 149 | for i in range(int(input())):
a,b,c=sorted(map(int, input().split()))
if a**2+b**2==c**2:
print('YES')
else:
print('NO')
|
s516693677 | p03433 | u216631280 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | 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())
print('YES' if n % 500 - a <= 0 else 'No') | s450358547 | Accepted | 17 | 2,940 | 77 | n = int(input())
a = int(input())
print('Yes' if n % 500 - a <= 0 else 'No') |
s304708983 | p03080 | u219610930 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 250 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | import sys
input = sys.stdin.readlines()
n = int(input[0])
print(input[1])
hatList = list(input[1])
counter = 0
for i in range (n):
if(hatList[i] == "R"):
counter += 1
if counter >= (n/2 + 1):
print("Yes")
exit()
print("No") | s266919810 | Accepted | 17 | 3,060 | 223 | import sys
input = sys.stdin.readlines()
n = int(input[0])
hatList = list(input[1])
counter = 0
for i in range (n):
if(hatList[i] == "R"):
counter += 1
if counter > (n/2):
print("Yes")
else:
print("No") |
s437252827 | p02916 | u881141729 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 425 | Takahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \ldots, Dish N) once. The i-th dish (1 \leq i \leq N) he ate was Dish A_i. When he eats Dish i (1 \leq i \leq N), he gains B_i satisfaction points. Additionally, when he eats Dish i+1 just after eating Dish i (1 \... | while True:
try:
n = int(input())
ans = 0
last = lsta[0]
lsta = list(map(int, input().split()))
lstb = list(map(int, input().split()))
lstc = list(map(int, input().split()))
for i in range(n):
ans += lstb[lsta[i]-1]
if last + 1 == i:
... | s148184958 | Accepted | 17 | 3,064 | 431 | while True:
try:
n = int(input())
ans = 0
lsta = list(map(int, input().split()))
lstb = list(map(int, input().split()))
lstc = list(map(int, input().split()))
last = lsta[0]
for i in range(n):
ans += lstb[lsta[i]-1]
if last + 1 == lsta[... |
s108089505 | p00003 | u355726239 | 1,000 | 131,072 | Wrong Answer | 40 | 6,724 | 224 | 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. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
n = int(input())
for i in range(n):
x = list(map(int, input().split()))
x.sort()
if x[0]**2 + x[1]**2 == x[2]**2:
print('Yes')
else:
print('No') | s928280286 | Accepted | 40 | 6,724 | 224 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
n = int(input())
for i in range(n):
x = list(map(int, input().split()))
x.sort()
if x[0]**2 + x[1]**2 == x[2]**2:
print('YES')
else:
print('NO') |
s811853074 | p03578 | u453642820 | 2,000 | 262,144 | Wrong Answer | 256 | 55,256 | 260 | Rng is preparing a problem set for a qualification round of CODEFESTIVAL. He has N candidates of problems. The difficulty of the i-th candidate is D_i. There must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.... | from collections import Counter
N=int(input())
D=list(map(int,input().split()))
D=Counter(D)
M=int(input())
T=list(map(int,input().split()))
T=Counter(T)
for key,value in T.items():
if D[key]<value:
print("No")
break
else:
print("Yes")
| s633186165 | Accepted | 277 | 57,056 | 282 | import collections
n = int(input())
ln = list(map(int, input().split()))
m = int(input())
lm = list(map(int, input().split()))
c1 = collections.Counter(lm)
c2 = collections.Counter(ln)
for i in c1.keys():
if c2[i] < c1[i]:
print("NO")
exit()
print("YES") |
s931725928 | p03399 | u891217808 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | a = int(input())
b = int(input())
print(min(a, b))
c = int(input())
d = int(input())
print(min(c,d)) | s170248040 | Accepted | 17 | 2,940 | 95 | a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a, b)+min(c, d))
|
s384002994 | p03696 | u373047809 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | input()
t=s=input()
p,q="()"
while"()"in s:s=s.replace(p+q,"")
print(p*s.count(q)+t+q*s.count(q)) | s859178108 | Accepted | 18 | 3,188 | 93 | input()
s=t=input()
p,q=o="()"
exec('s=s.replace(o,"");'*50)
f=s.count
print(p*f(q)+t+q*f(p)) |
s507221356 | p03493 | u321071346 | 2,000 | 262,144 | Wrong Answer | 30 | 9,084 | 116 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | s = list(map(str, input().split()))
counter = 0
for si in s:
if si == '1':
counter += 1
print(counter)
| s799317200 | Accepted | 27 | 8,856 | 105 | s = input()
counter = 0
for i in range(len(s)):
if s[i] == '1':
counter += 1
print(counter)
|
s943782850 | p04029 | u815444398 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | n = int(input())
print((n+1)*n/2)
| s615551223 | Accepted | 17 | 2,940 | 39 | n = int(input())
print(int((n+1)*n/2))
|
s647744799 | p02612 | u951502681 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,148 | 89 | 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('N='))
if N%1000==0:
Q=N//1000
else:
Q=N//1000+1
W=Q*1000-N
print(W)
| s223022471 | Accepted | 27 | 9,064 | 85 | N=int(input())
if N%1000==0:
Q=N//1000
else:
Q=N//1000+1
W=Q*1000-N
print(W)
|
s664314611 | p03354 | u743281086 | 2,000 | 1,048,576 | Wrong Answer | 565 | 19,280 | 639 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | class UnionFindSet:
def __init__(self):
self.dic = dict()
def find(self, x):
if x not in self.dic:
return x
else:
self.dic[x] = self.find(self.dic[x])
return self.dic[x]
def union(self, x, y):
fx = self.find(x)
fy = self.find(y)
... | s466770511 | Accepted | 739 | 19,408 | 642 | class UnionFindSet:
def __init__(self):
self.dic = dict()
def find(self, x):
if x not in self.dic:
return x
else:
self.dic[x] = self.find(self.dic[x])
return self.dic[x]
def union(self, x, y):
fx = self.find(x)
fy = self.find(y)
... |
s109529351 | p02612 | u245120181 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,148 | 53 | 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())
while N > 999:
N -= 1000
print(N) | s546109572 | Accepted | 26 | 9,096 | 122 | import math
N = int(input())
for i in range(math.floor(N/1000)):
N -= 1000
if N != 0:
print(1000 - N)
else:
print(0) |
s096576086 | p02612 | u706330549 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,144 | 59 | 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())
while n >= 1000:
n -= 1000
print(n)
| s580477671 | Accepted | 32 | 9,168 | 88 | n = int(input())
i = 0
a = n
while a > 0:
a -= 1000
i += 1
print(i*1000 - n)
|
s134463623 | p00424 | u567380442 | 1,000 | 131,072 | Wrong Answer | 40 | 6,720 | 292 | 与えられた変換表にもとづき,データを変換するプログラムを作成しなさい. データに使われている文字は英字か数字で,英字は大文字と小文字を区別する.変換表に現れる文字の順序に規則性はない. 変換表は空白をはさんで前と後ろの 2 つの文字がある(文字列ではない).変換方法は,変換表のある行の前の文字がデータに現れたら,そのたびにその文字を後ろの文字に変換し出力する.変換は 1 度だけで,変換した文字がまた変換対象の文字になっても変換しない.変換表に現れない文字は変換せず,そのまま出力する. 入力ファイルには,変換表(最初の n + 1 行)に続き変換するデータ(n + 2 行目以降)が書いてある. 1 行目に変換表の行数 n,続く ... | import sys
f = sys.stdin
n = int(f.readline())
converter = {}
for _ in range(n):
pre, post = f.readline().strip().split()
converter[pre] = post
m = int(f.readline())
for _ in range(m):
c = f.readline().strip()
print(converter[c] if c in converter else c, end='')
print()
| s874394103 | Accepted | 220 | 6,808 | 368 | import sys
f = sys.stdin
while True:
n = int(f.readline())
if n == 0:
break
converter = {}
for _ in range(n):
pre, post = f.readline().strip().split()
converter[pre] = post
m = int(f.readline())
for _ in range(m):
c = f.readline().strip()
print(converter[... |
s178052853 | p03643 | u653807637 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 576 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | # encoding:utf-8
def main():
k = int(input())
k = 0
n = 50
div = k // n
res = k % n
temp = [i for i in range(n)]
temp = [temp[i] + (i >= (50 - res)) + div for i in range(n)]
out = [str(x) for x in temp]
print(n)
print(" ".join(out))
#print(calc(temp))
def calc(temp):
i = 0
while len([x for x in temp i... | s167403270 | Accepted | 17 | 2,940 | 79 | def main():
n = input()
print("ABC" + n)
if __name__ == '__main__':
main() |
s872881274 | p03854 | u290211456 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 150 | 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_list = ["eraser","erase","dreamer","dream"]
for i in range(4):
s.replace(s_list[i],'')
if len(s) == 0:
print("YES")
else:
print("NO") | s375065095 | Accepted | 20 | 3,188 | 149 | s = input()
s_list = ["eraser","erase","dreamer","dream"]
for i in range(4):
s = s.replace(s_list[i],"")
if len(s):
print("NO")
else:
print("YES") |
s373028716 | p03845 | u854685063 | 2,000 | 262,144 | Wrong Answer | 29 | 9,196 | 750 | Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d... | 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... | s692183769 | Accepted | 29 | 9,156 | 737 | 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... |
s726340560 | p03455 | u544165032 | 2,000 | 262,144 | Wrong Answer | 23 | 8,832 | 103 | 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())
c = a * b
d = c//2
if d == 0:
print("Even")
else:
print("Odd") | s010106496 | Accepted | 25 | 9,076 | 104 | a, b = map(int, input().split())
c = a * b
d = c % 2
if d == 0:
print("Even")
else:
print("Odd") |
s481977156 | p02393 | u427219397 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 116 | Write a program which reads three integers, and prints them in ascending order. | a,b,c = map(int, input().split())
if a > b :
a,b = b,a
if b > c :
b,c = c,b
if a > c :
a,c =c,a
print(a,b,c)
| s314753791 | Accepted | 20 | 5,600 | 137 | a, b, c = map(int, input().split())
if a > b:
a, b = b, a
if b > c:
b, c = c, b
if a > b:
a, b = b, a
print(a, b, c)
|
s276767255 | p03139 | u967835038 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 148 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | n,a,b=map(int,input().split())
maximam=0
minimam=0
if a+b-n>=0:
minimam=a+b-n
else:
minimam=0
s=[a,b]
maximam=max(s)
print(maximam,minimam)
| s804610233 | Accepted | 17 | 2,940 | 148 | n,a,b=map(int,input().split())
maximam=0
minimam=0
if a+b-n>=0:
minimam=a+b-n
else:
minimam=0
s=[a,b]
maximam=min(s)
print(maximam,minimam)
|
s352721832 | p03494 | u302789073 | 2,000 | 262,144 | Wrong Answer | 29 | 9,172 | 305 | 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. | n=int(input())
a_list=[int(i) for i in input().split()]
count_list=[]
for i in range(n):
num=a_list[i]
count=0
while True:
if num%2==0:
num//=2
count+=1
else:
break
count_list.append(count)
print(count_list)
print(min(count_list))
| s951367904 | Accepted | 26 | 9,180 | 323 | # Your code here!
n=int(input())
a_list=[int(i) for i in input().split()]
count_list=[]
for i in range(n):
num=a_list[i]
count=0
while True:
if num%2==0:
num//=2
count+=1
else:
break
count_list.append(count)
#print(count_list)
print(min(count_lis... |
s771215659 | p03386 | u482157295 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 258 | 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())
ans_list = []
for i in range(a,a+k):
ans_list.append(i)
if ans_list[-1] == b:
print(ans_list)
exit()
for i in range(b-k+1,b+1):
if ans_list.count(i) == 0:
ans_list.append(i)
print(ans_list) | s619287556 | Accepted | 17 | 3,060 | 284 | a,b,k = map(int,input().split())
ans_list = []
for i in range(a,a+k):
ans_list.append(i)
if ans_list[-1] == b:
[print(i) for i in ans_list]
exit()
for i in range(b-k+1,b+1):
if ans_list.count(i) == 0:
ans_list.append(i)
[print(i) for i in ans_list] |
s799755678 | p03609 | u563588763 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 28 | 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? | s = input()
print(s[::2])
| s571071811 | Accepted | 17 | 2,940 | 81 | X,t = map(int,input().split())
if X - t > 0:
print(X - t)
else:
print(0)
|
s937064948 | p02390 | u962909487 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 80 | 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. | number = int(input())
print(number//3600, (number%3600)//60, (number%3600)%60)
| s128113515 | Accepted | 20 | 5,580 | 78 | sec = int(input())
print(sec//3600, ':', (sec%3600)//60, ':', sec%60, sep='')
|
s041105022 | p03479 | u819135704 | 2,000 | 262,144 | Wrong Answer | 25 | 9,120 | 104 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl... | X, Y = map(int, input().split())
a = X
count = 1
while a <= Y:
count += 1
a *= 2
print(count)
| s457401366 | Accepted | 28 | 9,140 | 104 | X, Y = map(int, input().split())
a = X
count = 0
while a <= Y:
count += 1
a *= 2
print(count)
|
s869217819 | p03471 | u247680229 | 2,000 | 262,144 | Wrong Answer | 2,107 | 3,060 | 324 | 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... | import sys
N,Y=list(map(int, input().split()))
for i in range(N):
for j in range(N):
for k in range(N):
Total=10**4*i+5000*j+10**3*k
if Total==Y and i+j+k<=N:
print("{} {} {}".format(i,j,k))
sys.exit()
print("-1 -1 ... | s701090573 | Accepted | 1,134 | 3,060 | 297 | import sys
N,Y=list(map(int, input().split()))
for j in range(N+1):
for k in range(N+1):
if N-j-k<0:
continue
Total=10**4*(N-j-k)+5000*j+10**3*k
if Total==Y:
print("{} {} {}".format(N-j-k,j,k))
sys.exit()
print("-1 -1 -1") |
s134487816 | p02743 | u165368960 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 130 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | import math
a, b, c = map(int, input().split())
if math.sqrt(a) + math.sqrt(b) < math.sqrt(c):
print("Yes")
else:
print("NO") | s830717946 | Accepted | 17 | 2,940 | 135 | import math
a, b, c = map(int, input().split())
if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0:
print("Yes")
else:
print("No") |
s559958400 | p03698 | u757030836 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 149 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
l=[]
for i in range(len(s)):
l.append(s[i])
x = set(l)
if len(x) == len(s):
print("Yes")
else:
print("No") | s621822966 | Accepted | 19 | 3,060 | 150 | s = input()
l=[]
for i in range(len(s)):
l.append(s[i])
x = set(l)
if len(x) == len(s):
print("yes")
else:
print("no")
|
s164379035 | p03470 | u402063987 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 307 | 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... | import sys
input1 = input().rstrip()
input_list = list()
for i in range(int(input1)):
inputs = input().rstrip()
input_list.append(int(inputs))
input_list.sort()
print(input_list)
count = 1
for i in range(len(input_list)-1):
if (input_list[i] < input_list[i+1]):
count += 1
print(count) | s551825880 | Accepted | 18 | 2,940 | 103 | n = int(input())
inputs_list =[int(input()) for i in range(n)]
sets = set(inputs_list)
print(len(sets)) |
s113865369 | p02615 | u095384238 | 2,000 | 1,048,576 | Wrong Answer | 129 | 31,400 | 85 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | N = int(input())
A = list(map(int, input().split()))
A.sort()
print(sum(A) - max(A)) | s142052192 | Accepted | 137 | 31,672 | 181 | N = int(input())
A = list(map(int, input().split()))
A.sort()
A = A[::-1]
ans = max(A)
M = (N-2)//2
for i in range(M):
ans += 2*A[i+1]
if N%2 != 0:
ans += A[M+1]
print(ans) |
s108154215 | p02413 | u299231628 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 272 | 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 = [int(i) for i in input().split()]
data = [[int(i) for i in input().split()] for j in range(r)]
ans = [data[i] + [sum(data[i])] for i in range(r)]
last_ans = ans + [[sum([ans[i][j] for i in range(r)]) for j in range(c+1)]]
for i in last_ans:
print(*i, sep='\n')
| s948520874 | Accepted | 20 | 6,296 | 262 | r, c = [int(i) for i in input().split()]
data = [[int(i) for i in input().split()] for j in range(r)]
ans = [data[i] + [sum(data[i])] for i in range(r)]
last_ans = ans + [[sum([ans[i][j] for i in range(r)]) for j in range(c+1)]]
for i in last_ans:
print(*i)
|
s677191106 | p03693 | u596536048 | 2,000 | 262,144 | Wrong Answer | 29 | 9,016 | 93 | 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... | r, g, b = map(int, input().split())
print('Yes' if (100 * r + 10 * g + b) % 4 == 0 else 'N0') | s529065144 | Accepted | 27 | 9,100 | 120 | r, g, b = map(int, input().split())
number = 100 * r + 10 * g + b
if number % 4 == 0:
print('YES')
else:
print('NO') |
s852178191 | p03588 | u600261652 | 2,000 | 262,144 | Wrong Answer | 315 | 11,052 | 145 | A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. | N = int(input())
A = []
B = []
for i in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
print(min(A)+B[A.index(min(A))]) | s775045935 | Accepted | 319 | 11,052 | 145 | N = int(input())
A = []
B = []
for i in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
print(max(A)+B[A.index(max(A))]) |
s160836042 | p02618 | u700805562 | 2,000 | 1,048,576 | Wrong Answer | 35 | 9,392 | 587 | AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to sched... | D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
last = [-1]*26
ans = 0
for d in range(D):
stack = []
for i in range(26):
if (d-last[i])*c[i]<0:
stack.append(i)
if stack:
tmp, res = 0, 0
for i in stack:
... | s427354909 | Accepted | 34 | 9,396 | 304 | D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
do_list = [-1]*D
for i in range(D):
tmp, res = s[i][0], 0
for j in range(1,26):
if tmp<s[i][j]:
tmp, res = s[i][j], j
do_list[i] = res
for i in do_list: print(i+1) |
s364577092 | p03449 | u819135704 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 255 | 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())
A = [[int(i) for i in input().split()] for j in range(2)]
count = 0
Max = 0
for i in range(N):
for j in range(i+1):
count += A[0][j]
for j in range(N-i-1):
count += A[1][i+j]
Max = max(Max, count)
print(Max)
| s975806843 | Accepted | 19 | 3,060 | 267 | N = int(input())
A = [[int(i) for i in input().split()] for j in range(2)]
count = 0
Max = 0
for i in range(N):
for j in range(i+1):
count += A[0][j]
for j in range(N-i):
count += A[1][i+j]
Max = max(Max, count)
count = 0
print(Max)
|
s843324244 | p03377 | u229518917 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 80 | 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())
if A+B<X:
print('NO')
else:
print('Yes') | s175205524 | Accepted | 17 | 2,940 | 106 | A,B,X= map(int,input().split())
if A+B<X:
print('NO')
elif A>X:
print('NO')
else:
print('YES') |
s757150152 | p03681 | u050428930 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,480 | 208 | Snuke has N dogs and M monkeys. He wants them to line up in a row. As a Japanese saying goes, these dogs and monkeys are on bad terms. _("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.)_ Snuke is trying to reconsile them, by arranging the animals so that there... | N,M=map(int,input().split())
def f(n):
for i in range(n-1):
n=n*(i+1)
return n
if N==M+1:
s=N*2*f(M)
elif M==N+1:
s=M*2*f(N)
elif N==M:
s=2*f(N)
else:
s=0
print(s%(10**9+7)) | s390277633 | Accepted | 701 | 5,160 | 182 | import math
N,M=map(int,input().split())
def f(n):
n=math.factorial(n)
return n
if abs(N-M)==1:
s=f(N)*f(M)
elif N==M:
s=2*f(N)**2
else:
s=0
print(s%(10**9+7)) |
s498612287 | p02748 | u479638406 | 2,000 | 1,048,576 | Wrong Answer | 2,125 | 358,328 | 440 | You are visiting a large electronics store to buy a refrigerator and a microwave. The store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \le i \le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \le j \le B ) is sold at b_j yen. You have M discount tic... | A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dis = []
for i in range(M):
dis.append(list(map(int, input().split())))
total = []
for i in range(A):
for j in range(B):
plus = a[i] + b[j]
total.append(plus)
for k in range(M):
x = dis[k][0] -... | s967698744 | Accepted | 511 | 42,400 | 379 | A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dis = []
for i in range(M):
dis.append(list(map(int, input().split())))
total = []
total.append(min(a) + min(b))
for k in range(M):
x = dis[k][0] - 1
y = dis[k][1] - 1
c = dis[k][2]
discount = a[x] ... |
s701548727 | p03407 | u870654265 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | 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+B >= C:
print("YES")
else:
print("NO") | s253893312 | Accepted | 17 | 3,064 | 85 | A,B,C = map(int,input().split())
if A+B >= C:
print("Yes")
else:
print("No") |
s356263348 | p02396 | u955389483 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 124 | 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... | number = 0
x = input()
x = int(x)
if 1 <= x and x <= 10000:
number += 1
print("Case" + str(number) + ":" + str(x))
| s589041444 | Accepted | 150 | 5,604 | 209 | number = 0
while True:
x = input()
x = int(x)
if x == 0:
break
else:
if 1 <= x and x <= 10000:
number += 1
print("Case " + str(number) + ": " + str(x))
|
s425161619 | p03214 | u621100542 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,064 | 283 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | P = int(input())
N = list(map(int,input().split()))
N.reverse()
#print(N)
s = sum(N)/P
minfr=9999
ans = 0
print(s)
for i ,n in enumerate(N):
minfr = min(minfr,abs(n-s))
print(minfr,i,n)
if minfr == abs(n-s):
ans = i
# TODO: write code...
print(abs(ans-(P-1))) | s238930569 | Accepted | 17 | 3,064 | 285 | P = int(input())
N = list(map(int,input().split()))
N.reverse()
#print(N)
s = sum(N)/P
minfr=9999
ans = 0
#print(s)
for i ,n in enumerate(N):
minfr = min(minfr,abs(n-s))
#print(minfr,i,n)
if minfr == abs(n-s):
ans = i
# TODO: write code...
print(abs(ans-(P-1))) |
s394172041 | p03997 | u249987458 | 2,000 | 262,144 | Wrong Answer | 26 | 8,980 | 69 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print(((a+b)*h)/2) | s672390369 | Accepted | 33 | 9,060 | 74 | a = int(input())
b = int(input())
h = int(input())
print(int(((a+b)*h)/2)) |
s155399823 | p03352 | u518064858 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 181 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | x=int(input())
m=0
if x==1:
print(1)
else:
for i in range(2,50):
j=2
while i**j<=x:
j+=1
if m<i**(j-1):
m=i**(j-1)
print(m) | s134436377 | Accepted | 23 | 2,940 | 187 | x=int(input())
m=0
if x==1:
print(1)
else:
for i in range(2,50):
j=2
while i**j<=x:
if m<i**j:
m=i**j
j+=1
print(m)
|
s331349729 | p03557 | u766407523 | 2,000 | 262,144 | Wrong Answer | 357 | 24,528 | 262 | The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ... | import bisect
def inpl(): return list(map(int, input().split()))
N = int(input())
a, b, c = sorted(inpl()), sorted(inpl()), sorted(inpl())
print(a)
print(b)
print(c)
ans = 0
for j in b:
ans += bisect.bisect_left(a, j)*(N-bisect.bisect_right(c, j))
print(ans) | s534071680 | Accepted | 328 | 22,720 | 237 | import bisect
def inpl(): return list(map(int, input().split()))
N = int(input())
a, b, c = sorted(inpl()), sorted(inpl()), sorted(inpl())
ans = 0
for j in b:
ans += bisect.bisect_left(a, j)*(N-bisect.bisect_right(c, j))
print(ans)
|
s173443861 | p00004 | u078042885 | 1,000 | 131,072 | Wrong Answer | 20 | 7,536 | 129 | 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. | while 1:
try:a,b,c,d,e,f=map(int,input().split())
except:break
x=(c*d-a*f)/(b*d-a*e)
print("%f %f"%((c-b*x)/a,x)) | s714721028 | Accepted | 30 | 7,656 | 133 | while 1:
try:a,b,c,d,e,f=map(int,input().split())
except:break
x=(c*d-a*f)/(b*d-a*e)
print("%.3f %.3f"%((c-b*x)/a,x)) |
s363277630 | p03129 | u903596281 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 73 | 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*K:
print("YES")
else:
print("NO") | s848186344 | Accepted | 17 | 2,940 | 75 | N,K=map(int,input().split())
if N>2*K-2:
print("YES")
else:
print("NO") |
s222557733 | p00045 | u498511622 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 7,552 | 154 | 販売単価と販売数量を読み込んで、販売金額の総合計と販売数量の平均を出力するプログラムを作成してください。 | total=0
s=0
i=0
while True:
try:
a,b = map(int,input().split(','))
total += a*b
s+=b
i+=1
except:
result=s/i
print(total)
print(result) | s776560096 | Accepted | 30 | 7,492 | 151 | try:
total=s=i=0
while True:
a,b = map(int,input().split(','))
total += a*b
s += b
i += 1
except:
print(total)
print(round(s/i+0.5)) |
s640940817 | p03854 | u343150957 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 143 | 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().replace("eraser", "").replace("erace", "").replace("dreamer", "").replace("dream", "")
if s:
print("NO")
else:
print("YES") | s304984679 | Accepted | 19 | 3,188 | 153 | s = input().replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")
if len(s) > 0:
print("NO")
else:
print("YES")
|
s123134584 | p03971 | u560708725 | 2,000 | 262,144 | Wrong Answer | 73 | 9,972 | 497 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | n, a, b = map(int, input().split())
s = list(input())
line = a + b
rank = 0
bnum = 0
for student in s:
if student == "a" or student== "b":
if rank <= line:
rank += 1
if student == "a":
print("Yes")
else:
bnum += 1
if bnum <=... | s480766474 | Accepted | 75 | 9,696 | 532 | n, a, b = map(int, input().split())
s = list(input())
line = a + b
rank = 1
bnum = 0
for student in s:
if student == "a" or student== "b":
if rank <= line:
if student == "a":
print("Yes")
rank += 1
else:
bnum += 1
if bn... |
s086914974 | p03477 | u085186789 | 2,000 | 262,144 | Wrong Answer | 24 | 9,072 | 135 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | A, B, C, D = map(int,input().split())
if A + B < C + D:
print("Left")
elif A + B == C + D:
print("Balanced")
else:
print("Right") | s311275184 | Accepted | 29 | 9,112 | 136 | A, B, C, D = map(int,input().split())
if A + B < C + D:
print("Right")
elif A + B == C + D:
print("Balanced")
else:
print("Left")
|
s591521918 | p04043 | u201234972 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 342 | 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 ... | #import sys
#input = sys.stdin.readline
def main():
A = list(input().split())
five = 0
seven = 0
for a in A:
if len(a) == 5:
five += 1
elif len(a) == 7:
seven += 1
if five == 2 and seven == 1:
print("YES")
else:
print("NO")
if __name__ == ... | s046462709 | Accepted | 18 | 2,940 | 263 | #import sys
#input = sys.stdin.readline
def main():
A = list( map( int, input().split()))
C = [0]*11
for a in A:
C[a] += 1
if C[5] == 2 and C[7] == 1:
print("YES")
else:
print("NO")
if __name__ == '__main__':
main() |
s355366946 | p03711 | u089032001 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 209 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | x, y = map(int, input().split())
setA = []
setA.append({1, 3, 5, 7, 8, 10, 12})
setA.append({4, 6, 9, 11})
setA.append({2})
for s in setA:
if x in setA and y in setA:
print("Yes")
exit()
print("No") | s091053182 | Accepted | 17 | 3,060 | 204 | x, y = map(int, input().split())
setA = []
setA.append({1, 3, 5, 7, 8, 10, 12})
setA.append({4, 6, 9, 11})
setA.append({2})
for s in setA:
if x in s and y in s:
print("Yes")
exit()
print("No") |
s472900860 | p03672 | u047535298 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 218 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | s = input()
for i in range(1, len(s)):
if((len(s)-i) % 2 == 0):
ans = len(s) - i
print(s[0:ans//2], s[ans//2:ans])
if(s[0:ans//2] == s[ans//2:ans]):
print(ans)
break
| s759061294 | Accepted | 17 | 2,940 | 176 | s = input()
for i in range(1, len(s)):
if((len(s)-i) % 2 == 0):
ans = len(s) - i
if(s[0:ans//2] == s[ans//2:ans]):
print(ans)
break
|
s246063903 | p02399 | u651428295 | 1,000 | 131,072 | Wrong Answer | 20 | 7,708 | 137 | 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) | i = list(map(int, input().split()))
a = i[0]
b = i[1]
float_a = float(a)
float_b = float(b)
print(int(a / b), int(a % b), float(a / b)) | s457111793 | Accepted | 30 | 7,684 | 116 | i = list(map(int, input().split()))
a = i[0]
b = i[1]
print('{0} {1} {2:.5f}'.format(a // b, a % b, float(a / b))) |
s059611119 | p03469 | u582817680 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | 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... | day = input()
if day[3]=='7':
day = day.replace(day[3], '8')
print(day) | s824685657 | Accepted | 17 | 2,940 | 107 | tmp_date = list(input())
if tmp_date[3] == '7':
tmp_date[3] = '8'
date = ''.join(tmp_date)
print(date) |
s266595660 | p02663 | u564589929 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,368 | 970 | In this problem, we use the 24-hour clock. Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is the length of the period in which he can start studying? | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().... | s361597847 | Accepted | 24 | 9,492 | 918 | import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().... |
s726817128 | p03167 | u884077550 | 2,000 | 1,048,576 | Wrong Answer | 1,216 | 57,696 | 848 | There is a grid 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. For each i and j (1 \leq i \leq H, 1 \leq j \leq W), Square (i, j) is described by a character a_{i, j}. If a_{i, j} is `.`, Square (i, j) is an empty square; if a... | h,w = map(int, input().split())
bignum = pow(10,9) + 7
mee = [[0 for i in range(w+1)] for j in range(h)]
#starting should all be 1
#walled = -1
for j in range(h):
mee[j][0] = 0
for i in range(h):
temp = input()
for j in range(w):
if temp[j] == "#":
mee[i][j+1] = -1
for i in range(w... | s744213723 | Accepted | 1,012 | 43,492 | 777 | h,w = map(int, input().split())
bignum = pow(10,9) + 7
mee = [[0 for i in range(w+1)] for j in range(h)]
#starting should all be 1
#walled = -1
for j in range(h):
mee[j][0] = 0
for i in range(h):
temp = input()
for j in range(w):
if temp[j] == "#":
mee[i][j+1] = -1
for i in range(w... |
s759863213 | p03433 | u045707160 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 185 | 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())
b = n // 500
if n - (500 * b) - a == 0:
print('Yes')
else:
print('No') | s553369850 | Accepted | 19 | 3,064 | 91 | n = int(input())
a = int(input())
if n % 500 <= a:
print('Yes')
else:
print('No') |
s039062994 | p02742 | u537550206 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 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... | import math
h, w = map(int, input().split())
if h == 1 or w == 1:
print(1)
else:
print(math.ceil((h + w )/2)) | s953720948 | Accepted | 18 | 2,940 | 117 | import math
h, w = map(int, input().split())
if h == 1 or w == 1:
print(1)
else:
print(math.ceil((h * w )/2)) |
s562006355 | p03659 | u249447366 | 2,000 | 262,144 | Wrong Answer | 219 | 30,912 | 201 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | N = int(input())
A = list(map(int, input().split()))
print(A)
X = sum(A)
tmps = []
x = 0
for i in range(N-1):
x += A[i]
tmps.append(X - 2 * x)
print(tmps)
print(min(tmps,key=lambda x:abs(x)))
| s573644566 | Accepted | 150 | 24,824 | 204 | N = int(input())
A = list(map(int, input().split()))
tmp = 0
ans = 10 ** 10
Asum = sum(A)
for i in range(N - 1):
tmp += A[i]
a = abs((Asum - tmp) - tmp)
if ans > a:
ans = a
print(ans)
|
s911136161 | p03957 | u391589398 | 1,000 | 262,144 | Wrong Answer | 27 | 8,900 | 139 | This contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters. Mr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way. You are given a string s consisting of uppercase English letters. Determine whether the string `CF` can be obtai... | S = input()
alp = "ABDEGHIJKLMNOPQRSTUVWXYZ"
for a in alp:
S = S.replace(a, '')
if 'CF' in S:
print('YES')
else:
print('NO')
| s141392008 | Accepted | 34 | 9,936 | 78 | import re
S = input()
print('No' if re.search(r'C.*F', S) is None else 'Yes')
|
s393149705 | p03478 | u408791346 | 2,000 | 262,144 | Wrong Answer | 34 | 2,940 | 165 | 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(n):
if a <= sum(map(int, list(str(i)))) <= b:
ans += i
else:
continue
print(ans) | s694533211 | Accepted | 33 | 3,060 | 170 | n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
if a <= sum(map(int, list(str(i)))) <= b:
ans += i
else:
continue
print(ans) |
s141579278 | p03502 | u323626540 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 352 | 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. | def calcurate_digit_sum(num):
digit_sum = 0
while num > 0:
digit_sum += num % 10
num = num // 10
return digit_sum
def check_harshad(num):
digit_sum = calcurate_digit_sum(num)
if num % digit_sum == 0:
return("yes")
return("no")
if __name__ == "__main__":
N = int(inpu... | s192058141 | Accepted | 17 | 3,060 | 352 | def calcurate_digit_sum(num):
digit_sum = 0
while num > 0:
digit_sum += num % 10
num = num // 10
return digit_sum
def check_harshad(num):
digit_sum = calcurate_digit_sum(num)
if num % digit_sum == 0:
return("Yes")
return("No")
if __name__ == "__main__":
N = int(inpu... |
s730609834 | p03599 | u826263061 | 3,000 | 262,144 | Wrong Answer | 111 | 3,188 | 1,172 | 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... | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 8 14:30:54 2018
ABC074C
@author: maezawa
"""
a, b, c, d, e, f = list(map(int, input().split()))
pos_water = set([])
pos_sugar = set([])
max_water = f
max_sugar = f*e//100
for i in range(max_water//100//a+1):
for j in range(max_water//100//b+1):
if 100*(i*a ... | s311809617 | Accepted | 117 | 3,188 | 1,123 | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 8 14:30:54 2018
ABC074C
@author: maezawa
"""
a, b, c, d, e, f = list(map(int, input().split()))
pos_water = set([])
pos_sugar = set([])
max_water = f
max_sugar = f*e//100
for i in range(max_water//100//a+1):
for j in range(max_water//100//b+1):
if 100*(i*a ... |
s972494083 | p03861 | u468972478 | 2,000 | 262,144 | Wrong Answer | 2,205 | 9,148 | 104 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, c = map(int, input().split())
a = 0
for i in range(a, b + 1):
if i % c == 0:
a += 1
print(a) | s910148035 | Accepted | 28 | 9,096 | 64 | a, b, c = map(int, input().split())
print(b // c - (a - 1) // c) |
s809553389 | p03624 | u626468554 | 2,000 | 262,144 | Wrong Answer | 411 | 3,956 | 294 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | li = list("abcdefghijklmnopqrstuvwxyz")
s = list(input())
cnt = [0 for i in range(26)]
for i in range(len(s)):
for j in range(26):
if li[j]==s[i]:
cnt[j]+=1
for i in range(26):
if cnt[j]==0:
print(li[j])
break
elif i ==25:
print("None") | s606511056 | Accepted | 437 | 3,956 | 295 | li = list("abcdefghijklmnopqrstuvwxyz")
s = list(input())
cnt = [0 for i in range(26)]
for i in range(len(s)):
for j in range(26):
if li[j]==s[i]:
cnt[j]+=1
for i in range(26):
if cnt[i]==0:
print(li[i])
break
elif i ==25:
print("None") |
s505263825 | p00423 | u498211963 | 1,000 | 131,072 | Wrong Answer | 110 | 5,612 | 442 | A と B の 2 人のプレーヤーが, 0 から 9 までの数字が書かれたカードを使ってゲームを行う.最初に, 2 人は与えられた n 枚ずつのカードを,裏向きにして横一列に並べる.その後, 2 人は各自の左から 1 枚ずつカードを表向きにしていき,書かれた数字が大きい方のカードの持ち主が,その 2 枚のカードを取る.このとき,その 2 枚のカードに書かれた数字の合計が,カードを取ったプレーヤーの得点となるものとする.ただし,開いた 2 枚のカードに同じ数字が書かれているときには,引き分けとし,各プレーヤーが自分のカードを 1 枚ずつ取るものとする. 例えば, A,B の持ち札が,以下の入力例 1 から 3 のように並べられている... | def main():
sum_a = 0
sum_b = 0
while True:
n = input()
if n == '0':
return
for i in range(int(n)):
a,b = list(map(int, input().split()))
if a > b:
sum_a += a+b
elif a < b:
sum_b += a+b
else:... | s316004574 | Accepted | 100 | 5,616 | 484 | # coding: utf-8
# Your code here!
def main():
while True:
sum_a = 0
sum_b = 0
n = input()
if n == '0':
return
for i in range(int(n)):
a,b = list(map(int, input().split()))
if a > b:
sum_a += a+b
elif a < b:
... |
s132892547 | p02613 | u913153936 | 2,000 | 1,048,576 | Wrong Answer | 144 | 17,472 | 273 | 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 i in range(n)]
print(n, s)
ac = s.count('AC')
wa = s.count('WA')
tle = s.count('TLE')
re = s.count('RE')
print('AC'+' '+'x'+' '+str(ac))
print('WA'+' '+'x'+' '+str(wa))
print('TLE'+' '+'x'+' '+str(tle))
print('RE'+' '+'x'+' '+str(re))
| s893216402 | Accepted | 142 | 16,176 | 260 | n = int(input())
s = [input() for i in range(n)]
ac = s.count('AC')
wa = s.count('WA')
tle = s.count('TLE')
re = s.count('RE')
print('AC'+' '+'x'+' '+str(ac))
print('WA'+' '+'x'+' '+str(wa))
print('TLE'+' '+'x'+' '+str(tle))
print('RE'+' '+'x'+' '+str(re))
|
s284872766 | p03485 | u597017430 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | 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())
print((a+b)//2 if (a+b)%2 == 1 else (a+b)//2 +1) | s075887059 | Accepted | 17 | 2,940 | 83 | a, b = map(int, input().split())
print((a+b)//2 +1 if (a+b)%2 == 1 else (a+b)//2 ) |
s309921845 | p04045 | u099566485 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 423 | 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()))
a=[0,1,2,3,4,5,6,7,8,9]
for i in d:
del a[a.index(i)]
for i in a:
for j in a:
for k in a:
for l in a:
for m in a:
p=int(i*10**4+j*10**3+k*10**2+l*10+m)
if p>=n:
... | s296046275 | Accepted | 81 | 3,060 | 240 | n,k=map(int,input().split())
d=list(map(int,input().split()))
while True:
change=False
for i in str(n):
if int(i) in d:
n+=1
change=True
break
if change==False:
break
print(n) |
s940648538 | p03351 | u045408189 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 94 | 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())
print('Yes' if abs(c-a)<=d or abs(b-a)+abs(c-b)<=d else 'No') | s764700911 | Accepted | 18 | 2,940 | 113 | a,b,c,d=map(int,input().split())
print('Yes' if abs(c-a)<=d else 'Yes' if abs(b-a)<=d and abs(c-b)<=d else 'No')
|
s344921376 | p02972 | u747703115 | 2,000 | 1,048,576 | Wrong Answer | 439 | 12,352 | 243 | 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 = list(map(int, input().split()))[::-1]
ans = []
for i in range(n-1,-1,-1):
t = 0
for j in range(i+1,n,i+1):
t += A[j]
if t%2!=A[i]:
ans.append(A[i])
print(len(ans))
if len(ans)>0:
print(*ans) | s839524194 | Accepted | 175 | 18,028 | 200 | n = int(input())
A = list(map(int, input().split()))
B = [0]*n
ans = []
for i in range(n-1,-1,-1):
if sum(B[i::i+1])%2!=A[i]:
B[i] = 1
ans.append(i+1)
print(len(ans))
print(*ans) |
s526047665 | p03556 | u917558625 | 2,000 | 262,144 | Wrong Answer | 30 | 9,116 | 51 | 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. | import math
N=int(input())
print(int(math.sqrt(N))) | s923161719 | Accepted | 30 | 9,156 | 54 | import math
N=int(input())
print(int(math.sqrt(N))**2) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.