text stringlengths 59 71.4k |
|---|
#include<bits/stdc++.h> #define rep(i, a, n) for(int i = a; i <= n; i++) #define _rep(i, n, a) for(int i = n; i >= a; i--) typedef long long LL; using namespace std; const int maxn = 2e5 + 10; const int mod = 1004535809; inline LL read(){ LL x = 0, fl = 1; char c = getchar(); while (c < 0 || c > ... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; const double pi = acos(-1.0); const long long int inf = 0x3f3f3f3f3f3f3f3f; const long long int mod = 998244353; bool isPowerOfTwo(int x) { return x && (!(x & (x - 1))); } void fast() { ios::sync_with_stdio(0); cin.tie(0); co... |
#include <bits/stdc++.h> using namespace std; int read() { register int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = 10 * x + ch - 0 ; ch = getchar(); } return x * ... |
#include <bits/stdc++.h> using namespace std; const int oo = (int)1e9; const double eps = 1e-9; long long gcd(long long a, long long b); int main() { int n; long long maxi = 0, num, g; cin >> n; for (int i = 0; i < n; i++) { cin >> num; maxi = max(maxi, num); g = gcd(g, num);... |
/*
* Wrapper for Xilinx MIG'd DDR2 controller, allowing 3 masters
* to contol the single interface.
*/
module xilinx_ddr2
(
// Inputs
input [31:0] wbm0_adr_i,
input [1:0] wbm0_bte_i,
input [2:0] wbm0_cti_i,
input wbm0_cyc_i,
input [31:0] wbm0_dat_i,
input [3:0] wbm0_sel_i,
... |
#include <bits/stdc++.h> using namespace std; const int maxN = 5e5 + 10, mod = 1e9 + 7; int n, q, cnt; int nxt[maxN + 1], res[maxN + 1], ans[maxN + 1]; int pw[maxN + 1], id[maxN + 1], tp[maxN + 1]; int L[maxN + 1], R[maxN + 1], S[maxN + 1]; int stk[maxN + 1], top; int sum[maxN + 1], mn[maxN + 1][21], lg... |
//
// Copyright (c) 1999 Steven 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)
// ... |
#include <bits/stdc++.h> using namespace std; int n, lcnt; long long m, p, q; int a[100005], lsum[100005]; long long sum[100005], rmax[100005], lmin[100005], ls[100005]; long long ans1, ans2, ans; set<int> unu; inline long long Min(long long x, long long y) { return x < y ? x : y; } inline long long M... |
#include <bits/stdc++.h> const int INF_INT = 0x3f3f3f3f; const long long INF_LL = 0x7f7f7f7f; const int MOD = 1e9 + 7; const double eps = 1e-10; const double pi = acos(-1); using namespace std; const int N = 200010; long long n, k; long long fac[N], inv[N]; long long ksm(long long a, long long x, lo... |
module mojo_top(
// 50MHz clock input
input wire clk,
// Input from reset button (active low)
input wire rst_n,
// cclk input from AVR, high when AVR is ready
input wire cclk,
// Outputs to the 8 onboard LEDs
output wire [7:0]led,
// AVR SPI connections
output wire spi_miso,
... |
#include <bits/stdc++.h> template <class T> inline bool rd(T &ret) { char c; int sgn; if (c = getchar(), c == EOF) return 0; while (c != - && (c < 0 || c > 9 )) c = getchar(); sgn = (c == - ) ? -1 : 1; ret = (c == - ) ? 0 : (c - 0 ); while (c = getchar(), c >= 0 && c <= 9 ) re... |
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef vector<int> vi; int n,a[300010],res[300010],gtm[300010]; vi L,R,rm; void solve() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; L.assign(n,0); R.assign(n,0); rm.assign(n + 1, 0); L[0] = 0; for... |
#include <bits/stdc++.h> using namespace std; const bool debug = 1; int xl = 1 << 30, xr = -(1 << 30), yl = 1 << 30, yr = -(1 << 30), zl = 1 << 30, zr = -(1 << 30); bool getpod(pair<int, int> p, int s) { int pzl = p.first - p.second - s; int pzr = p.first - p.second + s; int pxl = p.first - s;... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1, typename Arg2> ostream& operator<<(ostream& out, const pair<Arg1, Arg2>& x) { return out << ( << x.first << , << x.second << ) ; } template <typename Arg1> ostream& operator<<(ostream& out, const vector<Arg1>& a) { out << [... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &x) { x = 0; bool w = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) w = 0; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - 0 ; c = getchar(); } x = w ... |
#include <bits/stdc++.h> int n, d, m, t[200005][2], l, p, r, b; long long ans; std::pair<int, int> s[200005]; bool a = true; int main() { scanf( %d %d %d , &d, &n, &m); for (int i = 0; i < m; i++) scanf( %d %d , &s[i].first, &s[i].second); std::sort(s, s + m); t[l][0] = 0; t[l++][1] = n; ... |
#include <bits/stdc++.h> using namespace std; template <class T> void in(T &x) { x = 0; bool f = 0; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = 1; c = getchar(); } while ( 0 <= c && c <= 9 ) { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(... |
#include <bits/stdc++.h> using namespace std; template <class T> void readi(T &x) { T input = 0; bool negative = false; char c = ; while (c < - ) { c = getchar(); } if (c == - ) { negative = true; c = getchar(); } while (c >= 0 ) { input = input * 10 +... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:40:38 05/31/2011
// Design Name: main
// Module Name: /home/ikari/prj/sd2snes/verilog/sd2snes/main_tf.v
// Project Name: sd2snes
// Target Device:
// Tool versions... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; for (int k = 0; k < t; k++) { int n, m; cin >> n >> m; vector<vector<int>> a(max(n, m), vector<int>(max(n, m))); vector<vector<int>> id(n * m, vect... |
/*+--------------------------------------------------------------------------
Copyright (c) 2015, Microsoft Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:45:56 04/26/2014
// Design Name: sccpu_cpu
// Module Name: D:/XilinxProject/CPU/sccpu.v
// Project Name: CPU
// Target Device:
// Tool versions:
// Descriptio... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; char arr[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> arr[i][j]; } } vector<pair<int, int>> vec; if ... |
#include <bits/stdc++.h> using namespace std; unsigned long long mod = 1000000007; template <class T1> void deb(T1 e1) { cout << e1 << n ; } template <class T1, class T2> void deb(T1 e1, T2 e2) { cout << e1 << << e2 << n ; } template <class T1, class T2, class T3> void deb(T1 e1, T2 ... |
// my simple if else example, indented by verilog-mode
if (x == 1)
begin
test1 <= 1;
test2 <= 2;
end
else
begin
test1 <= 2;
test2 <= 1;
end
// code from IEEE spec, pg. 164
class MyBus extends Bus;
rand AddrType atype;
constraint addr_range
{
(atype == low ) -> addr inside { [0 : 15] };
(atype == mid )... |
#include <bits/stdc++.h> struct node { int a, b, w; } p[200005]; int fa[200005]; bool d[200005]; bool cmp(node x, node y) { return x.w > y.w; } int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); } int main() { int n, m, ans = 0; scanf( %d%d , &n, &m); for (int i = 1; i <= m; i+... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s; cin >> s; int n = s.size(); if (n % 2 == 1) { for (int i = 0; i < n + 1; ++i) { cout << (i < (n + 1) / 2 ? 4 : 7); } cout << endl; return 0; } int seven = 0, four = 0;... |
#include <bits/stdc++.h> using namespace std; long long ax, ay, bx, by, cx, cy; void check(long long axx, long long ayy) { if (cx == 0 && cy == 0) { if (axx == bx && ayy == by) { cout << YES ; exit(0); } else return; } if ((cx * (by - ayy) - cy * (bx - axx)) % (cx ... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC optimize( unroll-loops ) using namespace std; using ll = long long; using db = long double; using ii = pair<int, int>; const int N = 1e5 + 5, LG = 17, MOD = 998244353; const int SQ = 225; const long double EPS = 1e-7; int n, m, a[N], 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 law... |
/*
Copyright (c) 2018 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,... |
// file: clk_gen.v
//
// (c) Copyright 2008 - 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 l... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long mx = 1e3 + 4; vector<vector<long long>> dist; vector<vector<bool>> col; queue<pair<long long, long long>> vis; long long n, m, t; long long expo_pow(long long x, long long y) { if (y == 0) return 1; y = ... |
module deserializer
#( parameter INLOGBITS = 3,
parameter OUTLOGBITS = 6,
localparam INWIDTH = 1<<INLOGBITS,
localparam OUTWIDTH = 1<<OUTLOGBITS)
(
input clk,
input rst_n,
input in_valid,
output reg in_ready,
input [INWIDTH-1:0] in_data,
output reg out_val... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; long long a[N], n, seg[20][N]; void build(int xl = 0, int xr = n, int ind = 0) { if (xr - xl == 1) { seg[ind][xl] = a[xr] - a[xl]; return; } int xm = (xl + xr) / 2; build(xl, xm, ind + 1); build(xm, xr, ind + 1)... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, m, t; cin >> n >> k >> m >> t; for (int i = 0; i < t; i++) { int a, b; cin >> a >> b; if (a == 0 && b < k) { k -= b; n -= b; } else if (a == 1 && b <= k) { k++; n++; } else ... |
#include <bits/stdc++.h> using namespace std; int n; int cnt[3], seen[3]; string s; int main() { ios::sync_with_stdio(0); cin >> n >> s; int m = n / 3; for (int i = 0; i < n; i++) { cnt[s[i] - 0 ]++; } for (int i = 0; i < n; i++) { if (cnt[s[i] - 0 ] > m) { for (l... |
// jaxa_mm_interconnect_0_avalon_st_adapter.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 17.1 593
`timescale 1 ps / 1 ps
module jaxa_mm_interconnect_0_avalon_st_adapter #(
parameter inBitsPerSymbol ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
#include <bits/stdc++.h> using namespace std; using UL = unsigned long int; using UI = unsigned int; using ULL = unsigned long long int; using LI = long int; using LL = long long; using LF = double; using LLF = long double; const int mod1 = 1000000007; const int mod2 = 998244353; const double PI =... |
// 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 Jun 04 17:33:00 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int main() { int c0, c1, c2, c3; cin >> c0 >> c1 >> c2 >> c3; if (c1 - c0 == c2 - c1 && c2 - c1 == c3 - c2) { cout << c3 + c1 - c0 << endl; } else if (c1 * c1 == c0 * c2 && c2 * c2 == c1 * c3 && !((c3 * c3) % c2)) { cout << c3 * c1 / c0 << en... |
/**
* 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; cin >> n; int x = 0, y = 0; char s[n]; for (int i = 0; i < n; i++) { cin >> s[i]; if (s[i] == 0 ) y++; else x++; } if (x == y) { cout << 2 << endl << s[0] << ; for (int i... |
#include <bits/stdc++.h> using namespace std; char A[300]; int cnt[5]; char data[5] = ACGT ; int main() { int n; scanf( %d , &n); scanf( %s , A); for (int i = 0; A[i]; i++) { if (A[i] == A ) cnt[0]++; else if (A[i] == C ) cnt[1]++; else if (A[i] == G ) ... |
/**
* 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 <typename A, typename B, typename C> struct triple { A X; B Y; C Z; triple(A a = 0, B b = 0, C c = 0) : X(a), Y(b), Z(c) {} }; template <typename A, typename B, typename C> triple<A, B, C> make_triple(A a = 0, B b = 0, C c = 0) { ret... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 4e5 + 5; const string s[] = { NW , NE , SE , SW }; inline int read() { int x = 0; char ch = getchar(); while (!isdigit(ch)) ch = getchar(); while (isdigit(ch)) { x = x * 10 + ch - 0 ; ch = getchar(); } return ... |
//move some stuff to minitests/ncy0
`define SEED 32'h12345678
module top(input clk, stb, di, output do);
localparam integer DIN_N = 42;
localparam integer DOUT_N = 79;
reg [DIN_N-1:0] din;
wire [DOUT_N-1:0] dout;
reg [DIN_N-1:0] din_shr;
reg [DOUT_N-1:0] dout_shr;
always @(posedge clk) begin
din_shr <= {d... |
// (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... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using uint = unsigned int; using pii = pair<int, int>; using vi = vector<int>; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; if (a % b == 0) cout << YES n ; else co... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char* argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); int k; string str; cin >> str; cin >> k; int temp[50]; memset(temp, 0, sizeof(temp)); int count = 0; for (int i = 0; i < str.size(); ++i) { ... |
module x (/*AUTOARG*/
// Inputs
MIERHW, MBOOTH_P, CEIopMADH_E_D2_R, CEIopMAZH_E_D2_R, DDATAH, DIV2HI, HI_R, MCLA, MCLASH,
MULTSHCYC, MULTUSCYC, HI_P
);
input [18:0] MIERHW;
integer i;
integer MTEMP1;
integer MTEMP2;
input MBOOTH_P;
inpu... |
#include <bits/stdc++.h> using namespace std; int N[5]; int K; int getChoice(int choice) { if (N[choice]) return choice; for (int i = 1; true; i++) { if (choice + i < 5 && N[choice + i]) return choice + i; if (choice - i >= 0 && N[choice - i]) return choice - i; } } int main() { ... |
#include <bits/stdc++.h> using namespace std; const long double PI = 4 * atan(1); const int32_t MOD = 1e9 + 7; int power(int x, unsigned int y) { int temp; if (y == 0) return 1; temp = power(x, y / 2); if (y % 2 == 0) return temp * temp % MOD; else return x * temp % MOD * temp % ... |
#include <bits/stdc++.h> using namespace std; long long a, b, c, m, n; int main() { cin >> a; cout << a / 2520; } |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int l = s.length(); vector<char> s1; for (int i = 0; i < l; i++) { s1.push_back(s[i]); int f = 0; while (s[i] == / && i < l) { i++; f = 1; } if (f == 1) i--; } i... |
#include <bits/stdc++.h> int n; long long x, y, z = 2; int main() { scanf( %d , &n); for (long long k = 1; k <= n; k++) { y += 2; x += y; double a = x; double b = z; a = (double)(a / k); b = (double)(b / k); a = (double)a * x; printf( %.0lf n , (double)a - b... |
// This should blink at a rate of ~ second
// 12mhz/(56000hz) = 214/2 = 107
// 12mhz/2400 = 5000 /2 = 2500
// 12mhz/9600 = 1250 /2 = 625
// 12mhz/38400 = 312 /2 = 156
// 12mhz/57600 = 208.3 /2 = 104
// 12mhz/19200 = 625 /2 = 312
// 12mhz/115200 = 104 /2 = 52
// 2400hz
//parameter UART_PERIOD = 5000;
//parameter UA... |
// part of NeoGS flash programmer project (c) 2014 lvd^NedoPC
//
// top-level module
module top(
input wire clk_fpga, // clocks
input wire clk_24mhz, //
output wire clksel0, // clock selection
output wire clksel1, //
input wire warmres_n, // warm reset
inout wire [ 7:0] d, // Z80 data bus
output wire ... |
// (C) 2001-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 simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; const long long inf = ~0ULL >> 1; const int maxV = 3e5 + 10; const int maxE = 6e5 + 10; struct EDGE { int v, nxt; long long w; EDGE() {} EDGE(int vv, int xx, long long ww) { v = vv, nxt = xx, w = ww; } }; EDGE edg[maxE]; int EH[maxV], etot; ... |
#include <bits/stdc++.h> using namespace std; struct Segment { int l, r, x, ls, rs, fa; } seg[2000100]; int n, k, p[100100], cnt, pnt, b[2000100], w, ans[100100], res; int Dfs(int &id, int l, int r) { id = ++cnt; seg[id].l = l, seg[id].r = r; seg[id].x = 1; if (r - l == 1) return 1; in... |
#include <bits/stdc++.h> using namespace std; int n, m, A, B; double p[25]; double a[625][625], l[625][625], u[625][625]; vector<int> g[25]; double y[625], x[625], b[625]; int id[25][25]; void edge(int ea, int b, int c, int d, double e) { if (ea < b) swap(ea, b); if (c < d) swap(c, d); a[id[... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 9; int n, p, q; string s, t, a, b; int c[2005], d[2005], h[2005], invH[2005], k[2005], invK[2005]; vector<pair<int, int>> memo; int mul(int aa, int bb) { return ((long long)aa * bb) % MOD; } int add(int aa, int bb) { return (aa + bb) % ... |
`timescale 1ns / 1ps
module quick_spi_hard_be_msb_testbench;
reg clk;
reg rst_n;
wire end_of_transaction;
wire[7:0] incoming_data;
reg[15:0] outgoing_data;
wire mosi;
reg miso;
wire sclk;
wire[1:0] ss_n;
reg enable;
reg start_transaction;
reg operation;
integer sclk_toggle_count;
reg[8:0] incoming_data_buffer;
reg sp... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:05:35 06/18/2015
// Design Name:
// Module Name: gainMult
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
/... |
#include<bits/stdc++.h> using namespace std; #define sz(s) (int)s.size() #define f first #define s second #define pb push_back #define all(s) s.begin(), s.end() #define vi vector<int> #define vvi vector<vi> #define ll long long #define vll vector<ll> #define ii pair<int, int> #define... |
`timescale 1 ns / 1 ps
module axis_ram_writer #
(
parameter integer ADDR_WIDTH = 20,
parameter integer AXI_ID_WIDTH = 6,
parameter integer AXI_ADDR_WIDTH = 32,
parameter integer AXI_DATA_WIDTH = 64,
parameter integer AXIS_TDATA_WIDTH = 64
)
(
// System signals
input wire aclk,
... |
//Legal Notice: (C)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
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; const long long infll = powl(2, 63) - 1; struct cup { long long a, b, c; }; bool comp(cup x, cup y) { return x.c < y.c; } bool cmp1(cup x, cup y) { if (x.a == y.a) return x.c < y.c; return x.a > y.a; } int32_t main() { long long n, tea; c... |
#include <bits/stdc++.h> using namespace std; int n, k, m; int a[111]; int c[111][111]; long long dp[111][111][111]; long long f(int idx, int cnt, int last) { if (idx > n) return cnt == k ? 0 : 1e13; if (dp[idx][cnt][last] != -1) return dp[idx][cnt][last]; long long ans = 1e13; if (a[idx]) ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5, M = 20; int n, m; string s; int pos[(1 << M) - 1], a[M + 5][M + 5], f[(1 << M) + 5], g[(1 << M) + 5][M + 5]; int main() { memset(a, 0, sizeof(a)); memset(f, 0x3f, sizeof(f)); memset(g, 0, sizeof(g)); cin >> n >> m >> s; ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (lin64) Build Wed Dec 14 22:35:42 MST 2016
// Date : Sat Jan 21 14:43:33 2017
// Host : natu-OMEN-by-HP-Laptop running 64-bit Ubunt... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> std::pair<T, U> operator+(const std::pair<T, U> &l, const std::pair<T, U> &r) { return {l.first + r.first, l.second + r.second}; } typedef void (*callback_function)(void); const long long INF64 = 1e18; const long long INF3... |
#include <bits/stdc++.h> using namespace std; struct node { int i; int num; } a[1005]; bool cmp(node x, node y) { return x.num < y.num; } int main() { int t; scanf( %d , &t); while (t--) { int n, m; scanf( %d %d , &n, &m); int i, j; int ans = 0; for (i = 1; 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; const int N = 20; int a[N], b[N], c[N], d[N], ln[N], rn[N], lm[N], rm[N]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i] >> b[i]; if (a[i] > b[i]) swap(a[i], b[i]); } set<int> st; for (int i = 1; ... |
/*
* 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... |
// This is a component of pluto_servo, a PWM servo driver and quadrature
// counter for emc2
// Copyright 2006 Jeff Epler <>
//
// 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 Foundatio... |
#include <bits/stdc++.h> using namespace std; template <class T1> void deb(T1 e) { cout << e << endl; } template <class T1, class T2> void deb(T1 e1, T2 e2) { cout << e1 << << e2 << endl; } template <class T1, class T2, class T3> void deb(T1 e1, T2 e2, T3 e3) { cout << e1 << << e2 ... |
/**
* 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 long long int maxn = 2e5 + 5; long long int sz[maxn], dp[maxn], ans[maxn]; vector<long long int> g[maxn]; long long int n; long long int dp1(long long int node, long long int parent) { sz[node] = 1; for (auto& itr : g[node]) if (itr != parent... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, j = 0, ans = 0; cin >> n >> m; string s; cin >> s; set<char> st; vector<long long int> vec; for (long long int i = 0; i < m; i++) { char c; cin >> c; st.insert(c); } for (long long 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 la... |
#include <bits/stdc++.h> using namespace std; long long a, b, c, d, e, t1, t2, t3; long long la, lb, lc; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, m, s; cin >> n >> m >> s; a = 0; b = 0; long long i = 0; c = 1; if (s <= n) { while (i < n... |
#include <bits/stdc++.h> using namespace std; const int maxn = int(1.5 * 1e7); const int inf = 1e9 + 7; const long long ll_inf = 1e18 + 420; const double eps = 1e-4; const int N = 1e6; const int MAX = 2e5 + 9; const int MOD = 1e9 + 7; const long double pi = 3.14159265359; string s; bool was[10][10... |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; long long qpow(long long x, long long tms) { long long tmp = 1; while (tms) { if (tms & 1) tmp = tmp * x % mod; tms >>= 1; x = x * x % mod; } return tmp; } int n, m, T; bool chk(int k) { if (n == ... |
`timescale 1ns/10ps
module pll_0002(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'locked'
output wire locked
);
altera_pll #(
.fractional_vco_multiplier("false"),
.reference_clock_frequency("50.0 MHz"),
.ope... |
/*
* Copyright (c) 2002 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> const int N = 1e5 + 10; const int MOD = 1e9 + 7; const int INF = 2e9; const long long INFLL = 1e18; const double PI = acos((double)-1); inline int mult(int a, int b, int p = MOD) { return (1ll * a * b) % p; } inline int add(int a, int b, int p = MOD) { return (1ll * a + b) % p; } ... |
#include <bits/stdc++.h> using namespace std; int a[150005]; int main() { int n, k, q; scanf( %d %d %d , &n, &k, &q); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } multiset<int> t; for (int i = 1; i <= q; i++) { int x, y; scanf( %d %d , &x, &y); if (x == 1) {... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const long long inf64 = 1e18; void solve() { int n, m; cin >> n >> m; vector<vector<int>> a(n, vector<int>(m)), b; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> a[i][j]; for (int i = 0; i < n; i++) { ... |
`define bsg_mul_booth_gen_macro(name,blocks,S_above,dot_bar,b_vec,one_vec) \
if ( blocks == blocks_p && S_above == S_above_vec_p \
&& dot_bar == dot_bar_vec_p && b_vec == B_vec_p && one_vec == one_vec_p) \
begin : macro ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long MAXN = 2e5 + 7; long long a[MAXN]; bool good[MAXN]; long long want[MAXN], pref[MAXN], next_[MAXN]; signed main() { ios_base::sync_with_stdio(false); cout.precision(40); long long n; cin >> n; 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... |
module decoder (cx,d);
output [7:0] d;
input [18:0] cx;
reg [7:0] d;
reg [7:0] s;
reg [18:0] cx1;
parameter s0 = 8'b10000000000;
parameter s1 = 8'b01000000000;
parameter s2 = 8'b00100000000;
parameter s3 = 8'b00010000000;
parameter s4 = 8'b00001000000;
parameter s5 = 8'b00000100000;
parameter s6 = 8'b00... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) std::pair<int, int> DR[] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {-1, 1}, {-1, -1}, {1, 1}, {1, -1}}; using namespace std; int n, x, a[1 << 19]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cerr.tie(... |
/**
* 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 = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3f; const int MOD = (int)1e9 + 7; const int N = (int)1e6 + 7; const int M = (int)-1; int a[N], cnt[100]; int main() { int T; cin >> T; while (T--) { long long n; int m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.