text stringlengths 59 71.4k |
|---|
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
/*
* 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 <cstdio> #include <cstring> #include <queue> #include <cmath> #include <set> #include <cstdlib> #include <iostream> #include <map> #include <algorithm> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef unsigned int uii; typedef pair<int, ll> pii; tem... |
#include <bits/stdc++.h> using namespace std; vector<int> g[100010]; long long int weight[100010], add[100010], sub[100010]; int n; void dfs(int mom, int u) { for (vector<int>::iterator v = g[u].begin(); v != g[u].end(); v++) if (*v != mom) { dfs(u, *v); add[u] = max(add[*v], add[u])... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) template <class T> bool scanff(T &ret) { char c; int sgn; T bit = 0.1; if (c = getchar(), c == EOF) return 0; while (c != - && c != . && (c < 0 || c > 9 )) c = getchar(); sgn = (c == - ) ? -1 : 1; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); unsigned long long t; cin >> t; while (t--) { unsigned long long x1, x2, y1, y2; cin >> x1 >> y1 >> x2 >> y2; if (x1 == x2 || y1 == y2) { cout << 1 ... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_no_transition (clock, reset, enable, test_expr, start_state, next_state, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width ... |
module __TFF_P_ALWAYS_ (C, Q);
input C;
output wire Q;
wire notout;
$_NOT_ notgate (
.A(Q),
.Y(notout),
);
$_DFF_P_ dff (
.C(C),
.D(notout),
.Q(Q),
);
endmodule
module __TFF_N_ALWAYS_ (C, Q);
input C;
output wire Q;
wire notout;
$_NOT_ notgate (
.A(Q),
.Y(notout),
);
$_DFF_N_ dff (
... |
#include <bits/stdc++.h> using namespace std; char dif(char c1) { if (c1 == a ) return b ; return a ; } char dif2(char c1, char c2) { if (c1 != a && c2 != a ) return a ; if (c1 != b && c2 != b ) return b ; return c ; } int main() { int n, t; cin >> n >> t; string ... |
/**
* 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... |
//Alan Achtenberg
//Project 2
//Processor Control Unit
`define OPCODE_ADD 6'b000000
`define OPCODE_SUB 6'b000000
`define OPCODE_ADDU 6'b000000
`define OPCODE_SUBU 6'b000000
`define OPCODE_AND 6'b000000
`define OPCODE_OR 6'b000000
`define OPCODE_SLL 6'b000000
`define OPCODE_SRA 6'b000000
... |
/**
* 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 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Mon Feb 20 13:52:57 2017
// Host : GILAMONSTER running 64-bit major release (... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/24 14:50:26
// Design Name:
// Module Name: _8_to_3_priority_encoder
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
//... |
//
// N-dimensional wormhole dimension ordered decoder
//
// given input coordinates for the target of a message, and for the current node
// it will output a one hot vector which is which direction that header should be routed
//
//
`include "bsg_defines.v"
module bsg_wormhole_router_decoder_dor
#(parameter dims_p=2... |
#include <bits/stdc++.h> using namespace std; inline long long max3(long long a, long long b, long long c) { return (a) > (b) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c)); } inline long long min3(long long a, long long b, long long c) { return (a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b... |
/*
Distributed under the MIT license.
Copyright (c) 2015 Dave McCoy ()
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, mo... |
module spdif_tx(
input wire clk, // 24.576Mhz
input wire rst,
input wire [1:0] ack_i,
input [47:0] data_i,
output wire [1:0] pop_o,
input wire [191:0] udata_i,
input wire [191:0] cdata_i,
output wire spdif_o
);
reg halfbit_ff;
always @(posedge clk) begin
if (rst)
halfbit_ff ... |
/**
* 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; cin >> t; while (t--) { int n, ans = 0, sum = 0, sum2 = 0; cin >> n; int a[n + 1]; a[0] = 0; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a, a + (n + 1)); for (int i = 1; i <= n; i++) { ... |
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
(* \VV/ **************************************************************)
(* // * Th... |
//Dummy tb for sound channel 4.
//Tb is only for debug this module.
`timescale 1ns / 1ps
`include "aDefinitions.v"
`include "collaterals.v"
`include "SoundControllerChannel4.v"
`include "SoundControllerOSC1.v"
`include "SoundControllerOSC2.v"
module tb;
reg clk;
wire clk64;
wire clk256;
wire clk131k;
w... |
/**
* 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> const int dx[] = {0, -1, 0, 1, -1, 1, 1, -1, -2, -2, 2, 2, -1, -1, 1, 1}; const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1, -1, 1, -1, 1, -2, 2, -2, 2}; using namespace std; int main(int argc, char const *argv[]) { int n, m; scanf( %d %d , &n, &m); while (n) { printf( 0 ); ... |
#include <bits/stdc++.h> using namespace std; long long Length, X, Y; long long Dp[10000001]; int main(void) { register long long i; cin >> Length >> X >> Y; Dp[1] = X; for (i = 2; i <= Length; i++) { Dp[i] = Dp[i - 1] + X; if (i & 1) { Dp[i] = min(Dp[i], Dp[(i >> 1) + 1] + X... |
#include <bits/stdc++.h> using namespace std; int a[2]; string ans[2] = { Vladik , Valera }; int main() { cin >> a[0] >> a[1]; int turn = 0; int sub = 1; while (true) { if (a[turn] - sub >= 0) { a[turn] -= sub; } else { break; } sub++; turn = 1 - tu... |
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9; const int mod = (int)1e9 + 7; const double pi = acos(-1.0); const double eps = 1e-9; const int maxn = (int)2e6 + 11; long long n; long long a[maxn]; long long sum[maxn]; int main() { cin >> n; a[1] = 2; sum[1] = 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 la... |
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; int a1[n], a2[n]; for (int i = 0; i < n; i++) a1[i] = s[i] - 0 ; for (int i = n; i < 2 * n; i++) a2[i - n] = s[i] - 0 ; for (int i = 0; i < n; i++) { int s1(i), s2(i); for (int j = i ... |
#include <bits/stdc++.h> using namespace std; string mt[1226], sc[1226], s[51], q1, q2; int n, k1, k2, c; map<string, int> O, Z, P; pair<pair<pair<int, int>, int>, string> p[51]; vector<string> v; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> s[i]; } for (int i = 1; i ... |
#include <bits/stdc++.h> using namespace std; bool comp(pair<long long, long long> a, pair<long long, long long> b) { if (a.first > a.second && a.first > b.first) return 1; return 0; } void solve() { long long n; cin >> n; vector<pair<double, pair<long long, long long>>> v(n); for (long ... |
/*
* .--------------. .----------------. .------------.
* | .------------. | .--------------. | .----------. |
* | | ____ ____ | | | ____ ____ | | | ______ | |
* | ||_ || _|| | ||_ \ / _||... |
module SortX16 # (
parameter DSIZE = 18,
parameter OFFSET = 8
)(
input [DSIZE-1:0] a0,
input [DSIZE-1:0] a1,
input [DSIZE-1:0] a2,
input [DSIZE-1:0] a3,
input [DSIZE-1:0] a4,
input [DSIZE-1:0] a5,
input [DSIZE-1:0] a6,
input [DSIZE-1:0] a7... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014
// Date : Mon May 26 11:12:25 2014
// Host : macbook running 64-bit Arch Linux
// ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000 * 1000 * 1000 + 7; const int INF = 2000 * 1000 * 1000; const double EPS = 1e-9; const double pi = acos(-1.0); const int maxn = 100010; inline long long sqr(int n) { return n * 1ll * n; } struct Point { int x, y; Point() {} in... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int maxn = 1 << 23; char s[55][55]; int p[55], r[55], d[55], h[55], ans = 0; int f[maxn], g[maxn], bit[maxn]; int ff(int x) { if (p[x] != x) p[x] = ff(p[x]); return p[x]; } void funion(int x, int y) { x = ff(x); ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; const int M = 1000000007; int t; int n, k; string s; int dp[1001][1002][2]; int get(int it, int d, bool complete, bool zero) { if (it == 0) return complete; if (zero && dp[it][d][complete] != -1) return dp[i... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; scanf( %d%d%d , &a, &b, &c); int ok = 0; if (a == 1 || b == 1 || c == 1) ok = 1; if (a == 3 && b == 3 && c == 3) ok = 1; if (a == 2 && b == 2) ok = 1; if (b == 2 && c == 2) ok = 1; if (a == 2 && c == 2) ok = 1; ... |
#include <bits/stdc++.h> using namespace std; long long a[10], nd[10], dad[10], root, ans; int nopd(long long n) { long long now = 2, ans = 0; for (; now * now <= n; now++) while (n && n % now == 0) { n /= now; ans++; } if (n > 1) ans++; return ans; } bool prime(lon... |
#include <bits/stdc++.h> using namespace std; long long n, a[1000003]; pair<long long, long long> b[1000003]; long long calc1() { for (int i = 0; i < n; i++) b[i] = make_pair(-a[i], i); sort(b, b + n); set<signed> s1; s1.insert(-1); s1.insert(n); long long ret = 0; for (int i = 0; i ... |
#include <bits/stdc++.h> using namespace std; int a[100], b[45], c[100]; int main() { int x; cin >> x; int p = 0, ans = 0, q = 0, f = 0; while (x) { c[p++] = x % 2; if (x % 2 == 0) f = 1; x = x / 2; } int pp = 0; for (int h = p - 1; h >= 0; h--) { a[pp++] = c[h]... |
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int n; cin >> n; long long int a[n], b[n], c[n - 1]; b[n - 1] = 0, c[n - 2] = 0; for (int i = 0; i < n; i++) { cin >> a[i]; ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2012.2
// Copyright (C) 2012 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
mod... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_shiftreg.v ////
//// ////
//// This file is part of the Ether... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; long long ar[maxn]; int main() { long long n, m; cin >> n >> m; long long a, b, c; cin >> a >> b >> c; ar[a] = 1, ar[b] = 2, ar[c] = 3; for (int i = 1; i < m; ++i) { cin >> a >> b >> c; if (!ar[a] and !ar... |
#include <bits/stdc++.h> using namespace std; long long pos[11], neg[11], n, x, zero; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> x; if (x == 0) zero++; if (x > 0) pos[x]++; if (x < 0) neg[abs(x)]++; } long long cnt = 0; cnt += zero * (zero - 1) / 2; ... |
module Datapath(input clock,
input clear);
// PC register
wire[31:0] pc_in;
wire[31:0] pc_out;
PcRegister pc_register(
clock,
clear,
pc_in,
pc_out);
// Instruction memory
wire[31:0] instruction_memory_address;
wire[31:0] instruction_memory_instr;
InstructionMemory instruction_memory(
clock,
... |
/**
* 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; template <class T> int chkmax(T &a, T b) { if (b > a) { a = b; return 1; } return 0; } template <class T> int chkmin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; } template <class iterator> void out... |
/*
* Copyright (c) 2001 Stephen Williams ()
*
* 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)
* ... |
#include <bits/stdc++.h> using namespace std; bool vis[500009]; int siz[500009]; int rr[1005][1005]; char arr[1005][1005]; vector<int> d; int n; void dfs(int x, int y, int cn) { if (x > n or y > n or x < 1 or y < 1 or rr[x][y] != 0) return; rr[x][y] = cn; siz[cn]++; if (arr[x + 1][y] == ... |
/**
* 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... |
//////////////////////////////////////////////////////////////////////
//// ////
//// ROM ////
//// ////
//// Author(s): ... |
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t; cin >> t; vector<long long> v; long long h = 1, m; while (h <= 25820) { m = ((3 * h + 1) * h) / 2; v.push_back(m); h++; } for (l... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_b_e
//
// Generated
// by: wig
// on: Mon Apr 10 13:26:55 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bitsplice.xls
//
// !!! Do not edit this file! Autogenerated by MIX !... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int par[N], ran[N]; struct DSU { DSU() { for (int i = 1; i < N; ++i) par[i] = i, ran[i] = 1; } int find(int x) { return par[x] == x ? x : par[x] = find(par[x]); } bool unite(int a, int b) { a = find(a), b = find(b);... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1LL << 60; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int lcm(int a, int b) { return a * b / gcd(a, b); } const int N = 2e5 + 5; int v[N], in[N]; vector<int> e[N]; bool cmp(int a, int b) { return in[a] < in[b]; } voi... |
#include <bits/stdc++.h> using namespace std; int a[4010][4010]; int n, m; int u[4010], v[4010], sz[4010]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= m; i++) { scanf( %d%d , &u[i], &v[i]); a[u[i]][v[i]] = a[v[i]][u[i]] = 1; sz[u[i]]++; sz[v[i]]++; } int an... |
#include <bits/stdc++.h> using namespace std; vector<int> a[1111]; queue<int> p; int ji[1111], f = 1, b[1111], c[1111]; void dfs(int p) { ji[p]++; for (int i = 0; i < a[p].size(); i++) { if (ji[a[p][i]] >= 3) { f = 0; return; } dfs(a[p][i]); } } int main() { ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2013(c) Analog Devices, Inc.
// Author: Lars-Peter Clausen <>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, ... |
/**
* 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<cstdio> #include<vector> #include<map> #include<set> #include<algorithm> #include<cstdlib> #include<cstring> #include<cmath> #include<string> #include<deque> #include<queue> using namespace std; #define db double #define ll long long int T; struct node{ ll x,y; }p[10]; i... |
// (C) 2001-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 doc... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 405; char G[405][405], P[405][405]; bitset<MAXN> nolet[405][27]; int main() { int N, M; scanf( %d%d , &N, &M); for (int i = 0; i < N; ++i) { scanf( %s , G[i]); for (int c = 0; c < 26; ++c) for (int j = 0; j < M; ++j... |
#include <bits/stdc++.h> using namespace std; template <int M> struct static_mint { static_assert(0 < M, Module must be positive ); int val; static_mint() : val() {} static_mint(long long x) : val(x % M) { if (val < 0) val += M; } static_mint pow(long long n) const { static_mi... |
#include <bits/stdc++.h> using namespace std; inline void output(long long int x) { if (x % 2) cout << x / 2 << n ; else cout << x / 2 - 1 << n ; return; } long long int N, K; int main() { cin >> N >> K; if (N >= K) output(K); else { if ((N << 1) - 1 < K) ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2008 by Wilson Snyder.
module t;
wire d1 = 1'b1;
wire d2 = 1'b1;
wire d3 = 1'b1;
wire o1,o2,o3;
add1 add1 (d1,o1);
add2 add2 (d2,o2);
`define ls left_side
`define r... |
module test_bench(clk, rst);
input clk;
input rst;
wire [63:0] wire_39069600;
wire wire_39069600_stb;
wire wire_39069600_ack;
wire [63:0] wire_39795024;
wire wire_39795024_stb;
wire wire_39795024_ack;
wire [63:0] wire_39795168;
wire wire_39795168_stb;
wire wire_39795168_ack;
... |
//////////////////////////////////////////////////////////////////////////////////
// AXI4MasterInterface for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Kibin Park <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD.
//
// Cosmos OpenSSD is free softwar... |
/**
* 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() { long long h, w; cin >> h >> w; long long pow2max = 1; while (2 * pow2max <= h && 2 * pow2max <= w) pow2max *= 2; long long hmax = min(h, (long long)(1.25 * pow2max)); long long wmax = min(w, (long long)(1.25 * pow2max)); if (hm... |
// Copyright (c) 2015 Kareem Matariyeh
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; using Real = long double; Real g_err = 1e-9; bool r_eq(Real x, Real y, Real err = g_err) { return abs(x - y) <= err || abs(x - y) <= abs(x) * err; } bool r_le(Real x, Real y, Real err = g_err) { return x - y <= err || x - y <= abs(x) * err; } bool r_... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, k, ans = 1, p, temp; cin >> n >> k; if (n == k) { cout << 1; return 0; } if (k == 1) { cout << n; return 0; } long long s, e, m; s ... |
`timescale 1 ns / 1 ps
`include "Four_Digit_Seven_Segment_Display_v2_0_tb_include.vh"
// lite_response Type Defines
`define RESPONSE_OKAY 2'b00
`define RESPONSE_EXOKAY 2'b01
`define RESP_BUS_WIDTH 2
`define BURST_TYPE_INCR 2'b01
`define BURST_TYPE_WRAP 2'b10
// AMBA AXI4 Lite Range Constants
`define S00_AXI_MAX_B... |
#include <bits/stdc++.h> using namespace std; int f(int y) { return y % 400 == 0 ? 2 : y % 100 == 0 ? 1 : y % 4 == 0 ? 2 : 1; } int main() { int n, r = 0, t; scanf( %d , &n); t = f(n); while (r % 7 != 0 || r == 0 || t != f(n)) { r += f(n); n++; } printf( %d n , n); re... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Iztok Jeras.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
parameter SIZE = 8;
integer cnt = 0;
logic [SIZE-1:0] vld_for;
logic vld_... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; void compute() { long long n; cin >> n; n -= 2; string s[n]; cin >> s[0]; string ans = s[0]; for (long long i = 1; i < n; i++) { cin >> s[i]; if (s[i][0] == ans[ans.size() - 1]) ans.push_ba... |
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time base for each unit, ranging from seconds
* to femtoseconds, and must be... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_ad
//
// Generated
// by: wig
// on: Mon Oct 24 15:17:36 2005
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
/... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, b, d; cin >> n >> b >> d; int cur ... |
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; int o=0,e=0; int a; for(int i=0;i<2*n;i++){ cin>>a; if(a%2==0) e++; else o++; } if(o == e) cout<< YES <<endl; else cout<< NO <<endl; ... |
#include <bits/stdc++.h> using namespace std; long long n, M; vector<long long> cards; map<int, vector<int>> m; int sodd = 1, seven = 2; int oddbalance; int nextOdd() { for (int i = sodd;; i += 2) { if (m[i].empty()) { sodd = i + 2; if (i > M) { cout << -1 << endl; ... |
#include <bits/stdc++.h> using namespace std; const int N = 200 * 1000 + 20; int p[N], q[N], n, ans[N], cnt[N], seg[N << 2]; void build(int id = 1, int st = 0, int en = n) { if (en - st == 1) { seg[id] = 1; return; } int mid = st + en >> 1; build(id << 1, st, mid); build(id << 1 ... |
#include <bits/stdc++.h> using namespace std; int N; long long arr[100020]; long long prefix[100020]; multiset<long long> s; set<int> ded; long long range(int i, int j) { if (i == 0) { return prefix[j]; } else { return prefix[j] - prefix[i - 1]; } } int32_t main() { ios_bas... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void si(T &x) { register int c = getchar(); x = 0; int neg = 0; for (; ((c<48 | c> 57) && c != - ); c = getchar()) ; if (c == - ) { neg = 1; c = getchar(); } for (; c > 47 && c < 58; c = getchar... |
#include <bits/stdc++.h> using namespace std; long long ar[200010]; void solve() { long long a, b, c = 0, i, j, t, k, lie, m, n, o, x, y, z; long long p = 0, sm = 0, cnt = 0; scanf( %lld , &n); string s; cin >> s; if (n == 1) { printf( Yes n ); return; } for (i = 0; i <... |
#include <bits/stdc++.h> int main() { uint64_t a, b, x; std::cin >> a >> b; a < b | a - b & 1 ? std::cout << -1 : (x = a - b >> 1, x ^ a - x ^ b ? std::cout << -1 : std::cout << x << << a - x); } |
#include <bits/stdc++.h> using namespace std; const long long int N = 2e5 + 5; void solve() { long long int n, i, j, ans = 0; cin >> n; long long int a[n]; for (auto &x : a) { cin >> x; }; map<long long int, long long int> cnt; for (i = 0; i < n; i++) { for (j = i + 1; j < ... |
//Legal Notice: (C)2015 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 associate... |
#include <bits/stdc++.h> using namespace std; set<pair<int, int> > s; std::vector<int> vv; std::vector<std::vector<int> > gr; std::vector<int> vis; int k; pair<int, int> dfs(int u, int l) { vis[u] = l; vv.emplace_back(u); for (int v : gr[u]) { if ((vis[v]) && (vis[u] - vis[v]) >= k) { ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int ttt; cin >> ttt; for (long long int iq = 0; iq < ttt; ++iq) { long long int n, e = 0; cin >> n; long long int s = n % 10; while (n >= 10) { n ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2010 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 proper... |
/**
* 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() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; vector<string> g(n); for (int i = 0; i < n; i++) cin >> g[i]; auto flip = [&](int i, int... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:39:12 12/01/2015
// Design Name: peripheral_crc_16
// Module Name: /home/jorge/Documentos/SPI_SD/crc_16_peripheral_testbench.v
// Project Name: SPI_SD
// Target D... |
/**
* 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; bool check(long long x, long long y, long long p, long long q, long long t) { return p * t >= x && q * t - p * t >= y - x; } int main() { long long t; cin >> t; while (t--) { long long x, y, p, q, m; cin >> x >> y >> p >> q; long lo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.