akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int64_t N, ans = 0;
    cin >> N;
    vector<int64_t> A(N), B(N), C(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    for (int i = 0; i < N; i++) {
        cin >> B.at(i);
    }
    for (int i = 0; i < N; i++) {
        cin >> C.at(i);
    }
    sort(ALL(A));
    sort(ALL(B));
    sort(rALL(C));
    for (int i = 0; i < N; i++) {
        int64_t a, c, ok = -1, ng = N;
        while (ok + 1 < ng) {
            int64_t mid = (ok + ng) / 2;
            if (A.at(mid) < B.at(i)) {
                ok = mid;
            } 
            else {
                ng = mid;
            }
            a = ok + 1;
        }
        ok = -1;
        ng = N;
        while (ok + 1 < ng) {
            int64_t mid = (ok + ng) / 2;
            if (C.at(mid) > B.at(i)) {
                ok = mid;
            } 
            else {
                ng = mid;
            }
            c = ok + 1;
        }
        ans += a * c;
    }
    cout << ans << endl;
}


Measured memory_bytes: 2560
from collections import defaultdict

N = int(input())
A = [int(input()) for _ in range(N)]

mem = defaultdict(int)
for i in range(N) :
    mem[A[i]] += 1
    
ret = 0
for v in mem.values() :
    if v % 2 == 1 :
        ret += 1
print(ret)

Measured memory_bytes: 61528
// Problem : B - Palindrome-philia
// Contest : AtCoder - AtCoder Beginner Contest 147
// URL : https://atcoder.jp/contests/abc147/tasks/abc147_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include<set>
#define lli long long int
using namespace std;
int main()
{
	lli t=0,a,i;
	string s;
	cin>>s;
	a=s.length();
	for(i=0;i<s.length()/2;i++){
		if(s[i]!=s[a-1-i])
		t++;
	}
	cout<<t;
	
	
	return 0;
}

Measured memory_bytes: 3584
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, W;
  cin >> n >> W;

  vector<llong> w(n), v(n);
  REP(i,n){
    cin >> w[i] >> v[i];
  }

  llong dp[2][100001] = {};

  REP(i,n){
    int pre = i % 2, next = (i+1) % 2;
    REP(j,W+1){
      if(j - w[i] >= 0)
        dp[next][j] = max(dp[pre][j], dp[pre][j-w[i]] + v[i]);
      else
        dp[next][j] = dp[pre][j];
    }
  }

  llong ans = 0;
  REP(i,W+1){
    ans = max(ans, dp[n%2][i]);
  }

  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 2424
import java.util.Scanner;

class Main {
	static void f(int A, int B, int C, int D) {
		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < 2; j++) {
				for(int k = 0; k < 2; k++) {
					int ans = A;
					ans += (i == 0) ? B : (-B);
					ans += (j == 0) ? C : (-C);
					ans += (k == 0) ? D : (-D);
					if(ans == 7) {
						char op1 = (i == 0) ? '+' : '-';
						char op2 = (j == 0) ? '+' : '-';
						char op3 = (k == 0) ? '+' : '-';
						System.out.println(A+""+op1+""+B+""+op2+""+C+""+op3+""+D+"=7");
						return;
					}
				}
			}
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int A = s/1000; s -= A*1000;
		int B = s/100; s -= B*100;
		int C = s/10, D = s%10;
		f(A,B,C,D);
	}
}

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

