akhauriyash/Code-Regression huggingface dataset:
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}

function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],1);
  if(N % 2 == 1){
     myout("No");
    return;
  }else{
    var a = "";
    var b = "";
    var list = myconv(input[1],6);
    for(var i = 0; i < N; i++){
      if(i < (N/2)){
         a += list[i];
      }else{
        b += list[i];
      }
    }
    if(a == b){
       myout("Yes");
       }else{
       myout("No");
       }
  }
}

Main(myin());


Measured memory_bytes: 21064
# coding: utf-8
# NとSの入力
N = int(input())
S = list(input())
#解答の初期化
ans = 0
#Nが小さいので全探索で十分
for i in range(N):
  #Sをi番目で分割しXとYに
  X = list(set(S[0 : i + 1]))
  Y = list(set(S[i + 1 : N]))
  #i番目で分けた場合の値の初期化
  temp = 0
  #1文字ずつ見ていく
  for x in X:
    for y in Y:
      if x == y:
        temp += 1
        break
  #ansをtempで上書きするかどうか
  if temp > ans:
    ans = temp
#解答の出力
print(ans)

Measured memory_bytes: 3060
from itertools import accumulate

def main():
    N, K = map(int, input().split())
    MOD = 10 ** 9 + 7
    A = list(range(0,N+1))
    B = list(accumulate(A))
    A.reverse()
    C = list(accumulate(A))
    ans = 0
    for r in range(K, N+2):
        r -= 1
        t_max = C[r]
        t_min = B[r]
        ans += t_max - t_min + 1 
        ans %= MOD
    print(ans)





if __name__ == "__main__":
    main()

Measured memory_bytes: 101104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
#define MOD 1000000007
#define INF 1000000
#define PI 3.14159265358979323846264338327950L
#define MAX_N 200010


int main()
{
  int N;cin>>N;
  vector<string> s(N);
  for (int i=0;i<N;i++)
  {
      cin>>s[i];
  }
  
  for (int i=0;i<N;i++)
  {
    sort(s[i].begin(),s[i].end());
    //cout<<s[i]<<endl;
  } 
  
  map<string,ll> m;
  for (int i=0;i<N;i++)
    m[s[i]]++;
  
  ll ans = 0;
  for (auto i=m.begin();i!=m.end();i++)
  {
     ll n = i->second;
     ans += n*(n-1)/2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 18176
#include <bits/stdc++.h>
#define All(v) v.begin(), v.end()
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

const int MAX_N = (int)1e5 + 5;
int A[MAX_N], sign[MAX_N];

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, p=0, m=0, z=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>A[i];
        if(A[i]>0) p++, sign[i] = 1;
        else if(A[i]<0) m++, sign[i] = -1;
        else z++;
    }
    if(m==0){
        int idx = distance(A, min_element(A, A+N));
        sign[idx] = -1;
    }
    else if(p==0){
        int idx = distance(A, max_element(A, A+N));
        sign[idx] = 1;
    }

    int cnt = 0, ans = 0, cur = 0;
    queue<int> P, M;
    for(int i=0;i<N;i++){
        if(sign[i]==1) ans += A[i], P.push(A[i]);
        else ans -= A[i], M.push(A[i]);
    }
    cur = ans;
    vector<int> X, Y;
    while(P.size()>1){
        int x = P.front(); P.pop();
        if(cnt==0){
            cur = x - cur;
            X.push_back(x); Y.push_back(cur);
            cnt ^= 1;
        }
        else{
            cur += x;
            X.push_back(cur); Y.push_back(x);
        }
    }

    while(M.size()>1) {
        int x = M.front(); M.pop();
        if (cnt==1) {
            cur = x - cur;
            X.push_back(x); Y.push_back(cur);
            cnt ^= 1;
        }
        else {
            cur += x;
            X.push_back(cur); Y.push_back(x);
        }
    }

    int xx = P.front(), yy = M.front();
    if(cnt==0){
        X.push_back(xx), Y.push_back(yy);
    }
    else{
        Y.push_back(xx), X.push_back(yy);
    }

    printf("%d\n", ans);
    reverse(All(X)), reverse(All(Y));
    for(int i=0;i<N-1;i++) printf("%d %d\n", X[i], Y[i]);
    return 0;
}

Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()

int main(){
  ll n,m,ans=0;
  cin >> n >> m;
  vector<ll> a[200010];
  for(ll i=0;i<n;i++){
    ll x,y;
    cin >> x >> y;
    if(x>m) continue;
    a[x].push_back(y);
  }
  priority_queue<ll> pq;
  for(ll i=1;i<=m;i++){
    for(auto e: a[i]){
      pq.push(e);
    }
    if(!pq.empty()){
      ans += pq.top();
      pq.pop();
    }
  }
  cout << ans << endl;
}

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

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

    cout<<  max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<< endl;
    return 0;
}

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

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

Measured memory_bytes: 1156
n=int(input())
a=sorted(list(map(int,input().split())))
if n%3==0:
  d={}
  for ai in a:
    if ai not in d:
      d[ai]=a.count(ai)
      if len(d)==4:
        break
  sa=list(set(a))
  if len(sa)==3 and sa[0]^sa[1]==sa[2] and d[sa[0]]==d[sa[1]] and d[sa[0]]==d[sa[2]]:
    print('Yes')
    exit()
  if len(sa)==2 and 0 in d and 2*d[0]==max(d[sa[0]],d[sa[1]]):
    print('Yes')
    exit()

if n == a.count(0):
  print('Yes')
  exit()

print('No')

Measured memory_bytes: 14116
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

