Dataset Viewer
Auto-converted to Parquet Duplicate
code
string
generator
string
label
int64
language
string
(a, b, c, d) = [int(x) for x in input().split()] k = input() (p, q, r, s) = (0, 0, 0, 0) for i in k: if i == '1': p += 1 elif i == '2': q += 1 elif i == '3': r += 1 elif i == '4': s += 1 print(a * p + b * q + c * r + d * s)
human
0
Python
valid version for the language; all others can also just parse a test that does an incorrect solution in real-time before testing all code solutions can cause the "wrong output". The largest portion of this question lies in handling corner solutions without leading and trailing zeros. Can a brute-force solver write in...
Qwen/Qwen2.5-Coder-1.5B
1
Python
python def min_cards_to_flip(s): vowels = {'a', 'e', 'i', 'o', 'u'} odd_digits = {'1', '3', '5', '7', '9'} # Collect all cards with vowels and all cards with odd digits cards_with_vowels = [i for i, char in enumerate(s) if char in vowels] cards_with_odd_digits = [i for i, char in enumerate(s) if ch...
Qwen/Qwen2.5-Coder-7B-Instruct
1
Python
T = int(input()) for t in range(T): color = input().split() s1 = color[:2] s2 = color[2:4] s3 = color[4:6] bo = False for i in range(2): for j in range(2): for k in range(2): if s1[i] == s2[j] == s3[k]: bo = True if bo: print('YES') else: print('NO')
human
0
Python
for i in range(int(input())): input() a = input().split(' ') for j in range(len(a)): a[j] = int(a[j]) b = min(a) c = [] d = [] for j in range(len(a)): if a[j] % b == 0: c.append(a[j]) d.append(j) c = sorted(c) d = enumerate(d) for (j, k) in d: a[k] = c[j] d = 1 for j in range(len(a) - 1): d = ...
human
0
Python
n = int(input()) a = [int(x) for x in input().split()] mval = max(a) r = 0 for i in range(len(a)): r += abs(a[i] - mval) print(r)
human
0
Python
l=[] for i in range(int(input())): n = int(input()) l.append([]) arr = [0] * n for j in range(n): arr[j] = [0] * n for k in range(n): if not (k == 0 or k == n-1 or j == 0 or j == n-1): arr[j][k] = min(arr[j][k-1], arr[j-1][k-1], ...
microsoft/phi-2
1
Python
def is_wilson_prime(p): if not isinstance(p, int) or p < 2: return False factorial = 1 for i in range(2, p): factorial *= i return (factorial + 1) % (p * p) == 0 # Example usage: # print(is_wilson_prime(5)) # True # print(is_wilson_prime(13)) # True # print(is_wilson_prime(563))#...
microsoft/Phi-3-medium-4k-instruct
1
Python
def can_divide_watermelon(w): # If the watermelon can be divided into two even parts, it must be an even number greater than 2 return "YES" if w % 2 == 0 and w > 2 else "NO" # Example usage w = int(input()) print(can_divide_watermelon(w))
codellama/CodeLlama-70b-Instruct-hf
1
Python
def math(s): if len(s) <= 100: for i in '+'.join(sorted(s)): print(i, end='') math(input().replace('+', ''))
human
0
Python
a = sorted(list(map(int, input().split())), reverse=True) f1 = a[0] + a[3] f2 = a[1] + a[2] if f1 == f2: print('YES') elif a[0] == a[1] + a[2] + a[3]: print('YES') else: print('NO')
human
0
Python
python import math def can_pair_numbers(l, r): count = (r - l + 1) // 2 if count != (r - l + 1) % 2: return False numbers = list(range(l, r + 1)) paired = [False] * len(numbers) def find_next_gcd(used, start, count, current_gcd): if count == 0: return True next...
microsoft/Phi-3.5-mini-instruct
1
Python
n = int(input()) for i in range(n): x = int(input()) s = input() s1 = s s2 = s count = 0 if len(s) == 1: print(0) else: while s2[0] != '>' and s1[len(s1) - 1] != '<': s1 = s1[0:len(s1) - 1] s2 = s2[1:len(s2)] count += 1 print(count)
human
0
Python
n = int(input()) s = input() groups = [] current_group = 0 for c in s: if c == 'B': current_group += 1 elif current_group > 0: groups.append(current_group) current_group = 0 if current_group > 0: groups.append(current_group) print(len(groups)) print(*groups)
codellama/CodeLlama-34b-Instruct-hf
1
Python
m = lambda x: [*map(lambda y: ord(y) - ord('A'), x)] n = int(input()) a = m(input()) r = 26 * n for i in range(n - 3): c = 0 for (x, y) in zip(a[i:i + 4], m('ACTG')): d = (x - y + 26) % 26 c += min(d, 26 - d) r = min(r, c) print(r)
human
0
Python
w = int(input()) a = [] for i in range(w): t = input() p = input().split() a.append(p) for i in range(w): o = 0 r = a[i] for j in range(2, len(r)): if int(r[0]) + int(r[1]) <= int(r[j]): o = j + 1 if o >= 3: print(*[1, 2, o]) else: print(-1)
human
0
Python
import math import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = 'x' in file.mode or 'r' not in file.mode self.write = self.buffer.write if self.writable else None de...
human
0
Python
def solve(mat): mx = max(map(max, mat)) (x, y) = (-1, -1) for i in range(len(mat)): for j in range(len(mat[0])): if mat[i][j] == mx: x = i y = j w = max(x + 1, len(mat) - x) h = max(y + 1, len(mat[0]) - y) return w * h t = int(input()) for i in range(t): (n, m) = list(map(int, input().split())) mat...
human
0
Python
def stoneGame(self, piles: List[int]) -> bool:       totalPiles=sum(piles)#simple hai chutiya so some in divisions       if totalPiles==len(piles):#if all the piles have 1 stone           remPiles=totalPiles//2           if remPiles==1:#if number of piles are odd return true else false               return Tr...
01-ai/Yi-Coder-9B
1
Python
(q, x) = map(int, input().split(' ')) my_list = [] for i in range(q): my_list.append(int(input())) count = [0] * x mex = 0 for a in my_list: count[a % x] += 1 while True: if count[mex % x] > 0: count[mex % x] -= 1 mex += 1 else: break print(mex)
human
0
Python
n = int(input()) s = input() r = input() if len(s) != len(r): print("NO") else: count = 0 for i in range(len(s)): if s[i] != r[i]: count += 1 if count == 0: print("YES") else: print("NO") A: You can use a dicti...
microsoft/phi-2
1
Python
n = int(input()) li1 = list(map(int, input().split())) m = int(input()) li2 = list(map(int, input().split())) li2.sort(reverse=True) li = [0] * 1000000 maxx = 0 for i in li1: for j in li2: if j % i == 0: z = j // i if maxx < z: maxx = z li[maxx] += 1 elif maxx == z: li[maxx] += 1 print(li[maxx])...
human
0
Python
from collections import defaultdict from operator import itemgetter def max_occurrences(seq): c = defaultdict(int) for item in seq: c[item] += 1 return max(c.items(), key=itemgetter(1)) t = int(input()) for i in range(t): (n, k) = map(int, input().split()) a = list(map(int, input().split())) a = [i for i in a ...
human
0
Python
def fly1(string): SF = 0 FS = 0 current = None for letter in string: if current == None: current = letter if current != letter: if letter == 'F': SF += 1 else: FS += 1 return SF > FS def fly(string): s = 0 f = 0 if string[0] == string[-1]: return False else: if string[0] == 'S' and st...
human
0
Python
import operator import math class Solution: # @param L, an integer sorted list # @param R, an integer sorted list # @return the same list of integers def GetMovieList(self, L=[], R=[]): max = L[0] * R[0] iMax = 0 for i in range(0,len(L)): temp = 1L * L[i] * R[i] if max < temp or (max == temp & R[iMax] < R...
google/codegemma-7b
1
Python
, no examples in it. import re sum_str = input() # Splitting the string into a list of numbers using regex numbers = re.findall('[1-3]+', sum_str) # Sorting each number to rearrange into non-decreasing order sorted_numbers = ['+'.join(sorted(num)) for num in numbers] # Joining sorted numbers with the '+' character...
microsoft/Phi-3-mini-4k-instruct
1
Python
# coding: utf-8 # In[1]: class Solution: def findKthBit(self, n: int, k: int) -> int: def helper(n, k): if n == 1: return 0 else: mid = 2**(n-1) if k <= mid: return helper(n-1, k) else: ...
ibm-granite/granite-8b-code-base-4k
1
Python
f = int(input()) for q in range(f): n = input() for i in range(0, len(n), 4): print(n[i], end='') if i != len(n) - 1: print(n[i + 1], end='') if len(n) % 4 == 0: print(n[-1]) print()
human
0
Python
if it's needed to optimize your code speed or give your solution idea. [Code Snippet] import sys from collections import defaultdict def input(): return sys.stdin.readline().rstrip() def inpute(): return sys.stdin.readline().split() def pr(arr, sep = " ", end = "\n"): sys.stdout.write(sep.join(map(str, arr)) + end...
Qwen/Qwen2.5-Coder-1.5B
1
Python
array = [int(item) for item in input().split()] if sum(array) == 0: print('EASY') else: print('HARD')<|endoftext|># Recommended imports for all problems # Some problems may require more import sys import math import string cases = int(sys.stdin.readline().rstrip()) for caseNum in range(cases): modNum = int(...
01-ai/Yi-Coder-9B
1
Python
x = int(input()) year = 0 sum = 100 while sum < x: sum += int(sum // 100) year += 1 print(year)
human
0
Python
import collections def count_incoming_edges(graph): ret = collections.defaultdict(lambda : 0) for vs in graph.values(): for v in vs: ret[v] += 1 return ret def topsort(edges, verts): sorted = [] incoming_edges = count_incoming_edges(edges) S = collections.deque([v for v in verts if incoming_edges[v] == 0])...
human
0
Python
import math def allPermutations(string): listi = permutations(string) for i in list(listi): print(''.join(i)) from operator import add n = int(input()) a = input() b = input() list1 = [] list2 = [] for i in range(n): if a[i] + b[i] == 'ab': list1.append(i + 1) if a[i] + b[i] == 'ba': list2.append(i + 1) leng...
human
0
Python
python from collections import defaultdict def min_cost(arr): bag_sizes = [200, 300, 500] unit_prices = [380, 550, 850] discount_units = [5, 4, 3] discount_rates = [0.2, 0.15, 0.12] bag_count = [0] * 3 for i in arr: bag_count[0] = (i + 500 - 1) // 500 cost = bag_count[0] * unit...
microsoft/Phi-3-small-8k-instruct
1
Python
: - 001 """Return true if given expression (exp) return code. """True"""# We cannot pass the first 10 test in two separate steps""" import math def is_prime_check(maxnum): nums = [] x = 2 ans1 = true minp1d2a9p01 = int(x) while x * x <= maxnum: sqrNum = True whil...
meta-llama/Llama-3.2-1B
1
Python
def solve(nums): while len(nums) > 1: nums = [nums[i] + nums[i + 1] for i in range(len(nums) - 1)] return nums[0] % 10 while True: try: s = list(map(int, list(input()))) print(solve(s)) except EOFError: break
human
0
Python
n = int(input()) ls = [int(x) for x in input().split()] ans = 2 while ans**2 < n: ls = shuffle(ls) flag = True for i in range(n): if i - 2 >= 0 and ls[i] % (ls[i-2] - ls[i]) != 0: flag = False break if flag: print(ans) break ans += 2 if ans**2 == n: ...
bigcode/starcoder
1
Python
python def rooms_apartments(n): if n == 0: print("0 0 2") return for three in range(0, n // 3 + 1): for five in range(0, (n - three * 3) // 5 + 1): seven = (n - three * 3 - five * 5) // 7 if three * 3 + five * 5 + seven * 7 == n: print(three, five,...
Qwen/Qwen2.5-Coder-1.5B
1
Python
(n, k, l, c, d, p, nl, np) = map(int, input().split()) mal = k * l / nl lebu = c * d salt = p / np ans = min(mal, min(lebu, salt)) / n print(int(ans))
human
0
Python
T = int(input().strip()) for t in range(T): N = int(input().strip()) if N % 2 == 0: print('1' * (N // 2)) else: S = '7' + str('1' * ((N - 3) // 2)) print(S)
human
0
Python
import sys import copy import math import heapq import bisect import statistics from sys import stdin, stdout from math import gcd, floor, sqrt, log from collections import defaultdict as dd from heapq import heapify, heappush, heappop from itertools import permutations, combinations from collections import Counter, Or...
human
0
Python
for i in range(int(input())): n = int(input()) a = input().split() if a.count('1') == n: if n % 2 == 0: print('Second') else: print('First') elif a[0] != '1': print('First') else: c = 0 index = 0 while a[index] == '1': c += 1 index += 1 if index == n - 1: break if c % 2 == 0: pr...
human
0
Python
l = int(input()) r = len(bin(l)[2:]) - 1 w = 2 ** r outlist = [] for t in range(r, 0, -1): if l - 2 ** r >= 2 ** (t - 1): outlist.append('{} {} {}'.format(t, r + 1, w)) w += 2 ** (t - 1) l = l - 2 ** (t - 1) print(r + 1, len(outlist) + 2 * r) for i in range(1, r + 1): print('{} {} 0'.format(i, i + 1)) print('{...
human
0
Python
def binary(t, s): fir = 0 last = len(t) - 1 mid = 0 while fir <= last: mid = (fir + last) // 2 if t[mid] > s: last = mid - 1 else: fir = mid + 1 return last + 1 n = int(input()) t = list(map(int, input().split())) m = int(input()) p = 0 t.sort() for i in range(m): s = int(input()) print(binary(t, s))...
human
0
Python
readone line from standard input "a b". Now, I suggest you rewrite it. Python class Solution: def findTsuboArea(self, a, b): return round((a * b) / 3.305785, 6) s = Solution() print(s.findTsuboArea(int(input().split(' ')[0]),int(input().split(' ')[1]))) In the python, code earlier, we are able to read the ...
meta-llama/Llama-3.1-8B-Instruct
1
Python
print(int(i ** 0.5) ** 2) """ i = input() print(int(int(i) ** 0.5) ** 2) """ i = input() print(int(int(i) ** 0.5) ** 2) """<|endoftext|>#!/usr/bin/env python3 import sys def main(): n = int(sys.stdin.readline()) times = [] for i in range(n): times.append(list(map(int, sys.stdin.readline().spli...
01-ai/Yi-Coder-9B
1
Python
for Python. def win(arr1,arr2): n = 0 for e in arr2: n|= 1<<(e-1) for i in range(len(arr1)): for j in range(i+1,len(arr1)): msk = (1<<(arr1[j]-1)) - (1<<(arr1[i]-1)) if n&msk==0: return True return False def solve(n,k1,k2,arr1,arr2): if...
ibm-granite/granite-8b-code-instruct-4k
1
Python
python def is_divisible(a, b): for i in range(len(b)): if b[i:] == a[:len(b[i:])]: return True return False def lcm(s, t): if is_divisible(s, t) and is_divisible(t, s): return s if len(s) > len(t) else t else: return -1 q = int(input()) for _ in range(q): s = in...
01-ai/Yi-Coder-1.5B-Chat
1
Python
- cannot plot solution ----Python code is:--- # coding: utf-8 if __name__=='__main__': n=int(input()) l1=[] flag=0 for i in range(n): l1.append(input().strip()) for i in range(n): if flag==1: break for j in range(2): if l1[i][j]=='O' an...
01-ai/Yi-Coder-9B-Chat
1
Python
nums = input().split() unic = [] nums = list(map(int, nums)) counter = 0 for num in nums: if num not in unic: unic.append(num) print(4 - len(unic))
human
0
Python
import re from random import sample def mix_words(strng): if type(strng) != str: return None return re.sub('[A-Za-z]{4,}', fu, strng) def fu(w): w = w.group() r = w[1:-1] while r == w[1:-1]: r = ''.join(sample(r, len(r))) return w[0] + r + w[-1]
human
0
Python
n=int(input()) import math y=n//7 x=math.ceil(n/7.0) if n*x%7==0: x+=1 x=x//2 y=y//2 else: print(x-n//7) x=x//2 y=y//2 print(x,y)
ibm-granite/granite-8b-code-instruct-4k
1
Python
when the input is correct. Code looks like below: from fractions import Fraction from fractions import gcd def solution(a): # Check that a is a list of positive integers if not all(isinstance(i, int) and i > 0 for i in a): return "NO" # Sort the array in increasing order a.sort() # Proc...
Qwen/Qwen2.5-Coder-1.5B
1
Python
arr = list(map(int, input().split())) following = [1] * n if n > 1: for i in range(1, n): if arr[i] >= arr[i - 1]: following[i] = following[i - 1] + 1; else: following[i] = 1 result = max(following); indices = [i + 1 for i, val in enumerate(following) if val == result]; pri...
microsoft/phi-2
1
Python
def program(target, asktl): while asktl: if target % 2: return False, True target //= 2 return True, False wantsX = True ii = 0; while ii < int(input()[1 : -1]): ii += 1 target, asktl = input().split() target = int(target) asktl = int(asktl) isObtained, isASKtl =...
bigcode/starcoder2-15b
1
Python
import java.io.*; import java.util.*; public class TravellingSalesmanProblem { public static void main(String[] args) { InputReader reader = new InputReader(System.in); PrintWriter writer = new PrintWriter(System.out, false); int N = reader.nextInt(); int[][] cities = new in...
human
0
Java
python def find_abc(n): for a in range(2, int(n**(1/3))+1): if n % a == 0: b = n // a if b > a and b % a == 0: return f"YES {a} {b//a} {b}" return "NO" t = int(input()) for _ in range(t): n = int(input()) print(find_abc(n))
microsoft/Phi-3.5-mini-instruct
1
Python
n = int(input()) nums = [int(x) for x in input().split()] answers = set() for i in range(n): cur_num = nums[i] furthest = max(n - i - 1, i) answers.add(cur_num // furthest) if answers != set(): print(min(answers)) else: print(0)
human
0
Python
for _ in range(int(input())): (a, b, c, d, K) = map(int, input().split()) diff = abs(c - a) + abs(d - b) if (K - diff) % 2 == 0 and K - diff >= 0: print('YES') else: print('NO')
human
0
Python
def precalc(): k = 1 arr = [0] while arr[-1] < 10 ** 18: s = (1 << k) - 1 t = s * (s + 1) // 2 arr.append(t + arr[-1]) k += 1 return arr[1:] def main(arr): x = int(input()) i = 0 while arr[i] <= x: i += 1 print(i) for _ in range(int(input())): arr = precalc() main(arr)
human
0
Python
n = int(input()) s = input() t = ['RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG'] ans = [0] * len(t) for string in range(len(t)): for i in range(n): if s[i] != t[string][i % 3]: ans[string] += 1 print(min(ans)) key = t[ans.index(min(ans))] for i in range(n): print(key[i % 3], end='') print()
human
0
Python
long long mmax () { llength += ++lenllongmax; __fpurnear(); llint += a[i]-max[a[i]-b[di]); long long a[NN+1][26],len=0,min2l=1,longt={ll=Long=long long=llong=lLON=lnNGNGoNG}; std::maplong{ return a[b+i][x]= a[e];++[k++b]++; ...
meta-llama/Llama-3.2-3B
1
C++
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> PII; #define REP(i,s,t) for(int i=(s);i<(t);i++) #define FILL(x,v) memset(x,v,sizeof(x)) const int INF = (int)1E9; #define MAXN 100005 const int mod = 1000000007; int cnt[101]; class Solution { public: int threeSumMulti(vector<int>& A, int target)...
human
0
C++
class Solution: def maxSumDivThree(self, nums: List[int]) -> int: m0 = 0 m1 = 0 m2 = 0 for n in nums: m = n % 3 (m0n, m1n, m2n) = (m0, m1, m2) if m == 0: m0n = m0 + n m1n = m1 + n m2n = m2 + n elif m == 1: if m2 % 3 == 2: m0n = max(m0, m2 + n) m1n = max(m1, m0 + n) if ...
human
0
Python
def gcd(a: int, b: int) -> int: (a, b) = (abs(a), abs(b)) if a < b: (a, b) = (b, a) return gcd(b, a % b) if b else a def sum_seq1(l: int, r: int) -> int: if r < l: return 0 return r * (r + 1) // 2 - l * (l - 1) // 2 def sum_difference(N: int, X: int, D: int) -> int: if D == 0: if X == 0: return 1 ret...
human
0
Python
n = int(stdin.readline()) kbs = [stdin.readline()[:26].strip() for i in range(n)] strs = [stdin.readline().strip() for i in range(n)] def solve(s,l): pos = [l.index(ch) for ch in s] it = iter(pos) return sum(abs(x-y) for x,y in zip(it,it)) for i in range(n): l = kbs[i] print(solve(strs[i],l))
Qwen/Qwen2.5-Coder-7B
1
Python
I did not learnt python some days before this date so i am very new to this programming language where typing anything is easy. But there is nothing creative or anything. It just sounds ridiculous to me Can someone solve that for me? I'm not asking for someone to give me the answer for this question but I need to kno...
ibm-granite/granite-8b-code-base-4k
1
Python
import sys def solve(): t = int(sys.stdin.readline()) for _ in range(t): r, g, b = map(int, sys.stdin.readline().split()) max_val = max(r, g, b) other_sum = r + g + b - max_val if max_val - other_sum <= 1: print("Yes") else: print("No") if __name...
codellama/CodeLlama-34b-Instruct-hf
1
Python
7 iterative = 1 8 while left <= right: 9 x = dic[left][a] 10 parent = a 11 12 if x < 0: 13 left = left + 1 15 if left > right: 16 break 17 18 a = parent 19 tmp = x 20 21 while True: 22 if left <= right: 23 x = dic[left][a] 24 if x < 0: 25 break 26 left = left + 1 27 28 if x > 0: 29 tmp += x 30 elif right + 1 <= n...
bigcode/starcoder2-7b
1
Python
class SegmentTree { class Node { int l, r; int max; Node(int _l, int _r) { l = _l; r = _r; } int mid() { return (l + r) >> 1; } } Node[] tree; SegmentTree(int n, int[] a) { tree = new Node[(n + 5) << 2]; ...
human
0
Java
python def find_life_time(X, A, N): left, right = 0, max(A) while left < right: mid = (left + right) // 2 if sum(A) + mid < N * X: left = mid + 1 else: right = mid return right def main(): T = int(input()) for _ in range(T): N, X = map(int, in...
01-ai/Yi-Coder-1.5B-Chat
1
Python
for test in range(t): a,b=map(int,input().split()) max =0 if a != 0: if b != 0: if a > b: if a>=2: a-=2 b-=1 else: b-=2 max+=1 else: a-=2 max+=1 print(max)
meta-llama/Llama-3.1-8B
1
Python
print("YES") if n % 2 == 0 else print("NO") """ if __name__ == '__main__': # n = int(input()) n = 8 print("YES") if n % 2 == 0 else print("NO")
bigcode/starcoder
1
Python
from bisect import bisect_right from itertools import accumulate def solution(): (n, q) = map(int, input().split()) a = [int(num) for num in input().split()] k = [int(num) for num in input().split()] ans = [] acc = list(accumulate(a, initial=0)) b = [] maximum = -float('Inf') for num in a: maximum = max(maxi...
human
0
Python
s=input() r=input() if len(s.split('H')[0])>len(r.split('H')[1]) or len(s.split('H')[2:])>len(r.split('H')[1:]): print('Invalid') elif r.count('T')!=s.count('H') or r.count('T')!=s.count('H')+1: print('Invalid') else: print('Valid') var ALL_INPUT = readline().split(" ").map(parseInt); var TEST_CASE = ALL_INPUT[0]...
bigcode/starcoder2-7b
1
Python
def PowMod(x, n, M): """ Compute (x^n) % M. Parameters: x (int): The base number. n (int): The exponent. M (int): The modulus. Returns: int: The result of (x^n) % M. """ # Handle edge case where n is 0 if n == 0: return 1 % M # If n is negative, use...
meta-llama/Llama-3.3-70B-Instruct
1
Python
def solve(a, b, c): # Check for first shop cheaper first_shop_cheaper = -1 for x in range(1, 10**9 + 1): if a * x < c * (x + b - 1) // b: first_shop_cheaper = x break # Check for second shop cheaper second_shop_cheaper = -1 for x in range(1, 10**9 + 1): i...
Qwen/Qwen2.5-Coder-32B-Instruct
1
Python
python def solve(n, x, a, b): if a > b: a, b = b, a if x >= b - 1: return n - 1 if x <= a - 1: return b - 2 return min(b - 2, a - 1 + min(x, n - b)) n, x, a, b = map(int, input().split()) print(solve(n, x, a, b))
01-ai/Yi-Coder-9B-Chat
1
Python
. String and variable names are not given. 0 -1 */ //include library for randint and using the input() function #include <cstdlib> #include <iostream> #include <random> using namespace std; //using input function int readInt( ){ int n; string str; cin >> n; } //func that is supposed to determine if the jacket has b...
01-ai/Yi-Coder-1.5B
1
Python
from collections import defaultdict as dfl names = dfl(list) for _ in range(int(input())): s = input() if names[s] != []: q = len(names[s]) p = s + str(q) print(p) names[s].append(p) else: print('OK') names[s].append(s)
human
0
Python
def check(a, k): for i in range(k, len(a)): if a[i] != a[i - k]: return False return True def solve(a): n = len(a) b = [] for i in range(n): t = a[i] if i: t -= a[i - 1] b += [t] res = [] for i in range(1, n + 1): if check(b, i): res += [i] return res n = int(input()) a = map(int, input().sp...
human
0
Python
static const int __ = []() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); return 0; }(); typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; typedef pair<int ,int> pii; typedef pair<ll, ll> pll; typedef double rl; typedef pii int2; typedef tuple<int, int, ...
human
0
C++
s = input() tab = [] for i in range(k): tab.append(s.count(chr(ord('A') + i))) tab.sort() suma = 0 for i in tab: suma = suma + i print(suma - tab[k-1])
ibm-granite/granite-8b-code-base-4k
1
Python
cpp #include <iostream> #include <algorithm> int main() { int t, a1, a2, a3; std::cin >> t; while (t--) { std::cin >> a1 >> a2 >> a3; int diff = std::abs(a1 + a3 - 2 * a2); if (a1 + a3 >= 2 * a2) { std::cout << diff << std::endl; } else { ...
microsoft/Phi-3.5-mini-instruct
1
C++
#!/usr/bin/python import sys #MOD = 1000000007 #Given array arr[] and size n. #Compute XOR of all elements of array. #The value stored in the answer variable will be XOR of first and last elements of array. #Compute sum of array elements. #Find out the number pair N = (i,j) such that #L-1 < j-i < M. if __name__ == '__...
microsoft/phi-2
1
Python
from collections import deque (N, M) = map(int, input().split()) root = [[] for _ in range(N)] for _ in range(M): (a, b) = map(int, input().split()) root[a - 1].append(b) root[b - 1].append(a) q = deque() q.append(1) ans = [0 for _ in range(N)] while len(q) > 0: v = q.popleft() for ike in root[v - 1]: q.append(i...
human
0
Python
if terminal is set Clearly defined incorrect input. */ #include <bits/stdc++.h> using namespace std; int main() { long long int N, first,last; cin>>N; while (N--){ cin>>first; cin.ignore(); cin>>last; while (last >=first ) last -= first; cout<<last<<endl; } ...
deepseek-ai/deepseek-coder-1.3b-base
1
Python
_:print("_" * 40) n:RNoinitial='2 2'.split() cs=RNOLinput().split() for i in range(n): cs[i+i%n]='3 8'.split() _':print("["+' '.join(c) +']') ¶
meta-llama/Llama-3.2-3B
1
Python
if len(s) != len(t): return 'No' vowel_map = {'a':'e', 'e':'i', 'i':'o', 'o':'u', 'u':'a'} if s==t: return 'Yes' for i in range(len(s)): if s[i]!=t[i]: s_vowel = (lambda x:x if x in vowel_map else None)(s[i]) if s_vowel is not None and (vowel_map[s_vowel]==t[...
Qwen/Qwen2.5-Coder-7B
1
Python
t = input() res = (len(t) + 1) // 2 if len(t) % 2 == 1 and t.count('1') == 1: res -= 1 if t == '0': res = 0 print(res)
human
0
Python
import math as ma (m, n, a) = map(float, input().split()) print(int(ma.ceil(m / a) * ma.ceil(n / a)))
human
0
Python
itr for _ in range(itr): x,y = map(int,input().split()) mat = [] for i in range(x): a = list(map(int,input().split())) mat.append(a) for i in range(x): for j in range(y): cnt = 0 m = mat[i][j] m -=1 if i-1 >=0: if ma...
bigcode/starcoder2-15b
1
Python
. No explanation. PLAINFORMAT # Answer def last_cookie_eater(input_value): if isinstance(input_value, str): return "Who ate the last cookie? It was Zach!" elif isinstance(input_value, (int, float)): return "Who ate the last cookie? It was Monica!" else: return "Who ate the last cook...
microsoft/Phi-3-mini-4k-instruct
1
Python
inp = input() data = inp.split() n = int(data[0]) k = int(data[1]) def allZero(s): for i in s: if i != '0': return False return True def removeChar(s, n): return s[:n] + s[n + 1:] nStr = data[0] zeros = 0 for char in nStr: if char == '0': zeros += 1 if nStr == '0': print(0) elif zeros < k: print(len(nStr...
human
0
Python
python def can_reach_cell(n, m, k): # If k is 0, we are already at the end cell. if k == 0: return "YES" # If n and m are the same, it's only one path with cost n*m. elif n == m: if k == n*m: return "YES" else: return "NO" # If n is the same as m multi...
microsoft/Phi-3.5-mini-instruct
1
Python
#include<bits/stdc++.h> using namespace std; int t; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> t; while(t--){ int n; cin >> n; int a = (n / 2) + 1, b = 1; vector<int> res; while(res.size() < n){ if(res...
human
0
C++
import sys def quaternion_product(x1, y1, z1, w1, x2, y2, z2, w2): prod = [ x1 + x2, y1 + y2, z1 + z2, w1 + w2 ] return prod def solve(): while True: n = int(input()) if n == 0: break for _ in range(n): x1, y1, z...
Qwen/Qwen2.5-Coder-1.5B-Instruct
1
Python
for _ in range(int(input())): (n, x) = map(int, input().split()) arr = list(map(int, input().split())) M = [arr[i] % x for i in range(n)] if sum(M) == 0: print(-1) continue elif 0 not in M and sum(arr) % x: print(n) continue elif sum(arr) % x: print(n) continue l = 0 r = n - 1 for i in range(n): ...
human
0
Python
class Solution: def eggDrop(self, n, k): dp = [[0 for x in range(k + 1)] for y in range(n + 1)] for i in range(n + 1): dp[i][0] = 0 dp[i][1] = 1 for j in range(1, k + 1): dp[1][j] = j for i in range(2, n + 1): for j in range(2, k + 1): dp[i][j] = float('inf') (lo, hi) = (1, j) while lo...
human
0
Python
s = input() s = s.lower() vowels = "aeiouy" new_s = "".join(".{0}".format(c) if c not in vowels else c for c in s) print(new_s)
meta-llama/Llama-3.1-8B-Instruct
1
Python
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
-