int main() {
    int N;
    string S;
    cin >> N;
    cin >> S;
    int ans = N;

    for (int i = 0; i < N; i++) {
        char tmp1, tmp2;
        tmp1 = S[i];
        tmp2 = S[i+1];
        if (tmp1 == tmp2) ans--;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
h,w=map(int,input().split())
field=[]
field.append([True for i in range(w+2)])
start=[]
for i  in range(h):
    s=input()
    sub=[True]
    for j in range(w):
        if s[j]=="#":
            sub.append(True)
        else:
            sub.append(False)
            start.append((i+1,j+1))
    
    sub.append(True)
    field.append(sub)

            
        
    
field.append([True for i in range(w+2)])

from collections import deque
import copy
dis=[]
for i in range(len(start)):

        fields=copy.deepcopy(field)
        d=deque()
        e=deque()
        distance=0
        fields[start[i][0]][start[i][1]]=True

        d.append((start[i][0],start[i][1]))
        while d:
            for some in d:
                index1,index2=some[0],some[1]
                if fields[index1-1][index2]==False:
                    fields[index1-1][index2]=True
                    e.append((index1-1,index2))
                if fields[index1+1][index2]==False:
                    fields[index1+1][index2]=True
                    e.append((index1+1,index2))
                if fields[index1][index2+1]==False:
                    fields[index1][index2+1]=True
                    e.append((index1,index2+1))
                if  fields[index1][index2-1]==False:
                    fields[index1][index2-1]=True
                    e.append((index1,index2-1))
            distance+=1
            d=e
            e=deque()

        dis.append(distance)
    


print(max(dis)  -1)      


Measured memory_bytes: 52056
#include <cstdio>
#include <algorithm>
using namespace std;
#define N 200000 + 5

int n, m, sz, bcc, T[N], Deg[N], Head[N], Dfn[N], Low[N], Stack[N];
bool ok = true;

struct Edge
{
	int next, node;
}h[N << 1];

inline void addedge(int u, int v)
{
	static int tot = 1;
	h[++ tot].next = Head[u], Head[u] = tot;
	h[tot].node = v;
}

void dfs(int z)
{
	static int id = 0;
	Dfn[z] = Low[z] = ++ id;
	Stack[++ sz] = z;
	for (int i = Head[z]; i; i = h[i].next)
	{
		int d = h[i].node;
		if (!Dfn[d])
		{
			dfs(d);
			Low[z] = min(Low[z], Low[d]);
			if (Low[d] >= Dfn[z])
			{
				bcc ++;
				int j;
				do
				{
					j = Stack[sz --];
				} while (j != d);
			}
		}
		else Low[z] = min(Low[z], Dfn[d]);
	}
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1, u, v; i <= m; i ++)
	{
		scanf("%d%d", &u, &v);
		addedge(u, v), addedge(v, u);
		Deg[u] ++, Deg[v] ++;
	}
	for (int i = 1; ok && i <= n; i ++)
		ok = Deg[i] % 2 == 0;
	if (!ok) puts("No");
	else
	{
		ok = false;
		int cnt = 0;
		for (int i = 1; !ok && i <= n; i ++)
			ok = Deg[i] >= 6, cnt += Deg[i] >= 4;
		ok |= (cnt >= 3);
		if (!ok && cnt == 2)
			dfs(1), ok = bcc > 1;
		puts(ok ? "Yes" : "No");
	}
	return 0;
}

Measured memory_bytes: 9344
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


ll R[399];

int main() {

	int N;
	scanf("%d", &N);

	R[0] = 2;
	R[1] = 1;
	for (int i = 2; i < 100; i++) {
		R[i] = R[i - 1] + R[i - 2];
	}

	printf("%lld", R[N]);

}


void  bubbleSort(char number[]) {
	for (int i = 0; i < strlen(number); i++)
		for (int j = i + 1; j < strlen(number); j++)
			if ((int)number[i] > (int)number[j]) {
				char tmp = number[i];
				number[i] = number[j];
				number[j] = tmp;
			}
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int n;
        int s;
        while(true) {
            n = scan.nextInt();
            s = scan.nextInt();
            if(s == 0 && n == 0) break;
            System.out.println(solve(n, s, 9));
        }
        scan.close();
    }

    public static int solve (int n, int s, int r) {
        if(n == 0 && s == 0) return 1;
        if(n == 0 || s < 0 || r == -1) return 0;
        return solve(n, s, r-1) + solve(n-1, s-r, r-1);
    }
}


Measured memory_bytes: 26216
fun main(args: Array<String>) = println(run {
    val (n,m) = readLine()!!.split(" ").map { it.toInt() }
    val x = readLine()!!.split(" ").map { it.toInt() }.sorted()
    val d = IntArray(m-1) { x[it+1] - x[it] }.sorted()
    if(m>=n) d.take(m-n).sum() else 0
})

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

#define ALL(a) (a).begin(), (a).end()
#define ll long long

using namespace std;

bool ismatch(string &key, char c){
    for(int i = 0; i < key.size(); i++){
        if(key[i] == c)return true;
    }
    return false;
}

signed main(){
    string key("aeiou");
    while(true){
        int n; cin >> n;
        if(n == 0)break;
        vector<string> s(n);
        for(int i = 0; i < n; i++)cin >> s[i];
        vector<string> c(n);
        int cmax = 0;
        for(int i = 0; i < n; i++){
            c[i].push_back(s[i][0]);
            for(int j = 0; j < s[i].size()-1; j++){
                if(ismatch(key, s[i][j])){
                    c[i].push_back(s[i][j+1]);
                }
            }
            cmax = max(cmax, (int)c[i].size());
        }
        int ans = -1;
        for(int i = 1; i <= cmax; i++){
            map<string, bool> k;
            for(int j = 0; j < n; j++){
                string temp;
                if(c[j].size() < i){
                    temp = c[j];
                }
                else{
                    temp = c[j].substr(0,i);
                }
                if(k.find(temp) != k.end()){
                    break;
                }
                else{
                    k[temp] = true;
                }
            }
            if(k.size() == n){
                ans = i; break;
            }
        }
        cout << ans << endl;
    }
    return 0;
}




