prompt string | response string |
|---|---|
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int n;
unordered_map<int, int> cnt;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
long long ans = 0;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
int x = 0;
for (auto it : s) {
x ^= (1 << (it - 'a'));
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
public class Main {
static int[][] count;
static long[] result;
static long[] sameCount;
static long des;
public static void main(String[] args) throws IOException {
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
struct VectorHasher {
int operator()(const vector<int> &V) const {
int hash = V.size();
for (auto &i : V) {
hash ^= i + 0x9e3779b9 + (hash << 6) + (hash >> 2);
}
return hash;
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
const int N = 1e5 + 5, mod = 1e9 + 7, base = 311;
using namespace std;
class Mine {
int mycode_mydream;
};
template <class T>
inline void Write(T x) {
if (x < 0) {
putchar('-');
x *= -1;
}
if (x > 9) Write(x / 10);
putchar(x % 10 + '0');
}
template <class T>
inline void Read(T... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | n=int(input())
a= {}
ans=0
for i in range(n):
d=0
st=input()
for j in st:
d^=1<<(ord(j)-ord("a"))
ans+=a.get(d,0)
for k in range(26):
ans+=a.get(d^(1<<k),0)
t=a.get(d,0)+1
a[d]=t
print(ans) |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.util.*;
import java.lang.*;
import java.io.*;
public class Solution
{
public static void findPalPairs(ArrayList<String>[] hash){
OutputStream output = System.out;
PrintWriter out = new PrintWriter(output);
long ans = 0;
if(hash[0].size() > 1){
l... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int isGrayCode(long long num1, long long num2) {
long long differences = 0;
while (num1 > 0 || num2 > 0) {
if ((num1 & 1) != (num2 & 1)) differences++;
num1 >>= 1;
num2 >>= 1;
}
return differences == 1;
}
unordered_map<long long, long long> mp1;
int main... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
inline bool eq(double a, double b) { return fabs(a - b) < 1e-9; }
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int &n, int b) { n |= two(b); }
inline void unset_bit(int &n, int b) { n &= ~two(b); }
inlin... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n;
cin >> n;
map<long long, long long> dp;
vector<long long> v;
for (long long i = 0; i < n; i++) {
string s;
cin >> s;
long long num = 0;
for (long long j = 0; j <... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const int INFL = (int)1e9;
const long long int INFLL = (long long int)1e18;
const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
bool nearlyeq(double x, double y) { return abs(x - y) < 1e-9; }
bool inrange(int x, int t) { return ... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool uax(T &x, T y) {
return (y > x) ? x = y, true : false;
}
template <typename T>
inline bool uin(T &x, T y) {
return (y < x) ? x = y, true : false;
}
string to_string(char c) { return "'" + string(1, c) + "'"; }
string to_string(string s)... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.HashMap;
import java.io.*;
/**
*
* @author arvin
*/
public class pallindrome_pairs {
public static void... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.*;
import java.util.*;
public class SOlution
{
public static void main(String ag[])
{
Scanner sc=new Scanner(System.in);
int i,j,k;
int N=sc.nextInt();
String A[]=new String[N];
for(i=0;i<N;i++)
A[i]=sc.next();
HashMap<Long,Long> hm... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int n, i, x, j, ans;
cin >> n;
string str[n];
int a[n][26];
long long int val[n];
map<int, int> m;
for (i = 0; i < n; i++) {
cin >> str[i];
val[i] = 0;
for (j = 0; j < 26; ... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
void DBG() { cerr << "]\n"; }
template <typename T, typename... Args>
void DBG(T first, Args... args) {
cerr << first;
if (sizeof...(args)) cerr << ", ";
DBG(args...);
}
void solve() {
long long n;
cin >> n;
string a[n];
map<string, long long> m;
long long e... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
const long long maxn = (long long)1e6 + 5;
const long long mod = (long long)998244353;
const long long inf = 0x3f3f3f3f3f3f3f3f;
unordered_map<long long, long long> m;
long long a[maxn];
signed main() {
ios::sync_with_stdio(false... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
struct _ {
ios_base::Init i;
_() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); }
} _;
unordered_map<int, int> dp;
int main() {
int n;
cin >> n;
vector<string> v(n);
for (int i = 0; i <= n - 1; i++) cin >> v[i];
vector<long long> msk(n, 0);... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
map<int, int> appear;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
vector<int> cnt(26, 0);
for (char c : s) cnt[c - 'a'] = (cnt[c - 'a']... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
inline bool eq(double a, double b) { return fabs(a - b) < 1e-9; }
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int &n, int b) { n |= two(b); }
inline void unset_bit(int &n, int b) { n &= ~two(b); }
inlin... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
import java.util.*;
public class realfast implements Runnable {
private static final int INF = (int) 1e9;
public void solve() throws IOException
{
int n = readInt();
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
/**
* Created by Katushka on 05.02.2020.
*/
public class PalindromPairs {
public static void main(String[] args) throws FileNotFoundException {
InputReader in = new InputReader(System.in);
PrintWri... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.DataInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Scanner;
import static java.lang.System.*;
public class Main {
private int[] num;
private HashMap<Integer, Integer> hashtable;
private int gcd(int x, int y) {
if (x == 0)
return y;
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.util.*;
import java.lang.*;
import java.io.*;
public class Solution
{
public static void findPalPairs(ArrayList<String>[] hash){
OutputStream output = System.out;
PrintWriter out = new PrintWriter(output);
long ans = 0;
if(hash[0].size() > 1){
long n =... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
inline int read() {
register int x = 0, o = 1;
register char ch = getchar();
while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
if (ch == '-') o = -1, ch = getchar();
while (ch >= '0' && ch <= '9')
x = ((x << 3) + (x << 1)) + ch - '0', ch = getchar();... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = (int)2e5 + 5;
int n, sta;
long long ans = 0;
char s[2000005];
map<int, int> mp;
int cal(int pos) { return (1 << pos); }
int main(... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
string mask[n];
map<string, long long> mp;
for (long long i = 0; i < n; i++) {
string s;
cin >> s;
long long cnt[26] = {};
for (long long j = 0; j < s.size(); j++) cnt[s[j] - 'a']++;
for (long long j = 0; j <... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e9 + 7;
const long long int mod = 1e9 + 9;
long long int mini(long long int a, long long int b) {
if (a >= b) return b;
return a;
}
long long int maxi(long long int a, long long int b) {
if (a >= b) return a;
return b;
}
int main() {
ios... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
template <typename _T>
inline void _DBG(const char *s, _T x) {
cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
while (*s != ',') cerr << *s++;
cerr << " = " << x << ',';
_DBG(s + 1, a...);
}
con... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const long long N = 1000000007;
const long long INF = 1000000000000000;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cout.precision(numeric_limits<double>::max_digits10);
long long n;
cin >> n;
map<string, long long> mp;
f... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int oo = 1000000000;
int n;
map<int, int> m;
int ch[26];
int a[100005];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
for (int i = 0; i < 26; i++) ch[i] = 0;
f... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | def zamien(S):
A = 26*[0]
for znak in S:
A[ord(znak)-ord('a')] += 1
return int(''.join([str(i%2) for i in A]),2)
def main():
A = {}
wynik = 0
for i in range(int(input())):
s = zamien(input())
wynik += A.get(s,0)
for i in range(26):
s ^= (1<<i)
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | aw=[2**i for i in range(26)]
n=int(input())
d=dict()
ans=0
for ir in range(n):
st=input()
es=0
for j in st:
es=es^aw[ord(j)-97]
if es in d:
ans+=d[es]
for j in range(26):
es=es^aw[j]
if es in d:
ans+=d[es]
es=es^aw[j]
if es in d:
d[es]+... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int tc = 1, n, pow_2[30];
map<int, int> cnt;
string str;
int getHash() {
int freq[30] = {0};
for (char c : str) freq[c - 'a']++;
int hash = 0;
for (int i = 0; i < 26; i++) hash += (freq[i] % 2) * pow_2[i];
return hash;
}
void preprocess() {
ios::sync_with_stdio(... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
long long a, b, c, n, m, k = 0, T, x[30], dp[100010], head[100010],
maxx = -0x3f3f3f3f;
int main() {
scanf("%lld", &n);
map<long long, long long> q;
long long ans = 0;
while (n--) {
string A;
cin >> A;
memset(x, 0, sizeof(x));
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
unordered_map<int, int> mp;
bool ar[26];
int p2[26];
p2[0] = 1;
for (int i = 1; i < 26; ++i) p2[i] = p2[i - 1] * 2;
long long t = 0;
for (int i = 0; i < n; ++i) {
cin >> s;
memset(ar, false, sizeof(ar));
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
long long int t;
cin >> t;
string s[t];
for (long long int i = 0; i < t; i++) cin >> s[i];
map<long long int, long long int> m;
vector<long long int> v;
long long int ans = 0;
for (long... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
string s[1000000];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
long long ret = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
int mask = 0;
for (auto x : s[i]) {
mask ^= (1 << (x - 'a'... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
const int N = 100010;
const int md = 998244353;
using namespace std;
int main() {
int n;
cin >> n;
long long ans = 0;
map<long long, long long> mp;
for (int j = 1; j <= n; j++) {
string st;
cin >> st;
long long mask = 0;
for (int i = 0; i < st.size(); i++) {
mask... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.*;
import java.util.*;
public class Main {
static int N;
static String[] S;
public static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
N = sc.nextInt();
S = new String[N];
for (int i = 0; i < N; i++) {
S[i] = sc.next();... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.*;
import java.util.*;
public class I_PalindromePairs {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader inp = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int mod = (int)1e9 + 7;
const int N = 1e5 + 10;
const long long inf = -1e17;
vector<int> g[N];
vector<int> req;
struct event {
lo... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 5;
long long int n;
string s[N];
void solve() {
cin >> n;
map<long long int, long long int> mp;
for (long long int i = 0; i < n; i++) {
cin >> s[i];
long long int mask = 0;
for (auto ch : s[i]) {
mask ^= (1 << (ch - 'a')... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
map<int, long long int> evencnt;
map<int, long long int> oddcnt;
long long int ans = 0;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
int val = 0;
for (char ch ... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 2e5 + 10;
int a[N];
map<int, int> mc;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
string str;
cin >> str;
int o = 0;
for (auto& c : str) o ^= 1 << (c - 'a');
a[i] = o;
mc[a[i]]++;
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int N, cnt[26];
long long ans = 0;
char ch[1000005];
int main() {
scanf("%d", &N);
for (int i = 1; i <= N; i++) {
scanf("%s", ch + 1);
memset(cnt, 0, sizeof(cnt));
int n = strlen(ch + 1);
for (int i = 1; i <= n; i++) cnt[ch[i] - 'a']++;... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
map<string, long long> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
map<char, long long> ms;
for (int i = 0; i < s.size(); i++) ms[s[i]]++;
string s1 = "";... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int main() {
int i, n;
ios::sync_with_stdio(false);
cin >> n;
long long ans = 0;
while (n > 0) {
n--;
string str;
cin >> str;
int cnf = 0;
for (auto it : str) {
cnf ^= (1 << (it - 'a'));
}
ans += mp[cnf];
for... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
template <typename T>
T min(T a, T b, T c) {
return min(a, min(b, c));
}
template <typename T>
T max(T a, T b, T c) {
return max(a, max(b, c));
}
vector<pair<long long, long long>> traverse = {
{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
void read(st... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> MAP;
int value[100005], cnt[26];
int SET(int mask, int pos) { return mask = (mask | (1 << pos)); }
bool CHECK(int mask, int pos) { return (bool)(mask & (1 << pos)); }
int RESET(int mask, int pos) { return mask = mask & ~(1 << pos); }
int calcHash(str... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int getmask(string s) {
int ans = 0;
for (const auto& x : s) {
ans ^= (1 << (x - 'a'));
}
return ans;
}
int check(int x) {
int ans = 0;
ans += mp[x];
for (int i = 0; i < 'z' - 'a' + 1; i++) {
x ^= (1 << i);
ans += mp[x];
x ^= ... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long ans = 0;
map<int, int> mp;
while (n--) {
int h = 0;
string str;
cin >> str;
for (int i = 0; i < str.length(); i++) h ^= 1 << (str[i] - 'a');
for (int i = 0; i < 26; i++) ans += mp[h ^ (1 << i)];
ans +... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const int N = 100002;
long long h[N];
map<int, int> mp;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
vector<int> a(26);
string s;
cin >> s;
for (auto c : s) a[c - 'a']++;
for (int j = 0; j < 26; j++) h[i] += (a[j] % 2) * (1 << j);
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int maxn = 100100;
int n, vis[27];
int msk[maxn];
string s[maxn];
map<int, int> past;
signed main() {
cin >> n;
past.clear();
LL ret = 0;
for (int i = 1; i <= n; i++) {
cin >> s[i];
for (int j = 0; j < 26; j++) vis[j] = 0;
for... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
int c[28], f[100005];
unsigned short b[1 << 26];
char a[1000005];
int main() {
long long ans = 0;
int n, s = 0, q1 = -1, q2 = 0;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%s", a), memset(c, 0, sizeof c);
for (int j = strlen(a) - 1; ~j; j--) c[a[j] - 96]++;
for (... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
HashMap<String, Integer> map = new HashMap<>();
Str... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int n;
string s;
int poww[26];
long long res;
map<int, int> m;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
poww[0] = 1;
for (int i = 1; i < 26; i++) poww[i] = poww[i - 1] * 2;
for (int i = 1; i <= n; i++) {
cin >> s;
i... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
map<int, int> cnt;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
int h = 0;
for (int j = 0; j < s.size(); j++) {
h ^= (1 << (s[j] - 'a'));
}
cnt[h]++;
}... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
map<int, int> mp0, mp1;
long long res;
char mde[N * 10];
int n;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
int val = 0;
scanf("%s", mde + 1);
int len;
for (len = 1; mde[len + 1] != '\0'; len++)
;
for (i... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
#pragma gcc diagnostic warning "-std=c++11"
int n;
string s;
long long ans;
unordered_map<int, int> cnt;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(0);
cin >> n;
while (n--) {
cin >> s;
int mask = 0;
for (char c : s) {
mask ^= 1 << (c - 'a'... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
long long vis[30];
map<string, long long> mp;
vector<string> v;
int main() {
long long ans;
long long n, i, j, x = 0;
cin >> n;
for (i = 0; i < n; i++) {
memset(vis, 0, sizeof(vis));
string s, ss = "";
cin >> s;
long long len = s.size();
for (j =... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
// 8:59.433
public class cf303229b {
public static void main(String[] args) throws IOException {
int n = ri(), hash[] = new int[n];
char[][] s = new char[n][];
Map<Integer, Integer> ha... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
string arr[1000000];
long long aux[26];
unordered_map<long long, long long> freq;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n;
cin >> n;
for (long long i = 0; i < n; i++) cin >> arr[i];
long long tot = 0;
for (long long i = 0; ... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 200;
int n;
int cnt[30];
map<string, int> d;
long long ans = 0;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
int m = 'z' - 'a';
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
memset(cnt, 0, si... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | n = input()
n = int(n)
st = list()
store = {}
for i in range(n):
x = input()
t = 0
for c in x:
t^=2**(ord(c)-ord('a'))
if not t in store:
store[t]=1
else:
store[t]+=1
st.append(t)
res = 0
for x in st:
store[x]-=1
if x in store:
res+=store[x]
for i in range(26):
if x^(2**i) in store:
res+=store[x... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
long long n, f[26], sum, ans;
string s;
bitset<26> a;
map<long long, long long> m;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
f[0] = 1;
for (int i = 1; i < 26; i++) {
f[i] = f[i - 1] * 2;
}
for (int i = 1; i <= n; i++) ... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import sys
input = sys.stdin.readline
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
def lcm(a, b):
return (a * b) / gcd(a, b)
def main():
comp=[]
c=1
for i in range(27):
comp.append(c)
c*=2
n=int(input())
d={}
table=[]
for i in range(n):... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.*;
import java.util.*;
import java.lang.*;
import static java.lang.Math.*;
// Sachin_2961 submission //
public class Codeforces {
public void solve() {
int n = fs.nInt();
Map<Long,Integer> map = new HashMap<>();
long ans = 0;
for(int i=0;i<n;i++){
char[]s... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
string solve(string &s) {
int64_t i;
vector<int64_t> arr(26, 0);
for (i = 0; i < s.size(); ++i) arr[s[i] - 'a']++;
string ans;
for (i = 0; i < arr.size(); ++i) ans.p... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
bool done_something = false;
stringstream res;
res << "[";
for (; begin_iter != end_iter and counter; ++begin_iter) {
done_something = true;
counter--;
r... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.*;
import java.util.*;
public class Main2
{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static String ns()
{
while(st==null||(!st.hasMoreTokens()))
{ try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
// ... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int32_t main() {
long long int n, ans = 0;
;
cin >> n;
string s;
map<long long int, long long int> m;
for (long long int c = 1; c <= n; c++) {
long long int h = 0;
cin >> s;
for (long long int i = 0; i <= s.length(); i++) h ^= 1 << (s[i] - 'a');
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run(){
work();
out.flush();
}
long mod=1000000007;
long gcd(long a,long b) {
return b==0?a:gcd(b,a%b);... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
t = 1;
while (t--) {
int n;
cin >> n;
map<int, int> mp;
long long int ans = 0;
while (n--) {
string s;
cin >> s;
long long int cur = 0;
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | def zamien(S):
A = 26*[0]
for znak in S:
A[ord(znak)-ord('a')] += 1
return ''.join([str(i%2) for i in A])
def mainn():
A = {}
wynik = 0
for i in range(int(input())):
s = zamien(input())
wynik += A.get(s,0)
for i in range(26):
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string a[n];
for (int i = 0; i < n; i++) cin >> a[i];
map<unsigned long long, unsigned long long> br;
unsigned long long rj = 0;
for (int i = 0; i < n; i++) {
unsigned long long nep = 0;
for (int j = 0; j < a[i].size(); j+... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
long long ans = 0;
char s[1000000 + 1];
int main() {
int n;
scanf("%d", &n);
while (n--) {
int x = 0;
scanf("%s", s);
int sizeS = strlen(s);
for (int i = 0; i < sizeS; i++) {
x ^= 1 << (s[i] - 'a');
}
for (int i = 0; i <... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
ll ans = 0;
map<int, int> f;
for (string& s : a) {
int mask = 0;
for (char c :... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | def main():
n = int(input())
ans = 0
d = {}
for i in range(n):
s = input()
cur = 0
for c in s:
cur ^= (1 << (ord(c) - ord('a')))
ans += d.get(cur, 0)
for j in range(26):
ans += d.get(cur ^ (1 << j), 0)
t = d.get(cur, 0) + 1
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
inline int GCD(int a, int b) { return b == 0 ? a : GCD(b, a % b); }
inline int LCM(int a, int b) { return a * b / GCD(a, b); }
inline long long int PowMod(long long int a, long long int b) {
long long int val = 1;
while (b) {
if (b & 1) val = (val * a) % 1000000007;... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.io.BufferedOutputStream;
import java.util.StringTokenizer;
import... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | //package bubble11;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class I {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const int Nmax = 1e6, MOD = 1e9 + 7;
ifstream infile;
ofstream outfile;
template <class T>
void inline Scan(vector<T> &arr) {
for (auto &i : arr) cin >> i;
}
template <class T>
void inline Print(vector<T> &arr) {
for (auto &i : arr) cout << fixed << setprecision(7) << i... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
map<int, long long> mp;
const int maxn = 1e6 + 10;
char str[maxn];
int num[30];
int main() {
int n;
scanf("%d", &n);
while (n--) {
scanf("%s", str);
memset(num, 0, sizeof num);
int len = strlen(str);
for (int i = 0; i < len; i++) {
num[str[i] - '... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | import java.io.*;
import java.math.*;
import java.util.*;
public class icpc
{
static long count = 0L;
public static void main(String[] args) throws IOException
{
// Reader in = new Reader();
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.par... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | from collections import Counter
n = int(input())
mp = Counter({'': 0})
for i in range(n):
string = input()
occ = [0] * 26
for c in string:
occ[ord(c) - ord('a')] += 1
if occ[ord(c) - ord('a')] == 2:
occ[ord(c) - ord('a')] = 0
clean = []
for idx in range(26):
wh... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #! /usr/bin/python3
import os
import sys
from io import BytesIO, IOBase
from collections import Counter
def main():
n = int(input())
string_cnt = {}
for _ in range(n):
s = input()
item_cnt = Counter(s)
s0 = []
for x in 'abcdefghijklmnopqrstuvwxyz':
if item_cnt.... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
char s[1000000];
int m[100000];
int main() {
int n, t, i, j;
long long res = 0;
scanf("%d", &n);
unordered_map<int, int> f;
for (i = 0; i < n; i++) {
scanf("%s", &s);
t = strlen(s);
for (j = 0; j < t; j++) m[i] ^= (1 << (s[j] - 'a'));
res += f[m[i]... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int process(string &s) {
int ans = 0;
for (int i = 0; i < s.size(); i++) ans ^= (1 << (s[i] - 'a'));
return ans;
}
int main() {
ios_base::sync_with_stdio(0);
int n;
cin >> n;
string s;
unordered_map<int, long long> m;
long long ans = 0;
for (int i = 0; i... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n;
cin >> n;
unordered_map<string, long long> mp;
map<char, long long> t;
for (long long y = 0; y < n; y++) {
string s;
cin >> s;
for (long long i = 0; i < s.length(); i++) {
t[... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int maxn = 1000005;
char s[maxn];
unordered_map<int, int> cnt;
int n;
long long ans;
int main() {
cin >> n;
for (int i = (1), _E = (n); i <= _E; i++) {
scanf("%s", s);
int now = 0;
for (int k = 0; s[k]; k++) now ^= 1 << (s[k... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
map<long long, long long> f;
long long n, p;
string s;
int main() {
cin >> n;
while (n--) {
long long a = 0;
cin >> s;
for (long long j = 0; j < s.size(); j++) a ^= 1 << s[j] - 'a';
for (long long j = 0; j < 26; j++) p += f[1 << j ^ a];
p += f[a]++;
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int N;
map<int, int> mp;
int main() {
ios::sync_with_stdio(0);
cin >> N;
long long ans = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
int mask = 0;
for (int j = 0; j < s.size(); j++) mask ^= (1 << (s[j] - 'a'));
if (mp.count(mask)) ans +=... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
void fast() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
void inout() {}
int main() {
fast();
inout();
int n;
cin >> n;
string s[n];
vector<int> e;
vector<int> o;
long long int ans = 0;
map<string, int> m;
unordered_map<string, int> needed;
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
long long int ans = 0;
map<long long int, long long int> m;
while (n--) {
string s;
cin >> s;
long long int cur = 0;
for (long long int i = 0; i < s.size(); i++) {
cur = cur ^ (1 << (s[i] - 'a'));
}... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
void cp() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
void solve() {
long long n;
cin >> n;
long long ans = 0;
map<long long, long long> mp;
for (long long i = 0; i < n; i++) {
string s;
cin >> s;
long ... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9) + 7;
const long long linf = 1ll * inf * inf;
const int N = 1000000 + 7;
const int M = 10000 + 7;
const int multipleTest = 0;
const double pi = acos(-1);
template <typename T>
void addmod(T& a, const long long& b, const int MOD = inf) {
a = (a + b)... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
srand(time(0));
long long x = rand() % 1000;
long long n, ans = 0;
cin >> n;
unordered_map<long long, long long> m;
for (long long i = 0; i < n; i++) {
string s;
cin >> s;
... |
Problem: After learning a lot about space exploration, a little girl named Ana wants to change the subject.
Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this prob... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d ", &n);
map<long long, long long> m;
while (n--) {
long long r = 0;
char c;
while ((c = getchar()) != '\n' && c != EOF) {
r ^= 1LL << (c - 'a');
}
map<long long, long long>::iterator it = m.find(r);
if (it ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.