text stringlengths 59 71.4k |
|---|
Require Export Iron.Language.SimpleRef.SubstExpExp.
Require Import Iron.Language.SimpleRef.Preservation.
Require Import Iron.Language.SimpleRef.Ty.
Require Export Iron.Language.SimpleRef.Step.
Require Export Iron.Language.SimpleRef.Exp.
(********************************************************************)
(** Big S... |
/**
* 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 cnt[2]; int main() { ios::sync_with_stdio(false); string s; cin >> s; for (int i = s.size() - 1; i >= -1; i--) { if (i > -1) cnt[s[i] - 0 ]++; if (s[i] == 1 && (i == 0 || s[i - 1] == 0 )) { int req = cnt[1] - cnt[0]; ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const int N = 122231; int n, k; vector<int> g[N]; int used[N]; int done[150][150][150]; int memo[150][150][150]; vector<int> sons[N]; int max_dep[N]; void dfs(int v) { used[v] = 1; max_dep[v] = 0; for (int i = 0; i < g[... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; long long a, b, x, y, i, k, j, t, n, s; cin >> t; while (t--) { cin >> n >> k; if (n % 2 == 0) { s = n + (k * 2); cout << s << endl; } else { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int min1, min2, min3, max1, max2, max3; cin >> min1 >> max1 >> min2 >> max2 >> min3 >> max3; int c = n; int ans1 = min1, ans2 = min2, ans3 = min3; for (int i = min1; i < max1; i++) { if (ans1 + ans2 + ans3 ... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// 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... |
/*
* 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; cin >> n; vector<vector<int>> moves(2, vector<int>()); for (int i = 0; i < 2; ++i) { int k; cin >> k; for (int j = 0; j < k; ++j) { int m; cin >> m; moves[i].push_back(m); } } qu... |
#include <bits/stdc++.h> const long long int INF = (1e9 + 12312), MOD = 1e9 + 7; const long double EPS = 0.0000000001; using namespace std; vector<pair<long long int, long long int> > a; pair<long long int, pair<long long int, long long int> > l(long long int x, ... |
#include<bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define inf INT_MAX #define minf INT_MIN #define infl LLONG_MAX #define minfl LLONG_MIN #define mod 1000000007 /*----------------------Debugger-----------------------------------*/ #ifndef ONLIN... |
#include <bits/stdc++.h> using namespace std; int a[150000], b[510000], arr[226660]; int main() { int n, x, k; cin >> n >> k >> x; int cnt = 1; int l = 0; cin >> arr[0]; for (int i = 1; i < n; i++) { cin >> arr[i]; if (arr[i] == arr[i - 1]) { cnt++; } else { ... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> v[1005]; int ma, src; bool vis[1005]; int p[1005]; void dfs(int s, int pa, int d) { p[s] = pa; vis[s] = 1; if (d >= ma) { src = s; ma = d; } for (int i = 0; i < v[s].size(); i++) { int u = v[s][i]; ... |
#include <bits/stdc++.h> using namespace std; namespace IO { inline bool read() { return true; } template <class T1, class... T2> bool read(T1 &a, T2 &...rest) { return (cin >> a) ? read(rest...) : 0; } template <class... T> bool read(char *a, T &...rest) { return (cin >> a) ? read(rest...) : 0;... |
/*TODO:
Test byte masks
Add timeout
Test linear burst from 0xffffffff
Add support for settings address ranges
*/
module wb_master
#(parameter aw = 32,
parameter dw = 32,
parameter VERBOSE = 0,
parameter MAX_BURST_LEN = 500)
(input wb_clk_i,
input wb_rst_i,
output [aw-1:0] wb... |
/* * * Author: Hsueh- * Date: 2021-03-05 21:34:52 * * */ #include <bits/stdc++.h> using namespace std; #define dbg(x...) do { cout << #x << ... |
#include <bits/stdc++.h> using namespace std; long long n, k, m, x[500010], y[500010], xx[500010], yy[500010], zz[500010]; const long long N = 2e6 + 10; struct link { long long top, fi[N], to[N], la[N], ne[N]; void clear() { top = 0, memset(fi, 0, sizeof fi), memset(la, 0, sizeof la), memset... |
#include <bits/stdc++.h> using namespace std; pair<double, double> get_vec_rotate(pair<double, double> nv, double fi) { return make_pair(nv.first * cos(fi) - nv.second * sin(fi), nv.second * cos(fi) + nv.first * sin(fi)); } pair<double, double> get_normal(pair<double, double> vec) { ... |
//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... |
/**
* 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() { cin.tie(0)->sync_with_stdio(0); int n; cin >> n; int sp = -1, rmv = 0, ans = 0; stack<int> st; while (n--) { int t; cin >> t; if (t == 1) { int x; cin >> x; sp = x; } else if (t == 3) {... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
//======================================================================
//
// trng_debug_ctrl.v
// -----------------
// Debug and control module in the Cryptech TRNG.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2014, Secworks Sweden AB
// All rights reserved.
//
// Redistribution and use in source and bina... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); long long q; cin >> q; while (q--) { long long l1, r1, l2, r2; cin >> l1 >> r1 >> l2 >> r2; if (l1 == l2) { cout << l1 << << r2 << n ; continue; } if (l1 == r2)... |
/*
* 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) 2001-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 associated doc... |
#include <bits/stdc++.h> void solve() { int n; std::cin >> n; int a = 0; std::string s; std::cin >> s; bool flag = false; int x, y; x = y = 0; if (s[0] == U ) { ++y; } else { ++x; } if (x > y) flag = true; for (size_t i = 1; i < s.size(); ++i) { i... |
(* -*- coding: utf-8 -*- *)
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * Copyright INRIA, CNRS and contributors *)
(* <O___,, * (see version control and CREDITS file for authors & da... |
#include <bits/stdc++.h> using namespace std; long long v[100005]; long long st[400005]; void init(int idx, int a, int b) { if (a == b) { st[idx] = v[a]; } else { int m = (a + b) / 2; init(idx * 2 + 1, a, m); init(idx * 2 + 2, m + 1, b); st[idx] = max(st[idx * 2 + 1], st[id... |
#include <bits/stdc++.h> using namespace std; int n, k, r, c; vector<string> grip; int main() { grip.clear(); cin >> r >> c >> n >> k; string ful = ; for (int i = 0; i < c; i++) ful += . ; for (int i = 0; i < r; i++) grip.push_back(ful); for (int i = 0; i < n; i++) { int y, x; ... |
`default_nettype none
`define WIDTH 16
module stack2pipe4(
input wire clk,
output wire [`WIDTH-1:0] rd,
input wire we,
input wire [1:0] delta,
input wire [`WIDTH-1:0] wd);
parameter DEPTH = 18;
localparam BITS = (`WIDTH * DEPTH) - 1;
localparam STATESIZE = `WIDTH * (DEPTH + 1); // complete size o... |
/*******************************************************************************
* 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; bool sortbysec(const pair<long long int, long long int> &a, const pair<long long int, long long int> &b) { return (a.second < b.second); } int main() { vector<pair<long long int, long long int>> v; long long int n, m, k; cin >> n >> ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, i, j; long long int prod = 1; char mat[105][105]; cin >> n >> m; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { cin >> mat[i][j]; } } for (i = 0; i < m; i++) { unordered_set<char> s; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2010 by Wilson Snyder.
module t (
`ifdef T_CLK_2IN_VEC
input [1:0] clks,
`else
input c0,
input c1,
`endif
input check
);
`ifdef T_CLK_2IN_VEC
wire c0... |
#include <bits/stdc++.h> using namespace std; string s; int dp[50][2000], r[50], n; const int inf = 1e6; int abs(int a) { return a > 0 ? a : -a; } int getTime(int id, int k) { if (k <= 0) return 0; if (dp[id][k]) return dp[id][k]; dp[id][k] = inf; for (int i = 0; i < n; i++) { if (s[i]... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1005000; int A[maxn], sum[maxn][10]; int dfs(int u) { if (u < 10) return u; if (A[u]) return A[u]; int now = 1, tmp = u; while (u) { if (u % 10 != 0) now *= u % 10; u /= 10; } return A[tmp] = dfs(now); } int m... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n, m; cin >> n >> m; int a[n][m]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> a[i][j]; int flag = 0; for (int i = n - 2; i >= 1; i--) { ... |
//Connect the switches to the LEDs, inverting the signal in the ROI
//Assumes # inputs = # outputs
`include "defines.v"
module roi(input clk,
input [DIN_N-1:0] din, output [DOUT_N-1:0] dout);
parameter DIN_N = `DIN_N;
parameter DOUT_N = `DOUT_N;
wire [DIN_N-1:0] internal;
genvar i;
genera... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n], b[1000000] = {0}; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n / 2; i++) { if (a[i] - i - 1 >= 0) b[a[i] - i - 1]++; if (a[n - 1 - i] - i - 1 >= 0) b[a[n - 1 - i] - i... |
#include <bits/stdc++.h> using namespace std; const int xi[] = {1, 1, 1, 0, 0, -1, -1, -1}; const int yi[] = {-1, 0, 1, -1, 1, -1, 0, 1}; int main() { int m, n; cin >> m >> n; char g[m][n]; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) cin >> g[i][j]; int u, v; for (int i... |
#include <bits/stdc++.h> using namespace std; long long int ans, sum, pro; string s, str; long long int solve(int st, int end, string z) { long long int sum2 = 0, pro2 = 1; for (int i = st; i <= end; i++) { if (z[i] == + ) { sum2 += pro2; pro2 = 1; } else if (i % 2 == 0) ... |
module InstName (/*AUTOARG*/
// Outputs
out,
// Inputs
in
);
input [7:0] in;
output [7:0] out;
wire [7:0] out = ~in;
endmodule // bottm
module top (/*AUTOARG*/
// Outputs
outgo,
// Input... |
`include "defines.v"
`define S_IDLE 3'b000
`define S_INST 3'b010
`define S_DATA 3'b011
`define S_SB_LOAD 3'b100
`define S_SB_STORE 3'b101
module memcontrol(
input wire clk,
input wire rst,
//Input
//Data from MEM
input wire[2:0] ramOp_i,
input wire[31... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const long long INF = 0x3f3f3f3f3f3f3f3fll; const int maxn = 1000010; const long long mod = 1e9 + 7; char str1[maxn], str2[maxn]; int ans[maxn]; long long L1[maxn], R1[maxn], L2[maxn], R2[maxn]; int main() { while (scanf( %s... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000 * 1000 * 1000 + 7; long long n, k; vector<long long> ans; long long positive(long long n) { n %= mod; (n < 0) && (n += mod); return n; } long long gcd(long long a, long long b, long long &x, long long &y) { if (a == 0... |
// Copyright (c) 2000-2009 Bluespec, Inc.
// 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, pub... |
/*
* 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 law... |
#include <bits/stdc++.h> using namespace std; int read() { int res = 0, p = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) p = -1; ch = getchar(); } while (isdigit(ch)) res = res * 10 + ch - 0 , ch = getchar(); return res * p; } const int mod = 1e9 + 7; int ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) using namespace std; const int mod1 = 1000000007; long long gcd(long long a, long long b) { long long c = a % b; while (c != 0) { a = b; b = c; c = a % b; } return b; } long long iss... |
#include <bits/stdc++.h> using namespace std; double a, v, d, w, l, ans, mid, t2, t; bool check(double maxv) { return d - ((maxv + w) / 2) * (((maxv - w) * 2) / a) > 1e-8; } int main() { scanf( %lf %lf %lf %lf %lf , &a, &v, &l, &d, &w); w = min(min(w, v), sqrt(2 * a * d)); if (2 * a * d + w * ... |
#include <bits/stdc++.h> using namespace std; int main() { int r, g, b, ck, maximum = 0, temp; scanf( %d %d %d , &r, &g, &b); if (r % 2 == 1) r++; r = r / 2; if (g % 2 == 1) g++; g = g / 2; if (b % 2 == 1) b++; b = b / 2; temp = 27 + r * 3; if (temp > maximum) maximum = temp;... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_b
//
// Generated
// by: wig
// on: Thu Apr 26 09:40:09 2007
// cmd: /home/wig/work/MIX/mix_0.pl -nodelta ../../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author: ... |
#include <bits/stdc++.h> using namespace std; int t, n, m; long long ans; int main() { scanf( %d%d , &n, &m); if (n == 1) ans = m; else if (m == 1) ans = n; else if (n == 2) ans = ((m / 4) * 2 + min(m & 3, 2)) * 2ll; else if (m == 2) ans = ((n / 4) * 2 + min(n & 3, 2)... |
#include <bits/stdc++.h> using namespace std; constexpr long long MOD = 1e9 + 7; long long cnt[710][710]; int a[500100]; int main() { int n; scanf( %d , &n); for (int ii = 0; ii < n; ++ii) { int t, x, y; scanf( %d%d%d , &t, &x, &y); if (t == 1) { a[x] += y; for (i... |
#include <bits/stdc++.h> using namespace std; void solve() { string s; cin >> s; map<char, long long> mp; for (long long i = 0; i < s.size(); i++) mp[s[i]]++; long long c = 0; for (auto it = mp.begin(); it != mp.end(); it++) { if (it->second & 1) c++; } if (c <= 1) cout <... |
#include <bits/stdc++.h> using namespace std; long long a, b, mod, sumz, sumy, sum, last, first, kol, z; long long run(long long x, long long step) { long long res = 1; while (step) { if (step & 1) res = (res * x) % mod; x = x * x % mod; step >>= 1; } return res % mod; } int ... |
#include <bits/stdc++.h> using namespace std; int main() { int test, a, sum = 0, wait = 0, counter = 0; priority_queue<int, vector<int>, greater<int> > q; queue<int> qqq; cin >> test; int num = test; while (test--) { cin >> a; sum += a; q.push(a); qqq.push(a); } ... |
#include <bits/stdc++.h> using namespace std; char s[200005], c; int a[200005]; int ans[26]; int main() { int n, k; int maxn = 0; cin >> n >> k; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n; i++) { if (s[i] == s[i - 1]) a[i] = a[i - 1] + 1; else ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:24:40 03/26/2015
// Design Name:
// Module Name: multiplier
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:32:20 04/26/2014
// Design Name:
// Module Name: dff2
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Re... |
#include <bits/stdc++.h> using namespace std; long long Gcd(long long a, long long b) { if (a % b == 0) return b; return Gcd(b, a % b); } long long Max(long long a, long long b) { if (a > b) return a; return b; } long long Min(long long a, long long b) { if (a < b) return a; return b... |
/*
* SPI_client.v client module
*
* SPI module with 16 byte buffer
* Addresses: 0 - data, 1 - control(write)/status(read)
* Control reg; bit 0 - ready to process, bit 7 - clear in/out buffers
* Status reg; CSn,0,0,master_rdy_i,outbound_full,outbound_empty,inbound_full,inbound_empty
* Part of the CPC... |
// Copyright (c) 2000-2011 Bluespec, Inc.
// 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, publ... |
#include <bits/stdc++.h> int main() { int i, j, l, x = 0; char s[100005]; gets(s); l = strlen(s); for (i = 0, j = l - 1; i < l / 2; i++, j--) { if (s[i] != s[j]) { x = 1; break; } } if (x == 1) { printf( NO n ); } else { for (i = 0; i < l; i++) {... |
/*
-- ============================================================================
-- FILE NAME : bus_slave_mux.v
-- DESCRIPTION : oXX[u}`vNT
-- ----------------------------------------------------------------------------
-- Revision Date Coding_by Comment
-- 1.0.0 2011/06/27 suito VK... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
... |
/*
* 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 a[2000005]; long long sum[2000005]; int main() { long long m, n, i, j, k, ans = 0; cin >> m; for (i = 1; i <= m; i++) scanf( %lld , &a[i]); sort(a + 1, a + 1 + m); for (i = m; i >= 1; i--) sum[i] = sum[i + 1] + a[i]; for (i = 1; i <... |
#include <bits/stdc++.h> using namespace std; template <class T> void minn(T& a, T b) { if (a > b) a = b; } template <class T> void maxx(T& a, T b) { if (a < b) a = b; } void debug() { return; } template <class H, class... T> void debug(H a, T... b) { cerr << a; debug(b...); } vo... |
#include <bits/stdc++.h> using namespace std; int n, m, a, b, fr, k1, k2; int dist[3005][3005]; bool flag[3005][3005]; vector<int> v[3005]; queue<int> q; int main() { scanf( %d %d , &n, &m); for (int i = 1; i <= m; i++) { scanf( %d %d , &a, &b); v[a].push_back(b); v[b].push_back(... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 2e5 + 5; int n, k, d, ansL = 1, ansR = 1, top1, top2; int a[MAXN], st1[MAXN], st2[MAXN]; map<int, int> lst; namespace SegmentTree { struct Tree { int l, r; int w, tag; } tree[MAXN << 2]; void update(in... |
`timescale 1 ns / 1 ps
//////////////////////////////////////////////////////////////////////////////////
// Company: AGH UST
// Engineer: Wojciech Gredel, Hubert Górowski
//
// Create Date:
// Design Name:
// Module Name: VgaTiming
// Project Name: DOS_Mario
// Target Devices: Basys3... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.1
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); int c = 0; for (int i = 0; i < n; i++) { if (i == 0 && a[0] > 0) { c++; } if (i > 0 && a[i] != 0 && a[i] ... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2011 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is distribut... |
#include <bits/stdc++.h> double p[1010][1010]; int a[1010]; int n, m; int main() { double t, ans; int i, j, x, y; scanf( %d%d , &n, &m); for (i = 1; i <= n; i++) scanf( %d , &a[i]); for (i = 1; i <= n; i++) for (j = 1; j <= n; j++) if (a[i] > a[j]) p[i][j] = 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... |
#include <bits/stdc++.h> using namespace std; int abs(int a, int b) { if (a > b) return a - b; else return b - a; } int main() { int n, c, i, b, count = 0, index1 = 1, index2 = 1, flag = 0; cin >> n >> c; char *s; s = new char[n + 2]; for (i = 1; i <= n; i++) { cin ... |
// $Id: c_shift_reg.v 1621 2009-10-28 04:33:50Z 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 of so... |
#include <bits/stdc++.h> const long long mod = 1e9 + 7; using namespace std; vector<int> par, rnk; void make_set(int n) { par[n] = n; rnk[n] = 0; } int find_set(int a) { if (par[a] == a) return a; return par[a] = find_set(par[a]); } void union_set(int a, int b) { a = find_set(a); ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int v1[10], v2[10]; int main() { memset(v1, 0, sizeof(v1)); memset(v2, 0, sizeof(v2)); int n; scanf( %d , &n); for (int i = 0, a; i < n; i++) { scanf( %d , &a); v1[a]++; } for (int i = 0, a; i < n; i++) ... |
#include <bits/stdc++.h> using namespace std; long long T, n, tempur; int t[105], l[105], h[105]; int main() { cin >> T; while (T--) { memset(t, 0, sizeof t); memset(h, 0, sizeof h); memset(l, 0, sizeof l); cin >> n >> tempur; int maxn = tempur, minn = tempur; for (in... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n, m; cin >> n >> m; char t[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> t[i][j]; } } bool check = true; int... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; const int MOD = 998244353; int fact[N], factinv[N]; int lgcput(int b, int p) { int a = 1; while (p) { if (p & 1) { a = (1LL * a * b) % MOD; } b = (1LL * b * b) % MOD; p /= 2; } return a; } i... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module fast_spi_rx_core #(
parameter ABUSWIDTH = 1... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2003 Matt Ettus
//
// 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 2 of the License... |
#include <bits/stdc++.h> using namespace std; string op; bool check(int l, int r) { char c; cout << ? << l << << r << endl; cin >> c; return c == x ; } int main() { while (cin >> op) { if (op == end ) { return 0; } int l = 1, r = 2; while (1) { ... |
`ifndef _MUX
`define _MUX
module mux16x8(data0, data1, data2, data3, data4, data5, data6, data7, selectInput, out); // 8-16bit-input mux
output reg [15:0] out;
input [15:0] data0, data1, data2, data3, data4, data5, data6, data7;
input [2:0] selectInput;
always@(data0 or data1 or data2 or data3 or data4 or da... |
#include <bits/stdc++.h> using namespace std; const int N = 200001; long long a[N + 1], tree[4 * N], lazy[4 * N]; void build(int idx, int l, int r) { if (l == r) tree[idx] = a[l]; else { int m = (l + r) / 2; build(2 * idx, l, m); build(2 * idx + 1, m + 1, r); tree[idx] = mi... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5; long long n, p, a[N], C[N], st, End; void in() { cin >> n >> p; for (long long i = 0; i <= n - 1; i++) cin >> a[i]; sort(a, a + n); } long long bns(long long lim) { long long low = 0, high = n - 1, res = -1; while... |
#include <bits/stdc++.h> using namespace std; using INT = long long; int n; int a[200010]; vector<int> B[200010]; void add(int u, int val) { for (; u <= n; u += u & -u) B[u].push_back(val); } int calc(int u, int val) { int ans = 0; for (; u; u -= u & -u) { int id = lower_bound(B[u].beg... |
///////////////////////////////////////////////////////////////////////////////
//
// Project: Aurora Module Generator version 2.8
//
// Date: $Date: 2007/09/28 12:50:35 $
// Tag: $Name: i+HEAD+134158 $
// File: $RCSfile: channel_error_detect.ejava,v $
// Rev: $Revision: 1.2 ... |
#include <bits/stdc++.h> using namespace std; int n, w, s, a[110]; int in[110], out[110]; int main() { scanf( %d%d , &n, &w); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); s += a[i]; } if (n == 1 && w == a[0]) { puts( Yes ); for (int i = 0; i < w * 2; i++) { p... |
#include <bits/stdc++.h> using namespace std; int n, tot; long long ans, sum; char s[100010], t[100010]; void print(int x, int opt) { tot++; printf( %d %d n , x, opt); if (tot == 100000) exit(0); } bool check(int i, int opt) { if (i == n) return 0; if (opt == -1) { if (s[i + 1] >... |
module RegisterTestBench;
parameter sim_time = 750*2; // Num of Cycles * 2
reg [31:0] test_in;
reg test_clk,test_reset,test_load;
wire [31:0] test_out;
Register test_reg(.IN(test_in),
.Clk(test_clk),
.Reset(test_reset),
.Load(test_load),
.OUT(test_out));
reg Clk,Reset;
/*
generate
genvar i... |
#include <bits/stdc++.h> using namespace std; using LL = long long; const int N = 100005; LL a[N]; int main() { int t; scanf( %d , &t); while (t--) { int n; LL sum = 0; LL x; scanf( %d%lld , &n, &x); LL q = n; for (int i = 1; i <= n; ++i) { scanf( %lld ,... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, l[N], r[N], id[N]; bool cmp(int x, int y) { return r[x] == r[y] ? l[x] < l[y] : r[x] < r[y]; } int main() { cin >> n; for (int x, w, i = 1; i <= n; ++i) { cin >> x >> w; l[i] = x - w, r[i] = x + w, id[i] = i; }... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.