akhauriyash/Code-Regression huggingface dataset:
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
int read(){
	int f=1,x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f*x;
}
#define INF 0x3f3f3f3f
int main(){
	int a=read();
	if(a==22)
		puts("Christmas Eve Eve Eve");
	if(a==23)
		puts("Christmas Eve Eve");
	if(a==24)
		puts("Christmas Eve");
	if(a==25)
		puts("Christmas");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
if(a[0]!=0){
  cout << -1 << endl;
  return 0;
}
bool tik=0;
rep(i,n-1){
  if(a[n-i-2]+2<=a[n-i-1]){
    cout << -1 << endl;
    return 0;
  }
  else{
    if(!tik)ans+=a[n-i-1];
    if(a[n-i-2]+1==a[n-i-1])tik=1;
    else tik=0;
  }
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 1920
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int n;
    cin >> n;
    int cnt = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if ((i + 1) % 2 == 1 && a % 2 == 1) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	cin>>n;
	unordered_map<string,int> cnt;
	int best = 0;
	for(int i =0;i<n;i++)
	{
		string s;
		cin>>s;
		cnt[s]++;
		best = max(best,cnt[s]);
	}
	vector<string> out;
	for(auto it : cnt)
	{
		if(it.second == best)
			out.push_back(it.first);
		else
			continue;
	}
	sort(out.begin(),out.end());
	for(auto it : out)
		cout<<it<<endl;
		

	return 0;
}

Measured memory_bytes: 26692
#include<bits/stdc++.h>
#define ll          long long int
#define ios        	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

int main()
{	ios
  ll n ;
  cin>> n ;
 ll a[n] , b[n], c[n] ;
 for(ll i=0;i<n;i++)
 {
   cin>>a[i]>>b[i]>>c[i] ;
 }
 ll dp[n][3] ;
 dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for(int i = 1 ; i < n ; i++ ){
		dp[i][0] = a[i]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1] = b[i]+max(dp[i-1][0],dp[i-1][2]);
		dp[i][2] = c[i]+max(dp[i-1][0],dp[i-1][1]);
	}
	cout << max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
	return 0 ;
}


Measured memory_bytes: 4992
#include <algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;

int N;
string S;
map<string, int> cnt;
int main() {
    cin >> N;
    rep(i, N) {
        cin >> S;
        cnt[S] ++;
    }
    int maxn = 0;
    for (const auto& n : cnt) {
        maxn = max(maxn, n.second);
    }
    for (auto itr = cnt.begin(); itr != cnt.end();itr++) {
        if (itr ->second == maxn) {
            cout << itr->first << endl;
        }
    }
}


Measured memory_bytes: 25216
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>

using namespace std;
#define n_max 100000

#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,a,n) for(int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;
typedef pair<ll, ll> PI;

int gcd(int a, int b) { return b ? gcd(b,a%b) : a; }

int main() {
    int n; cin >> n;
    vector<ll> x(n+1);
    rep(i,n+1) { cin >> x[i]; }

    sort(x.rbegin(), x.rend());
    
    ll ans = x[0] - x[1];
    for(int i = 1; i < n; i++) {
        ll d = x[i] - x[i+1]; 
        ans = gcd(ans, d);
    }
    cout << ans << endl;

    return 0;   
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define kokekoke int 
#define wannwann int 

using namespace std;
int main(){
    kokekoke N,a,b,c,d;
    int ans=0;
    vector<wannwann> aheahe;


    cin>>N>>a;

    N=N%500;

    if(N>a){
        cout<<"No"<<endl;
    }else{
    cout<<  "Yes"<<endl;
        
    }

}

Measured memory_bytes: 256
s = ""
while True:
    try:
        s += input().lower()
    except:
        break

dic = {}
orda = ord("a")
ordz = ord("z")

for c in s:
    if orda <= ord(c) <= ordz:
        try:
            dic[c] += 1
        except:
            dic[c] = 1

for i in range(orda,ordz + 1):
    c = chr(i)
    try:
        print("%s : %d" % (c, dic[c]))
    except:
        print("%s : %d" % (c, 0))

Measured memory_bytes: 7464
/**
 *      ABC 45 A
 *      author  : kyomukyomupurin
 *      created : 2018-09-20 07:24:08
**/

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b, h; cin >> a >> b >> h;
    cout << h / 2 * (a + b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>	
#include <cmath>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define Cout(s) cout<<s<<endl
using namespace std;
typedef long long ll;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================
int ketawa(int a) {
	if (a < 10)return a;
	else return a % 10 + ketawa(a / 10);
}

int a = 1, b = 0, c, d, n, k = 0, ans = 0;
string s, t;
int mod = 1000000007;

int main()
{
	int n; cin >> n;
	vector<int> a(n); rep(i, n) { cin >> b; a[i] = b - 1; }
	int cnt = 0;
	rep(i, n) {
		if (a[a[i]] == i)cnt++;
	}
	cout << cnt / 2 << endl;

	return 0;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b >= c)
        OP("Yes");
    else
        OP("No");

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;

    static void Main(string[] args)
    {
        Solve();
    }
    static long GCD(long x,long y)
    {
        if (y == 0) return x;
        return GCD(y, x % y);
    }

    static long LCM(long x,long y)
    {
        return x * y / GCD(x, y);
    }
    

    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();

        int N = sc.intarr[0];
        var a = sc.longarr;

        long ans = 0;
        for(int i = 0; i < N; ++i)
        {
            ans += a[i] - 1;
        }
        wr.wri(ans);

    
    }
}
    




