text stringlengths 59 71.4k |
|---|
/*
* LatticeMico32
* JTAG Registers
*
* Copyright (C) 2010 Michael Walle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyr... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << ceil(n / 2.0) - 1; } |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:01:56 04/23/2017
// Design Name: decrypt
// Module Name: C:/Users/vkoro/Final_Project/project/des/DES/decrypt_tb.v
// Project Name: DES
// Target Device... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:54:33 05/11/2014
// Design Name:
// Module Name: ID_stage
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depend... |
/* ltcminer_icarus.v copyright kramble 2013
* Based on https://github.com/teknohog/Open-Source-FPGA-Bitcoin-Miner/tree/master/projects/Xilinx_cluster_cgminer
* Hub code for a cluster of miners using async links
* by teknohog
*/
`include "../../source/sha-256-functions.v"
`include "../../source/sha256_transform.v"
... |
//altiobuf_out CBX_AUTO_BLACKBOX="ALL" CBX_SINGLE_OUTPUT_FILE="ON" DEVICE_FAMILY="Cyclone V" ENABLE_BUS_HOLD="FALSE" NUMBER_OF_CHANNELS=1 OPEN_DRAIN_OUTPUT="FALSE" PSEUDO_DIFFERENTIAL_MODE="TRUE" USE_DIFFERENTIAL_MODE="TRUE" USE_OE="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN1="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN2="FALSE" USE_TE... |
#include <bits/stdc++.h> using namespace std; int read_number(int i) { cout << ? << i << n ; fflush(stdout); int number; cin >> number; return number; } bool intersects(int l1, int l2, int r1, int r2) { if (l1 >= l2) swap(l1, l2); if (r1 >= r2) swap(r2, r1); return max(l1, r... |
#include <bits/stdc++.h> using namespace std; int u, v; const int maxn = 5e3 + 10; vector<long long> G[maxn]; bool visited[maxn]; long long dp[maxn]; vector<long long> vc[maxn]; bool mark[maxn]; long long n; vector<long long> ans; void dfs(int x) { visited[x] = 1; for (int i = 0; i != G[x]... |
/*WARNING: INCOMPLETE MODEL, DON'T USE. I RECOMMEND AGAINST USING THIS
*BLOCK ALL TOGETHER. NOT OPEN SOURCE FRIENDLY /AO
*/
module ISERDESE2 (/*AUTOARG*/
// Outputs
O, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, SHIFTOUT1, SHIFTOUT2,
// Inputs
BITSLIP, CE1, CE2, CLK, CLKB, CLKDIV, CLKDIVP, D, DDLY,
DYNCLKDIVSEL, ... |
`timescale 1ns / 1ps
`define RESET 0
`define RESET_WAIT 1
`define INIT_INSTRUCTION 2
`define INIT_WAIT 3
`define DATA_WAIT 4
`define DATA_WRITE 5
`define DATA_WRITE_WAIT 6
module LCD_controler(
input wire clk,
input wire [3:0] iLCD_data,
input wire iLCD_reset,
input wire iLCD... |
#include <bits/stdc++.h> int n, m, k, flag, ans, cnt, p, q, w[1000005], f[1000005], g[1000005], s[1000005]; int main() { scanf( %d%d%d , &n, &m, &k); w[0] = 1; for (int i = 1; i <= n; i++) w[i] = w[i - 1] * 2 % 1000000007; for (int i = 1; i <= m; i++) { int x, y; scanf( %d%d , &x, ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; #pragma GCC optimize( O3 ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { for (ll i = 0; ... |
/****************************************************************
/*
/* Description:
/* change internal parallel data to output
/* serial data
/* Author:
/* Guozhu Xin
/* Date:
/* 2017/7/10
/* Email:
/*
************************************... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b; cin >> b >> a; a--; b -= a; if (b >= 0 && b % 2 == 0 && a > 0) { cout << Yes << endl; } else if (b == 0 && a == 0) cout << Yes << endl; else cout << No << endl; return 0; } |
// -- (c) Copyright 2008 - 2014 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; inline void read(int &x) { int v = 0, f = 1; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) f = -1; else v = (c & 15); while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15); x = v * f;... |
#include <bits/stdc++.h> using namespace std; long long int power(long long int x, long long int y, long long int m) { if (y == 0) return 1; long long int p = power(x, y / 2, m) % m; p = (p * p) % m; return (y % 2 == 0) ? p : (x * p) % m; } long long int nCr(long long int n, long long int r, lon... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_edb_e
//
// Generated
// by: wig
// on: Mon Mar 22 13:27:29 2004
// cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls
//
// !!! Do not edit this file! Autogenerated by MIX !... |
#include <bits/stdc++.h> using namespace std; void marmot0814() { int n; cin >> n; int p1 = 1, p2 = 2, p3 = 3; while (n--) { int v; cin >> v; if (v == p3) { cout << NO n ; return; } else if (v == p1) { swap(p2, p3); } else { swap(p1, p3)... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int a[N]; int main() { int n; long long sum = 0; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); sum += a[i] - 1; if (sum % 2 == 1) printf( 1 n ); else printf( 2 n ); ... |
#include <bits/stdc++.h> using namespace std; void time() { ios_base ::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { time(); int a, s, d, f; cin >> a >> s >> d >> f; if (a == s || s > a) { cout << Second << endl; } else { cout << First << endl; }... |
/**
* 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... |
/**
HaarFilter
==========
Haar filter bank. Output is an array of signed values OUT_WIDTH bits wide,
arranged in little-endian fashion. Word 0 is the low-pass output, word 1 is the
corresponding high-pass output, word 2 is the high pass output from the previous
filter pair, and so on:
```
in --+--> HPF -----------... |
#include <bits/stdc++.h> using namespace std; string solve(string s) { if (s.size() & 1) { return s; } string a = solve(s.substr(0, s.size() / 2)); string b = solve(s.substr(s.size() / 2)); if (a < b) { return a.append(b); } else { return b.append(a); } } int main()... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const int N = 1e6 + 10; string s[101]; string x; long long dp[101]; long long n; int m; int fail[N]; struct matrix { long long v[4][4]; matrix() { for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++... |
#include <bits/stdc++.h> using namespace std; using LL = long long; constexpr int N = 1e5 + 5; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, x, y; cin >> n >> m >> x >> y; x--; y--; string s; cin >> s; vector<vector<int>> mat(n, vector<int>(m, -1)); ... |
#include <bits/stdc++.h> using namespace std; int n, m, k, a[100][100], ans, ma[100]; bool mark[10]; int seen[100000]; void BT(int n) { if (n > ::n) { int ans = 0; for (int i = 1; i <= ::n; i++) { if (a[i][ma[i]] == 0 && ma[i] != 0) return; ans += a[i][ma[i]]; } see... |
#include <bits/stdc++.h> using namespace std; int cmpfunc(const void* a, const void* b) { return (*(int*)a - *(int*)b); } int main() { int A, B, i; long long int sum = 0; int a[100001] = {0}; cin >> A; cin >> B; for (i = 0; i < A; i++) { cin >> a[i]; } qsort(a, A, sizeof(int)... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; vector<int> v[N]; vector<pair<int, int> > ans; int deg[N], maxT; void dfs(int x, int T, int u) { ans.push_back({x, T}); int beginT = T; for (auto it : v[x]) if (it != u) { if (T == maxT) { T = maxT - deg... |
// This file extends the original bug test case to explore all the
// forms of a signed right shift that are treated as special cases.
module test;
reg pass;
reg [8*40:1] str;
integer s;
initial begin
pass = 1'b1;
s = 1;
$sformat(str, "%0d", ((0 >> 1) + 1) * -1);
if (str[8*2:1] !== "-1" || str... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t;
sub #(.WIDTH(4)) sub4();
sub #(.WIDTH(8)) sub8();
logic [3:0] out4;
logic [7:0] out8;
initial beg... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> scores; for (int i = 0; i < n; i++) { int temp; cin >> temp; scores.push_back(temp); } int max = scores[0]; int min = scor... |
#include <bits/stdc++.h> using namespace std; inline int in() { int x, y; y = scanf( %d , &x); return x; } const int MAXN = 2e6 + 10; int n, p[MAXN], sec[MAXN], pt[MAXN]; string s; int nxt[MAXN], prv[MAXN]; int d[MAXN][2]; bool ok(int mid, int sz) { memset(d, 0, sizeof(d)); d[0][0]... |
#include <bits/stdc++.h> using namespace std; long long int b[101]; int main() { long long int n; cin >> n; long long int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; b[a[i]]++; } long long int ans = 0; for (int i = 1; i < 101; i++) { if (b[i] >= ans) { an... |
#include <bits/stdc++.h> using namespace std; int main() { int d[105], n, sum1 = 0, sum2 = 0, begin, end; cin >> n; for (int i = 1; i <= n; i++) cin >> d[i]; cin >> begin >> end; if (begin > end) { int t; t = begin; begin = end; end = t; } for (int i = begin; i < ... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); if (n % 5 == 0) printf( %d , n / 5); else printf( %d , (n / 5) + 1); return 0; } |
#include <bits/stdc++.h> using namespace std; int N, M, neg, nsus; int ar[100002]; int cnt[100002]; int sus[100002]; int main() { scanf( %d%d , &N, &M); for (int i = 1; i <= N; i++) { scanf( %d , &ar[i]); if (ar[i] > 0) cnt[ar[i]]++; else { cnt[-ar[i]]--; ne... |
#include <bits/stdc++.h> #include<stdlib.h> using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define ppb pop_back #define mp make_pair #define vl vector<ll> #define vi vector<int> #define endl n #define all(x) x.begin(), x.end() #define deb(x... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module gerneric_fifo (
clk, reset, write, read,
... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int mod = 1000000007; const int inf = 0x3f3f3f3f; const int maxn = 200005; void task() { int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2; int Rook = 0, Bishop = 0, King = 0; if (r1 == r2 or c1 == c2) Rook... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:16:03 03/03/2016
// Design Name:
// Module Name: data_memory
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dep... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n), b(n), c(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> b[i]; int ans = INT_MAX; sort(a.begin(), a.end()); sort(b.begin(), b.end()); for (int i = ... |
//#############################################################################
//# Function: MIO Configuration Registers #
//# (See README.md for complete documentation) #
//#############################################################################
... |
#include <bits/stdc++.h> using namespace std; string s[1005]; long long a[1005]; long long ans; long long b[1005][5]; long long ma; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; for (long long i = 1; i <= n; i++) { cin >> s[i... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: alt_rom.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ============================... |
// ==================================================================
// >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
// ------------------------------------------------------------------
// Copyright (c) 2013 by Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// ------------... |
/**
* 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... |
/*
reset...init...save.start_write.stop_write.restore.start_read(compare).stop_read.loop
error...
*/
module mem_tester(
clk,
rst_n,
led, // LED flashing or not
// SRAM signals
SRAM_DQ, // sram inout databus
SRAM_ADDR, // sram address bus
SRAM_UB_N,
SRAM_LB_N,
SRAM_WE_N, ... |
`timescale 1 ns / 100 ps
`include "sm_cpu.vh"
module sm_testbench;
// simulation options
parameter Tt = 20;
parameter Ncycle = 120;
reg clk;
reg rst_n;
reg [ 4:0] regAddr;
wire [31:0] regData;
// ***** DUT start ************************
//instruction memor... |
/*
* 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; long long power(long long a, long long b) { if (b == 0) return 1; else if (b % 2 == 0) return (power(a, b / 2) * power(a, b / 2)) % 998244353; else return (a * power(a, b / 2) * power(a, b / 2)) % 998244353; } int main() { long long... |
#include <bits/stdc++.h> using namespace std; int n, m; int a[200013]; int type[200013], len[200013]; int high[200013]; int res[200013]; multiset<int> has; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= m; i++) scanf( %d%d , &type[i]... |
#include <bits/stdc++.h> using namespace std; const int N = 205; char g[N]; map<char, int> h; void work() { int i, j; int s1 = 0, s2 = 0; h[ q ] = 9; h[ r ] = 5; h[ b ] = 3; h[ n ] = 3; h[ p ] = 1; h[ k ] = 0; for (i = 0; i < 8; ++i) { scanf( %s , g); for (j = 0... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:17:07 04/14/2015
// Design Name:
// Module Name: finalcounter
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// De... |
#include <bits/stdc++.h> using namespace std; const int dy[] = {-1, 0, 1, 0}, dx[] = {0, 1, 0, -1}; const double EPS = 1e-8; const double PI = acos(-1.0); int popcount(int n) { return __builtin_popcount(n); } int popcount(long long n) { return __builtin_popcountll(n); } template <class T> int SIZE(T a) ... |
#include <bits/stdc++.h> using namespace std; struct gam { int o; long long k; int nez; long long bd; long long kd; gam() { o = 0; k = 0; nez = 0; bd = 0; kd = 0; } }; bool mycomp(gam i, gam j) { return (i.k < j.k); } int main() { long long n; ... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e9 + 7; const int maxn = 1e5 + 5; int n, m; int a[maxn]; int num[maxn]; int main() { cin >> n; long long sum1 = 0; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); sum1 += a[i]; } num[n] = a[n]; long... |
#include <bits/stdc++.h> using namespace std; int main() { int te; cin >> te; while (te--) { int n, m, x, ji = 0, ou = 0; cin >> n >> m; for (int i = 0; i < n; ++i) { cin >> x; if (x & 1) ji++; else ou++; } if (ji == 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; const int maxn = 1e6 + 10; int sum[maxn], op[maxn]; int main() { int n, l = 0, r = 0, ans = 0, minn = 100; string s; cin >> n >> s; for (int i = 0; i < n; i++) { if (s[i] == ( ) { op[i + 1] = 1; sum[i + 1] = sum[i] + 1; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; int b; cin >> n >> b; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int mini[n]; mini[0] = a[0]; for (int i = 1; i < n; i++) { mini[i] = min(mini[i - 1], a[i]); } int maxi = b; for ... |
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:1024000000,1024000000 ) long long ans; int son[100010][2], fa[100010], cnt[100010], val[100010]; int is[100010]; long long sumVal[100010], sumCnt[100010], sum[100010], all[100010], lazy[100010]; void up(int p) { sumCnt... |
#include <bits/stdc++.h> using namespace std; int n; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; int sl = 0; for (int i = 1; i <= n; ++i) { int x, y; cin >> x >> y; if (x > 0) ++sl; } if (sl == n || sl == 0 || sl == n - 1 || sl == 1) { cout ... |
#include <bits/stdc++.h> using namespace std; int main(void) { long long int n, x; cin >> n; vector<vector<long long int> > a(n); for (long long int i = 0; i < n; i++) { cin >> x; for (long long int j = 0; j < x; j++) { long long int tp; cin >> tp; a[i].push_back(... |
/**
* 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: 16:04:06 03/25/2011
// Design Name:
// Module Name: debounce
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depend... |
/*
* 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... |
/*
* Copyright (c) 2000 Peter monta ()
*
* 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)
* an... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9 + 5; const long long N = 205; void solve(); int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; cout << fixed << setprecision(10); long long _ = 1; while (_--) solve(); return 0; } void... |
/*
* 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... |
// 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 08:38:15 2017
// Host : GILAMONSTER running 64-bit major release (... |
`define ADDER_WIDTH 021
`define DUMMY_WIDTH 128
`define 2_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
#include <bits/stdc++.h> using namespace std; long long Seg[3][1 << 21 + 2], X, Cnt = 1; pair<long long, int> P[1000001]; int l_q, r_q, Len; long long RSQ(int l, int r, int root) { if (l > r_q || l_q > r || l > r) return 0; if (l >= l_q && r <= r_q) return Seg[Len][root]; int mid = (r + l) / 2; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5; struct edg { int u, v, l, r; edg(int u = 0, int v = 0, int l = 0, int r = 0) : u(u), v(v), l(l), r(r) {} bool operator<(const edg &n1) const { return l > n1.l; } }; priority_queue<edg> q; vector<edg> adj[maxn][2]; int n, m... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9; const long long mod = 1e9 + 7; const long long N = 1e5 + 5; const long long Sz = 1e6 + 5; string to_string(const string& s) { return + s + ; } void DBG() { cerr << ] << endl; } template <class H, class... T> void DBG(H h... |
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; set<int> a, b; vector<pair<int, int> > ans(n); for (int i = 0; i < n; ++i) { cin >> ans[i].first >> ans[i].second; --ans[i].first; --ans[i].second; if (ans[i].first == -1) a.insert(i); i... |
#include <bits/stdc++.h> using namespace std; int main() { long long int b1, b2, h1, h2, n, h, i, j, k, a, b; cin >> n >> h >> a >> b >> k; if (a > b) { swap(a, b); } while (k--) { long long int ans = 0; cin >> b1 >> h1 >> b2 >> h2; if (b1 == b2) { ans += abs(h1 -... |
#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 15; const int mod = 998244353; char s[N]; int len; int depth[N]; vector<int> adj[N]; int dp[N][2]; int add(int x, int y) { return ((x + y) % mod + mod) % mod; } int mul(int x, int y) { return (long long)x * y % mod; } int mypow(int ... |
// -- (c) Copyright 2010 - 2013 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... |
// 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 : Wed May 31 20:16:38 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int ntest = 0, test = 0; inline void init(); inline void run(); inline void stop() { ntest = test - 1; } int main() { init(); while (++test <= ntest) { run(); } return 0; } const int INF = (int)1E9 + 5; const double EPS = 1E-11; con... |
#include <bits/stdc++.h> using namespace std; vector<int> P; int m, n; void bs() { int lo = 1, hi = m, ans = 0; int cnt = 0; while (lo <= hi) { int mid = (lo + hi) / 2; cout << mid << endl; int t; cin >> t; if (P[cnt % n] == 0) { if (t == 0) { exit(0);... |
#include <bits/stdc++.h> using namespace std; vector<int> adj[100005], dir[100005], vec; int vis1[100005], vis2[100005], vis3[100005], fl = 0; void dfs1(int u) { vis1[u] = 1; vec.push_back(u); for (int i = (int)0; i <= (int)adj[u].size() - 1; i++) { if (!vis1[adj[u][i]]) dfs1(adj[u][i]); }... |
#include <bits/stdc++.h> using namespace std; int main() { string s; int n; cin >> n >> s; vector<int> vec; for (int i = 0; i < s.length(); ++i) { if (s[i] == B ) { int res = 0; while (i < s.length() && s[i] == B ) { ++res; ++i; } vec.p... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e17; struct edge { int u, v; edge() {} edge(int _u, int _v) : u(_u), v(_v) {} }; struct node { vector<edge> edges; }; struct tree { vector<node> nodes; int root, n; tree(int _n, int _r = 0) : n(_n), root(_r) {... |
#include <bits/stdc++.h> using namespace std; const int N = 60 + 5; char a[N][N]; int l[N][N]; int r[N][N]; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int m, n; cin >> n >> m; for (int i = 1; i <= n; i++) cin >> (a[i] + 1); in... |
/*
* 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; int num1 = 0; string s1, s2; int counter = 0; int ques = 0; int main() { cin >> s1 >> s2; int num2 = 0; for (int i = 0; i < s1.length(); i++) if (s1[i] == + ) num1++; else num1--; for (int i = 0; i < s2.length(); 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... |
/**
* 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 solve(string s, int x, int y) { int t = 0; for (auto i : s) { if (i - 0 == x) { t++; swap(x, y); } } if (x != y && t % 2 == 1) --t; return t; } int main() { cin.tie(0); cout.tie(0); ios_base::sync_wit... |
//Legal Notice: (C)2019 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 main() { long long n; cin >> n; vector<long long> a(n); long long i; for (i = 0; i < n; i++) cin >> a[i]; map<long long, long long> m; long long add = 0; for (i = 0; i < n; i++) { auto it = m.find(a[i]); if (it != m.end())... |
`timescale 1ns / 1ps
`define STATE_IDLE 0
`define STATE_TX 1
`define STATE_RX 2
module spi_cmd(
// controls
input clk,
input reset,
input trigger,
output reg busy,
input [8:0] data_in_count,
input data_out_count,
input [260 * 8 - 1 : 0] data_in, // max l... |
#include <bits/stdc++.h> #pragma GCC diagnostic ignored -Wunused-result #pragma GCC diagnostic ignored -Wunused-function using namespace std; namespace { namespace shik { template <class T> void _R(T &x) { cin >> x; } void _R(int &x) { scanf( %d , &x); } void _R(int64_t &x) { scanf( % SCNd6... |
/**
* 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 power(long long a, long long b) { long long res = 1ll; while (b > 0) { if (b % 2 != 0) res = (res * a) % 1000000007; a = (a * a) % 1000000007; b /= 2; } return res % 1000000007; } long long ncr(long long n, long long k) { ... |
//-----------------------------------------------------------------------------
// Title : GT Common wrapper
// Project : 10GBASE-R
//-----------------------------------------------------------------------------
/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.