code large_string | generator large_string | language large_string | model_family large_string | authorship int64 | label int64 |
|---|---|---|---|---|---|
private Employee processRow(HashMap<String,Object> row)
{
Employee employee=null;
for(Employee currentEmployee : employeeInstances)
{
if(currentEmployee.getId() == (Integer)row.get("id"))
{
employeesUpdating.add(currentEmployee);
curren... | human | Java | human | 0 | 0 |
package com.xcóa.powder spring.security.web.diary.service.handler.transactional;
import com.xcóa.powder.spring.security.web.diary.api.component.SignupCallback;
import com.xcóa.powder.spring.security.web.diary.api.controller.form.SignupForm;
import com.xcáp.powder.spring.security.web.diary.domain.model.signup.SignupSer... | meta-llama/llama-3.1-8b-instruct | Java | meta-llama | 3 | 1 |
class Solution {
public:
int areaOfMaxDiagonal(vector<vector<int>>& dimensions) {
int res = -1, area = 0;
for (auto v : dimensions) {
int diag = v[0] * v[0] + v[1] * v[1];
if (res < diag) {
res = diag;
area = v[0] * v[1];
} else if ... | human | C++ | human | 0 | 0 |
import unittest
from unittest.mock import patch
import requests_mock
import warnings
class TestFolderAPI(unittest.TestCase):
"""Unit test suite for Folder API class methods."""
@patch('your_module.Folder')
def setUp(self, mock_folder):
"""Set up the test case with a mock Folder instance."""
... | gpt-4o | Python | gpt | 9 | 1 |
def convert(original, target, n):
bin_number = bin(original)[2::][::-1] # this line converts original number to binary and converts type to str
result = str(int(bin_number, base=2)) # converts binary number to int then to string.
return result[len(result) - n:] # return only last n symbols.
n = int(in... | qwen/qwen2.5-coder-1.5b | Python | qwen | 1 | 1 |
console.log('hello')
let cart = []
$('button').click(function(e){
let name = $(this).parent().parent().find('h3').text()
// let price = $(this.price).find('span').text()
let price = $(this.price).find('span').text()
window.variableICanPlayWith = this;
// $(variableICanPlayWith).parent().parent().... | human | JavaScript | human | 0 | 0 |
def calculate_sum(n: int) -> int:
"""
Calculate the sum of a geometric series with a common ratio of 1/2.
Args:
n (int): The initial number.
Returns:
int: The sum of the series.
"""
total = 0
while n > 0:
total += n
n //= 2
return total
# Example usage
... | meta-llama/llama-3.3-70b-instruct | Python | meta-llama | 3 | 1 |
max_val = max(lst)
dp = [0] * (k + 1)
for i in range(1, k + 1):
dp[i] = [0] * (n + 1)
for i in range(1, n + 1):
dp[1][i] = lst[i - 1]
for i in range(2, k + 1):
for j in range(1, n + 1):
dp[ | ibm-granite/granite-8b-code-base-4k | Python | ibm-granite | 6 | 1 |
#include<bits/stdc++.h>
using namespace std;
// g++ test.cpp ./a.out
int r[105]={0},w[105]={0};
int main(){
cin.tie(0);ios::sync_with_stdio(0);
int t;
cin>>t;
int n,m;
while(t--){
cin>>n>>m;
memset(r,0,sizeof(r));
memset(w,0,sizeof(w));
int mx_r=0,mx_w=0;... | human | C++ | human | 0 | 0 |
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
public class MetadataIndexConsumer implements Consumer {
private List<Item> toReindex = new ArrayList<>();
private List<Item> toUpdateAuthorities = new ArrayList<>();
private final Authority... | meta-llama/meta-llama-3.1-405b-instruct | Java | meta-llama | 3 | 1 |
// Add import for Gson
import com.google.gson.Gson;
// ... (other parts of the class remain unchanged)
public class OutputAccumulator {
// ... (other class members remain unchanged)
// Set start count using Gson
public void setStartCount(int startCount) {
journals = new String[] { startCount.toSt... | microsoft/phi-3-mini-4k-instruct | Java | phi | 2 | 1 |
<?php
namespace App\Http\Controllers;
use App\Models\category;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Redirect;
class CategoryController extends Con... | qwen/qwen2.5-72b-instruct | PHP | qwen | 1 | 1 |
@ApiModel(description = "This type represents information about a link port of an external VL, i.e. a port providing connectivity for the VNF to an NS VL. ")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-11-08T16:52:33.422+01:00")
public class ExtLinkPortInfo {
@Se... | human | Java | human | 0 | 0 |
public int checkStatus(FileStatusIterator results) throws IOException {
int count = 0;
while (results.hasNext()) {
FileStatus fileStatus = results.next();
Path path = fileStatus.getPath();
try {
FileAttributeView faView = Files.getFileAttributeView(path, false);
... | deepseek-ai/deepseek-coder-1.3b-instruct | Java | deepseek | 8 | 1 |
class Solution:
def maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) -> int:
window_start = 0
window_letters = Counter()
substring_counts = Counter()
for window_end in range(len(s)):
window_letters[s[window_end]] += 1
substring_len = window_end - window_start + 1
while substring_len... | human | Python | human | 0 | 0 |
python
string = input()
L = 1e-6
if len(set(string)) == 1:
print(1)
else:
n = len(string)
dp = [[[0 for _ in range(26)] for _ in range(n)] for _ in range(n)]
for i in range(26):
dp[0][0][i] = 1 if chr(97 + i) == string[0] else 0
for c in range(1, n):
for a in range(n):
f... | meta-llama/llama-3.1-8b-instruct | Python | meta-llama | 3 | 1 |
def network(self, max_clusters=20, max_members=10, max_nodes=300, l_go_selective=False):
if len(self.data)==0:
return None
if self.DM is None:
util.error_msg('Please run cluster first!')
S_node=GO_Cluster.sample_rows(self.t_go, max_clusters=max_clusters, max_members=max_m... | human | Python | human | 0 | 0 |
_mergePrefixes(left, right) {
if (!right) {
return left;
} else if (!left) {
return right;
}
if (_.isString(left) && _.isString(right)) {
return left + right;
}
if (left.type === React.Fragment) {
if (right.type === React.Fragment) {
return this._createFragment(
... | human | JavaScript | human | 0 | 0 |
@DoNotStrip
@SuppressWarnings("unused")
@AnyThread
@ThreadConfined(ANY)
private void scheduleMountItem(
@NonNull final MountItem mountItem,
int commitNumber,
long commitStartTime,
long diffStartTime,
long diffEndTime,
long layoutStartTime,
long layoutEndTime,
long... | human | Java | human | 0 | 0 |
auto IO_OPTIMIZE=[](){
ios::sync_with_stdio(false);
cin.tie(nullptr);
return 0;
}();
#define ll long long
#define inf 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dep(i,a,b) for(int i=(a);i>=(b);i--)
const int maxn = 2e5+5;
const int mo = 1e9+7;
int n,m,k;
int a[maxn],c[maxn];
class Solut... | human | C++ | human | 0 | 0 |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class PluginSystem {
private List<Plugin> plugins;
private Scanner scanner;
public PluginSystem() {
plugins = new ArrayList<>();
scanner = new Scanner(System.in);
}
public interface Plugin {
... | gpt-4o-mini | Java | gpt | 9 | 1 |
class RemoteControllerTester:
def test_remote_controller(self):
receiver = Receiver()
forward_command = ForwardCommand(receiver)
backward_command = BackwardCommand(receiver)
remote_controller = RemoteController()
remote_controller.set_forward_command(forward_command)
... | mistralai/mixtral-8x7b-instruct-v0.1 | Python | mistral | 10 | 1 |
t = int(input())
while t > 0:
n = int(input())
notes = 0
ls = [100, 50, 10, 5, 2, 1]
for i in ls:
notes = notes + n // i
n = n % i
print(notes)
t = t - 1
| human | Python | human | 0 | 0 |
@Override
public void parseNamespaceSpecificString(
NamespaceIdentifier namespace,
String nss,
SERIALIZATION_FORMAT serializationFormat)
throws URNFormatException
{
Matcher matcher = GlobalArtifactIdentifierImpl.namespaceSpecificStringPattern.matcher(nss);
if( ! matcher.matches() )
throw new URNFormat... | human | Java | human | 0 | 0 |
python
def left(i):
return 2 * i
def right(i):
return 2 * i + 1
def maxHeapify(A, i, H):
l = left(i)
r = right(i)
largest = i
if l <= H and A[l] > A[largest]:
largest = l
if r <= H and A[r] > A[largest]:
largest = r
if largest != i:
A[i], A[larges... | qwen/qwen2.5-coder-7b-instruct | Python | qwen | 1 | 1 |
private static Stack<IMove> stackCopy(Stack<IMove> existing) {
Stack<IMove> aCopy = new Stack<IMove>();
for (Iterator<IMove> it = existing.iterator(); it.hasNext(); ) {
aCopy.push(it.next());
}
return aCopy;
} | human | Java | human | 0 | 0 |
def bs(left, right, pos, p):
while right - left > 1:
middle = (left + right) // 2
if p[middle] < pos:
left = middle
else:
right = middle
return right
t = int(input())
for i in range(t):
count = dict()
for j in 'abcdefghijklmnopqrstuvwxyz':
count[j] = 0
(n, m) = map(int, input().split())
s = input()
... | human | Python | human | 0 | 0 |
#include <iostream>
#include <vector>
#include <string>
#include <ctime>
#include <iomanip>
// Sample thresholds for machine metrics
const float VIBRATION_THRESHOLD = 5.0; // Vibration threshold
const float TEMPERATURE_THRESHOLD = 80.0; // Temperature threshold
const int WORKING_HOURS_LIMIT = 500; // Limit for working... | gpt-4o-mini | C++ | gpt | 9 | 1 |
for t in range(int(input())):
s = input()
s = s.lstrip('0')
s = s.rstrip('0')
c = 0
for i in s:
if i == '0':
c += 1
print(c)
| human | Python | human | 0 | 0 |
import java.util.HashMap;
import java.util.Map;
public class CharacterFrequencyCounter {
public static void main(String[] args) {
String text = "example text"; // Example text
Map<Character, Integer> hm = new HashMap<>();
// Loop through each character in the string
for (int i = 0;... | qwen/qwen2.5-72b-instruct | Java | qwen | 1 | 1 |
import numpy as np
import pandas as pd
import requests
from textblob import TextBlob
import matplotlib.pyplot as plt
from flask import Flask, render_template, request, jsonify
import logging
from datetime import datetime
app = Flask(__name__)
# Set up logging
logging.basicConfig(filename='app.log', level=logging.INFO... | gpt-4o-mini | Python | gpt | 9 | 1 |
on python version 2 (no unicode) and do not print anything on stdout, instead print the output to file with mode="w"
import random, sys
from sys import stdout
p, q, l, r, k = tuple(map(int, raw_input().strip().split()))
p2, q = random.randint(int(p), int(q)), int(r)
stdout.write("{}".format((10 - 7 - (p % k)) / 3))#th... | qwen/qwen2.5-coder-1.5b | Python | qwen | 1 | 1 |
func (r *GetSubKeysResult) String() []string {
slice := make([]string, len(r.skeys))
for i, s := range r.skeys {
slice[i] = string(s[:len(s)-1])
}
return slice
}
| meta-llama/meta-llama-3.1-8b-instruct | Go | meta-llama | 3 | 1 |
from collections import defaultdict
def dfs(node, parent, cost, graph):
ans = 0
for neighbor, weight in graph[node]:
if neighbor != parent:
ans = max(ans, dfs(neighbor, node, cost + weight, graph))
return max(ans, cost)
def maxTravelCost(n, edges):
graph = defaultdict(list)
for... | codellama/codellama-70b-instruct-hf | Python | meta-llama | 3 | 1 |
import numpy as np
from astropy.table import Table
def extract_lens_parameters(x: Table, names: str or tuple) -> (np.ndarray, list):
"""
Given an OM10 table of lenses, extract the required parameters and
provide labels for them.
Parameters
----------
x : Table
OM10 lens sample.
nam... | meta-llama/llama-4-scout-17b-16e-instruct | Python | meta-llama | 3 | 1 |
class Solution:
def sumBase(self, n: int, k: int) -> int:
ans = 0
while n:
n, d =divmod(n, k)
ans += d
return ans | human | Python | human | 0 | 0 |
import java.util.HashMap;
import java.util.Map;
// Class to represent a unique symbol
class Symbol {
private final String name;
public Symbol(String name) {
this.name = name;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (!(obj instanceof... | gpt-4o | Java | gpt | 9 | 1 |
var express = require('express');
var router = express.Router();
var mongoose = require('mongoose');
var fs = require('fs');
/* GET home page. */
router.get('/', function(req, res) {
res.render('index', { title: 'File from renamer' });
});
router.get('/#/Users', function(req, res) {
res.send({"res":"gogo"});
});
... | human | JavaScript | human | 0 | 0 |
public static class Adapted3DFrom4D implements Noise3D {
public Noise4D basis;
public double w;
public Adapted3DFrom4D() {
this(ClassicNoise.instance);
}
public Adapted3DFrom4D(Noise4D basis) {
this.basis = basis;
}
public double getW() {... | human | Java | human | 0 | 0 |
namespace aafccore.resources
{
internal static class ConfigStrings
{
// App Settings
internal const string ControlStorageConnectionString = "ControlStorageConnectionString";
internal const string InstrumentationKey = "InstrumentationKey";
internal const string LARGE_FILE_COPY_TI... | human | C# | human | 0 | 0 |
n = int(input())
paper = [list(input()) for _ in range(n)]
diagonal1 = [paper[i][i] for i in range(n)]
diagonal2 = [paper[i][n - i - 1] for i in range(n)]
other_squares = [paper[i][j] for i in range(n) for j in range(n) if i!= j and i + j!= n - 1]
diagonal1_set = set(diagonal1)
diagonal2_set = set(diagonal2)
other_sq... | meta-llama/llama-3.3-70b-instruct | Python | meta-llama | 3 | 1 |
The class TextView is present already, you don't need to import anything for it.
class TextView:
def __init__(self, value: str, *, f_localize = True, isRtl: bool = False, editable: bool = True):
self.text = value
self.localize = f_localize
self.isRtl = isRtl
self.editable = editable
... | deepseek-ai/deepseek-coder-6.7b-instruct | Java | deepseek | 8 | 1 |
def reverseEqn(self, s: str):
# dictionary to store precedence value of the operators
dic = {'+', '-', '*', '/': 0, '^': 1, '(': 2, ')': 2}
stack = []
ans = ""
# iterating through the string
i = len(s) - 1
while i >= 0:
# if current character is not a space then a... | meta-llama/llama-3.1-8b | Python | meta-llama | 3 | 1 |
def generate_classifier_program(file_name, decision_tree, validation_file_name):
file_write = open(file_name, "w")
insert_import_statement(file_write)
file_write.writelines(["\ndef classify_validation_data(cls_validation_data):"])
file_write.writelines(["\n\tclassification_result = list()"])
file_wr... | human | Python | human | 0 | 0 |
def _try_estimate_gas(ledger_api: LedgerApi, tx: Dict[str, Any]) -> Dict[str, Any]:
try:
gas_estimate = ledger_api.api.eth.estimateGas(transaction=tx)
tx["gas"] = gas_estimate
except Exception as e:
raise e
return tx | human | Python | human | 0 | 0 |
public class VideoSharingService extends RcsService {
/**
* API
*/
private IVideoSharingService api;
/**
* Constructor
*
* @param ctx
* Application context
* @param listener
* Service listener
*/
public VideoSharingService(Context ctx, RcsServiceListener listen... | human | Java | human | 0 | 0 |
(n, k) = [int(x) for x in input().split()]
s = {ord(x) - 96 for x in input()}
r = sorted(s)
min_sum = -1
count = 1
current_sum = r[0]
prev_item = r[0]
for (i, item) in enumerate(r[1:]):
if count == k:
break
if item - prev_item > 1:
count += 1
current_sum += item
prev_item = item
if count == k:
min_sum = curr... | human | Python | human | 0 | 0 |
public class ServiceUpdateStatus : ConstantClass
{
public static readonly ServiceUpdateStatus Available = new ServiceUpdateStatus("available");
public static readonly ServiceUpdateStatus Complete = new ServiceUpdateStatus("complete");
public static readonly ServiceUpdateStatus InProgress = n... | human | C# | human | 0 | 0 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LINE_LENGTH 1024
void check_memory_leak(const char *line) {
// Example check for malloc without free
if (strstr(line, "malloc(") != NULL && strstr(line, "free(") == NULL) {
printf("Possible memory leak: %s\n", line);
}
}
void ... | gpt-4o-mini | C | gpt | 9 | 1 |
int EnglishNumberConverter::convertSpelledOutNumberWord(const std::wstring& str) {
if (!str.compare(L"zero")) return 0;
if (!str.compare(L"one")) return 1;
if (!str.compare(L"two")) return 2;
if (!str.compare(L"three")) return 3;
if (!str.compare(L"four")) return 4;
if (!str.compare(L"five")) return 5;
if (!str.... | human | C++ | human | 0 | 0 |
def hxtScrollbar(master):
bg = master.cget("background")
acanvas = Canvas(master, borderwidth=0, background=bg)
frame = Frame(acanvas, background=bg)
vsb = Scrollbar(master, orient="vertical", command=acanvas.yview)
vsb2 = Scrollbar(master, orient='horizontal', command=acanvas.xv... | human | Python | human | 0 | 0 |
import os
import cv2
import numpy as np
from sklearn.utils import resample
def augment_dataset(samples, augmented_dir, multiplier, register):
if not os.path.exists(augmented_dir):
os.makedirs(augmented_dir)
rgb_paths, lwir_paths, labels = zip(*samples)
labels = np.array(labels)
unique_labels ... | microsoft/phi-4 | Python | phi | 2 | 1 |
using System;
public delegate void CheckpointCallback();
public class CheckpointExample
{
public void ExecuteAndCheckpoint()
{
Console.WriteLine("Starting execution");
var result = SomeCheckpointOperationThatFails();
Console.WriteLine("This should still be printed even after fail");
... | mistralai/mistral-small-24b-instruct-2501 | C# | mistral | 10 | 1 |
import math
r = float(input())
area = math.pi * r ** 2
circumference = 2 * math.pi * r
print(f"{area:.6f} {circumference:.6f}") | codellama/codellama-34b-instruct-hf | Python | meta-llama | 3 | 1 |
def execute(self, obj, col_names, force_overwrite=False, col_map=None):
if obj is None:
raise MergeException(('DataMerge is attempting to merge a null object with a dataframe. Object to be '
' merged must be a dataframe, series, constant or numpy array. Unable to me... | human | Python | human | 0 | 0 |
// moodTracker.js
// Import necessary libraries for visualization (e.g., Chart.js)
// You'll need to include Chart.js in your HTML for this to work
// <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
// Mood logging functionality
class MoodTracker {
constructor() {
this.entries = JSON.parse(... | gpt-4o-mini | JavaScript | gpt | 9 | 1 |
const int MOD = 1e9 + 7;
long long dp[20001]{1};
int solve(vector<int>& N, int l, int r) {
sort(N.begin(), N.end());
long long sum = 1;
for (int n : N) {
for (int j = r; j >= n; j--) {
sum = (sum + dp[j - n]) % MOD;
dp[j] = sum;
}
}
int ans = 0;
for (int ... | qwen/qwen2.5-coder-1.5b-instruct | C++ | qwen | 1 | 1 |
def max_anars_chakris(P, a, b, c, x, y):
max_anar_chakri = 0
for f in range(P // a + 1):
remaining_budget = P - f * a
max_anars = min(f // x, remaining_budget // b)
remaining_fuljhari = f - max_anars * x
max_chakris = remaining_fuljhari // y
max_anar_chakri = max(max_anar... | qwen/qwen2.5-coder-32b-instruct | Python | qwen | 1 | 1 |
def disable_friendly_fire(ships):
"""
Disables friendly fire between ships with the same owner.
Parameters:
ships (list of dict): A list of ships, where each ship is represented as a dictionary with keys 'owner' and 'is_friendly'.
Returns:
list of dict: The modified list of ships with ... | microsoft/phi-4 | Python | phi | 2 | 1 |
s1 = list(input())
k = int(input())
l1 = [int(x) for x in input().split()]
alfie = 'abcdefghijklmnopqrstuvwxyz'
cool = []
ans = 0
for x in s1:
cool.append(l1[alfie.index(x)])
for x in range(k):
cool.append(max(l1))
for x in range(len(cool)):
ans += (x + 1) * cool[x]
print(ans)
| human | Python | human | 0 | 0 |
def approve(self, request):
"""
This method marks a revenue as approved.
Approving a revenue triggers an email to the economy system, and another email to the user who submitted the revenue
"""
if request.user == self.user:
messages.error(
request,
... | human | Python | human | 0 | 0 |
n = int(input())
l = [input() for i in range(n)]
s = set(l)
print(len(s))
| human | Python | human | 0 | 0 |
def get_schema(database_path: str, wal_path: Optional[str] = None) -> Dict[str, str]:
"""
Retrieves schema from given database.
Args:
database_path (str): file path to database.
wal_path (Optional[str]): file path to WAL file.
Returns:
dict[str, str]: schema as an SQL query per table... | mistralai/mistral-nemo-instruct-2407 | Python | mistral | 10 | 1 |
import java.util.*;
import java.io.*;
public class Main {
public static Scanner sc = new Scanner(System.in);
public static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) {
int t = sc.nextInt();
while( t > 0 ) {
... | human | Java | human | 0 | 0 |
#ifndef REDIS_DECIMAL_H
#define REDIS_DECIMAL_H
#include <dec/dec.h>
#include <string>
#include <stdexcept>
namespace redis {
template <size_t Precision = 28>
class RedisDecimal : public dec::decimal {
public:
RedisDecimal() : dec::decimal() {}
RedisDecimal(const std::string& str) {
try {
... | google/gemma-3-12b-it | C | gemma | 5 | 1 |
package com.example.personapp.model;
import jakarta.persistence.*;
@Table(name = "person")
@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Column(name = "name")
private String name;
@Column(name = "professio... | qwen/qwen2.5-coder-1.5b-instruct | Java | qwen | 1 | 1 |
q = int(input())
s = int(0)
d = int(0)
w = list(map(int, input().split()))
e = q
while e > 0:
s += max(w[0], w[len(w) - 1])
w.remove(max(w[0], w[len(w) - 1]))
e -= 1
if e == 0:
break
d += max(w[0], w[len(w) - 1])
e -= 1
w.remove(max(w[0], w[len(w) - 1]))
print(str(s) + ' ' + str(d))
| human | Python | human | 0 | 0 |
class CodeGenerator {
private final ProcessingEnvironment mEnv;
private final IntrospectionHelper mHelper;
private final DocumentModel mModel;
private final String mOutputPackage;
private final TypeSpec mOutputClass;
public static CodeGenerator generate(
@NonNull ProcessingEnvironm... | human | Java | human | 0 | 0 |
class Encrypter:
def __init__(self, keys: List[str], values: List[str], dictionary: List[str]):
self.d = defaultdict(int)
self.m = {}
for i, j in zip(keys, values):
self.m[i] = j
for i in dictionary:
l = []
for x in i:
l.append(sel... | human | Python | human | 0 | 0 |
@Generated("org.rcsb.cif.schema.generator.SchemaGenerator")
public class StructRefSeq extends DelegatingCategory {
public StructRefSeq(Category delegate) {
super(delegate);
}
@Override
protected Column createDelegate(String columnName, Column column) {
switch (columnName) {
... | human | Java | human | 0 | 0 |
def main():
s = input().strip()
return s + s[::-1]
if __name__ == "__main__":
print(main())
| qwen/qwen2.5-72b-instruct | Python | qwen | 1 | 1 |
n = int(input())
s = list(input())
t = list(input())
ans = []
for i in range(n):
if s[i] != t[i]:
f = -1
for j in range(i + 1, n):
if s[j] == t[i]:
f = j
break
if f == -1:
print(-1)
exit(0)
for j in range(f - 1, i - 1, -1):
(s[j], s[j + 1]) = (s[j + 1], s[j])
ans += [j + 1]
print(len(ans... | human | Python | human | 0 | 0 |
/*
苹果返回的失效的token列表
*/
var mongodb = require('./mongodb');
var Schema = mongodb.mongoose.Schema;
var limitedTokenSchema = new Schema({
time: String,
device: String
});
module.exports = mongodb.mongoose.model("limitedToken", limitedTokenSchema); | human | JavaScript | human | 0 | 0 |
public static IOrderedQueryable<TEntity> OrderBy<TEntity>(this IQueryable<TEntity> query, string propertyName, OrderDirection direction = OrderDirection.Ascending, bool caseInsensitive = false, bool alreadyOrdered = false)
{
if (string.IsNullOrWhiteSpace(propertyName))
{
throw new ArgumentNullException(... | bigcode/starcoderbase-3b | C# | bigcode | 7 | 1 |
#include <iostream>
#include <stack>
#include<vector>
int main() {
int a, stones, x, y;
std::cin >> a >> stones;
std::vector<std::vector<int>> grid(a, std::vector<int>(a, 0));
std::pair<int, int> pos(a-1, a-1); // Player 'a' starts from bottom-right
std::pair<int, int> target(0, 0); // Player... | microsoft/phi-3-small-8k-instruct | C++ | phi | 2 | 1 |
using System;
using System.IO;
public class StreamFactory
{
/// <summary>
/// Creates a new instance of <see cref="FileStream"/> with the specified file name and mode.
/// </summary>
/// <param name="path">The file name to open or create.</param>
/// <param name="mode">The mode in which to open the... | qwen/qwen2.5-coder-7b-instruct | C# | qwen | 1 | 1 |
class GameBot:
"""The Bot Player.
*Every 30 seconds the bot should pause for exactly 5 seconds,
moving the mouse to the top-right to allow for ending of program.
*After each move, the bot should move the mouse to the bottom-right
to prevent the image from containing the mouse cursor."""
... | human | Python | human | 0 | 0 |
wins_arr = [int(x) for x in input().split()]
wins={1:0,2:0,3:0}
last_view = 0
for i in range(n):
if i==0 and wins_arr[i] != 1:
last_view = wins_arr[i]
wins[last_view]+=1
continue
if wins_arr[i]==last_view:
last_view = 1 if last_view ==2 else 2
else:
last_view = 1 if last_view ==2 else 2
wins[last_view]+=... | bigcode/starcoder2-15b | Python | bigcode | 7 | 1 |
def resources_management(resources, max_parallel, inprogress):
if len(inprogress) == max_parallel:
for index in inprogress:
if resources[index] == 2 or index > len(resources) - 1:
return False
return True
print(resources_management([0, 0, 1, 1, 2], 2, [0, 1])) # Prints Fals... | deepseek-ai/deepseek-coder-6.7b-instruct | Python | deepseek | 8 | 1 |
func BinaryToNativeItem(data, acceptID, acceptValue interface{}, encodedID []byte) error {
if reflect.TypeOf(acceptValue).Kind() != reflect.Slice && reflect.TypeOf(acceptValue).Kind() != reflect.Ptr {
return fmt.Errorf("Value must be a []byte or *[]byte")
}
val := reflect.ValueOf(acceptValue)
if acceptValue.Kind(... | microsoft/phi-3-small-8k-instruct | Go | phi | 2 | 1 |
@Override
public void onCreate(Bundle savedInstanceState) {
//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
CallHelloWorld();
} catch (IOException e) {
... | human | Java | human | 0 | 0 |
#include <iostream>
#include <unordered_map>
#include <vector>
// Function to compare module function with difference pattern
bool compareModuleFunctionAndDifferencePattern(const std::vector<std::string>& moduleFunction, const std::vector<std::string>& differencePattern) {
// Assuming that both vectors have the sa... | microsoft/phi-3-mini-4k-instruct | C++ | phi | 2 | 1 |
def recamanSequence(self, num):
dp = [0] #base case: 0
for i in range(1,num+1):
val1 = dp[i-1]-i # check for predecessor
val2 = dp[i-1]+i # check for successor
# if both conditions are true:
if val1 > 0 and val1 not in dp:
dp.append(val1)
elif val2 not in dp:
dp.append(val1) # success... | bigcode/starcoder2-3b | Python | bigcode | 7 | 1 |
<style type="text/css">
a{list-style: none;}
table{margin-top: 5%;}
<div class="container">
<div style="margin-bottom: 10%; text-align: center;">
Data Mahasiswa
<div class="add">
<?php
$msg = $this->session->flashdata('msg');
if(isset($msg)){
echo $msg;
}
$username = $this->session->use... | human | PHP | human | 0 | 0 |
<?php
abstract class b {
abstract public function __set($name, $value);
}
class a extends b {
private function __set($name, $value) {}
} | deepseek-ai/deepseek-r1 | PHP | deepseek | 8 | 1 |
// Copyright 2017 All rights reserved.
#include "UsdToGtPrim.h"
#include
#include
PXR_NAMESPACE_USING_DIRECTIVE
namespace WalterHoudini
{
GT_PrimitiveHandle getGtPrimFromUsd(
const UsdPrim& prim,
const UsdTimeCode& time,
const GusdPurposeSet purpose)
{
GT_PrimitiveHandle gtPrimHandle;
UsdGeom... | human | C++ | human | 0 | 0 |
t = int(input())
for i in range(t):
s = input() + '$'
res = set()
prev = '#'
count = 0
for c in s:
if c == prev:
count += 1
else:
if prev != '#' and count % 2 == 1:
res.add(prev)
count = 1
else:
count += 1
prev = c
print(''.join(sorted(res)))
| human | Python | human | 0 | 0 |
#include
#include
#include "logging.h"
#define UNUSED __attribute__((unused))
int debug_level = LOG_NOTICE;
void applog(int level, char *fmt, ...)
{
if (level > debug_level)
return;
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
printf("\n");
va_end(ap);
} | human | C | human | 0 | 0 |
for i in range(int(input())):
lia = list(input().split())
lib = list(input().split())
count = 0
for i in lia:
if i in lib:
count += 1
print('similar' if count >= len(lia) // 2 else 'dissimilar')
| human | Python | human | 0 | 0 |
@Slf4j
@Component
public class MicroWebDbHealthIndicator implements HealthIndicator {
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public Health health() {
try {
if (true) {
throw new RuntimeException("The DB is not available.");
}
... | human | Java | human | 0 | 0 |
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"sync"
"time"
"github.com/dgrijalva/jwt-go"
"github.com/go-chi/chi"
"golang.org/x/crypto/bcrypt"
)
var (
users = make(map[string]string) // mock user store
userTokens = make(map[string]string) // token store
secretKey = []byte("... | gpt-4o-mini | Go | gpt | 9 | 1 |
def py3to2_convert_tree(folder, dest, encoding="utf8", pattern=".*[.]py$",
pattern_copy=_setup_pattern_copy,
unittest_modules=None, fLOG=noLOG):
exclude = ("temp_", "dist", "_doc", "build", "extensions",
"nbextensions", "dist_module27", "_virtualenv", "... | human | Python | human | 0 | 0 |
const initialState = {
focusedElements: {},
loading: false,
error: null
};
const focusedElementReducer = (state = initialState, action) => {
switch (action.type) {
case 'UPDATE_FOCUSED_ELEMENT':
return {
...state,
focusedElements: {
...state.focusedElements,
[actio... | mistralai/mistral-7b-instruct-v0.3 | JavaScript | mistral | 10 | 1 |
public class LicenseServiceTest {
@Test
public void testLoadLicenseWhenAllowedTypesSetAndTypeMatches() {
// Given
LicenseService licenseService = mock(LicenseService.class);
when(licenseService.ALLOWED_LICENSE_TYPES_SETTING()).thenReturn("java,other");
licenseService.setAllowedL... | ibm-granite/granite-3.2-2b-instruct | Java | ibm-granite | 6 | 1 |
import pytest
from unittest import mock
from your_module import Prometheus, Deployment
@pytest.fixture
def deployment():
return Deployment(metadata={"annotations": {}}, spec={"template": {}})
def test_apply_no_prometheus_enabled(deployment):
app_spec = {"prometheus": {"enabled": False}}
prometheus = Prome... | gpt-4o | Python | gpt | 9 | 1 |
import javax.sound.sampled.*;
import java.io.*;
import java.net.*;
import javax.json.*;
import javax.speech.*;
import javax.speech.recognition.*;
import java.util.*;
public class VirtualAssistant {
private Recognizer recognizer;
private final String weatherApiUrl = "https://api.openweathermap.org/data/2.5/weat... | gpt-4o-mini | Java | gpt | 9 | 1 |
func appendUint(data []byte, value uint) []byte {
for {
if int(value) >= len(data) {
newData := make([]byte, len(data)*2+100)
copy(newData, data)
data = newData
}
j := len(data)
for value >= 256 {
value -= 256
data[j-1] = byte(value & 255)
j--
}
if j == 0 {
break
}
data[j-1] = byte... | 01-ai/yi-coder-9b-chat | Go | 01-ai | 4 | 1 |
import React from "react";
import { Form } from "semantic-ui-react";
import SubmitButton from "./SubmitBotton";
const SignUpInputs = ({ signUpChange, handleSubmit, form }) => {
const signInData =[
{type:"text", name:"username",value: form.username },
{type:"email", name:"email", value: form.email },
{type:"pas... | human | JavaScript | human | 0 | 0 |
: 0
-----Explanation-----
You can check the example in the problem statement.
-----Your program-----
Write a code that solves the problem. The code should pass all test cases.
"""
import sys
def can_sort_array(n, a, p):
for i in range(n-1):
for j in p:
if a[i] > a[i+1] and j == i+1:
... | microsoft/phi-3-small-8k-instruct | Python | phi | 2 | 1 |
def largestPrimeFactor(N):
divisor = 2
while divisor * divisor <= N:
if N % divisor:
divisor += 1
else:
N //= divisor # it's important to perform integer division (n // divisor)
return N
print(largestPrimeFactor(256))
| microsoft/phi-3-mini-4k-instruct | Python | phi | 2 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.