class Scan
{
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
    public char[] chararr => str.ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13408
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

struct UnionFind {
  int n;
  vector<int> rank, par;
  UnionFind() {}
  UnionFind(int n) : n(n), rank(n, 1), par(n) {
    iota(par.begin(), par.end(), 0);
  }
  int root(int x) {
    return par[x] == x ? x : par[x] = root(par[x]);
  }
  void merge(int x, int y) {
    if ((x = root(x)) == (y = root(y))) return;
    if (rank[x] < rank[y]) swap(x, y);
    rank[x] += rank[y];
    par[y] = x;
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int size(int x) {
    return rank[root(x)];
  }
};

int N, K, L;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> K >> L;
  UnionFind road(N), rail(N);
  for (int i = 0; i < K; i++) {
    int p, q;
    cin >> p >> q;
    p--, q--;
    road.merge(p, q);
  }
  for (int i = 0; i < L; i++) {
    int r, s;
    cin >> r >> s;
    r--, s--;
    rail.merge(r, s);
  }

  map<pii, int> mp;
  for (int i = 0; i < N; i++) {
    mp[pii(road.root(i), rail.root(i))]++;
  }
  for (int i = 0; i < N; i++) {
    cout << mp[pii(road.root(i), rail.root(i))] << " \n"[i + 1 == N];
  }

  return 0;
}

Measured memory_bytes: 15104
#include <algorithm>
#include <cstdio>

using namespace std ;

const int N=2e5+10 ;

int to[N<<1] , nxt[N<<1] , lst[N] ;
inline void add ( int u , int v )
{
	static int cnt=0 ;
	++cnt,to[cnt]=v,nxt[cnt]=lst[u],lst[u]=cnt,
	++cnt,to[cnt]=u,nxt[cnt]=lst[v],lst[v]=cnt;
}

int fa[N] , dep[N] , siz[N] ;
int son[N] , top[N] ;
inline void Dfs1 ( int x , int f )
{
	int i ;
	dep[x]=dep[fa[x]=f]+1,siz[x]=1;
	for ( i=lst[x] ; i ; i=nxt[i] )
		if ( to[i]^f )
			Dfs1(to[i],x),
			siz[x]+=siz[to[i]],
			son[x]=siz[to[i]]>siz[son[x]]?to[i]:son[x];
	return ;
}
inline void Dfs2 ( int x , int c )
{
	int i ;
	top[x]=c;
	if ( !son[x] )
		return ;
	Dfs2(son[x],c);
	for ( i=lst[x] ; i ; i=nxt[i] )
		if ( to[i]^fa[x] && to[i]^son[x] )
			Dfs2(to[i],to[i]);
	return ;
}

inline int Lca ( int u , int v )
{
	while ( top[u]^top[v] )
		if ( dep[top[u]]>dep[top[v]] )
			u=fa[top[u]];
		else
			v=fa[top[v]];
	return dep[u]<dep[v]?u:v;
}

inline int Dis ( int u , int v )
{
	return dep[u]+dep[v]-2*dep[Lca(u,v)];
}

int n , A , B ;

int main ()
{
	int i , u , v ;
	scanf("%d%d%d",&n,&A,&B);
	for ( i=1 ; i<n ; i++ )
		scanf("%d%d",&u,&v),
		add(u,v);
	Dfs1(1,1),Dfs2(1,1);
	int res=0 ;
	for ( i=1 ; i<=n ; i++ )
		if ( Dis(A,i)<Dis(B,i) )
			res=max(res,Dis(B,i)-1);
	printf("%d\n",res);
	return 0 ;
}


Measured memory_bytes: 19584
#include<bits/stdc++.h>
using namespace std;

const int size = 2e5;
vector<int> graph[size+1];
int nodeValue[size+1];
bool vis[size+1];

void dfs(int node){
  	vis[node] = true;
  	for(int i=0;i<graph[node].size();i++){
  	    if(!vis[graph[node][i]]){
  		    nodeValue[graph[node][i]]+=nodeValue[node];
		    dfs(graph[node][i]);
  	    }
	}
}


int main(){
	
  	int n,q; cin >> n >> q;
  
  	for(int i=1;i<=n-1;i++){
    	int a,b; cin >> a >> b;
      	graph[a].push_back(b);
      	graph[b].push_back(a);
    }
  	
  	for(int i=1;i<=q;i++){
      int node,value; cin >> node >> value;
      nodeValue[node]+=value;
    }
  
  	dfs(1);
  	
  	for(int i=1;i<=n;i++) cout << nodeValue[i] << " ";


	return 0;
}

Measured memory_bytes: 23680
n = int(input())
s = list(input())
t = [0] * n
# 0=sheep, 1=wolf

def check(one, two):
    t[0: 2] = [one, two]
    for i in range(n - 2):
        if (s[i + 1] == "o" and t[i + 1] == 0) or (s[i + 1] == "x" and t[i + 1] == 1):
            t[i + 2] = t[i]
        else:
            t[i + 2] = 1 - t[i]
    # print(t)
    a = ((s[-1] == "o" and t[-1] == 0) or (s[-1] == "x" and t[-1] == 1)) and t[-2] == t[0]
    b = ((s[-1] == "o" and t[-1] == 1) or (s[-1] == "x" and t[-1] == 0)) and t[-2] != t[0]
    c = ((s[0] == "o" and t[0] == 0) or (s[0] == "x" and t[0] == 1)) and t[-1] == t[1]
    d = ((s[0] == "o" and t[0] == 1) or (s[0] == "x" and t[0] == 0)) and t[-1] != t[1]
    if (a or b) and (c or d):
        return t
    else:
        return None
    
def sw(t):
    ans = []
    for i in range(n):
        if t[i] == 0:
            ans.append("S")
        else:
            ans.append("W")
    return("".join(ans))

# print(check(0, 0))
# print(check(0, 1))
# print(check(1, 0))
# print(check(1, 1))
if check(0, 0) is not None:
    print(sw(check(0, 0)))
elif check(0, 1) is not None:
    print(sw(check(0, 1)))
elif check(1, 0) is not None:
    print(sw(check(1, 0)))
elif check(1, 1) is not None:
    print(sw(check(1, 1)))
else:
    print(-1)

Measured memory_bytes: 5544
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>
#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF 1e9
#define INFL 1e18
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

class CWalkOnMultiplicationTable {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll N;
        in >> N;
        ll ans = INFL;
        for (ll i = 1; i * i <= N; i++) {
            if (N % i == 0) ans = min(ans, i + N/i -2);
        }
        out << ans << '\n';
	}
};