Measured memory_bytes: 3168
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main(){
  int A,B,C,D,AB_far,BC_far,CA_far,A_hantei,B_hantei,C_hantei;
  string ans;
  cin >> A >> B >> C >> D;
  AB_far = abs(A-B);
  BC_far = abs(B-C);
  CA_far = abs(C-A);
  //cout << AB_far <<"\n";
  //cout << BC_far <<"\n";
  //cout << CA_far <<"\n";
  if (AB_far<=D)
    A_hantei = 1;
  else
    A_hantei = 0;
  
  if (BC_far<=D)
    B_hantei = 1;
  else
    B_hantei = 0;
  if (CA_far<=D)
    ans = "Yes";
  else if (A_hantei + B_hantei ==2)
    ans = "Yes";
  else
    ans = "No";
  cout << ans <<"\n";
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  string ss, t;
  cin >> ss >> t;

  int sl = ss.length();
  int tl = t.length();

  bool isOK = true;
  vector<string> sss;

  for (int i = sl - tl; i >= 0; i--) {
    string s = ss;
    isOK = true;
    for (int j = 0; j < t.length(); j++) {
      if (s[i + j] != t[j] && s[i + j] != '?') {
        isOK = false;
        break;
      }
    }
    if (isOK) {
      for (int j = 0; j < t.length(); j++) {
        s[i + j] = t[j];
      }
      sss.push_back(s);
    }
  }

  for (int i = 0; i < sss.size(); i++) {
    for (int j = 0; j < sss[i].length(); j++){
      if(sss[i][j] == '?'){
        sss[i][j] = 'a';
      }
    }
  }



  if (sss.size() > 0) { 
    sort(sss.begin(), sss.end());
    cout << sss[0];
  } else {
    cout << "UNRESTORABLE";
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
 
int main(){
  int n,i,j,minv,maxv,*r;
 
  scanf("%d",&n);
 
  r = malloc(sizeof(int)*n);
 
  for(i = 0;i < n;i++){
    scanf("%d",&r[i]);
  }
 
  minv = r[0];
  maxv = r[1] - r[0];
  for(j = 1;j < n;j++){
    if(maxv > (r[j] - minv)){
      maxv = maxv;
    }
    else{
      maxv = r[j] - minv;
    }
 
    if(minv < r[j]){
      minv = minv;
    }
    else{
      minv = r[j];
    }
  }
 
  printf("%d\n",maxv);
 
  return 0;
}

Measured memory_bytes: 1380
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

int main(){
	int n;
	scanf("%d", &n);
	deque<int>b;
	int flag = true;
	rep(i, n) {
		int a;
		scanf("%d", &a);
		if (flag) {
			b.push_back(a);
			flag = false;
		}
		else {
			b.push_front(a);
			flag = true;
		}
	}
	if (n % 2 != 0) {
		reverse(all(b));
	}
	rep(i, b.size()) {
		printf("%d",b[i]);
		if (i != b.size() - 1) {
			printf(" ");
		}
		else {
			printf("\n");
		}
	};
}

Measured memory_bytes: 2944
def comb(n, k, mod=10**9+7):
    num = den = 1
    for i in range(k):
        num = num * (n-i) % mod
        den = den * (i+1) % mod
    return num * pow(den, mod-2, mod) % mod

N, M, K = map(int, input().split())
mod = 10**9 + 7
ans = 0
for i in range(N):
    for j in range(M):
        ans += (i+1)*j*(j+1)//2 + i*(M-j-1)*(M-j)//2 + M*i*(i+1)//2
        ans %= mod
ans = ans * comb(N*M-2, K-2) % mod
print(ans)



Measured memory_bytes: 39368
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define N 200100
#define mod 1000000007
#define MOD 998244353
#define fn(i,n) for(int i=0;i<n;i+=1)
#define rep(i,l,r) for(int i=l;i<=r;i+=1)
#define INF 100000000000000000
#define pii pair<int,int>
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

signed main()
{
    
    speed
    string s;cin>>s;
    if(s=="ABC")cout<<"ARC"<<endl;
    else {
    	cout<<"ABC"<<endl;
    }


    

 
    return 0;
}

Measured memory_bytes: 3608
import numpy as np
N=int(input())
F=np.array([list(map(int,input().split(' '))) for i in range(N)])
#row:shop, col:openpattern

P=np.array([list(map(int,input().split(' '))) for i in range(N)])

openptn=np.array([[int(s) for s in list('{0:010b}'.format(i))] for i in range(1,2**10)])
#row:openpatterns, col:openpattern

dualopenfreq=np.array([np.sum(ptn*F, axis=1) for ptn in openptn])
#row:openpattern of my shop, col: dualopenfreq of each enemy

profit=np.array([np.sum(np.array([P[i][freq[i]] for i in range(N)]))  for freq in dualopenfreq])
#row:openpattern of my shop, col:profit
print(np.max(profit))

Measured memory_bytes: 14288
#include<cstdio>
#define WHITE 0
#define GRAY  1
#define BLACK 2
#define MAX 100

void InitializeBoolMatrix(int nmbr_of_rows, int nmbr_of_columns, bool mtrx[][MAX]){
	for (int row = 0; row < nmbr_of_rows; ++row) {
		for (int column = 0; column < nmbr_of_columns; ++column)
			mtrx[row][column] = false;
	}
}

void ListToMatrix(int number_of_vertices, bool mtrx[][MAX]){
	int vertex_from, vertex_to, degree_out;	
	for (int vertex_i = 0; vertex_i < number_of_vertices; ++vertex_i) {
		scanf("%d %d", &vertex_from, &degree_out);
		vertex_from--; //0?????????????????????
		for (int vertex_out_i = 0; vertex_out_i < degree_out; ++vertex_out_i) {
			scanf("%d", &vertex_to);
			vertex_to--; //0?????????????????????
			mtrx[vertex_from][vertex_to] = true;
		}
	}
}

void BuildAdjacencyMatrix(int n, bool adjmtrx[][MAX]){
	InitializeBoolMatrix(n, n, adjmtrx);
	ListToMatrix(n, adjmtrx);
}

bool adjmtrx[MAX][MAX];
bool has_not_been_discovered_yet[MAX];
int time;
int discoveredtime[MAX];
int finishedtime[MAX];

void Dfs(int present_vertex, int n){
	int pv = present_vertex;
	has_not_been_discovered_yet[pv] = false;
	discoveredtime[pv] = ++time;
	for(int v = 0;v < n;v++){
		if(adjmtrx[pv][v] && has_not_been_discovered_yet[v]){
			Dfs(v, n);
		}
	}
	finishedtime[pv] = ++time;
}

void DfsInit(int n){
	for (int i = 0; i < n; ++i)
		has_not_been_discovered_yet[i] = true;
	time = 0;
}

int main(){
	int number_of_vertices;
	scanf("%d", &number_of_vertices);
	int n = number_of_vertices;
	BuildAdjacencyMatrix(n, adjmtrx);
	DfsInit(n);
	for (int vertex_i = 0; vertex_i < n; ++vertex_i){
		if(has_not_been_discovered_yet[vertex_i])
			Dfs(vertex_i, n);
	}
	for (int id = 0; id < n; ++id)
		printf("%d %d %d\n", id+1, discoveredtime[id], finishedtime[id]);
	return 0;
}

Measured memory_bytes: 2692
// D - Banned K
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(n);++i)

#define nC2(n) ((ll)(n)*((n)-1)/2) //組み合わせ

int A[200000], C[200000];

int main(){
	int N; cin>>N;
	rep(i, N){ scanf("%d",A+i); A[i]--; C[A[i]]++; }//値の種類毎の計数
	ll all = 0; rep(a, N) all += nC2(C[a]);//組み合わせの総計
	rep(k, N) printf("%lld\n",all - nC2(C[A[k]]) + nC2(C[A[k]]-1));
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

ll K;
vector<ll> dist(100001, LLONG_MAX); //distance[i]は始点(start)から頂点iへの最短距離が入る

void Dijkstra(){ //start = 始点
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(make_pair(1, 1));
    while(!que.empty()){
        ll d, t;
        tie(d, t) = que.top(); que.pop();
        if(dist[t] <= d) continue;
        dist[t] = d;
        if(dist[(t + 1) % K] > d + 1) que.push(make_pair(d + 1, (t + 1) % K));
        if(dist[(t * 10) % K] > d) que.push(make_pair(d, (t * 10) % K));
    }
}

int main(void){
    
    scanf("%lld", &K);
    Dijkstra();
    printf("%lld\n", dist[0]);
    
    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}
template<uint32_t mod>
struct ModInt{
	uint32_t a;
	ModInt& s(uint32_t vv){
		a=vv<mod?vv:vv-mod;
		return *this;
	}

	ModInt(int64_t x=0){s(x%mod+mod);}

	ModInt& operator+=(const ModInt &x){return s(a+x.a);}
	ModInt& operator-=(const ModInt &x){return s(a+mod-x.a);}
	ModInt& operator*=(const ModInt &x){
		a=uint64_t(a)*x.a%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &x){
		*this*=x.inv();
		return *this;
	}

	ModInt operator+(const ModInt &x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt &x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt &x)const{return ModInt(*this)*=x;}
	ModInt operator/(const ModInt &x)const{return ModInt(*this)/=x;}
	bool operator==(const ModInt &x)const{return a==x.a;}
	bool operator!=(const ModInt &x)const{return a!=x.a;}
	bool operator<(const ModInt &x)const{return a<x.a;}

	ModInt operator-()const{return ModInt()-*this;}
	ModInt pow(int64_t n)const{
		ModInt res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}

	ModInt inv()const{return pow(mod-2);}
};

template<uint32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
	return (in>>a.a);
}
template<uint32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
	return (out<<a.a);
}
using mint=ModInt<1000000007>;
//using mint=ModInt<998244353>;
signed main(){
	int N;
	cin>>N;
	vint cnt(26);
	string S;cin>>S;
	for(auto c:S)cnt[c-'a']++;
	
	mint ans=1;
	rep(i,26)ans*=cnt[i]+1;
	ans-=1;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<math.h>
#include<vector>
using namespace std;
int main() {
  int n;cin>>n;
  vector<int> stones(n,0);
  vector<int> dp;// = new int[n];
  int tmp=0;
  for(int& i:stones){cin>>i;}//stones.push_back(tmp);}
  dp.push_back(0);
  dp.push_back(abs(stones[1]-stones[0]));
  for(int i=2;i<n;i++) {
  	dp.push_back(min(dp[i-1]+abs(stones[i]-stones[i-1]),dp[i-2]+abs(stones[i-2]-stones[i])));
  }
  if(n>=1)cout<<dp[n-1]<<endl;
  else cout<<0<<endl;
  return 0;
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,v[55];
ll solve(ll l,ll r){
	vector<ll> t;  
	for(int i=0;i<=l;i++){   
    	t.push_back(v[i]);
	} 
    for(int i=r;i<n;i++){ 
        t.push_back(v[i]);
    }  
    sort(t.begin(),t.end());     
    ll lim=k-t.size();          
    if(lim<0){
		return 0; 
	}
    ll sum=0;
    for(int i=0;i<t.size();i++){
        if(t[i]<0&&lim>0){    
        	lim--;
        }else{       
			sum+=t[i];
		}
    }
   return sum;
}
int main(){
    cin>>n>>k; 
    for(int i=0;i<n;i++){
		cin>>v[i];
	}
    ll ans=0; 
    for(int i=-1;i<n;i++){
    	for(int j=i+1;j<=n;j++){
    		ans=max(ans,solve(i,j));
    	}
	}
   cout<<ans;
   return 0;
}



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

int main(){
	int n,a;

	while( cin >> n , n ){
		a = 0;
		while( n != 1 ){
			(n%2)? n=n*3+1 : n/=2 ;
			a++;
		}
		cout << a << endl;
	}	
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] bubNum = new int[sc.nextInt()];
        
        for(int i = 0; i < bubNum.length; i++){
            bubNum[i] = sc.nextInt();
        }
        BubbleSort bs = new BubbleSort(bubNum);
        bs.changeOfBubNum();
        bs.outPutOfBubNum();
        bs.outPutOfBubCount();
    }
}

