akhauriyash/Code-Regression huggingface dataset:
/*Tax Increase*/
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    
    double a, b;
    
    cin >> a >> b;
    
    long long izq = 1ll;
    long long der = LLONG_MAX;
    double middle;
    double limInf;
    double limSup;
    double aux;
    
    
    /*calculamos  el  limite innferior*/ 
    
    while(izq <= der){
        
        middle =  ((double)izq + (double)der) / 2.0;
 
        aux = floor(middle * 0.08);
         
        if( aux >= a){
           der = middle - 1;
           limInf = middle; 
        }
        else{
            izq = middle + 1;
        }
    } 
    
    izq = limInf;
    der = LLONG_MAX;
    
    while(izq <= der){
      
       
        middle =  ((double)izq + (double)der) / 2.0;
        aux = floor(middle * 0.08);
         
        if( aux >= a + 1.0){
           der = middle - 1;
           limSup = middle; 
        }
        else{
            izq = middle + 1;
        }
    
   }
   
    bool can = false;
    
    limSup--;
    
    for(int i = (int)limInf; i <= (int)limSup; i++){
    
     aux = (double)i * 0.1;
     
     if(floor(aux) == b){
        cout << i;
        can = true;
        break;     
     }
   }
    
    if(can == false)
      cout << -1; 
    
    return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
