source stringclasses 4
values | task_type stringclasses 1
value | in_source_id stringlengths 0 125 | problem_statement stringlengths 235 1.63k | gold_standard_solution stringlengths 0 11.2k | problem_id stringlengths 7 10 | metadata dict | verification_info dict |
|---|---|---|---|---|---|---|---|
apps | verifiable_code | 2496 | Solve the following coding problem using the programming language python:
We have N integers. The i-th number is A_i.
\{A_i\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\leq i < j \leq N.
\{A_i\} is said to be setwise coprime when \{A_i\} is not pairwise coprime but GCD(A... | ```python
from math import gcd
N = int(input())
num_lis = list(map(int, input().split()))
c = True
def osa_k(max_num):
lis = [i for i in range(max_num+1)]
p = 2
while p**2 <= max_num:
if lis[p] == p:
for q in range(2*p, max_num+1, p):
if lis[q] == q:
lis[q] = p
p += 1
return li... | vfc_19717 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc177/tasks/abc177_e",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n3 4 5\n",
"output": "pairwise coprime\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n6 10 15\n",
"output": "setwise coprime\n",
"type": "stdin_stdout"
},
{
... |
apps | verifiable_code | 1181 | Solve the following coding problem using the programming language python:
Chef has a natural number N. Cheffina challenges chef to check whether the given number is divisible by the sum of its digits or not. If the given number is divisible then print "Yes" else "No".
-----Input:-----
- First-line will contain $T$, t... | ```python
import sys,io,os,math
from math import ceil,log,gcd,inf
from itertools import permutations
mod=1000000007
mod1=998244353
def printlist(n):
sys.stdout.write(" ".join(map(str,n)) + "\n")
printf=lambda n:sys.stdout.write(str(n)+"\n")
def printns(n):
sys.stdout.write(str(n))
def intinp():
return in... | vfc_3566 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/PEND2020/problems/ANITGUY9",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n16\n27\n",
"output": "No\nYes\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 1898 | Solve the following coding problem using the programming language python:
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.
Hulk likes the Inception so much, and like that his ... | ```python
n = int(input())
for i in range(1,n):
if i%2 == 1:
print('I hate that',end=' ')
else:
print('I love that',end=' ')
if n%2 == 1:
print('I hate it',end=' ')
else:
print('I love it',end=' ')
``` | vfc_17346 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/705/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n",
"output": "I hate it\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n",
"output": "I hate that I love it\n",
"type": "stdin_stdout"
},
{
"fn_name": null,... |
apps | verifiable_code | 1578 | Solve the following coding problem using the programming language python:
For an integer N, we will choose a permutation \{P_1, P_2, ..., P_N\} of \{1, 2, ..., N\}.
Then, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.
Find the maximum possible value of M_1 + M_2 + \cdots + M_N.
-----Constrai... | ```python
n=int(input())
print(n*(n+1)//2-n)
``` | vfc_16066 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc139/tasks/abc139_d",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "13\n",
"output": "78\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1\n",
... |
apps | verifiable_code | 372 | Solve the following coding problem using the programming language python:
You are given two circles. Find the area of their intersection.
-----Input-----
The first line contains three integers x_1, y_1, r_1 ( - 10^9 ≤ x_1, y_1 ≤ 10^9, 1 ≤ r_1 ≤ 10^9) — the position of the center and the radius of the first circle.
... | ```python
#!/usr/bin/env python3
# 600D_circles.py - Codeforces.com/problemset/problem/600/D by Sergey 2015
import unittest
import sys
import math
import decimal
###############################################################################
# Circles Class (Main Program)
#############################################... | vfc_11242 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/600/D",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "0 0 4\n6 0 4\n",
"output": "7.25298806364175601379\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "0 0 5\n11 0 5\n",
"output": "0.00000000000000000000\n",
"type": "stdin_stdout... |
apps | verifiable_code | 719 | Solve the following coding problem using the programming language python:
-----Problem-----
Suppose there is a circle. There are N Juice shops on that circle. Juice shops are numbered 0 to N-1 (both inclusive). You have two pieces of information corresponding to each of the juice shop:
(1) the amount of Juice that a ... | ```python
import re,sys
def isCirlePossible(juices,distances):
if juices == [] or distances == []:
return -1;
total_juice_consumed = 0
juice_consumed = 0
start=0
for i in range(0,len(juices)):
diff = juices[i] - distances[i]
if juice_consumed >= 0:
juice_consumed += diff
else:
juice_consumed = diff
... | vfc_1718 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/COMN2016/problems/SUMTOUR",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n1 5\n10 3\n3 4\n",
"output": "1\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 545 | Solve the following coding problem using the programming language python:
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.
More formally, you are given two strings s_1, s_2 of length n and numbe... | ```python
def main():
import sys
n, t, s1, s2 = sys.stdin.read().split()
n, t = int(n), int(t)
result = [-1] * n
rest = n - t
for i in range(n):
if rest == 0: break
if s1[i] == s2[i]:
result[i] = s1[i]
rest -= 1
k = rest
for i in range(n)... | vfc_11934 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/584/C",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3 2\nabc\nxyc\n",
"output": "bac",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 0\nc\nb\n",
"output": "-1\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
apps | verifiable_code | 758 | Solve the following coding problem using the programming language python:
Everyone loves short problem statements.
Given a function $ f(x) $ find its minimum value over the range $ 0 < x < π/2$
$
f(x) = ( x^2 + b*x + c ) / sin( x )
$
-----Input:-----
- First-line will contain $T$, the number of test cases. Then the t... | ```python
import sys
import math
input=sys.stdin.readline
def binary(l,r,co,b,c):
x=(l+r)/2
#print(x)
val1=(2*x+b)*math.sin(x)
val2=(x**2+b*x+c)*math.cos(x)
x=(l+r)/2
val=val1-val2
if(abs(val)<.0000001 or co==150):
return (l+r)/2
if(val<0):
return binary((l+r)/2,r,co+1,b,c)
else:
return binary(l,(l+r)/2,... | vfc_1874 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/ICM2020/problems/ICM2003",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n2 2\n",
"output": "5.8831725615\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 4400 | Solve the following coding problem using the programming language python:
We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that d... | ```python
S = str(input())
if "RRR" in S:
print(3)
elif "RR" in S:
print(2)
elif "R" in S:
print(1)
else:
print(0)
``` | vfc_26307 | {
"difficulty": "introductory",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc175/tasks/abc175_a",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "RRS\n",
"output": "2\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "SSS\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "RSR\n",... |
apps | verifiable_code | 404 | Solve the following coding problem using the programming language python:
Ivan has number $b$. He is sorting through the numbers $a$ from $1$ to $10^{18}$, and for every $a$ writes $\frac{[a, \,\, b]}{a}$ on blackboard. Here $[a, \,\, b]$ stands for least common multiple of $a$ and $b$. Ivan is very lazy, that's why t... | ```python
#JMD
#Nagendra Jha-4096
import sys
import math
#import fractions
#import numpy
###File Operations###
fileoperation=0
if(fileoperation):
orig_stdout = sys.stdout
orig_stdin = sys.stdin
inputfile = open('W:/Competitive Programming/input.txt', 'r')
outputfile = open('W:/Competitive Programm... | vfc_11370 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/1068/B",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n",
"output": "2",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "16\n",
"o... |
apps | verifiable_code | 3861 | Solve the following coding problem using the programming language python:
Given an array a_1, a_2, ..., a_{n} of n integers, find the largest number in the array that is not a perfect square.
A number x is said to be a perfect square if there exists an integer y such that x = y^2.
-----Input-----
The first line co... | ```python
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
a.reverse()
for i in a:
if i < 0:
print(i)
return
if int(i ** 0.5) ** 2 != i:
print(i)
return
``` | vfc_24151 | {
"difficulty": "competition",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/914/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n4 2\n",
"output": "2\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "8\n1 2 4 8 16 32 64 576\n",
"output": "32\n",
"type": "stdin_stdout"
},
{
"fn_name": null,... |
apps | verifiable_code | 1003 | Solve the following coding problem using the programming language python:
Vasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them away. Every m-th day (at days with numbers m, ... | ```python
"""
Codeforces Contest 262 Div 2 Problem A
Author : chaotic_iak
Language: Python 3.3.4
"""
def main():
n,m = read()
i = 0
while n:
n -= 1
i += 1
if not i%m: n += 1
print(i)
################################### NON-SOLUTION STUFF BELOW
def read(mode=2):
# 0: Stri... | vfc_13766 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/460/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 2\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "9 3\n",
"output": "13\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 2\n"... |
apps | verifiable_code | 4444 | Solve the following coding problem using the programming language python:
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
-----Constraints-----
- S and T are strings consisting of lowercase English let... | ```python
S,T = map(str,input().split())
print(T + S)
``` | vfc_26483 | {
"difficulty": "introductory",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc149/tasks/abc149_a",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "oder atc\n",
"output": "atcoder\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "humu humu\n",
"output": "humuhumu\n",
"type": "stdin_stdout"
},
{
"fn_name": null,... |
apps | verifiable_code | 608 | Solve the following coding problem using the programming language python:
Abhi Ram analyses london stock exchange and invests in a software company C-.gate . He wants to sell his shares after 5 weeks.
Given the investment m, increase or decrease of share prices of 5 weeks(+/- pi) , help him to calculate his net prof... | ```python
for i in range(int(input())):
n = int(input())
P = list(map(float, input().split()))
pr = 1
for p in P:
a = 100+p
pr = (pr*a)/100
pr = (pr-1)*100
x = 6-len(str(int(abs(pr))))
if (x==1):
if (pr==0):
print(0)
elif (pr>0):
print("+"+str("%.1f" % round(pr,x)))
els... | vfc_1274 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/ITRA2016/problems/ITRA03",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n10000\n+5 -3 -2 +10 +15\n6256250\n-24 +22 +4 -16 +20\n",
"output": "+26.2634\n-2.79977\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 923 | Solve the following coding problem using the programming language python:
Like all minions Dave also like to eat bananas. So as to his obsession, he is eating banana, but this time in different way. There are N bananas in dish. Dave wants to eat all of them. He starts eating at speed 1 banana/second. He can increase o... | ```python
t=int(input())
while(t):
k=1
j=0
n=int(input())
while(n>0):
if(n<=k):
j+=1
n=0
elif n>2*k:
j+=2
n=n-2*k
k+=1
else:
j+=2
n=0
print(j)
t-=1
``` | vfc_2534 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/CFSN2015/problems/PUNBAN",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n2\n4\n",
"output": "2\n3\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 4577 | Solve the following coding problem using the programming language python:
You are given three integers A, B and C.
Determine whether C is not less than A and not greater than B.
-----Constraints-----
- -100≤A,B,C≤100
- A, B and C are all integers.
-----Input-----
Input is given from Standard Input in the followin... | ```python
# 3 つの整数 A , B , C が与えられます。
# 整数 C が A 以上 かつ B 以下であるかを判定してください。
A,B,C = map(int,input().split())
if C >= A and C <= B:
print('Yes')
else:
print('No')
``` | vfc_26997 | {
"difficulty": "introductory",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc061/tasks/abc061_a",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1 3 2\n",
"output": "Yes\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 5 4\n",
"output": "No\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "... |
apps | verifiable_code | 4724 | Solve the following coding problem using the programming language python:
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 t... | ```python
# 現在と目標のレーティングを取得
R = int(input())
G = int(input())
# 目標のレーティングになるためのパフォーマンスの数値を計算
Target = (G * 2) - R
# 計算結果を出力
print(Target)
``` | vfc_27531 | {
"difficulty": "introductory",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc076/tasks/abc076_a",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2002\n2017\n",
"output": "2032\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4500\n0\n",
"output": "-4500\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 3879 | Solve the following coding problem using the programming language python:
Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size a_{i} dollars.
Each p... | ```python
def i23(x):
while x%2==0:
x//=2
while x%3==0:
x//=3
return x == 1
import fractions
from fractions import gcd
x = int(input())
y = list(map(int, input().split(' ')))
gcdx = y[0]
for i in y:
gcdx = gcd(i, gcdx)
for i in y:
if not i23(i/gcdx):
print("No")
qui... | vfc_24223 | {
"difficulty": "competition",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/573/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n75 150 75 50\n",
"output": "Yes\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n100 150 250\n",
"output": "No\n",
"type": "stdin_stdout"
},
{
"fn_name": nul... |
apps | verifiable_code | 621 | Solve the following coding problem using the programming language python:
Given n words w[1..n], which originate from the same stem (e.g. grace, graceful, disgraceful, gracefully), we are interested in the original stem. To simplify the problem, we define the stem as the longest consecutive substring that occurs in al... | ```python
t = eval(input())
for _ in range(t):
n = eval(input())
a = input().strip().split()
cb, cs = 0, ""
for i in range(len(a[0])):
for j in range(i+1,len(a[0])+1):
al = True
s = a[0][i:j]
for k in a[1:]:
if s not in k:
al = False
break
if al:
if j-i>=cb:
cb = max(cb, j-i)
... | vfc_1326 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/COOK63/problems/STEM",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n4\ngrace graceful disgraceful gracefully\n",
"output": "grace\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 961 | Solve the following coding problem using the programming language python:
The chef has one array of N natural numbers (might be in sorted order). Cheffina challenges chef to find the total number of inversions in the array.
-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases ... | ```python
# cook your dish here
def mergeSort(arr, n):
# A temp_arr is created to store
# sorted array in merge function
temp_arr = [0]*n
return _mergeSort(arr, temp_arr, 0, n-1)
# This Function will use MergeSort to count inversions
def _mergeSort(arr, temp_arr, left, right):
# A va... | vfc_2686 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/PSTR2020/problems/ANITGUY3",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n5\n5 4 1 3 2\n",
"output": "8\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 4328 | Solve the following coding problem using the programming language python:
You are given positive integers A and B.
If A is a divisor of B, print A + B; otherwise, print B - A.
-----Constraints-----
- All values in input are integers.
- 1 \leq A \leq B \leq 20
-----Input-----
Input is given from Standard Input in t... | ```python
a,b = map(int, input().split())
print(a+b if b%a==0 else b-a)
``` | vfc_26019 | {
"difficulty": "introductory",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc118/tasks/abc118_a",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 12\n",
"output": "16\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "8 20\n",
"output": "12\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1 1... |
apps | verifiable_code | 1356 | Solve the following coding problem using the programming language python:
Chef is good at making pancakes. Generally he gets requests to serve N pancakes at once.
He serves them in the form of a stack.
A pancake can be treated as a circular disk with some radius.
Chef needs to take care that when he places a pancake o... | ```python
t=[[1]]
def bell_numbers(start, stop):
## Swap start and stop if start > stop
if stop < start: start, stop = stop, start
if start < 1: start = 1
if stop < 1: stop = 1
c = 1 ## Bell numbers count
while c <= stop:
if c >= start:
yield t[-1][0] ## Yield the Bell number of the previous ... | vfc_4266 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/APRIL12/problems/PANSTACK",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n1\n2\n",
"output": "1\n2\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 1007 | Solve the following coding problem using the programming language python:
Given an array A1,A2...AN, you have to print the size of the largest contiguous subarray such that
GCD of all integers in that subarray is 1.
Formally,
For a subarray Ai,Ai+1...Aj where 1 ≤ i < j ≤ N to be valid: GCD(Ai,Ai+1...Aj) should be 1.... | ```python
import math
for _ in range(int(input())):
n=int(input())
ar=[int(x) for x in input().split()]
# dp=[1]*n
f=0
g=ar[0]
for i in range(1,n):
g=math.gcd(g,ar[i])
if g==1:
f=1
print(n)
break
if f==0:
print(-1)
``` | vfc_2870 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/problems/SUBGCD",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n2\n7 2\n3\n2 2 4\n",
"output": "2\n-1\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 4583 | Solve the following coding problem using the programming language python:
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols ... | ```python
S = input()
a = int(S[0])
b = int(S[1])
c = int(S[2])
d = int(S[3])
if a+b+c+d==7:
print('{}+{}+{}+{}=7'.format(a,b,c,d))
elif a+b+c-d==7:
print('{}+{}+{}-{}=7'.format(a,b,c,d))
elif a+b-c+d==7:
print('{}+{}-{}+{}=7'.format(a,b,c,d))
elif a+b-c-d==7:
print('{}+{}-{}-{}=7'.format(a,b,c,d))
e... | vfc_27021 | {
"difficulty": "introductory",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc079/tasks/abc079_c",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1222\n",
"output": "1+2+2+2=7\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "0290\n",
"output": "0-2+9+0=7\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
apps | verifiable_code | 2648 | Solve the following coding problem using the programming language python:
Snuke has decided to play a game using cards.
He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.
He will perform the operation described below zero or more times, so that the values written on the rema... | ```python
n=int(input())
a=list(map(int,input().split()))
num=[0]*100001
for i in a:
num[i]+=1
x=0
for i in num:
if i<=0:
continue
elif i%2==0:
n-=i
x+=1
else:
n-=i-1
if x%2:
x-=1
print(n+x)
``` | vfc_20286 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc053/tasks/arc068_b",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\n1 2 1 3 7\n",
"output": "3\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "15\n1 3 5 2 1 3 2 8 8 6 2 6 11 1 1\n",
"output": "7\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 796 | Solve the following coding problem using the programming language python:
You have $n \times n$ square grid and an integer $k$. Put an integer in each cell while satisfying the conditions below. All numbers in the grid should be between $1$ and $k$ inclusive. Minimum number of the $i$-th row is $1$ ($1 \le i \le n$)... | ```python
fa = [1]
m = 251
P = 10**9+7
for i in range(1, m+1): fa.append(fa[-1] * i % P)
fainv = [pow(fa[m], P-2, P)]
for i in range(1, m+1)[::-1]: fainv.append(fainv[-1] * i % P)
fainv = fainv[::-1]
def C(a, b): return fa[a] * fainv[a-b] * fainv[b] % P
N, K = list(map(int, input().split()))
poK = [1]
for i in range(2... | vfc_12938 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/1228/E",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2 2\n",
"output": "7\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "123 456789\n",
"output": "689974806\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"i... |
apps | verifiable_code | 709 | Solve the following coding problem using the programming language python:
You are a lover of bacteria. You want to raise some bacteria in a box.
Initially, the box is empty. Each morning, you can put any number of bacteria into the box. And each night, every bacterium in the box will split into two bacteria. You hop... | ```python
n = int(input())
ans = 1
while n != 1:
if n % 2 == 1:
ans += 1
n -= 1
else:
n //= 2
print(ans)
``` | vfc_12590 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/579/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\n",
"output": "2\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "8\n",
"output": "1\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "536870911\n... |
apps | verifiable_code | 1320 | Solve the following coding problem using the programming language python:
Chef has many friends, but his best friend is Hemant. They both love to watch anime.
In fact, their weekends are meant for that only. Also, Hemant is highly into games, of which Chef is unaware. Hemant once gave a game to Chef and asked him to d... | ```python
for _ in range(int(input())):
n=int(input())
if(n<3):
print("B")
else:
if(n==3):
print("A")
elif(n%2):
print("B")
else:
print("B")
``` | vfc_4122 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/ENCO2020/problems/ENC2020A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n1\n3\n7\n",
"output": "B\nA\nB\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 4177 | Solve the following coding problem using the programming language python:
Given is a string S. Replace every character in S with x and print the result.
-----Constraints-----
- S is a string consisting of lowercase English letters.
- The length of S is between 1 and 100 (inclusive).
-----Input-----
Input is given ... | ```python
S = input()
l = len(S)
print("x" * l)
``` | vfc_25415 | {
"difficulty": "introductory",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc154/tasks/abc154_b",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "sardine\n",
"output": "xxxxxxx\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "xxxx\n",
"output": "xxxx\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"in... |
apps | verifiable_code | 3869 | Solve the following coding problem using the programming language python:
You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are parallel to the coordinate axes: the length of the... | ```python
from math import sin, cos, tan, atan, pi
def main():
w, h, a = map(int, input().split())
a = min(a, 180 - a) * pi / 180
if h > w:
h, w = w, h
if h * (1 + cos(a)) < w * sin(a):
res = h * h / sin(a)
else:
res = h * w - ((w - h * tan(a / 2)) ** 2 * tan(a) + (h - w * ... | vfc_24183 | {
"difficulty": "competition",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/280/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1 1 45\n",
"output": "0.828427125\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6 4 30\n",
"output": "19.668384925\n",
"type": "stdin_stdout"
},
{
"fn_name": nu... |
apps | verifiable_code | 3736 | Solve the following coding problem using the programming language python:
Recently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?
The market analysts came up with a very smart plan: the name of the company should ... | ```python
s=input()
M={"A","H","I","M","O","T","U","V","W","X","Y"}
ans="YES"
n=len(s)
for i in range(len(s)//2):
x=s[i]
y=s[n-i-1]
if(x!=y or x not in M):
ans="NO"
break
if(n%2==1):
if(s[n//2] not in M):
ans="NO"
print(ans)
``` | vfc_23652 | {
"difficulty": "competition",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/420/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "AHA\n",
"output": "YES\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "Z\n",
"output": "NO\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "XO\n",... |
apps | verifiable_code | 271 | Solve the following coding problem using the programming language python:
Vasya has a non-negative integer n. He wants to round it to nearest integer, which ends up with 0. If n already ends up with 0, Vasya considers it already rounded.
For example, if n = 4722 answer is 4720. If n = 5 Vasya can round it to 0 or to ... | ```python
import math
n = int(input())
print(10 * round(n / 10))
``` | vfc_10838 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/898/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "113\n",
"output": "110\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1000000... |
apps | verifiable_code | 316 | Solve the following coding problem using the programming language python:
While playing with geometric figures Alex has accidentally invented a concept of a $n$-th order rhombus in a cell grid.
A $1$-st order rhombus is just a square $1 \times 1$ (i.e just a cell).
A $n$-th order rhombus for all $n \geq 2$ one obtai... | ```python
n = int(input())
a = n * (n + 1) // 2
print(4 * a - 4 * n + 1)
``` | vfc_11018 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/1180/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n",
"output": "5",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "3\n",
"ou... |
apps | verifiable_code | 2013 | Solve the following coding problem using the programming language python:
You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty substring of s and shift all its letters 'z' $\rightarrow$ 'y' $\rightarrow$ 'x' $\rightarrow \ldots \rightarrow$ 'b' $\rightarrow... | ```python
#!/usr/bin/env python3
import re
try:
while True:
s = input()
m = re.search(r"[^a]", s)
if m is None:
print(s[:-1], end="z\n")
else:
j = s.find('a', m.end())
if j == -1:
j = len(s)
print(end=s[:m.start()])
... | vfc_5598 | {
"difficulty": "competition",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/708/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "codeforces\n",
"output": "bncdenqbdr\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "abacaba\n",
"output": "aaacaba\n",
"type": "stdin_stdout"
},
{
"fn_name": nul... |
apps | verifiable_code | 1224 | Solve the following coding problem using the programming language python:
Given is an integer N.
Determine whether there is a pair of positive integers (A, B) such that 3^A + 5^B = N, and find one such pair if it exists.
-----Constraints-----
- 1 \leq N \leq 10^{18}
- All values in input are integers.
-----Input--... | ```python
n=int(input())
for i in range(1,100):
if 3**i > n:
print(-1)
break
x=n-3**i
for j in range(1,100):
if x==5**j:
print(i,j)
return
``` | vfc_14650 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/arc106/tasks/arc106_a",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "106\n",
"output": "4 2\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "1024\n",
"output": "-1\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "104... |
apps | verifiable_code | 625 | Solve the following coding problem using the programming language python:
Shaun is very much interested in Subarrays. Shaun wants to count the number of subarrays in his chosen array with sum being a multiple of $10^9$. Since, Shaun is interested in huge numbers.He chose his array such that it contains only $10^8$ and... | ```python
def subCount(arr, n, k):
mod = []
for i in range(k + 1):
mod.append(0)
cumSum = 0
for i in range(n):
cumSum = cumSum + arr[i]
# as the sum can be negative,
# taking modulo twice
mod[((cumSum % k) + k) % k] = mod[((cumSum % k) + k) % k] +... | vfc_1342 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/COCA2020/problems/COCA2001",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n3\n100000000 900000000 100000000\n1\n900000000\n",
"output": "2\n0\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 224 | 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... | ```python
# You lost the game.
s = str(input())
n = len(s)
d = -1
r = 0
V = "AEIOUY"
for i in range(n):
if V.count(s[i]):
r = max(r,i-d)
d = i
print(max(r, n-d))
``` | vfc_10650 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/733/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "ABABBBACFEYUKOTT\n",
"output": "4",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "AAA\n",
"output": "1",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input":... |
apps | verifiable_code | 4680 | Solve the following coding problem using the programming language python:
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, ... | ```python
haiku = list(map(int, input().split()))
if haiku == [5, 5, 7] or haiku == [5, 7, 5] or haiku == [7, 5, 5]:
print("YES")
else:
print("NO")
``` | vfc_27355 | {
"difficulty": "introductory",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc042/tasks/abc042_a",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 5 7\n",
"output": "YES\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "7 7 5\n",
"output": "NO\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 4264 | Solve the following coding problem using the programming language python:
Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).
-----Constraints-----
- 1 \leq N \leq 10^5
-----Input-----
Input is given from Standard... | ```python
n=input()
count=0
for i in range(1,int(n)+1):
l=len(str(i))
if l%2!=0:
count+=1
print(count)
``` | vfc_25763 | {
"difficulty": "introductory",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://atcoder.jp/contests/abc136/tasks/abc136_b",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "11\n",
"output": "9\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "136\n",
"output": "46\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "100000\... |
apps | verifiable_code | 435 | Solve the following coding problem using the programming language python:
High school student Vasya got a string of length n as a birthday present. This string consists of letters 'a' and 'b' only. Vasya denotes beauty of the string as the maximum length of a substring (consecutive subsequence) consisting of equal let... | ```python
n, k = map(int,input().split())
s = input()
maxi = 0
a = 0
b = 0
st = 0
for i in range(0, n):
if s[i] == 'a': a += 1
else: b+=1
if min(a, b) > k:
if s[st] == 'a': a-=1
else: b-=1
st += 1
else: maxi += 1
print(maxi)
``` | vfc_11494 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/676/C",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4 2\nabba\n",
"output": "4\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "8 1\naabaabaa\n",
"output": "5\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"... |
apps | verifiable_code | 1757 | Solve the following coding problem using the programming language python:
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters. [Image]
Her friend suggested that her name should only consis... | ```python
d = [1, 1]
n = int(input())
while d[-1] < n:
d.append(d[-1] + d[-2])
s = set(d)
res = ''
for i in range(1, n + 1):
if i in s:
res += 'O'
else:
res += 'o'
print(res)
``` | vfc_16782 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/918/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "8\n",
"output": "OOOoOooO\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "15\n",
"output": "OOOoOooOooooOoo\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
... |
apps | verifiable_code | 1549 | Solve the following coding problem using the programming language python:
The chef is trying to solve some pattern problems, Chef wants your help to code it. Chef has one number K to form new pattern. Help the chef to code this pattern problem.
-----Input:-----
- First line will contain $T$, number of testcases. Then... | ```python
# cook your dish here
import copy
for _ in range(int(input())):
k=int(input())
c=[]
d=[]
start=0
while True:
c=[]
for i in range(start):
c.append(" ")
for i in range(start,k+1):
c.append(str(i))
start+=1
d.append(c)
... | vfc_5038 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/PBK02020/problems/ITGUY12",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "2\n2\n4\n",
"output": "2\n12\n012\n12\n2\n4\n34\n234\n1234\n01234\n1234\n234\n34\n4\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 322 | Solve the following coding problem using the programming language python:
You have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining points are located on one side of the OY axis.
-----Input-----
The first line contains a single positive inte... | ```python
n = int(input())
lcnt = 0
rcnt = 0
for i in range(n):
x, y = map(int, input().split())
if x < 0:
lcnt += 1
else:
rcnt += 1
if (lcnt <= 1 or rcnt <= 1):
print("Yes")
else:
print("No")
``` | vfc_11042 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/900/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n1 1\n-1 -1\n2 -1\n",
"output": "Yes",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n1 1\n2 2\n-1 1\n-2 2\n",
"output": "No",
"type": "stdin_stdout"
},
{
"fn_n... |
apps | verifiable_code | 840 | Solve the following coding problem using the programming language python:
The chef is trying to solve some pattern problems, Chef wants your help to code it. Chef has one number K(odd) to form a new pattern. Help the chef to code this pattern problem.
-----Input:-----
- First-line will contain $T$, the number of test... | ```python
def func(num):
for i in range(num):
if i < num//2 + 1:
print(' '*i, end='')
print('*')
else:
print(' '*(num-i-1), end='')
print('*')
for _ in range(int(input())):
num = int(input())
func(num)
``` | vfc_2202 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://www.codechef.com/PSTR2020/problems/ITGUY45",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n1\n3\n5\n7\n",
"output": "*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n",
"type": "stdin_stdout"
}
]
} |
apps | verifiable_code | 2012 | Solve the following coding problem using the programming language python:
A permutation p of size n is the sequence p_1, p_2, ..., p_{n}, consisting of n distinct integers, each of them is from 1 to n (1 ≤ p_{i} ≤ n).
A lucky permutation is such permutation p, that any integer i (1 ≤ i ≤ n) meets this condition p_{p}... | ```python
n = int(input())
if n%4 > 1:
print(-1)
else:
a = [n+1>>1]*n
for i in range(n//4):
j = i*2
a[j], a[j+1], a[-2-j], a[-1-j] = j+2, n-j, j+1, n-1-j
print(' '.join(map(str, a)))
``` | vfc_5594 | {
"difficulty": "competition",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/286/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "1\n",
"output": "1 \n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n",
"output": "-1\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "4\n",
... |
apps | verifiable_code | 4073 | Solve the following coding problem using the programming language python:
DO YOU EXPECT ME TO FIND THIS OUT?
WHAT BASE AND/XOR LANGUAGE INCLUDES string?
DON'T BYTE OF MORE THAN YOU CAN CHEW
YOU CAN ONLY DISTORT THE LARGEST OF MATHEMATICS SO FAR
SAYING "ABRACADABRA" WITHOUT A MAGIC AND WON'T DO YOU ANY GOOD
THE LA... | ```python
n = int(input())
a = list(map(int, input().split()))
print(max(a) ^ a[-1])
``` | vfc_24999 | {
"difficulty": "introductory",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/784/C",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "4\n2 5 3 1\n",
"output": "4\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "2\n1 5\n",
"output": "0\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input"... |
apps | verifiable_code | 2575 | Solve the following coding problem using the programming language python:
Emuskald needs a fence around his farm, but he is too lazy to build it himself. So he purchased a fence-building robot.
He wants the fence to be a regular polygon. The robot builds the fence along a single path, but it can only make fence corne... | ```python
import sys
my_file = sys.stdin
##my_file = open("input.txt", "r")
num = int(my_file.readline().strip("\n"))
angles = my_file.read().split()
angles = [int(i) for i in angles]
for i in angles:
if 360%(180-i)>0:
print("NO")
else:
print("YES")
``` | vfc_20033 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/270/A",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "3\n30\n60\n90\n",
"output": "NO\nYES\nYES\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "6\n1\n2\n3\n170\n179\n25\n",
"output": "NO\nNO\nNO\nYES\nYES\nNO\n",
"type": "stdin_st... |
apps | verifiable_code | 1217 | Solve the following coding problem using the programming language python:
You are given two arrays of integers a and b. For each element of the second array b_{j} you should find the number of elements in array a that are less than or equal to the value b_{j}.
-----Input-----
The first line contains two integers n,... | ```python
#!/usr/bin/env python3
from bisect import bisect
try:
while True:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for x in map(int, input().split()):
print(bisect(a, x), end=' ')
print()
except EOFError:
pass
``` | vfc_14622 | {
"difficulty": "interview",
"memory_limit": null,
"memory_limit_bytes": null,
"problem_url": "https://codeforces.com/problemset/problem/600/B",
"time_limit": "None"
} | {
"language": "python",
"test_cases": [
{
"fn_name": null,
"input": "5 4\n1 3 5 7 9\n6 4 2 8\n",
"output": "3 2 1 4\n",
"type": "stdin_stdout"
},
{
"fn_name": null,
"input": "5 5\n1 2 1 2 5\n3 1 4 1 5\n",
"output": "4 2 4 2 5\n",
"type": "stdin_stdout"
... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 6