akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>  // istringstream
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main()
{   
    int x_1, x_2, x_3, x_4, x_5;
    cin >> x_1 >> x_2 >> x_3 >> x_4 >> x_5;

    if (x_1 == 0) {
        cout << 1 << endl;
    }
    if (x_2 == 0) {
        cout << 2 << endl;
    }
    if (x_3 == 0) {
        cout << 3 << endl;
    }
    if (x_4 == 0) {
        cout << 4 << endl;
    }
    if (x_5 == 0) {
        cout << 5 << endl;
    }

    return 0;
}

Measured memory_bytes: 3560
#include<stdio.h>
int main(void)
{
	int l,m[13],n[13];
	int i,x;
	int cnt,flg;
	int sum;
	
	scanf("%d",&l);
	while(l!=0){
		cnt=0;
		sum=0;
		for(i=0;i<12;i++){
			scanf("%d %d",&m[i],&n[i]);
		}
		for(i=0;i<12;i++){
			sum+=m[i]-n[i];
			cnt++;
			if(l<=sum){
				break;
			}
		}
		if(l<=sum){
			printf("%d\n",cnt);
		}
		else if(cnt==12 && sum<=l){
			printf("NA\n");
		}
		scanf("%d",&l);
	}
	return 0;
}

Measured memory_bytes: 608
import sys
sys.setrecursionlimit(2 << 28)

n, m = [int(i) for i in input().split()]
al = [set() for _ in range(n)]
for _ in range(m):
    x, y = [int(i) for i in input().split()]
    al[x-1].add(y-1)

dp = [-1] * n


def rec(v):
    if dp[v] != -1:
        return dp[v]
    ret = 0
    for nv in al[v]:
        ret = max(ret, rec(nv) + 1)
    dp[v] = ret
    return ret


ans = 0
for v in range(n):
    ans = max(ans, rec(v))

print(ans)


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

using namespace std;

const int MAXN = 100100;

int N;
vector<int> adj[MAXN];
int deg[2][MAXN];
int ans[MAXN];
vector<pair<int, int>> edges;

int dfs1(int v) {
   while (adj[v].size() > 1) {
      int u0 = dfs1(adj[v].back()); adj[v].pop_back();
      int u1 = dfs1(adj[v].back()); adj[v].pop_back();
      edges.emplace_back(u0, u1);
   }
   return adj[v].size() ? dfs1(adj[v][0]) : v;
}

void dfs2(int v) {
   for (int u : adj[v]) if (!ans[u]) {
      ans[u] = -ans[v];
      dfs2(u);
   }
}

int main() {
   ios_base::sync_with_stdio(false);
   cin >> N;
   for (int z = 0; z < 2; ++z) {
      int root = -1;
      for (int i = 0; i < N; ++i) {
         int par;
         cin >> par;
         if (par == -1) root = i;
         else {
            deg[z][--par] ^= 1;
            adj[par].emplace_back(i);
         }
      }
      dfs1(root);
      for (int i = 0; i < N; ++i) adj[i] = {};
   }
   for (int i = 0; i < N; ++i) if (deg[0][i] ^ deg[1][i]) {
      cout << "IMPOSSIBLE\n";
      return 0;
   }
   for (auto e : edges) {
      adj[e.first].emplace_back(e.second);
      adj[e.second].emplace_back(e.first);
   }
   for (int i = 0; i < N; ++i) if (!deg[0][i] && !ans[i]) {
      ans[i] = +1;
      dfs2(i);
   }
   cout << "POSSIBLE\n";
   for (int i = 0; i < N; ++i) {
      cout << ans[i] << " ";
   }
}


Measured memory_bytes: 11904
mou1=mou2=mou3=0
for i in range(10):
    a=int(input())
    if a>mou1:
        mou3=mou2
        mou2=mou1
        mou1=a
    elif a>mou2:
        mou3=mou2
        mou2=a
    elif a>mou3:
        mou3=a
    else:
        pass
    
print(mou1)
print(mou2)
print(mou3)


Measured memory_bytes: 5592
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;

struct UnionFindTree {
  std::vector<int> data;