int dx[4] = { 0,  0, 1, -1 };
int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	int n, c; cin >> n >> c;
	vvi d(c, vector<int>(c));
	rep(i, c) {
		rep(j, c) {
			cin >> d[i][j];
		}
	}

	vector<vector<ll>> t(3, vector<ll>(30));
	rep(i, n) {
		rep(j, n) {
			int x; cin >> x; --x;
			rep(k, c) {
				t[(i + j) % 3][k] += d[x][k];
			}
		}
	}
	ll ans = INF;
	rep(i, c) {
		rep(j, c) {
			if (i == j) continue;
			rep(k, c) {
				if (i == k || j == k) continue;
				ans = min(ans, t[0][i] + t[1][j] + t[2][k]);
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//const int MAX=;



int main(){
	int P,Q,R;
	cin>>P>>Q>>R;
	int ans=min(P+Q,Q+R);
	ans=min(ans, R+P);
	cout<<ans<<endl;
}

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

//-----------------------------------LIBRARY OF INPUT-----------------------------------
void reader(int *x) {
	int k = getchar_unlocked(); *x = k - '0';
	while (true) {
		k = getchar_unlocked();
		if (k < '0' || k > '9') break;
		*x = ((*x) << 1) + ((*x) << 3) + k - '0';
	}
}

#pragma warning(disable:4996)
int n, m, q, dist[110000], mark[110000], u[210000], v[210000];
vector<pair<int, int>>x[110000], y[110000], z[110000]; bool used[210000];
inline bool isgood(int f) {
	for (int i = 0; i < z[f].size(); i++) {
		if (mark[z[f][i].first] == 0 && used[z[f][i].second] == false)return true;
	}
	return false;
}
int main() {
	reader(&n); reader(&m); reader(&q); queue<int>Q;
	for (int i = 0; i < m; i++) {
		int a = 0, b = 0;
		reader(&a);
		reader(&b);
		u[i + 1] = a; v[i + 1] = b;
		x[a].push_back(make_pair(b, i + 1)); x[b].push_back(make_pair(a, i + 1));
	}
	Q.push(1); for (int i = 1; i <= n; i++)dist[i] = 999999; dist[1] = 0;
	while (!Q.empty()) {
		int a1 = Q.front(); Q.pop();
		for (int i = 0; i < x[a1].size(); i++) {
			if (dist[x[a1][i].first] > dist[a1] + 1) { dist[x[a1][i].first] = dist[a1] + 1; Q.push(x[a1][i].first); }
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < x[i].size(); j++) {
			if (dist[i] < dist[x[i][j].first]) { y[i].push_back(x[i][j]); }
			if (dist[i] > dist[x[i][j].first]) { z[i].push_back(x[i][j]); }
		}
	}
	int cnt = 0;
	for (int i = 0; i < q; i++) {
		int a = 0;
		reader(&a);
		used[a] = true;
		int E1 = u[a], E2 = v[a];
		if (dist[E1] == dist[E2]) { cnt += 0; }
		else {
			int a1 = 0; if (dist[E1] < dist[E2])a1 = E2; else a1 = E1;
			if (isgood(a1) == false && mark[a1] == 0) {
				queue<int>Q; Q.push(a1); cnt++; mark[a1] = 1;
				while (!Q.empty()) {
					int a2 = Q.front(); Q.pop();
					for (int j = 0; j < y[a2].size(); j++) {
						if (mark[y[a2][j].first] == 0 && isgood(y[a2][j].first) == false) {
							mark[y[a2][j].first] = 1; Q.push(y[a2][j].first); cnt++;
						}
					}
				}
			}
		}
		printf("%d\n", cnt);
	}
	return 0;
}

Measured memory_bytes: 25568
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mem(dp, v) memset(dp, v, sizeof dp);
using namespace std;

const int N = 1e3 + 7, inf = 1e9;
ll ar[N], dp[N][N], n, k, t;

int main()
{
    ll n, k, pw = 1, tot = 0;
   // ios_base::sync_with_stdio(false);
    cin>>n>>k;
    for(int i = 0; i < k; i++)
    {
        cin>>pw;
        tot += pw;
    }
    if(tot >= n) puts("Yes");
    else puts("No");
    return 0;
}


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

using namespace std;

int main(){
    int d,n;
    cin >> d >> n;
    if (d==0) {
        if (n==100) cout << 101 << endl;
        else{
            cout << n << endl;
        }
    }
    else if(d==1){
        if (n==100) cout << 10100 << endl;
        else{
            cout << n*100 << endl;
        }
    }
    else{
        if (n==100) cout << 1010000 << endl;
        else{
            cout << n*10000 << endl;
        }
    }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    l = int(input())

    ll = l
    key = 0
    while ll > 0:
        key += 1
        ll //= 2
    
    ans = []
    for i in range(key-1):
        ans.append((i+1, i+2, 0))
        ans.append((i+1, i+2, pow(2, i)))
    
    l -= pow(2, key-1)
    l = bin(l)[2:]
    sub = pow(2, key-1)
    
    for i in range(len(l)):
        if l[i] == '1':
            ans.append((len(l)-i, key, sub))
            sub += pow(2, len(l)-i-1)
    

    print(key, len(ans))
    for a in ans:
        print(*a)




    
if __name__ == "__main__":
    main()



Measured memory_bytes: 8912
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>=y?x:y)
#define min(x,y) (x<=y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(true)
#define INF 1044266558
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll g[212][202],vis[10],n,x,y,w,m,s;
void init()
{
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=i;j++)
            g[j][i]=g[i][j]=INF;
        g[i][i]=0;
    }
    for(int i=0;i<m;i++)
    {
        scanf("%lld%lld%lld",&x,&y,&w);
        g[x][y]=g[y][x]=min(g[x][y],w);
    }
}
void flyod()
{
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int k=1;k<=n;k++)
            {
                g[j][k]=min(g[j][k],g[j][i]+g[i][k]);
            }
        }
    }
}
int main()
{
    while(scanf("%lld%lld%lld",&n,&m,&s)!=EOF)
    {
        for(int i=0;i<s;i++)
            scanf("%lld",&vis[i]);
        sort(vis,vis+s);
        init();
        flyod();
        ll ans=INF;
        do
        {
            ll pos=0;
            for(int i=0;i<s-1;i++)
                pos+=g[vis[i]][vis[i+1]];
            ans=min(ans,pos);
        }while(next_permutation(vis,vis+s));
        printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define fr(i1,m) for(int i1=0;i1<m;i1++)
using namespace std;
int main()
{
     long l;
     while(cin>>l)
     {
         long a[100100],c=0;
         fr(i,l)
         cin>>a[i];


         fr(i,l)
         {
             if(a[i]<a[i+1]&&i+1<l)
             {
                 c++;
                 while(a[i]<=a[i+1]&&i+1<l)
                 i++;

             }
             else if(a[i]>a[i+1]&&i+1<l)
             {
                 c++;
                  while(a[i]>=a[i+1]&&i+1<l)
                 i++;

             }
             else
             {
                 c++;
                  while(a[i]==a[i+1]&&i+1<l)
                 i++;
                  if(a[i]<=a[i+1])
                  {
                 while(a[i]<=a[i+1])
                 i++;

                  }
                  else   if(a[i]>=a[i+1]&&i+1<l)
                  {
                 while(a[i]>=a[i+1]&&i+1<l)
                 i++;

                  }
             }

         }
         cout<<c<<"\n";
     }
    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)

void intsertionSort(int *data, int size) {
	int temp, k;
	rep(i, size) {
		temp = data[i]; k = i - 1;
		while (k >= 0 && data[k] > temp) {
			data[k + 1] = data[k]; k--;
		}
		data[k + 1] = temp;
		rep(j, size) {
			if (j != 0) cout << " " << flush;
			cout << data[j] << flush;
		}
		cout << endl;
	}
	return;
}

int main() {
	int n; cin >> n; int arr[n];
	rep(i, n) cin >> arr[i];
	intsertionSort(arr, n);
	return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {

	static int n, m;
	static boolean[] vis;
	static boolean[][] graph;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		vis = new boolean[n];
		graph = new boolean[n][n];
		for(int i = 0 ; i < m ; i++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			graph[a][b] = graph[b][a] = true;
		}
		for(int i = 0 ; i < n ; i++) {
			vis[i] = false;
		}
		vis[0] = true;
		System.out.println(dfs(0));
	}

	public static int dfs(int v) {
		boolean all_vis = true;
		for(int i = 0 ; i < n ; i++) {
			if(vis[i] == false) {
				all_vis = false;
			}
		}
		if(all_vis == true) return 1;
		int ret = 0;
		for(int i = 0 ; i < n ; i++) {
			if(vis[i] == true) continue;
			if(graph[v][i] == false) continue;
			vis[i] = true;
			ret += dfs(i);
			vis[i] = false;
		}
		return ret;
	}

}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 10000000000;
const ll MOD = 1000000007;

using namespace std;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	long long g = gcd(a, b);
	return a / g * b;
}

int main() {
	int a, b, c; cin >> a >> b >> c;

	vector<ll>asum(102);
	asum[0] = a;
	for(int i=1;i<=101;i++) {
		asum[i] = asum[i - 1] + a;
	}
	
	for (int i = 0; i < 101; i++) {
		if (asum[i] % b == c) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
}


Measured memory_bytes: 256
# abc173a
def main():
    import sys

    input = sys.stdin.readline

    K = int(input())

    x = 7 % K
    for i in range(1, K + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % K
    print(-1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9152
//2018年  3月 26日 月曜日 15:52:50 JST
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, M; ll K;
ll A[MAX_N];

vi ordfun(const vi& vec1, const vi& vec2) {
	vi res(N - 1);
	rep(i, 0, N - 1) {
		res[i] = vec2[vec1[i]];
	}
	return res;
}

vi ordpow(vi vec, ll K) {
	if(K == 1) return vec;
	else {
		vi tmp = ordpow(vec, K / 2);
		tmp = ordfun(tmp, tmp);
		if(K % 2 == 0) return tmp;
		else return ordfun(tmp, vec);
	}
}

void solve() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];
	cin >> M >> K;
	vector<int> vec(N - 1);
	rep(i, 0, N - 1) vec[i] = i;
	rep(i, 0, M) {
		int a;
		cin >> a; a--;
		swap(vec[a], vec[a - 1]);
	}
	vec = ordpow(vec, K);
	ll cur = A[0];
	rep(i, 0, N) {
		cout << cur << "\n";
		if(i != N - 1) {
			cur += A[vec[i] + 1] - A[vec[i]];
		}
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 25344
#include <iostream>
#include <iomanip>
#include <cmath>
#define _USE_MATH_DEFINES
using namespace std;
int main() {
    double a;
    cin >> a;
    cout << fixed << setprecision(6);
    cout << (double) pow(a, 2) * M_PI << " " << (double) 2 * a * M_PI;
    return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N,K;
string S;
int main(){
    cin >> N >> K >> S;
    S[K-1] -= 'A' - 'a';
    cout << S << '\n';
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>

using namespace std;


int main()
{
    int a;

    string str;
   cin>>a;


    cin>>str;

    if(a>=3200){
        cout<<str<<endl;
    }
    else cout<<"red"<<endl;



    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;


int main()
{
	int N;
	cin >> N;
	int even = 0;
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		if (A % 2 == 0) even++;
	}
	if (even == N) cout << "second" << endl;
	else cout << "first" << endl;
}

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        int n = Integer.parseInt(bf.readLine());
        for (int i = 0; i < n; i++) {
            char[] s1 = bf.readLine().toCharArray();
            char[] s2 = bf.readLine().toCharArray();
            sb.append(lcs(s1,s2)).append("\n");
        }
        System.out.print(sb);
    }

    private static int lcs(char[] s1, char[] s2) {
        int m=s1.length;
        int n=s2.length;
        int c[][] =new int[m+1][n+1];
        int max=0;
        for (int i = 1; i <= m; i++) {
            for (int j = 1; j <=n ; j++) {
                if (s1[i-1]==s2[j-1]){
                    c[i][j]=c[i-1][j-1]+1;
                }else {
                    c[i][j]=Math.max(c[i-1][j],c[i][j-1]);
                }
                max =Math.max(max,c[i][j]);
            }
        }
        return max;
    }
}


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

int n;
string s[14];
int c[14][14];
int dp[1 << 14][14];

int main()
{
	while (cin >> n, n){
		for (int i = 0; i < n; i++){
			cin >> s[i];
		}

		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				if (i == j) continue;
				if (s[j].find(s[i]) != string::npos){
					swap(s[i], s[n - 1]);
					n--;
					i--;
					break;
				}
			}
		}

		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				if (i == j) c[i][j] = 1 << 28;
				else {
					int r = s[j].size();
					for (int k = 0; k < s[i].size(); k++){
						if (s[j].size() + k < s[i].size()) continue;
					 	string ss(s[i], k, s[i].size() - k);
						string tt(s[j], 0, s[i].size() - k);
						if (ss == tt) r = min<int>(r, s[j].size() - tt.size());
					}
					c[i][j] = r;
				}
			}
		}
		
		fill_n(*dp, (1 << 14) * 14, 1 << 28);
		for (int i = 0; i < n; i++){
			dp[1 << i][i] = s[i].size();
		}
		for (int i = 0; i < (1 << n); i++){
			for (int j = 0; j < n; j++){
				for (int k = 0; k < n; k++){
					if (~i & (1 << j)) continue;
					if (i & (1 << k)) continue;
					int &t = dp[i | (1 << k)][k];
					t = min(t, dp[i][j] + c[j][k]);
				}
			}
		}
		
		int res = 1 << 28;
		for (int i = 0; i < n; i++){
			res = min(res, dp[(1 << n) - 1][i]);
		}

		cout << res << endl;
	}
}

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