class BubbleSort{
    int[] bubNum;
    public BubbleSort(int[] bubNum){
        this.bubNum = bubNum;
    }
    
    int count = 0;
    public void changeOfBubNum(){
        int minNum = 0;
        for(int i = 0, j; i < bubNum.length; i++){
            if(i == 0){
                continue;
            }
            minNum = bubNum[i];
            j = i - 1;
            while(j >= 0 && bubNum[j] > minNum){
                bubNum[j + 1] = bubNum[j];
                count++;
                j--;
            }
            bubNum[j + 1] = minNum;
        }
    }
    
    public void outPutOfBubNum(){
        for(int i = 0; i < bubNum.length; i++){
            if(i == 0){
                System.out.print(bubNum[i]);
                continue;
            }
            System.out.print(" " + bubNum[i]);
        }
        System.out.print("\n");
    }
    
    public void outPutOfBubCount(){
         System.out.println(count);
    }
}


Measured memory_bytes: 26492
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define p pair<int,int>
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
using namespace std;
int POW(int x,int y){return int(pow(double(x),double(y)));}

int main(){
	int n,k;
	cin>>n>>k;
	vector<int> a(n);
	rep(i,n){
		cin>>a[i];
	}
	if((n-1)%(k-1)==0)
		cout<<(n-1)/(k-1)<<endl;
	else
		cout<<(n-1)/(k-1)+1<<endl;
	return 0;
}


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