struct edge {
    int to, cost;
    edge(){}
    edge(int _to, int _cost) : to(_to), cost(_cost) {}
};
const int INF = 1e15;
typedef vector<vector<edge>> Graph;
int dijkstra(const Graph& G, int s, int g) {
    int N = G.size();
    priority_queue<Pii, vector<Pii>, greater<Pii>> pq;   // cost, vertex
    V d(N, INF);
    d[s] = 0;
    pq.push(make_pair(0, s));

    while (!pq.empty()) {
        auto p = pq.top(); pq.pop();
        int v = p.second;
        if (v == g) break;
        if (d[v] < p.first) continue;
        for (const auto& e : G[v]) {
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                pq.push(make_pair(d[e.to], e.to));
            }
        }
    }
    return d[g];
}

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

    int n, m, s, g1, g2;
    while (cin >> n >> m >> s >> g1 >> g2, n) {
        s--, g1--, g2--;
        Graph G(n);
        rep(i, m) {
            int a, b, c;
            cin >> a >> b >> c;
            a--, b--;
            G[a].emplace_back(b, c);    // directed
        }

        int ans = INF;
        rep(i, n) {
            ans = min(ans, dijkstra(G, s, i) + dijkstra(G, i, g1) + dijkstra(G, i, g2));
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3212
#include <iostream>


using namespace std;

int main()
{
    int n,x,l,n1=0,sum=0;

    cin>>n>>x;
    if(sum<=x){
        n1++;
    }


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

        cin>>l;
        sum = sum + l;
        if(sum<=x){
        n1++;
        }

    }

    cout<<n1;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n;

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

    #ifdef Local
        freopen("../IO/int.txt","r",stdin);
        freopen("../IO/out.txt","w",stdout);
    #endif
    int k;
    cin>>n>>k;

    if(500*n >= k) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

Measured memory_bytes: 256
def solve(A,n,s):
    ans = 0

    V = [False for i in range(n)] # 値が交換済みかどうか
    B = sorted(A)
    T = [None for i in range(10001)]
    for i in range(n):
        T[B[i]] = i
    for i in range(n):
        if V[i]: continue
        cur = i #カーソル
        S = 0 #サークル内の数字の総和
        m = 10000 # VMAX
        an = 0 # サークルに含まれる数字の個数
        while True: #サークル内の処理
            V[cur] = True
            an += 1
            v = A[cur]
            m = min(m,v) #mがサークル内の最小の数字
            S += v
            cur = T[v]
            if V[cur]: break
        ans += min(S+(an-2)*m, m+S+(an+1)*s)
    return ans

n = int(input())
A = [int(x) for x in input().split()]
s = min(A)

ans = solve(A,n,s)
print(ans)


Measured memory_bytes: 5780
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<ctype.h>

typedef long long ll;

ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll max(ll a, ll b) { return (a > b) ? a : b; }

ll min(ll a, ll b) { return (a < b) ? a : b; }

ll asc(const void* a, const void* b) { return *(ll*)a - *(ll*)b; }

ll dsc(const void* a, const void* b) { return *(ll*)b - *(ll*)a; }

bool flag;

ll f(ll x,ll y) {
	if (x == -1) return -1;
	else return x / y;
}

int main() {
	ll n,a, b;
	scanf("%lld%lld%lld", &a,&b,&n);
	printf("%lld", f(b,n)-f(a-1,n));
	
	return 0;
}

Measured memory_bytes: 2128
from collections import defaultdict
from itertools import combinations

n=int(input())
s=[input() for i in range(n)]
name=['M','A','R','C','H']

cnt=defaultdict(lambda:0)
for i in range(n):
    if s[i][0] in name:
        cnt[s[i][0]]+=1

cnt=cnt.values()
if len(cnt)<3:
    print(0)
    exit()
ans=0

# listから２つ選ぶ組み合わせ
for x,y,z in combinations(cnt,3):
    ans+=x*y*z

print(ans)


Measured memory_bytes: 10112
#include <iostream>
#include <algorithm>
using namespace std;
static const int N = 100;
int main(){
  int n,k,cnt,c[N],i,j,l,m,bcmax,acmax,x;
  while(1){
    cin >> n >> k;
    if(n==0&&k==0) break;
    for(i=0;i<n;i++){
      cin >> c[i];
    }
    bcmax=0;
    for(i=0;i<=n-k;i++){
      cnt=k;
      x=1;
      j=i;
      while(cnt){
	x*=c[j];
	j++;
	cnt--;
      }
      bcmax=max(bcmax,x);
    }
    acmax=0;
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	if(i!=j){
	  swap(c[i],c[j]);
	  for(l=0;l<=n-k;l++){
	    cnt=k;
	    x=1;
	    m=l;
	    while(cnt){
	      x*=c[m];
	      m++;
	      cnt--;
	    }
	    acmax=max(acmax,x);
	  }
	  swap(c[i],c[j]);
	}
      }
    }
    if(acmax-bcmax>=0) cout << acmax-bcmax << endl;
    else cout << "NO GAME" << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

int cost[310][310][310];
int dp[310][310][310];
int M = 310;

int H, W;
vector<string> blk;
const int INF = 1e9;

int main() {
	cin >> H >> W;
	blk.resize(H);
	rep(i,H) cin >> blk[i];
	rep(i,W-1) {
		rrep(j,H) {
			rrep(k,H) {
				cost[i][j][k] = cost[i][j+1][k+1] + (blk[H-(j+1)][i] == blk[H-(k+1)][i+1] ? 1 : 0);
			}
		}
	}
	rep(i,W-1) {
		rep(j,H+1) {
			rep(k,H+1) {
				if(j == 0 && k == 0) continue;
				dp[i][j][k] = min(j == 0 ? INF : (dp[i][j-1][k] + cost[i][j-1][k]),
						k == 0 ? INF : (dp[i][j][k-1] + cost[i][j][k-1]));
			}
		}
	}
	int res = 0;
	rep(i,W-1)
		res += dp[i][H][H];
	cout << res << endl;
	return 0;
}


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

void fnInput(vector<int> &a_rvoTarget, vector<int> &a_rvoSearch)
{
  int iTargetCnt;
  cin >> iTargetCnt;

  a_rvoTarget.resize(iTargetCnt + 1);
  for (int i = 0; i < iTargetCnt; i++)
    cin >> a_rvoTarget[i];

  int iSearchCnt;
  cin >> iSearchCnt;

  a_rvoSearch.resize(iSearchCnt);
  for (int i = 0; i < iSearchCnt; i++)
    cin >> a_rvoSearch[i];
}

void fnLinearSearch(vector<int> &a_rvoTarget, const vector<int> &a_cnrvoSearch, int &a_riFound)
{
  size_t iMaxSize = a_rvoTarget.size() - 1;
  for (auto itvoSearch = begin(a_cnrvoSearch); itvoSearch != end(a_cnrvoSearch); itvoSearch++)
  {
    a_rvoTarget[iMaxSize] = *itvoSearch;
    auto itvoTarget = begin(a_rvoTarget);
    while (*itvoSearch != *itvoTarget)
      itvoTarget++;
    if (distance(begin(a_rvoTarget), itvoTarget) != iMaxSize)
      a_riFound++;
  }
}

void fnResultOut(int a_iFound)
{
  cout << a_iFound << endl;
}

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

  vector<int> voTarget, voSearch;
  int iFound = 0;

  fnInput(voTarget, voSearch);
  fnLinearSearch(voTarget, voSearch, iFound);
  fnResultOut(iFound);

  return 0;
}

Measured memory_bytes: 1240
#include <stdio.h>
#include <math.h>

void call(int n);
void check_num(int x, int i, int n);
void include3(int x, int i, int n);
void end_check_num(int x, int i, int n);


int main(void){
	int a;
	scanf("%d", &a);
	call(a);
	return 0;
}

void call(int n){
	int i = 1;
	int x;
	check_num(x, i, n);
	/*
	while(1){
		x = i;
		if( x % 3 == 0 ){
			printf(" %d", i);
		}else if( x % 10 == 3 ){
			printf(" %d", i);
		}else{
			x /= 10;
		}
		
	}
	*/
}

void check_num(int x, int i, int n){
	x = i;
	if( x % 3 == 0){
		printf(" %d", i);
		end_check_num(x, i, n);
	}else{
		include3(x, i, n);
	}
}

void include3(int x, int i, int n){
	if( x % 10 == 3){
		printf(" %d", i);
		end_check_num(x, i, n);
	}else{
		x /= 10;
		if(x){
			include3(x, i, n);
		}else{
			end_check_num(x, i, n);
		}
	}
}

void end_check_num(int x, int i, int n){
	if( ++i <= n){
		check_num(x, i, n);
	}else{
		printf("\n");
	}
}
	

Measured memory_bytes: 600
//dont try to understand my code i really dont understand it 
#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
#include<set>
#include <map>
#include<vector>
#include <queue>
#include <stack>
#include<algorithm>
#include<memory.h>
using namespace std;
typedef long long ll;
#define f( i , x , n ) for(int i = x; i < (int)(n); ++i)
#define pb push_back
#define mp make_pair
#define mt make_tuple
typedef pair<int, int> ii;
const double PI = acos(-1.0);
//const ll oo = 1000000000000030200;
//const ll F = LLONG_MIN;	
const int A = 1234567;
typedef long long ll;
// write what you need here : ... 
queue<pair<int,int>>q;
vector<int> arr[200021];
bool vis[200032];
int main()
{
	int a, b;
	cin >> a >> b;
	for (int i = 0;i < b;i++)
	{
		int temp, temp1; 
		cin >> temp >> temp1;
		arr[temp].push_back(temp1);
	}

	int count = 3;
	int here = 1;
	
	
	q.push(mp(1,0));

	while (!q.empty())
	{
		
		int x = q.front().first;
		int y = q.front().second;
		q.pop();
		if (x == a)
		{
			cout << "POSSIBLE";return 0;
		}
		for (int el : arr[x])
		{
			if (!vis[el] && y != 2) {
				q.push(mp(el, y + 1));
				vis[el] = true;
			}
		}
		
	}

	cout << "IMPOSSIBLE";
	return 0;
}

Measured memory_bytes: 9464
import math
a, b = map(int, input().split())

if 12.5 * (a + 1) <= b * 10:
  print("-1")
elif b * 10 + 9 < 12.5 * a:
  print("-1")
else:
  print(max(math.ceil(12.5 * a), 10 * b))

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	if ( a < b )
		cout << "a < b" << '\n';
    else if ( a > b )
		cout << "a > b" << '\n';
	else if ( a == b )
		cout << "a == b" << '\n';
	return 0;
}

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