  UnionFindTree(int size) : data(size, -1) { }
  bool Unite(int x, int y) {
    x = Root(x); y = Root(y);
    if (x != y) {
      if (data[y] < data[x]) std::swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
    return x != y;
  }
  bool IsSameRoot(int x, int y) {
    return Root(x) == Root(y);
  }
  int Root(int x) {
    return data[x] < 0 ? x : data[x] = Root(data[x]);
  }
  int Size(int x) { return -data[Root(x)]; }
};

int main() {
  int N; cin >> N;
  vector<P> ps(N);
  vector<TP> tps(N);
  for (int i = 0; i < N; ++i) {
    int x, y; cin >> x >> y;
    ps[i] = {x, y};
    tps[i] = {x, y, i};
  }

  UnionFindTree tree(N);
  sort(tps.begin(), tps.end());
  map<int, int> m;
  for (int i = 0; i < N; ++i) {
    bool first = true;
    auto [x, y, k] = tps[i];
    for (auto [y2, k2] : m) {
      if (y < y2) break;
      first = false;
      tree.Unite(k, k2);
//      cout << y << " " << y2 << "->" << i << " and " << i2 << " is same" << endl;
    }
    if (first) m[y] = k;
  }

  for (int i = 0; i < N; ++i) cout << tree.Size(i) << endl;
}


Measured memory_bytes: 11984
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String line = sc.next();
		int a = Integer.parseInt(line);
		line = sc.next();
		int b = Integer.parseInt(line);

		System.out.println(a * b + " " + 2 * (a + b));
	}

}


Measured memory_bytes: 26152
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