int n;

bool prime(){
	if(n == 1) return 0;
	for(int i = 2; i * i <= n; i++)
		if(!(n % i)) return 0;
	return 1;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    while(!prime()) n++;
    cout << n << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

ll pw(ll x, ll y) {
	ll rez = 1;
	while(y--) rez *= x;
	return rez;
}

ll count(const vector<ll>& digits, ll x, ll y) {
	ll rez = 0;
	ll leng = len(digits);
	if(leng == 1) {
		return (x == y && x <= digits.front() ? 1 : 0);
	}

	for(ll sz = 1; sz < leng; ++sz) {
		rez += sz > 1 ? pw(10, sz - 2) : (x == y);
	}

	if(x < digits.front()) {
		rez += pw(10, leng - 2);
	} else if(x == digits.front()) {
		for(ll pos = 1; pos < leng; ++pos) {
			for(ll t = 0; t < digits[pos]; ++t) {
				ll suff = leng - pos - 1;
				if(suff != 0) {
					rez += pw(10, suff - 1);
				} else {
					rez += (t == y);
				}
			}	
		}

		if(digits.front() == x && digits.back() == y) ++rez;
	}

	return rez;
}

void solve() {
	ll n = fetch<ll>();
	ll answ = 0;
	vector<ll> digits;
	for(ll j = n; j > 0; j /= 10) digits.push_back(j%10);
	reverse(digits.begin(), digits.end());

	for(ll x = 1; x < 10; ++x) {
		for(ll y = 1; y < 10; ++y) {
			answ += count(digits, x, y) * count(digits, y, x);
		}
	}

	cout << answ << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const int INF = INT_MAX;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

const int mod = 1000000007;


int main() {

    int n, a, b, c;
    cin >> n >> a >> b >> c;

    vector<int> ls(n);
    rep(i, n) {
        int k;
        cin >> k;
        ls[i] = k;
    }

    int ans = INF;

    for (int i = 0; i < (1 << (2 * n)); i++) {

        int ac = 0;
        int bc = 0;
        int cc = 0;

        int as = 0;
        int bs = 0;
        int cs = 0;

        string s = "";

        for (int k = 0; k < n; k++) {
            int kb = (i >> (2 * k)) & 3;
            if (kb == 0) {
                ac++;
                as += ls[k];
                s += "a ";
            } else if (kb == 1) {
                bc++;
                bs += ls[k];
                s += "b ";

            } else if (kb == 2) {
                cc++;
                cs += ls[k];
                s += "c ";

            } else {
                s += "d ";
            }
        }

        if (ac == 0 || bc == 0 || cc == 0) continue;

        int now = (ac - 1) * 10;
        now += (bc - 1) * 10;
        now += (cc - 1) * 10;

        now += abs(a - as);
        now += abs(b - bs);
        now += abs(c - cs);

        ans = min(ans, now);

    }

    cout << ans << endl;


}



Measured memory_bytes: 256
N,X = list(map(int,input().split()))

n_patties = {0:1}
l_burgur = {0:1}
for i in range(N):
  n_patties[i+1] = n_patties[i]*2+1
  l_burgur[i+1] = l_burgur[i]*2+3 

def cnt_patty(level,x):
  if x == l_burgur[level]:
    return n_patties[level]
  elif l_burgur[level-1] + 2 < x:
    return n_patties[level-1] + 1 + cnt_patty(level-1,x-l_burgur[level-1]-2)
  elif l_burgur[level-1] + 2 == x:
    return n_patties[level-1] + 1
  elif 1 < x:
    return cnt_patty(level-1,x-1)
  else:
    return 0

print(cnt_patty(N,X))

Measured memory_bytes: 3064
n = int(input())
i = input()

i = i.split()
for item in range(len(i)):
    i[item] = int(i[item])

totn = 0
totp = 0

countp = 0
countn = 0

for x in range(len(i)):
    totp += i[x]
    totn += i[x]

    if x %2 == 1:
        if totn == 0:
            countn += 1
            totn = 1
        elif totn < 0:
            countn += abs(totn) + 1
            totn = 1

        if totp == 0:
            countp += 1
            totp = -1
        elif totp > 0:
            countp += abs(totp) + 1
            totp = -1

    if x %2 == 0:
        if totn == 0:
            countn += 1
            totn = -1
        elif totn > 0:
            countn += abs(totn) + 1
            totn = -1

        if totp == 0:
            countp += 1
            totp = 1
        elif totp < 0:
            countp += abs(totp) + 1
            totp = 1

count = min(countn, countp)
print(count)


Measured memory_bytes: 11132
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(ll key, ll value){
      this->key = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;

const ll DIVIDE = (1E+9)+7;
const ll MAX = (1E+5+1);

vvll edge(MAX);
vll white_num(MAX, -1);
vll black_num(MAX, -1);
vector<bool> flag(MAX, false);

int search(const ll N, const int pos){
  if(white_num[pos] + black_num[pos] >= 0) return (white_num[pos] + black_num[pos])%DIVIDE;

  flag[pos] = true;

  white_num[pos] = 1;
  black_num[pos] = 1;
  for(int i=0; i<edge[pos].size(); ++i){
    if(flag[edge[pos][i]]) continue;
    white_num[pos] *= search(N, edge[pos][i]);
    black_num[pos] *= white_num[edge[pos][i]];
    white_num[pos] %= DIVIDE;
    black_num[pos] %= DIVIDE;
  }

  flag[pos] = false;

  return (white_num[pos] + black_num[pos])%DIVIDE;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N;
  cin >> N;

  ll x, y;
  rep(i, 0, N-1){
    cin >> x >> y;
    edge[x-1].push_back(y-1);
    edge[y-1].push_back(x-1);
  }

  int ans = search(N, 0);

  cout << ans << "\n";

  return 0;
}


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

int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  int k;
  cin >> k;
  sort(a.begin(), a.end());
  string ans = (a[4] - a[0] <= k) ? "Yay!" : ":(";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n,k;
  cin >> n >> k;
  if((n-1)*(n-2)/2<k){ cout << -1 << "\n";return 0;}

  vector<int> a,b;
  rep1(i,n-1){
    a.push_back(1);b.push_back(1+i);
  }

  int s=(n-1)*(n-2)/2-k;
  int j=2;
  while(1){
    rep1(i,n-j){
      if(s==0) break;
      a.push_back(j);b.push_back(j+i);
      s--;
    }
    if(s==0) break;
    j++;
  }

  cout << (int)a.size() << "\n";
  rep(i,a.size()) cout << a[i] << " " << b[i] <<"\n" ;
  
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n;
int a[5001];
int sum[5001];
main(){
  while(1){
    int res=-1000000;
    scanf("%d",&n);
    if(n==0) break;
    int sm=0;
    for(int i=0;i<n;i++){
      scanf("%d",&a[i]);
      sm+=a[i];
      sum[i]=sm;
    }
    for(int i=0;i<n;i++){
      for(int j=i;j<n;j++){
	int s=i-1<0?0:sum[i-1];
	res=max(res,sum[j]-s);
      }
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 0
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#define debug(...) (cerr<<"'"<<__FUNCTION__<<"': "),fprintf(stderr,__VA_ARGS__)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n,m,k,a[111][111];
int main()
{
	getiii(n,m,k);
	int x=1,y=1,dir=1;
	for(int i=1;i<=k;i++)
	{
		int times;
		geti(times);
		while(times--)
		{
			a[x][y]=i;
			y+=dir;
			if(y>m)x++,y=m,dir=-1;
			if(y==0)x++,y=1,dir=1;
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			puti(a[i][j]);
		}
		puts("");
	}
	return 0;
}

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



ll findGCD(ll c, ll d){
    if(d == 0) return c;
    
    return findGCD(d, c%d);
    
}

ll findLCM(ll c, ll d){
    return c * d / findGCD(c, d);
}

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    
    //cでもdでも割り切れないもの
    //c,dで割り切れるもの以外 - c,dの最小公約数
    
    ll lcm = findLCM(c,d);
    
    a--;
    
    ll cc = b/c - a/c;
    
    ll dd = b/d - a/d;
    ll lcmlcm = b/lcm - a/lcm;
    
    
    ll ans = b - a - cc - dd + lcmlcm;
    
    cout << ans;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define r(i,n) for(int i=0;i<n;i++)
#define z 100
using namespace std;
int n,a,b,q[z],l[z],la,be,an,ct[z],c[z][z];bool v[z],s[z];void d(int x,int len){if(len>be){la=x;be=len;}v[x]=1,s[x]=1;for(int i=0;i<ct[x];i++)if(!v[c[x][i]]){d(c[x][i],len+1);v[c[x][i]]=0;}}int main(){while(1){cin>>n;if(!n)break;r(i,z)ct[i]=0;r(i,n){cin>>a>>b;a--,b--;c[a][ct[a]]=b,c[b][ct[b]]=a;ct[a]++,ct[b]++;}r(i,z)s[i]=0;an=0;for(int i=0;i<z;i++)if(!s[i]){r(i,z)v[i]=0;be=0;d(i,1);r(i,z)v[i]=0;be=0;d(la,1);an=max(an,be);}cout<<an<<endl;}return 0;}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
template<class T, class T2> inline void chkmax(T &x, const T2 &y) { if(x < y) x = y; }
template<class T, class T2> inline void chkmin(T &x, const T2 &y) { if(x > y) x = y; }
const int MAXN = (1 << 20);

int n;
vector<int> adj[MAXN];

void read()
{
	cin >> n;
	for(int i = 0; i < n - 1; i++)
	{
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
}

int dfs(int u, int pr = -1)
{
	int ans = 0;
	for(int v: adj[u])
		if(v != pr)
			ans ^= dfs(v, u);

	return ans + 1;
}

void solve()
{
	int answer = dfs(1) - 1;
	if(answer == 0) cout << "Bob" << endl;
	else cout << "Alice" << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	read();
	solve();
	return 0;
}



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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define trav(a, x) for (auto& a : x)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;
#define INF (1ll<<60)

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    ll N, A, B;
    cin >> N >> A >> B;
    ll x;
    cin >> x;
    ll ans = 0;
    FOR(i, 1, N-1) {
        ll y;
        cin >> y;
        if ((y-x) * A <= B) {
            ans += (y - x) * A;
        } else {
            ans += B;
        }
        x = y;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
N = int(input())
tmp = input()
A = [int(x.strip()) for x in tmp.split(' ')]
tmp = input()
B = [int(x.strip()) for x in tmp.split(' ')]
tmp = input()
C = [int(x.strip()) for x in tmp.split(' ')]
tmpsum = sum(B)
for i in range(0, N-1):
    if A[i]+1 == A[i+1]:
        tmpsum += C[A[i]-1]
print(tmpsum)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const int INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    int N, M; cin >> N >> M;
    P box[N];//ball_num, isRed
    rep(i, N)
        box[i].first = 1, box[i].second = false;
    box[0].second = true;
    rep(i, M) {
        int x, y; cin >> x >> y; --x, --y;
        box[y].first += 1;
        box[x].first -= 1;
        if(box[x].second == true) {//xに赤い玉がある
            box[y].second = true;
            if(box[x].first == 0)
                box[x].second = false;
        }
    }
    int ans = 0;
    rep(i, N) {
        if(box[i].second) ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    char s;
    cin >> s;
    cout << (char)((int)s + 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using namespace std::literals::chrono_literals;
using namespace std::literals::string_literals;
using ll = long long;

#define repi(i, s, n) for (long long i {s}, i##_len{n}; i < i##_len; ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) std::begin(x), std::end(x)

namespace xmaho
{
inline namespace input
{
template<typename T>
T get_value(std::istream& is = std::cin);
template<typename C>
C get_container(std::istream& is = std::cin, typename C::size_type length = std::numeric_limits<typename C::size_type>::max());
}
}
namespace xmaho
{
inline namespace integer
{
template<typename C>
constexpr auto ssize(const C& c) noexcept(noexcept(c.size()))
  -> typename std::common_type<std::ptrdiff_t, typename std::make_signed<decltype(c.size())>::type>::type;
template <class T, ptrdiff_t N>
constexpr std::ptrdiff_t ssize(const T (&)[N]) noexcept;
}
}
using namespace xmaho;

int main()
{
  cout << (get_value<int>() == get_value<int>()) << '\n';
  return 0;
}

class initalization
{
  class custom_numpunct: public std::numpunct<char>
  {
  public:
    using numpunct::numpunct;
  protected:
    std::string do_truename() const override { return "Yes"; }
    std::string do_falsename() const override { return "No"; }
  };

public:
  initalization()
  {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.imbue(std::locale(std::cout.getloc(), new custom_numpunct{}));
    std::cout << std::boolalpha << std::fixed << std::setprecision(15);
  }
} initalize;

template<typename T>
T xmaho::input::get_value(std::istream& is)
{ T v {}; is >> v; return v; }

template<typename C>
C xmaho::input::get_container(std::istream& is, typename C::size_type length)
{
  C v {};
  if (length != std::numeric_limits<typename C::size_type>::max())
    v.reserve(length);
  typename C::value_type e {};
  for (auto i {length}; i != 0 && is >> e; --i)
    v.push_back(std::move_if_noexcept(e));
  return v;
}

template<typename C>
constexpr auto xmaho::integer::ssize(const C& c) noexcept(noexcept(c.size()))
  -> typename std::common_type<std::ptrdiff_t, typename std::make_signed<decltype(c.size())>::type>::type
{ return c.size(); }

template <class T, ptrdiff_t N>
constexpr std::ptrdiff_t xmaho::integer::ssize(const T (&)[N]) noexcept
{ return N; }


Measured memory_bytes: 512
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 100005
#define M 200005
#define seed 23333

using namespace std;
int i,j,m,n,p,k,A[N];
int check(int x)
{
		long long s=0;
		for (i=1;i<=x;++i) s+=A[i];
		for (i=x+1;i<=n;++i)
		{
				if (2*s<A[i]) return 0;
				s+=A[i];
		}
		return 1;
}
int main()
{
		scanf("%d",&n);
		for (i=1;i<=n;++i) scanf("%d",&A[i]);
		sort(A+1,A+n+1);
		int l=1,r=n+1,Mid=0;
		while ((l+r)>>1!=Mid)
		{
				Mid=(l+r)>>1;
				if (check(Mid)) r=Mid;
				else l=Mid;
		}
		printf("%d\n",n-r+1);
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=200005;
//i_am_noob
int ans=0,x=0;
string str;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> str;
	rep(sz(str)){
		if(str[i]=='A'||str[i]=='C'||str[i]=='G'||str[i]=='T') x++;
		else x=0;
		ans=max(ans,x);
	}
	print1(ans);
	return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
# 県の個数, 市の個数
py = []
for i in range(m):
    p, y = map(int, input().split())
    py.append((i, p, y))


py.sort(key=lambda tup: tup[2])
# 年でsort
#print(py)

c = {}
newpy = []
for i in py:
    index = i[0]
    ken = i[1]
    year = i[2]
    if ken in c:
        c[ken] += 1
        order = c[ken]
    else:
        c[ken] = 1
        order = 1
    newpy.append((index, ken, order))
#print(c)

newpy.sort(key=lambda tup: tup[0])
#print(newpy)
for i in newpy:
    print("{:0=6}{:0=6}".format(i[1], i[2]))


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

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

int n, a[100005], ct;

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
        if (i == a[i]) {
            swap(a[i], a[i + 1]);
            ct++;
        }
    }
    cout << ct;
}


Measured memory_bytes: 640
//ITNOA
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
const long long INF=1e9+10,MAX=2e5+1e4,MOD=1e9+7,MAXL=25;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef pair<pii,ll> piii;
void OUT(long double o,int x){
	 cout<<fixed<<setprecision(x)<<o;
	 return;
}
ll a[MAX],d[MAX];
vector<int> v[MAX],k[MAX];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,m,t=0,p=0;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		k[x].pb(y);
		v[y].pb(x);
	}
	for(int i=0;i<n;i++){
		if(v[i].size()==0)
			a[t++]=i;
		d[i]=v[i].size();
	}
	while(p<t){
		for(int i:k[a[p]]){
			d[i]--;
			if(d[i]==0)
				a[t++]=i;
		}
		p++;
	}
	for(int i=0;i<n;i++)
		cout<<a[i]<<"\n";
	return 0;
}

Measured memory_bytes: 13912