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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s839161517 | p02264 | u564464686 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 394 | _n_ _q_ _name 1 time1_ _name 2 time2_ ... _name n timen_ In the first line the number of processes _n_ and the quantum _q_ are given separated by a single space. In the following _n_ lines, names and times for the _n_ processes are given. _name i_ and _time i_ are separated by a single space. | s=0
A=input().split()
n=(int)(A[0])
t=(int)(A[1])
x=[0 for i in range(2*n)]
for i in range(n):
B=input().split()
k=2*i
x[k]=(B[0])
x[k+1]=(int)(B[1])
while len(x)>0:
s=x[1]-t
if s>0:
sum=t
x.append(x[0])
x.append(s)
del x[0]
del x[0]
if s<=0:
... | s926425072 | Accepted | 2,110 | 9,456 | 396 | sum=0
s=0
A=input().split()
n=(int)(A[0])
t=(int)(A[1])
x=[0 for i in range(2*n)]
for i in range(n):
B=input().split()
k=2*i
x[k]=(B[0])
x[k+1]=(int)(B[1])
while len(x)>0:
s=x[1]-t
if s>0:
sum+=t
x.append(x[0])
x.append(s)
del x[0]
del x[0]
if s<=0:
... |
s545690776 | p03129 | u494151155 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 92 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | N,K = [int(_) for _ in input().split()]
if N/2 >= K:
print("YES")
else:
print("NO")
| s855027244 | Accepted | 17 | 2,940 | 96 | N,K = [int(_) for _ in input().split()]
if N >= K*2 - 1:
print("YES")
else:
print("NO")
|
s765367054 | p02389 | u623275452 | 1,000 | 131,072 | Wrong Answer | 20 | 7,500 | 53 | Write a program which calculates the area and perimeter of a given rectangle. | a,b = map(int,input().split())
print(int(a) * int(b)) | s365816041 | Accepted | 20 | 7,592 | 69 | a,b = map(int,input().split())
c = a + b
print(int(a) * int(b),c * 2) |
s113999284 | p03473 | u672898046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 28 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | i = int(input())
print(i+24) | s526824128 | Accepted | 17 | 2,940 | 33 | i = int(input())
print((24-i)+24) |
s208610730 | p03503 | u282228874 | 2,000 | 262,144 | Wrong Answer | 316 | 3,188 | 383 | Joisino is planning to open a shop in a shopping street. Each of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those ... | from itertools import product
n = int(input())
F = [list(map(int,input().split())) for i in range(n)]
P = [list(map(int,input().split())) for i in range(n)]
ans = []
for p in product([0,1],repeat = 10):
if sum(p) == 0:
continue
res = 0
for i in range(n):
cnt = 0
for j in range(10):
if p[j] == 1:
cnt +... | s742959438 | Accepted | 223 | 3,064 | 376 | from itertools import product
n = int(input())
F = [list(map(int,input().split())) for i in range(n)]
P = [list(map(int,input().split())) for i in range(n)]
ans = []
for p in product([0,1],repeat = 10):
if sum(p) == 0:
continue
res = 0
for i in range(n):
cnt = 0
for j in range(10):
if p[j]:
cnt += F[i... |
s644064577 | p03473 | u928784113 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | #!/usr/bin/env python
# -*- coding utf-8 -*-
x = int(input())
print("{}".format(x + 24)) | s098666345 | Accepted | 19 | 2,940 | 52 | # -*- coding: utf-8 -*-
M = int(input())
print(48-M) |
s347277026 | p03447 | u617659131 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 45 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | print(int(input())-int(input())-int(input())) | s180279205 | Accepted | 17 | 2,940 | 70 | x = int(input())
a = int(input())
b = int(input())
x -= a
print(x % b) |
s487891121 | p00042 | u319725914 | 1,000 | 131,072 | Wrong Answer | 20 | 5,620 | 637 | ๅฎ็ฉใใใใใๅ่ตใใใฆใใๅ็ฉ้คจใซใๆณฅๆฃใๅคงใใช้ขจๅๆทใไธใคใ ใๆใฃใฆๅฟใณ่พผใฟใพใใใ็ใฟๅบใใใใใฎใฏใใใใใใใพใใใ้ขจๅๆทใ่ใใใใ้ใใ้ใใใฆใใใใใใ่ถ
ใใใจ้ขจๅๆทใ็ ดใใฆใใพใใพใใใใใงๆณฅๆฃใฏใ็จๆใใ้ขจๅๆทใ็ ดใใไธใคๆใไพกๅคใ้ซใใชใใใใชใๅฎใฎ็ตใฟๅใใใ่ใใชใใฆใฏใชใใพใใใ ้ขจๅๆทใ่ใใใใ้ใ Wใใใใณๅ็ฉ้คจใซใใๅใ
ใฎใๅฎใฎไพกๅคใจ้ใใ่ชญใฟ่พผใใงใ้ใใฎ็ทๅใ W ใ่ถ
ใใชใ็ฏๅฒใงไพกๅคใฎ็ทๅใๆๅคงใซใชใใจใใฎใใๅฎใฎไพกๅค็ทๅใจ้ใใฎ็ทๅใๅบๅใใใใญใฐใฉใ ใไฝๆใใฆใใ ใใใใใ ใใไพกๅคใฎ็ทๅใๆๅคงใซใชใ็ตใฟๅใใใ่คๆฐใใใจใใฏใ้ใใฎ็ทๅใๅฐใใใใฎใๅบๅใใใใจใจใใพใใ | from sys import stdin
case = 0
while(True):
case += 1
W = int(stdin.readline())
if not W: break
print("Case %d"%case)
N = int(stdin.readline())
v = [0] * N
w = [0] * N
dp = [[0]*(W + 1) for _ in range(N + 1)]
for k in range(N):
v[k], w[k] = map(int, stdin.readline().split("... | s828116728 | Accepted | 1,070 | 17,252 | 638 | from sys import stdin
case = 0
while(True):
case += 1
W = int(stdin.readline())
if not W: break
print("Case %d:"%case)
N = int(stdin.readline())
v = [0] * N
w = [0] * N
dp = [[0]*(W + 1) for _ in range(N + 1)]
for k in range(N):
v[k], w[k] = map(int, stdin.readline().split(... |
s939723107 | p04043 | u422242631 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 179 | 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 = list(input().split())
count = 0
if A == "7":
count += 1
if B == "7":
count += 1
if C == "7":
count += 1
if count == 1:
print("Yes")
else:
print("No") | s209764526 | Accepted | 17 | 2,940 | 116 | A = list(map(int, input().split()))
if A.count(7) == 1 and A.count(5) == 2:
print("YES")
else:
print("NO")
|
s226755694 | p03623 | u023077142 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | 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... | x, a, b = map(int, input().split())
if abs(x - a) > abs(x - b):
print("A")
else:
print("B")
| s077556362 | Accepted | 17 | 2,940 | 101 | x, a, b = map(int, input().split())
if abs(x - a) < abs(x - b):
print("A")
else:
print("B")
|
s407942528 | p02843 | u963915126 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,056 | 207 | AtCoder Mart sells 1000000 of each of the six items below: * Riceballs, priced at 100 yen (the currency of Japan) each * Sandwiches, priced at 101 yen each * Cookies, priced at 102 yen each * Cakes, priced at 103 yen each * Candies, priced at 104 yen each * Computers, priced at 105 yen each Takahashi want... | ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
from math import ceil
x=ni()
p=x%100
if ceil(p/5) <= x//100:
print('Yes')
else:
print('No')
| s299353071 | Accepted | 29 | 9,108 | 200 | ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
from math import ceil
x=ni()
p=x%100
if ceil(p/5) <= x//100:
print(1)
else:
print(0)
|
s867551671 | p00049 | u078042885 | 1,000 | 131,072 | Wrong Answer | 20 | 7,348 | 150 | ใใๅญฆ็ดใฎ็ๅพใฎๅบๅธญ็ชๅทใจ ABO ่กๆถฒๅใไฟๅญใใใใผใฟใ่ชญใฟ่พผใใงใใใฎใใฎใฎ่กๆถฒๅใฎไบบๆฐใๅบๅใใใใญใฐใฉใ ใไฝๆใใฆใใ ใใใใชใใABO ่กๆถฒๅใซใฏใA ๅใB ๅใAB ๅใO ๅใฎ๏ผ็จฎ้กใฎ่กๆถฒๅใใใใพใใ | a={'A':0,'B':0,'O':0,'AB':0}
while 1:
try:
_,b=input().split(",")
a[b]+=1
except:
for i in a:print(a[i])
break | s984294896 | Accepted | 20 | 7,340 | 167 | a={'A':0,'B':0,'O':0,'AB':0}
while 1:
try:
_,b=input().split(",")
a[b]+=1
except:
for i in ['A','B','AB','O']:print(a[i])
break |
s605148981 | p03645 | u662613022 | 2,000 | 262,144 | Wrong Answer | 703 | 30,852 | 311 | In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk... | N,M = map(int,input().split())
li = []
numb = []
ans = ''
for i in range(M):
li.append(tuple(map(int,input().split())))
if li[i][0] == 1:
numb.append(i)
for i in range(M):
if li[i][0] in numb and li[i][1] == N:
ans = 'POSSIBLE'
break
if ans == '':
print('IMPOSSIBLE')
else:
print(ans)
| s271211059 | Accepted | 568 | 21,844 | 274 | N,M = map(int,input().split())
li = []
numb = []
for i in range(M):
a,b = map(int,input().split())
if a == 1:
li.append(b)
elif b == N:
numb.append(a)
ans = set(li) & set(numb)
if len(ans) >= 1:
print('POSSIBLE')
else:
print('IMPOSSIBLE') |
s305956571 | p03795 | u138486156 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n = int(input())
print(n*800 - n*200//15) | s535306651 | Accepted | 17 | 2,940 | 43 | n = int(input())
print(n*800 - (n//15)*200) |
s859935135 | p02534 | u667469290 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,072 | 115 | You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`. | # -*- coding: utf-8 -*-
def solve():
return 'ALC'*int(input())
if __name__ == '__main__':
print(solve())
| s670311584 | Accepted | 24 | 9,136 | 115 | # -*- coding: utf-8 -*-
def solve():
return 'ACL'*int(input())
if __name__ == '__main__':
print(solve())
|
s740624801 | p02279 | u637322311 | 2,000 | 131,072 | Wrong Answer | 20 | 5,612 | 1,058 | A graph _G_ = ( _V_ , _E_ ) is a data structure where _V_ is a finite set of vertices and _E_ is a binary relation on _V_ represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). **Fig. 1** A free tree is a connnected, acyclic, undirected graph. A rooted tree is a free tree in which one... | from sys import stdin
class Node(object):
def __init__(self, parent=None, children=None, name=None, depth=None):
self.parent = parent
self.children = children
self.name = name
self.depth = depth
def set_depth(nodes, u):
p = nodes[u].parent
d = nodes[p].depth
if d != Non... | s090739079 | Accepted | 880 | 35,712 | 1,167 | from sys import stdin
class Node(object):
def __init__(self, parent=None, children=None, name=None):
self.parent = parent
self.children = children
self.name = name
def print_nodes(nodes, n):
def get_depth(nodes, u):
p = nodes[u].parent
nonlocal d
if p != None an... |
s419106254 | p03130 | u519939795 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 295 | There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roa... | a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
a3,b3=map(int,input().split())
l=[]
l.append(a1)
l.append(b1)
l.append(a2)
l.append(b2)
l.append(a3)
l.append(b3)
print(l)
if l.count(1)==1 and l.count(4)==1 and l.count(2)==2 and l.count(3)==2:
print('YES')
else:
print('NO') | s285324704 | Accepted | 18 | 3,060 | 172 | li=[0]*4
for i in range(3):
a,b=map(int,input().split())
li[a-1]+=1
li[b-1]+=1
if li.count(1)==2 and li.count(2)==2:
print('YES')
else:
print('NO') |
s743153657 | p03155 | u433195318 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 6 | It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board. The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns. How many ways are there to choose where ... | 3
2
3
| s317787236 | Accepted | 38 | 5,344 | 624 | import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)
MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18
N = int(input())
H = int(input())
W = int(input())
print((N-H+1)*(N-W+1)) |
s373193677 | p02844 | u408375121 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,064 | 334 | AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code. The company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code. How many different PIN codes can he set this way? ... | n = int(input())
s = input()
ans = 0
for a in range(10):
for b in range(10):
for c in range(10):
for i in range(n-2):
if s[i] == str(a):
for j in range(i+1, n-1):
if s[j] == str(b):
for k in range(j+1, n):
if s[k] == str(c):
ans +... | s657570992 | Accepted | 47 | 8,932 | 438 | n = int(input())
s = input()
before = [[-1] * 10]
for i in range(n):
c = s[i]
num = int(c)
hoge = before[-1][::]
hoge[num] = i
before.append(hoge)
ans = 0
for i in range(10):
now = before[-1][i]
if now == -1:
continue
for j in range(10):
now2 = before[now][j]
if now2 == -1:
continue... |
s127765739 | p03163 | u693173434 | 2,000 | 1,048,576 | Wrong Answer | 204 | 29,676 | 209 | There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), Item i has a weight of w_i and a value of v_i. Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W. Find ... | import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W+1)
for i in range(N):
w, v = map(int, input().split())
dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print(dp)
print(int(dp.max()))
| s934932469 | Accepted | 180 | 29,744 | 195 | import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W+1)
for i in range(N):
w, v = map(int, input().split())
dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print(int(dp.max()))
|
s757384374 | p02665 | u801701525 | 2,000 | 1,048,576 | Wrong Answer | 94 | 20,180 | 363 | Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1. | import math
N = int(input())
leaf = list(map(int,input().split()))
end_flag = False
count = sum(leaf)
ans = 0
node = 1
for i in range(N+1):
if end_flag:
break
ans += node
count -= leaf[i]
node = min(count, (node-leaf[i])*2)
if node < 0:
end_flag = True
if end_flag:
print('-1... | s516962379 | Accepted | 94 | 20,076 | 343 | import math
N = int(input())
leaf = list(map(int,input().split()))
end_flag = False
count = sum(leaf)
ans = 0
node = 1
for i in range(N+1):
if end_flag:
break
ans += node
count -= leaf[i]
node = min(count, (node-leaf[i])*2)
if node < 0:
end_flag = True
if end_flag:
print('-1... |
s416512864 | p02612 | u962024525 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,120 | 29 | 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. | m=int(input())
print(m%1000)
| s892842237 | Accepted | 25 | 9,096 | 40 | m=int(input())
print((1000-m%1000)%1000) |
s736442952 | p02402 | u921038488 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 397 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | def bubble_sort(l):
N = len(l)
isChange = True
while isChange:
isChange = False
for i in range(N-1):
if(l[i] > l[i+1]):
l[i], l[i+1] = l[i+1], l[i]
isChange = True
return l
N = int(input())
l = input().split()
L = bubble_sort(l)
sum = 0
for k ... | s348922162 | Accepted | 20 | 6,548 | 102 | N = input()
l = map(int, input().split())
l = list(l)
print("{} {} {}".format(min(l), max(l), sum(l))) |
s221472186 | p03997 | u545666277 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | 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. | # -*- coding: utf-8 -*-
a = int(input())
b = int(input())
h = int(input())
print( ((a+b)*h)/2) | s050406628 | Accepted | 17 | 2,940 | 120 | # -*- coding: utf-8 -*-
a = int(input())
b = int(input())
h = int(input())
print( int(((a+b)*h)/2) ) |
s580637257 | p03353 | u644972721 | 2,000 | 1,048,576 | Wrong Answer | 33 | 3,188 | 484 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | s = list(input())
k = int(input())
t = sorted(s)
u = []
v = []
for i in range(min(len(s), 5)):
u.append(t[i])
for i in range(len(s)):
if s[i] in u:
if not [s[i]] in v:
v.append([s[i]])
l = [s[i]]
for j in range(1, 5):
if i + j == len(s):
break
... | s686266044 | Accepted | 34 | 3,188 | 475 | s = list(input())
k = int(input())
t = sorted(s)
u = []
v = []
for i in range(min(len(s), 5)):
u.append(t[i])
for i in range(len(s)):
if s[i] in u:
if not [s[i]] in v:
v.append([s[i]])
l = [s[i]]
for j in range(1, 5):
if i + j == len(s):
break
... |
s949965535 | p03049 | u673338219 | 2,000 | 1,048,576 | Wrong Answer | 48 | 3,064 | 503 | Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string. | n = int(input())
c = 0
xa = 0
bx = 0
ba = 0
for _ in range(n):
si = str(input())
l = len(si)
s1 = si[0]
s2 = si[-1]
if s1=="B":
if s2=="A":
ba += 1
else:
bx += 1
elif s2 == "A":
xa += 1
for i in range(l-1):
if si[i]=="A" and si[i+1]=="B":
c += 1
print(c,ba,bx,xa)
if ba ==... | s412883371 | Accepted | 48 | 3,188 | 485 | n = int(input())
c = 0
xa = 0
bx = 0
ba = 0
for _ in range(n):
si = str(input())
l = len(si)
s1 = si[0]
s2 = si[-1]
if s1=="B":
if s2=="A":
ba += 1
else:
bx += 1
elif s2 == "A":
xa += 1
for i in range(l-1):
if si[i]=="A" and si[i+1]=="B":
c += 1
if ba == 0:
print(c+min(... |
s218529321 | p03486 | u134519179 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s = input()
t = input()
s = sorted(s)
t = sorted(t)[::-1]
if s < t:
print('YES')
else:
print('NO') | s195522725 | Accepted | 17 | 2,940 | 108 | s = input()
t = input()
s = sorted(s)
t = sorted(t)[::-1]
if s < t:
print('Yes')
else:
print('No') |
s402129136 | p03433 | u789791593 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 125 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | # coding: utf-8
N_yen = int(input())
A_1mai = int(input())
answer = 'YES' if N_yen % 500 <= A_1mai else 'NO'
print(answer)
| s806408161 | Accepted | 17 | 2,940 | 125 | # coding: utf-8
N_yen = int(input())
A_1mai = int(input())
answer = 'Yes' if N_yen % 500 <= A_1mai else 'No'
print(answer)
|
s375425310 | p03149 | u410118019 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 65 | 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". | n = set(map(int,input().split()))
print('YNeos'[n!={1,9,7,4}::2]) | s693535243 | Accepted | 17 | 2,940 | 65 | n = set(map(int,input().split()))
print('YNEOS'[n!={1,9,7,4}::2]) |
s166382357 | p03815 | u870518235 | 2,000 | 262,144 | Wrong Answer | 29 | 9,000 | 99 | 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... | x = int(input())
if x % 11 == 0:
ans = (x // 11)*2
else:
ans = (x // 11)*2 + 1
print(ans) | s106859526 | Accepted | 26 | 9,124 | 152 | x = int(input())
X = x % 11
N = x // 11
ans = 0
if 1 <= X <= 6:
ans = N*2 + 1
elif 7 <= X <= 10:
ans = N*2 + 2
else:
ans = N*2
print(ans)
|
s716757690 | p03910 | u879309973 | 2,000 | 262,144 | Wrong Answer | 18 | 3,444 | 220 | The problem set at _CODE FESTIVAL 20XX Finals_ consists of N problems. The score allocated to the i-th (1โฆiโฆN) problem is i points. Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve. As problems with higher scores are harder, he wants to minimize the highe... | def solve(n):
score = 0
res = []
for p in range(1, n+1):
res.append(p)
score += p
if score >= n:
break
return "\n".join(map(str, res))
n = int(input())
print(solve(n)) | s001581030 | Accepted | 18 | 3,444 | 253 | def solve(n):
score = 0
for p in range(1, n+1):
score += p
if score >= n:
break
x = score - n
res = list(range(1,x)) + list(range(x+1,p+1))
return "\n".join(map(str, res))
n = int(input())
print(solve(n)) |
s524161621 | p02578 | u186397299 | 2,000 | 1,048,576 | Wrong Answer | 229 | 25,236 | 218 | 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 ... | N = int(input(''))
A = input('')
A_N = A.split()
num = 0
for i in range(1,N):
if int(A_N[i]) >= int(A_N[i-1]):
num += 0
elif (A_N[i]) < (A_N[i-1]):
num += int(A_N[i-1]) - int(A_N[i])
print(num) | s611402676 | Accepted | 169 | 33,596 | 246 | N = int(input(''))
A = input('')
a_n = A.split()
A_N = list(map(int, a_n))
num = 0
for i in range(1,N):
if A_N[i] >= A_N[i-1]:
num += 0
elif A_N[i] < A_N[i-1]:
num += A_N[i-1] - A_N[i]
A_N[i] = A_N[i-1]
print(num) |
s611419958 | p03434 | u290187182 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 313 | 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... | if __name__ == '__main__':
n = int(input())
k = [int(i) for i in input().split()]
a = 0
b = 0
k.sort(reverse=True)
print(k)
flag = True
for i in k:
if flag == True:
a+=i
flag=False
else:
b+=i
flag=True
print(a-b)
| s294369289 | Accepted | 17 | 3,060 | 300 | if __name__ == '__main__':
n = int(input())
k = [int(i) for i in input().split()]
a = 0
b = 0
k.sort(reverse=True)
flag = True
for i in k:
if flag == True:
a+=i
flag=False
else:
b+=i
flag=True
print(a-b)
|
s225823716 | p03352 | u460468647 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 197 | 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())
lst = [i**2 for i in range(1,32)]+[8,27,125,216,343,512,1000]+[32,243]+[128]+[1001]
lst.sort()
print(lst)
for i in range(len(lst)):
if lst[i]<=x<lst[i+1]:
print(lst[i]) | s240307795 | Accepted | 17 | 3,060 | 186 | x = int(input())
lst = [i**2 for i in range(1,32)]+[8,27,125,216,343,512,1000]+[32,243]+[128]+[1001]
lst.sort()
for i in range(len(lst)):
if lst[i]<=x<lst[i+1]:
print(lst[i]) |
s288906819 | p03861 | u893931781 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | 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? |
li=list(map(int,input().split()))
min=li[0]//li[2]
max=li[1]//li[2]
count=max-min
if li[0]==0:
count+=1
print(count) | s717466995 | Accepted | 17 | 3,060 | 126 |
li=list(map(int,input().split()))
min=li[0]//li[2]
max=li[1]//li[2]
count=max-min
if li[0]%li[2]==0:
count+=1
print(count) |
s227380923 | p04029 | u036363750 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 156 | 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? | #!/usr/bin/env python3
def main():
a = int(input())
if a%2==0:
print((a+1)*a/2)
else:
print((a+1)*a/2+(a+1)/2)
if __name__=='__main__':main() | s245796174 | Accepted | 17 | 2,940 | 111 | #!/usr/bin/env python3
def main():
a = int(input())
print(int(((a+1)*a)/2))
if __name__=='__main__':main() |
s918277165 | p03502 | u136869985 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | 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()
t=sum(map(int, list(N)))
print("Yes" if int(N)==t else "No") | s440117808 | Accepted | 17 | 2,940 | 109 | X = input()
fx = 0
for x in X:
fx += int(x)
if int(X) % fx == 0:
print("Yes")
else:
print("No") |
s771034287 | p03576 | u155687575 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,188 | 762 | We have N points in a two-dimensional plane. The coordinates of the i-th point (1 \leq i \leq N) are (x_i,y_i). Let us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior. Here, points on the sides of the rectangle are considered to be in th... | n, k = map(int,input().split())
xs = []
ys = []
points = []
for _ in range(n):
x, y = map(int, input().split())
xs.append(x)
ys.append(y)
points.append((x, y))
for leftx in xs:
for rightx in xs:
if leftx >= rightx:
continue
for downy in ys:
for upy in ys:
... | s834248909 | Accepted | 26 | 3,064 | 638 | n, k = map(int,input().split())
ps = [tuple(map(int,input().split())) for i in range(n)]
sx = sorted(ps,key = lambda x: x[0])
nx = list(enumerate(sx))
ans = 5e18
for f, (x1,y1) in nx[:n-k+1]:
for e, (x2,y2) in nx[f+k-1:]:
dx = x2 - x1
sy = sorted(y for x,y in sx[f:e+1])
for y3,y4 in ... |
s527099700 | p03494 | u408375121 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 191 | 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(map(int, input().split()))
B = []
for a in A:
i = 0
while True:
if a % 2 ** i == 0:
i += 1
else:
B.append(i)
break
B.sort()
print(B[0]) | s922104332 | Accepted | 21 | 2,940 | 155 | N = int(input())
A = list(map(int, input().split()))
B = []
for a in A:
i = 0
while a % 2 ** i == 0:
i += 1
B.append(i - 1)
B.sort()
print(B[0])
|
s382148318 | p03545 | u240793404 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 197 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | n = list(input())
for i in range(8):
ans = n[0]
ans += '+-'[i%2] + n[1]
ans += '+-'[i//4] + n[2]
ans += '+-'[(i%4)//2] + n[3]
if eval(ans) == 7:
print(ans)
break | s851468430 | Accepted | 17 | 3,060 | 202 | n = list(input())
for i in range(8):
ans = n[0]
ans += '+-'[i%2] + n[1]
ans += '+-'[i//4] + n[2]
ans += '+-'[(i%4)//2] + n[3]
if eval(ans) == 7:
print(ans+"=7")
break |
s172240036 | p03139 | u738037409 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 73 | 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(min(A, B), max(0, N - (A + B))) | s024264408 | Accepted | 17 | 2,940 | 73 | N, A, B = map(int, input().split())
print(min(A, B), max(0, (A + B) - N)) |
s341488543 | p03049 | u305422591 | 2,000 | 1,048,576 | Wrong Answer | 36 | 3,064 | 408 | Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string. | N = int(input())
res = 0
both = 0
head = 0
last = 0
for i in range(N):
inp = input()
if 'AB' in inp:
res += 1
if 'B'==inp[0] and 'A'==inp[-1]:
both+=1
elif 'B'==inp[0]:
head+=1
elif 'A'==inp[-1]:
last += 1
res += max(0,both -1)
if head > 0 and last >0:
res += 2 + min(head-1,last-1)
elif hea... | s374227876 | Accepted | 81 | 3,700 | 592 | n=int(input())
s=[0]*n
ct=0
a=0
b=0
c=0
for i in range(n):
s[i]=input()
for i in range(n):
for j in range(len(s[i])):
t=s[i]
ts=list(t)
ts.append(0)
if ts[j]=='A' and ts[j+1]=='B':
ct+=1
if ts[0]=='B' and ts[len(s[i])-1]!='A':
a+=1
if ts[len(s[i])-1]==... |
s008426649 | p03760 | u836737505 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 17,172 | 121 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | o = list(input())
e = list(input())
c = ""
for i in range(len(o)):
c += o[i]
while e:
c += e[i]
print(c) | s210674291 | Accepted | 17 | 2,940 | 127 | o = list(input())
e = list(input())
c = ""
for i in range(len(o)):
c += o[i]
if i < len(e):
c += e[i]
print(c) |
s205416010 | p03759 | u962718741 | 2,000 | 262,144 | Wrong Answer | 26 | 9,080 | 161 | 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. | #!/usr/bin/env python3
def main():
a, b, c = map(int, input().split())
print("YES" if b - a == c - a else "NO")
if __name__ == "__main__":
main()
| s772607588 | Accepted | 27 | 9,080 | 161 | #!/usr/bin/env python3
def main():
a, b, c = map(int, input().split())
print("YES" if b - a == c - b else "NO")
if __name__ == "__main__":
main()
|
s556354746 | p03971 | u857673087 | 2,000 | 262,144 | Wrong Answer | 97 | 4,016 | 177 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | N,A,B = map(int,input().split())
S =input()
for i in range(N):
if S[i]=='a' and i < A+B:
print('Yes')
elif S[i]=='b' and i < B:
print('Yes')
else:
print('No') | s327524429 | Accepted | 109 | 4,016 | 370 | N,A,B = map(int,input().split())
S = input()
passed = 0
fo = 1
for i in range(N):
if(S[i] == 'a'):
if(passed < A+B):
print('Yes')
passed += 1
else:
print('No')
elif(S[i] == 'b'):
if((passed < A+B)and(fo <= B)):
print('Yes')
fo += 1
passed += 1
else:
print... |
s103034875 | p02264 | u153665391 | 1,000 | 131,072 | Wrong Answer | 30 | 7,708 | 382 | _n_ _q_ _name 1 time1_ _name 2 time2_ ... _name n timen_ In the first line the number of processes _n_ and the quantum _q_ are given separated by a single space. In the following _n_ lines, names and times for the _n_ processes are given. _name i_ and _time i_ are separated by a single space. | N, Q = map(int, input().strip().split())
A = []
D = {}
for l in range(N):
n, t = input().strip().split()
D[n] = int(t)
A.append(n)
print(A)
T = 0
d = 0
while True:
n = A.pop(0)
if D[n] > Q:
D[n] -= Q
T += Q
A.append(n)
else:
T += D[n]
print('{0} {1}'.for... | s681534583 | Accepted | 480 | 24,316 | 768 | N, qms = map(int, input().split())
raw_proc = [input() for i in range(N)]
queue = [{} for i in range(N+1)]
limit = N+1
for i in range(N):
name, time = raw_proc[i].split()
time = int(time)
queue[i] = {"name": name, "time": time}
def enque(tail, p):
queue[tail] = p
tail = (tail+1) % limit
return... |
s182872341 | p03494 | u069129582 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,060 | 155 | 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(map(int,input().split()))
ans=0
while all(j%2==0 for j in a):
for k in range(len(a)):
a[k]==a[k]//2
ans+=1
print(ans) | s473686405 | Accepted | 19 | 3,060 | 128 | n=int(input())
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
A=[a/2 for a in A]
ans+=1
print(ans) |
s903510583 | p03455 | u883792993 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | 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(a)
print(b)
if a*b/2 == 1:
print("Odd")
else:
print("Even") | s950282297 | Accepted | 18 | 2,940 | 85 | a,b = map(int, input().split())
if a*b%2 == 1:
print("Odd")
else:
print("Even") |
s789601449 | p03455 | u350166773 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if a%2 == 0 and b%2 == 0:
print('Even')
else:
print('Odd') | s405185905 | Accepted | 17 | 2,940 | 84 | a, b = map(int, input().split())
if a*b%2 == 0:
print('Even')
else:
print('Odd') |
s419882634 | p03385 | u596536048 | 2,000 | 262,144 | Wrong Answer | 30 | 9,016 | 42 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | print('Yes' if 'abc' in input() else 'No') | s908504857 | Accepted | 29 | 9,036 | 136 | string = input()
if string[0] != string[1] and string[1] != string[2] and string[2] != string[0]:
print("Yes")
else:
print("No") |
s420584786 | p02844 | u102275718 | 2,000 | 1,048,576 | Wrong Answer | 316 | 21,512 | 707 | AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code. The company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code. How many different PIN codes can he set this way? ... | import sys
input = sys.stdin.readline
import numpy as np
from math import factorial
import itertools
def permutations_count(n, r):
return factorial(n) // factorial(n - r)
def combinations_count(n, r):
return factorial(n) // (factorial(n - r) * factorial(r))
n = int(input())
*s, = map(int, list(inp... | s884435200 | Accepted | 22 | 3,064 | 350 | import sys
input = sys.stdin.readline
n = int(input())
s = input().split()[0]
ans = 0
for i in range(1000):
num_str = str(i).zfill(3)
a = s.find(num_str[0])
if a==-1:
continue
b = s[a+1:].find(num_str[1])
if b==-1:
continue
b += a+1
c = s[b+1:].find(num_str[2])
if c!=-1... |
s456823729 | p03378 | u569776981 | 2,000 | 262,144 | Wrong Answer | 31 | 9,168 | 300 | 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... | N, M, X = map(int,input().split())
A = list(map(int,input().split()))
ans = []
z = 0
y = 0
for i in range(X + 1, N + 1):
if i in A:
z += 1
print(z)
ans.append(z)
for i in range(1,X):
if i in A:
y += 1
print(y)
ans.append(y)
ans = sorted(ans)
print(ans)
print(ans[0]) | s955543475 | Accepted | 28 | 9,184 | 263 | N, M, X = map(int,input().split())
A = list(map(int,input().split()))
ans = []
z = 0
y = 0
for i in range(X + 1, N + 1):
if i in A:
z += 1
ans.append(z)
for i in range(1,X):
if i in A:
y += 1
ans.append(y)
ans = sorted(ans)
print(ans[0]) |
s753131466 | p04035 | u608088992 | 2,000 | 262,144 | Wrong Answer | 2,104 | 14,052 | 398 | We have N pieces of ropes, numbered 1 through N. The length of piece i is a_i. At first, for each i (1โคiโคN-1), piece i and piece i+1 are tied at the ends, forming one long rope with N-1 knots. Snuke will try to untie all of the knots by performing the following operation repeatedly: * Choose a (connected) rope with... | N, L = map(int, input().split())
A = [int(a) for a in input().split()]
CanRemain = []
for i in range(N-1):
if A[i] + A[i+1] >= L: CanRemain.append(i+1)
if not CanRemain: print("impossible")
else:
print("possible")
for i in range(1, CanRemain[-1]):
if i not in CanRemain: print(i)
for i in reve... | s821157096 | Accepted | 124 | 14,072 | 458 | import sys
def solve():
input = sys.stdin.readline
N, L = map(int, input().split())
A = [int(a) for a in input().split()]
for i in range(N - 1):
if A[i] + A[i+1] >= L:
print("Possible")
for k in range(i): print(k + 1)
for k in reversed(range(i + 1, N - 1)): p... |
s020461434 | p03447 | u959759457 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 61 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | X,A,B=[int(input()) for i in range(3)]
s=X-(((X-A)//B)*B+A)
s | s430024806 | Accepted | 17 | 2,940 | 69 | X,A,B=[int(input()) for i in range(3)]
s=X-(((X-A)//B)*B+A)
print(s)
|
s405112409 | p03862 | u714888375 | 2,000 | 262,144 | Wrong Answer | 114 | 14,160 | 227 | There are N boxes arranged in a row. Initially, the i-th box from the left contains a_i candies. Snuke can perform the following operation any number of times: * Choose a box containing at least one candy, and eat one of the candies in the chosen box. His objective is as follows: * Any two neighboring boxes con... | N, x = list(map(int,input().split()))
a = list(map(int,input().split()))
result = 0
for i in range(N-1):
n = a[i] + a[i+1] - x
if n > 0:
result += n
a[i+1] -= n
if a[i+1] < 0:
a[i+1] = 0
print(result, a) | s930722673 | Accepted | 105 | 14,132 | 224 | N, x = list(map(int,input().split()))
a = list(map(int,input().split()))
result = 0
for i in range(N-1):
n = a[i] + a[i+1] - x
if n > 0:
result += n
a[i+1] -= n
if a[i+1] < 0:
a[i+1] = 0
print(result) |
s805346340 | p03998 | u018984506 | 2,000 | 262,144 | Wrong Answer | 21 | 9,116 | 566 | 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. * ... | from sys import exit
s = [input() for i in range(3)]
turn = 0
card = s[0][0]
sa,sb,sc = 0,0,0
while 1:
if card == "a":
if sa == len(s[0]):
print("A")
exit()
card = s[0][sa]
sa += 1
print(sa,sb,sc)
if card == "b":
if sb == len(s[1]):
p... | s336954114 | Accepted | 20 | 9,032 | 495 | from sys import exit
s = [input() for i in range(3)]
turn = 0
card = s[0][0]
sa,sb,sc = 0,0,0
while 1:
if card == "a":
if sa == len(s[0]):
print("A")
exit()
card = s[0][sa]
sa += 1
if card == "b":
if sb == len(s[1]):
print("B")
ex... |
s965752644 | p03679 | u952130512 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 134 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x,a,b=input().split()
if int(b)-int(a)>=0:
print("delicious")
elif int(b)-int(a)<=int(x):
print("safe")
else:
print("dangerous") | s641404167 | Accepted | 18 | 2,940 | 134 | x,a,b=input().split()
if int(b)-int(a)<=0:
print("delicious")
elif int(b)-int(a)<=int(x):
print("safe")
else:
print("dangerous") |
s576398456 | p04044 | u036190609 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 229 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | N, L =list(map(int, input().split()))
array = []
word = ""
for i in range(N):
s = input()
array.append(s)
print(array)
new_array = sorted(array)
print(new_array)
for j in range(N):
word += new_array[j]
print(word) | s710351481 | Accepted | 18 | 3,060 | 200 | N, L =list(map(int, input().split()))
array = []
word = ""
for i in range(N):
s = input()
array.append(s)
new_array = sorted(array)
for j in range(N):
word += new_array[j]
print(word)
|
s533977135 | p02388 | u067975558 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 30 | Write a program which calculates the cube of a given integer x. | x = int(input())
print(x ^ 3) | s606184503 | Accepted | 30 | 6,724 | 34 | x = int(input())
print(x * x * x) |
s497886287 | p03605 | u518455500 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | N = input()
if '9' in N:
print("YES")
else:
print("NO") | s861727352 | Accepted | 17 | 2,940 | 64 | N = input()
if '9' in N:
print("Yes")
else:
print("No") |
s885045039 | p03697 | u540631540 | 2,000 | 262,144 | Wrong Answer | 31 | 9,004 | 85 | You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. | a, b = map(int, input().split())
if a + b > 10:
print(a + b)
else:
print("error") | s854950861 | Accepted | 27 | 9,048 | 89 | a, b = map(int, input().split())
if a + b < 10:
print(a + b)
else:
print("error") |
s652250665 | p02276 | u742013327 | 1,000 | 131,072 | Wrong Answer | 30 | 7,660 | 813 | Quick sort is based on the Divide-and-conquer approach. In QuickSort(A, p, r), first, a procedure Partition(A, p, r) divides an array A[p..r] into two subarrays A[p..q-1] and A[q+1..r] such that each element of A[p..q-1] is less than or equal to A[q], which is, inturn, less than or equal to each element of A[q+1..r]. I... | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_6_B&lang=jp
#partition
def partition(target_list):
x = target_list[-1]
i = -1
for j in range(len(target_list))[:-1]:
if target_list[j] <= x:
i = i+1
tmp = target_list[i]
target_list[i] = target_list... | s732194928 | Accepted | 80 | 18,524 | 817 | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_6_B&lang=jp
#partition
def partition(target_list):
x = target_list[-1]
i = -1
for j in range(len(target_list))[:-1]:
if target_list[j] <= x:
i = i+1
tmp = target_list[i]
target_list[i] = target_list... |
s201108161 | p03548 | u503228842 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | x,y,z =map(int,input().split())
print((x-2*z)//(y+z)) | s196137114 | Accepted | 25 | 3,068 | 51 | x,y,z =map(int,input().split())
print((x-z)//(y+z)) |
s955230340 | p03228 | u085186789 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,044 | 163 | 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... | A, B, K = map(int,input().split())
for i in range(K):
if A % 2 == 1:
A -= 1
if B % 2 == 1:
B -= 1
m = A / 2
n = B / 2
A += n
B += m
print(A, B) | s017045378 | Accepted | 25 | 8,968 | 153 | A, B, K = map(int,input().split())
for i in range(K):
if i % 2 == 0:
A = A // 2
B += A
else:
B = B // 2
A += B
print(int(A), int(B))
|
s956122625 | p02255 | u647766105 | 1,000 | 131,072 | Wrong Answer | 20 | 7,640 | 485 | 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 ... | def insert(array, index):
value = array[index]
for i in range(index-1, -1, -1):
if array[i] < value:
array[i] = value
break
array[i + 1] = array[i]
else:
array[0] = value
def insertion_sort(array, log=False):
for i in range(len(array)):
insert(arr... | s672162213 | Accepted | 30 | 8,140 | 489 | def insert(array, index):
value = array[index]
for i in range(index - 1, -1, -1):
if array[i] < value:
array[i+1] = value
break
array[i + 1] = array[i]
else:
array[0] = value
def insertion_sort(array, log=False):
for i in range(len(array)):
insert... |
s844459176 | p03814 | u459697504 | 2,000 | 262,144 | Wrong Answer | 73 | 16,300 | 674 | 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... | #! /usr/bin/python3
# A to Z String
s = input()
list_s = list(s)
test = True
def length_AZ(l):
len_l = len(l)
index_A = []
index_Z = []
for i in range(len_l):
if l[i] == 'A':
index_A.append(i)
elif l[i] == 'Z':
index_Z.append(i)
if test:
pri... | s786947603 | Accepted | 55 | 12,792 | 675 | #! /usr/bin/python3
# A to Z String
s = input()
list_s = list(s)
test = False
def length_AZ(l):
len_l = len(l)
index_A = []
index_Z = []
for i in range(len_l):
if l[i] == 'A':
index_A.append(i)
elif l[i] == 'Z':
index_Z.append(i)
if test:
pr... |
s875393969 | p03854 | u383551754 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 160 | 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('erase', '').replace('eraser', '').replace('dream', '').replace('dreamer', '')
print(s)
if s == '':
print('YES')
else:
print('NO')
| s362276180 | Accepted | 18 | 3,188 | 151 | s = input().replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '')
if s == '':
print('YES')
else:
print('NO')
|
s621036917 | p03485 | u692632484 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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())
if (a+b)%2==0 :
print((a+b)/2)
else:
print((a+b)/2+1) | s414844222 | Accepted | 17 | 2,940 | 86 | a,b=map(int,input().split())
if (a+b)%2==0 :
print((a+b)//2)
else:
print((a+b)//2+1) |
s682576715 | p02273 | u196653484 | 2,000 | 131,072 | Wrong Answer | 20 | 5,620 | 654 | Write a program which reads an integer _n_ and draws a Koch curve based on recursive calles of depth _n_. The Koch curve is well known as a kind of You should start (0, 0), (100, 0) as the first segment. | class Dot:
x=0.0
y=0.0
def __init__(self,x,y):
self.x=x
self.y=y
def __lt__(self,other):
return self.x < other.x
def print(self):
print("{} {}".format(self.x,self.y))
def divide_line_n(a,b,dots,n):
dx=abs(a.x-b.x)
dy=abs(a.y-b.y)
for i in range(1,... | s077169253 | Accepted | 40 | 6,524 | 950 | import math
class Dot:
x=0.0
y=0.0
def __init__(self,x,y):
self.x=x
self.y=y
def __lt__(self,other):
return self.x < other.x
def print(self):
x=self.x
y=self.y
print("{:.8f} {:.8f}".format(x,y))
def kock(n,a,b,dots):
if n == 0:
retur... |
s124760540 | p02274 | u148628801 | 1,000 | 131,072 | Wrong Answer | 20 | 7,684 | 831 | For a given sequence $A = \\{a_0, a_1, ... a_{n-1}\\}$, the number of pairs $(i, j)$ where $a_i > a_j$ and $i < j$, is called the number of inversions. The number of inversions is equal to the number of swaps of Bubble Sort defined in the following program: bubbleSort(A) cnt = 0 // the number of inver... | import sys
a_max = 10000000000
def merge_sort(A):
n = len(A)
num_swap = 0
if n > 1:
m = n // 2
num_swap0, A0 = merge_sort(A[0:m])
num_swap1, A1 = merge_sort(A[m:])
num_swap += num_swap0 + num_swap1
n1 = len(A0)
A0.append(a_max)
A1.append(a_max)
i = 0
j = 0
for k in range(n):
if A0... | s928562454 | Accepted | 1,360 | 30,092 | 832 | import sys
a_max = 10000000000
def merge_sort(A):
n = len(A)
num_swap = 0
if n > 1:
m = n // 2
num_swap0, A0 = merge_sort(A[0:m])
num_swap1, A1 = merge_sort(A[m:])
num_swap += num_swap0 + num_swap1
n1 = len(A0)
A0.append(a_max)
A1.append(a_max)
i = 0
j = 0
for k in range(n):
if A0... |
s439228915 | p00014 | u354053070 | 1,000 | 131,072 | Wrong Answer | 20 | 7,480 | 132 | Write a program which computes the area of a shape represented by the following three lines: $y = x^2$ $y = 0$ $x = 600$ It is clear that the area is $72000000$, if you use an integral you learn in high school. On the other hand, we can obtain an approximative area of the shape by adding up areas of many... | import sys
for line in sys.stdin:
d = int(line)
S = 0
for x in range(1, 600, d):
S += (x ** 2) * d
print(S) | s733353726 | Accepted | 20 | 7,568 | 132 | import sys
for line in sys.stdin:
d = int(line)
S = 0
for x in range(0, 600, d):
S += (x ** 2) * d
print(S) |
s459640225 | p03997 | u951750034 | 2,000 | 262,144 | Wrong Answer | 40 | 3,064 | 68 | 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) | s354853276 | Accepted | 39 | 3,064 | 69 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2) |
s461623341 | p03860 | u557523358 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | 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(''.join(c for c in input() if 'A' <= c <= 'Z')) | s905812000 | Accepted | 17 | 2,940 | 32 | print('A{}C'.format(input()[8])) |
s069616537 | p03469 | u617225232 | 2,000 | 262,144 | Wrong Answer | 25 | 8,808 | 32 | 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... | a = input()
print('2018'+a[4:6]) | s917020901 | Accepted | 28 | 9,020 | 31 | a = input()
print('2018'+a[4:]) |
s974071764 | p03050 | u500297289 | 2,000 | 1,048,576 | Wrong Answer | 146 | 2,940 | 187 | Snuke received a positive integer N from Takahashi. A positive integer m is called a _favorite number_ when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod m holds. Find all favorite numbers and print the sum of those. | N = int(input())
import math
ans = 0
for k in range(1, int(math.sqrt(N) + 1)):
if N % k == 0 and k ** 2 != N:
ans += N // k - 1
print(ans - 1)
| s871970598 | Accepted | 336 | 3,060 | 220 | N = int(input())
import math
ans = 0
for k in range(1, int(math.sqrt(N) + 1)):
m = N // k - 1
if m != 0:
if N % k == 0 and N // m == N % m:
ans += m
print(ans)
|
s728873555 | p04045 | u614984376 | 2,000 | 262,144 | Wrong Answer | 27 | 2,940 | 206 | 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()))
print(d)
for i in range(n,10001):
for x in d:
if str(x) in str(i):
break
else:
print(i)
break | s212798172 | Accepted | 98 | 2,940 | 198 | n,k=map(int,input().split())
d=list(map(int,input().split()))
for i in range(n,100001):
for x in d:
if str(x) in str(i):
break
else:
print(i)
break |
s801508744 | p03997 | u456416458 | 2,000 | 262,144 | Wrong Answer | 30 | 9,108 | 91 | 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 = input()
b = input()
h = input()
answer = ((int(a) + int(b)) * int(h)) / 2
print(answer) | s618222969 | Accepted | 31 | 9,124 | 96 | a = input()
b = input()
h = input()
answer = ((int(a) + int(b)) * int(h)) / 2
print(int(answer)) |
s012757036 | p03997 | u416758623 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | 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) | s580163129 | Accepted | 17 | 2,940 | 68 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2) |
s495703995 | p03962 | u288948615 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 46 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he migh... | nums = list(input().split())
print(set(nums)) | s136777614 | Accepted | 17 | 2,940 | 51 | nums = list(input().split())
print(len(set(nums))) |
s974907804 | p03399 | u345136423 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 70 | 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,b,c,d = [int(input()) for _ in range(4)]
print(max(a,b) + max(c,d)) | s969588492 | Accepted | 17 | 2,940 | 71 | a,b,c,d = [int(input()) for _ in range(4)]
print(min(a,b) + min(c,d))
|
s679178733 | p03485 | u519721530 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | 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. | # ABC082_A
a, b = map(int, input().split())
print((a+b)/2 if (a+b)%2==0 else (a+b+1)/2) | s588367573 | Accepted | 17 | 2,940 | 86 | a, b = map(int, input().split())
print(int((a+b)/2) if (a+b)%2==0 else int((a+b+1)/2)) |
s719676858 | p03712 | u642528832 | 2,000 | 262,144 | Wrong Answer | 27 | 9,124 | 137 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | H,W = map(int,(input().split()))
a = [input() for _ in range(H)]
print('#'*(W+1))
for i in a:
print('#'+str(i)+"#")
print('#'*(W+1)) | s828780408 | Accepted | 28 | 9,152 | 137 | H,W = map(int,(input().split()))
a = [input() for _ in range(H)]
print('#'*(W+2))
for i in a:
print('#'+str(i)+"#")
print('#'*(W+2)) |
s193658415 | p03720 | u835482198 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 202 | There are N cities and M roads. The i-th road (1โคiโคM) connects two cities a_i and b_i (1โคa_i,b_iโคN) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | n, m = map(int, input().split())
g = [[]] * n
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
g[a] += [b]
g[b] += [a]
for i in range(n):
print(len(set(g[i])))
| s761983335 | Accepted | 17 | 3,060 | 207 | n, m = map(int, input().split())
ret = [[] for i in range(n + 1)]
for i in range(m):
a, b = map(int, input().split())
ret[a] += [b]
ret[b] += [a]
for i in range(1, n + 1):
print(len(ret[i]))
|
s856429256 | p02326 | u837811962 | 1,000 | 131,072 | Wrong Answer | 20 | 7,780 | 617 | Given a matrix (H ร W) which contains only 1 and 0, find the area of the largest square matrix which only contains 0s. | H,W = map(int,input().split())
tile = [[0 for i in range(W)] for i in range(H)]
buf = [[1 for i in range(W)] for i in range(H)]
maxsquare = 0
for i in range(H):
tile[i] = list(map(int,input().split()))
for i in range(1,H):
for j in range(1,W):
if tile[i-1][j]==1 or tile[i][j-1]==1 or tile[i-1][j-1]==1... | s049669724 | Accepted | 2,190 | 58,504 | 460 | H,W = map(int,input().split())
tile = [[0 for i in range(W)] for i in range(H)]
buf = [[0 for i in range(W+1)] for i in range(H+1)]
maxsquare = 0
for i in range(H):
tile[i] = list(map(int,input().split()))
for i in range(1,H+1):
for j in range(1,W+1):
if tile[i-1][j-1]!=1:
buf[i][j] = min(... |
s147442981 | p03352 | u342051078 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 139 | 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. | import sys
x = int(input())
mx = 0
for i in range(2,33):
if i*i <= x:
mx = max(mx,i*i)
else :
sys.exit(0)
print(mx) | s291230544 | Accepted | 18 | 2,940 | 150 | x = int(input())
ans = 1
for i in range(2,41):
for j in range(2,11):
if x < i**j:
break
ans = max(ans,i**j)
print(ans) |
s676906098 | p03971 | u197300773 | 2,000 | 262,144 | Wrong Answer | 108 | 4,016 | 294 | 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())
ca,cb=0,0
s=input()
for i in range(n):
if s[i]=="a":
if ca<a+b:
print("Yes")
ca+=1
elif s[i]=="b":
if ca<a+b and cb<b:
print("Yes")
ca+=1;cb+=1
else: print("No")
else: print("No") | s509991100 | Accepted | 114 | 4,016 | 320 | n,a,b=map(int,input().split())
ca,cb=0,0
s=input()
for i in range(n):
if s[i]=="a":
if ca<a+b:
print("Yes")
ca+=1
else: print("No")
elif s[i]=="b":
if ca<a+b and cb<b:
print("Yes")
ca+=1;cb+=1
else: print("No")
else: print("No") |
s500099403 | p02612 | u962050670 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,100 | 32 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n % 1000) | s974135804 | Accepted | 29 | 9,168 | 78 | n = int(input())
if n % 1000 == 0:
print(0)
else:
print(1000 - (n % 1000)) |
s630113738 | p03608 | u029169777 | 2,000 | 262,144 | Wrong Answer | 656 | 16,044 | 2,841 | There are N towns in the State of Atcoder, connected by M bidirectional roads. The i-th road connects Town A_i and B_i and has a length of C_i. Joisino is visiting R towns in the state, r_1,r_2,..,r_R (not necessarily in this order). She will fly to the first town she visits, and fly back from the last town she visi... | from itertools import permutations
from scipy.sparse.csgraph import dijkstra as di
N,M,R=map(int,input().split())
r=list(map(int,input().split()))
dp=[[0 for _ in range(N)] for _ in range(N)]
for _ in range(M):
A,B,C=map(int,input().split())
if dp[A-1][B-1]==0 or dp[A-1][B-1]>C:
dp[A-1][B-1]=C
dp[B-1][A-1]... | s574354431 | Accepted | 621 | 15,756 | 2,839 | from itertools import permutations
from scipy.sparse.csgraph import dijkstra as di
N,M,R=map(int,input().split())
r=list(map(int,input().split()))
dp=[[0 for _ in range(N)] for _ in range(N)]
for _ in range(M):
A,B,C=map(int,input().split())
if dp[A-1][B-1]==0 or dp[A-1][B-1]>C:
dp[A-1][B-1]=C
dp[B-1][A-1... |
s922288931 | p03007 | u159228113 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 14,008 | 390 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | n = int(input())
x = list(map(int,input().split()))
#nmax = max(x)
#ans = 2*nmax-sum(x)
lst = []
while len(x) > 2:
mi = min(x)
ma = max(x)
lst.append(str(mi)+" "+str(ma))
del x[x.index(min(x))]
del x[x.index(max(x))]
x.append(mi - ma)
print(max(x) - min(x))
for i in range(len(lst)):
print(lst[i])
print(... | s624934844 | Accepted | 175 | 17,872 | 795 | n = int(input())
x = list(map(int,input().split()))
#nmax = max(x)
#ans = 2*nmax-sum(x)
lst = []
nmi = min(x)
nma = max(x)
del x[x.index(nmi)]
del x[x.index(nma)]
mainus = [i for i in x if i < 0]
plus = [i for i in x if i >= 0]
for i in mainus:
lst.append(str(nma)+" "+str(i))
nma -= i
for i in plus:
lst.app... |
s717562808 | p02397 | u382316013 | 1,000 | 131,072 | Wrong Answer | 40 | 7,560 | 131 | Write a program which reads two integers x and y, and prints them in ascending order. | while True:
x, y = [int(i) for i in input().split()]
if x == y == 0:
break
if x > y:
x, y = y, x
print(x, y) | s872511289 | Accepted | 50 | 7,544 | 146 | while True:
x, y = [int(i) for i in input().split()]
if x == y == 0:
break
if x > y:
x, y = y, x
print(x, y) |
s129188521 | p03861 | u314089899 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 86 | 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? | #48b
import math
a,b,x = map(int, input().split())
first = math.ceil(a/x)
end = b//x
| s463404539 | Accepted | 17 | 2,940 | 123 | #48b
a,b,x = map(int, input().split())
down = a//x
if down*x == a:
down -= 1
up = b//x
#print(up,down)
print(up - down) |
s005307444 | p03547 | u449555432 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 76 | In programming, hexadecimal notation is often used. In hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters `A`, `B`, `C`, `D`, `E` and `F` are used to represent the values 10, 11, 12, 13, 14 and 15, respectively. In this problem, you are given two letters X and Y. Each X and Y is `A`, `B`, `C`,... | a=list(input());print('>' if max(a)==a[0] else '<' if max(a)==a[1] else '=') | s437357706 | Accepted | 18 | 2,940 | 62 | a,b=input().split();print('>' if a>b else '<' if a<b else '=') |
s529592237 | p03816 | u759412327 | 2,000 | 262,144 | Wrong Answer | 67 | 20,892 | 78 | Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of... | N = int(input())
A = sorted(list(map(int,input().split())))
print(len(set(A))) | s202113689 | Accepted | 48 | 23,016 | 61 | N = int(input())
K = len(set(input().split()))
print(K+K%2-1) |
s672757674 | p02613 | u410943190 | 2,000 | 1,048,576 | Wrong Answer | 157 | 9,204 | 339 | 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`,... | li = [0] * 4
N = int(input())
for i in range(N):
result = input()
if result == "AC":
li[0] += 1
if result == "WA":
li[1] += 1
if result == "TLE":
li[2] += 1
if result == "RE":
li[3] += 1
line = "AC ร {0}\nWA ร {1}\nTLE ร {2}\nRE ร {3}".format(li[0], li[1], li[2], li[... | s842865281 | Accepted | 158 | 9,188 | 335 | li = [0] * 4
N = int(input())
for i in range(N):
result = input()
if result == "AC":
li[0] += 1
if result == "WA":
li[1] += 1
if result == "TLE":
li[2] += 1
if result == "RE":
li[3] += 1
line = "AC x {0}\nWA x {1}\nTLE x {2}\nRE x {3}".format(li[0], li[1], li[2], li[... |
s360860520 | p03479 | u023229441 | 2,000 | 262,144 | Wrong Answer | 30 | 9,016 | 115 | 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())
import bisect as bi
ans=1
for i in range(80):
if x*2<=y:
ans+=1
print(ans) | s802325633 | Accepted | 24 | 9,092 | 128 | x,y=map(int,input().split())
import bisect as bi
ans=1
for i in range(80):
if x*2<=y:
ans+=1
x*=2
print(ans) |
s273273129 | p04043 | u766407523 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | 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 ... | ABC = list(map(int, input().split()))
if ABC in [5, 5, 7]:
print('YES')
else:
print('NO') | s249447901 | Accepted | 17 | 2,940 | 113 | a = list(map(int, input().split()))
if sum(a) == 17 and 5 in a and 7 in a:
print('YES')
else:
print('NO') |
s198549105 | p03861 | u252964975 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 91 | You are given nonnegative integers a and b (a โค b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | import math
a,b,x=map(int, input().split())
A=math.ceil(a/x)
B=math.floor(b/x)
print(A-B+1) | s813182614 | Accepted | 17 | 2,940 | 53 | a,b,x=map(int, input().split())
print(b//x-(a-1)//x)
|
s533540294 | p03407 | u995914787 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 112 | 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. | S = str(input())
X = S.split()
A = X[0]
B = X[1]
C = X[2]
if (A + B) < C:
print("Yes")
else:
print("No") | s641453460 | Accepted | 17 | 2,940 | 128 | S = str(input())
X = S.split()
A = int(X[0])
B = int(X[1])
C = int(X[2])
if C <= (A + B):
print("Yes")
else:
print("No") |
s147598151 | p04044 | u300778480 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 146 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | try:
N, L = map(int, input().split())
l = []
for i in range(N):
l.append(input())
l_ = sorted(l)
print(l_)
except EOFError:
pass | s666156279 | Accepted | 18 | 3,060 | 155 | try:
N, L = map(int, input().split())
l = []
for i in range(N):
l.append(input())
l_ = sorted(l)
print(''.join(l_))
except EOFError:
pass |
s965529458 | p02612 | u382169090 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,144 | 63 | 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())
if n%1000==0:
print(0)
else:
print(n%1000) | s228840913 | Accepted | 32 | 9,152 | 70 | n = int(input())
if n%1000==0:
print(0)
else:
print(1000 - n%1000) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.