int H, W;
const int MAX_HW = 100 + 10;
string C[MAX_HW];

int main() {
    cin >> H >> W;
    for (int i = 0; i < H; i++) cin >> C[i];
    
    for (int i = 0; i < H; i++) {
        cout << C[i] << endl;
        cout << C[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*********************************************************************************\
*  _________  _      _  ________  _       _       __       ________               *
* |___   ___|| |    | ||  ______|| |     | |     /  \     |  ____  |              *
*     | |    | |    | || |______ | |_____| |    / /\ \    | |____| |              *
*     | |    | |    | ||______  ||  _____  |   / /__\ \   |  __  __|              *
*     | |    | |____| | ______| || |     | |  / ______ \  | |  \ \                *
*     |_|    |________||________||_|     |_| /_/      \_\ |_|   \_\               *
*                                                                                 *
*   Department of Computer Science & Engineering                                  *
*   Student ID : 18CSE035                                                         *
*   Bangabnadhu Sheikh Mujibur Rahman Science & Technology University,Gopalgonj.  *
*                                                                                 *
\*********************************************************************************/

//Now Write to Code ___________________________


#include <bits/stdc++.h>
using namespace std ;
 
 
typedef long long                ll;
typedef long double              ld;
typedef unsigned long long       ull;
typedef pair <int,int>           pii;
typedef pair <ll,ll>             pll;
typedef vector <int>             vi;
typedef vector <ll>              vll;
typedef vector <vector <int> >   vvi;
 
inline int    Int(){int x; cin >> x; return x;}
inline ll     Long(){ll x; cin >> x; return x;}
inline float  Float(){float x; cin >> x; return x;}
inline double Double(){double x; cin >> x; return x;}
inline void   Yes(){cout << "Yes" << endl;}
inline void   No(){cout << "No" << endl;}
inline void   YES(){cout << "YES" << endl;}
inline void   NO(){cout << "NO" << endl;}
 
const int N             =(int)2e5 + 5;
const int maxN          =(int)1e6 + 6;
const ll  Mod           =(ll)1e9 + 7;
const int inf           =(int)2e9;
const ll  Inf           =(ll)1e18;
 
#define     T           int t,q; cin >> t; for(q=1;q<=t;q++)
#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i=(b); i!=(e+1)-2*(b > e); i =i+1-2*(b > e))
#define     Int         Int()
#define     Long        Long()
#define     Float       Float()
#define     Double      Double()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)
#define     biday       return 0 
 
 
int main(){

	int X,A;
	cin >> X >> A;
	
	if(X < A) cout << "0" << endl;
	else cout << "10" << endl;
    

    biday;
}
 
//...............BYE BYE................

Measured memory_bytes: 256
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int n,m;
    cin >> n >> m;
    
    if(n<=m) {
        fff(i,m)
        cout <<n;
    }
    else {
    fff(i,n)
    cout << m;
    }
	return 0;
    
}

Measured memory_bytes: 8832
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
  int n,m;cin>>n>>m;
  int a[n];
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];

  }

 int counter = 0;
  sort(a,a+n,greater<int>());
  if(a[m-1]>=ceil((sum/(4.0*(double)m))))cout<<"Yes";
  else{
    cout<<"No";
  }
    return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll>P;
