source stringclasses 4
values | task_type stringclasses 1
value | in_source_id stringlengths 0 138 | problem stringlengths 219 13.2k | gold_standard_solution stringlengths 0 413k | problem_id stringlengths 5 10 | metadata dict | verification_info dict |
|---|---|---|---|---|---|---|---|
code_contests | verifiable_code | p00795 Co-occurrence Search | Solve the following coding problem using the programming language python:
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you ca... | vfc_81621 | {
"difficulty": "0",
"memory_limit": null,
"memory_limit_bytes": 134217728,
"problem_url": null,
"time_limit": "{'seconds': 8, 'nanos': 0}"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclo... | |
code_contests | verifiable_code | p00926 Shopping | Solve the following coding problem using the programming language python:
Example
Input
10 3
3 7
8 9
2 5
Output
23
The input will be given via stdin and the output should be printed to stdout by your code.
Now solve the problem by providing the code. | ```python
import sys
reader=(token for line in sys.stdin for token in line.split())
while 1:
try:
n=int(next(reader))
m=int(next(reader))
except: break
a=[1]*(n+1)
for i in range(m):
c=int(next(reader))-1
d=int(next(reader))-1
for i in range(c,d):
a[i]=3
print(sum(a))
``` | vfc_81625 | {
"difficulty": "0",
"memory_limit": null,
"memory_limit_bytes": 268435456,
"problem_url": null,
"time_limit": "{'seconds': 1, 'nanos': 0}"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "10 3\n3 7\n8 9\n2 5",
"output": "23",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "10 3\n3 7\n8 9\n3 5",
"output": "21\n",
"type": "stdin_stdout"
},
{
"fn_name": n... |
code_contests | verifiable_code | p01191 Grated Radish | Solve the following coding problem using the programming language python:
Grated radish (daikon-oroshi) is one of the essential spices in Japanese cuisine. As the name shows, it’s made by grating white radish.
You are developing an automated robot for grating radish. You have finally finished developing mechan- ical ... | vfc_81633 | {
"difficulty": "0",
"memory_limit": null,
"memory_limit_bytes": 134217728,
"problem_url": null,
"time_limit": "{'seconds': 8, 'nanos': 0}"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n1 2\n1\n42 3.141592653589793\n5 20\n3\n0 307.09242465218927\n180 307.09242465218927\n90 728.30573874452591",
"output": "2.0 3.141592653589793\n8.660254038 5.235987756",
"type": "stdin_stdout"
},
{
"fn_n... | |
code_contests | verifiable_code | p01329 Stolen Jewel | Solve the following coding problem using the programming language python:
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back.
However, when I went to return the jewel to the castle of ... | vfc_81637 | {
"difficulty": "0",
"memory_limit": null,
"memory_limit_bytes": 134217728,
"problem_url": null,
"time_limit": "{'seconds': 8, 'nanos': 0}"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD",
"output": "-1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n....... | |
code_contests | verifiable_code | p01496 Bicube | Solve the following coding problem using the programming language python:
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cu... | ```python
from collections import deque
from string import ascii_lowercase, ascii_uppercase, digits
import sys
readline = sys.stdin.readline
write = sys.stdout.write
D = [
(1, 5, 2, 3, 0, 4), # 'U'
(3, 1, 0, 5, 4, 2), # 'R'
(4, 0, 2, 3, 5, 1), # 'D'
(2, 1, 5, 0, 4, 3), # 'L'
]
p_dice = (0, 0, 0, 1, 1, ... | vfc_81641 | {
"difficulty": "0",
"memory_limit": null,
"memory_limit_bytes": 134217728,
"problem_url": null,
"time_limit": "{'seconds': 8, 'nanos': 0}"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...",
"output": "No",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input... |
code_contests | verifiable_code | p01664 Sigma | Solve the following coding problem using the programming language python:
I-σ
A permutation of magnitude N is a sequence of elements in a sequence (1, 2, 3,…, N). For example, (5, 2, 1, 4, 3) is a permutation of size 5, while (1, 5, 1, 2, 3) is not.
This problem is a reactive task. You play a response program and a ... | vfc_81645 | {
"difficulty": "0",
"memory_limit": null,
"memory_limit_bytes": 134217728,
"problem_url": null,
"time_limit": "{'seconds': 2, 'nanos': 0}"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "",
"output": "",
"type": "stdin_stdout"
}
]
} | |
code_contests | verifiable_code | p01944 Almost Infinite Glico | Solve the following coding problem using the programming language python:
G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the f... | vfc_81653 | {
"difficulty": "0",
"memory_limit": null,
"memory_limit_bytes": 268435456,
"problem_url": null,
"time_limit": "{'seconds': 2, 'nanos': 0}"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "10 3 2\n3\n6\n6",
"output": "1\n0\n4\n2\n0\n0\n5\n0\n0\n4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "10 3 2\n3\n10\n6",
"output": "4\n0\n1\n4\n0\n0\n5\n0\n0\n2\n",
"type": "... | |
code_contests | verifiable_code | p02093 Invariant Tree | Solve the following coding problem using the programming language python:
F: Invariant Tree
Problem Statement
You have a permutation p_1, p_2, ... , p_N of integers from 1 to N. You also have vertices numbered 1 through N. Find the number of trees while satisfying the following condition. Here, two trees T and T' ar... | vfc_81657 | {
"difficulty": "0",
"memory_limit": null,
"memory_limit_bytes": 536870912,
"problem_url": null,
"time_limit": "{'seconds': 2, 'nanos': 0}"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n2 1 4 3",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n3 2 4 1",
"output": "1\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": ... | |
code_contests | verifiable_code | p02226 Test | Solve the following coding problem using the programming language python:
test
UnionFind(バイナリ入力)
Example
Input
Output
The input will be given via stdin and the output should be printed to stdout by your code.
Now solve the problem by providing the code. | vfc_81661 | {
"difficulty": "0",
"memory_limit": null,
"memory_limit_bytes": 1073741824,
"problem_url": null,
"time_limit": "{'seconds': 8, 'nanos': 0}"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "",
"output": "",
"type": "stdin_stdout"
}
]
} | |
code_contests | verifiable_code | p02377 Minimum Cost Flow | Solve the following coding problem using the programming language python:
Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output
The input will be given via stdin and the output should be printed to stdout by your code.
Now solve the problem by providing the code. | ```python
# ノードをtupleで渡す
from collections import defaultdict
from heapq import *
class MinCostFlow:
def __init__(self):
self.inf=10**9
self.to = defaultdict(dict)
def add_edge(self, u, v, cap, cost):
self.to[u][v]=[cap, cost]
self.to[v][u]=[0, -cost]
# s...source,t...sink,f... | vfc_81665 | {
"difficulty": "0",
"memory_limit": null,
"memory_limit_bytes": 134217728,
"problem_url": null,
"time_limit": "{'seconds': 1, 'nanos': 0}"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
"output": "6",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "",
"output": "",
"type": "stdin_stdout"
},
{
"fn_n... |
codeforces | verifiable_code | 604 | Solve the following coding problem using the programming language python:
Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maximum point values of 500, 1000, 1500, 2000, and 2500, respectively. Despite the challenging tasks, Kevin was uncowe... | def score(x,m,w):
t=(1-(m/250))*x - (50*w)
return max(0.3*x,t)
sl=[500,1000,1500,2000,2500]
m=list(map(int, input().split()))
w=list(map(int, input().split()))
s,u=map(int,input().split())
res=0
for i in range(5):
res+=score(sl[i],m[i],w[i])
res+=(100*s)
res-=(50*u)
print(int(res)) | vfc_81669 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "20 40 60 80 100\n0 1 2 3 4\n1 0",
"output": "4900",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "119 119 119 119 119\n0 0 0 0 0\n10 0",
"output": "4930",
"type": "stdin_stdout"
... |
codeforces | verifiable_code | 281 | Solve the following coding problem using the programming language python:
Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word.
Note, that during capitalization all the letters except the first one remains unchanged.
The input will be provided via stan... | s=str(input())
s=list(s)
a=s[0]
a=a.upper()
s[0]=a
y="".join(s)
print(y) | vfc_81673 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "ApPLe",
"output": "ApPLe",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "konjac",
"output": "Konjac",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 322 | Solve the following coding problem using the programming language python:
Fox Ciel has some flowers: *r* red flowers, *g* green flowers and *b* blue flowers. She wants to use these flowers to make several bouquets. There are 4 types of bouquets:
- To make a "red bouquet", it needs 3 red flowers. - To make a "green ... | def f(x): return x // 3
r, g, b = map(int, input().split())
m = min(r, g, b)
ans = 0
for i in range(max(0, m - 30), m + 1):
ans = max(ans, i + f(r - i) + f(g - i) + f(b - i))
print(ans)
| vfc_81677 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 6 9",
"output": "6",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4 4 4",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "0 0 0",
... |
codeforces | verifiable_code | 804 | Solve the following coding problem using the programming language python:
We have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of substrings "ab" in the string and replace it with the string "bba". If we have no "ab" as a substring, our job is done. Print the mi... | import math as m
t=1
#t=int(input())
mod=10**9+7
while t:
t-=1
s=input()
ans,cost=0,0
for i in range(len(s)):
if s[i]=='a':
cost=(cost*2+1)%mod
else :
ans+=cost
print(ans%mod)
| vfc_81681 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "ab",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "aab",
"output": "3",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 776 | Solve the following coding problem using the programming language python:
Our beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his powers of deduction, he came to know that the killer has a strategy for selecting his next victim.
The killer starts with two po... |
s = ' '+input()+' '
n = int(input())
print(s[1:-1])
for i in range(n):
l,r = input().split()
s = s.replace(' '+l+' ',' '+r+' ')
print(s[1:-1])
| vfc_81685 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2500"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "ross rachel\n4\nross joey\nrachel phoebe\nphoebe monica\nmonica chandler",
"output": "ross rachel\njoey rachel\njoey phoebe\njoey monica\njoey chandler",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 854 | Solve the following coding problem using the programming language python:
Petya is a big fan of mathematics, especially its part related to fractions. Recently he learned that a fraction is called proper iff its numerator is smaller than its denominator (*a*<=<<=*b*) and that the fraction is called irreducible if ... | from math import gcd
n=int(input())
#print(gcd(1,0))
a=0
u=[]
for i in range(1,n+1):
if gcd(a+i,n-i)==1:
u.append([a+i,n-i])
print(*u[(len(u)//2)-1])
| vfc_81689 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3",
"output": "1 2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4",
"output": "1 3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "12",
"out... |
codeforces | verifiable_code | 32 | Solve the following coding problem using the programming language python:
Ternary numeric notation is quite popular in Berland. To telegraph the ternary number the Borze alphabet is used. Digit 0 is transmitted as «.», 1 as «-.» and 2 as «--». You are to decode the Borze code, i.e. to find out the ternary number given... | p=0
c=''
s=input()
for i in range(len(s)):
if p==0:
if s[i]=='.':
c+='0'
elif s[i+1]=='.':
c+='1'
p=1
else:
c+='2'
p=1
else:
p=0
print(c) | vfc_81693 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": ".-.--",
"output": "012",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "--.",
"output": "20",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 808 | Solve the following coding problem using the programming language python:
Vasya has an array *a* consisting of positive integer numbers. Vasya wants to divide this array into two non-empty consecutive parts (the prefix and the suffix) so that the sum of all elements in the first part equals to the sum of elements in t... | n = int(input())
arr = list(map(int, input().split()))
def solve(n, a):
s = sum(a)
if n == 1 or s & 1:
print('NO')
return
half = s // 2
def judge(a):
pre, st = 0, {0}
for num in a:
st.add(num)
pre += num
if pre - half in st... | vfc_81697 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n1 3 2",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5\n1 2 3 4 5",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input":... |
codeforces | verifiable_code | 750 | Solve the following coding problem using the programming language python:
Limak is going to participate in a contest on the last day of the 2016. The contest will start at 20:00 and will last four hours, exactly until midnight. There will be *n* problems, sorted by difficulty, i.e. problem 1 is the easiest and problem... | inp = input().split()
lis = [eval(i) for i in inp]
k = lis[1]
n = 5
a,b=0,lis[0]
for i in range(lis[0]):
if(k<240 and k+((i+1)*5)<=240):
k+=n
n+=5
else:break
a=i+1
print(int(a)) | vfc_81701 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 222",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4 190",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7 1",
... |
codeforces | verifiable_code | 9 | Solve the following coding problem using the programming language python:
Yakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thought about Tasmania, its b... | y,w=map(int,input().split())
probability=["", "1/1", "5/6", "2/3", "1/2", "1/3", "1/6"]
print(probability[max(y,w)]) | vfc_81705 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 2",
"output": "1/2",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 50 | Solve the following coding problem using the programming language python:
You are given a rectangular board of *M*<=×<=*N* squares. Also you are given an unlimited number of standard domino pieces of 2<=×<=1 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possible on the board... | # n = int(input())
# words = [input() for i in range(n)]
# def shorter(word):
# if len(word) <= 10:
# return word
# else:
# return word[0] + str(len(word)-2) + word[-1]
# for i in words:
# print(shorter(i))
# n = int(input())
# sol = [input().split(" ") for i in range(n)]
# ... | vfc_81709 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 4",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 3",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 5",
"ou... |
codeforces | verifiable_code | 439 | Solve the following coding problem using the programming language python:
Devu is a renowned classical singer. He is invited to many big functions/festivals. Recently he was invited to "All World Classical Singing Festival". Other than Devu, comedian Churu was also invited.
Devu has provided organizers a list of the ... | n,m=map(int, input().split())
a=sum(list(map(int, input().split())))
if a+(n-1)*10<=m:
print((m-a)//5)
else:
print(-1) | vfc_81713 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 30\n2 2 1",
"output": "5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 20\n2 1 1",
"output": "-1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input":... |
codeforces | verifiable_code | 902 | Solve the following coding problem using the programming language python:
Pig is visiting a friend.
Pig's house is located at point 0, and his friend's house is located at point *m* on an axis.
Pig can use teleports to move along the axis.
To use a teleport, Pig should come to a certain point (where the teleport is... | n, finish = map(int, input().split())
end_interval = [0, finish]
points = []
for _ in range(n):
x, y = map(int, input().split())
points.append([x, y])
points.sort()
#print(points)
merge_interval = [points[0][0], points[0][1]]
for i in range(1, n):
if merge_interval[1]>=points[i][0]:
... | vfc_81717 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 5\n0 2\n2 4\n3 5",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 7\n0 4\n2 5\n6 7",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null... |
codeforces | verifiable_code | 272 | Solve the following coding problem using the programming language python:
Dima and his friends have been playing hide and seek at Dima's place all night. As a result, Dima's place got messy. In the morning they decided that they need to clean the place.
To decide who exactly would clean the apartment, the friends wan... | n=int(input())
a=list(map(int,input().split()))
k = sum(a)
n+=1
c=0
for i in range(1,6):
if (k+i)%n==1:
c+=1
print(5-c)
| vfc_81721 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n1",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1\n2",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n3 5",
... |
codeforces | verifiable_code | 219 | Solve the following coding problem using the programming language python:
A colored stripe is represented by a horizontal row of *n* square cells, each cell is pained one of *k* colors. Your task is to repaint the minimum number of cells so that no two neighbouring cells are of the same color. You can use any color fr... | n, k = map(int, input().split())
s = list(input())
if k > 2:
c = set(ord("A") + i for i in range(26))
r = 0
for i in range(1,len(s)):
if s[i-1] == s[i]:
r += 1
if i + 1 < n:
s[i] = "A" if "A" not in {s[i-1], s[i+1]} else ('B' if "B" not in {s[i], s[i+1]} els... | vfc_81725 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6 3\nABBACC",
"output": "2\nABCACA",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 2\nBBB",
"output": "1\nBAB",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 59 | Solve the following coding problem using the programming language python:
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either only c... | s=input()
ascii_lower=0
ascii_upper=0
str=''
for ele in s:
if ord(ele) <= 90:
ascii_upper+=1
elif ord(ele) >= 97:
ascii_lower+=1
if ascii_lower>=ascii_upper:
print(s.lower())
else:
print(s.upper())
| vfc_81729 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "HoUse",
"output": "house",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 520 | Solve the following coding problem using the programming language python:
A word or a sentence in some language is called a pangram if all the characters of the alphabet of this language appear in it at least once. Pangrams are often used to demonstrate fonts in printing or test the output devices.
You are given a st... | n = int(input())
str = input()
s = set(str.lower())
if len(s) == 26: print("YES")
else: print("NO") | vfc_81733 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "12\ntoosmallword",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "35\nTheQuickBrownFoxJumpsOverTheLazyDog",
"output": "YES",
"type": "stdin_stdout"
},
{
... |
codeforces | verifiable_code | 6 | Solve the following coding problem using the programming language python:
Alice and Bob like games. And now they are ready to start a new game. They have placed *n* chocolate bars in a line. Alice starts to eat chocolate bars one by one from left to right, and Bob — from right to left. For each chocololate bar the tim... | n = int(input())
t = list(map(int,input().split()))
Alice = 0
Bob = 0
cA = 0
cB = 0
i = 0
j = n-1
while i<j:
temp = min(Bob,Alice)
Alice -= temp
if Alice==0:
Alice += t[i]
cA += 1
i += 1
Bob -= temp
if Bob==0:
Bob += t[j]
cB += 1
... | vfc_81741 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1500"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\n2 9 8 2 7",
"output": "2 3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1\n1",
"output": "1 0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2... |
codeforces | verifiable_code | 1 | Solve the following coding problem using the programming language python:
Theatre Square in the capital city of Berland has a rectangular shape with the size *n*<=×<=*m* meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the s... | '''Vipin'''
# cook your dish here
n,m,a=map(int,input().split())
if a>n and a>m:
print("1")
else:
if n%a>0:
n=n//a+1
else:
n=n//a
if m%a>0:
m=(m//a)+1
else:
m=m//a
ans = n*m
print(ans)
| vfc_81745 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6 6 4",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 1 1",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2 1 1",
... |
codeforces | verifiable_code | 489 | Solve the following coding problem using the programming language python:
The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! *n* boys and *m* girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.
We know that several boy&girl pairs are g... | n=int(input())
arr1=list(map(int,input().split()))
m=int(input())
arr2=list(map(int,input().split()))
arr1=sorted(arr1)
arr2=sorted(arr2)
ans=0
for i in range(n):
for j in range(m):
if(arr1[i]==arr2[j] or arr1[i]+1==arr2[j] or arr1[i]-1==arr2[j]):
ans=ans+1
arr2[j]=-1
... | vfc_81749 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n1 4 6 2\n5\n5 1 5 7 9",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n1 2 3 4\n4\n10 11 12 13",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_... |
codeforces | verifiable_code | 463 | Solve the following coding problem using the programming language python:
Caisa solved the problem with the sugar and now he is on the way back to home.
Caisa is playing a mobile game during his path. There are (*n*<=+<=1) pylons numbered from 0 to *n* in this game. The pylon with number 0 has zero height, the pylon... | try:
t=int(input())
a=list(map(int,input().split(" ")))
k=max(a)
print(k)
except:
pass | vfc_81753 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\n3 4 3 2 4",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n4 4 4",
"output": "4",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 5 | Solve the following coding problem using the programming language python:
Polycarp is working on a new project called "Polychat". Following modern tendencies in IT, he decided, that this project should contain chat as well. To achieve this goal, Polycarp has spent several hours in front of his laptop and implemented a... | import sys
names = set()
result = 0
lines = sys.stdin.readlines()
for s in lines:
s = s.strip()
if '+' in s:
names.add(s[1:])
continue
if '-' in s:
names.remove(s[1:])
continue
name, messsage = s.split(':')
result += len(names) * len(messsage)
print(result) | vfc_81757 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "+Mike\nMike:hello\n+Kate\n+Dmitry\n-Dmitry\nKate:hi\n-Kate",
"output": "9",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "+Mike\n-Mike\n+Mike\nMike:Hi I am here\n-Mike\n+Kate\n-Kate",
... |
codeforces | verifiable_code | 940 | Solve the following coding problem using the programming language python:
And where the are the phone numbers?
You are given a string *s* consisting of lowercase English letters and an integer *k*. Find the lexicographically smallest string *t* of length *k*, such that its set of letters is a subset of the set of let... | a,b = map(int,input().split(' '))
s = input()
s1 = sorted(set(s))
if b>a:
print(s+s1[0]*(b-a))
else:
i = b-1
while s[i]>=s1[-1] and i>-1:
i -= 1
d = s1.index(s[i])
print(s[:i]+s1[d+1]+s1[0]*(b-i-1)) | vfc_81761 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 3\nabc",
"output": "aca",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 2\nabc",
"output": "ac",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 ... |
codeforces | verifiable_code | 404 | Solve the following coding problem using the programming language python:
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today... | n = int(input())
arr = []
for i in range(n):
arr.append(list(input()))
cnt = set()
x = arr[0][0]
y = arr[0][1]
ans = "YES"
for i in range(n):
for j in range(n):
cnt.add(arr[i][j])
if i == j or i == n-1-j:
if arr[i][j] != x:
ans = "NO"
break
el... | vfc_81765 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\nwsw\nsws\nwsw",
"output": "YES",
"type": "stdin_stdout"
},
{
... |
codeforces | verifiable_code | 965 | Solve the following coding problem using the programming language python:
$k$ people want to split $n$ candies between them. Each candy should be given to exactly one of them or be thrown away.
The people are numbered from $1$ to $k$, and Arkady is the first of them. To split the candies, Arkady will choose an intege... | s=list(map(int,input().split()))
n=s[0]
k=s[1]
M=s[2]
D=s[3]
ans=0
for d in range(0,D+1):
x=n//((d-1)*k+1)
if x>M:
x=M
if x*d>ans:
ans=x*d
print(ans)
| vfc_81769 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "20 4 5 2",
"output": "8",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "30 9 4 1",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2 2 1... |
codeforces | verifiable_code | 246 | Solve the following coding problem using the programming language python:
Polycarpus has an array, consisting of *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Polycarpus likes it when numbers in an array match. That's why he wants the array to have as many equal numbers as possible. For that Polycarpus performs the followi... | n = int(input())
arr = [int(i) for i in input().split()]
if sum(arr)%n ==0: print(n)
else: print(n-1) | vfc_81773 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n2 1",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n1 4 1",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n2 -7... |
codeforces | verifiable_code | 445 | Solve the following coding problem using the programming language python:
DZY loves chessboard, and he enjoys playing with it.
He has a chessboard of *n* rows and *m* columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white o... | n, m = map(int, input().split())
inp = [input() for _ in range(n)]
for i in range(n):
for j in range(m):
if inp[i][j] == '-':
print('-', end='')
else:
print('B' if (i+j)%2==0 else 'W', end='')
print('') | vfc_81777 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1 1\n.",
"output": "B",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2 2\n..\n..",
"output": "BW\nWB",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": ... |
codeforces | verifiable_code | 352 | Solve the following coding problem using the programming language python:
One day Jeff got hold of an integer sequence *a*1, *a*2, ..., *a**n* of length *n*. The boy immediately decided to analyze the sequence. For that, he needs to find all values of *x*, for which these conditions hold:
- *x* occurs in sequence *a... | n= int(input())
t = list(map(int,input().split()))
u=[]
f={}
p=0
for j in range(n):
if t[j] not in f:
f[t[j]]=[0,j]
else:
if f[t[j]][0]==0:
f[t[j]][0]= j-f[t[j]][-1]
f[t[j]].append(j)
elif f[t[j]][0]!='a':
if j-f[t[j]][-1]==f[t[j]][0]:
... | vfc_81781 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n2",
"output": "1\n2 0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "8\n1 2 1 3 1 2 1 5",
"output": "4\n1 2\n2 4\n3 0\n5 0",
"type": "stdin_stdout"
},
{
"fn_nam... |
codeforces | verifiable_code | 1011 | Solve the following coding problem using the programming language python:
Natasha is planning an expedition to Mars for $n$ people. One of the important tasks is to provide food for each participant.
The warehouse has $m$ daily food packages. Each package has some food type $a_i$.
Each participant must eat exactly o... | n, m = map(int, input().split())
packages = list(map(int, input().split()))
counts = dict()
for p in packages:
if p in counts:
counts[p] += 1
else:
counts[p] = 1
arrayCounts = []
for package, count in counts.items():
arrayCounts.append(count)
arrayCounts.sort()
arrayCounts.reverse()
for i in range(m//n+1):... | vfc_81785 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 10\n1 5 2 1 1 1 2 5 7 2",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "100 1\n1",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 146 | Solve the following coding problem using the programming language python:
Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya loves tickets ver... | n = int(input())
s = str(input())
a = 0
b = 0
for i, num in enumerate(s):
if num != '7' and num != '4':
print("NO")
a=-1
b=-2
break
else:
if i+1<=n/2:
a+=int(num)
else:
b+=int(num)
else:
if a==b:
print("YES")
... | vfc_81789 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n47",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n4738",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n4774... |
codeforces | verifiable_code | 454 | Solve the following coding problem using the programming language python:
Twilight Sparkle once got a crystal from the Crystal Mine. A crystal of size *n* (*n* is odd; *n*<=><=1) is an *n*<=×<=*n* matrix with a diamond inscribed into it.
You are given an odd integer *n*. You need to draw a crystal of size *n*. The... | n=int(input())
x=int(n/2)
for i in range(1,n+1):
print("*"*x+'D'*(n-(2*x))+'*'*x)
if i <=int(n/2) :
x-=1
else :
x+=1
# print(x,i) | vfc_81793 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3",
"output": "*D*\nDDD\n*D*",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5",
"output": "**D**\n*DDD*\nDDDDD\n*DDD*\n**D**",
"type": "stdin_stdout"
},
{
"fn_name... |
codeforces | verifiable_code | 431 | Solve the following coding problem using the programming language python:
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.
In this game, the phone's screen is divided into four vertical strips. Each sec... | k = list(map(int,input().split()))
s = str(input())
sum = 0
for i in s:
if i == "1":
sum += k[0]
elif i == "2":
sum += k[1]
elif i == "3":
sum += k[2]
elif i == "4":
sum += k[3]
print(sum)
| vfc_81797 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1 2 3 4\n123214",
"output": "13",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 5 3 2\n11221",
"output": "13",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 652 | Solve the following coding problem using the programming language python:
You are given a permutation *p* of length *n*. Also you are given *m* foe pairs (*a**i*,<=*b**i*) (1<=≤<=*a**i*,<=*b**i*<=≤<=*n*,<=*a**i*<=≠<=*b**i*).
Your task is to count the number of different intervals (*x*,<=*y*) (1<=≤<=*x*<=≤<=*y*<=≤<=*... | import sys
if __name__=='__main__':
n,m=map(int,input().split())
line=sys.stdin.readline()
pos={int(v):i for i,v in enumerate(line.split())}
check=[300004]*(n+1)
for line in sys.stdin.readlines():
a,b=map(int,line.split())
if pos[a]>pos[b]:
check[pos[b]]=min(chec... | vfc_81801 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 2\n1 3 2 4\n3 2\n2 4",
"output": "5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "9 5\n9 7 2 3 1 4 6 5 8\n1 6\n4 5\n2 7\n7 2\n2 7",
"output": "20",
"type": "stdin_stdout"
... |
codeforces | verifiable_code | 71 | Solve the following coding problem using the programming language python:
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words sho... | n = int(input(""))
for a in range(0,n):
string = input("")
if len(string)>10:
slice = string[0] + str(len(string)-2) +string[-1]
print(slice)
else:
print(string) | vfc_81805 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\nword\nlocalization\ninternationalization\npneumonoultramicroscopicsilicovolcanoconiosis",
"output": "word\nl10n\ni18n\np43s",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 1003 | Solve the following coding problem using the programming language python:
Polycarp has $n$ coins, the value of the $i$-th coin is $a_i$. Polycarp wants to distribute all the coins between his pockets, but he cannot put two coins with the same value into the same pocket.
For example, if Polycarp has got six coins repr... | n= int(input())
a= list(map(int, input().split()))
x= [a.count(i) for i in a]
x.sort()
print(x[n-1]) | vfc_81809 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "4000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6\n1 2 4 3 3 2",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1\n100",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1... |
codeforces | verifiable_code | 632 | Solve the following coding problem using the programming language python:
You're given a list of *n* strings *a*1,<=*a*2,<=...,<=*a**n*. You'd like to concatenate them together in some order such that the resulting string would be lexicographically smallest.
Given the list of strings, output the lexicographically sma... | from functools import cmp_to_key
def cmp(x,y):
if x+y>y+x:
return 1
else:
return -1
a=[]
n=int(input())
for i in range(n):
a.append(input())
ans=""
for s in sorted(a,key=cmp_to_key(cmp)):
ans+=s
print(ans)
| vfc_81813 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\nabba\nabacaba\nbcd\ner",
"output": "abacabaabbabcder",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 926 | Solve the following coding problem using the programming language python:
You are given a sequence of positive integers *a*1,<=*a*2,<=...,<=*a**n*.
While possible, you perform the following operation: find a pair of equal consecutive elements. If there are more than one such pair, find the leftmost (with the smalles... | n = int(input())
a = [int(x) for x in input().split()]
stack = []
i = 0
x = a[i]
while True:
if len(stack) == 0:
stack.append(x)
i += 1
if i == n:
break
x = a[i]
else:
if x == stack[-1]:
del stack[-1]
x += 1
else... | vfc_81817 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6\n5 2 1 1 2 2",
"output": "2\n5 4 ",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n1000000000 1000000000 1000000000 1000000000",
"output": "1\n1000000002 ",
"type": "stdin_st... |
codeforces | verifiable_code | 330 | Solve the following coding problem using the programming language python:
You are given a rectangular cake, represented as an *r*<=×<=*c* grid. Each cell either has an evil strawberry, or is empty. For example, a 3<=×<=4 cake may look as follows:
The cakeminator is going to eat the cake! Each time he eats, he chooses... | n, m = [int(i) for i in input().split()]
mas = [input() for _ in range(n)]
count = 0
for i in range(n-1,-1,-1):
if 'S' not in mas[i]:
count += m
del mas[i]
n -= 1
for j in range(m-1, -1, -1):
flag = False
for i in range(n):
flag += 'S' == mas[i][j]
if not fla... | vfc_81821 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 4\nS...\n....\n..S.",
"output": "8",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2 2\n..\n..",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 987 | Solve the following coding problem using the programming language python:
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
- the Power Gem of purple color, - the Time Gem of green color, - the Space Gem of blue color, - the Soul Gem of orange color, - t... | dict1={"purple":"Power", "green":"Time", "blue":"Space", "orange":"Soul", "red":"Reality", "yellow":"Mind"}
n=int(input())
n_list=[]
print(6-n)
for i in range(n):
g=input()
n_list.append(g)
for k,v in dict1.items():
if k not in n_list:
print(v)
| vfc_81825 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\nred\npurple\nyellow\norange",
"output": "2\nSpace\nTime",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "0",
"output": "6\nMind\nSpace\nPower\nTime\nReality\nSoul",
"type": "st... |
codeforces | verifiable_code | 279 | Solve the following coding problem using the programming language python:
When Valera has got some free time, he goes to the library to read some books. Today he's got *t* free minutes to read. That's why Valera took *n* books in the library and for each book he estimated the time he is going to need to read it. Let's... | p=lambda:list(map(int,input().split()))
n,t=p()
l=p()
i=j=s=0
for j in range(n):
s+=l[j]
if s>t:
s-=l[i]
i+=1
print(n-i) | vfc_81829 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 5\n3 1 2 1",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 3\n2 2 3",
"output": "1",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 474 | Solve the following coding problem using the programming language python:
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
Unfortunately Mole is blind, so sometimes it is problem for him to put his hands accurately. He accidentally mo... | a = input()
b = list(input())
key = list("qwertyuiopasdfghjkl;zxcvbnm,./")
if a =="L":
d=1
else:
d=-1
n=[]
for i in range(len(b)):
e = b[i]
f = key.index(e)
n.append(key[f+d])
print(''.join(n)) | vfc_81833 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "R\ns;;upimrrfod;pbr",
"output": "allyouneedislove",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "R\nwertyuiop;lkjhgfdsxcvbnm,.",
"output": "qwertyuiolkjhgfdsazxcvbnm,",
"type": ... |
codeforces | verifiable_code | 760 | Solve the following coding problem using the programming language python:
Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond to weekdays, and cells contain dates. For example, a... | import math
m, d = map(int, input().split())
a = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
print(math.ceil((a[m-1]+d-1)/7))
| vfc_81837 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1 7",
"output": "6",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 1",
"output": "5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "11 6",
"o... |
codeforces | verifiable_code | 733 | Solve the following coding problem using the programming language python:
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowe... | l=['A','U','O','I','E','Y']
s=input()
c=0
m=0
for i in s:
if(i in l):
m=max(m,c)
c=0
else:
c=c+1
m=max(c,m)
print(m+1) | vfc_81841 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "ABABBBACFEYUKOTT",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "AAA",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "A"... |
codeforces | verifiable_code | 955 | Solve the following coding problem using the programming language python:
Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, ababa is adorable (you can transform it to... | s = input()
l = list(set(s))
ans = 1
if (len(l)>4) or (len(l)<=1):
ans = 0
else:
if len(l)==2:
c1=0
c0=0
for i in range(len(s)):
if s[i]==l[0]:
c0+=1
else:
c1+=1
if (c1<2) or (c0<2):
ans = 0
i... | vfc_81845 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "ababa",
"output": "Yes",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 835 | Solve the following coding problem using the programming language python:
Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consisting of *s* characters. The first participant types one character in *v*1 milliseconds and has ping *t*1 milliseconds. The... | s,v1,v2,t1,t2=map(int,input().split())
first=s*v1+2*t1
second=s*v2+2*t2
if first > second:
print ("Second")
if first < second:
print("First")
if first ==second:
print("Friendship")
| vfc_81849 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 1 2 1 2",
"output": "First",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 3 1 1 1",
"output": "Second",
"type": "stdin_stdout"
},
{
"fn_name": null,
"inp... |
codeforces | verifiable_code | 686 | Solve the following coding problem using the programming language python:
After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.
At the start of the day they have *x* ice cream packs. Since the ice cream is free, people start standing in t... | def solve(test):
ans = 0
n, x = map(int, input().split())
for i in range(n):
c = input().split()
if c[0] == '+':
x += int(c[1])
elif int(c[1]) > x:
ans += 1
else:
x -= int(c[1])
print(x, ans)
t = 1
#t = int(input())
for _ ... | vfc_81853 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20",
"output": "22 1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98",
"output": "3 2",
"type": "stdin_stdout"
... |
codeforces | verifiable_code | 822 | Solve the following coding problem using the programming language python:
Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university of her dreams which is located in a town Pavlopolis. It's well known that universities provide students with dormitory for the period of univers... | import math as m
a,b=map(int,input().split())
c=min(a,b)
print(m.factorial(c)) | vfc_81857 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 3",
"output": "6",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "10 399603090",
"output": "3628800",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "... |
codeforces | verifiable_code | 75 | Solve the following coding problem using the programming language python:
Can you imagine our life if we removed all zeros from it? For sure we will have many problems.
In this problem we will have a simple example if we removed all zeros from our life, it's the addition operation. Let's assume you are given this equ... | a = (input())
b = (input())
res = int(a)+int(b)
a = a.replace("0",'')
b = b.replace("0",'')
res = str(res)
res = res.replace("0",'')
res = int(res)
a = int(a)
b = int(b)
if res == (a+b):
print("YES")
else:
print("NO")
| vfc_81861 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "101\n102",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "105\n106",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "54... |
codeforces | verifiable_code | 58 | Solve the following coding problem using the programming language python:
Vasya has recently learned to type and log on to the Internet. He immediately entered a chat room and decided to say hello to everybody. Vasya typed the word *s*. It is considered that Vasya managed to say hello if several letters can be deleted... | str = list(input())
n = len(str)
hello = "hello"
counter = 0
for i in range(0,n):
if(counter < 5 and str[i] == hello[counter]):
counter += 1
if(counter >= 5):
print("YES")
else:
print("NO") | vfc_81865 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "ahhellllloou",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "hlelo",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "h... |
codeforces | verifiable_code | 166 | Solve the following coding problem using the programming language python:
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are show... | a,b = map(int,input().split())
mat = []
for i in range(a) :
arr = list(map(int,input().split()))
mat.append(arr)
mat = sorted(mat, key = lambda x : (-x[0],x[1]))
print(mat.count(mat[b-1])) | vfc_81869 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 4\n3 1\n3 1\n5 3\n3 1\n3 1",
"output": "4",
"type": "stdin_stdout"
... |
codeforces | verifiable_code | 294 | Solve the following coding problem using the programming language python:
Shaass has decided to hunt some birds. There are *n* horizontal electricity wires aligned parallel to each other. Wires are numbered 1 to *n* from top to bottom. On each wire there are some oskols sitting next to each other. Oskol is the name of... | n=int(input())
s=input()
s=s.split()
l=[]
for i in range(n):
l.append(int(s[i]))
m = int(input())
for i in range(m):
ss=input()
ss=ss.split()
xi=int(ss[0])
yi=int(ss[1])
ox=l[xi-1]
l[xi-1]-=yi
if xi-2>=0:
l[xi-2]+=(yi-1)
ox=ox-yi
l[xi-... | vfc_81873 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\n10 10 10 10 10\n5\n2 5\n3 13\n2 12\n1 13\n4 6",
"output": "0\n12\n5\n0\n16",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n2 4 1\n1\n2 2",
"output": "3\n0\n3",
"type": "std... |
codeforces | verifiable_code | 432 | Solve the following coding problem using the programming language python:
The Saratov State University Olympiad Programmers Training Center (SSU OPTC) has *n* students. For each student you know the number of times he/she has participated in the ACM ICPC world programming championship. According to the ACM ICPC rules,... | fristNum,secondNum=map(int,input().split())
listNum=list(map(int,input().split()))
counts=0
for i in range(fristNum):
if(listNum[i]+secondNum <= 5):
counts+=1
print(counts//3)
| vfc_81877 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 2\n0 4 5 1 0",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 4\n0 1 2 3 4 5",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"... |
codeforces | verifiable_code | 278 | Solve the following coding problem using the programming language python:
The circle line of the Berland subway has *n* stations. We know the distances between all pairs of neighboring stations:
- *d*1 is the distance between the 1-st and the 2-nd station;- *d*2 is the distance between the 2-nd and the 3-rd station;... | num = int(input())
stations = list(map(int,list(input().split())))
points = sorted(list(map(int,list(input().split()))))
sum1 = sum(stations[points[0]-1:points[1]-1])
sum2 = sum(stations) - sum(stations[points[0]-1:points[1]-1])
if sum1 < sum2:
print(sum1)
else:
print(sum2)
| vfc_81881 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n2 3 4 9\n1 3",
"output": "5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n5 8 2 100\n4 1",
"output": "15",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 615 | Solve the following coding problem using the programming language python:
Vasya wants to turn on Christmas lights consisting of *m* bulbs. Initially, all bulbs are turned off. There are *n* buttons, each of them is connected to some set of bulbs. Vasya can press any of these buttons. When the button is pressed, it tur... | a,b=map(int,input().split())
g=set()
for i in range(a):
n=list(map(int,input().split()))
n.pop(0)
g.update(n)
print(['NO','YES'][len(g) == b]) | vfc_81885 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 4\n2 1 4\n3 1 3 1\n1 2",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 3\n1 1\n1 2\n1 1",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name"... |
codeforces | verifiable_code | 920 | Solve the following coding problem using the programming language python:
You have an array *a* consisting of *n* integers. Each integer from 1 to *n* appears exactly once in this array.
For some indices *i* (1<=≤<=*i*<=≤<=*n*<=-<=1) it is possible to swap *i*-th element with (*i*<=+<=1)-th, for other indices it is n... | n=int(input())
a=input().split()
b=input()+'1'
c=[]
k=0
for u in b:
c.append(k)
if u=='0':
k+=1
for i in range(0,n):
if c[i]!=c[int(a[i])-1]:
print('NO')
exit()
print('YES')
exit()
| vfc_81889 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6\n1 2 5 3 4 6\n01110",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6\n1 2 5 3 4 6\n01010",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name"... |
codeforces | verifiable_code | 522 | Solve the following coding problem using the programming language python:
One day *n* friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together.
Simply speaking, the process of taking photos can be described as follows. On the photo, each photographed frie... |
n = int(input())
W = 0
pers = []
H1 = 0; H2 = 0
I = 0
for i in range(n):
w, h = map(int, input().split())
pers.append([w,h])
W += w
if h > H2:
H2 = h
I = i
for i in range(n):
if i == I:
continue
w, h = pers[i]
if H2 >= h > H1:
H1 =... | vfc_81893 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n1 10\n5 5\n10 1",
"output": "75 110 60 ",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n2 1\n1 2\n2 1",
"output": "6 4 6 ",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 977 | Solve the following coding problem using the programming language python:
Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:
- if the last digit of the number is non-zero, s... | n, k = [int(z) for z in input().split(" ")]
for i in range(1,k+1):
if(n%10!=0):
n=n-1
else:
n=n/10
print(int(n))
| vfc_81897 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "512 4",
"output": "50",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1000000000 9",
"output": "1",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 385 | Solve the following coding problem using the programming language python:
The bear decided to store some raspberry for the winter. He cunningly found out the price for a barrel of honey in kilos of raspberry for each of the following *n* days. According to the bear's data, on the *i*-th (1<=≤<=*i*<=≤<=*n*) day, the pr... | n,c=map(int,input().split())
x=list(map(int,input().split()))
e=0
for i in range(n-1):
e=max(e,x[i]-x[i+1]-c)
print(e) | vfc_81901 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 1\n5 10 7 3 20",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 2\n100 1 10 40 10 40",
"output": "97",
"type": "stdin_stdout"
},
{
"fn_name": null... |
codeforces | verifiable_code | 103 | Solve the following coding problem using the programming language python:
The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".
The test consists of *n* questions; the questions are to b... | try:
t=int(input())
a=[int(i) for i in input().split()]
c=0
j=[]
for i in range(t):
c=(a[i]-1)*(i+1)+1
j.append(c)
print(sum(j))
except:
pass | vfc_81905 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n1 1",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n2 2",
"output": "5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1\n10",
... |
codeforces | verifiable_code | 415 | Solve the following coding problem using the programming language python:
Bimokh is Mashmokh's boss. For the following *n* days he decided to pay to his workers in a new way. At the beginning of each day he will give each worker a certain amount of tokens. Then at the end of each day each worker can give some of his t... | import math
n,a,b=map(int,input().split())
arr = list(map(int,input().split()))
for i in range(n):
x=(math.floor(arr[i]*a/b))
arr[i]-=(math.ceil(x*b/a))
print(*arr) | vfc_81913 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 1 4\n12 6 11 9 1",
"output": "0 2 3 1 1 ",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 61 | Solve the following coding problem using the programming language python:
Shapur was an extremely gifted student. He was great at everything including Combinatorics, Algebra, Number Theory, Geometry, Calculus, etc. He was not only smart but extraordinarily fast! He could manage to sum 1018 numbers in a single second.
... | line1 = input()
line2 = input()
output = []
for i in range(0,len(line1)):
if line1[i] == line2[i]:
output.append(0)
else:
output.append(1)
print(int(output[i]),end = "")
| vfc_81917 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "5000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1010100\n0100101",
"output": "1110001",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "000\n111",
"output": "111",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
codeforces | verifiable_code | 999 | Solve the following coding problem using the programming language python:
You are given a string $s$ consisting of $n$ lowercase Latin letters. Polycarp wants to remove exactly $k$ characters ($k \le n$) from the string $s$. Polycarp uses the following algorithm $k$ times:
- if there is at least one letter 'a', remo... | n,k=map(int,input().split())
s=input()
for j in range(ord('a'), ord('z') + 1):
i=len(s)
s=s.replace(chr(j), "",k)
j=len(s)
k-=(i-j)
if k==0:
break
print(s) | vfc_81921 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "15 3\ncccaabababaccbc",
"output": "cccbbabaccbc",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "15 9\ncccaabababaccbc",
"output": "cccccc",
"type": "stdin_stdout"
},
{
... |
codeforces | verifiable_code | 339 | Solve the following coding problem using the programming language python:
Xenia lives in a city that has *n* houses built along the main ringroad. The ringroad houses are numbered 1 through *n* in the clockwise order. The ringroad traffic is one way and also is clockwise.
Xenia has recently moved into the ringroad ho... | n,m = map(int, input().split(" "))
x=0
work = [int(x) for x in input().split()[:m]]
pos=1
for i in range(len(work)):
if(pos>work[i]):
x+=(n-(pos-work[i]))
pos=work[i]
else:
x+=((work[i]-pos))
pos=work[i]
print(x) | vfc_81925 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 3\n3 2 3",
"output": "6",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4 3\n2 3 3",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2... |
codeforces | verifiable_code | 80 | Solve the following coding problem using the programming language python:
A prime number is a number which has exactly two distinct divisors: one and itself. For example, numbers 2, 7, 3 are prime, and 1, 6, 4 are not.
The next prime number after *x* is the smallest prime number greater than *x*. For example, the nex... | def is_prime(n):
return n > 1 and all(n % i != 0 for i in range(2, int(n**0.5)+1))
n, m = map(int, input().split())
next_prime = n + 1
while not is_prime(next_prime):
next_prime += 1
print("YES" if next_prime == m else "NO") | vfc_81929 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 5",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7 11",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7 9",
... |
codeforces | verifiable_code | 44 | Solve the following coding problem using the programming language python:
Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it matches the color and the species of the tree of one... | n = int(input())
mySet = set(())
for i in range(n):
s = input()
mySet.add(s)
print(len(mySet)) | vfc_81933 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\nbirch yellow\nmaple red\nbirch yellow\nmaple yellow\nmaple green",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\noak yellow\noak yellow\noak yellow",
"output": "1"... |
codeforces | verifiable_code | 251 | Solve the following coding problem using the programming language python:
Little Petya likes points a lot. Recently his mom has presented him *n* points lying on the line *OX*. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exce... | import sys
input = sys.stdin.readline
def inInt():
return int(input())
def inStr():
return input().strip("\n")
def inIList():
return(list(map(int,input().split())))
def inSList():
return(input().split())
def solve(case, d):
ans = 0
j = 0
for i in range(len(case)):
whi... | vfc_81937 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 3\n1 2 3 4",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4 2\n-3 -2 -1 0",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"inp... |
codeforces | verifiable_code | 462 | Solve the following coding problem using the programming language python:
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?
Given a *n*<=×<=*n* checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that e... | def solve(n, arr):
for i in range(n):
for j in range(n):
cnt = 0
for x, y in [(-1, 0), (0, 1), (1, 0), (0, -1)]:
ni, nj = x + i, y + j
if ni >= 0 and ni < n and nj >= 0 and nj < n:
if arr[ni][nj] == "o":
... | vfc_81941 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\nxxo\nxox\noxx",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\nxxxo\nxoxo\noxox\nxxxx",
"output": "NO",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 94 | Solve the following coding problem using the programming language python:
Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza". Th... | s = input()
a = []
for i in range(10):
a.append(input())
p = 0
while(p < 80):
for i in range(10):
if a[i] == s[p:p+10]:
print(i, end='')
p += 10
break
| vfc_81945 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "01001100100101100000010110001001011001000101100110010110100001011010100101101100\n0100110000\n0100110010\n0101100000\n0101100010\n0101100100\n0101100110\n0101101000\n0101101010\n0101101100\n0101101110",
"output": "12345678",
... |
codeforces | verifiable_code | 818 | Solve the following coding problem using the programming language python:
There are *n* students who have taken part in an olympiad. Now it's time to award the students.
Some of them will receive diplomas, some wiil get certificates, and others won't receive anything. Students with diplomas and certificates are calle... | s=input()
l=s.split()
n=int(l[0])
k=int(l[1])
a=n//2
p1=a//(k+1)
p2=k*p1
p3=n-p2-p1
if p3>=n/2 :
print(int(p1),int(p2),int(p3))
else :
print(0,0,n) | vfc_81949 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "18 2",
"output": "3 6 9",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "9 10",
"output": "0 0 9",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "10000... |
codeforces | verifiable_code | 478 | Solve the following coding problem using the programming language python:
*n* participants of the competition were split into *m* teams in some manner so that each team has at least one participant. After the competition each pair of participants from the same team became friends.
Your task is to write a program that... | n,m = map(int,input().split())
temp = n-(m-1)
kmax = (temp*(temp-1))//2
a = n//m
temp1 = m*(a*(a-1))//2 + a*(n%m)
print(temp1,kmax) | vfc_81957 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 1",
"output": "10 10",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3 2",
"output": "1 1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 3",
... |
codeforces | verifiable_code | 509 | Solve the following coding problem using the programming language python:
An *n*<=×<=*n* table *a* is defined as follows:
- The first row and the first column contain ones, that is: *a**i*,<=1<==<=*a*1,<=*i*<==<=1 for all *i*<==<=1,<=2,<=...,<=*n*. - Each of the remaining numbers in the table is equal to the sum of... | n = int(input())
s = []
x = [[0] * n for _ in range(n)]
for i in range(n):
x[i][0] = 1
x[0][i] = 1
for i in range(1, n):
for j in range(1, n):
x[i][j] = x[i - 1][j] + x[i][j - 1]
for row in x:
s.append(max(row))
m = max(s)
print(m) | vfc_81961 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5",
"output": "70",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 468 | Solve the following coding problem using the programming language python:
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of *n* integers: 1,<=2,<=...,<=*n*. In a single step, you can pick two of them, let's denote the... | n=int(input())
if n>=4:
print("YES")
if n==4:
print("4 * 3 = 12")
print("12 * 2 = 24")
print("24 * 1 = 24")
elif n==5:
print("5 * 4 = 20")
print("20 + 3 = 23")
print("23 + 2 = 25")
print("25 - 1 = 24")
else:
print("4 * 3 = 12")... | vfc_81965 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1",
"output": "NO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "8",
"output": "YES\n8 * 7 = 56\n6 * 5 = 30\n3 - 4 = -1\n1 - 2 = -1\n30 - -1 = 31\n56 - 31 = 25\n25 + -1 = 24",
"... |
codeforces | verifiable_code | 897 | Solve the following coding problem using the programming language python:
— I experienced so many great things.
— You gave me memories like dreams... But I have to leave now...
— One last request, can you...
— Help me solve a Codeforces problem?
— ......
— What?
Chtholly has been thinking about a problem for day... | a, k = map(int, input().split())
sm = 0
for i in range(1, a + 1):
r = str(i)
sm += int(r + r[::-1])
sm %= k
print(sm % k) | vfc_81969 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 100",
"output": "33",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 30",
"output": "15",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "42147 4123... |
codeforces | verifiable_code | 46 | Solve the following coding problem using the programming language python:
A kindergarten teacher Natalia Pavlovna has invented a new ball game. This game not only develops the children's physique, but also teaches them how to count.
The game goes as follows. Kids stand in circle. Let's agree to think of the children... | aruncari = int(input(''))
def nr_ce_primesc_mingea(aruncari):
numar = 1
for i in range(1, aruncari):
numar = numar + i
if numar > aruncari:
numar = numar - aruncari
print(numar, end=' ')
nr_ce_primesc_mingea(aruncari) | vfc_81973 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "10",
"output": "2 4 7 1 6 2 9 7 6",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 672 | Solve the following coding problem using the programming language python:
Every year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems.
This is your first year at summer camp, and you are asked to solve the following problem. All integers starting with 1 are written in one li... | s=""
for i in range(1,1000):
f=str(i)
s=s+f
n=int(input())
print(s[n-1])
| vfc_81981 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "11",
"output": "0",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "12",
"output... |
codeforces | verifiable_code | 369 | Solve the following coding problem using the programming language python:
Valera is a lazy student. He has *m* clean bowls and *k* clean plates.
Valera has made an eating plan for the next *n* days. As Valera is lazy, he will eat exactly one dish per day. At that, in order to eat a dish, he needs exactly one clean p... | n, m, k = map(int, input().split())
daf = list(map(int, input().split()))
c = 0
total = 0
while (m>0 or k>0) and c < n:
f = daf[c]
if f == 1:
if m > 0:
m -= 1
else:
total += 1
else:
if k > 0:
k -= 1
elif m > 0:
... | vfc_81985 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 1 1\n1 2 1",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4 3 1\n1 1 1 1",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"inpu... |
codeforces | verifiable_code | 721 | Solve the following coding problem using the programming language python:
Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized *a*<=×<=*b* squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the colum... | n = int(input())
row = input()
row_arr = row.split("W")
row_arr = [i for i in row_arr if i != '']
print(len(row_arr))
#print(row_arr) # debugging
for i in row_arr:
print(len(i),end=" ")
| vfc_81989 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "3000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\nBBW",
"output": "1\n2 ",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5\nBWBWB",
"output": "3\n1 1 1 ",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 228 | Solve the following coding problem using the programming language python:
Valera the Horse is going to the party with friends. He has been following the fashion trends for a while, and he knows that it is very popular to wear all horseshoes of different color. Valera has got four horseshoes left from the last year, bu... | shoes = list(input().split())
shoes = list(map(int, shoes))
colours = []
count = 0
for i in range(len(shoes)):
if shoes[i] in colours:
count += 1
else:
colours.append(shoes[i])
print(count)
| vfc_81993 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1 7 3 3",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7 7 7 7",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "8117086... |
codeforces | verifiable_code | 894 | Solve the following coding problem using the programming language python:
"QAQ" is a word to denote an expression of crying. Imagine "Q" as eyes with tears and "A" as a mouth.
Now Diamond has given Bort a string consisting of only uppercase English letters of length *n*. There is a great number of "QAQ" in the string... | t = list(input())
q_inds = [i for i, x in enumerate(t) if x == "Q"]
a_inds = [i for i, x in enumerate(t) if x == "A"]
ans = 0
for i, qi in enumerate(q_inds):
for ai in a_inds:
if qi < ai:
for qi_2 in q_inds[i+1:]:
if ai < qi_2:
ans += 1
print(ans) | vfc_81997 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "QAQAQYSYIOIWIN",
"output": "4",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 534 | Solve the following coding problem using the programming language python:
An exam for *n* students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers (*i* and *i*<=+<=1) always studied side by side and became friends and... | def odd(lst,n):
for i in range(1,n+1,2):
lst.append(i)
def even(lst,n):
start=2
if len(lst)==1 or n==3:
start=4
for j in range(start,n+1,2):
lst.append(j)
n=int(input())
lst=[]
if n%2==0 and n>2:
even(lst, n)
odd(lst, n)
... | vfc_82001 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "6",
"output": "6\n5 3 1 6 4 2 ",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3",
"output": "2\n1 3",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 408 | Solve the following coding problem using the programming language python:
Little Vasya went to the supermarket to get some groceries. He walked about the supermarket for a long time and got a basket full of products. Now he needs to choose the cashier to pay for the products.
There are *n* cashiers at the exit from t... | class CodeforcesTask408ASolution:
def __init__(self):
self.result = ''
self.cash_count = 0
self.client_cashwise = []
self.baskets = []
def read_input(self):
self.cash_count = int(input())
self.client_cashwise = [int(x) for x in input().split(" ")]
... | vfc_82005 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n1\n1",
"output": "20",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n1 4 3 2\n100\n1 2 2 3\n1 9 1\n7 8",
"output": "100",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 701 | Solve the following coding problem using the programming language python:
Vasya has the square chessboard of size *n*<=×<=*n* and *m* rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.
The cell of the field is under rook's attack, if there is at least one r... | import sys
input = lambda:sys.stdin.readline()
int_arr = lambda: list(map(int,input().split()))
str_arr = lambda: list(map(str,input().split()))
get_str = lambda: map(str,input().split())
get_int = lambda: map(int,input().split())
get_flo = lambda: map(float,input().split())
mod = 1000000007
# def solve()... | vfc_82009 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 3\n1 1\n3 1\n2 2",
"output": "4 2 0 ",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 2\n1 5\n5 1",
"output": "16 9 ",
"type": "stdin_stdout"
},
{
"fn_name": nul... |
codeforces | verifiable_code | 25 | Solve the following coding problem using the programming language python:
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given *n* numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob — to check his an... | n=int(input())
m=input().split()
jishu=0
oushu=0
for i in range(3):
k=int(m[i])/2-int(m[i])//2
if k==0:
oushu+=1
else:
jishu+=1
if jishu>oushu:
for i in range(n):
kt=int(m[i])/2-int(m[i])//2
if kt==0:
print(i+1)
break
else:
for... | vfc_82013 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\n2 4 7 8 10",
"output": "3",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n1 2 1 1",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input":... |
codeforces | verifiable_code | 483 | Solve the following coding problem using the programming language python:
Your friend has recently learned about coprime numbers. A pair of numbers {*a*,<=*b*} is called coprime if the maximum number that divides both *a* and *b* is equal to one.
Your friend often comes up with different statements. He has recently ... | l,r = map(int,input().split())
range = r - l + 1
if (range < 3) or (l % 2 == 1 and range < 4):
print(-1)
else:
if (l % 2 == 0):
print(l,l+1,l+2)
else:
print(l+1,l+2,l+3) | vfc_82017 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 4",
"output": "2 3 4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "10 11",
"output": "-1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "90000000... |
codeforces | verifiable_code | 931 | Solve the following coding problem using the programming language python:
Two friends are on the coordinate axis *Ox* in points with integer coordinates. One of them is in the point *x*1<==<=*a*, another one is in the point *x*2<==<=*b*.
Each of the friends can move by one along the line in any direction unlimited n... | import math
a = int(input())
b = int(input())
z = math.fabs(a-b)//2
n = 0
for i in range(int((math.fabs(a-b)-z))+1):
n+=i
for i in range(int(z)+1):
n+=i
print(n) | vfc_82021 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n4",
"output": "1",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 903 | Solve the following coding problem using the programming language python:
Ivan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some fried chicken.
CFK sells chicken chunks in small and large portions. A small portion contains 3 chunks; a large one — 7 chunks. Ivan ... | #903A
n = int(input())
for i in range(n):
x = int(input())
if x%3==0:
print('YES')
elif x %3== 1:
if x >= 7:
print('YES')
else:
print('NO')
else:
if x >=14:
print('YES')
else:
print('NO') | vfc_82025 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n6\n5",
"output": "YES\nNO",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "100\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n3... |
codeforces | verifiable_code | 584 | Solve the following coding problem using the programming language python:
Olesya loves numbers consisting of *n* digits, and Rodion only likes numbers that are divisible by *t*. Find some number that satisfies both of them.
Your task is: given the *n* and *t* print an integer strictly larger than zero consisting of *... | n, t=(map(int,input().split()))
if n==1 and t==10:
print(-1)
elif n>=2 and t ==10:
for i in range((n-1)):
print('1',end="")
print(0)
else:
for i in range((n)):
print(t,end="")
| vfc_82029 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 2",
"output": "222",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2 2",
"output": "22",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4 3",
... |
codeforces | verifiable_code | 597 | Solve the following coding problem using the programming language python:
Find the number of *k*-divisible numbers on the segment [*a*,<=*b*]. In other words you need to find the number of such integer values *x* that *a*<=≤<=*x*<=≤<=*b* and *x* is divisible by *k*.
The input will be provided via standard input and l... | print((lambda x : (x[2]//x[0])-((x[1]-1)//x[0]))(list(map(int,input().split())))) | vfc_82037 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1 1 10",
"output": "10",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 989 | Solve the following coding problem using the programming language python:
"What a pity it's already late spring," sighs Mino with regret, "one more drizzling night and they'd be gone."
"But these blends are at their best, aren't they?" Absorbed in the landscape, Kanno remains optimistic.
The landscape can be expres... | s=input()
n=len(s)
f=0
for i in range(n-2):
if(ord(s[i])+ord(s[i+1])+ord(s[i+2])==198 and s[i]!=s[i+1]):
f=1
break
if(f==0):
print("NO")
else:
print("YES") | vfc_82041 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "1000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": ".BAC.",
"output": "Yes",
"type": "stdin_stdout"
}
]
} |
codeforces | verifiable_code | 373 | Solve the following coding problem using the programming language python:
Cucumber boy is fan of Kyubeat, a famous music game.
Kyubeat has 16 panels for playing arranged in 4<=×<=4 table. When a panel lights up, he has to press that panel.
Each panel has a timing to press (the preffered time when a player should pre... | # https://codeforces.com/problemset/problem/373/A
# 900
n = int(input())
n2 = n * 2
x = {}
o = "YES"
for _ in range(4):
r = input()
for c in r:
if c == ".":
continue
x.setdefault(c, 0)
x[c] += 1
if x[c] > n2:
o = "NO"
break
print(o)
| vfc_82045 | {
"difficulty": "N/A",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": null,
"time_limit": "2000"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n.135\n1247\n3468\n5789",
"output": "YES",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5\n..1.\n1111\n..1.\n..1.",
"output": "YES",
"type": "stdin_stdout"
},
{
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.