int main() {
	CWalkOnMultiplicationTable solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a < b) {
        cout << "a < b";
    } else if (a > b) {
        cout << "a > b";
    } else {
        cout << "a == b";
    }
    cout << endl;
}


Measured memory_bytes: 3104
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
const int V = 2e5 + 5;
const int N = 1e6;
const LL mod = 924844033;
const LL g = 5;

struct edge {
  int nxt, to;
} e[V << 1];
LL fac[N], inv[N], a[N], b[N], c[N];
int pos[N], fir[V], sz[V], cnt = 0, n;

inline void addedge(int x, int y) {
  e[++ cnt] = (edge) { fir[x], y  };
  fir[x] = cnt;
}

inline LL pow(LL x, LL exp) {
  LL r = 1; x %= mod;
  exp = (exp + mod - 1) % (mod - 1);
  for (; exp; exp >>= 1, x = x * x % mod)
    if (exp & 1) r = r * x % mod;
  return r;
}

inline void pre(int n) {
  int t = n >> 1;
  for (int i = fac[0] = 1; i < n; i ++) {
    fac[i] = fac[i - 1] * i % mod;
    pos[i] = (pos[i >> 1] >> 1) ^ (t * (i & 1));
  }
  a[n - 1] = inv[n - 1] = pow(fac[n - 1], mod - 2);
  for (int i = n - 1; i; i --) a[i - 1] = inv[i - 1] = inv[i] * i % mod;
}

inline void dfs(int x, int fa) {
  sz[x] = 1;
  for (int i = fir[x]; i; i = e[i].nxt)
    if (e[i].to != fa) {
      dfs(e[i].to, x);
      sz[x] += sz[e[i].to];
      b[sz[e[i].to]] --;
    }
  if (x != 1) b[n - sz[x]] --;
}

inline void NTT(LL *a, int n, LL t) {
  for (int i = 0; i < n; i ++)
    if (pos[i] < i) swap(a[pos[i]], a[i]);
  LL x, y, per, cur;
  for (int i = 2, ii = 1; i <= n; i <<= 1, ii <<= 1) {
    per = pow(g, t * (mod - 1) / i);
    for (int j = 0; j < n; j += i) {
      cur = 1;
      for (int k = j; k < j + ii; k ++) {
        x = a[k];
        y = cur * a[k + ii] % mod;
        a[k] = x + y;
        if (a[k] >= mod) a[k] -= mod;
        a[k + ii] = x - y;
        if (a[k + ii] < 0) a[k + ii] += mod;
        cur = cur * per % mod;
      }
    }
  }
  if (t == -1) {
    LL I = pow((LL)n, mod - 2);
    for (int i = 0; i < n; i ++) a[i] = a[i] * I % mod;
  }
}