typedef pair<ll, P>PP;

ll path[101][101];
ll flg[101];
ll tim[101][101];
void init(){
    for(ll i = 0; i < 101; i++){
        for(ll j = 0; j < 101; j++){
            path[i][j] = 1000;
            tim[i][j] = 1145141919;
        }
        flg[i] = 0;
    }
}

int main(){
    
    for(ll N, M, L, K, A, H; cin >> N >> M >> L >> K >> A >> H, N;){
        init();
        for(ll i = 0; i < L; i++){
            ll x;
            cin >> x;
            flg[x] = 1;
        }
        for(ll i = 0; i < K; i++){
            ll x, y, t;
            cin >> x >> y >> t;
            path[x][y] = t;
            path[y][x] = t;   
        }
        priority_queue<PP, vector<PP>, greater<PP> >Q;
        Q.push(PP(0, P(A, M)));
        ll help = 1;
        while(!Q.empty() && help){
            ll t = Q.top().first;
            ll pos = Q.top().second.first;
            ll m = Q.top().second.second;
            Q.pop();
            if(tim[pos][m] <= t)continue;
            // cout << t << " " << pos << " " << m << endl;
            tim[pos][m] = t;
            if(pos == H){
                cout << t << endl;
                help = 0;
                break;
            }
            for(ll i = 0; i < N; i++){
                if(pos == i && flg[i] && m < M){
                    if(tim[i][m + 1] > t + 1){
                        Q.push(PP(t + 1, P(i, m + 1)));
                    }
                }
                if(path[pos][i] <= m){
                    if(tim[i][m - path[pos][i]] > t + path[pos][i]){
                        Q.push(PP(t + path[pos][i], P(i, m - path[pos][i])));
                    }
                }
            }
        }
        if(help)cout << "Help!" << endl;
    }
    
    return 0;    
}


