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 <stdio.h> #include <algorithm> #include <utility> #include <vector> #include <queue> #include <map> #include <set> #include <string> #include <vector>; using namespace std; const int N=2000; int n; struct ind { int n,c; ind(int n,int c) { this->n=n; this->c=c; } bool operator<(const ind &b) const {...
C++
97bbbf864fafcf95794db671deb6924b
9ecedd399dbfc794d3aa733b8dc961c5
1,900
PASSED
#include <stdio.h> #include <sstream> #include <iostream> #include <string> #include <algorithm> #include <vector> #include <list> #include <iomanip> #include <map> #include <set> #include <cmath> #include <queue> #include <cassert> #include <string.h> using namespace std; #pragma comment(linker, "/STACK:20000000") ty...
C++
97bbbf864fafcf95794db671deb6924b
29c9b5cbbd6ca99457d9f55cec389230
1,900
PASSED
#include <algorithm> #include <cstdio> #include <cstring> using namespace std; typedef long long ll; ll s[2001]; int main() { int n; scanf("%d", &n); memset(s, 0x33, sizeof(s)); s[0] = 0; for (int i = 0; i < n; i++) { int t, c; scanf("%d%d", &t, &c); for (int j = n-1; j >= ...
C++
97bbbf864fafcf95794db671deb6924b
61fcd058f1508bfdea2e871c71acdc70
1,900
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include<fstream> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cs...
C++
97bbbf864fafcf95794db671deb6924b
e4c1676d67eef8917401ed9dacffe5fb
1,900
PASSED
#include <cstdio> #include <cstring> #include <algorithm> #include <map> #include <set> #include <vector> #include <string> #include <iostream> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector <int> vi; const ll inf = 1000000000000000LL; int n; int t[2100]; int c[2100]; ll a[50...
C++
97bbbf864fafcf95794db671deb6924b
bb987abdf1fbf13d21ba296d5280ff92
1,900
PASSED
#include <cstdio> #define N 2005 #define ll long long ll a[N]; const ll inf=1LL<<62; int n; inline ll minim(ll x,ll y) { return ( (x<y) ? (x) : (y) ); } int main() { ll c; int t,x; scanf("%d",&n); int now=0,last=1; for(int i=0; i<n; ++i) { scanf("%d%d",&t,&x); c=(ll)x; ...
C++
97bbbf864fafcf95794db671deb6924b
df2f5426302db4223823c225413857dd
1,900
PASSED
#include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <queue> #include <cassert> #include <ctime> #include <map> #include <set> #define forn(i, n) for(int i = 0; i < int(n); i++) #define X first #define Y second #define sz(s) (int)(s).size() #define mp make_pair using n...
C++
97bbbf864fafcf95794db671deb6924b
35e4fb413d54ec6a59012a40340e05bc
1,900
PASSED
#include <iostream> #include <vector> using namespace std; const long long int z=1e18; int n; struct gd { int t,c; }; vector <gd> a; vector <long long int> b; int main() { cin >> n; b.assign(n+1,z); b[0]=0; a.resize(n); for (int i=0;i<n;i++) { cin >> a[i].t >> a[i].c; a[i].t+...
C++
97bbbf864fafcf95794db671deb6924b
257f1bf1c46c85a5a4a2127b0f3bd34b
1,900
PASSED
#include <stdio.h> #include <memory.h> #include <algorithm> struct tov { int t,c; }; tov a[10000]; long long dp[3000]; long long min(long long a,long long b) { return (a>b)?b:a; } void main() { int n; scanf("%d",&n); for (int i=0;i<n;i++) scanf("%d%d",&a[i].t,&a[i].c); memset(dp,60,sizeof(long long)*3000); dp...
C++
97bbbf864fafcf95794db671deb6924b
80b2b14e492c8e63b92bd785e233d45c
1,900
PASSED
#include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { int n; cin>>n; vector <vector < ll > > d(n+1,vector <ll > (n+1,-1)); d[0][0]=0; vector <pair <int ,int > > v(n); for(int i=0;i<n;i++) cin>>v[i].second>>v[i].first; for(int i=1;i<=n;i++) ...
C++
97bbbf864fafcf95794db671deb6924b
3c9434f78dd851b3d509154f9d6652d6
1,900
PASSED
//#pragma GCC optimize(2) #include<bits/stdc++.h> using namespace std; #define ll long long #define ls o<<1 #define rs o<<1|1 #define pii pair<int,int> #define fi first #define se second const double pi=acos(-1.0); const double eps=1e-10; const ll mod=1e9+7; const int INF=0x3f3f3f3f; ll read(){ ll x=0,f=1; char ch=ge...
C++
d418db46dd3aa411836774a4cc7f73d7
f0b4b32aa3ccf8f0081b4c4dbcd2197b
2,300
PASSED
#include <cstdio> #include <cctype> #include <cstring> #include <algorithm> using namespace std; #define File(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout) typedef long long ll; template<typename T> inline void in(T &x){ //Read Positive Integer. char ch; x = 0; // int f = 1; while(isspace(ch = getcha...
C++
d418db46dd3aa411836774a4cc7f73d7
6bfefe807d98543bf935be2f4c8abb89
2,300
PASSED
#include <bits/stdc++.h> using namespace std; using ll=long long; const int LG=32; ll dp[LG][2][2]; ll calc(int idx, int t1, int t2, int l, int r) { if (idx==-1) return 1; if (dp[idx][t1][t2]!=-1) return dp[idx][t1][t2]; int k1 = (t1) ? ((l>>idx)&1) : 1; int k2 = (t2) ? ((r>>idx)&1) :...
C++
d418db46dd3aa411836774a4cc7f73d7
e5fd50b796240bc0bb4792fe39024ab0
2,300
PASSED
#include <bits/stdc++.h> using namespace std; using ll=long long; const int LG=31; ll dp[LG][2][2]; ll calc(int idx, int t1, int t2, int l, int r) { if (idx==-1) return 1; if (dp[idx][t1][t2]!=-1) return dp[idx][t1][t2]; ll res=0; int k1 = (t1) ? ((l>>idx)&1) : 1; int k2 = (t2) ? ((r>>idx)&1) : 1;...
C++
d418db46dd3aa411836774a4cc7f73d7
3d9036b7f9575febefbbaba701862411
2,300
PASSED
#pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native") #include <bits/stdc++.h> using namespace std; using ll=long long; const int LG=32; ll dp[LG][2][2]; ll calc(int idx, int t1, int t2, int l, int r) { if (idx==-1) return 1; if (dp[idx][t...
C++
d418db46dd3aa411836774a4cc7f73d7
e1d7ce3fcff5c115cf748d93442389a1
2,300
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=3e5+5; const int mod=1e9+7; #define pb push_back #define fi first #define se second #define all(x) (x).begin(),(x).end() #define rep(i,a,n) for (int i=a;i<=n;i++) #define per(i,a,n) for (int i=n;i>=a;i--) typedef long long ll; typedef double db; typedef vector...
C++
d418db46dd3aa411836774a4cc7f73d7
484f66cd890c943e382a77c36e1f4454
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define fst first #define snd second typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; #define pb push_back #define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++) #ifndef ONLINE_JUDGE #define debug(args...) fprintf(st...
C++
d418db46dd3aa411836774a4cc7f73d7
0b4f73f5b03ed2f6efe27ce26069f81d
2,300
PASSED
#include<bits/stdc++.h> using namespace std; long long dp[35][2][2]; long long ans(int l,int r,int x,int sa,int sb){ if(x==-1)return 1; if(dp[x][sa][sb]!=-1)return dp[x][sa][sb]; int ma=1,mb=1; if(sa)ma=(l>>x)&1; if(sb)mb=(r>>x)&1; dp[x][sa][sb]=0; for(int i=0;i<=ma;i++){ for(int j...
C++
d418db46dd3aa411836774a4cc7f73d7
3175cb266519f74ba0dcf8c0d0944a94
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define mp make_pair ll dp[66][2][2]; ll solve(ll a,ll b){ if(a==-1)return 0; if(a==0)return b+1; vector<int> va,vb; while(a){ va.pb(a%2); a/=2; } while(b){ vb.pb(b%2); b/=2; ...
C++
d418db46dd3aa411836774a4cc7f73d7
be78782c20ea3dd5eabc294c157822f3
2,300
PASSED
#include<bits/stdc++.h> using namespace std; #define LL long long int f(int x,int r){//the num[0,r-1] int ans=0,w=0; for(int i=1;i<=r;i<<=1){ if(r&i){ r^=i; if(!(r&x))ans+=(1<<w); } if(!(x&i))w++; } return ans; } LL cal(int l,int r){ LL ans=0; if(l==r)return 0; if(l==0)return 2*r-1+cal(1,r); if(l&1)...
C++
d418db46dd3aa411836774a4cc7f73d7
1ed3f47d9da98b83bc037cfe6f679267
2,300
PASSED
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int numOfFriends = scn.nextInt(), fenceHeight = scn.nextInt(), count = 0, n; for (int i = 0; i < numOfFriends; i++) { n = scn.nextInt(); if (...
Java
e7ed5a733e51b6d5069769c3b1d8d22f
cadc9c949c687eca80e82578eb55467a
800
PASSED
import java.util.Scanner; public class VanyaAndFence { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int friendNum = scanner.nextInt(); int fenceHeight =scanner.nextInt(); int minWidthOfRoad = 0; for (int i = 0; i < friendNum; i++) { ...
Java
e7ed5a733e51b6d5069769c3b1d8d22f
7b57aa1e06c21fbf8d3ce8c4f706257f
800
PASSED
import java.util.Scanner; public class VenyaAndFence { public static void main(String[] args) { Scanner input = new Scanner (System.in); int num =input.nextInt() , h =input.nextInt(), width =0; for (int i=1; i<=num; i++){ int ai = input.nextInt(); if (ai <= h) w...
Java
e7ed5a733e51b6d5069769c3b1d8d22f
68f32573db9e4dee52ce63224f39333a
800
PASSED
import java.util.Scanner; public class problem { public static void main(String[] args) { int n,h,w=0 , s; Scanner input = new Scanner(System.in); n=input.nextInt(); h=input.nextInt(); int [] arr=new int[n]; for(int i=0;i<n;i++) { ...
Java
e7ed5a733e51b6d5069769c3b1d8d22f
9687557d24b8b2f854f96be4fbd0bcac
800
PASSED
//package test; import java.util.Scanner; public class test { public static void main(String[] args) { // TODO Auto-generated method stub Scanner IN = new Scanner(System.in); int n,h,len,x; n = IN.nextInt(); h = IN.nextInt(); len = 0; for (int i = 1; i<=n; i++){ x = IN.nextInt(); if(x>h) len+...
Java
e7ed5a733e51b6d5069769c3b1d8d22f
56b740461104239c756a9e0e1b97e39f
800
PASSED
import java.util.Scanner; /** * * @author i7 */ public class ProblemSolving { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int n,h,w=0,s; Scanner input = new Scanner(System.in); ...
Java
e7ed5a733e51b6d5069769c3b1d8d22f
665034e91b7cc7d2a3a8a32b906167e4
800
PASSED
import java.util.Scanner; public class test { public static Scanner myScanner = new Scanner(System.in); public static void main(String[] args) { int n = myScanner.nextInt(); int h = myScanner.nextInt(); int[] arr = new int[n]; int result = 0; for(int X = 0; X < n ; X++) { arr[X] = myScanner.nextIn...
Java
e7ed5a733e51b6d5069769c3b1d8d22f
7f3a4adc453d44c00385e9aab2c08595
800
PASSED
import java.util.Scanner; public class Test { public static Scanner myScanner = new Scanner(System.in); public static void main(String[] args) { int n, h; n = myScanner.nextInt(); h = myScanner.nextInt(); int[] numOfFriends = new int[n]; int minimumWidth = 0; for(int p = 0; p < n; p++) { numOfFr...
Java
e7ed5a733e51b6d5069769c3b1d8d22f
c5ee0faa75b1f854443bcf7049e84ea7
800
PASSED
import java.util.Scanner; /** * * @author CesarAlfonsoMendoza */ public class A { public static void main(String[]args){ Scanner in = new Scanner(System.in); int n=in.nextInt(),h=in.nextInt(),persona,suma=0; for(int i=0;i<n;i++) { persona=in.nextInt(); if(persona>h) suma+=2; else...
Java
e7ed5a733e51b6d5069769c3b1d8d22f
dc7a02440fa32a74e247d6b637871a59
800
PASSED
import java.util.Scanner; public class Main { private static int PersonsNumber; private static int FenceHeight ; private static int RoadSize = 0 ; public static void main(String[] args) { // write your code here Scanner myObj = new Scanner(System.in); ...
Java
e7ed5a733e51b6d5069769c3b1d8d22f
3b830d85a368e3f8fa218bba869287c7
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t,n,i,j,index; char s[100000]; cin>>t; for(i=0;i<t;i++) { cin>>n; index=1; if(n%2!=0) { s[0]='7'; n=n-3; while(n>0) { s[index]='1'; ...
C++
07db573b0db736d798b6c18c06c32f3d
98376ecd4f29a3117f081277837cdeb6
900
PASSED
#include <bits/stdc++.h> using namespace std; // To give an input string after a integer or double is taken input //cin.ignore(); // better to use 2 times getline(cin,s); #define pb push_back #define mk make_pair #define siz size() #define endl "\n" #define ll long long int #define ld long double void fast() { ios...
C++
07db573b0db736d798b6c18c06c32f3d
0837007d2272618d6b8973e4f8f3ca2b
900
PASSED
#include<iostream> using namespace std; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; unsigned long long number =0 ; if(n%2==0){ while(n) { cout<<"1"; n=n-2; } } else { ...
C++
07db573b0db736d798b6c18c06c32f3d
5e0a3fea6df3db0fa95b78e1089581bd
900
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; long long int i, j; for (i = 0; i < n; i++) { long long int m; long long int p = m; cin >> m; if (m % 2 == 0) { for(j=0;j<m/2;j++){ cout<<"1"; ...
C++
07db573b0db736d798b6c18c06c32f3d
de98dcdf85408a8e24c58fce9964e4a9
900
PASSED
#import<iostream> using namespace std;main(int n){for(cin>>n;cin>>n;)cout<<"17"[n&1]+string(n/2-1,49)+" ";}
C++
07db573b0db736d798b6c18c06c32f3d
e47161767fd14897c0750945daa4a8fa
900
PASSED
#import<iostream> using namespace std;main(int n){for(cin>>n;cin>>n;)cout<<(n&1?"7":"1")+string(n/2-1,'1')+" ";}
C++
07db573b0db736d798b6c18c06c32f3d
80bf8ae6f7ef2ab13e5bd3b885891802
900
PASSED
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define danon ios_base::sync_with_stdio(false); cin.tie(); cout.tie(); #define ll long long #define ld long double #define pb push_back typedef vector<int> vi; typedef vector<string> vs; const int inf=(int)1e9; const int lyam=(int)1e6; con...
C++
07db573b0db736d798b6c18c06c32f3d
4942d58f4909591d1d15e70b39c0caf7
900
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long #define debug(x) cout<<#x<<" "<<x<<endl typedef pair<int,int> pi; #define F first #define S second inline void solve() { int n; cin >> n; string num = ""; if(n & 1) num += '7' , n -= 3; /// n is even at this line -> full utilization o...
C++
07db573b0db736d798b6c18c06c32f3d
0aa1ab3e9e5944956a5d3651618eb37e
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,a,b,i,s=0,k; cin>>n; for(i=1; i<=n; i++) { s=0; cin>>a; if(a%2==0) { k=a/2; for(int y=0; y<k; y++) { cout<<"1"; } } else if(a%2!...
C++
07db573b0db736d798b6c18c06c32f3d
1b6c07e219499ae364e67540aca30ecd
900
PASSED
//Nihal Mittal - nihal_47 //Strike First , Strike Hard , No Mercy !! /**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀ ⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀ ⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀ ⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀ ⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀ ⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀ ⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀ ⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀ ⠀...
C++
07db573b0db736d798b6c18c06c32f3d
c69c779958b2e6f8084613a787388605
900
PASSED
from math import * from collections import * from operator import itemgetter import bisect from heapq import * i = lambda: input() ii = lambda: int(input()) iia = lambda: list(map(int,input().split())) isa = lambda: list(input().split()) I = lambda:list(map(int,input().split())) chrIdx = lambda x: ord(x)-96 idxChr = la...
Python
a98f67141b341152fcf20d803cbd5409
d8498ad02add4a9f32695655e17a004d
1,500
PASSED
from math import * from collections import * from operator import itemgetter import bisect from heapq import * i = lambda: input() ii = lambda: int(input()) iia = lambda: list(map(int,input().split())) isa = lambda: list(input().split()) I = lambda:list(map(int,input().split())) chrIdx = lambda x: ord(x)-96 idxChr = la...
Python
a98f67141b341152fcf20d803cbd5409
6e784f87d0d0cfabded9371554c04f11
1,500
PASSED
# cook your dish here for _ in range(int(input())): n=int(input()) a=list(map(int,input().split())) a=[0]+a k=[] check1=0 check2=0 l=0 for i in range(1,n+1): if a[i]!=i: check1=1 else: l+=1 k.append(i) if check1==0: print(0)...
Python
a98f67141b341152fcf20d803cbd5409
6fc181cb4e7db89a3b099b863cf93d23
1,500
PASSED
t = int(input()) for i in range(t): n = int(input()) a = [int(i) for i in input().split()] sorteda = [i for i in a] sorteda.sort() acheck = [1 if a[i]==sorteda[i] else 0 for i in range(n)] a1check = [i for i in acheck] a1check.reverse() if a == sorteda: print(0) elif 1 not in...
Python
a98f67141b341152fcf20d803cbd5409
8bc2e98449a22b51b78d5393e885e3a7
1,500
PASSED
import sys import bisect as bi import math from collections import defaultdict as dd import heapq input=sys.stdin.readline #sys.setrecursionlimit(10**7) mo=10**9+7 def cin(): return map(int,sin().split()) def ain(): return list(map(int,sin().split())) def sin(): return input() def inin(): re...
Python
a98f67141b341152fcf20d803cbd5409
df83b2dfe0634eb81bf7d551aced5216
1,500
PASSED
for _ in range(0, int(input())) : j = int(input()) l = list(map(int, input().strip().split())) r = 0 index = [] flag = 0 length = 0 for i in range(1, j + 1): if l[i-1] == i : r += 1 index.append( i ) # print(index) if r > 1: if index[-1] - 1 != index[-2]: flag = 1 # print(in...
Python
a98f67141b341152fcf20d803cbd5409
4d416f63ea4d344e19ff4e18c9734189
1,500
PASSED
t = int(input()) for i in range(t): n = int(input()) arr = list(map(int, input().split())) chcounter = 0 if arr[0] == 1: falseflag = False trueflag = True else: falseflag = True trueflag = False for j in range(n): if arr[j] == (j + 1): ...
Python
a98f67141b341152fcf20d803cbd5409
d7b9aaa15be9b4031706c265e7727670
1,500
PASSED
from collections import Counter import string import math import sys from fractions import Fraction def array_int(): return [int(i) for i in sys.stdin.readline().split()] def vary(arrber_of_variables): if arrber_of_variables==1: return int(sys.stdin.readline()) if arrber_of_variables>=2: ret...
Python
a98f67141b341152fcf20d803cbd5409
4a2e70ad55042489b0f25c36757d35bf
1,500
PASSED
import os,io from sys import stdout import collections # import random # import math # from operator import itemgetter input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline # from collections import Counter # from decimal import Decimal # import heapq # from functools import lru_cache import sys # import threadi...
Python
a98f67141b341152fcf20d803cbd5409
7f733dc6713f921ce5c410770a682f3c
1,500
PASSED
for nt in range(int(input())): n = int(input()) a = list(map(int,input().split())) b = sorted(a) if a==b: print (0) continue else: flag = [] for i in range(n): if a[i]!=i+1: flag.append(i) # print (flag) if len(flag)!=0: if flag[-1] - flag[0] == len(flag)-1: print (1) else: print (...
Python
a98f67141b341152fcf20d803cbd5409
d09329d188fff91882b817b9c44d39d0
1,500
PASSED
st = str(raw_input()) n = int(raw_input()) size = len(st)/n def is_palindrome(seq): return seq == seq[::-1] if n <= len(st): cnt = 0 for i in range(0,len(st),size): if is_palindrome(st[i:size+i].lower()): cnt += 1 else: cnt -=1 if cnt == n: print "YES" else: print "NO" else: ...
Python
43bb8fec6b0636d88ce30f23b61be39f
7956bc4c65a48358e90bccdd9bd52207
1,100
PASSED
s = raw_input() k = int(raw_input()) n = len(s) if n % k != 0: print "NO" else: d = n / k for i in xrange(0, n, d): if s[i:i + d] != s[i:i + d][::-1]: print "NO" break else: print "YES"
Python
43bb8fec6b0636d88ce30f23b61be39f
1e44175c18bc81c938aa77bdaed4f23d
1,100
PASSED
def isPal(s): a = [x for x in s] b = [x for x in s] b.reverse() return a == b def f(s,k,n): if n % k != 0: return 'NO' l = n / k for i in range(k): if not isPal(s[i * l : (i + 1) * l]): return 'NO' return 'YES' s = raw_input() k = int(raw_input()) n = len(s) print f(s,k,n)
Python
43bb8fec6b0636d88ce30f23b61be39f
adc6333ce9078e46e3ec49f77c2fdad8
1,100
PASSED
t=raw_input() n=input() L=len(t) l=L/n flag=0 i=0 j=l if L%n!=0: j=L+1 while(j<=L): t1=t[i:j] t2=t1[::-1] if t1==t2: flag=1 else: flag=0 break i=j j=j+l if(flag==1): print "YES" else: print "NO"
Python
43bb8fec6b0636d88ce30f23b61be39f
e4bb4830daf76bb2a54ea6a44e03ba26
1,100
PASSED
def A(): s=raw_input() k=int(raw_input()) if len(s)%k!=0: return "NO" for i in xrange(0, len(s), len(s)/k): p=s[i:i+(len(s)/k)] if p!=p[::-1]: return "NO" return "YES" print A()
Python
43bb8fec6b0636d88ce30f23b61be39f
622e58401fd6789c3c1d8c089d251c4f
1,100
PASSED
data=raw_input() n=int(raw_input()) chk=0 length=len(data)/n if len(data)%n!=0: print 'NO' exit(0) for i in range(n): tmp=data[i*length:i*length+length] for i in range(len(tmp)): if tmp[i]!=tmp[len(tmp)-i-1]: chk=1 break if chk==1: print 'NO' break if chk==0: print 'YES'
Python
43bb8fec6b0636d88ce30f23b61be39f
3aeda6d49d2035f250ae43a82d3462cf
1,100
PASSED
text = raw_input() m = int(raw_input()) length = len(text) if length % m: print "NO" else: blocks = [text[i:i+length/m] for i in range(0, length, length/m)] err_str = filter(lambda s: True if s != s[::-1] else False, blocks) print "NO" if len(err_str) else "YES"
Python
43bb8fec6b0636d88ce30f23b61be39f
42535bf87c844f4871bfaa82ee84631a
1,100
PASSED
def main(): text = raw_input() m = int(raw_input()) length = len(text) if length % m: print "NO" return blocks = [text[i:i+length/m] for i in range(0, length, length/m)] err_str = filter(lambda s: True if s != s[::-1] else False, blocks) if len(err_str): print "NO" else: ...
Python
43bb8fec6b0636d88ce30f23b61be39f
8a73fcb1b19b76fb06ddcc8e387c6df6
1,100
PASSED
import math import sys st=raw_input() k=int(raw_input()) fg=0 pl=int((len(st)/k)) le=len(st) cnt=0 #print pl if pl==0 or len(st)%k!=0: print "NO" sys.exit(0) for i in range(k): pch= st[i*pl:i*pl+pl] #print pch if pch==pch[::-1]: cnt+=1 if cnt==k: print "YES" else: print "NO"
Python
43bb8fec6b0636d88ce30f23b61be39f
96cfa608aa76feeccefb0bfde7c7b81b
1,100
PASSED
#coding: utf-8 word = raw_input() k = int(raw_input()) word_list = [] control = False if(len(word)%k==0): for i in xrange(0, len(word), len(word)/k): word_list.append(word[i : i+(len(word)/k):]) for w in word_list: if (w[::]==w[::-1]): control = True else: control = False break if(control): print "YES"...
Python
43bb8fec6b0636d88ce30f23b61be39f
74e85c4b3ae1449059a2a35c999ab066
1,100
PASSED
package main import ( "bufio" "fmt" "os" ) var reader *bufio.Reader = bufio.NewReader(os.Stdin) var writer *bufio.Writer = bufio.NewWriter(os.Stdout) func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) } func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) } func min_int(a int...
Go
cf4d8a5caa37def0b7c0007743139e36
94f8d392af33e591c740e665a6170941
800
PASSED
package main import ( "bufio" "fmt" "os" "strconv" ) func solve() { t := readInt() for i := 0; i < t; i++ { solveSingle() } } func solveSingle() { n := readInt() up := (n * 4) - 2 for i := 0; i < n; i++ { if i > 0 { fmt.Print(" ") } fmt.Print(up) up -= 2 } fmt.Println() } var scanner *bufio...
Go
cf4d8a5caa37def0b7c0007743139e36
bdf0bc71d316814a1333132d68668278
800
PASSED
package main import "fmt" func main() { q := 0 fmt.Scan(&q) for t := 0; t < q; t++ { n := 0 fmt.Scan(&n) for i := 2 * n + 2; i <= 4 * n; i += 2 { fmt.Print(i, " ") } fmt.Println() } }
Go
cf4d8a5caa37def0b7c0007743139e36
5fb08a5dc289c17669d938ee360a10a5
800
PASSED
package main import ( "bufio" "fmt" "os" "strconv" ) func main() { //rd, _ := os.Open("input") //in := bufio.NewReader(rd) in := bufio.NewReader(os.Stdin) var t, n int fmt.Fscan(in, &t) for ; t > 0; t-- { fmt.Fscan(in, &n) result := "" for i := 0; i < n; i++ { result += strconv.Itoa(4*n-2*i) + " ...
Go
cf4d8a5caa37def0b7c0007743139e36
6d11527bccc3323e73b9fbf4aef1ddc6
800
PASSED
package main import ( "bufio" "fmt" "os" ) var reader = bufio.NewReader(os.Stdin) func main() { var t int fmt.Fscan(reader, &t) for i := 0; i < t; i++ { var n int fmt.Fscan(reader, &n) for j, k := 0, 4*n; j < n; j, k = j+1, k-2 { fmt.Printf("%d ", k) } fmt.Println() } }
Go
cf4d8a5caa37def0b7c0007743139e36
8bc79941f8d3a0852de499074e5b7456
800
PASSED
package main import "fmt" func main() { var t int fmt.Scanf("%d\n", &t) for count := 0; count < t; count++ { var q int fmt.Scanf("%d\n", &q) base := 2 * q for i := 0; i < q; i++ { fmt.Printf("%d ", base) base += 2 // if i >= 1 { // base += 2 // } } fmt.Println("") } }
Go
cf4d8a5caa37def0b7c0007743139e36
21f9ab7b64aaba55597c2cd4aca33949
800
PASSED
package main import ( "bufio" "os" "strconv" ) var scanner = bufio.NewScanner(os.Stdin) var writer = bufio.NewWriter(os.Stdout) func print(str string) { writer.WriteString(str) } func nextInt() int { scanner.Scan() str := scanner.Text() val, _ := strconv.Atoi(str) return val } func nextFloat() float64 { s...
Go
cf4d8a5caa37def0b7c0007743139e36
6c2f2ddac7b9882b45f2f4b9a17a5bff
800
PASSED
package main import ( "fmt" ) var t,a,s,c int func main() { fmt.Scan(&t) for i:=1;i<=t;i++{ fmt.Scan(&a) s=4*a for j:=1;j<=a;j++{ s-=2 fmt.Printf("%d ",s) } fmt.Printf("\n") } }
Go
cf4d8a5caa37def0b7c0007743139e36
9ce82d43f2916808f15ae27ef29f085e
800
PASSED
package main import ( "fmt" ) var t,a,s,c int func main() { fmt.Scanf("%d",&t) for i:=1;i<=t;i++{ fmt.Scan(&a) s=4*a for j:=1;j<=a;j++{ s-=2 fmt.Printf("%d ",s) } fmt.Printf("\n") } }
Go
cf4d8a5caa37def0b7c0007743139e36
bd61d65c7ece7dcd9afdf5df7373ab70
800
PASSED
from collections import Counter, defaultdict, deque import bisect import heapq from sys import stdin, stdout from itertools import repeat import math import random import copy # sys.stdin = open('input') def mod(x, y, mod): re = 1 now = x while y: if y&1: re *= now re %= mo...
Python
cf4d8a5caa37def0b7c0007743139e36
f5253bb8a387871bc32aa5abf40fb248
800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll Max=5e9+10, N=5e5+10; ll n,a[N],last,sim,psum[N]; int main(){ cin>>n; for(ll i=1;i<=(n+1)/2;i++){ scanf("%lld",&a[i]); psum[i]=psum[i-1]+a[i]; } cin>>last; sim=(n+1)/2+1; for(ll i=sim;i<=n;i++) psum[i]=psum[i-1]+last; if(last>=0) ...
C++
3800f4d44031aad264e43dc6b490592c
d8e30b80101e3fad6a386203f1df66aa
2,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll Max=5e9+10, N=5e5+10; ll n,a[N],last,sim,psum[N]; int main(){ cin>>n; for(ll i=1;i<=(n+1)/2;i++){ scanf("%lld",&a[i]); psum[i]=psum[i-1]+a[i]; } cin>>last; sim=(n+1)/2+1; for(ll i=sim;i<=n;i++) psum[i]=psum[i-1]+last; if(last>=0) ...
C++
3800f4d44031aad264e43dc6b490592c
8ac782f9ba9d9760a8caac49cc577cf7
2,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll Max=5e9+10, N=5e5+10; ll n,a[N],last,sim,psum[N]; int main(){ cin>>n; for(ll i=1;i<=(n+1)/2;i++){ scanf("%lld",&a[i]); psum[i]=psum[i-1]+a[i]; } cin>>last; sim=(n+1)/2+1; for(ll i=sim;i<=n;i++) psum[i]=psum[i-1]+last; if(last>=0) ...
C++
3800f4d44031aad264e43dc6b490592c
4ddf1f1935769dbb3e4fad5392e9eeb7
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long #define N 1000005 int T,n,a[N],X,x,s[N],mn[N],mx[N],i,l,r,mid; signed main(){ // freopen("E.in","r",stdin);freopen("E.out","w",stdout); cin>>n;X=(n+1)/2; for(i=1;i<=X+1;++i)cin>>a[i]; for(i=X+2;i<=n;++i)a[i]=a[i-1]; for(i=1;i<=n;++i)s[i]=s[i-1]+a[i]...
C++
3800f4d44031aad264e43dc6b490592c
e94360c6e27f020c6959c74ccd917b37
2,400
PASSED
#include<bits/stdc++.h> using namespace std; const long long maxn = 5e5 + 10; const long long inf = 1e18; long long n; long long K; long long ans; long long sum; long long a[maxn]; long long seg[4 * maxn]; long long lazy[4 * maxn]; void in(); void solve(); void out(); void upd(long long, long long, long long, long l...
C++
3800f4d44031aad264e43dc6b490592c
81b956546ca2a228d05be25a0fe90cf0
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define x first #define y second #define mp make_pair #define pb push_back typedef long long ll; const ll MOD = 1e9+7; const ll INF = 1e9+5; ll a[500005]; ll suff[500005]; int main() { ll n; scanf("%I64d", &n); ll sum = 0; for (int i=0 ; i<(n+1)/2 ; i++) { scanf...
C++
3800f4d44031aad264e43dc6b490592c
d8d06d32ee7dbfff8dfee55b8124659b
2,400
PASSED
#define ICC ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define PI acos(-1) #include<time.h> #include<string.h> #include<stdio.h> #include<math.h> #include<map> #include<set> #include<stack> #include<queue> #include<deque> #include<vector> #include<iostream> #include<algorithm> //#include<unordered_map> using na...
C++
3800f4d44031aad264e43dc6b490592c
b6bea784224ba286267ecf030f129a44
2,400
PASSED
/* * @Author: loke@tencent.com * @Date: 2020-05-29 22:44:16 * @Description: file content */ #include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #inc...
C++
3800f4d44031aad264e43dc6b490592c
232a9640998eb064b05d21cd4820b054
2,400
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <random> #include <chrono> using namespace std; using namespace __gnu_pbds; #define endl '\n' typedef long long ll; typedef pair<int, int> pii; typedef tree<int, null_type,less<int>, rb_tree_tag, tree_o...
C++
3800f4d44031aad264e43dc6b490592c
7de09a314ec9bb34ede1d8d81ee20e0b
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long int read() { int d = 0, w = 1; char ch = getchar(); while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar(); if (ch == '-') w = -1, ch = getchar(); while (ch >= '0' && ch <= '9') d = d * 10 + ch - '0', ch = getchar(); return d * w; } voi...
C++
3800f4d44031aad264e43dc6b490592c
2370e7f0211b939e5885758904e2f5f0
2,400
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; int cnt,s,n,x; map<int,bool>mp; signed main(){ mp[0]=1; cin>>n; while(n--){ cin>>x;s+=x; if(mp[s]){ cnt++;s=x; mp.clear(); mp[0]=mp[s]=1; }else mp[s]=1; } cout<<cnt; }
C++
05548be393d794bf106708627220b9a3
5a4e451447adc20755241e0df4bfbd9c
1,500
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long a[200005], sum =0, cnt=0; unordered_map<long long, long long> mp; mp[0]=1; for(int i=0;i<n;i++) { cin >> a[i]; sum+=a[i]; if(mp.find(sum)!=mp.end()) { cnt++; ...
C++
05548be393d794bf106708627220b9a3
77d53cec96e294156c43936a776ee1d8
1,500
PASSED
//-----Rashish-----// #include<bits/stdc++.h> typedef long long ll; using namespace std; #define REP(i,a,b) for (int i = a; i <= b; i++) #define endl '\n' #define ALL(a) a.begin(), a.end() #define ALLN(a, n) (a, a+n) #define MAX 10000007 #define MIN -10000007 #def...
C++
05548be393d794bf106708627220b9a3
e04760380afd3d99842466febf24aac6
1,500
PASSED
#include<bits/stdc++.h> #define int long long #define rep(i,a,n) for ( i = a ; i <= n ; i++ ) #define per(i,a,n) for ( i = n ; i >= a ; i--) #define fi first #define se second #define pb push_back #define ppb pop_back #define Y "YES" #define N "NO" #define endl '\n' #define pii pair<int,int> using namespace std; cons...
C++
05548be393d794bf106708627220b9a3
aa0081ecc335286334a6dba0e449b149
1,500
PASSED
#include<bits/stdc++.h> #define int long long #define rep(i,a,n) for ( i = a ; i <= n ; i++ ) #define per(i,a,n) for ( i = n ; i >= a ; i--) #define fi first #define se second #define pb push_back #define ppb pop_back #define Y "YES" #define N "NO" #define endl '\n' #define pii pair<int,int> using namespace std; cons...
C++
05548be393d794bf106708627220b9a3
a8f8d703fd34d622880dbb4de93af091
1,500
PASSED
#include<iostream> #include<algorithm> #include<cstring> #include<map> using namespace std; const int N = 200010; int a[N]; int main() { int n; cin >> n; int ans = 0; map<long long, bool>p; long long sum = 0; for (int i = 1; i <= n; ++i)scanf("%d", &a[i]); p[0] = 1; for (int i = 1; i <= n; ++i) { sum += a[i]; ...
C++
05548be393d794bf106708627220b9a3
1a669557635c05631f5a8657165cfbfd
1,500
PASSED
#include <bits/stdc++.h> inline long long read(){char c = getchar();long long x = 0,s = 1; while(c < '0' || c > '9') {if(c == '-') s = -1;c = getchar();} while(c >= '0' && c <= '9') {x = x*10 + c -'0';c = getchar();} return x*s;} using namespace std; #define NewNode (TreeNode *)malloc(sizeof(TreeNode)) #define Mem(a,b)...
C++
05548be393d794bf106708627220b9a3
83ee1ca65faf9080748bc1bb8bbd2e8f
1,500
PASSED
#include <bits/stdc++.h> inline long long read(){char c = getchar();long long x = 0,s = 1; while(c < '0' || c > '9') {if(c == '-') s = -1;c = getchar();} while(c >= '0' && c <= '9') {x = x*10 + c -'0';c = getchar();} return x*s;} using namespace std; #define NewNode (TreeNode *)malloc(sizeof(TreeNode)) #define Mem(a,b)...
C++
05548be393d794bf106708627220b9a3
dbb5ed6ca1e0707ecc65a5099fe5dc95
1,500
PASSED
#include <bits/stdc++.h> #include<iostream> #include<string> #include<algorithm> #include<cstdio> #include<cstring> #include<cmath> #include<map> #include <queue> #include<sstream> #include <stack> #include <set> #include <bitset> #include<vector> #define FAST ios::sync_with_stdio(false) #define abs(a) ((a)>=0?(a):-(a)...
C++
05548be393d794bf106708627220b9a3
82c7e3d0d86f99090f49b4f29a0667c8
1,500
PASSED
#include<bits/stdc++.h> #include<algorithm> using namespace std; #include<string.h> #define boost ios_base::sync_with_stdio(false); cin.tie(NULL); #define vlli vector<long long int> #define lli long long int #define M 1000000007 #define NM 600006 #define rep(i,a,b) for(lli i=a;i<b;i++) #define repi(i,a,b) f...
C++
05548be393d794bf106708627220b9a3
45d40509237cd55f3bcc8854034d450a
1,500
PASSED
#include <cstdio> #include <cstring> using namespace std; typedef long long LL; const int MAXN = 250 + 10, MAXM = 250 + 10; const int H = 1, V = 2; int n, m; char buf[4][MAXM * 5]; const char HC[3][MAXM * 5] = { "......O..O..O.OO.OOOO", "....O.....O.....O....", "........O..OO.OO.OOOO", }; const char VC[...
C++
66b2d21d8ddd6b3ba30b7850fe1a7228
cb0b8185fc8800f4badbaed67762539c
2,300
PASSED
#include <stdio.h> #include <string.h> #define maxn 260 #define q 1000000007 typedef long long LL; char s[maxn<<2][maxn<<2]; LL f[maxn],g[maxn]; int h[maxn]; int a[maxn][maxn]; int n,m; int check(int x,int y){ int num=0; for (int i=1;i<4;i++) for (int j=1;j<4;j++) if (s[x+i][y+j]!='.') num...
C++
66b2d21d8ddd6b3ba30b7850fe1a7228
0e622d368279b3e88188e3a51a1b9963
2,300
PASSED
//For Future //By JFantasy #include <cstdio> #include <cstring> const int maxn = 305; const int mod = 1000000007; typedef long long LL; LL dp[maxn]; int data[maxn][maxn] , n , m; int getflag( char str[4][maxn*5] , int x ) { int st = (x-1)*4+1 , ed = (x-1)*4+3 , tot = 0; for ( int i = 1; i <= 3; i++ ) { ...
C++
66b2d21d8ddd6b3ba30b7850fe1a7228
6ffe5b9563ee5c6159b2611edc1a8699
2,300
PASSED
#include<cstdio> const int maxn=250+10; const int mod=1000000007; int f[maxn],ff[maxn]; int g[maxn][maxn]; char buf[maxn*10][maxn*10]; int n,m; int main() { // freopen("input.txt","r",stdin); scanf("%d%d",&n,&m); for (int i=1;i<=4*n+1;i++) scanf("%s",buf[i]+1); for (int i=1;i<=n;i++) for (in...
C++
66b2d21d8ddd6b3ba30b7850fe1a7228
e5934b54cad42dc1dc3bf79445d4dd9f
2,300
PASSED
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include <math.h> #include <ctype.h> #include <iostream> #include <fstream> #include <sstream> #include <string> #include <vector> #include <list> #include <stack> #include <queue> #include <set> #include <map> #include <algorithm> #include <f...
C++
66b2d21d8ddd6b3ba30b7850fe1a7228
5b12aa4ed14397455bc0bebad6a52012
2,300
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cst...
C++
66b2d21d8ddd6b3ba30b7850fe1a7228
ce271a8c281e15a3d30a05982bc9d05b
2,300
PASSED
#include <iostream> #include <cassert> using namespace std; enum {BOTH, VERT, HORIZ}; const int N_MAX = 400; int P = 1000000007; int N, M; char grid[N_MAX * 4][N_MAX * 4]; int carpet[N_MAX][N_MAX]; int cols1[N_MAX]; int cols2[N_MAX]; int get_orientation(int x, int y) { int num_dots = 0; for (int i = 0; i < 3; ...
C++
66b2d21d8ddd6b3ba30b7850fe1a7228
ccf5f8ecf09e39a8786a1184635fd972
2,300
PASSED
#include <cstdio> #include <algorithm> #include <cstring> #define maxn 300 #define K 7 #define mo 1000000007 using namespace std; char s[4*maxn][4*maxn]; char t[2*K][4][4]={ {"...","...","..."}, {"...",".O.","..."}, {"..O","...","O.."}, {"..O",".O.","O.."}, {"O.O","...","O.O"}, {"O.O",".O.","O.O"}, {"O.O","O.O","O.O"},...
C++
66b2d21d8ddd6b3ba30b7850fe1a7228
952f03dc97149b35dadb628f2abdda2d
2,300
PASSED
#include <stdio.h> #include <vector> #include <string> #include <set> #include <map> #include <queue> #include <algorithm> #include <string.h> #include <math.h> using namespace std; #define N 300 #define K 7 #define mod 1000000007 int a[N][N]; char s[4 * N][4 * N]; char t[2 * K][4][4] = { { "...", "...", "..." }, { ".....
C++
66b2d21d8ddd6b3ba30b7850fe1a7228
87ffdb0630d8ecbe8ef5694e7ded3c4e
2,300
PASSED
#include <cstdio> #include <algorithm> #include <cstring> #define maxn 300 #define K 7 #define mo 1000000007 using namespace std; char s[4*maxn][4*maxn]; char t[2*K][4][4]={{ "...", "...", "..." }, { "...", ".O.", "..." }, { "..O", "...", "O.." }, { "..O", ".O.", "O.." }, { "O.O", "...", "O.O" }, { "O.O", ".O.", "O.O" ...
C++
66b2d21d8ddd6b3ba30b7850fe1a7228
4a6aff8db409e2607f3ada127360c776
2,300
PASSED