int main(){
    unsigned long long int hp,count = 0;

    cin >> hp;

    while(hp != 0){
        count++;
        hp /= 2;
    }

    if(count == 1){
        cout << 1 << endl;
    }else{
        
        cout << setprecision(0) << fixed <<  (pow(2,count) - 1) << endl;
    }

    return 0;


}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	int X;
	cin >> X;

	int primes[X*2] = {};

	for(int i=2; i<=X; i++){
		for(int j=2; i*j<=X*2; j++){
			primes[i*j] = 1;
		}
	}

	for(int i=X; i<X*2; i++){
		if(primes[i] == 0){
			cout << i << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main()
	{
		long n = GetLong();
		long s = GetLong();
		
		if(n == s)
		{
			Console.WriteLine(n+1);
			return;
		}

		for(long b = 2; b <= Math.Sqrt(n); b++)
			if(digitSum(n, b) == s)
			{
				Console.WriteLine(b);
				return;
			}


		for(long p = (long)Math.Sqrt(n); p > 0; p--)
		{
			if(n <= s)
				continue;

			if((n-s) % p != 0)
				continue;

			long b = (n-s)/p + 1;	// b >= 2
			if(digitSum(n, b) == s)
			{
				Console.WriteLine(b);
				return;
			}
		}

		Console.WriteLine(-1);
	}

	private static long digitSum(long n, long b)
	{
		long ans = 0;
		while(n > 0)
		{
			ans += n % b;
			n /= b;
		}
		return ans;
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 13140
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>
#include<queue>

//const int mod = 1000000007;

int main() {
	int N;
	scanf("%d", &N);
	char*S = new char[N + 1];
	scanf("%s", S);
	int **r = new int*[N];
	for (int i = 0; i < N; i++) {
		r[i] = new int[N];
		for (int j = 0; j < N; j++)r[i][j] = 0;
	}
	for (int j = 1; j < N; j++) {
		for (int i = N - 1 - j; i >= 0; i--) {
			if (S[i] == S[i + j]) {
				r[i][j] = r[i + 1][j] + 1;
				if (r[i][j] > j)r[i][j] = j;
			}
		}
	}
	int best = 0;
	for (int i = 0; i < N; i++)for (int j = 0; j < N; j++)if (best < r[i][j])best = r[i][j];
	printf("%d", best);
	return 0;
}


Measured memory_bytes: 98048
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath> 
using namespace std;
int mojikaku (string s){
  cout << s << endl;
  return 0;
}
int suujikaku (int t){
  cout << t <<endl;
}

int main(){
  int n,t,a;
  cin >> n >> t >> a;
  
  int h[n],k[n];
  int ans=1000000;
  double hikaku=100000;
  int ans1=10000;
  
  for (int i=0;i<n;i++){
  cin >>h[i] ;
    double y=t-0.006*h[i]-a;
    double z=abs(y);
    if (hikaku>z){
      ans=h[i];
      hikaku=z;
      ans1=i+1;
    }
  }
  
  cout << ans1 << endl;
  
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    int n;
    cin >> n;
    //出力
	cout << (n<1200 ? "ABC" : "ARC") << ENT;
    return 0;
}

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


Measured memory_bytes: 256
let readInt () = stdin.ReadLine() |> int
let choice ok ng bool = if bool then ok else ng

readInt ()
|> fun z ->
    [ for x in 1 .. 9 do
        for y in 1 .. 9 -> x * y ]
    |> List.exists ((=) z)
    |> choice "Yes" "No"
    |> printfn "%s"


Measured memory_bytes: 29712
N=int(input())
A=[]
B=[]
for _ in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort()
if N%2==1:
    print(B[(N+1)//2-1]-A[(N+1)//2-1]+1)
else:
    print(B[N//2-1]+B[N//2]-A[N//2-1]-A[N//2]+1)

Measured memory_bytes: 25360
#include<algorithm>
#include<iomanip>
#include<cstdio>
#include<iostream>
#include<vector>
#include<cmath>
#include<climits>
#include<map>
#include<set>
using namespace std;

vector<int> chair = {1,2,1,2,1,4,1,4};
int l[8];

vector<int> solve(){
  map<int,set<vector<int>>> list;
  for(int i=0;i<chair.size();i++){
    int tmp=0;
    for(int j=0;j<8;j++){
      tmp += max(0,l[j]-chair[j]);
    }
    list[tmp].insert(chair);
    rotate(chair.begin(),chair.begin()+1,chair.end());
  }
  return *((*list.begin()).second).begin();
}

int main(){
  while(cin>>l[0]>>l[1]>>l[2]>>l[3]>>l[4]>>l[5]>>l[6]>>l[7]){
    vector<int> ans = solve();
    cout<<ans[0];
    for(int i=1;i<ans.size();i++){
      cout<<" "<<ans[i];
    }cout<<endl;
  }
}

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

int main() {
	string s;
	cin >> s;
	int i, t = 0, l = s.size();
	for(i = 1; i < l; ++i)
		if(s[i - 1] != s[i])	++t;
	cout << t << endl;
	return 0;
}


Measured memory_bytes: 512
import Control.Applicative
import Control.Monad

main :: IO ()
main = do
  [n, q] <- f
  solve q <$> replicateM n g >>= putStrLn
  where
    f = map read <$> words <$> getLine
    g = (\[yr, nm] -> (read yr, nm)) <$> words <$> getLine

solve :: Int -> [(Int, String)] -> String
solve q = snd . last . takeWhile ((q >=) . fst) . ((1, "kogakubu10gokan"):)



Measured memory_bytes: 4080
from sys import stdin

k,n = [int(x) for x in stdin.readline().strip().split()]
a_lst = [int(x) for x in stdin.readline().strip().split()]
diff_lst = [a_lst[i+1] - a_lst[i] for i in range(len(a_lst)-1)] + [k - a_lst[-1] + a_lst[0]]

print(k - max(diff_lst))

Measured memory_bytes: 31604
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n, k;
    cin >> n >> k;
    ll ans = n;
    n = abs(n - k);
    ans = min(ans, n);

    if(n > k) n = n % k;

    rep(i,100){
        ans = min(ans, n);
        n = abs(n - k);
    }

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


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

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (size_t i = 0; i < n; i++) cin >> a[i];

    sort(a.begin(), a.end());
    string ans = "YES";
    for (size_t i = 1; i < n; i++) {
        if (a[i] == a[i-1]) ans = "NO";
    }

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


Measured memory_bytes: 3964
#include <stdio.h>

int main(void) {
	int a = 0;
	int b = 0;
	int c = 0;

	scanf("%d %d %d", &a, &b, &c);

	if (a < b && b < c) printf("Yes\n");
	else printf("No\n");


	return 0;

}

Measured memory_bytes: 580
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    int ans = 0;
    for(int i = 1;i <= n; i++)
        ans += i;
    printf("%d\n",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int A[250+1], h;

int parent(int i){
  return i/2;
}

int left(int i){
  return i*2;
}

int right(int i){
  return i*2+1;
}

int main(void){
  int i;
  
  scanf("%d", &h);
  for(i=1; i<=h; i++) scanf("%d", &A[i]);

  for(i=1; i<=h; i++){
    printf("node %d: key = %d, ", i, A[i]);

    if(i != 1) printf("parent key = %d, ", A[parent(i)]);
    
    if(left(i)  <= h) printf("left key = %d, ", A[left(i)]);
    if(right(i) <= h) printf("right key = %d, ", A[right(i)]);

    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 3220
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	if(a==1)a+=13;
	if(b==1)b+=13;
	if(a>b)cout<<"Alice"<<endl;
	else if(a==b)cout<<"Draw"<<endl;
	else cout<<"Bob"<<endl;
	return 0;
}

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

using namespace std;
const int maxn = 1010;

int n, m, a, b;
int niz[maxn][maxn];

int main() {
    scanf("%d%d%d%d", &n, &m, &a, &b);
    for (int i = 0; i < n - b; i++) {
        for (int j = 0; j < a; j++) {
            niz[i][j] = 1;
        }
    }

    for (int i = n - b; i < n; i++) {
        for (int j = a; j < m; j++) {
            niz[i][j] = 1;
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            printf("%d", niz[i][j]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 5120
N,A=map(int,input().split())
X=[x-A for x in map(int,input().split())]
dp=[0]*(N*100+1)
dp[0]=1
for x in X:
    if x>0:
        for i in range(N*50,-N*50-1,-1):
            if dp[i]>0:
                dp[i+x]+=dp[i]
    else:
        for i in range(-N*50,N*50+1):
            if dp[i]>0:
                dp[i+x]+=dp[i]
print(dp[0]-1)

Measured memory_bytes: 3064
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include "cmath"
typedef long long ll;
using namespace std;

void sep_next(ll separ[15]){
  // ll separ2[15] = separ;
  // separ[0] +=1;
  ll asf = 0;
  while (separ[asf] == 7) {
    asf++;
  }

  for (size_t i = 0; i < asf+1; i++) {
    if (i != asf) {
      separ[i] = 3;
    }else{
      if (separ[i] == 0) {
        separ[i] = 3;
      }else{
        separ[i] += 2;
      }
    }
  }

}



int main(int argc, char const *argv[]) {
  ll NN;

  std::cin >> NN;

  ll separ[15];
  for (size_t i = 0; i < 15; i++) {
    separ[i] = 0;
  }

  // std::cout << separ[0] << '\n';

  // separ = sep_next(separ);
  // separ = sep_next(separ);
//   sep_next(separ);
//   for (size_t i = 0; i < 15; i++) {
//     std::cout << separ[i] << ' ';
//   }
//   std::cout  << '\n';
//
//   sep_next(separ);
//   for (size_t i = 0; i < 15; i++) {
//     std::cout << separ[i] << ' ';
//   }
//   std::cout  << '\n';
//
//   for(size_t i = 0; i < 40; i++){sep_next(separ);
//   for (size_t i = 0; i < 15; i++) {
//     std::cout << separ[i] << ' ';
//   }
//   std::cout  << '\n';
// }

  int flag = 0;
  ll count = 0;

  while(flag == 0){
    sep_next(separ);

    int flag3 = 0,flag5 = 0,flag7 = 0;
    for (size_t i = 0; i < 15; i++) {
      if (separ[i] == 3) {
        flag3 += 1;
      }
      if (separ[i] == 5) {
        flag5 += 1;
      }
      if (separ[i] == 7) {
        flag7 += 1;
      }
    }

    ll sep_rep =0;
    for (size_t i = 0; i < 15; i++) {
      sep_rep += separ[i] * pow(10, i);
    }
    if (sep_rep > NN) {
      flag = 1;
      break;
      // std::cout << "end" << '\n';
    }

    if (flag3*flag5*flag7 >0) {
      count += 1;
    }
  }

  std::cout << count << '\n';


  return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  long long res = 0;
  for (int b = k + 1; b <= n; b++) {
    int num = b - k;
    // xk x2k x3k x4k

    int rem = n % b;

    res += n / b * num;

    if (n % b >= k) 
      res += n % b - k + (k != 0);

    // int x = n / b;

    // find how many time it repeats 
  }   
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

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

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

///////////////////////////




int main() {

	string s;
	cin >> s;

	ll n = s.size();

	ll ans = 0;

	rep(i, n) {
		int j = i;
		while (s[j] == 'A' || s[j] == 'T' || s[j] == 'G' || s[j] == 'C') {
			ans = max(ans, j - i + 1);
			j++;
		}
	}

	cout << ans;
	

	system("PAUSE");
}

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

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define readint ({int t;cin >> t;t;})
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

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

template <typename T>
ostream& operator << (ostream& os, const vector<T> V) {
    for(auto v : V)os << v << " ";
    return os;
}

template <typename T>
ostream& operator << (ostream& os, const set<T> V) {
    for(auto v : V)os << v << " ";
    return os;
}

//#define int ll
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
class CDubiousDocument {
public:
    int A[26];
void solve(std::istream& cin, std::ostream& cout) {
    Fill(A, 55);
    int N;
    cin >> N;
    _for(i,N){
        string s;
        cin >> s;
        int B[26];
        Fill(B, 0);
        for(auto c : s)B[c - 'a'] ++;
        _for(i,26)chmin(A[i], B[i]);
    }
    _for(i,26)_for(j,A[i])cout << (char)(i + 'a') ;
}


};


#undef int
int main() {


	CDubiousDocument solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0); ios::sync_with_stdio(0); out<<fixed<<setprecision(20);
	solver.solve(in, out);
	return 0;
}


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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {
    string s;
    cin>>s;
    
    if(s.find("AC")==s.npos) No;
    else Yes;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    double n, m, d;
    cin >> n >> m >> d;
    double res;
    if (d == 0) {
        res = max(n - d, 0.0) * (m - 1) / n / n;
    } else {
        res = 2 * max(n - d, 0.0) * (m - 1) / n / n;
    }
    cout << fixed << setprecision(10) << res << endl;

    return 0;
}


Measured memory_bytes: 3728
//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e9) + 1;
const int mod = 479001599;
const int maxn = 3e6 + 111;
        
using namespace std;          

int a, b, c;

void solve(){
	cin >> a >> b >> c;

   	if ((a == b && a != c) || (a == c && a != b) || (b == c && b != a))
   		cout << "Yes";
   	else
   		cout << "No";
}                              
      
main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

    boost;
    
    int q = 1;
 
    //cin >> q;
    
    while (q--){
        solve();
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
typedef long long li;

const int maxn = 100000;

int n, x, a[maxn];

int main(void) {
  scanf("%d%d", &n, &x);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  sort(a, a + n);

  int ans = 0;
  for (int i = 0; i < n; ++i) if (a[i] <= x) x -= a[i], ++ans;
  if (ans == n && x) --ans;
  printf("%d\n", ans);
}


Measured memory_bytes: 128
use std::io::Read;
use std::collections::HashSet;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iter = input.split_whitespace();

    let n: usize = iter.next().unwrap().parse().unwrap();

    let set: HashSet<&str> = iter.collect();

    if set.len() == n {
        return String::from("YES");
    } else {
        return String::from("NO");
    }
}


Measured memory_bytes: 18584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		long w = sc.nextInt(), h = sc.nextInt();
		BigDecimal width = BigDecimal.valueOf(w);
		BigDecimal height = BigDecimal.valueOf(h);
		
		long x = sc.nextInt(), y = sc.nextInt();
		
		BigDecimal area = width.multiply(height);
		BigDecimal two = BigDecimal.valueOf(2);
		
		System.out.println(area.divide(two));
		if(x == 0 && y == 0) {
			System.out.println(0);
		}else if(x*2 == w && y*2 == h) {
			System.out.println(1);
		}else {
			System.out.println(0);
		}
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 33532
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Yes[2] = {"No", "Yes"};
string YES[2] = {"NO", "YES"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string a, b, c;
    cin >> a;
    cout << Yes[a[0] == a[2]];
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


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

int main(){
	ll n,a,b,cnt=0;
	cin>>n>>a>>b;
	for(int i=1; i<=n; i++){
		if(a<=i/10000+(i%10000)/1000+(i%1000)/100+(i%100)/10+i%10 and i/10000+(i%10000)/1000+(i%1000)/100+(i%100)/10+i%10<=b){
			cnt+=i;
			//cout<<i<<endl;
		}
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 256
let quick_sort (a : (int * char * int) array) cmp =
  let rec partition p r =
    let swap i j = let t = a.(i) in a.(i) <- a.(j); a.(j) <- t
    in
    let rec exchange i j =
      if j >= r then (swap (i + 1) r; i + 1)
      else if cmp a.(j) a.(r) <= 0 then (swap (i + 1) j; exchange (i + 1) (j + 1))
      else exchange i (j + 1)
    in exchange (p - 1) p
  and doit p r =
    if p < r then begin
      let q = partition p r in
      doit p (q - 1);
      doit q r
    end in
  doit 0 (Array.length a - 1)

let stable_p (a : (int * char * int) array) n =
  let rec doit i =
    if i = n - 1 then true
    else if (fun (xi, _, xd) (yi, _, yd) -> xd = yd && xi > yi) a.(i) a.(i+1) then false
    else doit (i + 1)
  in doit 0

let split str delim =
  let rec doit s acc =
    match
      try Some (String.rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        doit s1 (String.sub s (i + 1) (String.length s - String.length s1 - 1) :: acc)
  in doit str []

let () =
  let n = read_int () in
  let a = Array.init n (fun i ->
    match split (read_line ()) ' ' with
    | [c; d] -> (i, c.[0], int_of_string d)
    | _ -> exit 1
  ) in
  quick_sort a (fun (_, _, x) (_, _, y) -> compare x y);
  print_endline (if stable_p a n then "Stable" else "Not stable");
  Array.iter (fun (_, c, d) -> Printf.printf "%c %d\n" c d) a

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

int main() {
	string S;
	int C = 0;
	cin >> S;
	bool check = true;
	if (S[0] != 'A') check = false;
	for (int i = 2; i < S.size() - 1; i++) {
		if (S[i] == 'C') C = i;
	}
	if (C == 0) check = false;
	for (int i = 1; i < S.size(); i++) {
		int x = S[i];
		if (i != C) {
			if (x < 97 || 122 < x) check = false;
		}
	}
	if (check) cout << "AC" << endl;
	else cout << "WA" << endl;
}

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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for (int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

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

    int H, W;
    cin >> H >> W;
    vector<vector<int>> A(H, vector<int>(W));

    REP(i, H)
    {
        REP(j, W)
        {
            cin >> A[i][j];
        }
    }

    ll ans = llINF;

    REP(i, H)
    {
        REP(j, W)
        {
            ll sum = 0;

            REP(y, H)
            {
                REP(x, W)
                {
                    sum += A[y][x] * min(abs(i - y), abs(j - x));
                }
            }

            ans = min(ans, sum);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k,q; cin >> n >> k >> q;
    vector<int> ans(n);
    REP(i,q) {
        int a;cin >> a; --a;
        ++ ans[a];
    }
    REP(i,n) {
        cout << (k-(q-ans[i])>0 ? "Yes" : "No") << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;

ll n, a[maxn], test[maxn];
//2 4 12 2 8
int check(ll x) {
    test[0] = x;
    for (int i = 0; i < n - 1; ++i) {
        test[i + 1] = a[i + 1] - test[i];
    }
    if (a[0] - test[n - 1] == x) {
        return 998;
    }
    //少了
    if (a[0] - test[n - 1] > x) {
        return 1;
    }
    if (a[0] - test[n - 1] < x) {
        return 0;
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    ll l = 0, r = a[0], mid;
    while (l <= r) {
        mid = (l + r) >> 1;
        int e = check(mid);
        if (e == 998) {
            break;
        }
        if (e == 1) {
            l = mid + 1;
        } else {
            r = mid - 1;
        }
    }
    cout << 2 * test[n - 1] << ' ';
    for (int i = 0; i < n - 1; ++i) {
        cout << 2 * test[i] << ' ';
    }
//    cout << 2 * test[0] << '\n';
    return 0;
}


Measured memory_bytes: 2944
# ABC 135

N = int(input())
A = [int(i) for i in (input().split())]
B = [int(i) for i in (input().split())]
cnt = 0 
for i in range(len(A)-1):

    cnt += min(A[i]+A[i+1],B[i])
    if A[i] < B[i]:
        A[i+1] = max(A[i+1] - (B[i] - A[i]),0)
print(cnt)

Measured memory_bytes: 18624
#include<bits/stdc++.h>
using namespace std;
typedef long long  int ll;
int main()
{

  bool game=true;
 ll n,k,q;
 cin>>n>>k>>q;
 vector<ll >v(n+1,0);
 ll tot=q;
 for(ll  i=0;i<q;i++)
 {
     ll x;
     cin>>x;
     v[x]++;
 }

 for(ll  i=1;i<=n;i++)
 {
     if(k-(tot-v[i])<=0)
     {
         cout<<"No\n";
     }
     else
        cout<<"Yes\n";
 }
 }


Measured memory_bytes: 1408
n = int(input())
ans = [[0]*n for i in range(n)]

for i in range(n):
    inta = list(map(int,input().split(" ")))

    for j in inta[2:2+inta[1]]:
        ans[inta[0]-1][j-1] = 1

for i in ans:
    print(" ".join(map(str,i)))



Measured memory_bytes: 5672
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

int main() {
    while (true) {
      Int n;
      cin >> n;
      if (n == 0) break;
      vector<Int> x;
      for (Int i = 0; i < n; i++) {
          string s;
          cin >> s;
          x.emplace_back((Int)s.size());
      }
      for (Int i = 0; i < (Int)x.size(); i++) {
          Int a = 5, b = 7, c = 5, d = 7, e = 7;
          for (Int j = i; j < (Int)x.size(); j++) {
              if (a > 0) {
                  a -= x[j];
              }
              else if (b > 0) {
                  b -= x[j];
              }
              else if (c > 0) {
                  c -= x[j];
              }
              else if (d > 0) {
                  d -= x[j];
              }
              else if (e > 0) {
                  e -= x[j];
              }
              if (a < 0 || b < 0 || c < 0 || d < 0 || e < 0) break;
          }
          if (a == 0 && b == 0 && c == 0 && d == 0 && e == 0) {
              dump(i + 1);
              break;
          }
      }
    }
    return 0;
}


Measured memory_bytes: 3212
A,B,C,D = [int(i) for i in input().split()]
t = 0
while 0 < A and 0 < C:
    if t % 2 == 0:
        C -= B
    else:
        A -= D
    t += 1
if A <= 0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 9176
#include<iostream>
using namespace std;
int selectionSort(int a[], int n)
{
	int count = 0;
	for (int i = 0; i < n; i++)
	{
		int min = i;
		for (int j = i; j < n; j++)
		{
			if (a[j] < a[min])
			{
				min = j;
			}
		}
		int temp;
		temp = a[i];
		a[i] = a[min];
		a[min] = temp;
		if (i != min)
			count++;
	}
	return count;
}
int main()
{
	int a[100], n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int count = selectionSort(a, n);
	for (int i = 0; i < n; i++)
	{
		if (i > 0)
			cout << " ";
		cout << a[i];
	}
	cout << "\n";
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3136
#include<stdio.h>

int main()
{
	int a[1000], b[50];
	int n, m;
	int i, j;
	int k, l;
	int temp;

	for (i = 0; i < 1000; i++)
	{
		a[i] = 0;
	}

	k = 0;
	l = 0;

	k = scanf("%d %d", &n, &m);

	for (i = 0; i < m*2; i++)
	{
		l = scanf("%d", &temp);
		a[temp-1]++;
	}

	for (i = 0; i < n; i++)
	{
		printf("%d\n", a[i]);
	}
	
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long N = long.Parse(Console.ReadLine());
		string aaa = "abcdefghijklmnopqrstuvwxyz";
		long[]C = new long[26];
		string str = Console.ReadLine();
		for(var i=0;i<N;i++){
			C[aaa.IndexOf(str.Substring(i,1))]++;
		}
		long ans = 1;
		long mod = 1000000007;
		for(var i=0;i<26;i++){
			ans = ans * (C[i]+1) % mod;
		}
		Console.WriteLine((ans+mod-1)%mod);
	}
}

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/a.in", "r", stdin);
//  freopen("../IO/a.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}



void solve(std::istream &in, std::ostream &out) {
  int a, b, c;
  in >> a >> b >> c;
  swap(a, b);swap(a, c);
  out << a << ' ' << b <<  ' ' << c << '\n';
}


Measured memory_bytes: 256
n = int(input())

a = list(map(int,input().split()))

l = [0]*9


for i in a:
    if i >= 3200:
        l[8] +=1
    else:    
        l[i//400] +=1

b = [i for i in l[:8] if i > 0]
mx = 0
mn = 0

if len(b) >= 1:
    mx = len(b)+l[8]
    mn = len(b)
else:
    mx = len(b)+l[8]
    mn = 1
    
print(mn,mx)

Measured memory_bytes: 3064
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, sum = 0;
	cin >> N;
	VP A(N);
	VI ans(N, 0);
	VI B(N);
	map<int, int>mp;
	REP(i, N) {
		cin >> A[i].first;
		sum += A[i].first;
		A[i].second = -i;
		mp[A[i].first]++;
		B[i] = A[i].first;
	}

	vector<bool>F(N, false);
	int ma = 0;
	REP(i, N) {
		if (ma < A[i].first) {
			ma = A[i].first;
			F[i] = 1;
			//cout << i << endl;
		}
	}
	SORT(B);
	VI cnt(N + 1, 0);
	REP(i, N)cnt[i + 1] = cnt[i] + B[i];

	REP(i, N) if(F[i]){
		
		int a = A[i].first;
		int b = UB(B, a) - B.begin();
		
		ans[i] = sum - (cnt[N] - cnt[b] - a * (N - b));
		sum -= ans[i];
	}

	REP(i, N)cout << ans[i] << '\n';

	return 0;
}



Measured memory_bytes: 11264
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void LCS(char *x, char *y){
	int m = strlen(x+1);
	int n = strlen(y+1);
	int i, j, **c;

	c = malloc(sizeof(int)*(m+1000));
	for (i = 0; i <= m; i++)
		c[i] = malloc(sizeof(int)*(n+1));
	
	for (i = 0; i <= m; i++){
		for (j = 0; j <= n; j++){
			c[i][j] = 0;
		}
	}
	
	for (i = 1; i <= m; i++){
		for (j = 1; j <= n; j++){
			if (x[i] == y[j])
				c[i][j] = c[i - 1][j - 1] + 1;
			else if (c[i - 1][j] >= c[i][j - 1])
				c[i][j] = c[i - 1][j];
			else
				c[i][j] = c[i][j - 1];
		}
	}
	
	printf("%d\n", c[i-1][j-1]);
	for (i = 0; i < m; i++)free(c[i]);
	free(c);
	
}

int main(){
	int i, n;
	char x[1001], y[1001];

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%s%s", x + 1, y + 1);
		LCS(x, y);
	}
	return 0;
}

Measured memory_bytes: 4616
import collections
import math
n = int(input())
s_list = list(input())
c = collections.Counter(s_list)
ans = c["R"] * c["G"] * c["B"]
for i in range(n):
    for j in range(i + 1, n):
        k = j + j - i
        if k < n:
            if s_list[i] != s_list[j] and s_list[i] != s_list[k] and s_list[j] != s_list[k]:
                ans -= 1
print(ans)

Measured memory_bytes: 9456
#include <cstdio>
#include <algorithm>
int N, K, _a[2000002], *a = _a, rev;
char _i[200002];
int main()
{
	scanf("%d%d%s", &N, &K, _i + 1);
	for (int i = 1; i <= N; i++)
		a[i] = _i[i] == 'B';
	for (int T = std::min(K, 1000000); T--; )
	{
		K--;
		if (a[1] ^ rev)
		{
			a++;
			rev ^= 1;
			a[N] = rev;
		}
		else
			a[1] ^= 1;
	}
	putchar('A' + (a[1] ^ rev ^ N & K & 1));
	for (int i = 2; i <= N; i++)
		putchar('A' + (a[i] ^ rev));
	putchar(10);
	return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  ll ans = 0;
  rep(i,n){
    cin >> a[i];
  }
  if(a[0]!=0){ cout << -1 << ln; return 0; }
  REP(i,1,n){
    if(a[i]==1+a[i-1]){ ans++; continue; }
    if(a[i]>1+a[i-1]){ cout << -1 << ln; return 0; }
    ans += a[i];
  }
  cout << ans << ln;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
    
#define ll long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--)
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<char>	vc;
typedef vector<bool>	vb;
typedef pair<ll,ll> 	pll;
#define br "\n"
#define ff first
#define ss second
ll MAX =  (ll)1000005;
ll mod =  1e9 + 7;

vll v,a;
void solve(){
    ll n;
    cin >> n;
    v.resize(n);
    a.resize(n + 1);
    a[0] = 0;
    rep(i,0,n){
        cin >> v[i];
        a[i + 1] = (a[i] + v[i]) % mod;
    }
    ll ans = 0;
    rep(i,0,n){
        ans = (ans + (v[i]*((a[n] - a[i + 1]) + mod)) % mod) % mod;
    }
    cout << ans;

    
}
	

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif  

	ll t = 1;
	// cin >> t;
	rep(i,0,t){
		solve();
	}
 
}	

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Set = std::set<T>;
template<class T, class U>
using Map = std::map<T, U>;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

int main() {
    int x, y;
    cin >> x >> y;
    cout << ((
        (y-2*x) % 2 == 0 &&
        (4*x-y) % 2 == 0 &&
        (y-2*x) >= 0 &&
        (4*x-y) >= 0
    ) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3644