void solve(int n, int k, vector<int>&a){
    
    int needed = (log(n) + 1.0)/log(1.34);
    needed = min(needed, k);

    for(int kk = 0; kk < needed; kk++){
        vector<int>B(n, 0);
        //int done = false;
        for(int i = 0; i < n; i++){
            int l = max(0, i - a[i]);
            int r = min(n - 1, i + a[i]);
            //cout << l << " " << r << endl; 
            B[l]++;
            if(r + 1 < n){
                B[r+1]--;
            }
        }
        for(int i = 1; i < n; i++){
            B[i] += B[i-1];
        }
        //int current_cnt = 0;
        //for(int i = 0; i < n; i++){
            //if(B[i] == n){
                //current_cnt += 1;
            //}
            //if(current_cnt == n){
                //done = true;
            //}
        //}
        a = B;
        //if(done){
            //break;
        //}else{
            //cnt += 1;
        //}
    }
    for(int i = 0; i < n; i++){
        cout << a[i] << " ";
    }cout << endl;
}



int main(){
    
    int n, k;
    cin >> n >> k;
    vector<int>a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    solve(n, k, a);
    //cout << solve(n, k, a) << endl;
    
}


Measured memory_bytes: 5080
IDENTIFICATION DIVISION.
       PROGRAM-ID. ATCODER.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  indata PIC X(100).
       01  a1 PIC S9(08).
       01  a2 PIC S9(08).
       01  a3 PIC S9(08).
       01  r1 PIC S9(08).
       01  r2 PIC S9(08).
       01  r3 PIC S9(08).
       01  r pic S9(08).
       01 disp pic Z(20)9.
       PROCEDURE DIVISION.
        ACCEPT indata.
        UNSTRING indata DELIMITED BY SPACE INTO a1 a2.
        compute r = 0

        if a1 > a2 then
         compute r = r + a1
         compute a1 = a1 - 1
        ELSE
         compute r = r + a2
         compute a2 = a2 - 1
        END-if

        if a1 > a2 then
         compute r = r + a1
         compute a1 = a1 - 1
        ELSE
         compute r = r + a2
         compute a2 = a2 - 1
        END-if



        MOVE FUNCTION TRIM(r) to disp
        DISPLAY disp

       STOP RUN.


