text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { int n, k, sumk; cin >> n >> k; k--; int out[500][500]; sumk = 0; int current = n * n; for (int i = 0; i < n; ++i) { for (int j = n - 1; j >= k; --j) { out[i][j] = current; if (j == k) { sumk += cur... |
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int a, b; cin >> a >> b; if (a % b == 0) { cout << 0 << n ; } else { long long int g = a / b; long long int ans = (b * (g + 1) - a); cou... |
/*
* Copyright (c) 2000 Steve Wilson ()
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* a... |
#include <bits/stdc++.h> using namespace std; int num[27]; int num2[27]; inline int idx(char a) { return a - a ; } char sa[5555], sb[5555], sans1[5555], sans2[5555], sans[5555]; inline char rev(int id) { return a + id; } int lena, lenb; bool ans1, ans2; int main() { scanf( %s , sa); scanf( ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k; cin >> n >> k; long long int i, a[n]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); if (a[0] == a[n - 1] && a[0] == 0) { while (k--) cout << 0 << endl; } long long int b[n], ct = 0; for (i... |
#include <bits/stdc++.h> const double EPS = 1e-24; const long long int MOD = 1000000007ll; const long long int MOD1 = 1000000009ll; const long long int MOD2 = 1100000009ll; const double PI = 3.14159265359; int INF = 2147483645; long long int INFINF = 9223372036854775807; template <class T> T Max2(T a,... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(); cout.tie(); int n, q, i; cin >> n; int arr[106] = {}; for (i = 1; i <= n; i++) { cin >> arr[i]; } cin >> q; int x, y; while (q--) { cin >> x >> y; arr... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
modul... |
module top (input CLK,
inout SCL,
inout SDA,
//-- Debug. Logic analizer
output D0,
output D1,
output D13,
//-- Debug: buttons and leds
input SW1,
input SW2,
output LED0
);
localparam AD... |
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long n) { if (a == 0) return 0; if (a == 1 || n == 0) return 1; if (n == 1) return a % 1000000007; long long t = power(a, n / 2); t = t * t % 1000000007; if (n & 1) return t * a % 1000000007; return t; } ... |
`timescale 1 ns / 1 ps
module seven_segment_display
(
input clk,
input [15:0]num_in,
output reg [6:0]dig,
output reg dp,
output reg neg,
output reg clr,
output reg [3:0]dig_sel
);
//dig format
//dig[0] : A, top
//dig[1] : B, top/right
//dig[2] : C, bottom/right
//dig[3] : D, bottom
//dig[4] : E, bottom/... |
#include <bits/stdc++.h> using namespace std; int const N = 200001; int main() { int t; scanf( %d , &t); while (t--) { int n; string s, t; scanf( %d , &n); cin >> s >> t; set<int> msA[200], msB[200]; map<char, int> f; for (int i = 0; i < n; ++i) { msA[... |
#include <bits/stdc++.h> using namespace std; int th[100080], bl[100080]; int main() { int i, j, n, k, mx = 0, sum, fl, fval; scanf( %d %d , &n, &k); for (i = 0; i < n; i++) { scanf( %d , &th[i]); } for (i = 0; i < n; i++) { scanf( %d , &bl[i]); } j = 0; i = 0; sum ... |
#include <bits/stdc++.h> using namespace std; int n, m, q, p[200005], a[200005], pi[200005], mra[200005], t; int mar[200005], su[200005], pr[200005], mm[200005], l, lr, r, Ilmm[200005]; vector<int> v[200005]; bool pa; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> 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... |
/**
* 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; long long a[200001], b[200001], c[200001], d[200001], s, n, cnt[200001]; int bit(int a, int j) { return (a & (1 << j)) >> j; } int checkb() { int mb = 0; for (int i = 1; i <= n; ++i) { for (int j = 0; j <= 29; ++j) { int x = bit(a[i], j), y = b... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); char *str = new char[n + 1]; scanf( %s , str); int size = strlen(str); int sum1 = 0, sum2 = 0; bool f = true; for (int i = 0; i < size / 2; ++i) { if ((str[i] == 4 || str[i] == 7 ) && (str[size - i - 1] ==... |
#include <bits/stdc++.h> using namespace std; long long int power(long long int a, long long int b) { if (b == 0) return 1; if (b == 1) return a; long long int r = power(a, b / 2) % 1000000007; if (b % 2 == 0) return (r * r) % 1000000007; else return (((r * r) % 1000000007) * a) % 10... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:03:27 10/03/2014
// Design Name:
// Module Name: topmodule
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
... |
//======================================================================
//
// coretest_hashes.v
// -----------------
// Top level wrapper that creates the Cryptech coretest system.
// The wrapper contains instances of external interface, coretest
// and the core to be tested. And if more than one core is
// present th... |
// part of NeoGS project (c) 2007-2008 NedoPC
//
// mem512b is 512 bytes synchronous memory, which maps directly to the EAB memory block of ACEX1K.
// rdaddr is read address, dataout is the data read. Data is read with 1-clock latency, i.e. it
// appears after the positive clock edge, which locked rdaddr.
// wrad... |
// (C) 1992-2014 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 simulati... |
#include <bits/stdc++.h> using namespace std; const long long mod1 = 1000000007; const long long mod2 = 998244353; mt19937 rng( (unsigned int)chrono::steady_clock::now().time_since_epoch().count()); long long power(long long a, long long b) { long long result = 1; while (b > 0) { if (b % 2... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e9 + 3; long long n, sum; vector<int> vec; int32_t main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for (int i = n - 100; i <= n; i++) { long long x = i; while (x) { sum += x % 10; ... |
#include <bits/stdc++.h> using namespace std; struct data { int le, ri, cnt; data(int le_ = 0, int ri_ = 0, int cnt_ = 0) { le = le_; ri = ri_; cnt = cnt_; } }; const int N = 1e6 + 10; int seg[4 * N + 10]; int brk[5][4 * N + 10]; int n; void add(int idx, bool b, int L = 0, ... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = -1; for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 0 ; return x * f; } int n, k, a[201010]; long long f[201010][2];... |
/*
* 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 maxint = -1u >> 2; const double eps = 1e-6; const int MAX = 100001; int CA[MAX]; int CB[MAX]; int main() { int N; cin >> N; int ans = N + 1; if (N == 1 || N == 2) { cout << 0 << endl; return 0; } vector<int> A(N); ... |
#include <bits/stdc++.h> using namespace std; int main() { set<int> co[2]; set<pair<int, int> > delta[2]; int w, h, n; scanf( %d%d%d , &w, &h, &n); co[0].insert(0); co[0].insert(w); delta[0].insert(make_pair(w, 0)); co[1].insert(0); co[1].insert(h); delta[1].insert(make_pair(... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); if (n < 6) printf( -1 n ); else { printf( 1 2 n2 3 n2 4 n3 5 n3 6 n ); for (int i = 7; i <= n; i++) printf( 3 %d n , i); } for (int i = 2; i <= n; i++) printf( %d %d n , i - 1, i); return... |
#include <bits/stdc++.h> using namespace std; long long po(long long a, long long b) { long long x = 1, y = a; while (b > 0) { if (b % 2) { x = x * y; x %= 1000000007; } y = y * y; y %= 1000000007; b /= 2; } return x; } int main() { if (0) { ... |
#include <bits/stdc++.h> const int maxn = 1e5 + 5, lim = 62, maxm = 65; const long long inf = 1e18; template <typename T> inline T min(T a, T b) { return a < b ? a : b; } int n; long long a[maxn], mod, dp[maxm][maxn]; inline bool Comp(long long a, long long b) { return a > b; } void radix_sort() {... |
module myAddSub(A,B,CI,ADD,BOP,Y,CO,OVF);
input [7:0] A;
input [7:0] B;
input CI;
input ADD;
input BOP;
output [7:0] Y;
output CO;
output OVF;
//------------------------------------------------------------
// This is an ADDER/SUBTRACTOR based on the adder subtractor
// that is... |
#include<bits/stdc++.h> using namespace std; long long q,n,c[400005],z,ans,mn=1e14,d,x; map<long long,long long>las,ll; vector<long long>v; struct am{ long long va,ind; }; am a[400005]; bool cmp(am zz,am y){ return zz.ind<y.ind; } set<long long>st; int main(){ ios::sync_with_stdio(NULL); c... |
/**
* 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; const int inf = 1.01e9; const double eps = 1e-9; const int N = 1010; char s[N][N]; char res[N * N]; int resc = 0; char ch[4] = { D , L , R , U }; int dx[4] = {1, 0, 0, -1}; int dy[4] = {0, -1, 1, 0}; pair<int, int> q[N * N]; int st = 0, en = 0; ... |
/*
* This test runs the random number generator to make sure
* it follows the standard algorithm. It is based on the bug
* report from PR#995.
*/
module pr995 ();
integer seed;
integer i;
integer result;
initial begin
seed = 1;
$display ("Start sequence: seed=%h", seed);
result=$ran... |
#include <bits/stdc++.h> using namespace std; int t; int n; int a[5001]; bool coutNO; vector<int> check[5001]; int main() { cin.tie(0); cout.tie(0); cin >> t; for (int ct = 1; ct <= t; ct++) { cin >> n; coutNO = true; for (int i = 1; i <= n; i++) check[i].clear(); f... |
/**
* 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; long long a[100005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, i; cin >> n; long long mx = -1, mn = 1e18; for (i = 0; i < n; i++) { cin >> a[i]; mn = min(mn, a[i]); mx = max(mx, a[i])... |
////////////////////////////////////////////////////////////////////////////////
// infrared_control: sub-modulo de genius_top que recebe e interpreta sinal IR.
//
// O sinal de IR recebido (ativacao baixa, mas invertido nos inputs) segue um
// padrao de ondas que se repete durante seu pressionamento, em uma estrutura ... |
#include <bits/stdc++.h> using namespace std; void Oli() { int a; cin >> a; vector<pair<int, int>> pr(a); for (int i = 0; i < a; i++) { cin >> pr[i].first >> pr[i].second; } int s = 0; int k = 1; for (int i = 0; i < pr.size(); i++) { if (pr[i].second >= 1) { k--; ... |
/*
Copyright (c) 2019 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute,... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, const U &b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, const U &b) { if (a < b) a = b; } template <class T> inline void gn(T &first) { char c, sg = 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 law... |
// file: Clock_gen.v
//
// (c) Copyright 2008 - 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
// laws.
//
// DISCLAIMER
// This disclaimer is not a ... |
#include <bits/stdc++.h> using namespace std; template <typename T> T gcd(T a, T b) { while (b > 0) { a %= b; swap(a, b); } return a; } template <class _T> inline _T sqr(const _T& first) { return first * first; } template <class _T> inline string tostr(const _T& a) { os... |
#include <bits/stdc++.h> using namespace std; pair<long long, long long> A[300005]; long long B[300005]; int main() { long long n; scanf( %lld , &n); for (long long i = 1; i <= n; ++i) { scanf( %lld , &A[i].first); A[i].second = i; } sort(A + 1, A + n + 1); long long val = 1;... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; for (int i = 0; i < t; i++) { int x; cin >> x; int ans = (x % 10 - 1) * 10; ans += 1; if (x / 10 > 0) ans += 2; if (x / 100 >... |
/*
* 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... |
//`#start header` -- edit after this line, do not edit this line
// ========================================
//
// Proper 8+2-bit DitherPWM, derived from PWM component v3.30
// Werner Johansson,
//
// ========================================
`include "cypress.v"
//`#end` -- edit above this line, do not edit this line... |
/**
* 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; long long INF; int n; long long v[100005]; int c[100005]; long long mx[100005]; pair<long long, int> st[2]; int q; long long a, b; void solve(long long a, long long b) { long long ans = 0; st[0].first = 0; st[0].second = -2; st[1].first =... |
#include <bits/stdc++.h> using namespace std; const int M = 333333; const int INF = 2000000000; int n, m, k, a[M]; inline int read() { char c = getchar(); int ans = 0; while (c < 0 || c > 9 ) c = getchar(); while (c >= 0 && c <= 9 ) ans = (ans << 1) + (ans << 3) + (c ^ 48), c = get... |
#include <bits/stdc++.h> using namespace std; template <typename T> T sqr(T x) { return x * x; } template <typename T> T abs(T x) { return x < 0 ? -x : x; } template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <typename T> bool chmin(T& x, const T& y) { ... |
`define bsg_mux_one_hot_gen_macro(words,bits) \
if (harden_p && els_p == words && width_p == bits) \
begin: macro \
bsg_rp_tsmc_40_mux_w``words``_b``bits w``words``_b``bits \
(.* ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// Author: Yu-Sheng Lin
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
int cyc;
reg rstn;
parameter real fst_gparam_real = 1.23;
loc... |
#include <bits/stdc++.h> using namespace std; int bit(int mask, int n) { return mask & (1 << n) ? 1 : 0; } int rev(int a) { int res = 0; for (int i = 0; i < 8; ++i) res = res | ((1 << (7 - i)) * bit(a, i)); return res; } int main() { string s; int prev = 0; getline(cin, s); for (in... |
#include <bits/stdc++.h> using namespace std; string run(vector<string> &vec) { vector<bool> used(vec.size(), false); vector<char> ans(100, 1 ); for (int i = 0; i < vec[0].size(); ++i) { ans[50 + i] = vec[0][i]; } used[0] = true; while (true) { int count = 0; for (int i = ... |
#include <bits/stdc++.h> int main() { double k, b, n, t; double bacteria = 1; double time = 0; scanf( %lf %lf %lf %lf , &k, &b, &n, &t); while (bacteria <= t) { bacteria = (k * bacteria + b); if (bacteria > t) { break; } else if (bacteria == t) { time++; b... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 06/16/2017 03:08:23 PM
// Design Name:
// Module Name: seg7x16
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Re... |
module test;
reg clk = 0;
reg reset = 1;
initial begin
reset = 1;
#250 reset = 0;
end
always #100 clk = ~clk;
reg io_in_bits_centeroidsFinished ;
reg io_in_bits_pointsFinished ;
wire [15:0] io_in_bits_centeroidIndex;
wire [63:0] io_in_bits_point_x;
wire [63:0] io_in_bits_point_y;
wire... |
/*
* 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 N = 1e5 + 10, M = 1e6 + 5; long long T, l[N], dp[N], fen[M][2]; vector<int> adj[N]; int n, x[N], t[N]; void add(int p, int x) { for (long long y = 1LL * x * p; p < M; p += p & -p) fen[p][0] += x, fen[p][1] += y; } long long get(int p, int... |
/**
* 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... |
module erx_remap (/*AUTOARG*/
// Outputs
emesh_access_out, emesh_packet_out,
// Inputs
clk, reset, emesh_access_in, emesh_packet_in, remap_mode,
remap_sel, remap_pattern, remap_base
);
parameter AW = 32;
parameter DW = 32;
parameter PW = 104;
parameter ID = 12'h808;
//Clock/reset
... |
#include <bits/stdc++.h> using namespace std; bool dp[10005][3]; int main() { int n, i; string s; set<string> ans; cin >> s; n = s.length(); for (i = n - 1; i >= 5; i--) { if (i + 2 <= n) { if (i + 2 == n || dp[i + 2][1] || (dp[i + 2][0] && s.substr(i + 2, 2) != s... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, i, ans, p, MD = 1000000007; cin >> a >> b; p = ((a * (a + 1)) / 2) % MD; p = p * b % MD; p = (a + p) % MD; ans = ((b * (b - 1) / 2)) % MD; ans = (ans * p) % MD; cout << ans << endl; return 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... |
#include <bits/stdc++.h> using namespace std; void Solve() { string s; cin >> s; int n = s.size(); int cnt1 = 0, cnt2 = 0; for (int i = 0; i < n - 1; i++) { string t = s.substr(i, 2); if (t == ab ) { cnt1++; } else if (t == ba ) { cnt2++; } } if ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:02:02 05/08/2014
// Design Name:
// Module Name: data_path
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
... |
#include <bits/stdc++.h> using namespace std; const int N = 710, size = 1 << 20, mod = (int)1e9 + 7, inf = 2e9; const long long INF = 1e15; template <class o> void qr(o& x) { char c = getchar(); x = 0; int f = 1; while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } ... |
#include <bits/stdc++.h> using namespace std; int main() { int q; long long N, M, K; cin >> N >> K >> M; vector<long long> A(N); long long s = 0; for (int i = 0; i < N; i++) { cin >> A[i]; s += A[i]; } sort(A.begin(), A.end()); long double res = (long double)(s + min(... |
`default_nettype none
// ============================================================================
module receiver #
(
parameter WIDTH = 8,
parameter MODE = "SDR"
)
(
input wire CLK,
input wire RST,
input wire I_CLK,
input wire I_DAT,
output wire O_STB,
output wire [WIDTH-1:0] O_DAT,
input wire... |
#include <bits/stdc++.h> using namespace std; int main() { string n; cin >> n; string m; cin >> m; sort(m.begin(), m.end()); int cn = 0; int cm = 0; int res = 0; for (int i = 0; i < m.length(); i += cm) { cm = count(m.begin(), m.end(), m[i]); cn = count(n.begin(), n.e... |
#include <bits/stdc++.h> using namespace std; int main() { int n, b; cin >> n; for (int i = 0; i < n; i++) { cin >> b; int a[b + 1]; for (int j = 0; j < b; j++) cin >> a[j]; sort(a, a + b); int mn = 999999; for (int j = 1; j < b; j++) { mn = min(a[j] - a[j - 1... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, s, c[10000]; cin >> n >> a >> b; for (int i = 1; i <= n; i++) { cin >> c[i]; } s = 0; for (int i = 1; i <= n / 2; i++) { if (c[i] != 2 && c[n - i + 1] != 2 && c[i] != c[n - i + 1]) { cout << -1 << end... |
#include <bits/stdc++.h> using namespace std; const int maxN = (int)1e5 + 100; const int MAX = (int)1e5 + 1; int l[maxN], d[maxN], cnt[maxN], q[maxN]; vector<int> pool[maxN]; multiset<int> p; void solveTask() { int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> l[i]; for (int i = 1; i <=... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
module circl_b(
input wire [6:0] in_addr,
output reg [6:0] out_word
);
always @*
case( in_addr )
7'h01: out_word = 7'h0A;
7'h02: out_word = 7'h12;
7'h03: out_word = 7'h18;
7'h04: out_word = 7'h1C;
7'h05: out_word = 7'h20;
7'h06: out_word = 7'h23;
7'h07: out_word = 7... |
#include <bits/stdc++.h> using namespace std; long long n; signed main() { long long ans; cin >> n; n++; if (n == 1) ans = 0; else if (n % 2 == 0) ans = n / 2; else ans = n; cout << ans << endl; } |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f2f1f0f; const long long LINF = 1ll * INF * INF; const int MAX_N = 2e5 + 100; int N; long long C; int Nr[MAX_N * 2]; long long SumNr[MAX_N * 2]; long long Ans[MAX_N]; long long SumAns[MAX_N]; long long getSum(long long val[], int a, ... |
#include <bits/stdc++.h> using namespace std; char tr[100005]; map<char, int> p; char num[12] = { AHIMOTUVWXY }; char num1[27] = { ABCDEFGHIJKLMNOPQRSTUVWXYZ }; void init() { int i; for (i = 0; i < 26; i++) { p[num1[i]] = 0; } for (i = 0; i < 11; i++) { p[num[i]] = 1; } } ... |
/* Verilog for cell 'PPGen_wordslice{sch}' from library 'wordlib8' */
/* Created on Mon Nov 04, 2013 20:40:31 */
/* Last revised on Wed Nov 06, 2013 18:23:07 */
/* Written on Wed Nov 06, 2013 18:23:30 by Electric VLSI Design System, version 8.06 */
module muddlib07__and2_1x(a, b, y);
input a;
input b;
output y;
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100 + 10; const int maxe = maxn * 2; int fir[maxn]; struct Edge { int v, c, nxt; Edge(int v = 0, int c = 0, int nxt = 0) : v(v), c(c), nxt(nxt) {} } edge[maxe]; int cnt; bool cir[maxn]; void init() { memset(fir, -1, sizeof(fir)... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01/24/2016 02:54:35 PM
// Design Name:
// Module Name: Problem1
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// R... |
module pr_region_default_mm_bridge_1 #(
parameter DATA_WIDTH = 512,
parameter SYMBOL_WIDTH = 8,
parameter HDL_ADDR_WIDTH = 32,
parameter BURSTCOUNT_WIDTH = 5,
parameter PIPELINE_COMMAND = 1,
parameter PIPELINE_RESPONSE = 1
) (
input wire clk, // clk... |
#include <bits/stdc++.h> using namespace std; long long pred[300005]; long long suffc[300005]; long long ans[300005]; int main() { int n, m; scanf( %d %d , &n, &m); pair<int, int> ara[n]; vector<pair<int, int> > vt(n); for (int i = 0; i < n; i++) { scanf( %d %d , &ara[i].first, &ara[... |
// ICEDEV=hx8k-ct256 bash ../icecube.sh sb_ram40.v
// ../../icebox/icebox_vlog.py -P sb_ram40.psb sb_ram40.txt
// ../../icebox/icebox_explain.py -t '7 21' sb_ram40.txt
module top (
input [10:0] WADDR,
input [10:0] RADDR,
input [15:0] MASK,
input [15:0] WDATA,
output [15:0] RDATA_0,
output [ 7:0] RDATA_1,
ou... |
// (C) 2001-2011 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 doc... |
/**
* 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... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-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... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double eps = 1e-9; int n, m, l, r; int main() { int T, cas = 1, x = INF; scanf( %d%d , &n, &m); for (int i = 1; i <= m; ++i) { scanf( %d%d , &l, &r); x = min(x, r - l + 1); } printf( %d n , x); ... |
/*
Copyright (C) 2013 Adapteva, Inc.
Contributed by Andreas Olofsson <>
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 vers... |
#include <bits/stdc++.h> using namespace std; int s[200005]; struct pp { int lev; int loc; } s1[200005], s2[200005]; bool cmp(pp &a, pp &b) { return a.lev < b.lev; } int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int s1h = 0, s2h = 0; string test; int n; ... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <typename T> inline T range(T l, T r) { return uniform_int_distribution<T>(l, r)(rng); } inline void setin(string s) { freopen(s.c_str(), r , stdin); } inline void setout(string... |
module k_nns_seq
#
(
parameter W = 15,
parameter K = 4
)
(
clk,
rst,
g_input,
e_input,
o
);
function integer log2;
input [31:0] value;
reg [31:0] temp;
begin
temp = value;
for (log2=0; temp>0; log2=log2+1)
temp = temp>>1;
end
endfunction
localparam LOGW = log2(W);
input clk;
input rst;
inpu... |
//Legal Notice: (C)2016 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; int n, cnt_t = 0; vector<pair<int, int>> ls_[2]; vector<int> upb, downb; bool cmp(pair<int, int> a, pair<int, int> b) { if (a.first != b.first) { return a.first < b.first; } return a.second < b.second; } long long proc(vector<pair<int, int>> ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.