code
string
generator
string
label
int64
language
string
def check(num): digit_sum = 0 zero_count = 0 for ch in num: if ch == '0': zero_count += 1 digit_sum += int(ch) num1 = num.replace('0', '') if digit_sum % 3 == 0 and (zero_count > 1 or (zero_count > 0 and ('2' in num1 or '4' in num1 or '6' in num1 or ('8' in num1)))): print('red') else: print('cyan') d...
human
0
Python
, without explanation text. Your code ```Python def gcd(p, m): q, r = divmod(m, p) return r != 0 and q or m def solution(seq1, seq2, m): gcm = reduce(lambda a, b: gcd(a+b[0], m-b[1]), zip(seq1, seq2)) if gcm== 0: result = reduce(mul, (p+y for (y,p) p seq1)) else:result = reduce(mul, (p+seq1...
microsoft/Phi-3.5-mini-instruct
1
Python
n,m=map(int,input().split()) s=[] for i in range(n): s.append(input()) def ispalindrome(s): return s==s[::-1] def ispalindrome2(s): return s==s[::-1] def ispalindrome3(s): return s==s[::-1] def ispalindrome4(s): return s==s[::-1] def ispalindrome5(s): return s==s[::-1] def ispalindrome6(s)...
ibm-granite/granite-8b-code-base-4k
1
Python
t = int(input()) for j in range(t): len = int(input()) str1 = input() a = '' b = '' flag_1 = False flag_2 = 0 for i in str1: if i == '0': a += '0' b += '0' elif i == '1': if flag_2 > 0 and flag_1 == False: a += '1' b += '0' else: a += '0' b += '1' flag_1 = True else: flag_...
human
0
Python
t = int(input()) for _ in range(t): n = int(input()) s = input() count = 0 first = True ans = 1 for i in range(0, n, 2): if s[i] != s[i + 1]: count += 1 elif first: cur = s[i] first = False elif s[i] != cur: ans += 1 cur = s[i] print(count, ans)
human
0
Python
for the function """ from collections import Counter def solve(N, K, numbers): c = Counter(numbers) sum_ = sum(k for k, v in c.items() if v == K) return sum_ if sum_ else -1 #Example usage print(solve(4, 1, [2, 3, 4, 4])) # Expected output 5 print(solve(5, 3, [9, 9, 1, 1, 9])) # Expected output 9 print(s...
deepseek-ai/deepseek-coder-6.7b-instruct
1
Python
from sys import stdin n = int(stdin.readline()) rect = [] for i in range(n): (a, b, c, d) = map(int, stdin.readline().split()) rect.append((a, b, c, d)) left = sorted(range(n), key=lambda x: rect[x][0], reverse=True) right = sorted(range(n), key=lambda x: rect[x][2]) top = sorted(range(n), key=lambda x: rect[x][3]) b...
human
0
Python
javascript function triangleType(nums) { if (nums.length !== 3 || nums.some(num => typeof num !== 'number' || num <= 0)) return "none"; const sorted = [...nums].sort((a, b) => a - b); const sum = sorted[2] + sorted[1]; if (sorted[0] + sorted[1] > sorted[2] && sorted[0] + sorted[2] > sorted[1] && sorted[1] +...
deepseek-ai/deepseek-coder-1.3b-instruct
1
Java
n, x = map(int, input().split()) a = list(map(int, input().split())) s = sum(a) if s == 0: print(0) elif s > 0: if s <= x: print(1) else: print((s + x - 1) // x) else: s = -s if s <= x: print(1) else: print((s + x - 1) // x)
codellama/CodeLlama-34b-Instruct-hf
1
Python
a = int(input()) b = [int(i) for i in input().split()] max = b[0] min = b[0] d = 0 for i in b: if i < min: d += 1 min = i elif i > max: d += 1 max = i print(d)
human
0
Python
def main(): n = int(input()) for i in range(2**n): print(f"{i}: {' '.join(map(str, [j for j in range(n) if (i >> j) & 1]))}") if __name__ == '__main__': main()
ibm-granite/granite-8b-code-base-4k
1
Python
# @return an integer def minCost(self,cost,time): # write your code here. # 最多来n次,每次不超过len(cost) n = len(cost) arr = [ None ] * len(cost) for i in range(n): tArr = sorted(range(len(cost) - i), key = lambda x:cost[x +i], reverse=True) print("tArr = ",t...
bigcode/starcoder
1
Python
import sys, math, itertools, heapq, collections, bisect, copy input = lambda : sys.stdin.buffer.readline().rstrip().decode('utf-8') sys.setrecursionlimit(10 ** 7) inf = float('inf') mod = 10 ** 9 + 7 ans = inf count = 0 pro = 1 (h, w) = map(int, input().split()) A = [tuple(map(int, input().split())) for i in range(h)] ...
human
0
Python
//package codeforces; import java.util.Scanner; public class PekoraandTrampoline { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); int n, nums[]; long counter[]; for (; t > 0; t--) { n = scan.nextInt(); nums = new int[n];...
human
0
Java
#Function to return a list containing the common nodes in two BST. def findCommon(self, root1, root2): # code here res = [] def inorder(root): if root: inorder(root.left) res.append(root.data) inorder(root.right) inorder(roo...
google/codegemma-2b
1
Python
without comments. public class CapitalizeTitle { public String capitalizeTitle(String title) { String[] words = title.split("\\s+"); StringBuilder result = new StringBuilder(); for (String word : words) { if (word.length() <= 2) { result.append(word.toLo...
microsoft/Phi-3.5-mini-instruct
1
Java
python def who_wins(n, a): # Initialize the XOR of the array xor_sum = 0 for num in a: xor_sum ^= num # If the XOR is zero, the second player can always choose an array segment with an even sum and win if xor_sum == 0: return "Second" # Otherwise, the first player can always cho...
01-ai/Yi-Coder-9B-Chat
1
Python
s = int(input()) if s > 0: print(s) else: s = str(abs(s)) a1 = int(s[:-1]) * -1 a2 = int(s[0:len(s) - 2] + s[-1:]) * -1 print(max(a1, a2))
human
0
Python
public int numSubmatrixSumTarget(int[][] matrix, int target) { HashMap<Integer,Integer> map=new HashMap<>(); map.put(0,1);//key为子数组值,key为对应次数 int res =0; int m=matrix.length,n=matrix[0].length; for (int i=1;i<m;++i){ for (int j=0;j<n;++j) matrix[i][j] += matrix[i-1][j]; HashMap<Integer,Integer> temp=new HashMap<>(); ...
meta-llama/Llama-3.1-8B
1
Java
if return code == 0: print("OK") elif return code == 1: print("OK") elif return code == 2: print("OK") elif return code == 3: print("OK") elif return code == 4: print("OK") elif return code == 5: print("OK") elif return code == 6: print("OK") elif return code == 7: print("OK") elif return code == 8: print("OK") elif re...
meta-llama/Llama-3.2-3B
1
Python
T,n=map(int, input().split()) for t in range(T): S=list(map(int,input().split())) a=S[:-1] b=S[-1:] zero=0 res=[] for i in range(n//2): if a[2*i]-zero<=b[2*i]+b[2*i+1]<=a[2*i]-zero or\ b[2*i]-zero<=a[2*i]+b[2*i+1]<=b[2*i]-zero: ...
microsoft/phi-2
1
Python
# Обработали ввод matrix = [] sbcount = 0 sb = ['w','g'] cbcount = 0 cb = ['c','m','y'] cou = False for i in range(n): matrix.append(['0'] * m) for i in range(n): lines = list(input()) if (lines.count('w') == 0 or lines.count('g') == 0): for k in sb: if matrix[i].count(k) != 0: ...
bigcode/starcoder
1
Python
for i in range(int(input())): (x, y) = map(int, input().split()) print(x, y - y % x)
human
0
Python
def solution(n, m): if m == 1: print(0) return zodiak = ['st', 'nd', 'rd'] zodiak_zero = ['th'] if n % 10 == 1 and n != 11 or n % 10 > 4 and n % 10 < 1: zodiak_zero = zodiak # zaderzhi vn oscitaniemala behabuz zodiak_one = ['st', 'nd', 'rd'] zodiak_two = ['th',...
google/codegemma-2b
1
Python
a = list(map(int, input().split())) ans = 0 c = 0 for i in range(len(a)): b = a.copy() if a[i] == 0: continue fi = b[i] b[i] = 0 f = fi // 14 xes = fi % 14 c = 0 for j in range(14): b[j] = b[j] + f for j in range(xes): b[(i + j + 1) % 14] += 1 for j in b: if j % 2 == 0: c = c + j ans = max(ans, c)...
human
0
Python
def main(): import sys input = sys.stdin.read data = input().split() p = [float(data[i]) for i in range(6)] N = int(data[6]) E_X = sum(i * p[i-1] for i in range(1, 7)) Var_X = sum((i - E_X) ** 2 * p[i-1] for i in range(1, 7)) E_S = N * E_X Var_S = (N-1) * Var_X + E_X ...
Qwen/Qwen2.5-Coder-32B-Instruct
1
Python
import math, sys # Replaced cp39, cp39-like, with code if str(locks) != '0': pops = locks print(pops) else: sys.exit()
microsoft/phi-2
1
Python
// Author: Tyler Wang #include <algorithm> #include <array> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <chrono> #include <cmath> #include <complex> #include <cstdint> #include <cstdlib> #include <deque> #include <functional> #include <initializer_list> #include <iomanip> #include <i...
human
0
C++
while True: try: d = int(input()) except: break ans = 0 x = d while x < 600: ans += x ** 2 * d x += d print(ans)
human
0
Python
for failed tests. """ import sys def solution(a, c): result = 0 for elem in a: if elem > c: result += 1 return result sys.stdin = open('tst.txt') n, k = map(int, input().split()) a = list(map(int, input().split())) print(solution(a, k)) out, __ = sys.stdout.detach() text_ans = out.dec...
deepseek-ai/deepseek-coder-1.3b-base
1
Python
n = int(input()) for i in range(n): (x, y, a, b) = map(int, input().split()) sol = (x - y) / (-b - a) if sol < 0 or sol % 1 != 0: print(-1) else: print(int(sol))
human
0
Python
from bisect import bisect_right def next_higher(start_value, k): d = {3: [162, 378, 756, 1161, 1206, 1611, 1989, 34992, 35208, 35388, 37332, 37548, 37728, 40104, 72972, 73152, 75312, 75492, 75708, 77652, 77832, 77868, 78048, 80208, 80388, 113256, 115596, 115812, 117972, 118152, 118368, 120312, 120492, 120708, 155916]...
human
0
Python
(n, l, a) = map(int, input().split()) if n == 0: print(l // a) exit() ar = [] for i in range(n): ar.append(list(map(int, input().split()))) ar = sorted(ar, key=lambda x: x[0]) cur = 0 ans = 0 for i in range(n): ans += (ar[i][0] - cur) // a cur = ar[i][0] + ar[i][1] ans += (l - cur) // a print(ans)
human
0
Python
python def is_prime(n): if n <= 1: return False for i in range(2, int(n**0.5) + 1): if n % i == 0: return False return True def is_palindrome(num): return str(num) == str(num)[::-1] def prime_count(n): count = 0 for i in range(2, n + 1): if is_prime(i): ...
microsoft/Phi-3.5-mini-instruct
1
Python
python def solve(): import sys input = sys.stdin.read data = input().split() t = int(data[0]) index = 1 results = [] for _ in range(t): n = int(data[index]) W = int(data[index + 1]) index += 2 widths = list(map(int, data[index:index + n])) in...
Qwen/Qwen2.5-Coder-7B-Instruct
1
Python
import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] fo...
human
0
Python
def main(): t = int(sys.stdin.readline()) for _ in range(t): n = int(sys.stdin.readline()) a = list(map(int, sys.stdin.readline().split())) b = list(map(int, sys.stdin.readline().split())) print(solve(n, a, b)) def solve(n, a, b): min_a = min(a) min_b = min(b) res = ...
01-ai/Yi-Coder-9B
1
Python
from collections import defaultdict as dc import sys import math mod = 10 ** 9 + 7 def sinp(): p = str(sys.stdin.readline()) return p def seive(n): p = [0] * (n + 1) for i in range(2, n): for j in range(2 * i, n + 1, i): p[i] = 1 return p def inp(): p = int(sys.stdin.readline()) return p def line(): p ...
human
0
Python
from math import gcd from bisect import bisect from functools import reduce def factors(n): k = sorted(list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5 + 1)) if n % i == 0))))) return k (a, b) = map(int, input().split()) gg = gcd(a, b) f = factors(gg) n = int(input()) for _ in range(0, n): ...
human
0
Python
n = int(input()) a = [*map(int, input().split())] a = sorted(a, reverse=True) yy = sum(a) i = s = 0 while i < n and s <= yy: s += a[i] yy -= a[i] i += 1 print(i)
human
0
Python
class Solution: def printTriangle(self, N): for i in range(0, N): if i != 0 and i != N - 1: for k in range(0, N): if k == 0 or k == N - 1: print('*', end='') else: print(' ', end='') else: for z in range(0, N): print('*', end='') print()
human
0
Python
def LI(): return list(map(int, input().split())) (H, W, A, B) = LI() S = '1' * A + '0' * (W - A) for _ in range(B): print(S) S = '0' * A + '1' * (W - A) for _ in range(H - B): print(S)
human
0
Python
from functools import lru_cache from sys import stdin, stdout import sys from math import * sys.setrecursionlimit(int(200000.0)) (a, bb, c) = map(int, input().split()) r = list(map(int, input().split())) g = list(map(int, input().split())) b = list(map(int, input().split())) r.sort(reverse=True) g.sort(reverse=True) b....
human
0
Python
def whospeaksthislang(language): L = [] global empl_lang global n for i in range(n): for j in range(len(empl_lang[i])): if empl_lang[i][j] == language: L += [i] return L def employeelangTograph(): L = [] global m global graph for i in range(1, m + 1): L = whospeaksthislang(i) for j in range(len(L...
human
0
Python
, no explanation. Do not print anything on the console. def solve (a: int, b: int, cars: List) -> float: ''' ''' solve(1,3,[ [3,3,2], [-2, 3, 6], [-2, 7, 10] ] ) ==> 0.5 solve(0,0, [ [2,0,1], [0,2,2] ]) ==> 1 ''' import math abc: i...
microsoft/Phi-3-medium-4k-instruct
1
Python
. def maxSubsetXOR(arr, N): max_xor = 0 for i in range(2**N): subset_xor = 0 for j in range(N): if (i & (1 << j)) != 0: subset_xor ^= arr[j] max_xor = max(max_xor, subset_xor) return max_xor # Example usage: arr = [2, 4, 5] N = len(arr) print(maxSubsetXO...
microsoft/Phi-3.5-mini-instruct
1
Python
S = input() (ans, sb) = (1, 0) n = len(S) for i in range(1, n, 1): if S[i] == S[i - 1]: ans += 1 else: ans = 1 if ans == 7: sb = 1 if sb == 0: print('NO') else: print('YES')
human
0
Python
python program by @Chukwuemez.peter aka dlux31 ```python import sys def pair_programming(): t = int(input()) for _ in range(t): _ = input() k, n, m = map(int, input().split()) Moran_actions = list(map(int, input().split())) Polycarp_actions = list(map(int, input().split())) ...
meta-llama/Llama-3.1-8B-Instruct
1
Python
t = int(input()) for i in range(t): s = input() a = s.count('L') b = s.count('R') c = s.count('D') d = s.count('U') if min(a, b) == 0 and min(c, d) == 0: print('0') elif c == 0 or d == 0: print('2') print('LR') elif a == 0 or b == 0: print('2') print('UD') else: x = min(a, b) y = min(c, d) prin...
human
0
Python
t = int(input()) for i in range(t): n = int(input()) li = [1, 5, 3] ans = [] point = 0 for j in range(n): if point == 3: point = 0 ans.append(li[point]) point += 1 for item in ans: print(item, end=' ') print()
human
0
Python
for i in range(t): n = int(input()) s = list(map(int, input().split())) s.sort() res = abs(max(s) - min(s)) print(res)
bigcode/starcoder2-15b
1
Python
def magic_set(N, K, L, a, b): # Write your code here # Return the number of magic sets modulo 1000000007 return 0 if __name__ == "__main__": N, K, L = map(int, raw_input().split()) a = map(int, raw_input().split()) b = map(int, raw_input().split()) print magic_set(N, K, L, a, b)
01-ai/Yi-Coder-9B
1
Python
def maximizeTheCuts(self, n: int, x: int, y: int, z: int) -> int: dp = [0] * (n + 1) for i in range(1, n + 1): if i >= x: dp[i] = max(dp[i], dp[i - x] + 1) if i >= y: dp[i] = max(dp[i], dp[i - y] + 1) if i >= z: dp[i] = ...
Qwen/Qwen2.5-Coder-7B
1
Python
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline output.write for _ in range(int(input())): a,b=map(int,(input().split())) if a==1:output(b) else:output((a-1)*(b-1)) sample input 638sample output 50392455543149782 DownloadSample Tests21813944803961059974097361 Visit Bug Support... what will be the sum of all a...
bigcode/starcoder2-15b
1
Python
#include<bits/stdc++.h> #define x first #define y second using namespace std; using i64=long long; void solve() { vector<pair<int,int>>p(3); vector<int>vx,vy; for(auto &[x,y]:p) { cin>>x>>y; vx.push_back(x); vy.push_back(y); } vector<tuple<int,int,int,int>>ans; auto Do=[&](int...
human
0
C++
class Solution: def countZeroes(self, A, N): from itertools import chain result = list(chain(*A)) k = 0 output = [] for i in range(0, len(result)): if result[i] == k: output.append(result[i]) return len(output)
human
0
Python
import sys N = int(sys.stdin.readline()) K = int(sys.stdin.readline()) BAGARR = list() for i in range(0, N): LINE = int(sys.stdin.readline()) BAGARR.append(LINE) BAGARR.sort() MIN = 10 ** 9 for i in range(0, N - K): t = BAGARR[i + (K - 1)] - BAGARR[i] if MIN > t: MIN = t print(MIN)
human
0
Python
python n = int(input()) s = input() if "xxx" in s: count = 0 for i in range(n): for j in range(2, n - i): if s[i:i + 3] == "xxx": s = s[:i] + s[i + 3:] count += 1 break print(count) else: print(0)
Qwen/Qwen2.5-Coder-1.5B-Instruct
1
Python
import math def main(): n = int(input()) a = [int(input()) for _ in range(n)] total = sum(a) if total % 360 == 0: print("YES") else: print("NO") if __name__ == "__main__": main()
Qwen/Qwen2.5-Coder-7B
1
Python
(n, n1, n2) = [int(i) for i in input().split()] if n1 > n2: (n1, n2) = (n2, n1) lista = [int(i) for i in input().split()] lista.sort(reverse=True) sn1 = sn2 = 0 for i in range(n1): sn1 += lista[i] for i in range(n1, n1 + n2): sn2 += lista[i] print('%.6f' % (sn1 / n1 + sn2 / n2))
human
0
Python
https://atcoder.jp/problems/arc103_cimport operator (24138165 26470398 arc109_a python3) from fractolues import Fraction a,b = map(Franction.from_string, input(), spit(':')) print ('O' if b >= -a and a<= a + 10 else x=''' 1. $a^{m+1} = ab^{2n+k}$ とおく 2. $b^{2n+k} = { \overbrace }*a^{2m*n - 2*n} {\cdots}^*a^{m}) + ...
bigcode/starcoder2-15b
1
Python
x = int(input()) h = input() left = {} right = {} for i in range(x): s = list(input().split('->')) if s[0] in left: left[s[0]] = left[s[0]] + 1 else: left[s[0]] = 1 if s[1] in right: right[s[1]] = right[s[1]] + 1 else: right[s[1]] = 1 if x == 1: print('contest') elif left[h] > right[h]: print('contest') ...
human
0
Python
def solve(s): vowels = 'AOYEUIaoyeui' s = ''.join(['.' + c for c in s if c not in vowels]) return s.lower() s = input() result = solve(s) print(result)
meta-llama/Llama-3.3-70B-Instruct
1
Python
class Solution { public: int minSwaps(vector<int>& nums) { int tot = accumulate(nums.begin(), nums.end(), (int)0); int cnt = 0; int idx = 0; int r = 0; int sr = 0; int res = tot; int n = nums.size(); while (idx < n) { while (r < idx + tot) ...
human
0
C++
from math import * n = int(input()) (a, b) = (2, 3) c = 0 while n >= a: (a, b) = (b, a + b) c += 1 print(c)
human
0
Python
. # Python3 implementation of the above approach # Returns maximum sum such that the # picked element from i'th array is # more than the picked element from (i-1)'th array def maximumSum(N, M, arr): # Initialize the result res = 0 # Initialize the current element # as the first ele...
microsoft/Phi-3-medium-4k-instruct
1
Python
accepts: -1 0 + All the strings will have 0 as their leading character. Method-1 class Solution: def getCarries(self, A, B): carry = 0 i = len(A) - 1 j = len(A) - 1 while(j >= 0): x = 0 y = 0 if i >= 0: x = int(A[i]) ...
deepseek-ai/deepseek-coder-1.3b-base
1
Python
#include<cstdio> #include<algorithm> const int MAXN = 2e5 + 10; int a[MAXN],b[MAXN]; int main() { int t; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); for (int i = 0; i < n; i++)scanf("%d", a + i); for (int i = 0; i < n; i++)scanf("%d", b + i); int sum = 0; for (int i = 0; i < n;i++)sum += b[i];...
meta-llama/Llama-3.1-8B-Instruct
1
C++
""" def min_cost(n, a, m, q): a.sort(reverse=True) cost = [0] * m for i in range(m): cost[i] = sum(a[j] for j in range(i * q[i], i * q[i] + q[i] - 1)) return cost n = 7 a = [7, 1, 3, 1, 4, 10, 8] m = 2 q = [3, 4] print(*min_cost(n, a, m, q))
microsoft/Phi-3-small-8k-instruct
1
Python
t = int(input()) for j in range(t): n = int(input()) a = list(map(int, input().split())) b = a[:] b.sort() c = [] if n == 1: print(-1) else: for i in range(n): if b[i] != a[i]: c.append(b[i]) elif i < n - 1: (b[i], b[i + 1]) = (b[i + 1], b[i]) c.append(b[i]) else: c.append(b[i]) if...
human
0
Python
from collections import Counter, defaultdict from functools import reduce, lru_cache from operator import mul class UnionFind: def __init__(self): self.leaders = defaultdict(lambda : None) def find(self, x): l = self.leaders[x] if l is not None: while self.leaders[l] is not None: l = self.leaders[l] ...
human
0
Python
import java.util.*; import java.io.*; public class Main { static StringBuilder sb; static dsu dsu; static long fact[]; static int mod = (int) (1e9 + 7); static void solve() { int n = i(); int x = i(); String str = s(); int cnt0 = 0; for(int i =0;i<str.length();i++){ ...
human
0
Java
import sys input() (ac, wa) = ({*()}, {}) nc = np = 0 for ln in sys.stdin: (p, S) = ln.split() if p in ac: continue if p not in wa: wa[p] = 0 if S == 'AC': ac.add(p) nc += 1 np += wa[p] else: wa[p] += 1 print(nc, np)
human
0
Python
def can_distribute_coins(t, test_cases): results = [] for i in range(t): a, b, c, n = test_cases[i] max_coins = max(a, b, c) total_needed = (3 * max_coins) - a - b - c if total_needed <= n and (n - total_needed) % 3 == 0: results.append("YES") else: ...
microsoft/Phi-3-medium-4k-instruct
1
Python
e numb=input('Enter number.') x0=int(sum([int(f) for _,f in ((r2%10,r.replace('c',2)[2].replace('e','%E')[0:7])*(-10*f) for _ #rem2=reversed(r.split('.')[-1][:.5].replace(' ', '10')) #l=map('1.'+''.join(str(s) for _,s in ((7*e-(num-s)).split('.')[-1:].reverse()), e=10)*(v),e(5,)) #d=-d.lap(numb/2) int(-100),*s[::-1])+...
meta-llama/Llama-3.2-3B
1
Python
contentInputName = input resultAns — Number : int def solnFun( inputNum = int, textInputContent = str ) : resultAnsCodehorses √ return if conditionsMet do this body ( resultCodeAthor ) n= solnPros_FunNumFunc( inputnum( line01 ) ) ;n : int f2_arrProhCodeWord [ ...
bigcode/starcoder2-7b
1
Python
a = 1 b = 2 c= 3 d = 4 for i in range(on): n = int(inpt()) mfunput() if n%2 == 0: print("Yes") else: priand("No")
deepseek-ai/deepseek-coder-6.7b-base
1
Python
when all the 2*N parameters are correctly obtained You can read the code, provided that is clear 1 <= N, a[i] < 30 push the board on to the screen """ """ time complexity: O(n) """ def dieThrow(latch, snake): if latch > 0: maxValue = latch - 1 elif snake: maxValue = snake[1][0] + 1 if max...
meta-llama/Llama-3.2-1B
1
Python
for t in range(int(input())): (x, y) = [int(i) for i in input().split()] ans = 2 * min(x, y) if x != y: ans += 1 + 2 * (abs(x - y) - 1) print(ans)
human
0
Python
def replaceWithRank(arr, N): # Create a dictionary to store the rank of each unique element rank_dict = {} # Sort the array while keeping track of the original indices sorted_arr = sorted((val, idx) for idx, val in enumerate(arr)) # Assign ranks to each unique element rank = 1 for ...
codellama/CodeLlama-70b-Instruct-hf
1
Python
n = int(input()) a = [int(i) for i in input().split()] mn = -100000000000000 for i in a: if i < 0: mn = max(mn, i) continue v = int(i ** 0.5) if v * v != i and (v + 1) * (v + 1) != i and ((v - 1) * (v - 1) != i): mn = max(mn, i) print(mn)
human
0
Python
python def is_M_popular_items_selectable(N: int, M: int, votes: List[int]) -> str: votes.sort(reverse=True) total_votes = sum(votes) if M*2 >= N or M > total_votes / (1/4): return 'No' vote_threshold = total_votes / M / 4 for vote in votes: if vote >= vote_threshold: M -...
microsoft/Phi-3.5-mini-instruct
1
Python
(N, K) = map(int, input().split()) a = list(map(int, input().split())) p = 0 while p < K: B = [0] * (N + 1) for i in range(N): t = a[i] B[max(i - t, 0)] += 1 B[min(i + t + 1, N)] -= 1 for i in range(N): B[i + 1] += B[i] a = B[:N] if min(a) == N: break p += 1 print(*a)
human
0
Python
def uniteUnique(*arrays): result = [] orig = iter(arrays) for num in itertools.chain.from_iterable(itertools.chain(itertools)): if orig.next() != num result.append(num) return result
google/codegemma-2b
1
Python
using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<pair<int, int>> v; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; v.push_back(make_pair(a, b)); } vector<double> ans(n); for (int i = 0; i < n; i...
microsoft/phi-2
1
C++
from collections import Counter def solve(): ans = 0 (N, K) = map(int, input().split()) A = list(map(int, input().split())) cum = [0] * (N + 1) for i in range(N): cum[i + 1] = (cum[i] + A[i]) % K for i in range(N): cum[i + 1] = (i + 1 - cum[i + 1]) % K if N < K: c = Counter(cum) for v in c.values(): ...
human
0
Python
checks if the returned value is correct. You need to write a function that can generate all possible combinations. ------ Subtasks ------ Subtask 1 (20 points): $K = 10^{9}$ Subtask 2 (20 points): $N, M, K \leq 10^{18}$ Subtask 3 (20 points): $N = 10^{5}$ Subtask 4 (20 points): Original constraints Subtask 5 (40 poi...
deepseek-ai/deepseek-coder-1.3b-base
1
Python
python for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) a.sort(reverse=True) max_side = 0 length = 0 for plank in a: if length + plank > max_side: length += plank else: max_side = length length = plank ...
Qwen/Qwen2.5-Coder-7B-Instruct
1
Python
def distance_to(a, b): return abs(distance[b][a]) while a != 7 and b != 7: print(a, distance_to)
bigcode/starcoder
1
Python
n = int(input()) arr = list(map(int, input().split())) temp = list(map(int, input().split())) count = 0 for i in range(len(temp)): temp[i] += arr[i] i = 0 while(i < len(temp)-1): if((temp[i+1]-temp[i]) % 2 != 0): temp.remove(temp[i+1]) count += 1 i = -1 i+=1
google/codegemma-2b
1
Python
import typing import array def ri(*args) -> typing.Iterator: (func, funcs) = (int, (int, float, str)) sep = ' ' for a in args: if a in funcs: func = a elif isinstance(a, str): sep = a return map(func, input().strip().split(sep)) def main(): N_MAX = 10 ** 5 _ = input() ns = ri() arr = array.array('q'...
human
0
Python
s = input() gg = [] for n in range(0, len(s)): if s[n] != '+': gg.append(int(s[n])) gg.sort() x = '' for m in range(0, len(gg) - 1): x += str(gg[m]) + '+' print(x + str(gg[len(gg) - 1]))
human
0
Python
p, m = input().split() n, p = map(int, input().split()) ar = list(map(int, input().split())) print(sum(ar[n:] + ar[0:n])) Sample tests: Please donot run the tests with GNU C++11 #include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { for (int i = 0; i < n; ++i) { ...
google/codegemma-2b
1
Python
# Function to find the median of two sorted arrays. def median_of_arrays(array1, array2) : # code here n1 =len(array1) n2=len(array2) if(n1>n2): n1,n2=n2,n1 a,b=array2,array1 dc=0 med=0 if(n2<median): dc=n2 opt=dc-median a_array=[3,1,4,5] b_array=[2,6,8,9] GetMedian(a_array,b_array) ...
bigcode/starcoder2-3b
1
Python
python def min_zeros_to_remove(s): count_of_zeros = 0 has_one_been_found = False for i in s: if i == '1': has_one_been_found = True elif has_one_been_found: count_of_zeros += 1 return count_of_zeros t = int(input()) for _ in range(t): s = input().strip() ...
microsoft/Phi-3.5-mini-instruct
1
Python
"3797" === import sys def calculate_asleep_duration(songs, title_to_wake_up_to): # Set the initial asleep duration to 0 seconds asleep_duration = 0 # Iterate through all the songs for title, duration in songs: # Add the current song's duration to the asleep duration asleep_duration += ...
microsoft/Phi-3-medium-4k-instruct
1
Python
To solve this problem, we need to maximize the final element in the sequence by repeatedly performing the specified operations. Here’s a step-by-step approach to achieve this: 1. **Identify the Optimal Strategy**: - We need to maximize the final sum, which means we should prefer operations that combine larger eleme...
Qwen/Qwen2.5-Coder-32B-Instruct
1
Python
python def minimizeVisibleBoxes(n, side_lengths): """ This function takes the number of boxes 'n' and a list of integers representing side lengths 'side_lengths', and returns the minimum possible number of visible boxes after optimally nesting the boxes within each other. The function applies the heuris...
microsoft/Phi-3-mini-4k-instruct
1
Python
#include <bits/stdc++.h> using namespace std; mt19937 rnd(std::chrono::duration_cast<std::chrono::milliseconds> (std::chrono::system_clock::now().time_since_epoch()).count()); int randint(int n) { return rnd() % n + 1; } vector<vector<int>>graph; vector<pair<int, int>>border; int ma...
human
0
C++
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public int diameterOfBinaryTree(TreeNode root) { if (root == null) { return 0; } ...
human
0
Java