text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int n, k; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> k; if (n < 2 * k + 1) { cout << -1 << endl; return 0; } cout << n * k << endl; for (int i = 0; i < n; i++) for (int j = 1; j <= k... |
#include <bits/stdc++.h> using namespace std; const int maxn = 60; int n, l; char s[maxn][maxn], t[maxn]; bool eq(int x, int i, int j) { for (int k = 0; k < l; k++) { if (s[x][i] != t[j]) return false; i = (i + 1) % l; j = (j + 1) % l; } return true; } int dist(int x, int j) ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; bitset<N> b; int p[N]; int cnt[N]; bool was[N]; int main() { int n, k; scanf( %d %d , &n, &k); for (int i = 0; i < n; i++) { scanf( %d , p + i); p[i]--; was[i] = false; } for (int i = 1; i <= n; i++)... |
module memif_d(
input wire clk,
input wire reset,
// Avalon Slave
input wire [1:0] s_address,
input wire s_write,
input wire s_read,
input wire [31:0] s_writedata,
output reg [31:0] s_readdata,
output wire s_waitrequest,
// 64 bit Avalon Master
output wire [31:0] m_address,
output reg m_write,
output reg... |
#include <bits/stdc++.h> using namespace std; long long n, m, q; long long siz[100005]; long long par[100005]; string s; unordered_map<string, long long> idx; vector<pair<long long, long long> > e[100005]; long long ans[100005]; long long dis[100005]; pair<long long, pair<long long, long long> > edg... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; inline long long read(long long num = 0, char c = 0) { while (c > 9 || c < 0 ) c = getchar(); while (c >= 0 && c <= 9 ) num = num * 10 + c - 48, c = getchar(); return num; } struct node { int x, y, val, num; void in() { x = read(), y = read... |
//
// Copyright 2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
#include <bits/stdc++.h> using namespace std; vector<int> edges[500000]; bool vis[500000]; int order[1000000]; int first[500000], second[500000]; int C; void dfs(int i) { vis[i] = 1; first[i] = C; order[C++] = i; for (int j = 0; j < edges[i].size(); j++) if (!vis[edges[i][j]]) dfs(ed... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { int n, m, a, b; cin >> n >> m >> a >> b; int total_ones = n * a; if (total_ones != m * b) { cout << NO ... |
//altpll bandwidth_type="AUTO" CBX_DECLARE_ALL_CONNECTED_PORTS="OFF" clk0_divide_by=25 clk0_duty_cycle=50 clk0_multiply_by=1 clk0_phase_shift="0" compensate_clock="CLK0" device_family="Cyclone IV E" inclk0_input_frequency=20000 intended_device_family="Cyclone IV E" lpm_hint="CBX_MODULE_PREFIX=dac_pll" operation_mode="n... |
#include <bits/stdc++.h> using namespace std; int x[55], y[55]; int main(int argc, char** argv) { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &x[i]); for (int i = 1; i <= n; i++) scanf( %d , &y[i]); int sum = 0; for (int i = 1; i <= n; i++) { sum += x[i] - y[i]; ... |
#include <bits/stdc++.h> using namespace std; float calc(int h, int d, int c, int n) { float a; if (h % n == 0) { a = (h / n) * c; } else a = ((h / n) + 1) * c; return a; } int main() { int p = 0, q = 0; int h, d, c, n, eh; int hh, mm; cin >> hh >> mm; cin >> h >>... |
#include <bits/stdc++.h> using namespace std; bool cmp(int a, int b) { return a > b; } const int maxen = 1e5 + 5, minn = 1e-5; string a[1005]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int res = 0, mn = 13; for (int i = 0; i < n - 1; i++) { for (int j = i... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000 * 1000 * 1000 + 47; const long long LINF = (long long)INF * INF; const int MAX = 2e5; const double EPS = 1e-9; const double PI = acos(-1.); int n; int a[10][10]; int dx[8] = {2, 2, 1, -1, -2, -2, -1, 1}; int dy[8] = {1, -1, -2, -2, -... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 7; int vis1[MAXN], vis2[MAXN], dis[MAXN]; int st, ed, n, ans; queue<int> q; vector<int> G[MAXN]; void Bfs1() { for (; !q.empty();) q.pop(); q.push(1); vis1[1] = 1; for (; !q.empty();) { int u = q.front(); q.po... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01:32:00 07/21/2013
// Design Name: sha256_chunk
// Module Name: C:/Dropbox/xilinx/processor/test/sha_chunk_test.v
// Project Name: processor
// Target Device:
// ... |
#include <bits/stdc++.h> using namespace std; int n, m; char ch[201][201]; int main() { cin >> m >> n; n *= 2; m *= 2; for (int i = 1; i <= n; i += 2) for (int j = 1; j <= m; j += 2) { cin >> ch[i][j]; ch[i + 1][j] = ch[i][j + 1] = ch[i + 1][j + 1] = ch[i][j]; } f... |
module instruction_decoder_testbench();
reg[31:0] instruction_data;
wire[3:0] opcode;
wire input_type_1;
wire[1:0] input_register_selector_1;
wire[7:0] input_immediate_1;
wire input_type_2;
wire[1:0] input_register_selector_2;
wire[7:0] input_immediate_2;
wire[1:0] output_... |
#include <bits/stdc++.h> using namespace std; const int MN = 100005, inf = 1000000005, mod = 1000000007; const long long INF = 1000000000000000005LL; const long double eps = (long double)1e-10; long long det(pair<int, int> x, pair<int, int> y) { return 1LL * x.first * y.second - 1LL * x.second * y.first; ... |
`timescale 1ns/1ps
`define INDEX(x,y) x*y +: y
module tb_register ;
localparam REGISTER_NUM_REGISTERS = 16 ;
localparam REGISTER_NUM_DATA_IN = 2 ;
localparam REGISTER_NUM_DATA_OUT = 4 ;
localparam REGISTER_NUM_SEL_BITS = $clog2(REGISTER_NUM_REGISTERS) ;
localparam REGISTER_WIDTH_DATA = ... |
#include <bits/stdc++.h> using namespace std; const int INF = (int)2e9; const double EPS = 1e-6; const double PI = 3.1415926535; const int MOD = 1000003; int last[100000]; int main() { int a, b, m, now, i = 2; cin >> a >> b >> m >> now; last[now] = 1; while (1) { now = (a * now + b) ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, count = 0, ans; cin >> n; string s; cin >> s; long long r = 0, b = 0; for (long long i = 0; i < n; i++) if (s[i] == r ) r++; else if (s[i] == b ) b++; for (long long i = 0; i < n; i++) ... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; const long long MOD = 1000000007; const int inf = 1 << 30; const long long linf = 1LL << 60; const double PI = 3.14159265358979323846; int n, k; char s[100000]; vector<int> v[2]; int main() { scanf( %d%d , &n, &k); for (i... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; namespace whatever { const long long inf = 1000000000000000001ll; template <typename type> type read() { char ch = getchar(); while (!isdigit(ch)) ch = getchar(); type value = ch - 0 ; ch = getchar(); while (isdigit(ch)) { value = value ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int T = 1; while (T--) { int n, m; cin >> n >> m; map<int, int> mp; vector<pair<int, int> > pp; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; pp.push_back({a, b}); if (a != b) { ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:26:57 02/28/2016
// Design Name: Pc
// Module Name: C:/Users/Ranolazine/Desktop/Lab/lab5/test_Pc.v
// Project Name: lab5
// Target Device:
// Tool ve... |
// (C) 2001-2016 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated docum... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000000; const int INF = 1000000001; vector<int> G[MAXN + 1]; bool vis[MAXN + 1]; vector<int> CC; int n, m, k; int dfs(int v) { vis[v] = true; int ret = 1; for (__typeof((G[v]).begin()) u = (G[v]).begin(); u != (G[v]).end(); ++u)... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright (C) 2017 Harmon Instruments, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This progr... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 60; long long fib[MAXN]; int main() { int n; long long k; cin >> n >> k; fib[0] = 1; fib[1] = 1; for (int i = 2; i <= n; i++) fib[i] = fib[i - 1] + fib[i - 2]; int i = 0; while (i < n) { if (fib[n - i - 1] < k) ... |
#include<bits/stdc++.h> using namespace std; #define int long long int32_t main() { int t; cin >> t; while(t--) { string s; int n; cin >> n; cin >> s; sort(s.begin(),s.end()); cout << s << endl; } return 0; }... |
#include <bits/stdc++.h> using namespace std; long long a; int b = 1; bool check(long long x) { if (x < 0) x = -x; while (x) { if (x % 10 == 8) return 1; x /= 10; } return 0; } int main() { scanf( %lld , &a); while (!check(a + b)) ++b; printf( %d , b); } |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); int even = 0, odd = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] % 2 == 0) { even++; } else { odd++; } } if (even > odd) { cout << odd << ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); vector<long> A; long N, L, R, M, T, Sum, Min = 2147483647; cin >> N; A.resize(N); for (long i = 0; i < N; ++i) cin >> A[i]; for (long M = 1; M <= 100; ++M) { ... |
#include <bits/stdc++.h> using namespace std; const int NMax = 110000; struct edge { int num; edge *next; } * G[NMax], pool[NMax * 2]; int N, M, K, cant[NMax], L, deg[NMax], cnt[NMax], del[NMax], cur[NMax]; void Build(int x, int y) { edge *p = &pool[L++], *q = &pool[L++]; p->num = y; p->... |
#include <bits/stdc++.h> using namespace std; char a[100100]; int main() { scanf( %s , a); int en; int len = strlen(a); int r = 0, l = 0; int ll, rr; int flag = 0; int last; int cnt = 0; for (int i = 0; a[i] != 0 ; i++) if (a[i] == # ) en = i; for (int i = 0; i < l... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int tc; cin >> tc; while (tc-- > 0) { long long int n; cin >> n; if (n % 2 == 0) { long long int a = 2; long long int b = n / 2; cout <<... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e3 + 5; long long n, m, c, cur, loc; long long a[N]; void work() { long long lim = c / 2 + c % 2; if (cur > lim) { for (long long i = n; i >= 1; i--) { if (cur > a[i] || !a[i]) { loc = i; return; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; double safe_sqrt(double x) { return sqrt(max((double)0.0, x)); } long long GI(long long& x) { return scanf( %lld , &x); } const long long MOD = 1e9 + 7; const long long MN = 1000111; long long gt[MN]; vector<long long> h[MN]; int main() { ios::sync_with_... |
#include <bits/stdc++.h> using namespace std; using INT = long long; const int NN = 202020; int a[NN], b[NN]; map<int, int> mp; int main() { int n, y; cin >> n >> y; for (int i = 1; i <= n; i++) cin >> a[i]; int m, yy; cin >> m >> yy; for (int i = 1; i <= m; i++) cin >> b[i]; int... |
module top;
reg pass = 1'b1;
parameter parm = 1;
/***********
* Check generate tasks.
***********/
// Only one is created.
generate
if (parm) begin: name_ti
task name_task;
$display("OK in task from scope name_ti");
endtask
end else begin: name_ti
task name_task;
... |
#include <bits/stdc++.h> using namespace std; struct node { int to; int l, r; node() {} node(int to, int l, int r) : to(to), l(l), r(r) {} }; struct node1 { int l, r; node1() {} node1(int l, int r) : l(l), r(r) {} }; vector<node> G[1010]; vector<node1> Q[1010]; int n, m, ans ... |
//See README and tcl for more info
`include "defines.v"
module roi(input clk,
input [DIN_N-1:0] din, output [DOUT_N-1:0] dout);
parameter DIN_N = `DIN_N;
parameter DOUT_N = `DOUT_N;
genvar i;
generate
//CLK
(* KEEP, DONT_TOUCH *)
reg clk_reg;
always @(posedge c... |
#include <bits/stdc++.h> using namespace std; bool prime[101]; void SieveOfEratosthenes(int n) { memset(prime, true, sizeof(prime)); for (int p = 2; p * p <= n; p++) { if (prime[p] == true) { for (int i = p * p; i <= n; i += p) prime[i] = false; } } } int main() { long long... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Sun Apr 09 07:04:52 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const int N = 100200; struct Node { int to, cost; }; vector<Node> g[N]; int dist[105][N] = {}, arr[N] = {}, n, m, type[N] = {}, k, s, vis[N] = {}; void addedge(int u, int v, int cost) { g[u].push_back((Node){v, cost}); g[v].p... |
#include <bits/stdc++.h> using namespace std; template <typename T> void Read(T &cn) { char c; int sig = 1; while (!isdigit(c = getchar())) if (c == - ) sig = -1; cn = c - 48; while (isdigit(c = getchar())) cn = cn * 10 + c - 48; cn *= sig; } template <typename T> void Write(T... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; int n, m; struct GUGAN { int s, e; int type; int idx, x; bool operator<(const GUGAN &p) const { return e < p.e; } GUGAN() {} GUGAN(int s, int e, int type, int idx, int x) { this->s = s, this->e = e, this-... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
//#############################################################################
//# Function: Achive high latch #
//#############################################################################
//# Author: Andreas Olofsson #
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a >> b; if (a == b) { cout << a; } else { cout << 1; } } |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; long long dp[57 + 7][57 + 7]; long long mdp[57 + 7][57 + 7]; bool vis[57 + 7][57 + 7]; int n, K; long long ncr[57 + 7][57 + 7]; int L, R; long long func(int l, int r, int i, int j, int k, int m) { long long ret = (ncr[... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:14:32 03/19/2015
// Design Name:
// Module Name: fsm
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Rev... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; using ll = long long; using ld = long double; using pi = pair<int, int>; using pl = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vpi = vector<pi>; using si = set<int>; using sl = set<ll>; using qi = qu... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:31:25 05/26/2014
// Design Name:
// Module Name: mccomp
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// ... |
`include "bsg_mem_2r1w_sync_macros.vh"
module bsg_mem_2r1w_sync #( parameter `BSG_INV_PARAM(width_p )
, parameter `BSG_INV_PARAM(els_p )
, parameter read_write_same_addr_p = 0
, parameter addr_width_lp = `BSG_SAFE_CLOG2(els_p)
... |
#include <bits/stdc++.h> using namespace std; int main() { long long int x, y, l, r; cin >> x >> y >> l >> r; vector<long long int> vec(0); long long int xa = 1; long long int cap = 0; long long int r1 = r; while (r1 > 0) { r1 /= x; ++cap; } for (long long int i = 0; ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const double PI = acos(-1.); const int MXN = 200005; const int MOD = 1000000000; int a[MXN], n, m; long long fib[MXN]; long long prefib[MXN]; struct SEG { int l, r; long long lazy; long long g[2]; SEG() {} SEG(i... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; map<string, string> mp; int main() { string a, b; int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a >> b; mp[b] = a; } for (int i = 0; i < m; i++) { cin >> a >> b; b.pop_back(); cout << a << << b ... |
// niosii_nios2_gen2_0.v
// This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 185
`timescale 1 ps / 1 ps
module niosii_nios2_gen2_0 (
input wire clk, // ... |
#include <bits/stdc++.h> using namespace std; int main() { int length; cin >> length; int query; cin >> query; string result; cin >> result; for (int i = 0; i < query; ++i) { int left; int right; cin >> left >> right; char which; char what; cin >> whic... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; cin >> s; int n = s.size(); bool dp[n + 1][8]; memset(dp, false, sizeof(dp)); string ans[8]; for (int i = 1; i < n + 1; i++) { string te... |
#include <bits/stdc++.h> using namespace std; const int inf = 2e9 + 10, MAXN = 1e5 + 10; int seg[4][MAXN * 4]; int n, S, l; void update(int ind) { seg[1][ind] = min(seg[1][((ind)*2)], seg[1][(((ind)*2) + 1)]); seg[2][ind] = max(seg[2][((ind)*2)], seg[2][(((ind)*2) + 1)]); seg[3][ind] = min(seg[3][... |
//Legal Notice: (C)2013 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; const int N = 1e6 + 10; struct UFS { stack<pair<int *, int>> stk; int fa[N], rnk[N]; inline void init(int n) { for (int i = 0; i <= n; ++i) fa[i] = i, rnk[i] = 0; } inline int Find(int x) ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2007 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
v95 v95 ();
v01nc v01nc ();
v01c v... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int ar[n]; int cnt = 0, cnt2 = 0; for (int i = 0; i < n; i++) { cin >> ar[i]; if (ar[i] > 0) cnt += ar[i]; else cnt2 += ar[i]; ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n, i, j, k, l = 0, s, x, y, z = 0, r = 1000000001, rr = 0; cin >> n >> s >> k; long long int a[k]; for (i = 0; i < k; i++) cin >> a[i]; sort(a, a + k); for (i = 0; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2009 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t;
// Speced ignored: system calls. I think this is nasty, so we error instead.
// Speced ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
// vga_0.v
// This file was auto-generated as part of a generation operation.
// If you edit it your changes will probably be lost.
`timescale 1 ps / 1 ps
module vga_0 (
input wire iCLK, // clk.clk
output wire [9:0] VGA_R, // avalon_slave_0_export.export
output wire [9:0] VG... |
#include <bits/stdc++.h> using namespace std; const int N = 1000051; long long n; string c; struct btree { int chnum; int child[2]; int num; int typ; int id; } tre[N]; int dfx[N][2]; int tot = 0; int has[N]; void predfs(int x) { if (tre[x].typ == 0) return; if (tre[x].typ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int mod = (int)1e9 + 7; long long modPow(long long n, long long k) { long long res = 1; for (n %= mod; k; k >>= 1) { if (k & 1) res = res * n % mod; n = n * n % mod; } return res; } long long modInv(const long long x) { return mod... |
#include <bits/stdc++.h> using namespace std; int lcs(string X, string Y) { int i, j, m = X.length(), n = Y.length(); int L[m + 1][n + 1]; for (i = 0; i <= m; i++) { for (j = 0; j <= n; j++) { if (i == 0 || j == 0) L[i][j] = 0; else if (X[i - 1] == Y[j - 1]) L[i... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n; cin >> t; while (t--) { cin >> n; vector<int> numbers(n); vector<int> trayectoria(n + 1); for (int &i : numbers) cin >> i; if (numbers[0] == 1) { cout << n + 1 << ; for (int i = 1; i < n... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; bool compare(string &s1, string &s2) { return s1.size() < s2.size(); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); vector<string> s; string str; int n, i, j, flag = 0; cin >> n; for (i = 0; i < n; i++) { cin >> str; ... |
#include <bits/stdc++.h> template <typename T> T min(T x, T y) { return x < y ? x : y; } template <typename T> T max(T x, T y) { return x > y ? x : y; } template <typename T> T abs(T x) { return x > 0 ? x : -x; } template <typename T> T gcd(T x, T y) { return x ? gcd(y % x, x) : y;... |
#include <bits/stdc++.h> using namespace std; long long A[1000000]; long long ncr(int n, int k) { long long ans = 1; k = k > n - k ? n - k : k; int j = 1; for (; j <= k; j++, n--) { if (n % j == 0) { ans *= n / j; } else if (ans % j == 0) { ans = ans / j * n; } el... |
`default_nettype none
`define CLKFREQ 12000000 // frequency of incoming signal 'clk'
`define BAUD 115200
// Simple baud generator for transmitter
// ser_clk pulses at 115200 Hz
module baudgen(
input wire clk,
output wire ser_clk);
localparam lim = (`CLKFREQ / `BAUD) - 1;
localparam w = $clog2(lim... |
#include <bits/stdc++.h> const int N = 100001, M = 998244353, mod = 1000000007; const long long MX = INT64_MAX, MN = INT64_MIN, oo = 1e18; using namespace std; vector<string> tokenizer(string str, char ch) { std::istringstream var((str)); vector<string> v; string t; while (getline((var), t, (ch)... |
#include <bits/stdc++.h> using namespace std; long long int mod = 1000000007; long long int numOfPoints(long long int &x, long long int &y, long long int &n, long long int t) { long long int region1 = 2 * t * (t + 1) + 1; long long int region2; if (y - t >= 1) region2... |
/////////////////////////////////////////////////////////////////////////////
//
// Silicon Spectrum Corporation - All Rights Reserved
// Copyright (C) 2005
//
// Title : Clock switch module for non programmable PLLs
// File : clk_switch.v
// Author : Jim MacLeod
// Created : 05-Mar-2013... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; inline int read() { char ch = getchar(); int x = 0, f = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while ( 0 <= ch && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x * f;... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.2
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.