int main() {
  scanf("%d", &n);
  for (int i = 1, x, y; i < n; i ++) {
    scanf("%d%d", &x, &y);
    addedge(x, y); addedge(y, x);
  }
  int k = 1;
  for (; k <= n; k <<= 1);
  k <<= 1;
  pre(k);
  dfs(1, 0); b[n] = n;
  for (int i = 0; i < k; i ++) {
    b[i] = b[i] * fac[i] % mod;
    if (b[i] < 0) b[i] += mod;
  }
  reverse(b + 1, b + n + 1);
  for (int i = n + 1; i <= k; i ++) a[i] = b[i] = 0;
  NTT(a, k, 1);
  NTT(b, k, 1);
  for (int i = 0; i < k; i ++) a[i] = a[i] * b[i] % mod;
  NTT(a, k, -1);
  for (int i = n; i > 0; i --)
    printf("%lld\n", a[i] * inv[n - i + 1] % mod);
  return 0;
}


Measured memory_bytes: 39296
#include <stdio.h>
#include <string.h>

int main(void) {

  char s[50];
  scanf("%s", s);

  int i;
  for (i = 0; i < 50; i++) {
        if (s[i] == '\0') {
          break;
        }
  }

  int j;
  for (j = 0; j <= i - 9; j++) {
        printf("%c", s[j]);
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	for(ll i=0;i<s.size();i++){
		if(s[i]=='?'){
			cout << 'D';
		}
		else{
			cout << s[i];
		}
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for(int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<int> b(n + 1), c(n + 2);
  for(int i = 1; i <= n; i++) {
    b[i] = max(a[i], b[i-1]);
  }
  for(int i = n; i; i--) {
    c[i] = max(a[i], c[i+1]);
  }
  for(int i = 1; i <= n; i++) {
    cout << max(b[i-1], c[i+1]) << endl;
  }
}

Measured memory_bytes: 3968
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<62);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

bool check(pair<ll,ll>a,pair<ll,ll>b){
	return (a.first>b.first&&a.second>b.second);
}

bool fun(pair<ll,ll>b,pair<ll,ll>a){
	if(a.first==b.first)return a.second>b.second;
	else return a.first<b.first;
}

void add(string* s,ll i){

	if(i>=(*s).size()){
		(*s).push_back('1');
		return;
	}
	if((*s)[i]!='9'){
		(*s)[i]++;
		return;
	}
	else{
		(*s)[i]='0';
		add(s,i+1);
		return ;
	}
	
}

int main(){
	string s;cin>>s;
	ll n=s.size();
	s.push_back('1');
	ll ans=0;
	rep(i,n){
		if(s[i]!=s[i+1])ans++;
	}
	cout<<ans-1<<endl;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	static long MOD = 1000000007;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long pow =1;

		for (int i = 1; i <= N; i++) {
			pow = pow * i % MOD;
		}

		System.out.println(pow);
	}
}


Measured memory_bytes: 35696
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a, x, c;
  cin >> a >> x >> c;
  cout << "A" << x[0] << "C" << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
//program luogu.AT2079;
#include <iostream>
#include <cstdio>
using namespace std;
const char cs[16]={'C','O','D','E','F','E','S','T','I','V','A','L','2','0','1','6'};
char s[16];
int ans;

int main(){
	scanf("%s",s);
	for(int i=0;i<16;i++){
		if( s[i]!=cs[i] )
			ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
char s[2][MAXN];
int Q;
int sum[2][MAXN];
void Solve() {
    scanf("%s%s",s[0] + 1,s[1] + 1);
    int l = strlen(s[0] + 1);
    for(int i = 1 ; i <= l ; ++i) {
	sum[0][i] = sum[0][i - 1];
	if(s[0][i] == 'A') sum[0][i] += 1;
	else sum[0][i] += 2;
    }
    l = strlen(s[1] + 1);
    for(int i = 1 ; i <= l ; ++i) {
	sum[1][i] = sum[1][i - 1];
	if(s[1][i] == 'A') sum[1][i] += 1;
	else sum[1][i] += 2;
    }
    read(Q);
    int a,b,c,d;
    for(int i = 1 ; i <= Q ; ++i) {
	read(a);read(b);read(c);read(d);
	if((sum[0][b] - sum[0][a - 1]) % 3 == (sum[1][d] - sum[1][c - 1]) % 3) {puts("YES");}
	else puts("NO");
    }
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 1536
# include <bits/stdc++.h>
# define lli long long int
# define pb push_back
# define loop(i,a,b) for(int i=a;i<b;i++)
# define loopl(i,a,b) for(lli i=a;i<b;i++)
# define MAXN 1000
# define INF 1000000000
# define mod 1000000007

using namespace std;

int main()
{
  string s;
  cin>>s;
  lli ans=0;
  for(lli i=0;s[i]!='\0';i++)
  {
  	if(s[i]=='+') ans++;
  	else ans-- ;
  }
  cout<<ans<<endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;

struct T { ll value; int id; bool isB; };

int main(void){
    int n;
    cin >> n;
    vector<T> t;

    rep(i,n){
        ll a,b;
        cin >> a >> b;
        t.push_back({a,i,false});
        t.push_back({b,i,true});
    }

    sort(all(t), [](T x, T y){
        return x.value != y.value ? x.value < y.value : x.id < y.id;
    });
    vector<vector<bool>> low(n, {0,0});
    rep(i,n){
        low[t[i].id][t[i].isB] = true;
    }

    int HH = 0, LL = 0, HL = 0, LH = 0;
    ll sum = 0;
    rep(i,n){
        if ( low[i][0] &&  low[i][1]) LL++;
        if (!low[i][0] && !low[i][1]) HH++;
        if (!low[i][0] &&  low[i][1]) HL++;
        if ( low[i][0] && !low[i][1]) LH++;
        sum += t[i].value;
    }

    if (LL > 0 || LH == n || HL == n) {
        cout << sum << endl;
    } else if (t[n].id != t[n-1].id) {
        cout << sum - t[n-1].value + t[n].value << endl;
    } else if (sum - t[n-2].value + t[n].value < sum - t[n-1].value + t[n+1].value) {
        cout << sum - t[n-2].value + t[n].value << endl;
    } else {
        cout << sum - t[n-1].value + t[n+1].value << endl;
    }
    
    return 0;
}


Measured memory_bytes: 11372
#include <iostream>
#include <stack>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <vector>
#include <cmath>
#include <unordered_map>
#define ll long long
using namespace std;
int a[200010];
vector<int> b;
int main()
{
    int n,med;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        b.push_back(a[i]-(i+1));
        a[i]=a[i]-(i+1);
    }
    sort(b.begin(),b.end());
    if(n%2==1){
        med=b[n/2];
    }
    else{
        med=(b[n/2]+b[n/2-1])/2;
    }
    
    ll sum=0;
    for(int i=0;i<n;i++){
        sum+=abs(a[i]-med);
    }
    printf("%lld",sum);
}



Measured memory_bytes: 1912
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define all(a) a.begin(), a.end()
#define forn(l, r) for(int i = l; i < (r); ++i)
#define F first
#define S second
#define $ ios::sync_with_stdio(0);
///#define int long long int

using namespace std;
using namespace __gnu_pbds;
using ll = long long int;
using ii = pair<int, int>;
using li = pair<ll, int>;
using vi = vector<int>;
using graph = vector<vi>;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll mod =  1000000007;
const int INF = 0x3f3f3f3f;
const int MAXN = 112345;
// const double pi = 3.14159265359;
const double eps = 0.00000001;

int dsu[MAXN]; 
ll qtd[MAXN];

void init_dsu(int n) {
    for (int i = 1; i <= n; ++i) {
        dsu[i] = i;
        qtd[i] = 1;
    }
}
int look(int x) {
    return x == dsu[x] ? x : dsu[x] = look(dsu[x]);
}
ll join(int x, int y) {
    int dis = 0;
    x = look(x);
    y = look(y);
    if (x != y) {
        if (rng() & 1) {
            swap(x, y);
        }
        dsu[x] = y;
        dis = qtd[x] * qtd[y];
        qtd[y] += qtd[x];
    }
    return dis;
}

int a[MAXN], b[MAXN];
ll ans[MAXN];

int32_t main() {
    $
    int n, m;
    cin >> n >> m;
    init_dsu(n);
    for (int i = 0; i < m; ++i) {
        cin >> a[i] >> b[i];
    }
    ll cur = (ll)n * (ll)(n - 1) / 2LL;
    ans[m - 1] = cur;
    for (int i = m - 2; i >= 0; --i) {
        cur -= join(a[i + 1], b[i + 1]);
        ans[i] = cur;
    }
    for (int i = 0; i < m; ++i) {
        cout << ans[i] << '\n';
    }
}   



Measured memory_bytes: 4096
#include <stdio.h>
int main(void)
{
    int i, n; 
    int arr[100]; 
    scanf("%d", &n); 
    for(i=0;i<n;i++){ 
        scanf(" %d", &arr[i]); 
    } 
    for(i=0;i<n;i++){ 
        if(i)printf(" "); 
        printf("%d", arr[n-i-1]); 
    } 
    printf("\n"); 
    return 0;
}


Measured memory_bytes: 2072
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define ins insert

#define debug(a) cerr<<(a)<<endl
#define dbrep(a,n) rep(_i,n) cerr<<(a[_i])<<" "; cerr<<endl
#define dbrep2(a,n,m) rep(_i,n){rep(_j,m) cerr<<(a[_i][_j])<<" "; cerr<<endl;}

using namespace std;

template<class A, class B>
ostream &operator<<(ostream &os, const pair<A,B> &p){return os<<"("<<p.fi<<","<<p.se<<")";}
template<class A, class B>
istream &operator>>(istream &is, pair<A,B> &p){return is>>p.fi>>p.se;}

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int N; cin>>N;
	vi A(N);
	rep(i,N){
		int a; cin>>a;
		A[a-1]++;
	}
	vi vec;
	for(auto f:A){
		if (f>0) vec.pb(f);
	}
	sort(all(vec));
	int V = vec.size();
	// 累積和
	vi sum(V+1);
	rep(i,V) sum[i+1]=sum[i]+vec[i];
	// max{vec}=xのときの総和最大値
	auto maxsum = [&](int x){
		int ret=0;
		auto itr = upper_bound(all(vec),x);
		ret += sum[itr-vec.begin()];
		ret += x*(vec.end()-itr);
		return ret;
	};

	int mx=N;
	FOR(i,1,N){
		while(mx>=0){
			int t = maxsum(mx)/i;
			if (mx<=t){
				cout<<t<<endl;
				break;
			}
			mx--;
		}
	}
	return 0;
}


Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> P(M), Y(M);
    for (int i = 0; i < M; i++) {
        cin >> P[i] >> Y[i];
    }

    vector<vector<iint>> G(N+1);

    for (int i = 0; i < M; i++) {
        G[P[i]].push_back(make_pair(Y[i], i));
    }

    for (int i = 0; i < N+1; i++) {
        if(G[i].size() > 0){
            sort(ALL(G[i]));
        }
    }

    vector<int> x(M);
    for (int i = 0; i < N+1; i++) {
        for (int j = 0; j < G[i].size(); j++) {
            x[G[i][j].second] = j+1;
        }
    }

    for (int i = 0; i < M; i++) {
        printf("%06d%06d\n", P[i], x[i]);
    }

}

Measured memory_bytes: 9664
n = int(input())
arr = list(map(int,input().split()))
if 0 in arr:
    print(0)
else:
    ans = 1
    f = 0
    for i in arr:
        ans = ans*i
        if ans>10**18:
            f = 1
            break
    if f==1:
        print(-1)
    else:
        print(ans)

Measured memory_bytes: 21648
#include <stdio.h>
#include<math.h>
 
int main() {
	int n,a,i;
	int re[100];
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
	scanf("%d",&re[i]);
	}
	
	for(i=n-1;i>=0;i--){
	printf("%d",re[i]);
	if(i!=0){
		printf(" ");
	}
	}
	
	printf("\n");
	
	
	return 0;
	}

Measured memory_bytes: 600
n=int(raw_input())
r=raw_input().split()

def BubbleSort(c, n):
    for i in range(n):
        for j in range(n-1, i, -1):
            if int(c[j][-1]) < int(c[j-1][-1]):
                c[j], c[j-1]=c[j-1],c[j]
    return c

def SelectionSort(c, n):
    for i in range(n):
        m=i
        for j in range(i, n):
            if int(c[j][-1]) < int(c[m][-1]):
                m=j
        c[i],c[m]=c[m],c[i]
    return c

l=list(r)
a=BubbleSort(l, n)
print ' '.join(a)
print 'Stable'
l=list(r)
b=SelectionSort(l, n)
print ' '.join(b)
if a==b:
    print 'Stable'
else:
    print 'Not stable'


Measured memory_bytes: 4680
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    long long int dp[n];
    dp[n-1]=0;
    dp[n-2]=abs(arr[n-1]-arr[n-2]);
    long long int ans;
    for(int i=n-3;i>=0;i--){
        ans=dp[i+1]+abs(arr[i]-arr[i+1]);
        for(int j=2;j<=k;j++){
            if(i+j<n) ans=min(ans,dp[i+j]+abs(arr[i]-arr[i+j]));
        }
        dp[i]=ans;
    }
    cout<<dp[0]<<endl;
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
typedef long long ll;
static const ll Z = 1 << 21;
#define rep(i,s,n)for(ll i = s;i<n;i++)
char s[Z];

ll strchar_i(char *s, char c) {
	ll i = 0;
	while (*s && *s != c) {
		s++;
		i++;
	}

	return ((*s) ? i : -1);
}
ll strlength(const char *s) {
	ll n = 0;;
	while (*s++)n++;
	return n;
}

ll strchar_r_i(char *s, char c) {
	ll length = strlength(s);
	ll r = length - 1;
	while (*(s + r) != c && r >= 0) {
		r--;
	}

	return r;
}

int main() {
	cin >> s;
	char* S = &s[0];

	cout << strchar_r_i(S, 'Z') - strchar_i(S, 'A') + 1 << endl;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

void debug() { std::cerr << '\n'; }
template <class H, class... T> void debug(H &&head, T &&... args) {
    std::cerr << head;
    sizeof...(args) == 0 ? std::cerr << "" : std::cerr << ' ';
    debug(std::forward<T>(args)...);
}
template <class T> void debug(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cerr << v[i];
        i == v.size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
    }
}
template <class T> void debug(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cerr << v[i][j];
            j == v[i].size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    scan(N);
    vector<int> l(N);
    scan(l);

    SORT(l);
    vector<int> db(N);
    FOR(i, 1, N) {
        db[i] = db[i - 1];
        if (l[i] == l[i - 1])
            db[i]++;
    }
    ll ans = 0;
    REP(i, N - 1) {
        FOR(j, i + 1, N) {
            auto itr = lower_bound(ALL(l), l[i] + l[j]);
            ll ng    = distance(itr, l.end());
            ans += (N - 1 - j) - ng;
        }
    }
    print(ans);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define long long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define debug(X) cerr<< #X << " = " <<X << endl
#define debug2(X,Y) cerr<< #X << " = " <<X << ","<<#Y<<" = "<<Y<<endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar
using namespace std;

inline void read(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for (;((c<48 || c>57) && c != '-') ;c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
inline void writeln(int x){

         char buffor[21];
         register int i=0;
         int neg=0; if (x<0) {neg=1; x= -x;}
         do{
               buffor[i++]=(x%10)+'0';
               x/=10;
            } while(x);
           i--;
           if (neg) pc('-');
           while(i>=0) pc(buffor[i--]);
           pc('\n');
       }

const int N= (int)1e5+10;
const long oo= (long)1e10+1;
int n;
long a[N],rev[N];
map<long,int> cnt;

void input()
{
    cin>>n;
    up(i,1,n) cin>>a[i];
}

void solve()
{

    up(i,1,n)
    {
    	rev[i]= 1; long A= a[i]; long remain= a[i];
    	a[i]= 1;
        for (long j= 2; j<= 320; j++)
		{
            long j3= j*j*j;
            while (remain%j3==0) remain/= j3;
            long j2= j*j;
            if (remain%j2==0)
			{
				rev[i]*= j; a[i]*= j2;
			}
            else if (remain%j==0)
			{
				rev[i]*= j2; a[i]*= j;
			};
            if (rev[i]>oo) rev[i]= oo;

            while (remain%j==0) remain/= j;
		}

		a[i]*= remain;
        long can= (long)sqrt(remain);
        if (can*can== remain)
		{
			rev[i]*= can;
			if (rev[i]>oo) rev[i]= oo;
		}
		else
		{
			rev[i]*= remain;
			if (rev[i]>oo) rev[i]= oo;
			rev[i]*= remain;
			if (rev[i]>oo) rev[i]= oo;
		};

		cnt[a[i]]++;
    }
    int res= 0;
    up(i,1,n)
    {
    	if (cnt[a[i]]==0) continue;
    	if (a[i]==1)
		{
			res++; cnt[a[i]]= 0;
		}
		else
		{
			res+= max(cnt[a[i]],cnt[rev[i]]);
			cnt[a[i]]= cnt[rev[i]]= 0;
		}
    }
    cout<<res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);// don't use when interactive

    #ifdef I_Love_Pork
    #define TASK "tmp"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
	#endif

    input();
    solve();

    return 0;
}


Measured memory_bytes: 12160
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>
#include<stack>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tpl;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 1500

const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {


	string a, b,c;
	cin >> a >> b >> c;
	cout << a[0] << b[0] << c[0] << endl;
	


	return 0;
}


Measured memory_bytes: 256
int main() {
    int H, W, i, n, m, x, y;
    for(; ;){
        scanf("%d%d", &H, &W);
        if(H == 0 && W == 0){break;}
        for(n=1; n <= H;n++){
            y=n;
            for(x=1; x <= 3000; x++){
                y=y%2;
            }
            if(y == 0){
                for(m=1;m <= W;m++){
                    y=m;
                    for(x=1;x <= 3000;x++){
                        y=y%2;
                    }
                    if(y == 0){
                        printf("#");
                    }else{
                        printf(".");
                    }
                }
                printf("\n");
            }else{
                for(m=1;m <= W;m++){
                    y=m;
                    for(x=1;x <= 3000;x++){
                        y=y%2;
                    }
                    if(y == 0){
                        printf(".");
                    }else{
                        printf("#");
                    }
                }
                printf("\n");
            }
        }
        printf("\n");
    }
    return 0;}

Measured memory_bytes: 572
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long sum = 0;
		for(int i = 1; i <= n; i++){
			if(i%3!=0 && i%5!=0){
				sum += i;
			}
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 35616
#include<stdio.h>
int main()
{
    int a, b, c, in[2000], out[2000], ok = 0, i, yes = 1, no = 1;
    scanf("%d", &a);
    for(i = 0;  i < a ; i++) scanf("%d", &in[i]);
    scanf("%d", &b);
    for(i = 0 ; i < b; i++) scanf("%d", &out[i]);
    c = a;
    if(b < c)
    {
        c = b;
    }
    for(i = 0; i < c; i++)
    {
        if(out[i] > in[i])
        {
            ok = 1;
            break;
        }
        if(in[i] > out[i])
        {
            no = 0;
            break;
        }
        if(in[i] != out[i]) yes = 0;
    }
    if(yes && no) if(b > a) ok = 1;
    printf("%d\n", ok);

    
}


Measured memory_bytes: 2760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int a,k;
 vector<int> b(81);
 string res;
  res = "No";
 
  cin >> a;
  k = 0;
  for (int i = 1;i<10;++i){
   for (int j = 1;j<10;++j){
     b.at(k) = i*j;
       ++k;
   }
  }
  
  for(int l = 0;l < 81;++l){
    if(a == b.at(l)){
      res = "Yes";
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807;
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	int H, W;
	char A[8];
	int cnt = 0;
	scanf("%d%d", &H, &W);
	for (int i = 0; i < H; i++) {
		scanf("%s", A);
		for (int j = 0; j < W; j++) {
			if (A[j] == '#') {
				cnt++;
			}
		}
	}

	if (cnt == H + W - 1) {
		puts("Possible");
	}
	else {
		puts("Impossible");
	}





#ifdef DEBUGF
	getch();
#endif
	return 0;
}


Measured memory_bytes: 128
//PseudoName

    #pragma GCC optimize("O3")
    #include <bits/stdc++.h>
/*
	#include <ext/pb_ds/assoc_container.hpp>
	#include <ext/pb_ds/tree_policy.hpp>
	using namespace __gnu_pbds;
	template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/
    #define FOR(i,n) for(i=0;i<n;i++)
    #define FOR1(i,n) for(i=1;i<=n;i++)
    #define FOR2(I, A, B) for (int I = (A); I <= (B); ++I)
    #define pb push_back
    #define unique_sort(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
    #define print(v) for(auto it:v)cout<<it<<" ";cout<<endl
    #define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define endl "\n"
    #define min3(a,b,c) min(a,min(b,c))
    #define forr(n) for(int i=0;i<n;i++)
    #define frr(n) for(int i=1;i<=n;i++)
    #define MAX 200005
    #define inf 200008

    using namespace std;

    typedef long long ll;
    typedef long li;
    typedef vector<int> vi;
    typedef vector<ll> vli;
    typedef vector<vi> vvi;
    typedef vector<vli> vvli;
    typedef pair<int,int> pi;
    typedef pair<ll,ll> pli;
    typedef vector<pi> vpi;
    typedef vector<pli> vpli;



    int main() {
       //fast();

       double n;
       cin>>n;
     //  n*=1.0;

       double ans=(n/3)*(n/3)*(n/3);
      // printf("%.8lf",ans);
        cout<<setprecision(10)<<ans<<endl;





    }


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}
ll N,A,B;
vector<ll>h(100005);
bool isOK(ll mid){
	ll ret=0;
	for(int i=0;i<N;i++){
		if(h[i]-mid*B>0){
			ret+=(h[i]-mid*B+(A-B)-1)/(A-B);
		}
	}
	return ret<=mid;
}


int main(){
	init();
	ll X,A,B;cin>>X>>A>>B;
	if(-A+B<=0)cout<<"delicious"<<endl;
	else if(-A+B<=X)cout<<"safe"<<endl;
	else cout<<"dangerous"<<endl;
}


Measured memory_bytes: 1024
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}
void writeA(T)(size_t n,T t){foreach(i,v;t.enumerate){write(v);if(i<n-1)write(" ");}writeln;}

void main()
{
  int n; readV(n);
  int[] a; readA(n, a);

  auto b = new int[](n);
  if (n%2 == 0) {
    foreach (i; 0..n/2)
      b[i] = a[n-i*2-1];
    foreach (i; 0..n/2)
      b[i+n/2] = a[i*2];
  } else {
    foreach (i; 0..n/2+1)
      b[i] = a[n-i*2-1];
    foreach (i; 0..n/2)
      b[i+n/2+1] = a[i*2+1];
  }

  writeA(n, b);
}


Measured memory_bytes: 5884
H,W,K=map(int,input().split());m,c=10**9+7,1;H+=W
for i in range(1,K):c=c*(H-i)%m;
v=pow(H-1,m-2,m);d=K*(K+1)//2;a=c*H*(d+K);a+=c*v*2*(H-W)*W*(K-1)*d//3;print(a%m)

Measured memory_bytes: 62936