text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; long long MOD = 1000000007; long double EPS = 1e-9; long long binpow(long long b, long long p, long long mod) { long long ans = 1; b %= mod; for (; p; p >>= 1) { if (p & 1) ans = ans * b % mod; b = b * b % mod; } return ans; } voi... |
`ifndef _B_PREDICTOR_
`define _B_PREDICTOR_
module b_predictor (
input clk,
input rst,
input direct_mispredict,
input direct_resolved,
input branch_commit,
input [31:0] pc_head, // the pc of commit branch
input [31:0] pc_branch, // the pc of branch making predic... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<pair<long long, int> > vertices; bool cmp(pair<long long, int> x, pair<long long, int> y) { return x.first < y.first; } bool cmp2(pair<long long, pair<int, int> > x, pair<long long, pair<int, int> > y) { return x.first < y.fi... |
/*
* 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> #pragma GCC optimize(2) using namespace std; const int INF = 0x3f3f3f3f; const int GRAPH_SIZE = 20010; int pin[GRAPH_SIZE], dep[GRAPH_SIZE], s = 0, t = GRAPH_SIZE - 1; struct EDGE { int u, v, c; }; vector<EDGE> e; vector<int> each[GRAPH_SIZE]; bool bfs() { queue<int>... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_transition (clock, reset, enable, test_expr, start_state, next_state, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width =... |
//-----------------------------------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE ... |
/**
* 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... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2018 Miodrag Milanovic <>
* Copyright (C) 2012 Clifford Wolf <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this per... |
/*
* 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; vector<int> v, ans; void op(int i) { int x = v[i + 2]; v[i + 2] = v[i + 1]; v[i + 1] = v[i]; v[i] = x; if (ans.size() >= 2 && ans[ans.size() - 1] == i + 1 && ans[ans.size() - 2] == i + 1) ans.pop_back(), ans.pop_back(); else ... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int n, s[3000 + 5], c[3000 + 5], f[3000 + 5][5]; inline int read() { int s = 0, w = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= ... |
#include <bits/stdc++.h> const int MAXN = 5; const double eps = 1e-4; struct node { double x, y; node(double x = 0, double y = 0) : x(x), y(y) {} inline bool operator<(const node &rhs) const { if (fabs(x - rhs.x) >= eps) return x < rhs.x; if (fabs(y - rhs.y) >= eps) return y < rhs.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... |
/**
* 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 vgaSync(clk, rst, hsync, vsync, video_on, p_tick, pixel_x, pixel_y);
input clk, rst;
output hsync, vsync, video_on, p_tick;
output [9:0] pixel_x, pixel_y;
// constant declaration
// VGA 640-by-480 sync parameters
parameter HD = 640; // horizontal display area
parameter HF = 48; // h. front (left) border
para... |
#include <bits/stdc++.h> using namespace std; int a[100010]; int b[15]; bool cmp(int x, int y) { if (x == 100 || y == 100) return x < y; else return x % 10 > y % 10; } int main() { int n, k; b[0] = 0; for (int i = 1; i <= 10; i++) b[i] = b[i - 1] + 10; while (scanf( %d%d ... |
//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 associate... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; inline int get_power(int a, int n) { int res = 1; while (n > 0) { res = n & 1 ? 1ll * res * a % mod : res; a = 1ll * a * a % mod; n >>= 1; } return res; } inline int get_inv(int x) { return get_power(x, ... |
//-----------------------------------------------------------------------------
// Copyright (C) 2009 OutputLogic.com
// This source file may be used and distributed without restriction
// provided that this copyright statement is not removed from the file
// and that any derivative work contains the original copyr... |
#include <bits/stdc++.h> using namespace std; long long n; int m; const long long mod = 1e9 + 7; struct Mat { long long mat[111][111]; } st, ed; long long stt[111][111]; void init() { memset(stt, 0, sizeof(stt)); stt[0][0] = stt[0][m - 1] = 1; for (int i = 1; i < m; ++i) stt[i][i - 1] = ... |
#include <bits/stdc++.h> using namespace std; int x[1000 + 1], y[1000 + 1]; void solve() { int n; cin >> n; for (int i = 0; i < n + 1; i++) cin >> x[i] >> y[i]; int res = 0; for (int i = 1; i < n; i++) { double X = x[i], Y = y[i]; int cnt = 0; if (x[i - 1] == x[i]) { ... |
#include <bits/stdc++.h> using namespace std; inline int readint() { int x = 0; bool f = 0; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) { f = 1; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - 0 ; c = getchar(); } ... |
#include <bits/stdc++.h> using namespace std; int cnt[26]; void sol() { int n; cin >> n; for (int i = 0; i < n; i++) { long long k, x; cin >> k >> x; cout << (x + (k - 1) * 9) << n ; } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { int arr[100005]; for (int i = 1; i <= n; i++) { cin >> arr[i]; } long long cnt = 0; for (int i = 1; i < n; i++) { long long x = log2(n - i); arr[i + (1 << x)] += arr[i];... |
#include <bits/stdc++.h> using namespace std; template <class T> typename T::value_type arr_sum(const T& v, int n) { typename T::value_type sum = 0; for (int i = 0; i < n; ++i) sum += v[i]; return sum; } struct Sync_stdio { Sync_stdio() { cin.tie(NULL); ios_base::sync_with_stdio(fa... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T read(register T& t) { register T f = 1; register char ch = getchar(); t = 0; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -f; ch = getchar(); } while (ch >= 0 && ch <= 9 ) t = t * 10 + ch - 0 ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { long long r; while (b != 0) { r = a % b; a = b; b = r; } return a; } long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } int const nmax = 1010; int k, n; vector<pair<... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000 + 10; const int MAXM = 10000 + 10; const int INF = 1000 * 1000 * 1000; int n, m, a[MAXM], b[MAXM], c[MAXM], q[MAXN], d[MAXN][MAXN], s, minimum[MAXN]; int main() { int check = 0; int sum = 0; int pt = 0; cin >> n; for (in... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
* adjusted to FML 8x16 by Zeus Gomez Marmolejo <>
* updated to include Direct Cache Bus by Charley Picker <>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public Lic... |
// Copyright 2020 The XLS 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
#include <bits/stdc++.h> using namespace std; int gcd(int p, int q) { return q == 0 ? p : gcd(q, p % q); } char s[100100]; long long res[2][2]; int main() { cin >> s; int len = strlen(s); memset(res, 0, sizeof(res)); long long a = 0, b = 0; for (int i = 0; i < len; i++) { int temp = ... |
#include <bits/stdc++.h> using namespace std; const long long int m = pow(10, 9) + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s, t; cin >> s >> t; int j = 0, l = -1, r = -1; for (int i = 0; i < t.length(); i++) { if (s[j] == t[i]) j++; if (j == s.le... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if (k > n) cout << k; else for (int i = 2;; i++) { if (k * i > n) { cout << k * i; break; } } return 0; } |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const long long mod = 1e9 + 7; const long long N = 1e5 + 10; inline long long add(long long x, long long y) { x += y; if (x >= mod) x -= mod; return x; } inline long long mul(long long x, long long y) { x = (1LL * x ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:08:01 02/19/2016
// Design Name: tp_final
// Module Name: /home/poche002/Desktop/ArqComp/Trabajo_final/arquitectura_tpf/tp_final_tb.v
// Project Name: arquitectur... |
#include <bits/stdc++.h> using namespace std; int p[1001][1001], row[1001], col[1001]; int main() { int n, m, k; scanf( %d%d%d , &n, &m, &k); for (int r = 1; r <= n; ++r) row[r] = r; for (int c = 1; c <= m; ++c) col[c] = c; for (int r = 1; r <= n; ++r) for (int c = 1; c <= m; ++c) scanf(... |
// 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;
reg signed [20:0] longp;
reg signed [20:0] longn;
reg signed [40:0] quadp;
reg signe... |
/*
* Copyright (C) 2011 Kiel Friedt
*
* 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 version.
*
* This p... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; int a, b, c, d, i, j, n, m, k, g, s; long long ans; pair<pair<int, int>, pair<int, int> > edges[50001]; vector<int> sm[201]; int cs[201][201]; pair<int, int> cur[201]; bool found; bool used[201]; inline void r... |
#include <bits/stdc++.h> using namespace std; int ask(int i, int j) { cout << ? << i << << j << endl; fflush(stdout); int val; cin >> val; return val; } int main() { int n; cin >> n; int a[n + 1]; int index = 1, i, x, y; for (int i = 2; i <= n; i++) { x = ask... |
#include <bits/stdc++.h> using namespace std; int n, m; int a[107]; map<string, int> f; vector<pair<int, string>> b; bool cmp(pair<int, string> u, pair<int, string> v) { return u.first > v.first; } int main() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= m; i+... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: scbuf_fbd.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/or
... |
//---------------------------------------------------------------------------
//-- Copyright 2015 - 2017 Systems Group, ETH Zurich
//--
//-- This hardware module 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 ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:36:46 09/06/2015
// Design Name:
// Module Name: FPU_Multiplication_Function
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// ... |
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-10; int n, q, t; double plc[500005], ans[500005]; struct Point { long double x, y; Point() {} Point(long double _x, long double _y) { x = _x, y = _y; } Point operator+(Point p) { return Point(x + p.x, y + p.y); } } P[50... |
// (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 = 1LL << 28; const long long mod = 1LL; int arr[3 * 100010]; int main() { int n, k, i, ans, flag, j; while (scanf( %d %d , &n, &k) == 2) { for (i = 0; i < n; i++) { scanf( %d , &arr[i]); } sort(arr, arr + n); ... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n; cin >> t; string s; for (int i = 0; i < t; i++) { cin >> n; cin >> s; int k = 0; if (n % 2 == 0) { for (int i = 1; i < n; i += 2) if ((int(s[i]) - 48) % 2 == 0) { k = 1; ... |
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9; const long long linf = (long long)1e18; const double eps = (double)1e-8; const int mod = (int)1e9 + 7; const int maxn = (int)3e5 + 5; int n, m; vector<int> a[maxn]; int fl; int c[maxn]; vector<int> ta, tb; set<pair<int, int>... |
#include <bits/stdc++.h> using namespace std; const int N = 200100; const long long OO = 1e18; const int oo = 2e9; const int md = 998244353; set<int> st; set<int>::iterator ite; int sto, n, p[N], obr = 1, ans = 0, mul[N], q, psm[N]; bool mrk[N]; int mult(int x, int y) { return (1ll * x * y) % md; } ... |
#include <bits/stdc++.h> using namespace std; const int order[3][4] = {{0, 1, 2, 3}, {0, 2, 3, 1}, {0, 3, 1, 2}}; long long solve(long long n) { long long four = 1; while (four * 4 <= n) { four *= 4; } int part = (n - 1) % 3; n -= four; n /= 3; long long res = four * (part + 1); ... |
#include <bits/stdc++.h> using namespace std; long long x; int n, d; int res[100010], a[100010], b[100010]; long long getNextX() { x = (x * 37 + 10007) % 1000000007; return x; } void initab() { for (int i = 0; i < n; i++) { a[i] = i + 1; } for (int i = 0; i < n; i++) { swap... |
/*
* 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 arr[4]; int t = 0; int s = 0; for (int i = 0; i < 4; i++) cin >> arr[i]; for (int m = 0; m < 4; m++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { if (arr[m] < arr[j] + arr[k] && arr[j] < arr[m... |
#include <bits/stdc++.h> using namespace std; struct node { int to, u, w; } edge[200000]; struct data { int x, y, w, d; } v[200010]; int k = 1, f[200000], low[200010], dfu[200010], n, m, ans[200010], head[200010], cnt, l; bool vis[200010]; void add(int x, int y, int z) { edge[k].u = y;... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); int maxar(int arr[], int n) { int res = arr[0]; for (int i = 0; i < n; i++) { res = max(res, arr[i]); } return res; } long long maxar(long long arr[], long long n) { long long res = arr[0]; for (long long... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:19:34 03/05/2017
// Design Name:
// Module Name: MUX32
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// R... |
/*
* 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... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`ifdef OVL_SHARED_CODE
reg window = 0;
always @ (posedge clk) begin
if (`OVL_RESET_SIGNAL != 1'b0) begin
if (!window && start_event == 1'b1)
window <= 1'b1;
else if (wi... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const int32_t M = 1e9 + 7; const int32_t MM = 998244353; long long m, n; void solve() { cin >> n >> m; bool visited[n + 5]; memset(visited, 0, sizeof(visited)); for (long long i = 0; i < m; i++) { long long a, b,... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:49:40 01/18/2017
// Design Name: right_barrel_shifter
// Module Name: /home/aaron/Git Repos/CSE311/lab1/right_barrel_shifter_tb.v
// Project Name: lab1
// Target ... |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
/********************************************/
/* qmem_bridge.v */
/* QMEM 32-to-16 bit async bridge */
/* */
/* 2013, */
/********************************************/
module qmem_bridge #(
parameter MAW = 22,
parameter ... |
#include <bits/stdc++.h> using namespace std; const int INF = 2e9 + 10; const int MOD = 1e9 + 7; const int N = 1e6 + 10; int n, k, m; string x, y, z; int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); cin >> x >> y; n = x.length(); int ans = 1; for (int i = 0; ... |
#include <bits/stdc++.h> using namespace std; vector<int> tree[2010]; int cs[2010], ps[2010]; int numDesc(int node) { int descendants = 0; for (int x : tree[node]) { descendants += 1 + numDesc(x); } if (descendants < cs[node]) return 10000; return descendants; } void solve(int node... |
#include <bits/stdc++.h> using namespace std; const int maxn = 151; const int inf = 0x7f7f7f7f; const int mod = (int)(1e9 + 7); const long long INF = 0x7f7f7f7f7f7f7f7fLL; const double eps = 1e-8; const double pi = acos(-1.0); const int mask = 65535; int a[maxn]; int b[maxn]; void handle(int a[], ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; bool used[n]; for (int i = 0; i <= n - 1; i++) used[i] = false; int a = 0, b = n - 1; for (int i = 0; i <= k - 1; i++) { if (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 la... |
#include <bits/stdc++.h> using namespace std; int a[200001]; bool b[200001]; int main() { string s1, s2; int n, i; cin >> s1 >> s2; n = s1.size(); for (i = 1; i <= n; i++) cin >> a[i]; int l, r, mid, pr = 0, j; l = 0; r = n; while (l != r) { mid = (l + r + 1) / 2; ... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
#include <bits/stdc++.h> using namespace std; const int N = 2005; int arr[N][N], n; vector<int> adj[N], revAdj[N]; bool visited[N]; vector<int> vec; void dfs(int v) { visited[v] = 1; for (auto i : revAdj[v]) if (!visited[i]) dfs(i); vec.push_back(v); } void dfs2(int v) { visited[... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, num, maxs = INT_MIN, mins = INT_MAX, mins2 = INT_MAX; cin >> n >> m; vector<int> v1; vector<int> v2; for (int i = 0; i < n; i++) { cin >> num; v1.push_back(num); maxs = max(maxs, num); mins2 = min(mins2,... |
/**
* 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() { string x; cin >> x; long long step[101]; step[0] = 1; for (int i = 1; i < 101; i++) step[i] = (step[i - 1] * 2) % ((int)1e9 + 7); long long ans = 0; for (int i = 0; i < x.size(); i++) if (x[i] == 1 ) ans = (ans + step[x.si... |
/**
* 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 (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 ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; char s[200]; int main() { int T; scanf( %d , &T); for (int t = 1; t <= T; t++) { bool num = 0, xx = 0, dx = 0; vector<int> res; scanf( %s , s + 1); int len = strlen(s + 1); for (int i = 1; i <= len; 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... |
/**
* 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 law... |
#include <bits/stdc++.h> using namespace std; int used[550][550]; int main() { int x, y; int x0, y0; cin >> x >> y; cin >> x0 >> y0; string s; cin >> s; int cnt = 0; cout << 1 << ; int last = x * y - 1; for (int i = 0; i < s.size(); i++) { used[x0][y0] = 1; b... |
#include <bits/stdc++.h> using namespace std; struct node { string name; int id; int taxi, pizza, girl; } arr[105]; int cmp1(node a, node b) { if (a.taxi == b.taxi) return a.id < b.id; return a.taxi > b.taxi; } int cmp2(node a, node b) { if (a.pizza == b.pizza) return a.id < b.id; ... |
/*###########################################################################
# Function: Single port memory wrapper
# To run without hardware platform dependancy use:
# `define TARGET_CLEAN"
############################################################################
*/
module memory_sp(/*AU... |
`include "elink_constants.v"
module etx_io (/*AUTOARG*/
// Outputs
txo_lclk_p, txo_lclk_n, txo_frame_p, txo_frame_n, txo_data_p,
txo_data_n, tx_io_wait, tx_wr_wait, tx_rd_wait,
// Inputs
reset, tx_lclk, tx_lclk90, txi_wr_wait_p, txi_wr_wait_n,
txi_rd_wait_p, txi_rd_wait_n, tx_packet, tx_access, tx_bu... |
#include <bits/stdc++.h> using namespace std; void computeLcp(string &s1, string &s2, int LCP[][5005]) { for (int i = ((int)s1.size()) - 1; i >= 0; i--) { for (int j = ((int)s2.size()) - 1; j >= 0; j--) { if (s1[i] == s2[j]) { LCP[i][j] = 1 + LCP[i + 1][j + 1]; } else { ... |
module IMUL
(
input wire [3:0] A,
input wire [3:0] B,
output reg [7:0] out
);
reg rC1, rC2, rC3; //registros para los llevos
reg [2:0] rT1, rT2; //registros temporales
always @ (*) begin
//R0
out[0] =A[0] & B[0];
//R1
{rC1, out[1]} = (A[0] & B[1]) + (A[1] & B[0]);
//R2
{rC1, rT1[0]} = (A[2] & B[0]) + (A[1] & B[1])... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6; int lp[N + 1]; vector<int> pr; int i, j, p1, p2, x0, x1, x2, ans; int main() { for (i = 2; i <= N; i++) { if (lp[i] == 0) { lp[i] = i; pr.push_back(i); } for (j = 0; j < pr.size() && pr[j] <= lp[i] && i * ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; const int M = 1e9 + 7; long long a[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long d; cin >> a[0] >> a[1] >> a[2] >> d; sort(a, a + 3); cout << max(0ll, a[0] - a[1] + d)... |
#include <bits/stdc++.h> using namespace std; long long k, n, a, b, val; void solve() { cin >> k >> n >> a >> b; k -= a * n; if (k <= 0) { k *= -1, k++; val = (k + a - b - 1) / (a - b); if (val > n) { cout << -1 << endl; return; } n -= val; } cout ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<pair<string, int>> v(n); for (int i = 0; i < n; i++) { string s; cin >> s; v[i].first = s; v[i].second = i + 1; } for (int i = 0; i ... |
#include <bits/stdc++.h> using namespace std; int p[111]; int main() { int n, a = 0, b = 0, c = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> p[i]; if (i < 3 && i == 1 || i % 3 == 1) { a = a + p[i]; } else if (i < 3 && i == 2 || i % 3 == 2) { b = b + p[i]; ... |
// (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> const int N = 1e6; const int M = 2e5 + 10; const int mod = 1e9 + 7; long long n, a[M], cnt[N], cnt2[N], sol[N]; long long brzo_stepenovanje(long long x, long long k) { if (k == 0) return 1; if (k == 1) return x; if (k % 2) return (x * brzo_stepenovanje((x * x) % mod,... |
`default_nettype none
module main (input wire clk,
input wire sw_in,
output wire sw_out);
//-- Configure the pull-up resistors for clk and rst inputs
wire sw_in2, sw;
SB_IO #(
.PIN_TYPE(6'b 1010_01),
.PULLUP(1'b 1)
) io_pin (
.PACKAGE_PIN(sw_in),
.D_IN_0(sw_in2)
);
//-- Sw... |
// Copyright (C) 2021 JacderZhang // // 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 version. // // This progra... |
#include <bits/stdc++.h> using namespace std; signed main() { long long n, m; cin >> n >> m; string s[n], v[n], a[n], o[n], b[n]; bool t[n]; string buf; for (long long i = 0; i < n; i++) { cin >> s[i]; cin >> buf; cin >> buf; t[i] = isdigit(buf[0]); if (t[i]) ... |
// ======================================================================
// CBC-DES encryption/decryption
// algorithm according to FIPS 46-3 specification
// Copyright (C) 2013 Torsten Meissner
//-----------------------------------------------------------------------
// This program is free software; you can redistri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.