Measured memory_bytes: 5312
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

const int mod = 1000000007;
int d;
int l[300];
int s;
int dp[2][90010][2];
using ll = long long;

ll modpow(ll x, int y){
    if(y == 0) return 1;
    ll a = modpow(x, y/2);
    a *= a;
    a %= mod;
    if(y&1){
        a *= x;
        a %= mod;
    }
    return a;
}

int main(){
    cin >> d;
    for(int i = 0; i < d; ++i) cin >> l[i];
    cin >> s;
    memset(dp, 0, sizeof dp);
    dp[0][0][0] = 1;
    for(int i = 0; i < d; ++i){
        auto a = dp[i&1];
        auto b = dp[~i&1];
        memset(b, 0, sizeof dp[0]);
        for(int j = 0; j <= s; ++j){
            for(int p : {0,1}){
                (b[j][p] += a[j][p]) %= mod;
                if(j+l[i] <= s) (b[j+l[i]][p^1] += a[j][p]) %= mod;
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i <= s; ++i){
        ll x = dp[d&1][i][0] * modpow(s-i, d) % mod;
        ll y = dp[d&1][i][1] * modpow(s-i, d) % mod;
        ans += x - y + mod;
    }
    ans %= mod;
    cout << ans << endl;
}

Measured memory_bytes: 4500
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<string>
#include<numeric>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int f[105][15];
int p[105][15];

int main(){
    int n;
    cin >> n;
//    vector<vector<int>> f(n, vector<int>(10));
//    vector<vector<int>> p(n, vector<int>(11));
    rep(i, n) {
        rep(j, 10) {
//            cin >> f[i][j];
            scanf("%d", &f[i][j]);
        }
    }
    rep(i, n) {
        rep(j, 11) {
//            cin >> p[i][j];
            scanf("%d", &p[i][j]);
        }
    }
    int risan = -1000000005;
    for ( int i = 1; i < 1<<10; ++i ) {
        int coba = 0;
        rep(j, n) {
            int ada = 0;
            rep(k, 10) if ( i & (1<<k)) ada += f[j][k];
            coba += p[j][ada];
        }
        risan = max(risan, coba);
    }
    cout << risan << endl;
    return 0;
}


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

int main() {
  int N, K, L;
  L = 0;
  cin >> N >> K;
  for (int i = 0; i < N; i++){
    int A;
    cin >> A;
    if ( 2*A <= K) {
      L += 2*A;
    }
    else {
      L += 2*(K-A);
    }
  }
  cout << L << endl;
}



Measured memory_bytes: 256
i,o,t,j,l,s,z=map(int,input().split())
ansl=[o,o]
ansl[0]+=3+(max(0,(i-1)//2))*2+(max(0,(j-1)//2))*2+(max(0,(l-1)//2))*2
ansl[1]+=(i//2)*2+(j//2)*2+(l//2)*2
if i>=1 and j>=1 and l>=1:
    print(max(ansl))
else:
    print(ansl[1])

Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	
	if((x-r>=0)&&(x+r<=W)&&(y-r>=0)&&(y+r<=H))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}



Measured memory_bytes: 2104
#include<stdio.h>
int main(void)
{
	int n,i,a,b,suma,sumb;
	

	while(1)	{
		scanf("%d",&n);
		if(n==0)	{
			break;
		}
		suma=0;
		sumb=0;
		for(i=1;i<=n;i++){
			scanf("%d",&a);
			scanf("%d",&b);
			if(a<b){
				sumb=sumb+a+b;
			}
			else if(a>b){
				suma=suma+a+b;
			}
			else{
				suma=suma+a;
				sumb=sumb+b;
			}	
		}
		printf("%d %d\n",suma,sumb);
	}
	return 0;
}

Measured memory_bytes: 1852
#include<bits/stdc++.h> 
#define ll long long 
using namespace std;
const int mod=1e9+7;
const int maxn=2010;
int n,K;
ll dp[maxn][maxn],sum[maxn];
int main() 
{
	scanf("%d%d",&n,&K);
	dp[0][0]=1;
	for(int i=0;i<=n;++i) sum[i]=1;
	for(int i=1;i<=K;++i) {
		for(int j=i;j<=n;++j) {
			if(j!=n)
			dp[i][j]=dp[i-1][j];
			dp[i][j]=(dp[i][j]+sum[j-1])%mod;
		}sum[0]=dp[i][0];
		for(int j=1;j<=n;++j) {
			sum[j]=(sum[j-1]+dp[i][j])%mod;
		}
	}
	for(int i=1;i<=n-K-1;++i) dp[K][n]=dp[K][n]*2%mod;
	cout<<dp[K][n]<<"\n";
	return 0;
} 
/**/


Measured memory_bytes: 31104
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {

    public static String solve(BigDecimal a, BigDecimal b) {
        String result = a.multiply(b).toString();
        int decimalIndex = result.indexOf('.');
        return decimalIndex == -1 ? result : result.substring(0, decimalIndex);
    }

    public static void main(String[] args) {
        Scanner sn = new Scanner(System.in);
        BigDecimal a = new BigDecimal(sn.next());
        BigDecimal b = new BigDecimal((sn.next()));
        System.out.println(solve(a,b));
    }
}

Measured memory_bytes: 36084
#include <bits/stdc++.h>
typedef long long LL;
using namespace std;

void solve_test() {
	int n;
	cin >> n;
	bool found = false;
	int x = 0;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (a == b)
			x++;
		else
			x = 0;
		if (x == 3)
			found = true;
	}

	cout << (found ? "Yes": "No") << '\n';
}

int main() {
	int T;
	T = 1;
	for (int t = 1; t <= T; t++)
		solve_test();

	return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;
int main(){
    int N;
    cin >> N;
    int A[N+1],B[N+1];
    
    for(int i=1;i<=N;i++)cin>>A[i];
    
    for(int i=1;i<=N;i++){
        B[A[i]] = i;
    }
    
    for(int i=1;i<=N;i++){
        cout << B[i] ;
        if(i == N)cout<<endl;
        else cout << " ";
    }
}


Measured memory_bytes: 4372
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
int mod=1000000007;
int Power(int x,int y,int mod) {
	int ret=1;
	while(y) {
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod,y>>=1;
	}
	return ret;
}
int main(){
	int n,a,b; 
	cin>>n>>a>>b;
	int ans=1,ans2=1,aa=Power(2,n,mod);
	for(int i=1;i<=a;i++)ans=1ll*ans*Power(i,mod-2,mod)%mod*(n-i+1)%mod;
	for(int i=1;i<=b;i++)ans2=1ll*ans2*Power(i,mod-2,mod)%mod*(n-i+1)%mod;
	cout<<((0ll+aa-ans-ans2-1)%mod+mod)%mod;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
x = list(map(int, input().split()))

ans = 10 ** 9
for i in range(n - k + 1):
    x1, xk = x[i], x[i + k - 1]
    if x1 * xk >= 0:
        t = max(abs(x1),abs(xk))
    elif x1 * xk < 0:
        t = min(abs(x1), abs(xk)) + abs(x1 - xk)
    ans = min(ans, t)
print(ans)


Measured memory_bytes: 85128
#include<cstdio>
#include<vector>
#include<algorithm> // sort
#include<functional> // pair


using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	vi a(3);

	while(scanf("%d%d%d", &a[0], &a[1], &a[2])==3)
	{
		sort(a.begin(), a.end());
		printf("%d\n", a[2]-a[0]);
	}

	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static int sum = 0;
	
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int num = 0;
		String line = null;
		
		try {
			num = Integer.parseInt(br.readLine());
			line = br.readLine();
		} catch (NumberFormatException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
		
		String[] str = line.split(" ");
		int array[] = new int[num];
		
		for(int i = 0; i < num; i ++ ){
			array[i] =Integer.parseInt(str[i]);
		}
		
		mergeSort(array, 0, num);
		
		
		output(array,num);
		
		System.out.println(sum);
		
	}
	
	public static void output(int[] sort, int num){
	//出力
	StringBuilder sb = new StringBuilder("");
	sb.append(sort[0]);
	for (int i = 1; i < num; i++) {
		sb.append(" ").append(sort[i]);
	}
	System.out.println(sb);
	}
	
	public static void mergeSort(int[] array, int left, int right){
		if(left + 1 < right){
			int middle = (left + right) / 2;
			mergeSort(array, left, middle);
			mergeSort(array, middle, right);
			merge(array, left, middle, right);
		}	
	}

	public static void merge(int[] array, int left, int middle, int right){
		int left_m = middle - left;
		int right_m = right - middle;
		int[] left_box = new int[left_m+1];
		int[] right_box = new int[right_m+1];
		for (int i=0; i<left_m; i++) {
			left_box[i] = array[left+i];
		}
		for (int i=0; i<right_m; i++) {
			right_box[i] = array[middle+i];
		}
		left_box[left_m] = Integer.MAX_VALUE;
		right_box[right_m] = Integer.MAX_VALUE;
		int i = 0;
		int j = 0;
		for (int k=left; k<right; k++) {
			sum ++;
			if (left_box[i] <= right_box[j]) {
				array[k] = left_box[i];
				i++;
			}else {
				array[k] = right_box[j];
				j++;
			}
		}
	}
}


Measured memory_bytes: 156332
#include<stdio.h>
#include <stdlib.h>
double abso(double a,double b)
{
    if(a-b<0)
        return b-a;
    else
        return a-b;
}
int main()
{
    int h, a, b;
    scanf("%d %d %d", &h, &a, &b);
    if(abso(h, a)< abso(h, b))
    {
        printf("A");
    }
    else{
        printf("B");
    }

}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<LP> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;


void solve() {
	int n, d; cin >> n >> d; d = 2 * d + 1;
	cout << (n + d - 1) / d << endl;
}

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

	//cout << fixed << setprecision(10);
	//init();
	solve();
	//stop
		return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

const long long MOD = 998244353;

long long modpow(long long c, long long n){
	long long ret = 1;
	while(n != 0){
		if(n&1){
			ret = ret * c % MOD;
		}
		c = c * c % MOD;
		n /= 2;
	}
	return ret;
}

int main(){
	int N, S;
	cin >> N >> S;
	int A[N];
	for (int i = 0; i < N; i++){
		cin >> A[i];
	}

	long long dp[N][S + 1];

	for (int i = 0; i < N; i++){
		for (int j = 0; j <= S; j++){
			dp[i][j] = 0;
		}
	}
	dp[0][0] = 2;
	dp[0][A[0]] = 1;

	for (int i = 1; i < N; i++){
		for (int j = 0; j <= S; j++){
			dp[i][j] = 2 * dp[i - 1][j] % MOD;
			if(j - A[i] >= 0){
				dp[i][j] += dp[i - 1][j - A[i]];
			}
			dp[i][j] %= MOD;
		}
	}

		cout << dp[N - 1][S] << endl;
	return 0;
}


Measured memory_bytes: 73860
#include <stdio.h>
#define MAX 100005
#define NIL -1


typedef struct{
  int par;
  int left;
  int right;
}Node;

Node tree[MAX];
int depth[MAX];

void print(int);
int Depth(int,int);

int main(){

int n,i,j,num,deg,c,l,r;

scanf("%d",&n);

for(i = 0; i < n; i++){
  tree[i].par = tree[i].left = tree[i].right = NIL;
}
for(i = 0; i < n; i++){
  scanf("%d %d",&num,&deg);
  for(j = 0 ; j < deg;j++){
    scanf("%d",&c);
    if(j == 0)tree[num].left = c;
    else tree[l].right = c;
    l = c;
    tree[c].par = num;
  }
}

for(i = 0; i<n;i++){
  if(tree[i].par == NIL)r=i;
}
Depth(r,0);

for(i = 0;i < n; i++)print(i);

return 0;
}

void print(int x){
  int i,c;

  printf("node %d: ",x);
  printf("parent = %d, ",tree[x].par);
  printf("depth = %d, ",depth[x]);

  if(tree[x].par == NIL)printf("root, ");
  else if(tree[x].left == NIL)printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i = 0, c = tree[x].left; c !=NIL; i++,c = tree[c].right){
    if(i > 0)printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

int Depth(int x,int y){
  depth[x] = y;
  if(tree[x].right != NIL)Depth(tree[x].right,y);
  if(tree[x].left != NIL)Depth(tree[x].left,y+1);
}



Measured memory_bytes: 6380
# すべて取らないといけないとき、例えばN=15は[1, 2, 3, 4, 5]で5になる。このあと16~(15+6-1)=20までは6でいけるやろ、そういうことじゃ

x = int(input())
i = 0
s = 0
while True:
    if s >= x:
        break
    i += 1
    s += i
print(i)


Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;


const ll MM = 1e9 + 7;
int main() {
    ll N,S,T;
    cin >> N >> S >> T;
    if(N<=S*T)cout << "Yes" << endl;
    else cout << "No" << endl;
    
}

Measured memory_bytes: 3648
A = list(map(int,input().split()))
N = A[0]
T = A[1]
ans = 999999
for i in range(0,N):
  A = list(map(int,input().split()))
  if T >= A[1]:
    ans = (A[0] if ans > A[0] else ans)
print(ans if ans != 999999 else "TLE")

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

const LL MOD = 1000000007;
LL memo[26];

void solve(long long N, std::string S){    
    REP(i, N) memo[S[i]-'a']++;
    LL ans = 1;
    REP(i, 26) {
        ans *= (memo[i] + 1LL);
        ans %= MOD;
    }
    cout << (ans - 1) << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define EPS 1e-10
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
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 power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}
ll dx[]={0, 0, -1, 1};
ll dy[]={1, -1, 0, 0};// up,down,left right


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

    ll N , K, S;
    cin >> N >> K >> S;
    
    rep(i, K){
        cout << S << " ";
    }
    

    ll r = S + 10;
    if(r >= 1000000000) r = S-10;
        
    rep(i, N-K){
        cout << r << " ";
    }
    cout << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int n, result;
    double t, a, tmp = 10000000.0, hoge;
    cin >> n >> t >> a;
    for(int i = 0; i < n; ++i) {
        cin >> hoge;
        hoge = abs(a - (t - hoge * 0.006));
        if(hoge < tmp) {
            tmp = hoge;
            result = i + 1;
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  bool a[n];
  for(int i=1;i<n;i++)
    a[i]=0;
  int t=0;
  for(int i=1;i<=n;i++)
  {
    t=(t*10+7)%n;
    if(t==0)
    {
      cout<<i<<endl;
      break;
    }
    if(a[t]==1)
    {
      cout<<-1<<endl;
      break;
    }
    a[t]=1;
  }
  return 0;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

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

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    string s, t; std::cin >> s >> t;
    map<char, char> m;
    int len = s.size();
    bool ok = true;
    rep(i, len) {
        if (m.count(s[i]) == 0) m[s[i]] = t[i];
        else if (m[s[i]] != t[i]) ok = false;
    }
    vi cnt(27);
    for (auto &p : m) {
        cnt[p.se-'a']++;
        if (cnt[p.se-'a'] > 1) ok = false;
    }
    std::cout << (ok ? "Yes" : "No") << "\n";
}


Measured memory_bytes: 916
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        if(a>b) {
        	System.out.println(a-1);
        }else {
        	System.out.println(a);
        }
    }

	private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

Measured memory_bytes: 20308
#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 sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#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 n;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	cout << fixed << setprecision(12);
	print1((ld)(n+1>>1)/n);
	return 0;
}

Measured memory_bytes: 256