source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include<iostream> #include<cstdio> #include<cstring> #include<stack> #include<algorithm> #include <fstream> #include<vector> #include<queue> #include<cmath> #include<map> #include<set> #include<unordered_map> #include<unordered_set> #define ll long long using namespace std; const int INF=0x3f3f3f3f; const double pi=ac...
C++
9a7e6c494ff7d161c92632569a6ecbef
18e16906ea900d55336e8338d99d034c
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define MX 2005 #define MM 1000005 int a[MX], b[MX], c[MX], d[MX], val[MM]; int main() { int N, M; cin >> N >> M; for(int i = 0; i < N; i ++) cin >> a[i] >> b[i]; for(int i = 0; i < M; i ++) cin >> c[i] >> d[i]; for(int i = 0; i < N ; i ++) for(int j = 0; j < M; j ++) ...
C++
9a7e6c494ff7d161c92632569a6ecbef
3fb9744071293d75516cb4b65f739f44
2,000
PASSED
#include<bits/stdc++.h> using namespace std; int a[2222], b[2222], v[1000005], cc[2222], dd[2222], c[2222], d[2222]; int main(){ ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); int n, m, md = 0, mc = 0; cin >> n >> m; for(int i = 0; i < n; i ++) cin >> a[i] >> b[i]; for(int i = 0; i < m; i ++) cin >> c[i] >> d...
C++
9a7e6c494ff7d161c92632569a6ecbef
14ee3d4fc80ce5bf679df1e157574e48
2,000
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse2") #include <bits/stdc++.h> #include <vector> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define i...
C++
9a7e6c494ff7d161c92632569a6ecbef
606c3929cd5b0b85fe8490b7bfc5e57d
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long multiset < int > allY; multiset< int > li[1000001]; int32_t main(){ int n,m; cin>> n >> m; vector< pair< int ,int > > robbers(n); for(int i=0; i<n; i++) { cin>>robbers[i].first >> robbers[i].second; } vector< pair <in...
C++
9a7e6c494ff7d161c92632569a6ecbef
45b1feff9ac719944f9365d9f23f61b1
2,000
PASSED
using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Text; class Template { static string inputFileName = "../../input.txt"; static StreamReader fileReader; static string[] inputTokens; static int curInputTokenIndex; static boo...
C#
6590c99e35f6f65e1b1bbd4f5bdca43a
d08f36b205ff5501b281e5f579d19f74
1,500
PASSED
using System; using System.Linq; using System.Diagnostics; using System.Collections.Generic; using Debug = System.Diagnostics.Debug; using StringBuilder = System.Text.StringBuilder; using System.Numerics; namespace Program { public class Solver { public void Solve() { var n = sc.In...
C#
6590c99e35f6f65e1b1bbd4f5bdca43a
0af8ada4ab35e6338317f321cf72500d
1,500
PASSED
using System; using System.Collections.Generic; using System.Linq; namespace Olymp { public class ProblemSolver { public void Solve() { string[] input = Console.ReadLine().Split(); int n = int.Parse(input[0]); int k = int.Parse(input[1]); int l = 0; int c = 0; for (int...
C#
6590c99e35f6f65e1b1bbd4f5bdca43a
a24375234482ac579105ac4892fd3ed1
1,500
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Globalization; namespace Codeforces310_A { class ContestIO : IDisposable { const int BufferSize = 1024 * 8; const string DefaultFileName = "input.txt"; StreamReader reader; StreamWriter write...
C#
6590c99e35f6f65e1b1bbd4f5bdca43a
735cbbc99bd58a6afca478198c608515
1,500
PASSED
using System; using System.IO; using System.Text; namespace Case_of_Matryoshkas { internal class Program { private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10); private static readonly StreamWriter writer = new Strea...
C#
6590c99e35f6f65e1b1bbd4f5bdca43a
fcb5f71394059ca01622920bf84da423
1,500
PASSED
using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; class Program { static void Main(string[] args) { int[] q1 = Console.ReadLine().Split(' ').Select(t => Int32.Parse(t)).ToArray(); int N = q1[0]; int K = q1[1]; int disasmStep...
C#
6590c99e35f6f65e1b1bbd4f5bdca43a
0a45cf86cecf4948ec100c3702b029c3
1,500
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Text.RegularExpressions; using System.IO; using System.Numerics; using System.Globalization; using System.Threading; namespace probleme { class Program { static void Main(strin...
C#
6590c99e35f6f65e1b1bbd4f5bdca43a
dae0ac3d37e88ccc2cb0e5b05f82e188
1,500
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Matreshka { class Program { static List<int[]> tmp = new List<int[]>(); static int time = 0; static void Main(string[] args) { string[] arr =...
C#
6590c99e35f6f65e1b1bbd4f5bdca43a
f1cdafdb7d63f6266644c8a8a113871c
1,500
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Matreshka { class Program { static void Main(string[] args) { List<int[]> tmp = new List<int[]>(); int time = 0; string[] arr = Conso...
C#
6590c99e35f6f65e1b1bbd4f5bdca43a
b095c27ad6f8a726f755256a69870861
1,500
PASSED
using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Threading; // (づ°ω°)づミ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜ public class Solver { void Solve() { int n = ReadInt(); int m = ReadInt(); for (int i = 0; i...
C#
6590c99e35f6f65e1b1bbd4f5bdca43a
7f6ca7b980ef6e3b2f11e41312838f30
1,500
PASSED
# https://codeforces.com/contest/1228/problem/D # all neightbor in group --> pass 1 # all neighbor not in group --> merge 0 # invalid 2 # WA def type_(list_v, group): cnt_0 = 0 cnt_1 = 0 for v in list_v: if v in group: cnt_1 += 1 else: cnt_0 += 1 ...
Python
7dea96a7599946a5b5d0b389c7e76651
9c372f74ccc3656797e5d61fdee09156
1,900
PASSED
n, m = map(int, input().split()) G = [[] for _ in range(n)] for i in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) if len(G[0]) < 2: print(-1) exit(0) res = [1]*n for a in G[0]: res[a] = 2 a2 = G[0][0] for b in G[a2]: if res[b] == 2: res[b] = 3 sizes = [n-len(G[0]), n...
Python
7dea96a7599946a5b5d0b389c7e76651
9ade06720cb330fd0a2c211b9186874b
1,900
PASSED
n, m = map(int, input().split()) neigh = [set() for i in range(n+1)] total = set(range(1, n+1)) for i in range(m): a, b = map(int, input().split()) neigh[a].add(str(b)) neigh[b].add(str(a)) for i in range(len(neigh)): neigh[i] = frozenset(neigh[i]) numbers = dict() count = 0 r = [] for i in neigh[1:]: ...
Python
7dea96a7599946a5b5d0b389c7e76651
b037c49b2c3579dc5604663fcdf0e240
1,900
PASSED
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline class UnionFind: def __init__(self, N): self.parent = [i for i in range(N)] self.size = [1 for _ in range(N)] def find(self, x): if self.parent[x] == x: return x else:...
Python
7dea96a7599946a5b5d0b389c7e76651
7b48d40c2e60a532177472b162309d37
1,900
PASSED
import collections from collections import defaultdict graph1=defaultdict(list) n,m=map(int,input().split()) groups=[0]*(n) for i in range(m): u,v=map(int, input().split()) graph1[u].append(v) graph1[v].append(u) index=[0,0,0,0] for i in graph1: for j in (graph1[i]): if groups[j-1]==groups[i-1]:...
Python
7dea96a7599946a5b5d0b389c7e76651
dbdab7c8e309e3306f142cce2f2694ed
1,900
PASSED
import collections from collections import defaultdict graph1=defaultdict(list) n,m=map(int,input().split()) groups=[0]*(n) for i in range(m): u,v=map(int, input().split()) graph1[u].append(v) graph1[v].append(u) index=[0,0,0,0] for i in graph1: for j in (graph1[i]): if groups[j-1]==groups[i-1]:...
Python
7dea96a7599946a5b5d0b389c7e76651
593f39df1eb11aff9472850104749489
1,900
PASSED
n,m = map(int, input().split()) ad = [[] for _ in range(n)] es = [] for _ in range(m): v,u = map(int, input().split()) v-=1 u-=1 es.append((min(v,u),max(v,u))) es = sorted(es, key=lambda x: (x[0], x[1])) for e in es: v, u = e ad[v].append(str(u)) ad[u].append(str(v)) ad = [''.join(a) fo...
Python
7dea96a7599946a5b5d0b389c7e76651
fd16b8f9403edce183aa20460a995f91
1,900
PASSED
# -*- coding:utf-8 -*- """ created by shuangquan.huang at 1/16/20 """ import collections import time import os import sys import bisect import heapq from typing import List def solve(N, M, g): if M < N - 1: print(-1) return mark = [1 for _ in range(N+1)] mark[1] = 1 mark[0] = ...
Python
7dea96a7599946a5b5d0b389c7e76651
85b55ea819d92f243f654529618b7ba2
1,900
PASSED
import sys n, m = [int(x) for x in input().split()] d = {i: [] for i in range(n)} for _ in range(m): ai, bi = [int(x) for x in input().split()] d[ai-1].append(bi-1) d[bi-1].append(ai-1) # All vertices WITHOUT an edge from 0 will be component A: #A = set(range(n)) - set(d[0]) which_set = [None for _ in range(n...
Python
7dea96a7599946a5b5d0b389c7e76651
9bd4ea250891ade87ad01ed2e8ad0960
1,900
PASSED
try: from string_source import string_source except ImportError: source = input from collections import defaultdict def complete_bipartite(n, edges): if not edges: return False neighbors = defaultdict(set, {}) for e1, e2 in edges: neighbors[e1].add(e2) neighbors[e2].add(...
Python
7dea96a7599946a5b5d0b389c7e76651
ef88c762158dc9e21e2b09673b944c9c
1,900
PASSED
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <algorithm> #include <math.h> #include <queue> #include <stack> #include <string> #include <string.h> #include <map> #include <vector> #include <fstream> using namespace std; #define N 200300 #define M 1001000 //#define MAXN 1125899906842624L #define M...
C++
93431bdae447bb96a2f0f5fa0c6e11e0
59a3752a948d679b4c2f5861588d75ed
1,600
PASSED
#include <iostream> using namespace std; typedef long long value_t; const int N = 200005; const value_t mod = 998244353; // Arrays values = [ 1; 1000000 ] value_t a[N]; int b[N]; int cmp_a(const void *a, const void *b) { value_t aa = *(const value_t *)(a); value_t bb = *(const value_t *)(b); return aa == bb ? 0...
C++
93431bdae447bb96a2f0f5fa0c6e11e0
81a9cee6b75e00ab0fcc63240d4d65b0
1,600
PASSED
n = int(input()) print(sum(a*b for a,b in zip(sorted(x*i*(n-i+1) for i,x in enumerate(map(int,input().split()),1)),sorted(map(int,input().split()),reverse=True)))%998244353)
Python
93431bdae447bb96a2f0f5fa0c6e11e0
86cf2517c915fbd26deb68d9d535f2cd
1,600
PASSED
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) for i in range(n): a[i] = a[i]*(i+1)*(n-i) a.sort() b.sort(reverse=True) res = 0 for i in range(n): res += a[i]*b[i] print(res % 998244353)
Python
93431bdae447bb96a2f0f5fa0c6e11e0
472601bd3e6d7dbd4d60cc79c378aec0
1,600
PASSED
N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) for i in range(N): a[i] = a[i]*(N-i)*(i+1) a1 = [(a[i], i) for i in range(N)] a1.sort(key=lambda x: x[0]) a1.reverse() a1 = [i[1] for i in a1] b.sort() res = [0]*N for i in range(N): res[a1[i]] = b[i] b = res Sum = 0 for i ...
Python
93431bdae447bb96a2f0f5fa0c6e11e0
97831eab7b5a6fec3c60c5bcc640eabf
1,600
PASSED
MOD = 998244353 def get_modified(num, pos, n): x = min(pos, n - pos + 1) return num * x * (n - x + 1) def solve(a, b): n = len(a) for (i, num) in enumerate(a): a[i] = get_modified(num, i + 1, n) a.sort() b.sort(reverse=True) return sum(num_a * num_b % MOD for (num_a, num_b) in ...
Python
93431bdae447bb96a2f0f5fa0c6e11e0
f60d1952280bb09678dbe8353eab7732
1,600
PASSED
import math ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) si = lambda: input() n = ii() a,b = li(),li() val = [] for i in range(n): val.append((i+1)*(n-i)*a[i]) val.sort() b.sort() sum=0 for i in range(n): sum+=val[i]*b[n-i-1] print(sum%998244353)
Python
93431bdae447bb96a2f0f5fa0c6e11e0
52f792101a3c00352497efa9df577de6
1,600
PASSED
# E. Two Arrays and Sum of Functions m = 998244353 n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) a = [a[i]*(i+1)*(n-i) for i in range(n)] a.sort() b.sort(reverse=True) ab = [a[i]*b[i] for i in range(n)] print(sum(ab)%m)
Python
93431bdae447bb96a2f0f5fa0c6e11e0
993fae33e9e6a818fddc3ccfc36d20b5
1,600
PASSED
N = int(input()) A = input() A = [int(num) for num in A.split(' ')] B = input() B = [int(num) for num in B.split(' ')] B.sort() m = [0]*N for i in range(N): m[i] = (i+1)*(N-i)*A[i] m.sort(reverse=True) #print(m) res = 0 for i in range(N): res += m[i]*B[i] print(res%998244353)
Python
93431bdae447bb96a2f0f5fa0c6e11e0
d300d1e9aa1d3e55ee9e346a525b4dd5
1,600
PASSED
MOD = 998244353 n = int(input()) a = [*map(int,input().split())] b = [*map(int,input().split())] for i in range(n): a[i] = (a[i]*(n-i)*(i+1)) a.sort(reverse = True) b.sort() res = 0 for i in range(n): a[i]%=MOD res += (a[i]*b[i])%MOD res %= MOD print(res)
Python
93431bdae447bb96a2f0f5fa0c6e11e0
9a971816342955e89e83952c5967f073
1,600
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define int long long int using namespace std; int sq; struct group { vector<pair<int,int>> data; int extra; void inc...
C++
7f91216cfb2568367f5e5ef058b8c2db
3c49de0bcf8b48bce64483584c01c5b9
2,500
PASSED
#include <bits/stdc++.h> using namespace std; int SIZ, n, q; long long lazy[715], a[500005]; vector <pair<long long, int> > block[715]; void build(int x) { block[x].clear(); for (int i = x * SIZ; i < min(n, (x + 1) * SIZ); i++) block[x].push_back({a[i], i}); sort(block[x].begin(), block[x].end()); } int...
C++
7f91216cfb2568367f5e5ef058b8c2db
a5572a30427554026d939de3adf9aab5
2,500
PASSED
//#pragma GCC target("avx2") //#pragma GCC optimize("O3") //# include <x86intrin.h> # include <bits/stdc++.h> # include <ext/pb_ds/assoc_container.hpp> # include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tre...
C++
7f91216cfb2568367f5e5ef058b8c2db
bed48e808b9faf0238fb2360ee9830d2
2,500
PASSED
//#pragma GCC target("avx2") //#pragma GCC optimize("O3") //# include <x86intrin.h> # include <bits/stdc++.h> # include <ext/pb_ds/assoc_container.hpp> # include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tre...
C++
7f91216cfb2568367f5e5ef058b8c2db
1c790865508678efa002bf194c741544
2,500
PASSED
//#pragma GCC target("avx2") //#pragma GCC optimize("O3") //# include <x86intrin.h> # include <bits/stdc++.h> # include <ext/pb_ds/assoc_container.hpp> # include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tre...
C++
7f91216cfb2568367f5e5ef058b8c2db
3c3720fcc0cb2ed748f6082d3329385f
2,500
PASSED
#include<bits/stdc++.h> using namespace std ; #define MAXN 500007 #define MX_BUCKETS 1007 #define bucket 807 int n , q ; pair < long long , int > a[ MAXN ] ; int bucket_cnt ; int st[ MX_BUCKETS ] ; int en[ MX_BUCKETS ] ; long long add[ MX_BUCKETS ] ; pair < long long , int > aux1[ bucket + 2 ] ; pair < long long ...
C++
7f91216cfb2568367f5e5ef058b8c2db
3c4d29e87031e4e0538d3e4223351af3
2,500
PASSED
//In The Name of Allah #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair < ll , ll > pll; const int N = 5e5 + 10; const int SQ = 500; const ll inf = 1e18 + 10; int n; ll c[N]; pll a[N]; void cal(){ ll x; cin >> x; ll L = -1; for (int i = 0; i < n; i += SQ){ in...
C++
7f91216cfb2568367f5e5ef058b8c2db
6bbe10e6825d1046c7f12e4b3c85efc7
2,500
PASSED
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author szawinis */ #include <iostream> #include <fstream> #include <bits/stdc++.h> using namespace std; #define long long long const long MOD = 1e9+7, LINF = 1e18 + 1e16; const int INF = 1e9+1; const double EPS = 1e-10; cons...
C++
7f91216cfb2568367f5e5ef058b8c2db
535f04b88deaa69d4d684330975f59e5
2,500
PASSED
/*================================================================ * Copyright (C) 2019 Sangfor Ltd. All rights reserved. * * 文件名称:D.cpp * 创 建 者: badcw * 创建日期: 8/22/19 * ================================================================*/ #include <bits/stdc++.h> #define ll long long using namespace std; const ...
C++
7f91216cfb2568367f5e5ef058b8c2db
1c0a3b8f21116d4211949c78cbc957fd
2,500
PASSED
// By H~$~C #include <bits/stdc++.h> using namespace std; static const int Maxn = 500005; static const int BLOCK = 750; #ifndef LOCAL_JUDGE static char _in_buf[100000], *_in_p1 = _in_buf, *_in_p2 = _in_buf; #define gc (__builtin_expect(_in_p1 == _in_p2, 0) && (_in_p2 = (_in_p1 = _in_buf) + \ fread(_in_buf, 1...
C++
7f91216cfb2568367f5e5ef058b8c2db
5caa39d0ed5d07721e8e0636de972f0d
2,500
PASSED
#include<iostream> #include<stdio.h> #include<set> #include<windows.h> #include<cmath> using namespace std; int main(){ long long y, k, n; scanf("%I64d%I64d%I64d", &y, &k, &n); if(n <= y || k > n){ printf("%d", -1); } else if(k==n) printf("%I64d", n-y); else{ long long...
C++
2deda3a05740e1184735bf437e3850a8
be89c79b14ee829ce3b4f9dd200c674c
1,200
PASSED
//#pragma comment(linker,"/STACK:102400000,102400000") #include <iostream> #include <cstdio> #include <cstdlib> #include <cassert> #include <climits> #include <ctime> #include <numeric> #include <vector> #include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <iomanip> #include <complex> #in...
C++
2deda3a05740e1184735bf437e3850a8
c73fef1c77beb57c5e1176e8d5a98349
1,200
PASSED
#include <iostream> using namespace std; int main() { long long n,y,k,x,c1=0; bool wow=false; cin >> y >> k >> n; c1=y+(k-(y%k)); x=c1-y; for(int i=x;(i+y)<=n;i+=k){ cout <<i<<' '; wow=true; } if(!wow){ cout<<-1<<endl; return 0;} return 0; }
C++
2deda3a05740e1184735bf437e3850a8
979b763f0262d3995c4e562c55fa3c7d
1,200
PASSED
#include<stdio.h> int main() { long y,k,n,c,m,r,ans; while(scanf("%ld%ld%ld",&y,&k,&n)!=EOF) { c=0; m=y; r=y%k; if(r>0) { y=y-r; } y=y+k; while(y<=n) { ans=y-m; printf("%ld ",ans); y=y+k; c=1; } if(c==0) printf("-1"); printf("\n"); } return 0; }
C++
2deda3a05740e1184735bf437e3850a8
2c493d904e49c5084b581e10d7829915
1,200
PASSED
#include<iostream> #include<algorithm> #include<vector> #include<cstring> #include<cmath> using namespace std; int main() { long long int f=0,i,x,y,k,n; cin>>y>>k>>n; if(y>=n) { cout<<-1; return 0; } if(k==1)x=1; else if(y>k) { for(x=2*k-y...
C++
2deda3a05740e1184735bf437e3850a8
2d46a6841cb28c08d9cd570651018c55
1,200
PASSED
#include<iostream> using namespace std; int main() { long int y,k,n,i,j,a=0,b=0,c=0; cin>>y>>k>>n; if(k>=y) { for(i=k-y;i<=n-y;i=i+k) {if(i!=0) cout<<i<<" "; c++; } } else { a=y%k; b=k-a; ...
C++
2deda3a05740e1184735bf437e3850a8
847b28c474be07c0388970eaaa22a32a
1,200
PASSED
#include <iostream> #include <string> #include <algorithm> #include <math.h> #include <cmath> #include<stdio.h> using namespace std; int main() { long long y, k, n, index = 0; scanf("%i %i %i", &y, &k, &n); int res[10000000]; for (long long i = k; i <= n; i+=k) { if (i%k == 0 && i - y > 0)...
C++
2deda3a05740e1184735bf437e3850a8
51c57ad7f1972accfb3a75852ec9edd7
1,200
PASSED
#include <iostream> #include <string> #include <cmath> #include <algorithm> #include <iomanip> using namespace std; void fn(int n, string s) { if (s.size() == n){ cout << s << '\n'; return; } fn(n, s + '1'); fn(n, s + '2'); fn(n, s + '3'); } int main() { long long y, k, n, index = 0; cin >> y >> k >> n; ...
C++
2deda3a05740e1184735bf437e3850a8
bc886a726bda72084eba418e08e4e6b7
1,200
PASSED
#include <iostream> #include <string> #include <algorithm> #include <math.h> #include <cmath> #include<stdio.h> using namespace std; int main() { long long y, k, n, index = 0; cin>>y>>k>>n; int res[10000000]; for (long long i = k; i <= n; i+=k) { if (i%k == 0 && i - y > 0) { ...
C++
2deda3a05740e1184735bf437e3850a8
cfceef9ec8990fafb92c31cd816c7e03
1,200
PASSED
#include <iostream> #include <string> #include <algorithm> #include <math.h> #include <cmath> #include<stdio.h> using namespace std; int main() { long long y, k, n, index = 0; scanf("%i %i %i", &y, &k, &n); int res[10000000]; for (long long i = k; i <= n; i+=k) { if (i%k == 0 && i - y > 0)...
C++
2deda3a05740e1184735bf437e3850a8
9e44ed1639d8596f4ec27bcceeb71bfd
1,200
PASSED
#include <bits/stdc++.h> #define ld long double #define ll long long #define sz size() #define all(xx) xx.begin(),xx.end() #define pb push_back #define in insert #define er erase #define S second #define F first #define pii pair <int, int> #define to_be continue #define mp make_pair #define stop exit (0) #define fname...
C++
d7dc61a8f3b0091320b96cedd1f4f0a7
1446a24bae30a0e69c71660d8d100255
1,000
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define pb push_back #define f(i,n) for(i=0;i<n;i++) #define F(i,a,b) for(i=a;a<=b;i++) #define fi first #define se second #define mp make_pair //#define m 1000000007 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout...
C++
d7dc61a8f3b0091320b96cedd1f4f0a7
c911dec50383f8b01ff37bebe76ab08c
1,000
PASSED
#include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(i=a;i<b;i++) #define repr(i,a,b) for(i=a;i>=b;i--) #define LL long long #define ull unsigned long long int #define scl(n) scanf("%lld", &n) #define scf(n) scanf("%lf", &n) #...
C++
d7dc61a8f3b0091320b96cedd1f4f0a7
4f91a436febb81d6eede7ea14da7fa68
1,000
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define ld long double int main() { ll T; cin>>T; ll a[T],b[T]; for(int i=0;i<T;i++) { cin>>a[i]>>b[i]; } bool flag = false; for(int i=0;i<T;i++) { for(int j=i;j<T;j++) { if(a[i]+b[i]==a[j] && a[...
C++
d7dc61a8f3b0091320b96cedd1f4f0a7
74927d551e03241efa813962d4635dc2
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { vector<pair<int , int>> v; int n; int x , d , m=0; cin>>n; for(int i=0 ;i<n ; ++i) { cin>>x>>d; v.push_back(make_pair(x,d)); } for(int i=0 ;i<n ;++i) for(int j=0 ; j<n ; ++j) { if(v[i].first + v[i].s...
C++
d7dc61a8f3b0091320b96cedd1f4f0a7
8259282a467386b39ef48d4e4ce76c4f
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { pair<int,int>p; vector<pair<int,int>>v; int x,d,n,t=1; cin>>n; for(int i=0;i<n;i++){ cin>>x>>d; p=make_pair(x,d); v.push_back(p); } for(int i=0;i<v.size();i++){ x=v[i].first; d=v[i].second; ...
C++
d7dc61a8f3b0091320b96cedd1f4f0a7
025c3063f8408c129d9fc0e5b2bfd3dd
1,000
PASSED
#include <iostream> #include <fstream> #include <cstring> using namespace std; int main() { int array[103][2]; int n; cin>>n; for(int i=0;i<n;i++) { int num1,num2; cin>>num1>>num2; array[i][0]=num1; array[i][1]=num2; } bool check=false; for(int i=0;i<n-1;i...
C++
d7dc61a8f3b0091320b96cedd1f4f0a7
d8b29ec354f66e0666106e35c0aa9c87
1,000
PASSED
/** Bismillahir Rahmanir Rahim **/ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<pair<int, int> > v; for (int i = 0; i < n; i++) { int x, d; cin >> x >> d; v.push_back(make_pair(x, d)); } ...
C++
d7dc61a8f3b0091320b96cedd1f4f0a7
2a9851892a1110f8d7136d8fbea1391c
1,000
PASSED
/** Bismillahir Rahmanir Rahim **/ #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<int, int> > v; for (int i = 0; i < n; i++) { int x, d; cin >> x >> d; v.push_back(make_pair(x, d)); } for (int i = 0; i < n; i++) { int d = v[...
C++
d7dc61a8f3b0091320b96cedd1f4f0a7
f33a5abbbce69a999970e5a459e6e477
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,i,j,k; cin>>n; int x[n],d[n]; for(i=0;i<n;i++) { cin>>x[i]>>d[i]; } for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(x[i]==(x[j]+d[j]) && x[i]+d[i]=...
C++
d7dc61a8f3b0091320b96cedd1f4f0a7
896b52bdfee1fc747bc1f1271803f0f3
1,000
PASSED
import java.io.*; import java.util.*; public class D implements Runnable { boolean judge = false; FastReader scn; PrintWriter out; String INPUT = ""; void solve() { int n = scn.nextInt(); char[] arr = scn.next().toCharArray(); long ans = n * 1L * (n - 1) / 2 - 2 * n; for(int i = 1; i < n; i++) { if(a...
Java
3eb23b7824d06b86be72c70b969be166
c3f2b110d707508000ac7d76c53c8267
1,900
PASSED
// package Quarantine; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ABSubstring { public static void main(String[] args)throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(b...
Java
3eb23b7824d06b86be72c70b969be166
c8da0c509886c38fa229a382b87ea580
1,900
PASSED
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); ArrayList<Integer> res=new ArrayList<>(); char[] a=scan.next().toCharArray(); int streak=0, prev=-1; for(int i=0;i<n;i++) { ...
Java
3eb23b7824d06b86be72c70b969be166
3577fb59d406ee05598e7f7aaf7742ad
1,900
PASSED
//package cfed74; import java.io.*; import java.util.*; import static java.lang.Math.*; public class G { public static void main(String[] args) { MyScanner sc = new MyScanner(); int n = sc.nextInt(); char[] s = sc.nextLine().toCharArray(); long ans = (long) n * (long) (n + 1) / 2; int[] last = new int[]{-1,...
Java
3eb23b7824d06b86be72c70b969be166
0a28669ef3394cb22f52ddee75846f1a
1,900
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.InputStream; ...
Java
3eb23b7824d06b86be72c70b969be166
1a817a59b665638ed5a85c7538356420
1,900
PASSED
import java.io.*; import java.util.*; public class cfd { static DataReader input; static int LARGE_INT = 1000000007; //static int MAXN = 300000; //static int[] len = new int[300000]; //static int[] price = new int[300000]; public static void main(String[] args) throws IOException { input = new DataReader(...
Java
3eb23b7824d06b86be72c70b969be166
1655e71d3082ea1f8814e054b3975ae9
1,900
PASSED
import java.util.*; import java.io.*; public class Contest1 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); char[]s=sc.nextLine().toCharArray(); TreeSet<I...
Java
3eb23b7824d06b86be72c70b969be166
63105d2d287a6c1a3ee5fb9213fd5783
1,900
PASSED
import java.util.Scanner; import static java.lang.Math.max; public class D { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String s = in.next(); int pra[] = new int[n]; int prb[] = new int[n]; int ta = n; ...
Java
3eb23b7824d06b86be72c70b969be166
eb3e8ee5a01090319e64ffce337fe14c
1,900
PASSED
/** * BaZ :D */ import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static MyScanner scan; static PrintWriter pw; static long MOD = 1_000_000_007; static long INF = 1_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(Strin...
Java
3eb23b7824d06b86be72c70b969be166
d205ff641908e073e2ea8aa78a3b8956
1,900
PASSED
import java.io.*; import java.util.*; import java.util.PriorityQueue; public class codeforces { public static PrintWriter out; public static class MyScanner { BufferedReader br; StringTokenizer st; public MyScanner() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while...
Java
3eb23b7824d06b86be72c70b969be166
1a2ae61e93b2cd730e406cc2db8c5036
1,900
PASSED
#include<bits/stdc++.h> #define endl '\n' #define pi 3.1415926536 #define int long long int #define forr(i,a,b) for (int i= a; i <b; ++i) //bi=bi+k for each i, such that 1≤i≤m−k. using namespace std; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //freopen("input.txt","r",stdin);freop...
C++
1cd295e204724335c63e685fcc0708b8
2a656f24ed07b17485fe17862f5015a4
1,400
PASSED
//getline(cin, str); takes line with spaces as str , cin>> doesn't. #include<bits/stdc++.h> using namespace std; // ifstream cin ("input.txt"); // ofstream cout ("output.txt"); // ofstream outputfile; // outputfile.open("output.txt"); // ifstream inputfile; ...
C++
1cd295e204724335c63e685fcc0708b8
b5027d61201e83b1ead9cf5bc2cc240a
1,400
PASSED
//getline(cin, str); takes line with spaces as str , cin>> doesn't. #include<bits/stdc++.h> using namespace std; // ifstream cin ("input.txt"); // ofstream cout ("output.txt"); // ofstream outputfile; // outputfile.open("output.txt"); // ifstream inputfile; ...
C++
1cd295e204724335c63e685fcc0708b8
cfbbf29f0468d312934d7ff658bf5603
1,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin>>n; ll a[100005]; vector<ll>sol; ll ans=0,k=0,s=0; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n-1;i++) { if(a[i]>a[i+1]){ans+=a[i]-a[i+1];} } cout<<ans; }
C++
1cd295e204724335c63e685fcc0708b8
ea315b28c3df482991be33ca35e4c0d9
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long int n, i; cin >> n; long long int a[n],cnt=0; for(i=0;i<n;i++) cin >> a[i]; for(i=1;i<n;i++) { if(a[i]<a[i-1]) cnt+=(a[i-1]-a[i]); } cout<<cnt; return 0; }
C++
1cd295e204724335c63e685fcc0708b8
d45066a5089f59c01cbdb600af0d0b63
1,400
PASSED
#include<stdio.h> #include<iostream> #include<cmath> #include<algorithm> #include<cstring> #include<map> #include<set> #include<vector> #include<utility> #include<math.h> #define sd(x) scanf("%d",&x); #define sd2(x,y) scanf("%d%d",&x,&y); #define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z); #define fi first #define se second...
C++
1cd295e204724335c63e685fcc0708b8
acd33dd2ddb10703d71f7089e1413dbe
1,400
PASSED
//Aim --> Blue on CF .... /* nothing is impossible */ /* IT IS GOING TO HAPPEN ! because I AM GOING TO MAKE IT HAPPEN ! */ // " every champion was once a contender who refused to give up " // // never give up ! // I failed countless times // I am still failing, // i d...
C++
1cd295e204724335c63e685fcc0708b8
ecee9b607c915bd989c8ba9019ebbf97
1,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; const int MAX=100001; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z; cin>>n; cin>>y; ll sum=0; for(i=1;i<n;i++) { cin>>x; if(x<y)...
C++
1cd295e204724335c63e685fcc0708b8
d8d33aa58ac4337cda620a1dee5e373b
1,400
PASSED
using namespace std; #include<string.h> #include <sstream> typedef long long int ll; typedef long double ld; #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <iterator> #include <unordered_map> #include <map> //#define N 4 #include <queue> #include <unordered_set> #...
C++
1cd295e204724335c63e685fcc0708b8
10db1b94317e52708e4e309de8563114
1,400
PASSED
#include<iostream> using namespace std; int main() { int n; cin>>n; int arr[n]; cin>>arr[0]; //mx=arr[0]; //int mn=arr[0]; long long sum=0,count=0; for(int i=1;i<n;i++){ cin>>arr[i]; if(arr[i]<arr[i-1]) sum=sum+arr[i-1]-arr[i]; } cout<<sum<<endl; return...
C++
1cd295e204724335c63e685fcc0708b8
aa6e01cc20b4e430238639a344b43f16
1,400
PASSED
// AVX-enabled std::bitset Pragmas (before #includes!) // - bitset<200000> takes ~ 1ms per 1000 operations on GNU C++14 & GNU C++17 // #pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags // #pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX // #pragm...
C++
513acc555c30e1a185a3d07e136f3cf9
158efaabd0488ebd66b367eb0f2c8737
2,400
PASSED
// AVX-enabled std::bitset Pragmas (before #includes!) // - bitset<200000> takes ~ 1ms per 1000 operations on GNU C++14 & GNU C++17 // #pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags // #pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX // #pragm...
C++
513acc555c30e1a185a3d07e136f3cf9
6031aee59626d4f4f86360438290023a
2,400
PASSED
// AVX-enabled std::bitset Pragmas (before #includes!) // - bitset<200000> takes ~ 1ms per 1000 operations on GNU C++14 & GNU C++17 // #pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags // #pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX // #pragm...
C++
513acc555c30e1a185a3d07e136f3cf9
e49b43cc0b7991faa1422bc8d92a0b73
2,400
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define debug std::cerr << "Debug(" << __LINE__ << "): " #define pub push_back #define pob pop_back #define mkp make_pair #define fir first #define se...
C++
513acc555c30e1a185a3d07e136f3cf9
e9cf2ba985a9568478560ec0f5bd678a
2,400
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define debug std::cerr << "Debug(" << __LINE__ << "): " #define pub push_back #define pob pop_back #define mkp make_pair #define fir first #define se...
C++
513acc555c30e1a185a3d07e136f3cf9
9999360063ca78a453d04a7c8c5fcef7
2,400
PASSED
#include<bits/stdc++.h> #define ll long long #define F first #define S second #define mod 1000000007 #define maxn 500005 #define INF 1000000000 #define ld long double using namespace std; ll pw(ll x,ll y){ ll ret = 1; while(y){ if(y%2)ret = (ret*x)%mod; x = (x*x)%mod; y/=2; } return ret; } struct node{ no...
C++
513acc555c30e1a185a3d07e136f3cf9
72fe52dff971dbe3781d52494f619da6
2,400
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/priority_queue.hpp> //#pragma GCC optimize("O3") //#pragma GCC target("sse4") //#pragma GCC target("avx2") #define deb(x) cout << #x << " = " << x << "\n" #define all(x) (x).begin(), (x).end() #de...
C++
513acc555c30e1a185a3d07e136f3cf9
25274ac5a0edc8ec1563e45ace65e6ce
2,400
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/priority_queue.hpp> //#pragma GCC optimize("O3") //#pragma GCC target("sse4") //#pragma GCC target("avx2") #define deb(x) cout << #x << " = " << x << "\n" #define all(x) (x).begin(), (x).end() #de...
C++
513acc555c30e1a185a3d07e136f3cf9
7a4f40deac80c01a4bb680ec120329c0
2,400
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/trie_policy.hpp> #include <ext/rope> #pragma GCC optimize ("Ofast") #pragma GCC optimization ("unroll-loops") #pragma GCC target("avx,avx2,fma") using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; mt19937 rn...
C++
513acc555c30e1a185a3d07e136f3cf9
c0f1a96d570c524e35d3096f3da5f109
2,400
PASSED
// So when you feel like hope is gone, Look inside you and be strong, And you'll finally see the truth, That a hero lies in you ... #include<bits/stdc++.h> #define F first #define S second #define PB push_back #define sz(s) int((s).size()) #define bit(n,k) (((n)>>(k))&1) using namespace std; typedef long long ll;...
C++
513acc555c30e1a185a3d07e136f3cf9
dbc30811c2183343410527da54a25bfc
2,400
PASSED
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm> using namespace std; long long t[500000], lazy[500000]; long long l[100005] , r[100005] , q[100005] ; void update(int node, int a, int b, int i, int j, long long value) { if(lazy[node] != 0) { t[node] |= lazy[node] ; if(...
C++
0b204773f8d06362b7569bd82224b218
6079443e3d17ddf3569e393c4188fd20
1,800
PASSED
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm> using namespace std; int t[500000], lazy[500000]; int l[100005] , r[100005] , q[100005] ; void update(int node, int a, int b, int i, int j, int value) { if( a > j || b < i) return; if(lazy[node] != 0) { t[node] |= l...
C++
0b204773f8d06362b7569bd82224b218
f5cbd77e2e3e66d1d2c35df1c4527c21
1,800
PASSED
#include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <algorithm> #include <cstdlib> #include <vector> #include <stack> #include <map> #include <string> #define inf 0x3f3f3f3f #define inf64 0x3f3f3f3f3f3f3f3f using namespace std; typedef long long ll; const ll num = (1 << 30) - 1; const...
C++
0b204773f8d06362b7569bd82224b218
a5c7536c37599f19eba6d213c8752e3f
1,800
PASSED
/* if you can't see the repay Why not just work step by step rubbish is relaxed to ljq */ #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <cmath> #include <map> #include <stack> #include <set> #include <sstream> #include <vector> #include <stdlib.h> #include <algorithm...
C++
0b204773f8d06362b7569bd82224b218
21735a98dcd89915a19a55d87bcb077c
1,800
PASSED
#include<bits/stdc++.h> using namespace std; const int N=1e5+5; #define M(a,x) memset(a,x,sizeof(a)); int a[N]; int b[N]; int c[N]; int val[N]; int sum[N]; int tree[11*N]; inline void build(int node,int rs,int re) { if(rs==re) { tree[node] = a[rs]; return ; } build(node*2,rs,(rs+re)/2); build(node*2+1,...
C++
0b204773f8d06362b7569bd82224b218
322031cc0d5702cb3f3ec414c1acb7e5
1,800
PASSED