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 <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define EACH(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define DEBUG(x) { cout << #x << " = "; cout << (x) << en... | C++ | 320e6c06194f8b1ccf1f4218d0757d2f | 90f189b880c072a6189f73676e2b4ff5 | 1,800 | PASSED |
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
char s[90],r[90],a[90],b[90],ans[90]={"Unhandled Exception"};
int n;
bool done=0;
bool check(){
bool hv=0;
while(scanf("%*[^a-z]%[a-z]",s),s[1]!='a'){
if(s[1]=='r') hv|=check();
if(s[1]=='h')scanf("%*[^A-Za-z]%[A-Za-z]",r... | C++ | 320e6c06194f8b1ccf1f4218d0757d2f | da503c7c5b289b7364fdc79275961898 | 1,800 | PASSED |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) x.begin(), x.end()
#define f(i,a,b) for(int i = (a); i <= (b); i++)
#define fd(i,a,b) for(int i = (a); i >= (b); i--)
#define mp make_pair
#define faster_io() ios_base::sync_with_stdio(false)
#define pb push_back
#define pii pair<int,i... | C++ | 320e6c06194f8b1ccf1f4218d0757d2f | 41a53272551b5aaa736da5ac279b03c2 | 1,800 | PASSED |
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <deque>
#include <functional>
#include <sstream>
using namespace std;
// ������ l... | C++ | 320e6c06194f8b1ccf1f4218d0757d2f | f7b3e87325d5df380fb7c91cd8f18791 | 1,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;int got,n;char s[101],a[101],b[101],c[101],ans[101]={"Unhandled Exception"};bool check(){int thr=0;while(~scanf("%*[^a-z]%[a-z]",s),s[1]!='a'){if(s[1]=='r')thr|=check();if(s[1]=='h')scanf("%*[^a-zA-Z]%[a-zA-Z]",a),thr=1;}scanf("%*[^a-zA-Z]%[a-zA-z]%*[^\"]\"%[^\"]",b,c);if(thr... | C++ | 320e6c06194f8b1ccf1f4218d0757d2f | 31444796cf6094a3320f8cedcaee712a | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
bool output;
int n;
void input()
{
cin >> n;
}
int gettype(char *s)
{
int cn = 1;
while (s[cn] && s[cn] < 'a' || s[cn] > 'z') cn ++;
if (s[cn] == 't' && s[cn + 1] == 'r') return 1;
if (s[cn] == 't' && s[cn + 1] == 'h') retur... | C++ | 320e6c06194f8b1ccf1f4218d0757d2f | 13f5345ef576079aba5ec58309ba02a5 | 1,800 | PASSED |
// practice with kaiboy
import java.io.*;
import java.util.*;
public class CF195E extends PrintWriter {
CF195E() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF195E o = new CF195E(); o.main(); o.flush();
}
static final int MD = 1000000007;
int[] pp, w... | Java | c4d464f1770d2c1b41f8123df4325615 | 8f9f413717965d2ae0692707ad864a82 | 2,000 | PASSED |
#include<bits/stdc++.h>
#include<algorithm>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define is insert
#define rep1(i,a,b) for(long long i=a;i<=b;i++)
#define mp make_pair
#define mh make_heap
#defi... | C++ | c4d464f1770d2c1b41f8123df4325615 | 63bedbea1fc91e10690394c701b2b9a9 | 2,000 | PASSED |
#include<bits/stdc++.h>
#include<algorithm>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define is insert
#define rep1(i,a,b) for(long long i=a;i<=b;i++)
#define mp make_pair
#define mh make_heap
#defi... | C++ | c4d464f1770d2c1b41f8123df4325615 | ffc5bf7bc711cf5350150985e3cdc089 | 2,000 | PASSED |
#include<bits/stdc++.h>
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define int long long
#define sz(x) (ll)(x.size())
using namespace std;
const int mod = 1e9+7;
in... | C++ | c4d464f1770d2c1b41f8123df4325615 | 6c7f9a0710f85e28f87bbc4e64c80ee9 | 2,000 | PASSED |
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC opatimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define FINAL_OUT(x)... | C++ | c4d464f1770d2c1b41f8123df4325615 | abd4483827fdc79ff6560e2c858c7be5 | 2,000 | PASSED |
/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) s... | C++ | c4d464f1770d2c1b41f8123df4325615 | 879499f880bb15e6f3afea4bb218c14f | 2,000 | PASSED |
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define int long l... | C++ | c4d464f1770d2c1b41f8123df4325615 | de28efb0750dc2772915a7c5f59c4b0e | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
const int N = 1e5 + 7... | C++ | c4d464f1770d2c1b41f8123df4325615 | b2b3b32ab48c472470c53c5da22a6da0 | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
const int N = 1e5 + 7... | C++ | c4d464f1770d2c1b41f8123df4325615 | e6e21eb319229bae5be3b8a7b9442335 | 2,000 | PASSED |
///supercalifragilisticexpialidocious.
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <utility>
#include <string>
#include <algorithm>
#include <vector>
#... | C++ | c4d464f1770d2c1b41f8123df4325615 | d2cd081b01c8448ec22c7d740b04c4fb | 2,000 | PASSED |
using System;
using System.Collections.Generic;
using System.Text;
public class taskA
{
static void Main(string[] args)
{
string inp = Console.ReadLine();
string[] spl = inp.Split(' ');
int n = int.Parse(spl[0]);
int[] x = new int[n];
for (int i = 1; i <= n;... | C# | 18b1814234b05bae56ea4446506b543b | c51fc9453004e7275bcc291f46022187 | 1,300 | PASSED |
using System;
class Program
{
static void Main()
{
string[] inputRout = Console.ReadLine().Split(' ');
string[] inputY = Console.ReadLine().Split(' ');
string[] inputZ = Console.ReadLine().Split(' ');
string[] inputAB = Console.ReadLine().Split(' ');
double A = double.Par... | C# | 18b1814234b05bae56ea4446506b543b | c4611acedb2d0e31e0501283a639d5bc | 1,300 | PASSED |
//
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Threading;
using System.Diagnostics;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Linq;
namespace sar_cs
{
static class Helpers
{
public static string Join<T>(this IEnu... | C# | 18b1814234b05bae56ea4446506b543b | e67f9586231cb6f4ec9b18af4647d9fd | 1,300 | PASSED |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Collections;
using System.Diagnostics;
using System.Globalization;
using System.Threading;
namespace CodeForces {
struct Node {
public int X, Y, D;
public Node(int x,int y, i... | C# | 18b1814234b05bae56ea4446506b543b | 8f1df8344d119a709a271172e05a7749 | 1,300 | PASSED |
using System;
using System.Globalization;
using System.Linq;
namespace OlympicMedal
{
internal class Program
{
private static int n;
private static int[] x;
private static int m;
private static int[] y;
private static int k;
private static int[] z;
... | C# | 18b1814234b05bae56ea4446506b543b | 6d4b8d682b720fdd31216cb56f3cf14f | 1,300 | PASSED |
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace B
{
internal class Program
{
private static void Main(string[] args)
{
int[] xs =
Console.ReadLine().Split(new[] { " " }, StringSplitOptions.R... | C# | 18b1814234b05bae56ea4446506b543b | 62683957148ce6c92708a4d7d303a1f6 | 1,300 | PASSED |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeForce97
{
class ClassB
{
static void Main(string[] args)
{
int r1 = 0;
string[] ss = Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
int n = int.Parse(ss[0]);
fo... | C# | 18b1814234b05bae56ea4446506b543b | b61f6954c704a2a79046cc81ecc704db | 1,300 | PASSED |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
namespace Temp
{
struct PointInt
{
public long X;
public long Y;
public PointInt(long x, long y)
: this()
{
thi... | C# | 18b1814234b05bae56ea4446506b543b | 99aa5203d0c7c3686f8de1be232852fe | 1,300 | PASSED |
package main
import "os"
import "bufio"
import "strconv"
import "sort"
import "math"
import "fmt"
func main(){
var n, m, k int
r := bufio.NewScanner(os.Stdin)
r.Split(bufio.ScanWords)
r.Scan()
n, _ = strconv.Atoi(r.Text())
x := make([]int, n)
for i:=0; i<n; i++ {
r.Scan()
x[i], _ = strconv.Atoi(r.Text())
... | Go | 18b1814234b05bae56ea4446506b543b | f0ce27d3b66a125b5d268e2c590fcb53 | 1,300 | PASSED |
package main
import (
"os"
"bufio"
"strconv"
"fmt"
"sort"
"math"
)
func scanInt(scanner *bufio.Scanner) int {
scanner.Scan()
x, _ := strconv.Atoi(scanner.Text())
return x
}
func main() {
scanner := bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanWords)
writer := bufio.NewWriter(os.Stdout)
defer write... | Go | 18b1814234b05bae56ea4446506b543b | 0099660aa6e311825ddc8bb84e309de7 | 1,300 | PASSED |
#include <iostream>
#include <stdlib.h>
#include <math.h> /* ceil */
using namespace std;
int main()
{
int n;
cin>>n;
char mus[n][n];
double ite = n;
ite = ceil(ite/2);
char f,s;
for(int i = 0; i < n ; i++){
for(int j = 0;j<n;j++){
cin>>mus[i][j];
}
... | C++ | 02a9081aed29ea92aae13950a6d48325 | 60b1e25849ef9fac185aa1daba90df20 | 1,000 | PASSED |
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
int i,j,al[30],n,k,l,f1,f2;
char a[310][310];
cin>>n;
getchar();
for(i=0;i<30;i++)
al[i]=0;
for(i=0;i<n;i++)
{
gets(a[i]);
}
f1=0;
f2=0;
for(i=0;i<n;i++)
{
for(j=0;j... | C++ | 02a9081aed29ea92aae13950a6d48325 | d60eb4e4641d30956b8b0941fc0dc905 | 1,000 | PASSED |
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char ch[330][330];
char ch1[90001];
char ch2[90001];
int main()
{
int i,k,j,n,m;
while(scanf("%d", &n)!=EOF)
{
getchar();
for(i=0;i<n;i++)
scanf("%s",ch[i]);
char na=ch[0][0];
char nb=... | C++ | 02a9081aed29ea92aae13950a6d48325 | b8a469019485d3d59b464d6861aad4fb | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
bool flag = false;
int n;
scanf("%d",&n);
char s[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cin>>s[i][j];
char s1 = s[0][0];
char s2 = s[0][1];
if(i==j)
{
if(s1!=s[i][j])
{
... | C++ | 02a9081aed29ea92aae13950a6d48325 | 5facc0b5ff6d51b8212880887aede04a | 1,000 | PASSED |
#include <iostream>
using namespace std;
int main()
{
char arr[1000][1000];
int n,s=1,b=1,c=0,v=0,m=0,y=0,x=0,t=2;
cin>>n;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cin>>arr[i][j];
}
}
for(int i=0;i<n;i++)
{
if(arr[i][i]==arr[i+1][i+1]&&arr[i][n-s]==a... | C++ | 02a9081aed29ea92aae13950a6d48325 | 4447912e7844c78d7f350aa5cd75cc16 | 1,000 | PASSED |
#include <bits/stdc++.h>
char a[305][305],s[2];
int main()
{
int n,i,j;
for(scanf("%d",&n),i=0;i<n;i++)
scanf("%s",a[i]);
if((s[0]=a[0][1])==(s[1]=a[0][0]))
return puts("NO");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
if(a[i][j]!=s[i==j||i+j==n-1])
return puts("NO");
return puts("YES");
} | C++ | 02a9081aed29ea92aae13950a6d48325 | 9de7bd25fc7182339fcebd555e7d88b3 | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#include<cstdio>
typedef long long ll;
main()
{
int n;
cin>>n;
char x;
set<char> s1,s2;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++ )
{
cin>>x;
if(i==j||j==n-1-i)
s1.insert(x);
else s2.insert(x);}
if(s1!=s2&&s1.size()==1&&s2.size()==1)
cout<<"YES";
else cout<<"N... | C++ | 02a9081aed29ea92aae13950a6d48325 | b90e81313906232cc5f5fade636dbe83 | 1,000 | PASSED |
#include<iostream>
using namespace std;
int main()
{int n,i,j,m=0,k=0,l=0;
cin>>n;
char a[n][n];
for(i=0;i<n;i++)
for(j=0;j<n;j++)
cin>>a[i][j];
for(i=0;i<n;i++)
{for(j=0;j<n;j++){
if(i==j&&a[i][i]==a[0][0])m++;
if(j==n-i-1&&a[i][j]==a[0][0])k++;
if(i!=j&&j!=n-i-1&&(a[i][j]!=a[0][1]||a[i][j]==a[0][0]))l++;}}
if(m==n&&k... | C++ | 02a9081aed29ea92aae13950a6d48325 | 278b473e842a892336d6c6df2163cb76 | 1,000 | PASSED |
#include <iostream>
using namespace std;
char g,o;
int main() {
string h;
int a , c = 0, l = 0;
cin >> a ;
l = a - 1 ;
for (int i=0;i<a;i++) {
cin>>h;
if ( i == 0 ) {
g = h[0];
o = h[1];
}
for ( int j = 0 ; j < a ; j++ ) {
if ( j == l || j == c ) {
continue ;
}
if ( h[j] != o ){
c... | C++ | 02a9081aed29ea92aae13950a6d48325 | f64ed10f6f40308acc04f73596e4550d | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,j,k,b[26]={0},m=0,p=0;
scanf("%d",&n);
char a[n+1][n+1];
for(i=0;i<n;i++)
scanf("%s",a[i]);
for(i=0;i<n;i++)
for(j=0;j<n;j++){
b[a[i][j]-'a']++;
}
for(i=0;i<26;i++)
if(b[i]!=0)
... | C++ | 02a9081aed29ea92aae13950a6d48325 | b5948f24630f9b65914bba2a45d021ac | 1,000 | PASSED |
import sys
import os
range = xrange
input = raw_input
S = sys.stdin.read()
n = len(S)
A = []
i = 0
while i < n:
c = 0
while ord(S[i]) >= 48:
c = 10 * c + ord(S[i]) - 48
i += 1
A.append(c)
i += 1 + (S[i] == '\r')
inp = A; ii = 0
n = inp[ii]; ii += 1
coupl = [[] for _ in range(n)]
for _... | Python | 739e60a2fa71aff9a5c7e781db861d1e | 479155577366530719b3898b47485a1a | 2,200 | PASSED |
import sys
import os
range = xrange
input = raw_input
inp = [int(x) for x in os.read(0, 2**25).split()]; ii = 0
n = inp[ii]; ii += 1
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u = inp[ii] - 1; ii += 1
v = inp[ii] - 1; ii += 1
coupl[u].append(v)
coupl[v].append(u)
bfs = [0]
found = [0]*n... | Python | 739e60a2fa71aff9a5c7e781db861d1e | 554ad88e883566c8e5249b66f0b968b6 | 2,200 | PASSED |
import sys
range = xrange
input = raw_input
inp = [int(x) for x in sys.stdin.read().split()]; ii = 0
n = inp[ii]; ii += 1
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u = inp[ii] - 1; ii += 1
v = inp[ii] - 1; ii += 1
coupl[u].append(v)
coupl[v].append(u)
bfs = [0]
found = [0]*n
children = [[... | Python | 739e60a2fa71aff9a5c7e781db861d1e | ff3a8d1d97218b050ad9011fc5e82cf4 | 2,200 | PASSED |
import sys
range = xrange
input = raw_input
inp = [int(x) for x in sys.stdin.read().split()]; ii = 0
n = inp[ii]; ii += 1
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u = inp[ii] - 1; ii += 1
v = inp[ii] - 1; ii += 1
coupl[u].append(v)
coupl[v].append(u)
bfs = [0]
found = [0]*n
found[0] = 1... | Python | 739e60a2fa71aff9a5c7e781db861d1e | 0bccb635abe560c3795da5afb9b0d936 | 2,200 | PASSED |
import sys
range = xrange
input = raw_input
inp = [int(x) for x in sys.stdin.read().split()]; ii = 0
n = inp[ii]; ii += 1
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u = inp[ii] - 1; ii += 1
v = inp[ii] - 1; ii += 1
coupl[u].append(v)
coupl[v].append(u)
bfs = [0]
found = [0]*n
children = co... | Python | 739e60a2fa71aff9a5c7e781db861d1e | a5d2b801baa639c532ef29148c1f6bfc | 2,200 | PASSED |
import sys
import os
range = xrange
input = raw_input
S = os.read(0, 2**25)
n = 0
i = 0
while S[i] >= '0':
n = 10 * n + ord(S[i]) - 48
i += 1
i += 2
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u = v = 0
while S[i] >= '0':
u = 10 * u + ord(S[i]) - 48
i += 1
i += 1
whil... | Python | 739e60a2fa71aff9a5c7e781db861d1e | d5d1533f2dbdf8c058c5c94b56cb5de0 | 2,200 | PASSED |
import sys
import os
range = xrange
input = raw_input
S = os.read(0, 2**25)
n = 0
i = 0
while S[i] >= '0':
n = 10 * n + ord(S[i]) - 48
i += 1
i += 2
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u = v = 0
while ord(S[i]) >= 48:
u = 10 * u + ord(S[i]) - 48
i += 1
i += 1
... | Python | 739e60a2fa71aff9a5c7e781db861d1e | 8eeedd3337facb2dc2aa980ffad78e51 | 2,200 | PASSED |
import sys
import os
range = xrange
input = raw_input
inp = [int(x) for x in os.read(0, 2**25).split()]; ii = 0
n = inp[ii]; ii += 1
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u = inp[ii] - 1; ii += 1
v = inp[ii] - 1; ii += 1
coupl[u].append(v)
coupl[v].append(u)
bfs = [0]
found = [0]*n... | Python | 739e60a2fa71aff9a5c7e781db861d1e | cab6f4c0537fad4ef3c8ffdbb991edbf | 2,200 | PASSED |
import sys
import os
range = xrange
input = raw_input
inp = [int(x) for x in os.read(0, 2**25).split()]; ii = 0
n = inp[ii]; ii += 1
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u = inp[ii] - 1; ii += 1
v = inp[ii] - 1; ii += 1
coupl[u].append(v)
coupl[v].append(u)
bfs = [0]
found = [0]*n... | Python | 739e60a2fa71aff9a5c7e781db861d1e | 3f5d11f43c6cc137d151e3a062130805 | 2,200 | PASSED |
import sys
import os
range = xrange
input = raw_input
inp = [int(x) for x in os.read(0, 2**25).split()]; ii = 0
n = inp[ii]; ii += 1
coupl = [[] for _ in range(n)]
for _ in range(n - 1):
u = inp[ii] - 1; ii += 1
v = inp[ii] - 1; ii += 1
coupl[u].append(v)
coupl[v].append(u)
bfs = [0]
found = [0]*n
ch... | Python | 739e60a2fa71aff9a5c7e781db861d1e | b88418771e72ec84d2afeaddcf198ecd | 2,200 | PASSED |
import string
t = string.ascii_lowercase
t2 = list(t)
#print(t2)
n , m = map(int,input().split())
s = input()
for i in range(m):
x , y = input().split()
index_x = t2.index(x)
index_y = t2.index(y)
t2[index_x] , t2[index_y] = t2[index_y] , t2[index_x]
#print(t2)
for i in s :
index = ord(i) - ord('... | Python | 67a70d58415dc381afaa74de1fee7215 | ba02b91aebce084f69fa4733b4496ca0 | 1,200 | PASSED |
#In the name of Allah
from sys import stdin, stdout
input = stdin.readline
d = {'x': 'x', 'y': 'y', 'z': 'z', 'p': 'p', 'q': 'q', 'r': 'r', 's': 's', 't': 't', 'u': 'u', 'v': 'v', 'w': 'w', 'h': 'h', 'i': 'i', 'j': 'j', 'k': 'k', 'l': 'l', 'm': 'm', 'n': 'n', 'o': 'o', 'a': 'a', 'b': 'b', 'c': 'c', 'd': 'd', 'e': 'e',... | Python | 67a70d58415dc381afaa74de1fee7215 | 5929a0eb8caacdfd3f1a14765f32068b | 1,200 | PASSED |
import string
n, m = map(int, input().split())
word = list(input())
alphabet = list(string.ascii_lowercase)
alphabet_dict = {}
for i in range(len(alphabet)):
alphabet_dict[alphabet[i]] = alphabet[i]
for i in range(m):
x, y = input().split()
for letter in alphabet_dict:
if alphabet_dict[letter] == ... | Python | 67a70d58415dc381afaa74de1fee7215 | 8a3b7bbd064397372ea323c608f4a388 | 1,200 | PASSED |
n, m = map(int, input().split())
s = input()
d = {}
for i in "abcdefghijklmnopqrstuvwxyz":
d[i] = []
for j, l in enumerate(s):
d[l].append(j)
for i in range(m):
xi, yi = input().split()
d[xi], d[yi] = d[yi], d[xi]
r = {}
for k, v in d.items():
for pos in v:
r[pos] = k
for l in sorted(r.... | Python | 67a70d58415dc381afaa74de1fee7215 | 7e9360405672763098bfc70908916090 | 1,200 | PASSED |
letters, designers = [int(x) for x in input().split(' ')]
name = input()
alphabet_dict = {x: x for x in range(26)}
alphabet_arr = [(x + 97) for x in range(26)]
def print_dict(dict_al):
for key, value in dict_al.items():
print('{}: {}'.format(chr(key), chr(value)))
for _ in range(designers):
letter1, letter2 = inp... | Python | 67a70d58415dc381afaa74de1fee7215 | cd79b05c084705976d7e7542ee92a3f6 | 1,200 | PASSED |
n, m = map(int, input().split())
name = input()
charList = [[chr(ord('a') + i),chr(ord('a') + i)] for i in range(26)]
for i in range(m):
x, y = input().split()
(charList[ord(y)-ord('a')][1], charList[ord(x)-ord('a')][1]) = (charList[ord(x)-ord('a')][1], charList[ord(y)-ord('a')][1])
(charList[ord(y)-ord('... | Python | 67a70d58415dc381afaa74de1fee7215 | 1fe98f4e6b701f2050b20ea9e4def81c | 1,200 | PASSED |
n, m = map(int, input().split())
s = input()
s1 = ''
for i in range(ord('a'), ord('z') + 1):
s1 += chr(i)
s2 = s1 + ""
for i in range(m):
a, b = input().split()
s2 = s2.replace(a, '*')
s2 = s2.replace(b, a)
s2 = s2.replace('*', b)
ss = ''
for i in range(n):
ss += s2[s1.index(s[i])]
print(ss)
| Python | 67a70d58415dc381afaa74de1fee7215 | 5057f2c6b47bd8a942bc9a34d68b51d1 | 1,200 | PASSED |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.
"""
"""
from string import ascii_lowercase
l = ascii_lowercase
[n, m] = list(map(int, input().split()))
s = input()
a = [None] * n
for i in ran... | Python | 67a70d58415dc381afaa74de1fee7215 | 5ee598c22a5412e7c00d60a5109d66ee | 1,200 | PASSED |
if __name__ == "__main__":
n,m = map(int,input().split())
s = input()
mp = ['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']
mp2 = mp[:]
for i in range(m):
a,b = input().split()
t = mp2.index(a)
mp2[mp2.index(b)] = a
mp2[t]... | Python | 67a70d58415dc381afaa74de1fee7215 | 7c1e1b8a55653f0e55fe95fb0d7a812d | 1,200 | PASSED |
import string
import sys
import traceback
from contextlib import contextmanager
from io import StringIO
AL = string.ascii_lowercase.encode('ascii')
OA = ord('a')
def transform(n, m, name, designers):
tr = bytearray(AL)
for x, y in reversed(designers):
i1 = ord(x) - OA
i2 = ord(y) - OA
... | Python | 67a70d58415dc381afaa74de1fee7215 | 9b487c1610b2277343fab8dc88b7c23b | 1,200 | PASSED |
#include <stdio.h>
int main()
{
int i, j, n, one = 0, two = 0, three = 0, a;
scanf("%d", &n);
for(i = 0; i <n; i++){
scanf("%d", &a);
if(a==1){
one++;
}
else if(a==2){
two++;
}
else{
three++;
}
}
if(three>= t... | C | fcb6a715dfe302d7ae5a6695ca8976aa | 6f6b68d57b12f622ec69a9919aa07712 | 900 | PASSED |
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n],k=0,l=0,m=0,i;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n;i++){
if(a[i]==1){
k++;
}
if(a[i]==2){
l++;
}
if(a[i]==3){
m++;
}
}
... | C | fcb6a715dfe302d7ae5a6695ca8976aa | 6f3669ee0bfebefd2048c37aef7a6380 | 900 | PASSED |
#include <stdio.h>
int max(int a, int b, int c)
{
int m = a;
if (b > m) m = b;
if (c > m) m = c;
return m;
}
int main()
{
int n, x, i;
int a[3] = {0};
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &x);
a[x - 1]++;
}
printf("%d\n", a[0] + a[1] + a[... | C | fcb6a715dfe302d7ae5a6695ca8976aa | 814877f25a7e7ee0038913d9a543ac32 | 900 | PASSED |
#include <stdio.h>
int main(void) {
// your code goes here
int n,j;
scanf("%d",&n);
int i,a=0,b=0,c=0;
for(i=0;i<n;i++)
{
scanf("%d",&j);
if(j==1)a++;
if(j==2)b++;
if(j==3)c++;
}
int max=0;
if(a>=b && a>=c)
max=a;
if(b>=a && b>=c)
max=b;
if(c>=a && c>=b) max=c;
printf("\n%d... | C | fcb6a715dfe302d7ae5a6695ca8976aa | 896c5eb13cdcdb23093960774e3853b7 | 900 | PASSED |
#include<stdio.h>
int main()
{
long long int n,a,i,p=0,q=0,r=0;
scanf("%I64d",&n);
for(i=0;i<n;i++)
{
scanf("%I64d",&a);
if(a==1) p++;
else if(a==2) q++;
else if(a==3) r++;
}
if(p>=q&&p>=r) printf("%I64d ",q+r);
else if(q>=p&&q>=r) printf("%I64d ",p+r);
el... | C | fcb6a715dfe302d7ae5a6695ca8976aa | 602285cc87ffcf0c38614596b1d2a49a | 900 | PASSED |
#include<stdio.h>
int main()
{
int n,i,on=0,tw=0,th=0,a;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
if(a==1)
on++;
else if(a==2)
tw++;
else
th++;
}
if(on>=tw && on>=th)
printf("%d",n-on);
else if(tw>=on && tw>=th)
printf... | C | fcb6a715dfe302d7ae5a6695ca8976aa | 023d908ab76c579d5c0a7da81a01de0c | 900 | PASSED |
#include <stdio.h>
#include <stdlib.h>
int main(){
int n, x, ans;
int ct[4];
ct[1] = ct[2] = ct[3] = 0;
scanf("%d", &n );
while( n-- ){
scanf("%d", &x );
ct[x]++;
}
ans = ct[1] + ct[2];
if( ct[1]+ct[3] < ans ) ans = ct[1] + ct[3];
if( ct[2]+ct[3]... | C | fcb6a715dfe302d7ae5a6695ca8976aa | 4a94627e529e862badf3db9e15dcb0ea | 900 | PASSED |
/*
Badhan Sen
Student of C.S.E
jessore University of Science & Technology
Mail: galaxybd9@gmail.com
*/
#include <stdio.h>
int array[10000000];
int main ()
{
int n, i, a=0, b=0, c=0;
scanf ("%d", &n);
for... | C | fcb6a715dfe302d7ae5a6695ca8976aa | f012dfddde158470408b1d2f6ab77342 | 900 | PASSED |
#include<stdio.h>
#include<math.h>
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
int main()
{
long long n,i,x,a[3]={0};
scanf("%lld",&n);
for(i=0;i<n;i++)
{
scanf("%lld",&x);
x--;
a[x]++;
}
printf("%d",n-(MAX(a[0],MAX(a[1],a[2]))));
return 0;
}
| C | fcb6a715dfe302d7ae5a6695ca8976aa | 110ef01cd40390f564922c5de13f395a | 900 | PASSED |
#include<stdio.h>
int main()
{
int a,n,i,p=0,q=0,r=0;
scanf("%d",&n);
//while(n!=0)
for(i=1;i<=n;i++) {
scanf("%d",&a);
if(a==1){
p++;
}
else if(a==2) {
q++;
}
else {
r++;
}
//n--;
}
if(p>=q&&p>=r... | C | fcb6a715dfe302d7ae5a6695ca8976aa | 66b307c3d04c1a35eb6fd6ace47c7288 | 900 | PASSED |
#include<stdio.h>
#include<string.h>
main(){
int i,j,k,l,a=0,b,m,n;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&a);
scanf("%d",&b);
if(a<b){
if((b-a)%2!=0){
printf("1\n");
}
else
printf("2\n");
}
if(a==b){
printf("0\n");
}
if... | C++ | fcd55a1ca29e96c05a3b65b7a8103842 | ab6b5e417b1cab692cb67f7998c7ea2c | 800 | PASSED |
#include<bits\stdc++.h>
using namespace std;
int main()
{
int a,b,t; cin>>t;
while(t--)
{
cin>>a>>b;
if(a==b) cout<<0<<endl;
else if((a<b && (a-b)%2)||(a>b &&(a-b)%2==0)) cout<<1<<endl;
else cout<<2<<endl;
}
} | C++ | fcd55a1ca29e96c05a3b65b7a8103842 | 73d2b4f1be35466e50a8f6dc56ce0ba7 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,a,b,c;
cin>>t;
while(t--)
{
cin>>a>>b;
c=b-a;
if(c>0)
{
if(c%2!=0)//odd
cout<<1<<endl;
else
cout<<2<<endl;
}
if(c<0)
{
if(c%2==0)
cout<<1<<endl;
else
cout<<2<<endl;
}
if(c==0)
{
cout<<0<<endl;
}
... | C++ | fcd55a1ca29e96c05a3b65b7a8103842 | f151974cacb8a8b3a21b77822d234a78 | 800 | PASSED |
#include <stdio.h>
int main()
{
static long int i,t,j,k,x,a[1000000],b[1000000];
scanf("%lld", &t);
for(i=0;i<t;i++)
{
scanf("%ld %ld", &a[i],&b[i]);
}
for(i=0;i<t;i++)
{
if(a[i] < b[i])
{
k = (b[i] - a[i]);
if(k%2 == 0) printf("2\n");
... | C++ | fcd55a1ca29e96c05a3b65b7a8103842 | 7163ff46bc9940bd13b24ab93db7707e | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--) {
int a, b;
cin >> a >> b;
if(a==b)
cout << "0\n";
else if((a&1)^(b&1)&&a<b)
cout << "1\n";
else if((a&1)==(b&1)&&a>b)
cout << "... | C++ | fcd55a1ca29e96c05a3b65b7a8103842 | ddb93c88bd1d3ecc9f81d9e064331f09 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
if(a==b)cout<<0<<"\n";
if(a%2!=b%2&&a>b)cout<<2<<"\n";
if(a%2==b%2&&a>b)cout<<1<<"\n";
if(a%2!=b%2&&a<b)cout<<1<<"\n";
if(a%2==b%2&&a<b)cout<<2<<"\n";
}
return 0;
}
| C++ | fcd55a1ca29e96c05a3b65b7a8103842 | d3eae55811abfdfb5d9ed43f6baed3fc | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
if(a==b)cout<<"0\n";
if((a&1)!=(b&1)&&a>b)cout<<"2\n";
if((a&1)==(b&1)&&a>b)cout<<"1\n";
if((a&1)!=(b&1)&&a<b)cout<<"1\n";
if((a&1)==(b&1)&&a<b)cout<<"2\n";
}
return 0;
}
| C++ | fcd55a1ca29e96c05a3b65b7a8103842 | d33436b5e6eccf25a5f9d445c75444e3 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
if(a==b)cout<<"0\n";
else
if((a&1)==(b&1)&&a>b)cout<<"1\n";
else
if((a&1)!=(b&1)&&a<b)cout<<"1\n";
else
cout<<"2\n";
}
return 0;
... | C++ | fcd55a1ca29e96c05a3b65b7a8103842 | 57020815b9228af7add63fff4b313b03 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
if(a==b)cout<<0<<"\n";
if((a&1)!=(b&1)&&a>b)cout<<2<<"\n";
if((a&1)==(b&1)&&a>b)cout<<1<<"\n";
if((a&1)!=(b&1)&&a<b)cout<<1<<"\n";
if((a&1)==(b&1)&&a<b)cout<<2<<"\n";
}
retur... | C++ | fcd55a1ca29e96c05a3b65b7a8103842 | f72008d4b2999348a2259a95b0270c95 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
if(a==b)cout<<"0\n";
if((a&1)!=(b&1)&&a>b)cout<<"2\n";
if((a&1)==(b&1)&&a>b)cout<<"1\n";
if((a&1)!=(b&1)&&a<b)cout<<"1\n";
if((a&1)==(b&1)&&... | C++ | fcd55a1ca29e96c05a3b65b7a8103842 | 9d8a5e42ec49bf64ea9d06658741be6f | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1e9+7;
ll mul(ll a,ll b)
{
return ((a%mod)*(b%mod))%mod;
}
ll add(ll a,ll b)
{
return ((a%mod)+(b%mod))%mod;
}
ll po(ll a, ll b)
{
if(b==0)
{
return 1;
}
ll t=po(a,b/2);
if(b%2)
{
return mul(t,mul(t,a));
}
else
{
return mul(t... | C++ | 537791353fe9f5892f28e1793bae2935 | fd793ec55857777629452c54080d77b2 | 1,600 | PASSED |
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;
const int N = 1e5 + 10;
int dp[N][6][2];
long long a[N];
int n, k, z;
long long solve(int i, int left, int prv, int moves)
{
... | C++ | 537791353fe9f5892f28e1793bae2935 | ce63d8fc585fdd2254942fc5c2530804 | 1,600 | PASSED |
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;
const int N = 1e5 + 10;
long long dp[N][6][2];
long long a[N];
int n, k, z;
long long solve(int i, int left, int prv, int mov... | C++ | 537791353fe9f5892f28e1793bae2935 | a20815907b160d95c35620b4eff957c5 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
const int INF = 1e9 + 5;
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][7][3];
int solve(int at, int left_already, bool last_right, int moves) {
if (moves == k) return numbers[at];
int &ans = dp[at][left_already... | C++ | 537791353fe9f5892f28e1793bae2935 | 54d7852443dce52c5478bfe76f2d62d4 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int mx = 1e5 + 5;
int numbers[mx];
int n, k, z;
int dp[mx][6][2];
int solve(int at, int left_already, bool last_right, int moves) {
if (moves == k) return numbers[at];
int &value = dp[at][left_already][last_right];
if (val... | C++ | 537791353fe9f5892f28e1793bae2935 | 6669e7b3c791817f2a48f7b5df86828a | 1,600 | PASSED |
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 100001
#define M 1000000007
#define nl cout<<"\n";
#define er cout<<"... | C++ | 537791353fe9f5892f28e1793bae2935 | b3e036b15f3e6fb864d9304bbe43bcda | 1,600 | PASSED |
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 100005
#define M 1000000007
#define nl cout<<"\n";
#define er cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL... | C++ | 537791353fe9f5892f28e1793bae2935 | 220cb3b8e3f0c2ea3e55f7964e7a7b00 | 1,600 | PASSED |
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 100005
#define M 1000000007
#define nl cout<<"\n";
#define er cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL... | C++ | 537791353fe9f5892f28e1793bae2935 | da8241dbb1c0fc5b7e6bb9e2020fc3a8 | 1,600 | PASSED |
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define loop(i,a,b) for(ll i=a;i<b;++i)
#define loope(i,a,b) for(ll i=a;i<=b;++i)
#define loopr(i,a,b) for(ll i=a;i>=b;--i)
#define loops(i,a,b,step) for(ll i=a;i<b;i+=step)
#define all(a) a.begin(),a.end()
#define FAST ios_base::sync_... | C++ | 537791353fe9f5892f28e1793bae2935 | 7bdf36b07aca3f02222750d61fcfe79e | 1,600 | PASSED |
#include <bits/stdc++.h>
#pragma GCC target ("arch=ivybridge")
using namespace::std;
//#define int long long
#define all(x) (x).begin(), (x).end()
#define inf (sizeof(int) == 4 ? (int)1E9 + 5 : (int)1E18 + 5)
typedef array<int, 3> tri;
template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I... | C++ | 537791353fe9f5892f28e1793bae2935 | 0a455616472336f732abe3c844c9476b | 1,600 | PASSED |
/// You just can't beat the person who never gives up
/// ICPC next year
#include<bits/stdc++.h>
using namespace std ;
const int N = 5e5+5 ;
int n ,a[N] ,l[N] ,r[N] ;
set<pair<int,int>> st ;
set<int> idx ;
int main(){
scanf("%d",&n);
for(int i=0;i<n;++i){
scanf("%d",a+i);
l[i] = i-1 ,r[i] = i+... | C++ | e7e0f9069166fe992abe6f0e19caa6a1 | cb57b1418435defd440ca052135a0cf3 | 2,500 | PASSED |
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<stack>
#include<algorithm>
using namespace std;
#define REP(i,e,s) for(register int i=e; i<=s; i++)
#define DREP(i,e,s) for(register int i=e; i>=s; i--)
#define ll long long
#define DE(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG(a) DE("... | C++ | e7e0f9069166fe992abe6f0e19caa6a1 | 50955cffdd48e9cf85b82f08d7d3b75d | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
const int MAXN = 500010;
int n;
int L[MAXN];
int R[MAXN];
int v[MAXN];
int ord[MAXN];
bool cmp(int i, int j) { return v[i] < v[j]; }
int main()
{
scanf("%d",&n);
for(int i = 1 ; i <= n ; i++)
scanf("%d",&v[i]);
iota( L + 1 , L + n + 1... | C++ | e7e0f9069166fe992abe6f0e19caa6a1 | db0fafc361686cdcfcb9079bbea6c769 | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn = 500010;
ll n,a[maxn],S[maxn],top,ans;
int main()
{
scanf("%lld",&n);
for (ll i = 1; i <= n; i++)
scanf("%lld",&a[i]);
for (ll i = 1; i <= n; i++)
{
while (top > 1 && S[top] <= S[top - 1] && S[top] <= a... | C++ | e7e0f9069166fe992abe6f0e19caa6a1 | 7615109fa817a3e37d99d2bc697183c6 | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int a[500005];
bool cmp(int x,int y)
{
return (a[x]<a[y]);
}
int main()
{
int n;
scanf("%d",&n);
vector<int> v;
set<int> s;
for (int i=0;i<n;i++)
{
scanf("%d",&a[i]);
s.insert(i);
v.push_back(i);
}
sort(v.begin(),v.end(),cmp);
long long ans=0;
queue<int> q;... | C++ | e7e0f9069166fe992abe6f0e19caa6a1 | 0e3801125ab66ddce5c0e2cb8815286c | 2,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int n,a[500005];
long long ans;
int main(){
scanf("%d",&n);
int x=-1;
while(n--){
x++;
scanf("%d",&a[x]);
while(x>=2&&a[x-1]<=min(a[x-2],a[x])){
ans+=min(a[x-2],a[x]);
a[x-1]=a[x];
x--;
}
}
for(int i=1;i<x;i++){
ans+=min(a[i-1],a[i+1]);
}
printf("%... | C++ | e7e0f9069166fe992abe6f0e19caa6a1 | ee75ddcae0b188e02cd9e3057c317800 | 2,500 | PASSED |
// You need the dark in order to show the light - Bob Ross :))
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, a, ind;
long long ans = 0;
vector <int> arr;
int main() {
cin >> n;
if(n == 2) {
int a, b;
cin >> a >> b;
cout << 0 << endl;
return 0;
} else if(n == 1) {
ci... | C++ | e7e0f9069166fe992abe6f0e19caa6a1 | 7530465c39f94d6bf64e0d012e26963a | 2,500 | PASSED |
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
using namespace std;
const int N=5e5+5;
int n,x,l,tot,a[N],pr[N],ne[N];
pair < int , int > p[N];
ll ans;
main () {
scanf("%d",&n);
for (int i=1; i<=n; i++) {
scanf("%d",&a[i]);
pr[i]=i-1,ne[i]=i+1;
p[i].F=a[i],p[i].S=i;
}
sort(p+... | C++ | e7e0f9069166fe992abe6f0e19caa6a1 | 524799377b42c9d46af0df9cd111742d | 2,500 | PASSED |
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FAST std::ios_base::sync_with_stdio(false);cin.ti... | C++ | e7e0f9069166fe992abe6f0e19caa6a1 | 789942b1f133c48ff20ca59c8bb737c1 | 2,500 | PASSED |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll n;
ll a[500005];
ll nxt[500005];
ll pre[500005];
queue<ll> q;
bool vis[500005];
bool check(ll x)
{
if(a[x] <= a[nxt[x]] && a[x] <= a[pre[x]]) return true;
return false;
}
int main()
{
ios_base::sync_with_stdio(false);
... | C++ | e7e0f9069166fe992abe6f0e19caa6a1 | 4f95c1054808f4d84d06f76ffd792a98 | 2,500 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<long long,int>, null_type, less<pair<long long,int>>, rb_tree_tag,
tree_o... | C++ | f2f9f63a952794f27862eb24ccbdbf36 | d86abb9009ef9108639e1b87f04e2781 | 1,600 | PASSED |
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
using less_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
using great_set = tree<in... | C++ | f2f9f63a952794f27862eb24ccbdbf36 | baab61910c17a0b2b1f995f21f6317b5 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int dp[3505][3505];
int arr[3505];
int solve(int i, int j){
int &ret=dp[i][j];
if(ret!=-1)return ret;
ret=0;
int remaining = i+(n-j-1);
//cout<<"i: "<<i<<", j: "<<j<<", remaining: "<<remaining<<endl;
if(remaining==m-1)return ret=max(arr[... | C++ | f2f9f63a952794f27862eb24ccbdbf36 | 369488eded0fc4ba6e80b5cb9c8be29a | 1,600 | PASSED |
#include <iostream>
#include <set>
using namespace std;
const int MAXN=4500;
int num[MAXN];
multiset<int> p;
int main(){
ios::sync_with_stdio((false));
p.insert(1);
p.insert(1);
p.erase(1);
for(auto item:p){
cout<<item<<" ";
}
int kase;cin>>kase;
while(kase--){
int nle... | C++ | f2f9f63a952794f27862eb24ccbdbf36 | 681444483ad924e0290ea17186385631 | 1,600 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.