Measured memory_bytes: 384
using System;

public class Program {
    public static void Main() {
        int data = int.Parse(Console.ReadLine());
        int hours = data / 3600,
            minutes = (data % 3600) / 60,
            seconds = (data % 3600) % 60;
        Console.WriteLine($"{hours}:{minutes}:{seconds}");
    }
}


Measured memory_bytes: 19888
//I have to work harder than anyone else to make it! I’ll never catch up otherwise…
//Don’t worry about what other people think. Hold your head up high and plunge forward.

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

#define P pair<int,int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define str std::string 
#define pb push_back
#define itrt(yo) for(auto x:yo){std::cout<<x<<nl;} 
#define vec(x) std::vector<x> 
#define nl '\n'
#define F first
#define S second
#define ll long long int
#define ALL(x) x.begin(),x.end() 
#define BN(x) x.begin()
#define ED(x) x.end()
#define MAP_traverse(it,x)  for(auto it = BN(x); it!= ED(x); it++)
#define PI 3.14159265358979323846264338327950L
const unsigned int M = 1000000007;




int main()
{
	ll d,n;
	cin>>d>>n;

	if (n==100)
	{
		ll ans = pow(100,d)*n + pow(100,d);
		cout<<ans;
	}else
	{
		ll ans = pow(100,d)*n;
	cout<<ans;
	
	}
	
	
	
	
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int N,M;
int POW[13];
int A[1005],num[1005];
int table[1005][13];
int dp[1 << 14];


int main(){

	POW[0] = 1;
	for(int i = 1; i < 13; i++){

		POW[i] = POW[i-1]*2;
	}

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

	dp[0] = 0;
	for(int state = 1; state < POW[N]; state++){

		dp[state] = BIG_NUM;
	}

	for(int i = 0; i < M; i++){

		scanf("%d %d",&A[i],&num[i]);

		int tmp = 0;

		for(int k = 0; k < num[i]; k++){

			scanf("%d",&table[i][k]);
			tmp += POW[table[i][k]-1];
		}

		dp[tmp] = min(dp[tmp],A[i]);
	}

	for(int state = 0; state < POW[N]-1; state++){
		if(dp[state] == BIG_NUM)continue;
		for(int adj_state = 1; adj_state < POW[N]; adj_state++){
			if(dp[adj_state] == BIG_NUM)continue;

			int next_state = state|adj_state;
			if(next_state == state || next_state == adj_state)continue;

			int next_cost = dp[state]+dp[adj_state];

			dp[next_state] = min(dp[next_state],next_cost);
		}
	}

	if(dp[POW[N]-1] == BIG_NUM){

		printf("-1\n");

	}else{

		printf("%d\n",dp[POW[N]-1]);
	}

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}
int main(){
  int n,k; cin >> n >> k;
  vl h(n);
  rep(i, n) cin >> h[i];
  sort(all(h));
  reverse(all(h));
  ll ans = 0;
  for(int i = k; i < n; i++) {
    ans += h[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;
struct BellmanFord {
    struct Edge {
        int from, to; LL cost;
        Edge() {}
        Edge(int from, int to, LL cost): from(from), to(to), cost(cost) {}
    };
    const LL INF = (1LL << 60);
    int n;
    vector<vector<int>> graph;
    vector<int> used, reach;
    vector<LL> dist;
    BellmanFord(int n): n(n), graph(n), used(n, 0), reach(n, 0), dist(n, INF) {}

    vector<Edge> edges;
    void add_edge(int from, int to, LL cost) {
        edges.push_back(Edge(from, to, cost));
        graph[from].push_back(to);
    }
    bool bfs(int s, int pre) {
        if (s == n - 1) return true;

        for (auto e : graph[s]) {
            if (e != pre and bfs(e, s)) return true;
        }
        return false;
    }
    void build(int s, bool &neg_loop) {
        neg_loop = false;
        dist[s] = 0;
        rep(i, n * 2) {
            for (auto e : edges) {
                if (dist[e.from] != INF and dist[e.from] + e.cost < dist[e.to]) {
                    dist[e.to] = dist[e.from] + e.cost;

                    if (i >= n - 1 and e.to == n - 1) {
                        neg_loop = true;

                    }
                }
            }
        }
    }
};
int main() {
    int n, m; cin >> n >> m;
    BellmanFord bf(n);
    rep(i, m) {
        int a, b; LL c; cin >> a >> b >> c;
        --a; --b;
        bf.add_edge(a, b, -c);
        // bf.add_edge(b, a, -c);
    }

    bool neg_loop;
    bf.build(0, neg_loop);
    if (neg_loop) {
        cout << "inf" << endl;
    } else {
        cout << -bf.dist[n - 1] << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
// #include "ane.cpp"

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 100005;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> lp;
typedef pair<ll, ll> llp;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A[NMAX],B[NMAX],C[NMAX],D[NMAX],E;
int dp[NMAX] = {};

string S;
vec v;

ll ans = 0;

void solve(){
  // main algorithm
  for (int i = 0; i < N; ++i)
  {
    ll cand = INFLL; int candi = 0;
    for (int j = 0; j < M; ++j)
    {
      if (cand > abs(A[i] - C[j]) + abs(B[i] - D[j]))
      {
        cand = abs(A[i] - C[j]) + abs(B[i] - D[j]);
        candi = j+1;
      }
    }
    cout << candi << endl;
  }

}
void debug(){
  // output debug information

}
void answer(){
  // output answer
  // cout << ans << endl;
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  cin >> N >> M;
  for (int i = 0; i < N; ++i)
  {
    cin >> A[i] >> B[i];
  }
  for (int i = 0; i < M; ++i)
  {
    cin >> C[i] >> D[i];
  }
  solve();
  #ifdef DEBUG
  debug();
  #endif
  // answer();

  return 0;
}

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

bool isprime[100001];
vector<int> prime;

void init()
{	int N=100001;
	isprime[0]=false;
	isprime[1]=false;
	int SPF[100001];
	for (long long int i=2; i<N ; i++) 
    {  
        if (isprime[i]) 
        { 
            prime.push_back(i); 
  
            // A prime number is its own smallest 
            // prime factor 
            SPF[i] = i; 
        } 
 
        for (long long int j=0; 
             j < (int)prime.size() && 
             i*prime[j] < N && prime[j] <= SPF[i]; 
             j++) 
        { 
            isprime[i*prime[j]]=false; 
  
            // put smallest prime factor of i*prime[j] 
            SPF[i*prime[j]] = prime[j] ; 
        } 
    } 
}


int main(){
	int n,i;
	cin>>n;
	for(i=0;i<100001;i++)
		isprime[i]=true;
	init();
	for(i=n;i<100001;i++)
	{
		if(isprime[i])
			break;
	}
	if(i==100001)
		cout<<"100003"<<endl;
	else
		cout<<i<<endl;
}

Measured memory_bytes: 896
#include <stdio.h>
int main(){
	int a,b,k;
	scanf("%d%d%d",&a,&b,&k);
	if(2*k>(b-a+1)){
	for(int i=a;i<=b;i++)
	  printf("%d\n",i);
      }
      else {
	  for(int i = a;i<=a+k-1;i++)
        printf("%d\n",i);
        for(int i=b-k+1;i<=b;i++)
        printf("%d\n",i);
		}
	  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;


//void warshall_floyd(int n){
//    for(int k=0;k<n;k++){
//        for(int i=0;i<n;i++){
//            for(int j=0;j<n;j++){
//                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
//            }
//        }
//    }
//}
//ll calc_digit(ll N) {
//    ll res = 0;
//    while (N) {
//        ++res;
//        N /= 10;
//    }
//    return res;
//}
//ll sum_digit(ll N) {
//    ll res = 0;
//    while (N) {
//        res += N % 10;
//        N /= 10;
//    }
//    return res;
//}
vector<vector<int>>v;
int n,m;
int ans = 0;
stack<int> s;
void dfs(int d,vector<bool> b,int next){
    b[next] = true;
    d++;
    if(d == n-1) {
        ans++;
    }else{
        for(int i = 0;i < v[next].size();i++){
            if(!b[v[next][i]]){
               dfs(d,b,v[next][i]);
            }
        }
    }
}

int main(){
    cin >> n >> m;
    int depth = 0;
    v.assign(n,vector<int>());
    vector<bool> b;b.assign(n,false);
    for(int i = 0;i < m;i++){
        int x,y; cin >> x >> y;x--;y--;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for(int i = 0;i < v[0].size();i++){
        s.push(v[0][i]);
    }
    int next = 0;
    b[0] = true;
    for(int i = 0;i < v[0].size();i++){
        dfs(depth,b,v[0][i]);
    }
    cout << ans;
}



Measured memory_bytes: 3640
#include <stdio.h>

int main()
{
    int a;
    int b;
    int x;
    int all_1000;
    int all_500;
    int and_1000_500;
    int ans;
    
    scanf("%d%d%d", &a, &b, &x);
    
    all_1000 = a * (x / 1000 + (x % 1000 == 0 ? 0:1));
    all_500 = b * (x / 500 + (x % 500 == 0 ? 0:1));
    and_1000_500 = a * (x / 1000) + b * (x % 1000 / 500 + (x % 1000 % 500 == 0 ? 0:1));

    if(all_1000 <= all_500)
    {
       if(all_1000 <= and_1000_500)
       {
           ans = all_1000;
       }
    }
    else
    {
        if(all_500 <= and_1000_500)
        {
            ans = all_500;
        }
        else
        {
            ans = and_1000_500;
        }
    }
    
    printf("%d\n", ans);
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    for(int i=0;i<w+2;i++){
        cout<<"#";
    }
    cout<<endl;
    for(int i=0;i<h;i++){
        cout<<"#";
        string s;
        cin>>s;
        cout<<s;
        cout<<"#"<<endl;
    }
    for(int i=0;i<w+2;i++){
        cout<<"#";
    }
    cout<<endl;
    
}
        

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int ans = min(b,d) - max(a,c);
    if(ans > 0)
    {
        cout << ans;
    }
    else
    {
        cout << "0";
    }
    
    return 0;
}

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

int w, h, tx, ty, d;
int dx[] = {0,0,1,-1};
int dy[] = {-1,1,0,0};
char dir[256];
string f[21];

void solve(string s){
	for(int j=0 ; j < (int)s.size() ; j++ ){
		char c = s[j];
		if( c == 'S' ){
			int sx = tx;
			int sy = ty;
			for(;;){
				int mx = sx + dx[ dir[d] ];
				int my = sy + dy[ dir[d] ];
				if( mx < 0 || my < 0 || mx >= w || my >= h ){
					break;
				}else if( f[my][mx] == '.' || f[my][mx] == '-' ){
					sx = mx;
					sy = my;
				}else if( f[my][mx] == '*' ){
					f[my][mx] = '.';
					break;
				}else if( f[my][mx] == '#' ){
					break;
				}
			}
		}else{
			d = dir[c];
			int mx = tx + dx[ dir[d] ];
			int my = ty + dy[ dir[d] ];
			if( mx < 0 || my < 0 || mx >= w || my >= h ){
				continue;
			}else if( f[my][mx] == '.' ){
				tx = mx;
				ty = my;
			}
		}
	}
}

int main(){
	int t, n;
	string s;
	
	dir['U'] = '^';
	dir['D'] = 'v';
	dir['R'] = '>';
	dir['L'] = '<';
	dir['^'] = 0;
	dir['v'] = 1;
	dir['>'] = 2;
	dir['<'] = 3;
	
	cin >> t;
	for(int i=0 ; i < t ; i++ ){
		cin >> h >> w;
		for(int y=0 ; y < h ; y++ ){
			cin >> f[y];
			for(int x=0 ; x < w ; x++ ){
				char c = f[y][x];
				if( c == '>' || c == '<' || c == '^' || c == 'v' ){
					tx = x;
					ty = y;
					d = c;
					f[y][x] = '.';
				}
			}
		}
		cin >> n >> s;
		solve( s );
		f[ty][tx] = d;
		for(int y=0 ; y < h ; y++ ){
			cout << f[y] << endl;
		}
		if( i != t-1 ) cout << endl;
	}
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;

public class Main {
	static ArrayList<ArrayList<Integer>> edges = new ArrayList<>();
	static long nodes[];

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int q = Integer.parseInt(str[1]);

		nodes = new long[n];
		for (int i = 0; i < n; i++) {
			edges.add(new ArrayList<>());
		}

		for (int i = 0; i < n - 1; i++) {
			str = br.readLine().split(" ");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			edges.get(a).add(b);
			edges.get(b).add(a);
		}

		for (int i = 0; i < q; i++) {
			str = br.readLine().split(" ");
			int index = Integer.parseInt(str[0]) - 1;
			int add = Integer.parseInt(str[1]);

			nodes[index] += add;
		}
		dfs(n, 0);
		System.out.print(nodes[0]);
		for (int i = 1; i < nodes.length; i++) {
			System.out.print(" " + nodes[i]);
		}
		System.out.print("\n");
	}

	static void dfs(int n, int s) {
		boolean[] used = new boolean[n];
		Deque<Integer> q = new ArrayDeque<>();
		q.offerFirst(0);
		used[0] = true;
		while (q.size() != 0) {
			int now = q.removeLast();
			for (int next : edges.get(now)) {
				if (!used[next]) {
					nodes[next] += nodes[now];
					q.offerFirst(next);
					used[next] = true;
				}
			}
		}
	}
}


Measured memory_bytes: 118244
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr)

const int N = 2e6 + 5;
const int M = 1e9 + 7;


int mod(int m){
   m%=M;
   return (m+M)%M;
}

int power(int x,int y) {
   int res = 1;
   x = mod(x);
   while (y > 0) {
      if (y & 1)
         res =mod(res*x);
      y = y>>1;
      x = mod(x*x);
   }
   return mod(res);
}

int f[N],invf[N];
void fact(){
   f[0]=f[1]=1;
   for(int i=2;i<N;i++)
      f[i]=mod(f[i-1]*i);

   invf[N-1]=power(f[N-1],M-2);
   for(int i=N-1;i>0;i--)
      invf[i-1]=mod(invf[i]*i);

}

int nCr(int n,int r) {
   if(r>n)
      return 0;
   int ans = f[n];
   ans = mod(ans*invf[n-r]);
   ans = mod(ans*invf[r]);
   return ans;
}

int nPr(int n,int r) {
   if(r>n)
      return 0;
   int ans = f[n];
   ans = mod(ans*invf[n-r]);
   return ans;
}

int32_t main(){
	fact();
	boost;
	int k;
	cin>>k;
	string s;
	cin>>s;
	int m = s.size();
	int n = m + k;
	int ans = 0;
   for(int i=m;i<=n;i++)
   ans = mod(ans + mod(mod(nCr(i-1,m-1)*power(25,i-m))*power(26,n-i)));
	cout<<ans<<endl; 
}


Measured memory_bytes: 35476
import itertools

n,k = map(int,input().split())
ans =0
a = []
for i in range(k):
    d=int(input())
    a.append(list(map(int,input().split())))

a = [ flatten for inner in a for flatten in inner ]

for j in range(n):
   if a.count(j+1)==0:
       ans +=1

print(ans)

Measured memory_bytes: 9364
package main

import "fmt"

func main() {
	var n int
	var a int

	fmt.Scan(&n)
	fmt.Scan(&a)

	x := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x[i])
	}

	fmt.Println(solve(a, n, x))
}

func solve(a int, n int, x []int) uint64 {
	dp := make([][]map[int]uint64, n+1)
	for i := 0; i <= n; i++ {
		dp[i] = make([]map[int]uint64, i+1)
		for j := 0; j <= i; j++ {
			dp[i][j] = make(map[int]uint64)
		}
	}

	dp[0][0][0] = 1

	for i := 0; i < n; i++ {
		for j := 0; j <= i; j++ {
			for k, v := range dp[i][j] {
				dp[i+1][j][k] += v
				dp[i+1][j+1][k+x[i]] += v
			}
		}
	}

	r := uint64(0)
	for i := 1; i <= n; i++ {
		r += dp[n][i][a*i]
	}

	return r
}


Measured memory_bytes: 17920
H,W=map(int,input().split())
P=[input() for _ in range(H)]

red=[['.' for x in range(W)]for y in range(H)]
blue=[['.' for x in range(W)]for y in range(H)]

for i in range(H):
  red[i][0]='#'
  blue[i][W-1]='#'
  for j in range(1,W-1):
    if i%2==0:
      red[i][j]='#'
    else:
      blue[i][j]='#'

for i in range(1,H-1):
  for j in range(1,W-1):
    if P[i][j]=='#':
      red[i][j]='#'
      blue[i][j]='#'
      
for i in range(H):
  print(''.join(red[i]))
print("")
for i in range(H):
  print(''.join(blue[i]))

Measured memory_bytes: 9460
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#define pb push_back
using namespace std;
typedef pair<int,int> pii;

int main(){
  string st;
  int k;
  cin>>st;
  cin>>k;


  for(int i=0;i<k;i++){
    if(st[i]!='1'){
      cout<<st[i]<<endl;
      return 0;
    }
  }
  cout<<1<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;


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

	// long long?
	int N;
	string S;
	cin >> N >> S;

	int ans = 0;
	for (int i = 0; i != N - 1; ++i) {
		set<char> schar;
		for (int j = 0; j != i; ++j) {
			for (int k = i; k != N; ++k) {
				if (S[j] == S[k]) schar.insert(S[j]);
			}
		}
		ans = max(ans, (int)schar.size());
	}

	cout << ans << endl;


	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++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000

ll powe(ll a, ll b){//aのb乗のmod
    ll ret = 1;
    while(0 < b){
        if((b%2) == 0){
            a = (a*a)%MOD;
            b >>= 1;
        }
        else{
            ret = (ret*a)%MOD;
            b--;
        }
    }
    return ret;
}

int main(){
    ll n; ll a, b, gcdab; cin >> n;
    ll bothz = 0; ll az = 0; ll bz = 0;
    vector<vector<ll>> as;
    REP(i,n){
        cin >> a >> b;
        if (a==0&&b==0){
            bothz++;
        }
        else if (a==0){
            az++;
        }
        else if (b==0){
            bz++;
        }
        else{
            gcdab = __gcd(a,b);
            a/=gcdab;
            b/=gcdab;
            if ((a<0&&b<0)||(a<0&&b>0)){
                a=-a;
                b=-b;
            }
            as.pb({a,b});
        }
    }
    sort(as.begin(),as.end());
    ll pp = as.size();
    ll ans = 1;
    ll i = 0;
    ll cnt = 0;
    vector<ll> reached(as.size(),0);
    vector<ll> bs;
    vector<ll> cs;
    REP(i,as.size()){
        bs.pb(as[i][0]);
        cs.pb(as[i][1]);
    }
    while (i<pp){
        if (reached[i]==0){
            cnt++;
            if (as[i]==as[i+1]){
                i++;
            }
            else{
                ll seb, sec;
                if (bs[i]>0&&cs[i]>0){
                    seb = cs[i];
                    sec = -bs[i];
                }
                else{
                    seb = -cs[i];
                    sec = bs[i];
                }
                ll ind1 = lower_bound(bs.begin(),bs.end(),seb)-bs.begin();
                ll ind2 = upper_bound(bs.begin(),bs.end(),seb)-bs.begin();
                ll ind3 = lower_bound(cs.begin()+ind1,cs.begin()+ind2,sec)-cs.begin();
                ll ind4 = upper_bound(cs.begin()+ind1,cs.begin()+ind2,sec)-cs.begin();
                for(ll j=ind3;j<ind4;j++) reached[j]=1;
                ans = (ans*((powe(2,cnt)+powe(2,ind4-ind3)+MOD-1)%MOD))%MOD;
                i++;
                cnt=0;
            }
        }
        else{
            i++;
        }
    }
    ans=(ans*((powe(2,az)+powe(2,bz)+MOD-1)%MOD))%MOD;
    ans=(ans+bothz+MOD-1)%MOD;
    cout << ans << endl;
}

Measured memory_bytes: 20696
/* ex 3_2
  kt125 */

#include <stdio.h>

int main(void) {
  int n;
  scanf("%d", &n);
  
  switch(n % 10){ // nの一の位
    case 2: case 4: case 5: case 7: case 9:
      printf("hon\n"); break;
    case 0: case 1: case 6: case 8:
      printf("pon\n"); break;
    case 3:
      printf("bon\n"); break;
  }
  return 0;
}



Measured memory_bytes: 1620
#include<iostream>
#include<string>
#include<iomanip>
#include<stdio.h>
#include<sstream>
#include<cmath>
#include<typeinfo>
#include<cstdlib>

using namespace std;

int main(void){
	long N,K;
	long a[100010];
	long l;
	long count = 0;
	string s;

	cin >> N >> K;
	for(int i =0; i < N; i++){
		cin >> a[i];
		if(a[i] == 1){
			l = i;
		}
	}

	int tmp = 0;
	while(N - 1 > tmp){
		tmp += (K - 1);
		count++;
	}
	
	cout << count << endl;
	
	
	return 0;
}

Measured memory_bytes: 1024
s = input()
m = [1] * len(s)
ns = []
ss = 0
for i in range(len(s)-1):
    if s[i:i+2] == 'LR':
        ns.append(s[ss:i+1])
        ss = i+1
ns.append(s[ss:])
m = []
for nsi in ns:
    l = len(nsi)
    mi = [0] * l
    for j in range(l):
        if nsi[j:j+2] == 'RL':
            r = j
            break
    mi[r] = l // 2
    mi[r+1] = l // 2
    if l % 2 == 1:
        mi[r + r % 2] += 1
    m += mi
ans = ''
for mi in m:
    ans += str(mi) + ' ' 
print(ans[:-1])

Measured memory_bytes: 7820
/* ヘッダインクルード */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

//#define DEBUG
#ifdef DEBUG  
#define     debug_print(fmt, ...)\
                                do{\
                                    printf("line:%d func:%s, ", __LINE__, __func__);\
                                    printf(fmt, ##__VA_ARGS__);\
                                }while(0)
#else
#define     debug_print(fmt, ...)
#endif

#define BUF_MAX             101

/* プロトタイプ宣言 */
int Even_NumCulc(int n, int m);

int main(void)
{
    int n = 0;
    int m = 0;
    char buf[BUF_MAX];
    int ans = 0;
    
    /* 初期化 */
    memset(buf, 0x00, sizeof(buf));
    
    /* Input */
    fgets(buf, sizeof(buf), stdin);
    sscanf(buf, "%d %d", &n, &m);
    
    ans = Even_NumCulc(n, m);
    
    printf("%d", ans);
    
    return 0;
}

int Even_NumCulc(int n, int m)
{
    int ptn = 0;
    
    ptn = (n * (n - 1 ) / 2) + (m * (m -1) / 2);
    
    return ptn;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int n,m,ans;
        
        n = sc.nextInt();
        m = sc.nextInt();
        
        
        ans = ((n + m) * (n + m - 1)) / 2 - (n * m);
        
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k;
    cin >> k;
    if(k % 2 == 0){
        cout << "-1";
        return 0;
    }
    if(k % 5 == 0){
        cout << "-1";
        return 0;
    }
    int p = 0, c = 0;
    while(1 == 1){
        c++;
        p = (p * 10 + 7) % k;
        if(p == 0){
            break;
        }
    }
    cout << c;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y") {
      cout << "Four" << endl;
      break;
    }
    if (i == N - 1) {
      cout << "Three" << endl;
    } 
  }
  
}


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

using namespace std;
typedef long long ll;
const ll INF_=0xcfcfcfcfcfcfcfcf;
vector<vector<ll>> dp;
int main()
{
    int n,w;
    cin >> n >> w;
    dp.resize(n+1,vector<ll>(w*2,INT_MIN));
    dp[0][0]=0;
    for (int i=0;i<n;i++)
    {
        int x,y;
        cin >> x >> y;
        for (int j=0;j<=w;j++)
        {
            dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
            dp[i+1][j+x]=max(dp[i][j]+y,dp[i+1][j+x]);
        }
    }
    /* for (int i = 0; i <= n; i++, puts(""))
        for (int j = 0; j <= w; cout << dp[i][j++] << ' ')
            ;  */
    cout << *max_element(dp[n].begin(),dp[n].begin()+w+1) << endl;
    return 0;
}

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

int main() {
  string a, b, c; cin >> a >> b >> c;
  
  if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
} 

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

typedef long long ll;

void printArray(vector<int> arr) {
	for (int a: arr) cout << a << " ";
	cout << '\n';
}

int swim[2];
int bugs[2];
int homework[2];

int a[100001];
int b[100001];
int c[100001];

int main() {
	std::ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i =0; i<n; i++) cin >> a[i] >> b[i] >> c[i];
	swim[1] = a[0];
	bugs[1] = b[0];
	homework[1] = c[0];
	
	for (int i =1; i<n; i++) {
		swim[0] = swim[1];
		bugs[0] = bugs[1];
		homework[0] = homework[1];
		
		swim[1] = max(bugs[0], homework[0]) + a[i];
		bugs[1] = max(swim[0], homework[0]) + b[i];
		homework[1] = max(swim[0], bugs[0]) + c[i];
	}
	
	cout << max({swim[1], bugs[1], homework[1]}) << '\n';
}



Measured memory_bytes: 4752