text stringlengths 59 71.4k |
|---|
/*
* In The Name Of God
* ========================================
* [] File Name : set_t.v
*
* [] Creation Date : 04-03-2015
*
* [] Last Modified : Tue, Mar 31, 2015 9:13:43 AM
*
* [] Created By : Parham Alvani ()
* =======================================
*/
`timescale 1 ns/100 ps
module set_t;
reg [0:15]... |
/*
* 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... |
/*
* BCH Encode/Decoder Modules
*
* Copyright 2014 - Russ Dill <>
* Distributed under 2-clause BSD license as contained in COPYING file.
*/
`timescale 1ns / 1ps
`include "bch_defs.vh"
`include "config.vh"
module bch_encode #(
parameter [`BCH_PARAM_SZ-1:0] P = `BCH_SANE,
parameter BITS = 1,
parameter PIPELINE_... |
// 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 : Thu May 25 15:18:21 2017
// Host : GILAMONSTER running 64-bit major release (... |
/*
* 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... |
// megafunction wizard: %ALTLVDS%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altlvds_rx
// ============================================================
// File Name: LVDS_AD.v
// Megafunction Name(s):
// altlvds_rx
//
// Simulation Library Files(s):
// altera_mf
// ====================... |
#include <bits/stdc++.h> using namespace std; const double Pi = acos(-1.0); const double Eps = 1e-6; const int Mod = (int)1e9 + 7; long long Bigmod(long long b, long long p, long long m) { if (p == 0) return 1LL; if (p % 2 == 0) { long long c = Bigmod(b, p / 2, m); return ((c % m) * (c % m... |
#include <bits/stdc++.h> using namespace std; inline int read() { char ch = getchar(); int f = 1, x = 0; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(); } ... |
//-----------------------------------------------------------------------------
//-- mpres.v Multiples prescalers
//-- (C) BQ August 2015. Written by Juan Gonzalez (obijuan)
//-----------------------------------------------------------------------------
//-- Ejemplo de diseño jerarquico
//-- Se utiliza el componente g... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; while (scanf( %d %d , &n, &k) == 2) { char s[1000005]; memset(s, 0, sizeof(s)); int t = 0; if (n == 1 && k == 1) printf( a n ); else if (k == 1) printf( -1 n ); else if (n < k) pr... |
#include <bits/stdc++.h> using namespace std; const long double EPS = 1E-9; const int INF = (int)1E9; const long long INF64 = (long long)1E18; const long double PI = 2 * acos(.0); long long dp[10][10][2]; vector<int> number; int pivot = 1; long long solve(int pos, bool is_bounded, int lucky_digits) { ... |
/*************************************************************** File name: CF1517F.cpp Author: ljfcnyali Create time: 2021年04月27日 星期二 10时19分32秒 ***************************************************************/ #include<bits/stdc++.h> using namespace std; #define REP(i, a, b) for ( int i = (a), _e... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; using ii = pair<int, int>; using ll = long long; const int N = 3000 + 5; const int mod = 1e9 + 7; string source[N], target[N]; int n; ii ranges[N]; vector<int> FAIL(string pat) { int m = pat.siz... |
#include <bits/stdc++.h> using namespace std; int main() { #ifdef DEBUG freopen( a.in , r , stdin); #endif ios_base::sync_with_stdio(false), cin.tie(0); int T; cin >> T; while (T--) { int a[2]; cin >> a[0] >> a[1]; string s; cin >> s; int n = a[0] + a[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 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 ... |
#include <bits/stdc++.h> using namespace std; int n, a[500000], o, ans; int main() { cin >> n; ans = 1; for (int i = 2; i <= n + 1; i++) { if (a[i] == 0) { a[i] = 1; o = 1; for (int j = i + i; j <= n + 1; j += i) { o = 2; ans = max(ans, o); a... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<long long int> v(n); for (long long int &x : v) cin >> x; for (int i = 0; i < n; i++) { if (i % 2) v[i] = -abs(v[i]); else v... |
/*
* 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... |
//*****************************************************************************
// (c) Copyright 2008-2009 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 = int(1e9) + 7; const double eps = 1e-9; vector<pair<int, int> > g[111]; int dp[111][111][30]; int n, m; int dfs(int u, int v, int x) { if (dp[u][v][x]) return dp[u][v][x]; dp[u][v][x] = 2; for (int i = 0; i < int((g[u]).size()); ++i)... |
`include "senior_defines.vh"
module loop_controller
#(parameter ctrl_w = `LC_CTRL_WIDTH,
parameter nat_w = `SENIOR_NATIVE_WIDTH,
parameter spr_dat_w = `SPR_DATA_BUS_WIDTH,
parameter spr_adr_w = `SPR_ADR_BUS_WIDTH)
(
input wire clk_i,
input wire reset_i,
input wire pfc_lc_loopn_sel_i,
inp... |
/////////////////////////////////////////////////////////////////////
//// ////
//// OpenCores Simple General Purpose IO core ////
//// ////
//// Author: Richard Herveille ... |
#include <bits/stdc++.h> using namespace std; template <class __Ty> bool minimize(__Ty& a, __Ty b) { if (a > b) { a = b; return true; } return false; } template <class __Ty> bool maximize(__Ty& a, __Ty b) { if (a < b) { a = b; return true; } return false; } ... |
#include <bits/stdc++.h> using namespace std; const int N = 400010; int n, ans[N], where[N]; long long sz[N]; vector<int> v[N]; bool visit[N]; void init() { scanf( %d , &n); int a, b; for (int i = 0; i < n - 1; ++i) { scanf( %d %d , &a, &b); v[a].push_back(b); v[b].push_back(... |
//-----------------------------------------------------------------------------
// (c) Copyright 2012 - 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 proper... |
#include <bits/stdc++.h> struct coor { int x[3]; }; int x[6][3] = {0, 1, 2, 0, 2, 1, 1, 0, 2, 1, 2, 0, 2, 0, 1, 2, 1, 0}; bool judge(coor a, coor b) { bool flag = 0; b.x[2] += 18; if (b.x[2] < a.x[2]) { flag = 1; } else if (b.x[2] > a.x[2]) { } else if (a.x[2] == b.x[2]) { if... |
//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... |
/*
* 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 "defines.v"
module cp0_reg (
input wire clk,
input wire rst,
input wire[`RegAddrBus] raddr_i,
input wire[`RegBus] data_i,
input wire[`RegAddrBus] waddr_i,
input wire we_i,
input wire[5:0] int_i,
input wire[`RegBus] excepttype_i,
// 当前执行的指令
input wire[`RegBus] mem_current_inst_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... |
/**
* 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... |
/*------------------------------------------------------------------------------
Purpose
Pipeline: ñontrol sequence of instructions. All instructions have two stages:
1) Fetch;
2) Execute.
Branch instructions may have additional stage:
3) Memory issue instruction of branch address.
Memory instruct... |
#include<bits/stdc++.h> #define FOR(i,l,r) for(int i=l;i<=r;i++) #define ROF(i,l,r) for(int i=l;i>=r;i--) #define lson k<<1,l,mid #define rson k<<1|1,mid+1,r #define r(x) read(x) #define rr(x,y) read(x);read(y) #define rrr(x,y,z) read(x);read(y);read(z) #define pb(x) push_back(x) #define mp(x,y) make_... |
/*
* Copyright (c) 2014 CERN
* @author Maciej Suminski <>
*
* 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)
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
// verilator lint_off GENCLK
reg [7... |
/**
* 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; const int inf = 1e9 + 5; const long long linf = 1e18 + 5; class point { public: int x, y; double m; point() {} point(int x, int y) { this->x = x; this->y = y; this->m = atan2(y, x); } bool operator<(point other) const { r... |
#include <bits/stdc++.h> using namespace std; const int N = 200 * 1000 + 10; struct edge { int u, v, w; edge() {} edge(int u, int v, int w) : u(u), v(v), w(w) {} } e[N]; vector<int> vec[N]; int n, m, root[N], mx[35][N], par[35][N], h[N], ans[N]; bool mst[N], mark[N]; multiset<int> add[N], re... |
#include <bits/stdc++.h> using namespace std; typedef struct { long long v; long long c; } double_pair; struct line { long long k, b; line() {} line(long long _k, long long _b) : k(_k), b(_b) {} long long Solve(long long val) { long long _a = val - b, _b = k; if (_a % _b == 0... |
#include <bits/stdc++.h> using namespace std; void redondear(string &s, int pto, int idx) { if (idx == (int)(s.size())) { cout << s << endl; return; } s.resize(idx); bool unoAdelante = false; for (int i = (idx)-1; i >= (int)(0); i--) { if (i == pto) { continue; } ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, a, i, sum = 0, k, l = 10000000000; cin >> n; for (i = 1; i <= n; i++) { cin >> a; sum += a; if (a % 2) l = min(l, a); } if (sum % 2 == 1) sum -= l; cout << sum << endl; } |
/* This file is part of JT51.
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
JT51 is distributed in the hope tha... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000000 + 5; char s[maxn]; int vis[maxn], a[maxn]; int main() { int n; scanf( %d , &n); scanf( %s , s + 1); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); memset(vis, 0, sizeof(vis)); int x = 1; while (1) { if (... |
#include <bits/stdc++.h> using namespace std; const int N = 100007; int n, m, q[N], a[N], mn = 100000007, k, l; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> m; for (int i = 0; i < m; i++) { cin >> q[i]; mn = min(mn, q[i]); } cin >> n; for... |
// $Id: vcr_crossbar_mac.v 1687 2009-11-06 23:41:57Z dub $
/*
Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University
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 ... |
/*******************************************************************************
* 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 ... |
#include <bits/stdc++.h> using namespace std; int main() { int mera[100001]; int snct[100001]; string s; cin >> s; int len = s.length(); stack<int> st; if (s[0] == [ ) { snct[0] = 1; } else { snct[0] = 0; } for (int i = 1; i < len; i++) { snct[i] = snct[i -... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vec; set<int> st; for (int i = 0; i < int(n); ++i) { int a; cin >> a; st.insert(i); vec.push_back(a); } queue<int> tok; int ans = 0; int killed = 0; for (int i = n ... |
//////////////////////////////////////////////////////////////////
// //
// Wishbone Slave to Xilinx Spartan-6 MCB (DDR3 controller) //
// Bridge //
// ... |
#include <bits/stdc++.h> int a, b, c, prad[1000001]; using namespace std; int main() { long long pro = 0; for (int i = 1; i < 1000001; ++i) { for (int j = 1; j * i < 1000001; ++j) { ++prad[j * i]; } } cin >> a >> b >> c; for (int j = 1; j < a + 1; ++j) for (int ja = 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... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011 Xilinx Inc.
//
// 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
//
// ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1 ... |
#include <queue> #include <cstdio> #include <algorithm> const int Maxn=200; const int Maxl=40; const int Mod=998244353; int n,m; namespace Trie{ struct Trie_Node{ int ch[26]; bool pos; }node[Maxl+5]; int id_tot; void insert(char *s,int len){ int root=0; for(int i=1;i<=len;i++){... |
#include <bits/stdc++.h> int n, m, a[210], f[210][210][1010], ans; inline void up(int &x, int y) { if ((x += y) >= 1000000007) x -= 1000000007; } int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); std::sort(a + 1, a + n + 1); f[1][1][0] = f[1][0][0] = 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 la... |
#include <bits/stdc++.h> char a[1002][34], b[34]; int point[1002], res[1002], h[1002]; int main() { int n, x, i, j, p = 1; scanf( %d , &n); scanf( %s %d , &a[0], &x); point[0] += x; h[0] = point[0]; res[0] = 0; for (i = 1; i < n; i++) { scanf( %s %d , &b, &x); for (j = 0; j... |
#include <bits/stdc++.h> using namespace std; long long n; int main() { ios::sync_with_stdio(false), cin.tie(0); cin >> n; long long a = (n + 2) * (n + 1) * n / 6, b = (n + 4) * (n + 3) * (n + 2) * (n + 1) * n / 120; cout << a * b; 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { int n, o = 0, x = 0; cin >> n; for (int i = 0; i < n; i++) { int a; cin >> a; if (a) x++; else o++; } int s = x / 9; if (s && o) { for (int i = 0; i < 9 * s; i++) { cout << 5; ... |
module \$lut (A, Y);
parameter WIDTH = 0;
parameter LUT = 0;
(* force_downto *)
input [WIDTH-1:0] A;
output Y;
generate
if (WIDTH == 1) begin
localparam [15:0] INIT = {{8{LUT[1]}}, {8{LUT[0]}}};
SB_LUT4 #(.LUT_INIT(INIT)) _TECHMAP_REPLACE_ (.O(Y),
.I0(1'b0), .I1(1'b0), .I2(1'b0), .... |
#include <bits/stdc++.h> using namespace std; long long sum[500000 + 10]; int data[500000 + 10]; int main() { int n, l, r, ql, qr; scanf( %d%d%d%d%d , &n, &l, &r, &ql, &qr); for (int i = 1; i <= n; ++i) { scanf( %d , &data[i]); sum[i] += (sum[i - 1] + data[i] * r); } long long an... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_a
//
// Generated
// by: wig
// on: Tue Jun 27 15:34:40 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -sheet HIER=HIER_UAMN ../../verilog.xls
//
// !!! Do not edit this file! Autogenerated ... |
/**
* 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 get(int a) { int maxx = 0; for (int i = 0; i < 21; i++) if (a & (1 << i)) maxx = i; int ans = (1 << (maxx + 1)) - 1; return (ans ^ a); } int main() { int n; cin >> n; vector<int> a(n + 1); for (int i = n; i >= 0; i--) { ... |
#include <bits/stdc++.h> using namespace std; inline long long mul(long long x, long long y) { if (x >= (1ll << 60) / y) return (1ll << 60); else return x * y; } int n, m, p; int d[100005]; long long cat[100005], sum[100005]; long long dp[105][100005]; int dq[100005], s, e; int mai... |
// DESCRIPTION: Verilator: Verilog Test module
// This file ONLY is placed into the Public Domain, for any use,
// without warranty.
`timescale 1ns / 1ps
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=0;
reg [63:0] crc;
reg [31:0] sum;
wire [8:0] Output;
wire ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k, a[205], b[205]; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; for (int j = 1; j <= k; j++) cin >> b[j]; if (k >= 2) {... |
#include <bits/stdc++.h> using namespace std; long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; } const long long N = 2e5 + 7; const long long inf = 1e6 + 1; const long long mod = 998244353; int t, n, m, a[N]; struct node { int def, s; bool operator<(const node& a) const { re... |
//Legal Notice: (C)2017 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... |
/*
Copyright (C) 2014 Adapteva, Inc.
Contributed by Fred Huettig <>
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 versi... |
#include <bits/stdc++.h> using namespace std; const int INF = 1.01e9; const double PI = acos(-1); bool eq(double A, double B) { return abs(A - B) < 1e-9; } bool ls(double A, double B) { return A < B && !eq(A, B); } bool le(double A, double B) { return A < B || eq(A, B); } struct pt { double x, y, id; ... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 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 la... |
#include <bits/stdc++.h> using namespace std; template <typename T> T gcd(T a, T b) { T m; while (b != T(0)) { m = a % b; a = b; b = m; } return a; } template <typename T> T lcm(T a, T b) { return a == 0 && b == 0 ? 0 : (a / gcd(a, b)) * b; } char s[1500080]; stat... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; string s; cin >> s; long long ans = (n * (n - 1)) / 2; long long l = 0, r = n - 1; while (s[l] == s[0]) l++; while (s[r] == s[n - 1]) r-... |
#include <bits/stdc++.h> using namespace std; int N; char S[100005]; int main() { scanf( %d , &N); scanf( %s , S); string ANS = ; int a = (N - 11) / 2, b = a; for (int i = 0; i < N; i++) { if (S[i] == 8 ) { if (a) --a; else ANS += S[i]; } el... |
/**
* 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 int div_floor(const long long int &a, const long long int &b) { return a / b - (((a ^ b) < 0) and a % b); } long long int div_ceil(const long long int &a, const long long int &b) { return a / b + (((a ^ b) >= 0) and a % b); } long long int modp... |
#include <bits/stdc++.h> using namespace std; struct road { int x, next; } r[100005 * 2]; int N, M, D, ans; int vis[100005], p[100005]; int down[100005], up[100005]; int st[100005], w; void add(int x, int y) { r[++w].x = y, r[w].next = st[x]; st[x] = w; } void Make_Down(int x, int fr) { ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) using namespace std; const int maxn = 200000; int t[4 * maxn]; int p[maxn]; int n; int mina(int x, int y) { if (x == -1) return y; if (y == -1) return x; return (p[x] < p[y] ? x : y); } void build... |
#include <bits/stdc++.h> using namespace std; int n; char a[1000005]; int q; struct node { int optimal; int open; int close; node(int op = 0, int cl = 0, int o = 0) { optimal = op; open = o; close = cl; } }; node t[4 * 1000005]; node operator+(const node &left, cons... |
/**
* 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; int32_t main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int t, n, m, i, j, k, sum = 0; long long int p, w, d; cin >> n >> p >> w >> d; long long int l = 0; long long int r = n; for (i = 0; i <= w; 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2004 by Wilson Snyder.
module t (/*AUTOARG*/
// Outputs
outc_w30, outd_w73,
// Inputs
clk, ina_w1, inb_w61
);
input clk;
input ina_w1;
input [60:0] ... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module gpio #(
parameter BASEADDR = 16'h0000,
... |
#include <bits/stdc++.h> using namespace std; int x, y, a, b, c, ans; int main() { cin >> x >> y; if (x > y) swap(x, y); a = b = c = x; while (true) { a = b + c - 1; ans++; if (a >= y) break; b = a + c - 1; ans++; if (b >= y) break; c = a + b - 1; an... |
#include <bits/stdc++.h> using namespace std; long long ans = 0; int n, m, w[2010]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { scanf( %d , &w[i]); } for (int i = 1, a, b; i <= m; i++) { scanf( %d%d , &a, &b); ans += min(w[a], w[b]); } printf( %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 law... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 &y) { if (x > y) x = y; } template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 &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 law... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m = 0, b, c = 0; cin >> n; int a[1001]; for (int i = 0; i < n; i++) { cin >> b; if (b == 1) { a[m] = c; m += 1; } c = b; } a[m] = c; cout << m << endl; for (int i = 1; i < m + 1;... |
/*
Copyright (c) 2014-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, distri... |
/*
* Copyright (c) 2015-2018 The Ultiparc Project. 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 copyright
* notice, this list... |
#include <bits/stdc++.h> using namespace std; template <class T> inline bool fs(T &x) { int c = getchar(); int sgn = 1; while (~c && c < 0 || c > 9 ) { if (c == - ) sgn = -1; c = getchar(); } for (x = 0; ~c && 0 <= c && c <= 9 ; c = getchar()) x = x * 10 + c - 0 ; x *= ... |
// file: bd_clk_wiz_0_0.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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.