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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s901809319 | p03371 | u888100977 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 341 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | a,b,c,x,y = map(int,input().split())
p = max(x,y)
q = min(x,y)
ans = 0
if a+b>=2*c:
if p == x:
ans += 2*c*q + min(a,2*c)*(p-q)
else:
ans += 2*c*q + min(b,2*c)*(p-q)
else:
if p == x:
ans += (a+b)*q + min(a,2*c)*(p-q)
else:
ans += (a+b)*q + min(b,2*c)*(p-q)
print(... | s214979593 | Accepted | 17 | 3,064 | 343 | a,b,c,x,y = map(int,input().split())
p = max(x,y)
q = min(x,y)
ans = 0
if a+b>=2*c:
if p == x:
ans += 2*c*q + min(a,2*c)*(p-q)
else:
ans += 2*c*q + min(b,2*c)*(p-q)
else:
if p == x:
ans += (a+b)*q + min(a,2*c)*(p-q)
else:
ans += (a+b)*q + min(b,2*c)*(p-q)
print(... |
s655171935 | p02363 | u165578704 | 1,000 | 131,072 | Wrong Answer | 30 | 6,360 | 1,114 | # -*- coding: utf-8 -*-
import sys
from copy import deepcopy
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')
def warshall_floyd(N: int, graph... | s514413224 | Accepted | 510 | 7,244 | 1,211 | # -*- coding: utf-8 -*-
import sys
from copy import deepcopy
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')
def warshall_floyd(N: int, graph... | |
s398015148 | p03385 | u964904181 | 2,000 | 262,144 | Wrong Answer | 118 | 27,096 | 113 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | import numpy as np
S=input()
s = [st for st in S]
if len(np.unique(s)) == 3:
print("YES")
else:
print("NO") | s432924178 | Accepted | 119 | 27,108 | 113 | import numpy as np
S=input()
s = [st for st in S]
if len(np.unique(s)) == 3:
print("Yes")
else:
print("No") |
s569004824 | p03836 | u259861571 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 372 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | # AtCoder
sx, sy, tx, ty = map(int, input().split())
path = []
dx = tx-sx
dy = ty-sy
# first
path.append('U'*dy)
path.append('R'*dx)
# second
path.append('D'*dy)
path.append('L'*dx)
# third
path.append('L')
path.append('U'*(dy+1))
path.append('R'*(dx+1))
# forth
path.append('R')
path.append('D'*(dy+1))
path.append... | s380449827 | Accepted | 18 | 3,064 | 389 | # AtCoder
sx, sy, tx, ty = map(int, input().split())
path = []
dx = tx-sx
dy = ty-sy
# first
path.append('U'*dy)
path.append('R'*dx)
# second
path.append('D'*dy)
path.append('L'*dx)
# third
path.append('L')
path.append('U'*(dy+1))
path.append('R'*(dx+1))
path.append('D')
# forth
path.append('R')
path.append('D'*(d... |
s743068244 | p03416 | u292810930 | 2,000 | 262,144 | Wrong Answer | 122 | 2,940 | 138 | Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. | A, B = map(int, input().split())
answer = 0
for i in range(A,B+1):
if list(str(i)) == list(str(i)):
answer += 1
print(answer)
| s419567283 | Accepted | 123 | 2,940 | 146 | A, B = map(int, input().split())
answer = 0
for i in range(A,B + 1):
if list(str(i)) == list(str(i))[::-1]:
answer += 1
print(answer)
|
s929605856 | p03712 | u102242691 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 150 | 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())
s = [input() for i in range(h)]
print("#" * w * 2)
for i in range(h):
print("#" + s[i] + "#")
print("#" * w * 2)
| s840738965 | Accepted | 18 | 2,940 | 125 |
h,w = map(int,input().split())
l = "#"*(w+2)
print(l)
for i in range(h):
tmp = input()
print("#"+tmp+"#")
print(l)
|
s199625527 | p03971 | u592743763 | 2,000 | 262,144 | Wrong Answer | 77 | 9,216 | 432 | 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... | datalist=list(map(int,input().split()))
N,A,B=datalist[0],datalist[1],datalist[2]
strings=str(input())
na,nb=0,0
for i in range(len(strings)):
if strings[i]=="a":
if na + nb < A+B:
print("YES")
na += 1
else:
print("NO")
elif strings[i]=="b":
if na + nb < A+B:
if nb <= B:
... | s149403321 | Accepted | 61 | 10,684 | 497 | datalist=list(map(int,input().split()))
N, A, B = datalist[0], datalist[1], datalist[2]
strings=str(input())
na,nb=0,0
out=[]
for i in range(len(strings)):
if strings[i]=="a":
if na + nb < A+B:
out.append("Yes")
na += 1
else:
out.append("No")
elif strings[i]=="b":
if na + nb < A+B:
... |
s480436195 | p03251 | u016901717 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 244 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | n,m,X,Y=map(int,input().split())
x=sorted(map(int,input().split()))
y=sorted(map(int,input().split()))
if Y-X>=1:
for i in range(X+1,Y):
if x[n-1]<i and y[0]>=i:
print("War")
exit()
else:
print("No War")
| s101831473 | Accepted | 17 | 3,060 | 233 | n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x_max=max(x)
y_min=min(y)
if (y_min-x_max > 0) and (Y-X > 0) and (X<y_min) and (x_max<Y):
print("No War")
else:
print("War")
|
s830133646 | p03160 | u852798899 | 2,000 | 1,048,576 | Wrong Answer | 228 | 13,928 | 248 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | n = int(input())
h = list(map(int, input().split()))
dp = [0 for i in range(n)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print(dp[i])
print(dp[n-1])
| s639914569 | Accepted | 131 | 13,928 | 223 | n = int(input())
h = list(map(int, input().split()))
dp = [0 for i in range(n)]
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print(dp[n-1])
|
s213346149 | p03855 | u919730120 | 2,000 | 262,144 | Wrong Answer | 1,216 | 37,924 | 1,626 | There are N cities. There are also K roads and L railways, extending between the cities. The i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities. No two roads connect the same pair of cities. Similarly, no two railways connect the s... | #UNIONFIND
class UnionFind:
def __init__(self, n):
self.table = [-1] * n
def _root(self, x):
if self.table[x] < 0:
return x
else:
self.table[x] = self._root(self.table[x])
return self.table[x]
def find(self, x, y)... | s229276244 | Accepted | 1,223 | 48,552 | 1,645 | #UNIONFIND
class UnionFind:
def __init__(self, n):
self.table = [-1] * n
def _root(self, x):
if self.table[x] < 0:
return x
else:
self.table[x] = self._root(self.table[x])
return self.table[x]
def find(self, x, y)... |
s093165903 | p03371 | u626337957 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 200 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | A, B, AB, X, Y = map(int, input().split())
ans1 = A*X + B*Y
ans2 = 0
ans3 = 0
if X >= Y:
ans2 = A*(X-Y) + AB*Y
ans3 = AB*X
else:
ans2 = A*(Y-X) + AB*X
ans3 = AB*Y
print(min(ans1, ans2, ans3)) | s615318180 | Accepted | 17 | 3,060 | 209 | A, B, AB, X, Y = map(int, input().split())
ans1 = A*X + B*Y
ans2 = 0
ans3 = 0
if X >= Y:
ans2 = A*(X-Y) + AB*Y*2
ans3 = AB*X*2
else:
ans2 = B*(Y-X) + AB*X*2
ans3 = AB*Y*2
print(min(ans1, ans2, ans3))
|
s974990576 | p03378 | u170183831 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 178 | 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())
count1 = x
count2 = n - x
for a in map(int, input().split()):
if a < x:
count1 += 1
else:
count2 += 1
print(min(count1, count2))
| s568974656 | Accepted | 17 | 2,940 | 174 | n, m, x = map(int, input().split())
count1 = 0
count2 = 0
for a in map(int, input().split()):
if a < x:
count1 += 1
else:
count2 += 1
print(min(count1, count2))
|
s663147328 | p03957 | u821262411 | 1,000 | 262,144 | Wrong Answer | 23 | 3,064 | 119 | 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=str(input())
if s.find('C')>0 and s.find('C')>0 and s.find('C')<s.rfind('F'):
print('Yes')
else:
print('No')
| s789937335 | Accepted | 23 | 3,064 | 142 | s=str(input())
p=list('ABDEGHIJKLMNOPQRSTUVWXYZ')
for i in p:
s=s.replace(i,'')
if 'CF' in s:
print('Yes')
else:
print('No')
|
s986212832 | p03997 | u099918199 | 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) | s428447156 | Accepted | 27 | 9,164 | 72 | a = int(input())
b = int(input())
h = int(input())
print((a+b) * h // 2) |
s035615459 | p02646 | u614181788 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,180 | 179 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
ans = 0
if v == w:
pass
elif v>w and abs(a-b)//(v-w) <= t :
ans = 1
print(["No","Yes"][ans]) | s147758851 | Accepted | 23 | 9,192 | 231 | a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
ans = 0
if a == b:
ans = 1
if v == w:
ans = 0
elif v>w and abs(a-b)/(v-w) <= t :
ans = 1
if ans == 0:
print("NO")
else:
print("YES") |
s841500195 | p04044 | u780475861 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 111 | 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 = [int(i) for i in input().split()]
lst = []
for _ in range(n):
lst.append(input())
lst.sort()
print(lst) | s873409723 | Accepted | 17 | 3,060 | 139 | n,l = [int(i) for i in input().split()]
lst = []
for _ in range(n):
lst.append(input())
lst.sort()
s = ''
for i in lst:
s += i
print(s) |
s937972187 | p03606 | u940102677 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 96 | Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive). How many people are sitting at the theater now? | n = int(input())
s = 0
for i in range(n):
l, r = map(int, input().split())
s += r-l
print(s) | s427634088 | Accepted | 26 | 2,940 | 98 | n = int(input())
s = 0
for i in range(n):
l, r = map(int, input().split())
s += r-l+1
print(s) |
s012423517 | p03160 | u570545613 | 2,000 | 1,048,576 | Wrong Answer | 119 | 13,980 | 342 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | def frog(arr):
n=len(arr)
if n<=1:
return 0
dp=[0]*(n+1)
dp[2]=abs(arr[0]-arr[1])
if n==2:
return dp[2]
for i in range(3,n+1):
dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i-2]),dp[i-2]+abs(arr[i-1]-arr[i-3]))
return dp[n]
n=int(input())
arr=[int(i) for i in input... | s505600614 | Accepted | 132 | 13,928 | 207 | n=int(input())
arr=[int(i) for i in input().split()]
dp=[0]*(n+1)
dp[2]=abs(arr[0]-arr[1])
for i in range(3,n+1):
dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i-2]),dp[i-2]+abs(arr[i-1]-arr[i-3]))
print(dp[n])
|
s843973003 | p03433 | u323210830 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 117 | 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())
for x in range(A-1):
if (N-x)%500==0:
print("YES")
break
else:
print("NO") | s224195757 | Accepted | 17 | 2,940 | 78 | N=int(input())
A=int(input())
if N%500<=A:
print("Yes")
else:
print("No") |
s862195518 | p03131 | u989623817 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 431 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | k, a, b = map(int, input().split())
if a+2 > b:
print(1 + k)
exit()
roop_turn = a+2
if k < roop_turn-1:
print(1 + k)
exit()
ret = b
remaining = k - roop_turn-1
q, mod = divmod(remaining, 2)
ret += (b-a)*q + mod
print(ret)
| s760083435 | Accepted | 17 | 3,060 | 433 | k, a, b = map(int, input().split())
if a+2 > b:
print(1 + k)
exit()
roop_turn = a+2
if k < roop_turn-1:
print(1 + k)
exit()
ret = b
remaining = k - (roop_turn-1)
q, mod = divmod(remaining, 2)
ret += (b-a)*q + mod
print(ret)
|
s617932055 | p03737 | u288500098 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | s1,s2,s3 = map(str, input().split())
s1 = s1.upper()
s2 = s2.upper()
s3 = s3.upper()
print(s1[0],s2[0],s3[0]) | s656445649 | Accepted | 17 | 2,940 | 110 | s1,s2,s3 = map(str, input().split())
s1 = s1.upper()
s2 = s2.upper()
s3 = s3.upper()
print(s1[0]+s2[0]+s3[0]) |
s214172583 | p03845 | u816631826 | 2,000 | 262,144 | Wrong Answer | 31 | 9,328 | 467 | 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... | from collections import *
from itertools import *
from math import *
n=int(input())
a=sorted(list(map(int,input().split())))
b=list(Counter(a))
mod=7+10**9
if n%2==1:
if a[0]!=0:
print(0)
exit()
for i in range(1,n):
if ceil(i/2)*2!=a[i]:
print(0)
exit()
print(... | s685193572 | Accepted | 24 | 9,164 | 182 | N = int(input())
T = list(map(int, input().split()))
t = sum(T)
M = int(input())
S = [list(map(int, input().split())) for _ in range(M)]
for s in S:
print(t - T[s[0] - 1] + s[1]) |
s276930247 | p03369 | u835482198 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | s = input()
print(700 + 100 * len(s.replace('x', 'o')))
| s177787128 | Accepted | 17 | 2,940 | 56 | s = input()
print(700 + 100 * len(s.replace('x', '')))
|
s470129947 | p02272 | u662418022 | 1,000 | 131,072 | Wrong Answer | 20 | 5,624 | 913 | Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function. Merge(A, left, mid, right) n1 = mid - left; n2 = right - mid; create array L[0...n1], R[0...n2] for i = 0 to n1-1 do L[i] = A[left + i] ... | # -*- coding: utf-8 -*-
def merge(A, left, mid, right):
global cnt
n1 = mid - left
n2 = right - mid
L = [None]*(n1+1)
R = [None]*(n2+1)
for i in range(n1):
L[i] = A[left + i]
for i in range(n2):
R[i] = A[mid + i]
L[n1] = float('inf')
R[n2] = float('inf')
i = 0
... | s055953832 | Accepted | 4,200 | 66,732 | 788 | # -*- coding: utf-8 -*-
def merge(A, left, mid, right):
global cnt
n1 = mid - left
n2 = right - mid
L = A[left:left+n1]
R = A[mid:mid+n2]
L.append(float('inf'))
R.append(float('inf'))
i = 0
j = 0
for k in range(left, right):
cnt += 1
if L[i] <= R[j]:
... |
s925305747 | p00022 | u299798926 | 1,000 | 131,072 | Wrong Answer | 40 | 5,640 | 123 | Given a sequence of numbers a1, a2, a3, ..., an, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a _contiquous_ subsequence. | while(1):
a=[]
n = int(input())
if n==0:
break
a=[int(input()) for i in range(n)]
print(sum(a)) | s061062034 | Accepted | 1,710 | 188,644 | 316 | while(1):
a=[]
n = int(input())
if n==0:
break
a=[int(input()) for i in range(n)]
result=[]
for i in range(n):
result1=a[i]
result.append(result1)
for j in range(i+1,n):
result1=result1+a[j]
result.append(result1)
print(max(result)) |
s652901617 | p02422 | u656153606 | 1,000 | 131,072 | Wrong Answer | 30 | 7,536 | 361 | Write a program which performs a sequence of commands to a given string $str$. The command is one of: * print a b: print from the a-th character to the b-th character of $str$ * reverse a b: reverse from the a-th character to the b-th character of $str$ * replace a b p: replace from the a-th character to the b-t... | str = input().casefold()
q = int(input())
for i in range(q):
command = input().split()
a = int(command[1])
b = int(command[2])
if command[0] == "print":
print(str[a:b+1])
elif command[0] == 'reverse':
str = str[a] + str[a:b+1][::-1] + str[b+a:]
elif command[0] == "replace":
... | s108874622 | Accepted | 20 | 7,732 | 302 | s = input()
for i in range(int(input())):
cmd = input().split()
a,b = [int(x) for x in cmd[1:3]]
if cmd[0] == 'print':
print(s[a:b+1])
elif cmd[0] == 'reverse':
s = s[:a] + s[a:b+1][::-1] + s[b+1:]
elif cmd[0] == 'replace':
s = s[:a] + cmd[3] + s[b+1:] |
s572882376 | p03836 | u076917070 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 607 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | import sys
input = sys.stdin.readline
def main():
sx, sy, tx, ty = map(int, input().split())
ans = ""
for _ in range(ty-sy):
ans += "U"
for _ in range(tx-sx):
ans += "R"
for _ in range(ty-sy):
ans += "D"
for _ in range(tx-sx):
ans += "L"
ans += "L"
for... | s693426698 | Accepted | 24 | 3,064 | 607 | import sys
input = sys.stdin.readline
def main():
sx, sy, tx, ty = map(int, input().split())
ans = ""
for _ in range(ty-sy):
ans += "U"
for _ in range(tx-sx):
ans += "R"
for _ in range(ty-sy):
ans += "D"
for _ in range(tx-sx):
ans += "L"
ans += "L"
for... |
s179484188 | p03673 | u171065106 | 2,000 | 262,144 | Wrong Answer | 2,206 | 24,924 | 109 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n = int(input())
a = input().split()
b = []
for i in a:
b.append(i)
b.reverse()
print("".join(b))
| s381551304 | Accepted | 87 | 29,756 | 287 | n = 4
a = [1, 2, 3, 4]
n = int(input())
a = input().split()
if n % 2 == 0:
y = [a[j] for j in range(1, n, 2)][::-1]
z = [a[j] for j in range(0, n, 2)]
else:
y = [a[j] for j in range(0, n, 2)][::-1]
z = [a[j] for j in range(1, n, 2)]
print(" ".join(map(str, y + z)))
|
s163947638 | p02612 | u161857931 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,140 | 31 | 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) | s716006833 | Accepted | 28 | 9,144 | 62 | N = int(input())
print(1000 - N%1000 if N%1000 != 0 else "0") |
s206674519 | p02400 | u865138391 | 1,000 | 131,072 | Wrong Answer | 30 | 7,400 | 92 | Write a program which calculates the area and circumference of a circle for given radius r. | import math
a = float(input())
print("{0:.6f}, {1:.6f}".format(a*a*math.pi, a*2.0*math.pi)) | s045063922 | Accepted | 20 | 7,468 | 91 | import math
a = float(input())
print("{0:.6f} {1:.6f}".format(a*a*math.pi, a*2.0*math.pi)) |
s335356920 | p03478 | u136395536 | 2,000 | 262,144 | Wrong Answer | 47 | 3,628 | 303 | 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). | charN,charA,charB =input().split()
N = int(charN)
A = int(charA)
B = int(charB)
total = 0
for i in range(N):
tmp = 0
chartmp = str(i+1)
for j in range(len(chartmp)):
tmp = tmp + int(chartmp[j])
print(tmp)
if (tmp>=A and tmp <= B):
total = total + (i+1)
print(total) | s629845865 | Accepted | 41 | 3,316 | 218 | N,A,B = (int(i) for i in input().split())
total = 0
for i in range(1,N+1):
s = str(i)
num = 0
for j in range(len(s)):
num += int(s[j])
if num <= B and num >= A:
total += i
print(total) |
s918034763 | p03555 | u516272298 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | 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 = list(str(input()))
e = list(str(input()))
if a[0] == e[2] and a[1] == e[1] and a[2] == e[0]:
print("Yes")
else:
print("No") | s402217860 | Accepted | 17 | 2,940 | 89 | a = str(input())
e = str(input())
if a == e[::-1]:
print("YES")
else:
print("NO") |
s120467688 | p03369 | u668503853 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | s=input()
print(500 + s.count("o")*100) | s002790347 | Accepted | 17 | 2,940 | 40 | s=input()
print(700 + s.count("o")*100)
|
s174077606 | p04043 | u167140942 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 157 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a,b,c = map(int,input().split())
if (a == 5 or a == 7) and (b == 5 or b == 7) and (c == 5 or c == 7) and a + b + c == 17:
print("Yes")
else:
print("No") | s955916602 | Accepted | 17 | 3,064 | 157 | a,b,c = map(int,input().split())
if (a == 5 or a == 7) and (b == 5 or b == 7) and (c == 5 or c == 7) and a + b + c == 17:
print("YES")
else:
print("NO") |
s146599067 | p03731 | u768816323 | 2,000 | 262,144 | Wrong Answer | 161 | 26,708 | 183 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | N, Y = map(int, input().split())
t = list(int (i) for i in input().split())
w=0
for i in range(len(t)-1):
if t[i+1]-t[i]<=Y:
w+=t[i+1]-t[i]
else:
w+=Y
print(w) | s051098637 | Accepted | 161 | 26,832 | 188 | N, Y = map(int, input().split())
t = list(int (i) for i in input().split())
w=0
for i in range(len(t)-1):
if t[i+1]-t[i]<=Y:
w+=t[i+1]-t[i]
else:
w+=Y
w+=Y
print(w) |
s241987227 | p03644 | u172393892 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 317 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | n = int(input())
ans = 0
count = 0
best = 0
for i in range(n, 0, -1):
count = 0
x = i
while True:
if x % 2 == 0:
count += 1
x = x / 2
else:
break
if count > best:
best = count
ans = i
if count == 0:
ans = i
print(ans)
| s127217403 | Accepted | 17 | 3,060 | 316 | n = int(input())
ans = 0
count = 0
best = 0
for i in range(n, 0, -1):
count = 0
x = i
while True:
if x % 2 == 0:
count += 1
x = x / 2
else:
break
if count > best:
best = count
ans = i
if ans == 0:
ans = 1
print(ans)
|
s156988236 | p01131 | u024384030 | 8,000 | 131,072 | Wrong Answer | 30 | 6,248 | 413 | Alice さんは Miku さんに携帯電話でメールを送ろうとしている。 携帯電話には入力に使えるボタンは数字のボタンしかない。 そこで、文字の入力をするために数字ボタンを何度か押して文字の入力を行う。携帯電話の数字ボタンには、次の文字が割り当てられており、ボタン 0 は確定ボタンが割り当てられている。この携帯電話では 1 文字の入力が終わったら必ず確定ボタンを押すことになっている。 * 1: . , ! ? (スペース) * 2: a b c * 3: d e f * 4: g h i * 5: j k l * 6: m n o * 7: p q r s * 8: t u v ... | d = {'1': ['.', ',', '!', '?', ' '], '2': ['a', 'b', 'c'], '3': ['d', 'e', 'f'], '4': ['g', 'h', 'i'], '5': ['j', 'k', 'l'], '6': ['m', 'n', 'o'], '7': ['p', 'q', 'r', 's'], '8': ['t', 'u', 'v'], '9': ['w', 'x', 'y', 'z']}
n = int(input())
m = [input() for i in range(n)]
for mm in m:
l = [x for x in mm.split('0') ... | s285054434 | Accepted | 40 | 6,516 | 421 | d = {'1': ['.', ',', '!', '?', ' '], '2': ['a', 'b', 'c'], '3': ['d', 'e', 'f'], '4': ['g', 'h', 'i'], '5': ['j', 'k', 'l'], '6': ['m', 'n', 'o'], '7': ['p', 'q', 'r', 's'], '8': ['t', 'u', 'v'], '9': ['w', 'x', 'y', 'z']}
n = int(input())
m = [input() for i in range(n)]
for mm in m:
l = [x for x in mm.split('0') ... |
s049912535 | p02697 | u116233709 | 2,000 | 1,048,576 | Wrong Answer | 73 | 9,304 | 112 | You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing fi... | n,m=map(int,input().split())
if m==1:
print(1,2)
else:
for i in range(1,m+1):
print(i,m*2-i+1)
| s918576625 | Accepted | 82 | 9,280 | 127 | n,m=map(int,input().split())
l=m//2
for i in range(l):
print(1+i,1+2*l-i)
for j in range(m-l):
print(1+2*l+1+j,2*m+1-j) |
s829657749 | p03024 | u948618130 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 117 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | N = input()
num = 0
for i in N:
if i == 'x':
num += 1
if num >= 8:
print('No')
else:
print('Yes') | s021888043 | Accepted | 17 | 2,940 | 117 | N = input()
num = 0
for i in N:
if i == 'x':
num += 1
if num >= 8:
print('NO')
else:
print('YES') |
s378295966 | p03605 | u979554218 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | 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? | print(sum([c == '9' for c in input()])) | s457025881 | Accepted | 19 | 2,940 | 75 | if [1 for c in input() if c == '9']:
print('Yes')
else:
print('No') |
s590478090 | p04043 | u039360403 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | 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=input().split()
print('YES' if a.count('5')==1 and a.count('7')==2 else 'NO')
| s155156831 | Accepted | 17 | 2,940 | 81 | a=input().split()
print('YES' if a.count('5')==2 and a.count('7')==1 else 'NO')
|
s172002263 | p04031 | u021759654 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 179 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (... | n = int(input())
a_list = list(map(int, input().split()))
b = sum(a_list)//n
ans1 = sum([(a-b)^2 for a in a_list])
ans2 = sum([(a-b-1)^2 for a in a_list])
print(min(ans1,ans2)) | s735542258 | Accepted | 17 | 3,060 | 189 | n = int(input())
a_list = list(map(int, input().split()))
b = sum(a_list) // n
ans1 = sum([(a-b)**2 for a in a_list])
b += 1
ans2 = sum([(a-b)**2 for a in a_list])
print(min(ans1,ans2))
|
s615079313 | p03623 | u873269440 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | 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())
print('A' if abs(x-a) < abs(x-b) else print('B')) | s790628029 | Accepted | 17 | 2,940 | 75 | x,a,b = map(int,input().split())
print('A' if abs(x-a) < abs(x-b) else 'B') |
s776633773 | p03673 | u527261492 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 281 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n=6
a=[0,6,7,6,7,0]
b=[]
if n%2==0:
for i in range(n-1,0,-2):
b.append(a[i])
for j in range(0,n-1,2):
b.append(a[j])
print(b)
else:
for i in range(n-1,-1,-2):
b.append(a[i])
for j in range(1,n-1,2):
b.append(a[i])
print(b)
| s319772724 | Accepted | 187 | 26,020 | 312 | n=int(input())
a=list(map(int,input().split()))
b=[]
if n%2==0:
for i in range(n-1,0,-2):
b.append(a[i])
for j in range(0,n-1,2):
b.append(a[j])
print(*b)
else:
for i in range(n-1,-1,-2):
b.append(a[i])
for j in range(1,n-1,2):
b.append(a[j])
print(*b)
|
s690162511 | p03543 | u864453204 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 303 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? |
x=input(int)
x=str(x)
if x[0]==x[1]:
if x[1]==x[2]:
print("Yes")
elif x[1]!=x[2]:
print("No")
elif x[0]!=x[1]:
if x[1]==x[2]:
if x[2]==x[3]:
print("Yes")
elif x[2]!=x[3]:
print("No")
elif x[1]!=x[2]:
print("No")
| s272806440 | Accepted | 17 | 3,060 | 296 |
x=str(input())
if x[0]==x[1]:
if x[1]==x[2]:
print("Yes")
elif x[1]!=x[2]:
print("No")
elif x[0]!=x[1]:
if x[1]==x[2]:
if x[2]==x[3]:
print("Yes")
elif x[2]!=x[3]:
print("No")
elif x[1]!=x[2]:
print("No")
|
s869848152 | p03555 | u950708010 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 131 | 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. | from sys import stdin
a = stdin.readline().rstrip()
b = stdin.readline().rstrip()
if b[::-1] == a:
print('Yes')
else:
print('No') | s073962820 | Accepted | 18 | 2,940 | 147 | from sys import stdin
a = stdin.readline().rstrip()
b = stdin.readline().rstrip()
if b[::-1] == a and a[::-1] ==b:
print('YES')
else:
print('NO') |
s318409356 | p03352 | u113971909 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 55 | 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. | a=int(input())
import math
b=int(math.sqrt(a))
print(b) | s799362168 | Accepted | 17 | 2,940 | 188 | X = int(input())
if X != 1:
A =[]
for b in range(1,int(X**0.5)+1):
for p in range(2,X):
if b**p > X:
A.append(b**(p-1))
break
print(max(A))
else:
print(1) |
s652071204 | p03673 | u919633157 | 2,000 | 262,144 | Wrong Answer | 179 | 26,172 | 199 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n=int(input())
a=list(input().split())
even,odd=[],[]
for i in range(n):
if i%2==0:even+=[a[i]]
else:odd+=[a[i]]
if n%2==0:print(*odd[::-1]+even,sep='')
else:print(*even[::-1]+odd,sep='')
| s878442383 | Accepted | 177 | 24,516 | 178 | from collections import deque
n=int(input())
a=list(input().split())
que=deque()
for i in range(n):
if n%2==i%2:que.append(a[i])
else:que.appendleft(a[i])
print(*que)
|
s730526273 | p03455 | u506549878 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 90 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | n, m = map(int, input().split())
if (n*m)%2 == 2:
print('Even')
else:
print('Odd') | s408362764 | Accepted | 17 | 2,940 | 84 | k, s = map(int, input().split())
if (k*s)%2==0:
print('Even')
else:
print('Odd') |
s673445631 | p03139 | u075155299 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 106 | 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())
m=0
s=0
if a>b:
m=a
else:
m=b
if a+b>n:
s=a+b-n
print(m,s)
| s201883194 | Accepted | 17 | 2,940 | 107 | n,a,b=map(int,input().split())
m=0
s=0
if a<b:
m=a
else:
m=b
if a+b>n:
s=a+b-n
print(m,s)
|
s337870341 | p03351 | u533679935 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 91 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a,b,c,d=map(int,input().split())
if a-b <d or a-c <d:
print('yes')
else:
print('No')
| s217219551 | Accepted | 17 | 2,940 | 123 | a,b,c,d=map(int,input().split())
if abs(a-b) <= d and abs(b-c) <= d or abs(a-c) <= d:
print('Yes')
else:
print('No')
|
s919388670 | p03657 | u800610991 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 141 | 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(a,b)
c = 0
if a/3 == 0 or b/3 == 0 or (a+b)/3 ==0:
print('Possible')
else:
print('Impossible')
| s513401818 | Accepted | 17 | 2,940 | 142 | a,b = map(int,input().split())
#print(a,b)
#c = 0
if a%3 == 0 or b%3 == 0 or (a+b)%3 ==0:
print('Possible')
else:
print('Impossible')
|
s093722545 | p03447 | u279493135 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | 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 = int(input())
a = int(input())
b = int(input())
print(X-a-b*(X-a)//b) | s896205899 | Accepted | 17 | 2,940 | 72 | X = int(input())
a = int(input())
b = int(input())
print(X-a-(X-a)//b*b) |
s479413526 | p02393 | u027634846 | 1,000 | 131,072 | Wrong Answer | 30 | 7,516 | 59 | Write a program which reads three integers, and prints them in ascending order. | num = list(map(int, input().split()))
num.sort()
print(num) | s856572635 | Accepted | 20 | 7,644 | 78 | num = list(map(int, input().split()))
num.sort()
print(' '.join(map(str,num))) |
s379694057 | p03943 | u373529207 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 111 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | v = list(map(int, input().split()))
v = sorted(v)
if v[0]+v[1] == v[2]:
print("YES")
else:
print("NO")
| s381582183 | Accepted | 17 | 2,940 | 111 | v = list(map(int, input().split()))
v = sorted(v)
if v[0]+v[1] == v[2]:
print("Yes")
else:
print("No")
|
s958002514 | p03473 | u580362735 | 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? | M = int(input())
print(24-M) | s470349977 | Accepted | 17 | 2,940 | 30 | M = int(input())
print(48 - M) |
s727574751 | p03943 | u395894569 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a,b,c=map(int,input().split())
if a+b==c or b+c==a or a+c==b:
print('YES')
else:
print('NO')
| s270226415 | Accepted | 17 | 2,940 | 97 | a,b,c=map(int,input().split())
if a+b==c or b+c==a or a+c==b:
print('Yes')
else:
print('No')
|
s569664005 | p03386 | u002459665 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 593 | 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. | def main():
a, b, k = map(int, input().split())
ans = set()
for i in range(k):
x = a + i
if x <= b:
ans.add(x)
y = b - i
if a <= y:
ans.add(y)
for i in sorted(list(ans)):
print(i)
def main2():
a, b, k = map(int, input().split())
... | s880236904 | Accepted | 19 | 3,064 | 601 | def main():
a, b, k = map(int, input().split())
ans = set()
for i in range(k):
x = a + i
if x <= b:
ans.add(x)
y = b - i
if a <= y:
ans.add(y)
for i in sorted(list(ans)):
print(i)
def main2():
a, b, k = map(int, input().split())
... |
s591086308 | p03474 | u934788990 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 162 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | a,b=map(int,input().split())
s = input()
if len(s)==a+b+1 and s[a] == '-' and s[a:]=="0123456789" and s[:b]=="0123456789":
print('Yes')
else:
print('No') | s499977963 | Accepted | 19 | 2,940 | 167 | a,b=map(int,input().split())
p=input()
frag=True
if len(p)!=a+b+1 or p.count("-")!=1:
frag=False
if p[a]!="-":
frag=False
print("Yes" if frag==True else "No")
|
s906583834 | p03448 | u668503853 | 2,000 | 262,144 | Wrong Answer | 53 | 3,060 | 207 | 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())
ans= 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
s = 500*i + 100*j + 50*j
if s==x:
ans+=1
print(ans) | s838458650 | Accepted | 55 | 3,064 | 208 | a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans= 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
s = 500*i + 100*j + 50*k
if s==x:
ans+=1
print(ans)
|
s113826166 | p03434 | u564368158 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 167 | 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())
a = list(map(int, input().split()))
a.sort()
x = y = 0
for i, j in enumerate(a):
if i%2 == 0:
x += j
else:
y += j
print(x - y) | s199558425 | Accepted | 17 | 2,940 | 181 | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
x = y = 0
for i, j in enumerate(a):
if i%2 == 0:
x += j
else:
y += j
print(x - y) |
s522277015 | p02831 | u419963262 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 302 | Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be ... | def gcd(a,b):
x=int(max(a,b))
y=int(min(a,b))
if x%y==0:
return y
else:
while x%y!=0:
z=x%y
x=y
y=z
else:
return z
a,b = map(int, input().split())
if a<b:
L=a
S=b
print((a*b)/gcd(L,S))
elif a>b:
L=b
S=a
print((a*b)/gcd(L,S))
else:
print(a) | s251990111 | Accepted | 17 | 3,060 | 191 | def GCD(a,b):
c=b//a
d=b%a
if d==0:
return a
else:
return GCD(d,a)
A,B=map(int,input().split())
if A>B:
a=A
b=B
else:
a=B
b=A
print(int(a*b/GCD(a,b))) |
s141884632 | p03693 | u607074939 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | 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())
s = 10*g+b
if(s%4==0):
print("Yes")
else:
print("No") | s242656300 | Accepted | 17 | 2,940 | 99 | r , g , b = map(int, input().split())
s = 10*g+b
if(s%4==0):
print("YES")
else:
print("NO") |
s332219345 | p03563 | u322422986 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 117 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | n = int(input())
k = int(input())
v = 1
for i in range(n):
if 2*v < v + k:
v = 2*v
else:
v = v+k
print(v) | s323777981 | Accepted | 18 | 2,940 | 54 | old = int(input())
new = int(input())
print(2*new-old) |
s493209381 | p03044 | u556589653 | 2,000 | 1,048,576 | Wrong Answer | 640 | 49,404 | 435 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | from collections import deque
N = int(input())
g = [[] for i in range(N)]
for i in range(N-1):
u,v,w = map(int,input().split())
g[u-1].append([v-1,w])
g[v-1].append([u-1,w])
q = deque([])
ans = [-1] * N
q.append(0)
while len(q) > 0:
e = q.popleft()
for i in g[e]:
if ans[i[0]] > -1:
continue
ans[... | s035843373 | Accepted | 782 | 46,740 | 488 | from collections import deque
N = int(input())
g = [[] for i in range(N)]
for i in range(N-1):
u,v,w = map(int,input().split())
g[u-1].append([v-1,w])
g[v-1].append([u-1,w])
q = deque()
check = [0] * N
check[0] = 1
q.append(0)
ans = [-1] * N
ans[0] = 0
while len(q) > 0:
e = q.popleft()
for i,j in g[e]:
... |
s695195102 | p03502 | u813238682 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 223 | 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. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
N = int(input())
n = N
sumup = 0
while N != 0:
print(N % 10)
sumup += (N % 10)
N = N // 10
if n % sumup == 0:
print('Yes')
else:
print('No') | s671986259 | Accepted | 17 | 2,940 | 224 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
N = int(input())
n = N
sumup = 0
while N != 0:
#print(N % 10)
sumup += (N % 10)
N = N // 10
if n % sumup == 0:
print('Yes')
else:
print('No') |
s045583128 | p03469 | u629350026 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 44 | 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... | ds=str(input())
ds=ds.replace("2017","2018") | s987487040 | Accepted | 17 | 2,940 | 54 | ds=str(input())
ds=ds.replace("2017","2018")
print(ds) |
s119416590 | p03494 | u270962921 | 2,000 | 262,144 | Time Limit Exceeded | 2,108 | 3,060 | 234 | 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. | import math
N = int(input())
a = list(map(int, input().split()))
number = 0
sign = True
while sign:
for x in a:
if x % 2 != 0:
sign = False
print(number)
break
else:
pass
number += 1
| s498359011 | Accepted | 19 | 3,060 | 235 | import math
N = int(input())
a = list(map(int, input().split()))
number = 0
sign = True
while sign:
for i in range(N):
if a[i] % 2 != 0:
sign = False
print(number)
break
else:
a[i] /= 2
number += 1
|
s699542103 | p03394 | u532966492 | 2,000 | 262,144 | Wrong Answer | 156 | 7,036 | 346 | Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers. She thinks that a set S = \\{a_{1}, a_{2}, ..., a_{N}\\} of **distinct** positive integers is called **special** if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of t... | def main():
from fractions import gcd
n=int(input())
for i in range(n-2):
n_2=n-2-i
n_3=i+1
wa=n_2*2+n_3*3
print(n_2,n_3,wa)
for j in range(1,30000):
if (n_3*3+j)%2==0 and (n_2*2+j)%3==0 and gcd(wa,j)>=2:
print(*([2]*n_2+[3]*n_3+[j]))
... | s921441984 | Accepted | 40 | 4,560 | 779 | def main():
n=int(input())
if n==3:
print(2,5,63)
return 0
ans=[2,3]
cnt=0
i=10
while cnt<n-4:
if i%2==0 or i%3==0:
ans.append(i)
cnt+=1
i+=1
a=sum(ans)
if n==20000:
ans.pop()
ans.pop()
ans.append(8)
... |
s472258796 | p00100 | u661290476 | 1,000 | 131,072 | Wrong Answer | 40 | 8,120 | 333 | There is data on sales of your company. Your task is to write a program which identifies good workers. The program should read a list of data where each item includes the employee ID _i_ , the amount of sales _q_ and the corresponding unit price _p_. Then, the program should print IDs of employees whose total sales pr... | from collections import defaultdict as dd
while True:
n=int(input())
if n==0:
break
data=dd(int)
for i in range(n):
a,b,c=map(int,input().split())
data[a]+=b*c
f=False
for i,j in data.items():
if j>=1000000:
print(i)
f=True
if f:
... | s378250559 | Accepted | 30 | 7,812 | 331 | while True:
n = int(input())
if n == 0:
break
emp = [0] * 4001
used = set()
for i in range(n):
e, p, q = map(int, input().split())
emp[e] += p * q
if 1000000 <= emp[e] and e not in used:
print(e)
used.add(e)
if len(used) == 0:
print... |
s122235574 | p03555 | u015318452 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 826 | 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. | import math
def A():
a, b = [int(x) for x in input().split()]
print(math.ceil((a + b)/2))
def B():
a = ''.join(sorted(list(input()), key=lambda x:ord(x)))
b = ''.join(sorted(list(input()), key=lambda x:-ord(x)))
if a < b:
print('Yes')
else:
print('No')
def C():
N = input()... | s050360100 | Accepted | 17 | 3,064 | 826 | import math
def A():
a, b = [int(x) for x in input().split()]
print(math.ceil((a + b)/2))
def B():
a = ''.join(sorted(list(input()), key=lambda x:ord(x)))
b = ''.join(sorted(list(input()), key=lambda x:-ord(x)))
if a < b:
print('Yes')
else:
print('No')
def C():
N = input()... |
s942059554 | p03486 | u126823513 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 187 | 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. | str_s = input()
str_t = input()
str_s_d = sorted(str_s)
str_t_d = sorted(str_t, reverse=True)
print(str_s_d)
print(str_t_d)
if str_s_d < str_t_d:
print("Yes")
else:
print("No") | s124194794 | Accepted | 17 | 2,940 | 156 | str_s = input()
str_t = input()
str_s_d = sorted(str_s)
str_t_d = sorted(str_t, reverse=True)
if str_s_d < str_t_d:
print("Yes")
else:
print("No") |
s569354353 | p03448 | u226179530 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 904 | 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... | import re
import sys
def i_input(): return int(input())
def s_input(): return map(int,input().split())
def l_input(): return list(map(int, input().split()))
def check(x, a, b, c):
diff = x - 500 * a - 100 * b
if diff >= 0 and diff % 50 == 0 and diff // 50 <= c:
print(a,b,diff // 50)
retur... | s257186767 | Accepted | 20 | 3,188 | 874 | import re
import sys
def i_input(): return int(input())
def s_input(): return map(int,input().split())
def l_input(): return list(map(int, input().split()))
def check(x, a, b, c):
diff = x - 500 * a - 100 * b
if diff >= 0 and diff % 50 == 0 and diff // 50 <= c:
return True
else:
retur... |
s538300648 | p02747 | u978640776 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 281 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | a = list(map(str, input().split()))
num = len(a)
TorF = True
if num % 2 == 0:
for i in range(num/2):
if not a(2*i ) == 'h' and a(2*i + 1) == 'i':
TorF = False
break
else:
TorF = False
if TorF == True:
print('Yes')
else:
print('No') | s413206423 | Accepted | 17 | 3,060 | 285 | a = input()
l = list(a)
num = len(l)
TorF = True
if num % 2 == 0:
b = int(num/2)
for i in range(b):
if not (a[2*i] == 'h' and a[2*i + 1] == 'i'):
TorF = False
break
else:
TorF = False
if TorF == True:
print('Yes')
else:
print('No') |
s683008699 | p02261 | u938045879 | 1,000 | 131,072 | Wrong Answer | 20 | 5,612 | 942 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl... | def bubbleSort(c, n):
flag = 1
while(flag) :
flag = 0
for i in reversed(range(1,n)):
if(c[i][1] < c[i-1][1]):
c[i], c[i-1] = c[i-1], c[i]
flag = 1
return c
def selectionSort(c,n):
for i in range(n):
minj = i
for j in range(i, n... | s000307452 | Accepted | 20 | 5,612 | 971 | def bubbleSort(c, n):
flag = 1
while(flag) :
flag = 0
for i in reversed(range(1,n)):
if(c[i][1] < c[i-1][1]):
c[i], c[i-1] = c[i-1], c[i]
flag = 1
return c
def selectionSort(c,n):
for i in range(n):
minj = i
for j in range(i, n... |
s270423938 | p03574 | u859897687 | 2,000 | 262,144 | Wrong Answer | 25 | 3,064 | 378 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | h,w=map(int,input().split())
m=[[0for _ in range(w+2)]for _ in range(h+2)]
for y in range(h):
s=input()
for x in range(w):
if s[x]=="#":
for i in [-1,0,1]:
for j in [-1,0,1]:
m[y+j][x+i]+=1
m[y+1][x+1]=9
for y in range(1,h+1):
ans=""
for x in range(1,w+1):
if m[y][x]>9:
... | s804692267 | Accepted | 24 | 3,064 | 376 | h,w=map(int,input().split())
m=[[0for _ in range(w+2)]for _ in range(h+2)]
for y in range(h):
s=input()
for x in range(w):
if s[x]=="#":
for i in [0,1,2]:
for j in [0,1,2]:
m[y+j][x+i]+=1
m[y+1][x+1]=9
for y in range(1,h+1):
ans=""
for x in range(1,w+1):
if m[y][x]>8:
... |
s835301822 | p02398 | u316246166 | 1,000 | 131,072 | Wrong Answer | 20 | 5,580 | 101 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | a, b, c = map(int, input().split())
x = 0
while a > b:
if c % a == 0:
x = x + 1
| s299114426 | Accepted | 20 | 5,596 | 117 | a, b, c = map(int, input().split())
x = 0
for i in range(a, b+1):
if c % i == 0:
x += 1
print(x)
|
s843064329 | p04043 | u255595446 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 158 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | N = list(map(int,input().split()))
if 7 in N:
N.remove(7)
if 5 in N:
if sum(N) == 10:
print("Yes")
exit()
print("No") | s843611418 | Accepted | 17 | 2,940 | 253 | import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
# N = list(map(int,input().split()))
N = list(map(int,input().split()))
N.sort()
if sum(N)==17 and int(N[0]) == int(N[1]) == 5:
print('YES')
else:
print("NO") |
s658938868 | p03407 | u561828236 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | 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") | s493909816 | Accepted | 17 | 2,940 | 87 | a,b,c = map(int,input().split())
if a + b >= c:
print("Yes")
else:
print("No")
|
s793635312 | p03605 | u752552310 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | 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 n[0] == 9 or n[1] == 9:
prnit("Yes")
else:
print("No") | s728501481 | Accepted | 17 | 2,940 | 79 | n = input()
if n[0] == "9" or n[1] == "9":
print("Yes")
else:
print("No") |
s342563921 | p03693 | u095756391 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 113 | 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... | a, g, b = map(int, input().split())
num = a*100 + g*10 + b
if num % 4 == 0:
print('Yes')
else:
print('No')
| s499078975 | Accepted | 17 | 2,940 | 113 | r, g, b = map(int, input().split())
num = r*100 + g*10 + b
if num % 4 == 0:
print('YES')
else:
print('NO')
|
s236232907 | p03563 | u966000628 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 112 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | N = int(input())
K = int(input())
i = 1
for num in range(N):
if i < K:
i *= 2
else:
i += K
print (i) | s041045769 | Accepted | 28 | 3,316 | 49 | R = int(input())
G = int(input())
print (2*G - R) |
s803996645 | p03798 | u619458041 | 2,000 | 262,144 | Wrong Answer | 74 | 4,312 | 3,071 | Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered... | import sys
def make_pos(pos, S):
N = len(S)
for i in range(1, N-1):
if pos[i] == 'S':
if S[i] == 'o':
pos[i+1] = pos[i-1]
else:
if pos[i-1] == 'S':
pos[i+1] = 'W'
else:
pos[i+1] = 'S'
... | s555609488 | Accepted | 132 | 4,972 | 1,863 | import sys
def check(pos, S, index):
N = len(S)
right = (index + 1) % N
left = (index + (N - 1)) % N
if pos[index] == 0:
if S[index] == 'o':
return pos[left] == pos[right]
else:
return pos[left] != pos[right]
else:
if S[index] == 'o':
ret... |
s867674625 | p03228 | u002459665 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 301 | 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 = list(map(int, input().split()))
for i in range(K):
if i % 2 == 0:
if A % 2 == 1:
A -= 1
B += A // 2
A = A // 2
else:
if B % 2 == 1:
B -= 1
A += B // 2
B = B // 2
print(A, B) | s662056726 | Accepted | 17 | 3,060 | 297 | A, B, K = list(map(int, input().split()))
for i in range(K):
if i % 2 == 0:
if A % 2 == 1:
A -= 1
B += A // 2
A = A // 2
else:
if B % 2 == 1:
B -= 1
A += B // 2
B = B // 2
print(A, B) |
s858084576 | p03079 | u338208364 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 90 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | A,B,C = list(map(int, input().split()))
if A==B and B==C:
print("yes")
else:
print("No") | s328091871 | Accepted | 17 | 2,940 | 90 | A,B,C = list(map(int, input().split()))
if A==B and B==C:
print("Yes")
else:
print("No") |
s655186626 | p03814 | u368796742 | 2,000 | 262,144 | Wrong Answer | 41 | 4,840 | 158 | 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... | l = list(input())
for i in range(len(l)):
if l[i] == "A":
a = i
break
for i in range(len(l)):
if l[-1-i] == "Z":
b = i
break
print(b-a+1) | s122746042 | Accepted | 41 | 4,840 | 164 | l = list(input())
for i in range(len(l)):
if l[i] == "A":
a = i
break
for i in range(len(l)):
if l[-1-i] == "Z":
b = len(l)-i
break
print(b-a)
|
s829647281 | p03854 | u918373199 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 423 | 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()
flag = 0
while True:
if S.startswith("dream") or S.startswith("erase"):
S = S[5:]
if S.startswith("ase"):
S = S[3:]
if S.startswith("aser"):
S = S[4:]
if S.startswith("dreamer"):
S = S[7:]
if S.startswith("eraser"):
S = S[6:]
el... | s390278825 | Accepted | 68 | 3,188 | 330 | S = input()
flag = 0
S = S[::-1]
while True:
if S.startswith("maerd") or S.startswith("esare"):
S = S[5:]
elif S.startswith("remaerd"):
S = S[7:]
elif S.startswith("resare"):
S = S[6:]
elif S == "":
break
else:
flag = 1
break
print("YES" if flag == 0 e... |
s196183426 | p03455 | u321035578 | 2,000 | 262,144 | Wrong Answer | 31 | 9,092 | 85 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b = map(int,input().split())
if a*b % 2 == 0:
print('Odd')
else:
print('Even') | s050838394 | Accepted | 28 | 9,136 | 86 | a,b = map(int,input().split())
if a*b % 2 == 1:
print('Odd')
else:
print('Even')
|
s829468066 | p02255 | u148477094 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 219 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | N=int(input("N"))
A=[0]*N
A=input().split()
print(A)
for i in range(1,len(A)):
j = i
while (j > 0) and (A[j-1] > A[j]) :
tmp = A[j-1]
A[j-1] = A[j]
A[j] = tmp
j -= 1
print(A)
| s676843102 | Accepted | 20 | 5,976 | 143 | n=int(input())
a=input().split()
for i in range(n):
k=int(a[i])
j=i-1
while j>=0 and int(a[j])>k:
a[j+1]=a[j]
j-=1
a[j+1]=k
print(*a)
|
s825246273 | p03997 | u027675217 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | 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))
| s440602117 | Accepted | 17 | 2,940 | 70 | a = int(input())
b = int(input())
h = int(input())
print(((a+b)*h)//2) |
s843578330 | p04030 | u802963389 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 113 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | s = input()
ans = []
for i in s:
if i == "B":
if ans:
ans.pop()
else:
ans.append(i)
print(*ans) | s875531889 | Accepted | 19 | 3,060 | 98 | s = input()
ans = ""
for i in s:
if i == "B":
ans = ans[:-1]
else:
ans += i
print(ans) |
s051787155 | p03478 | u819135704 | 2,000 | 262,144 | Wrong Answer | 36 | 9,152 | 218 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | N, A, B = map(int, input().split())
def f(x):
sum = 0
while x > 0:
sum += x % 10
x //= 10
return sum
count = 0
for i in range(N):
if A <= f(i+1) <= B:
count += i
print(count)
| s658706644 | Accepted | 32 | 8,932 | 220 | N, A, B = map(int, input().split())
def f(x):
sum = 0
while x > 0:
sum += x % 10
x //= 10
return sum
count = 0
for i in range(N):
if A <= f(i+1) <= B:
count += i+1
print(count)
|
s989490087 | p03401 | u528470578 | 2,000 | 262,144 | Wrong Answer | 199 | 15,032 | 274 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | N = int(input())
A = list(map(int, input().split()))
A = [0] + A + [0]
kane = []
for i in range(1, N+2):
kane.append(abs(A[i] - A[i-1]))
skane = sum(kane)
print(kane)
for i in range(1, N+1):
print(skane - kane[i-1] - kane[i] + abs(A[i+1] - A[i-1])) | s706454080 | Accepted | 196 | 14,048 | 261 | N = int(input())
A = list(map(int, input().split()))
A = [0] + A + [0]
kane = []
for i in range(1, N+2):
kane.append(abs(A[i] - A[i-1]))
skane = sum(kane)
for i in range(1, N+1):
print(skane - kane[i-1] - kane[i] + abs(A[i+1] - A[i-1])) |
s218277192 | p03457 | u766486294 | 2,000 | 262,144 | Wrong Answer | 285 | 9,220 | 444 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | # -*- coding: utf-8 -*-
import math
lastT, lastX, lastY = 0, 0, 0
flag = True
N = int(input())
for i in range(N):
t, x, y = map(int, input().split())
if ( t - lastT < math.fabs(x - lastX) + math.fabs(y - lastY)
or ( (t - lastT) - math.fabs(x - lastX) - math.fabs(y - lastY) ) % 2 == 1 ):
... | s499796479 | Accepted | 273 | 9,104 | 444 | # -*- coding: utf-8 -*-
import math
lastT, lastX, lastY = 0, 0, 0
flag = "Yes"
N = int(input())
for i in range(N):
t, x, y = map(int, input().split())
if ( t - lastT < math.fabs(x - lastX) + math.fabs(y - lastY)
or ( (t - lastT) - math.fabs(x - lastX) - math.fabs(y - lastY) ) % 2 == 1 ):
... |
s142545183 | p03150 | u227082700 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 131 | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string. | s=input()
if "keyence" in s:exit(print("YES"))
for i in range(1,6):
if s[:i]+s[-(6-i):]=="keyence":exit(print("YES"))
print("NO") | s903228605 | Accepted | 23 | 2,940 | 154 | s=input()
if "keyence"==s:exit(print("YES"))
for i in range(10):
for j in range(i,len(s)):
if s[:i]+s[j:]=="keyence":exit(print("YES"))
print("NO")
|
s462089482 | p02694 | u250554058 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,160 | 108 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | x = int(input())
num = 100
count = 0
while x == num:
num = num + (num // 100)
count += 1
print(count)
| s380765873 | Accepted | 24 | 9,100 | 107 | x = int(input())
num = 100
count = 0
while x > num:
num = num + (num // 100)
count += 1
print(count)
|
s449013590 | p03478 | u186542450 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 133 | 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())
i = 1
count = 0
for i in range(n+1):
if(a <= i and b >= i):
count += 1
print(count) | s281323711 | Accepted | 38 | 3,060 | 175 | N, A, B = map(int, input().split())
sum_som = 0
for i in range(1, N + 1):
if A <= (sum(list(map(int, list(str(i)))))) <= B:
sum_som = sum_som + i
print(sum_som)
|
s641284215 | p02612 | u282652245 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,144 | 110 | 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. |
def main():
A = int(input())
s = A % 1000
print(s)
if __name__ == '__main__':
main()
| s588860390 | Accepted | 29 | 9,152 | 162 |
def main():
A = int(input())
s = A % 1000
if s == 0:
print(s)
else:
print(1000-s)
if __name__ == '__main__':
main()
|
s093239361 | p00423 | u052758509 | 1,000 | 131,072 | Wrong Answer | 20 | 7,596 | 457 | A と B の 2 人のプレーヤーが, 0 から 9 までの数字が書かれたカードを使ってゲームを行う.最初に, 2 人は与えられた n 枚ずつのカードを,裏向きにして横一列に並べる.その後, 2 人は各自の左から 1 枚ずつカードを表向きにしていき,書かれた数字が大きい方のカードの持ち主が,その 2 枚のカードを取る.このとき,その 2 枚のカードに書かれた数字の合計が,カードを取ったプレーヤーの得点となるものとする.ただし,開いた 2 枚のカードに同じ数字が書かれているときには,引き分けとし,各プレーヤーが自分のカードを 1 枚ずつ取るものとする. 例えば, A,B の持ち札が,以下の入力例 1 から 3 のように並べられている... | def _resulting(ab):
a, b = 0, 0
for itr in ab:
if itr[0] > itr[1]:
a = a + (itr[0] + itr[1])
elif itr[0] < itr[1]:
b = b + (itr[0] + itr[1])
else:
a = a + itr[0]
b = b + itr[1]
return a, b
if __name__ == '__main__':
N = int(input(... | s762305906 | Accepted | 120 | 9,208 | 569 | def _resulting(ab):
a, b = 0, 0
for itr in ab:
if itr[0] > itr[1]:
a = a + (itr[0] + itr[1])
elif itr[0] < itr[1]:
b = b + (itr[0] + itr[1])
else:
a = a + itr[0]
b = b + itr[1]
return a, b
if __name__ == '__main__':
while True:
... |
s699821752 | p03738 | u937642029 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 111 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | a=int(input())
b=int(input())
if(a>b):
print("GREATER")
if(a<b):
print("LESS")
else:
print("EQUAL") | s159150304 | Accepted | 17 | 3,064 | 113 | a=int(input())
b=int(input())
if(a>b):
print("GREATER")
elif(a<b):
print("LESS")
else:
print("EQUAL") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.