text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; template <class Flow = long long, class Cost = long long> struct MinCostFlow { const Flow INF_FLOW = 1000111000; const Cost INF_COST = 1000111000111000LL; long long n, t, S, T; Flow totalFlow; Cost totalCost; vector<long long> last, visited; ... |
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long n) { if (a == 0) return 0; if (a == 1 || n == 0) return 1; if (n == 1) return a % 1000000007; long long t = power(a, n / 2); t = t * t % 1000000007; if (n & 1) return t * a % 1000000007; return t; } ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Iztok Jeras.
//bug991
module t (/*AUTOARG*/);
logic [31:0] array_assign [3:0];
logic [31:0] array_other [3:0];
logic [31:0] larray_assign [0:3];
logic [31:0] lar... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, p, c = 0; cin >> n >> k; vector<int> v; map<int, int> m; for (int i = 1; i <= n; i++) { cin >> p; v.push_back(p); m[p]++; } if (m[k] == 0) v.push_back(k), c++, n++; sort(v.begin(), v.end()); wh... |
/*
* 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... |
(** * Introduction *)
Set Warnings "-extraction-opaque-accessed,-extraction".
Set Warnings "-notation-overridden,-parsing".
From QuickChick Require Import QuickChick.
Require Import List ZArith. Import ListNotations.
(* ################################################################# *)
(** * A First Taste of Testi... |
/*
Copyright (c) 2014 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,... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; long long add(long long x, long long y, long long CMOD = MOD) { return (x + y + CMOD + CMOD) % CMOD; } long long mult(long long x, long long y, long long CMOD = MOD) { return add(x, 0) * add(y, 0) % CMOD; } long long fa... |
#include <bits/stdc++.h> using namespace std; int n, arr[101], color, maxi, mini = 101; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> color; for (int i = 0; i < n; i++) { cin >> arr[i]; mini = min(mini, arr[i]); maxi = max(maxi, arr[i]); } if (maxi - ... |
//==============================================================================
// Copyright (C) John-Philip Taylor
//
//
// This file is part of a library
//
// This file is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Fre... |
#include <bits/stdc++.h> const int MAXN = 100100; char S[MAXN]; char T[MAXN]; int aS[MAXN], aT[MAXN]; int bS[MAXN], bT[MAXN]; bool go() { int leftS, rightS, leftT, rightT; scanf( %d %d %d %d , &leftS, &rightS, &leftT, &rightT); int lengthS = rightS - leftS + 1; int lengthT = rightT - leftT +... |
#include <bits/stdc++.h> using namespace std; int v[2000]; int a, b, n, res; int main() { scanf( %d %d %d , &n, &a, &b); for (int i = 0; i < n; i++) scanf( %d , &v[i]); sort(v, v + n); int res = v[b] - v[b - 1]; cout << res << endl; } |
#include <bits/stdc++.h> using namespace std; int main(void) { int n; int answer = -1; long sum_x[2] = {0}; long sum_y[2] = {0}; int nr[2] = {0}; int i; scanf( %d n , &n); for (i = 0; i < n; i++) { int t, x, y; scanf( %d %d %d n , &t, &x, &y); if (t == 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; const int mo = (int)1e9 + 7; const int maxn = 1000010; int n; long long fac[maxn], ans; int a[maxn], num[maxn], num1[maxn], pos[maxn], mul[maxn]; int pre[maxn], ne[maxn]; vector<int> v[maxn]; inline void init() { fac[0] = 1; for (int i = 1; i <= n ... |
#include <bits/stdc++.h> using namespace std; const int N = 105; char mp[3][N], tmp[3][N], g[55][3][N]; bool vis[55][3][N]; int n, k; void getNext(int id) { memcpy(g[id], mp, sizeof(mp)); for (int i = int(0); i <= int((3) - 1); i++) for (int j = int(1); j <= int(n - 3); j++) tmp[i][j] = mp[i][... |
#include <bits/stdc++.h> using namespace std; long long int MOD = 1e9 + 7; const int N = 1e6 + 5, M = 1e5 + 10, NM1 = N - 1; long long int OO = 1e18 + 8; int oo = 1e9 + 8; void readFile() {} int n, m, l, r, x, top, arr[N], st[N]; long long int sum[N]; int main() { readFile(); scanf( %d , &n); ... |
// (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> using namespace std; pair<long long, long long> A[55]; double pos[55][55]; bool comp(pair<long long, long long> a, pair<long long, long long> b) { if (a.first > b.first) return 1; else if (a.first < b.first) return 0; else { return a.second <= b.second; ... |
#include <bits/stdc++.h> using namespace std; int GCD(int x, int y) { return !y ? x : GCD(y, x % y); } int LCM(int x, int y) { return x * y / GCD(x, y); } long long ceilDivision(long long dividend, long long divisor) { return (dividend + divisor - 1) / divisor; } bool check(pair<long long, int> right, p... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; int n, m; vector<int> liga[200100]; vector<int> adj[200100]; int state[200100]; int id[200100], sz[200100]; int vis[200200]; vector<int> top; int find(int x) { if (id[x] == x) return x; retur... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2000; int cubeta[MAXN + 2]; int color; int arr[MAXN + 2]; void mapea(int n) { set<int> nums; for (int i = 1; i <= n; i++) nums.insert(arr[i]); map<int, int> val; int cnt = 1; set<int>::iterator it = nums.begin(); while (i... |
#include <bits/stdc++.h> using namespace std; int main() { int n; int sa = 0, sb = 0; int ca, cb; char* c; int i = 0; scanf( %d , &n); c = (char*)malloc(sizeof(char) * n); while (n--) { scanf( %d %d , &ca, &cb); if (sb + cb > sa + 500) { sa = sa + ca; c[i+... |
// sigmadelta.v
// two channel second order sigma delta dac
// taken from Minimig
// audio data processing
// stereo sigma/delta bitstream modulator
module sd2_dac (
input clk, // bus clock
input [15:0] ldatasum, // left channel data
input [15:0] rdatasum, // right channel data
output reg left=0, // left b... |
`default_nettype none
module thinpad_top(/*autoport*/
//inout
base_ram_data,
ext_ram_data,
flash_data,
sl811_data,
dm9k_data,
//output
base_ram_addr,
base_ram_be_n,
base_ram_ce_n,
base_ram_oe_n,
base... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int lbracket = s.length(), rbracket = -1, lcolon = s.length(), rcolon = -1; for (int i = 0; i < s.length(); i++) if (s[i] == [ ) { lbracket = i; break; } for (int i = lbracket; i < s.lengt... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, i; scanf( %d%d , &n, &k); char s[n]; scanf( %s , s); for (i = 0; i < n; ++i) { if (s[i] == G ) { for (int j = i + k; j < n; j += k) { if (s[j] == # ) { printf( NO n ); return 0;... |
`timescale 1ns / 1ps
/*
-- Module Name: DES Sbox 8
-- Description: Sbox 8 del algoritmo DES
-- Dependencies: -- none
-- Parameters: -- none
-- Original Author: Héctor Cabrera
-- Current Author:
-- Notas:
-- History:
-- Creacion 05 de Junio 2015
*/
module des_sbox8
... |
// ==============================================================
// 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; int main() { int t; cin >> t; while (t--) { int n, m, k; cin >> n >> m >> k; int card_to_person = n / k; if (card_to_person >= m) { cout << m << n ; continue; } int tmp = (m - card_to_person) / (k - 1); ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n, m, k; int main() { cin >> n >> m >> k; cout << m * (m - 1) / 2 << endl; for (int i = 1; i <= m; i++) { for (int j = i + 1; j <= m; j++) { if (k) cout << j << << i << endl; else ... |
#include <bits/stdc++.h> using namespace std; char to_da(char c) { if (c >= A && c <= Z ) return c; else return c - 32; } char to_xiao(char c) { if (c >= A && c <= Z ) return c + 32; else return c; } int main() { string s; int a; while (cin >> s >> a... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; template <class T1, class T2> inline void remin(T1& a, T2 b) { a = min(a, (T1)b); } const int maxN = 1 << 18, maxTS = maxN * 2, INF = 1 << 30; vector<int> G[maxN]; int A[maxN], pat[maxN], whole[maxN], ile[maxN], sz[maxN], re... |
#include <iostream> #include <algorithm> #include <cstring> #include <string> #include <queue> typedef long long ll; using namespace std; int main() { // what is greedy? int T; cin >> T; while (T--) { int len, a, b; cin >> len >> a >> b; string s; cin >> s; if (b >... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0; bool t = false; char ch = getchar(); while ((ch < 0 || ch > 9 ) && ch != - ) ch = getchar(); if (ch == - ) t = true, ch = getchar(); while (ch <= 9 && ch >= 0 ) x = x * 10 + ch - 48, ch = getchar(); retu... |
#include <bits/stdc++.h> using namespace std; long long a[200000 + 1], b[200000 + 1]; int c[200000 + 1], t[200000 + 1]; int n, m, k, s; vector<pair<long long, int> > v; inline int check(int p) { int i; v.clear(); long long mna = (1LL << 62), mnb = (1LL << 62); for (i = 1; i <= p; 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; int n, m, k, d1[200005], d2[200005], ty, re1, re2, re3; long long s, a[200005], b[200005], te; vector<pair<long long, int> > v1, v2; vector<long long> v3; void bs(int lo, int up) { int mid = (lo + up) / 2; if (lo == up) { v3.clear(); for (int... |
#include <bits/stdc++.h> using namespace std; const long long N = 3e5; const long long P = 1e9 + 7; long long n; long long col[N], f[N], g[N]; vector<long long> a[N]; long long read(void) { long long s = 0, w = 0; char c = getchar(); while (!isdigit(c)) w |= c == - , c = getchar(); while ... |
`timescale 1ns / 1ps
// Name: WcaDownConverter_stimulus.v
//
// Copyright(c) 2013 Loctronix Corporation
// http://www.loctronix.com
//
// 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... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:256000000 ) using namespace std; int main() { int n; scanf( %d , &(n)); vector<int> v1(n), v2(n), v3(n); if (!(n % 2)) { printf( -1 n ); return 0; } for (int i = (0), endi = (n); i < endi; ++i) v1[i] = i; for (int i =... |
#include <bits/stdc++.h> double eps = 1e-9; using namespace std; int main() { std::ios::sync_with_stdio(false); int x, y, z, w, b, a; cin >> x >> y >> z >> w >> b >> a; cout << (2 * (2 * x + a + y) * (z + y) - (a * a + b * b + y * y + z * z)) / 2; return 0; } |
#include <bits/stdc++.h> using namespace std; using vec_i = vector<int>; using pii = pair<int, int>; using ll = long long; using vec_ii = vector<pii>; using vec_ll = vector<ll>; template <typename T> using vec = vector<T>; ll gcd(ll x, ll y) { ll m; while (y > 0) { m = x % y; x = y... |
#include <bits/stdc++.h> template <typename T> T power(T x, T y, T mod) { T res = 1; while (y > 0) { if (y & 1) res = (res * x) % mod; y /= 2; x = (x * x) % mod; } return res; } using namespace std; long long int a[2005][2005]; long long int d1[4005]; long long int d2[400... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_mul_cntl.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 an... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, x = 0; scanf( %d , &n); for (i = 2; i <= n / 2; i += 2) { if ((n - i) % 2 == 0 && i / 2 != (n - i) / 2) x++; } printf( %d n , x); } |
/*
* 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... |
module VGA_NIOS_CTRL ( // Host Side
iDATA,
oDATA,
iADDR,
iWR,
iRD,
iCS,
iRST_N,
iCLK, // Host Clock
// Export Side
VGA_R,
VGA_G,
VGA_B,
VGA_HS,
VGA_VS,
VGA_SYNC,
VGA_BLANK,
VGA_CLK,
iCLK_25 );
parameter RAM_SIZ... |
// (C) 2001-2016 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; int n, i, j, x; long long m, k, x1, u1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6; bool t = 0; int main() { cin >> x1 >> u1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4 >> x5 >> y5 >> x6 >> y6; m = (x2 - x1) * (y2 - u1); if (x3 < x2 && y3 < y2 && x4 > x1 && y4 > u... |
/*
* Copyright 2017 Google 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
#include <bits/stdc++.h> using namespace std; vector<int> x[100100], y[100100]; vector<int> p[100100], q[100100], v[100100], w[100100]; int a[100100], b[100100], c[100100]; map<pair<int, int>, int> mp; void solve() { mp.clear(); int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < m; i++) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long a, b; int cnt = 0; cin >> a >> b; long long d = abs(a - b); if (d % 10 == 0) { cout << d / 10 << endl; } else { cout << d / 10 + 1 << endl; } ... |
#include <bits/stdc++.h> using namespace std; int a[100005]; int t[400005]; int d[400005]; pair<int, int> p[305]; pair<int, int> cp[305]; int n; void build(int l, int r, int i) { d[i] = 0; if (l == r) t[i] = a[l]; else { int m = (l + r) / 2; int L = 2 * i; build(l, m,... |
#include <bits/stdc++.h> using namespace std; int ans = 0, n; int numDistDig(int n) { vector<int> arr(10, 0); while (n > 0) { arr[n % 10]++; n /= 10; } int ans = 0, i; for (i = 0; i < 10; i++) ans += (arr[i] > 0); return ans; } void dfs(int num) { if (num > 0 && num <= ... |
#include <bits/stdc++.h> using namespace std; int dp1[100010]; int dp2[100010]; int a[100010]; int main(int argc, char const *argv[]) { int n; cin >> n; for (int i = 1; i <= n; i++) { std::cin >> a[i]; } dp1[0] = 0; int sum = 0; for (int i = 1; i <= n; i++) { sum += a[i... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k; scanf( %lld , &n); scanf( %lld , &k); long long int i, j; long long int val = 0, val1 = 0, val2 = 1; for (i = 1; i < k; i++) { val = (val * 10) + 9; val2 = val2 * 10; } val1 = (val * 10) + 9; ... |
/*
Copyright (c) 2019 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,... |
#include <bits/stdc++.h> using namespace std; int main(void) { long double a, b, c, p, q, r; cin >> a >> b >> c; p = b * b - 4 * a * c; if (a == 0 && b == 0 && c == 0) cout << -1 << endl; else if (a == 0 && b == 0 && c != 0) cout << 0 << endl; else if (p < 0) cout << 0 << e... |
<%
var _ = core();
var ir = _.logic(4);
var len = _.logic(3);
var len = {
'??00': '0001',
'1?0?': '0001',
'0001': '0010',
'0010': '0100',
'0011': '1000'
};
%>
/*
module tail_length (${ _.get.list() });
${ _.get.ports() }
${ _.get.wires() }
${ _.get.body() }
*/... |
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; long long INF = 1e18; bool isPrime(long long n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (long long i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2)... |
`timescale 1ns/1ns
// $ iverilog fp16rmul.v fp16rmul_test.v
module FP16RMul_Test;
reg clk, rst;
reg [15:0] s0_arg_0;
reg [15:0] s0_arg_1;
wire s0_ret_0;
wire [4:0] s0_ret_1;
wire [4:0] s0_ret_2;
wire [11:0] s0_ret_3;
reg s1_arg_0;
reg [4:0] s1_arg_1;
reg [4:0] s1_arg_... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int n, m, k; cin >> n >> m >> k; vector<pair<long long int, long long int> > F(n), S(m); long long int maxDay = 0; for (long long int i = 0; i < n; i++) { ... |
// Example module that doesn't instantiate
module appendix1 (/*AUTOARG*/
// Outputs
z,
// Inputs
i
);
input i;
output z;
/*AUTOREG*/
// Beginning of automatic regs (for this module's undeclared outputs)
reg z;
// End of automatics
/*AUTOWIRE*/
// Beginning of automatic wires (... |
#include <bits/stdc++.h> using namespace std; long long dp[31][31]; long long solve(int n, int r) { if (n == r || r == 0) return 1; if (n < r) return 0; if (dp[n][r] != -1) { return dp[n][r]; } return dp[n][r] = solve(n - 1, r - 1) + solve(n - 1, r); } int main() { int t = 1; ... |
#include <bits/stdc++.h> using namespace std; int n, k, a[101], m, ans; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> k; if (k % 2) a[++m] = k; ans += k; } if (m == 0) { cout << 0 << endl; return 0; } if (m % 2 == 0) { sort(a + 1, a + m + ... |
#include <bits/stdc++.h> using namespace std; int n, arr[100005], diff[100005], prv[100005]; bool flag[100005]; vector<int> a, d; int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %d , arr + i); flag[arr[i]] = 1; } for (int i = 1; i <= n; ++i) { if (!flag[ar... |
/* lcd_tb.v */
`timescale 1ns/1ps
module lcd_tb();
reg clk;
reg rst;
wire sof;
wire [ 4-1:0] r;
wire [ 4-1:0] g;
wire [ 4-1:0] b;
wire [ 16-1:0] lcd_dat;
wire lcd_cs;
wire lcd_rs;
wire lcd_wr;
wire lcd_rd;
wire lcd_res;
//// c... |
`include "defines.v"
`timescale 1ns/1ps
module tb(
);
wire injrd, injack;
reg clk, rst;
reg `control_w flit0c;
reg `control_w flit1c;
reg `control_w flit2c;
wire `control_w port0_co, port1_co, port2_co, port3_co, port4_co;
brouter r(
.clk(clk),
.rst(rst),
... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int t, n, c_0, c_1, h; string s; cin >> t; for (int i = 0; i < t; i++) { cin >> n >> c_0 >> c_1 >> h; cin >> s; int sum = 0; for (int j = 0; j < n; j++) { sum += s[j] - 0 ; }... |
#include <bits/stdc++.h> using namespace std; void _print(int32_t t) { cerr << t; } void _print(int64_t t) { cerr << t; } void _print(string t) { cerr << t; } void _print(char t) { cerr << t; } void _print(long double t) { cerr << t; } void _print(double t) { cerr << t; } void _print(unsigned long long ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-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... |
#include <bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using pll = pair<ll, ll>; template <typename T1, typename T2> ostream &operator<<(ostream &out, const pair<T1, T2> &item) { out << ( << item.fi... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; if (m == 3 && n > 4) { cout << -1 << endl; return 0; } int cnt = 0, ans = 0; for (int i = 0; i < m; i++) printf( %d %d n , i, ans += (cnt++)); if (m < n) cout << m + 100000 << << ans << ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 150000 + 10; int len, n, h; int a[MAXN], b[MAXN]; int dp[1 << 20], all[1 << 20]; inline void go(int root, int lo, int hi, int s, int e, int key) { if (hi < s || e < lo) return; if (s <= lo && hi <= e) { all[root] += key; dp[r... |
#include <bits/stdc++.h> using namespace std; long long n, m, N, Left, Right; long long seg[2000001], vs[2000001]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; char grid[n + 1][m + 1]; vs[0] = 0; set<pair<long long, long long>> d; for (lo... |
/**
* 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; char a[100]; int main() { int i, l, c = 0; scanf( %s , a); l = strlen(a); for (i = 1; i < l; i++) { if (a[i] <= Z ) { c++; } } int t = 0; if (a[1] <= Z && c >= l - 1) t++; if (t != 0) { for (i = 0; i < l; i+... |
#include <bits/stdc++.h> using namespace std; const int MAX_L = 200; map<int, pair<int, int> > ds; int ops[MAX_L]; int powmod(int a, int n, int mod) { int pm = 1; while (n > 0) { if (n & 1) pm = (long long)pm * a % mod; a = (long long)a * a % mod; n >>= 1; } return pm; } ... |
#include <bits/stdc++.h> using namespace std; const int N = 21; int n; long long s, a[N], down = 1, ans; void exgcd(long long a, long long b, long long &x, long long &y) { if (b == 0) { x = 1, y = 0; return; } exgcd(b, a % b, y, x); y -= a / b * x; } long long inv(long long x) ... |
/*
* 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... |
// synthesis verilog_version verilog_2001
`timescale 1 ps / 1 ps
//-----------------------------------------------------------------------------
// Title : PCI Express Reference Design Example Application
// Project : PCI Express MegaCore function
//--------------------------------------------------------... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) using namespace std; int n, cnt; int ans[1005]; bool prime(int x) { for (int i = 2; i < x; i++) if (x % i == 0) return 0; return 1; } int main() { scanf( %d , &n); for (int i = 2; i <= n; i++) { if (... |
// -- (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
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01:42:41 03/22/2015
// Design Name: xor2
// Module Name: C:/Users/Joseph/Documents/Xilinx/HW1/prioencoder_test.v
// Project Name: HW1
// Target Device:
... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 100; int p[N]; vector<int> G[N]; int mn[N], mx[N], val[N], sum[N], s[N][2], c[N][2], fa[N], mp[N]; int head; void upd(int x) { sum[x] = sum[c[x][1]] + sum[c[x][0]] + val[x]; mn[x] = min(mn[c[x][0]], min(sum[c[x][0]] ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k = 0; cin >> n; int r[n]; for (int i = 0; i < n; ++i) { cin >> r[i]; if (r[i] % 2 == 1) ++k; } if (k % 2 == 0) cout << n - k; else cout << k; } |
#include <bits/stdc++.h> using namespace std; int ok[1 << 20]; int F[1 << 9][1 << 9]; int d[1 << 9]; int bfs(int n) { d[0] = 0; for (int i = 1; i <= n; ++i) d[i] = -1; queue<int> Q; Q.push(0); while (!Q.empty() && d[n] == -1) { int node = Q.front(); Q.pop(); for (int 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... |
module main_pll (
input inclk0,
output c0
);
wire [5:0] sub_wire0;
wire [0:0] sub_wire4 = 1'h0;
wire [0:0] sub_wire1 = sub_wire0[0:0];
assign c0 = sub_wire1;
wire sub_wire2 = inclk0;
wire [1:0] sub_wire3 = {sub_wire4, sub_wire2};
altpll altpll_component (
.inclk (sub_wire3),
.clk (sub_wire0),
.... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: thesis_new.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =============================... |
// Copyright (C) 2020-2021 The SymbiFlow Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier:ISC
//////////////////////////
// arithmetic //
//////////////////////////
(... |
//
// Generated by Bluespec Compiler, version 2013.12.beta1 (build 32746, 2013-12-02)
//
// On Thu Feb 27 22:22:33 CST 2014
//
//
// Ports:
// Name I/O size props
// RDY_start O 1
// result O 32 reg
// RDY_result O 1
//... |
//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 int MAXN = 105; struct ANS { int xa, ya, xb, yb, xc, yc; }; struct PRE { int p1, p2, s; } pre[MAXN][2][2]; int T, n, m; int a[MAXN][MAXN]; int f[MAXN][2][2]; char s[MAXN]; vector<ANS> ans; int popcount(int v) { return v ? popcount(v - (... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2) { cout << black << endl; } else { cout << white << n1 2 n ; } return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); 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]; } } long long l = 0, r = 1e9 + 1; i... |
#include <bits/stdc++.h> using namespace std; void solve() { string number; cin >> number; int n = number.length(); int answer; vector<vector<int> > remainders = { {}, {1}, {1, 2, 4, 3}, {1, 3, 4, 2}, {1, 4}}; int last_digit = number[n - 1] - 0 ; if (n == 1) { answer = (re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.