akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int main(){
    LCIN(N);
    map<LL,LL> mp1,mp2;
    REP(a,N){
        LCIN(b);
        if(a%2){
            mp1[b]++;
        }else{
            mp2[b]++;
        }
    }
    V<P> vec1,vec2;
    for(auto hoge:mp1){
        vec1.push_back(make_pair(hoge.second,hoge.first));
    }
    for(auto hoge:mp2){
        vec2.push_back(make_pair(hoge.second,hoge.first));
    }
    sort(ALL(vec1));
    sort(ALL(vec2));
    reverse(ALL(vec1));
    reverse(ALL(vec2));
    LL ans = LINF;
    if(vec1.front().second == vec2.front().second){
        if(vec2.size() >= 2)ans = min(ans,N/2-vec1.front().first + N/2-vec2.at(1).first);
        if(vec1.size() >= 2)ans = min(ans,N/2 - vec1.at(1).first + N/2 - vec2.front().first);
        if(vec1.size() == 1 && vec2.size() == 1)ans = min(N/2,ans);
    }else{
        ans = N/2-vec1.front().first+N/2-vec2.front().first;
    }
    COUT(ans);
    return 0;
}


Measured memory_bytes: 8824
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main(){
 string S,T;
  cin >> S>> T;
  T.pop_back();
  if(S == T)cout << "Yes"<<endl;
  else cout << "No" <<endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define int long long 
using namespace std;
int n,m,x,y,z,a[20][20],kk,f[20][40000],p[40000],sum;
inline int min(int x,int y){return x<y?x:y;}
inline int max(int x,int y){return x>y?x:y;}
signed main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;for (int i=1;i<=m;i++){
		cin>>x>>y>>z;if (x>y)swap(x,y);a[x][y]+=z;sum+=z;
	}kk=1<<n;for (int l=1;l<kk;l++)
		for (int i=1;i<=n;i++)if (l&(1<<(i-1)))
			for (int j=1;j<=n;j++)if (l&(1<<(j-1)))p[l]+=a[i][j];
	memset(f,200,sizeof(f));
	for (int i=1;i<kk;i++)if (i&1)f[1][i]=p[i];
	for (int i=1;i<kk;i++)
		for (int x1=1;x1<=n;x1++)if (i&(1<<(x1-1))){
			int P=(kk-1)^i;
			for (int x2=1;x2<=n;x2++)if (a[min(x1,x2)][max(x1,x2)])
				for (int j=P;j;j=(j-1)&P)if (j&(1<<(x2-1)))
					f[x2][i|j]=max(f[x2][i|j],f[x1][i]+a[min(x1,x2)][max(x1,x2)]+p[j]);
		}cout<<sum-f[n][kk-1]<<endl;
}

Measured memory_bytes: 6784
s = gets.chomp.split("")

n = s.length

if s.uniq.length == 1 then
  puts 0
elsif s.uniq.length == n then
  puts n / 2
else
  h = Hash.new(0)
  s.each do |c|
    h[c] += 1
  end
  ret = n
  h.each do |k, v|
    if v > 1 then
      ind = [0]
      cand = []
      s.each_with_index do |c, i|
        if c == k
          ind << i 
          cand << i - ind[-2] - 1
        end
      end
      cand[0] += 1
      cand << n-1 - ind[-1]
      ret = [ret, cand.max].min
    end
  end
  puts ret
end


Measured memory_bytes: 3836
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  int p[N];
  for(int i=0;i<N;++i) cin>>p[i];
  int ans = 0;
  for(int i=1;i<N-1;++i) {
    if((p[i-1]<p[i] && p[i]<p[i+1]) || (p[i-1]>p[i] && p[i]>p[i+1])) ans++;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 1000000000
#define LLINF 100000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int n,m;
int a[100100];
ll b[100100];
int l[100100],r[100100];
int d(int i){
	return (a[i+1]+m-a[i])%m;
}
int main(){
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> a[i];
		a[i]--;
	}
	for(int i=0;i<n-1;i++){
		r[a[i+1]]++;
		l[a[i]]++;
		b[a[i+1]]+=d(i)-1;
	}
	int k=0;
	for(int i=0;i<n-1;i++){
		if(a[i]>a[i+1] || a[i]==0)k++;
	}
	ll now = 0ll;
	for(int i=0;i<n-1;i++){
		if(a[i]>a[i+1])now+=a[i+1]+1;
		else now += a[i+1]-a[i];
	}
	ll ans = now;
	//cout << k << ' ' << now << endl;
	for(int x=1;x<m;x++){
		now = now-(k-l[x-1]-r[x-1])+b[x-1];
		k = k-r[x-1]+l[x];
		ans = min(ans,now);
		//cout << k << ' ' << now << endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include<algorithm>
using lint=long long;
using namespace std;

int main()
{
	lint in[2];
	
	cin >> in[0] >> in[1];
	sort(in,in+2);
	
	if(in[0]==1)
	{
		if(in[1]==1)
		{
			cout << 1 << endl;
			return 0;
		}
		cout << in[1]-2 << endl;
		return 0;
	}
	
	cout << (in[0]-2)*(in[1]-2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long n,a[129],ans;
char b[6]={0,'M','A','R','C','H'};
int main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		string s1;
		cin >> s1;
		a[s1[0]]++;
	}
	for(int i=1;i<=5;i++){
		for(int j=i+1;j<=5;j++){
			for(int k=j+1;k<=5;k++){
				ans+=a[b[i]]*a[b[j]]*a[b[k]];
			}
		}
	}
	cout << ans;
	return 0;
}

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


using namespace std;

int main()
{
    vector<int> Result;
    string temp;
    while(cin >> temp){
        if(temp == "0"){
            break;
        }

        int tempnum = 0;

        for(auto temps : temp){
            tempnum += temps - '0';
        }
        Result.push_back(tempnum);
    }

    for(auto b:Result){
        cout << b << endl;
    }
}

Measured memory_bytes: 3216
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

s = input()
if s == 'ABC':
    print('ARC')
else:
    print('ABC')

Measured memory_bytes: 72760
#include <iostream>
#include <algorithm>
#include <string>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
	int n, i, j, le[27][103] = {}, sans, ans;
	string s;

	cin >> s;

	n = s.size();

	for (i = 0; i < 26; i++) {
		le[i][0] = -1;
	}

	for (i = 0; i < n; i++) {
		le[s[i] - 'a'][i] = i;
	}

	for (i = 0; i < 26; i++) {
		for (j = 1; j < n; j++) {
			if (le[i][j] == 0) le[i][j] = le[i][j - 1];
		}
		le[i][n] = n;
	}

	ans = INF;
	for (i = 0; i < 26; i++) {
		sans = 0;
		for (j = 1; j <= n; j++) {
			if (le[i][j] != le[i][j - 1]) {
				sans = max(sans, le[i][j] - le[i][j - 1] - 1);
			}
		}
		ans = min(ans, sans);
	}

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] arr = sc.nextLine().split(" ");
		int n = Integer.parseInt(arr[0]);
		int k = Integer.parseInt(arr[1]);
		int[] seq = new int[n];
		arr = sc.nextLine().split(" ");
		for(int i=0; i<seq.length; i++)
			seq[i] = Integer.parseInt(arr[i]);
		sc.close();

		if(n==k) {
			System.out.println(1);
			return ;
		}
		if(k*2>n) {
			System.out.println(2);
			return ;
		}

		int minIndex=0;
		while(seq[minIndex]!=1)
			minIndex++;

		int min=Integer.MAX_VALUE;
		for(int i=0; i<k; i++) {
			int prevIndex = minIndex - (k-1) + i;
			int nextIndex = minIndex + i;
			int prevLength = prevIndex;
			int nextLength = n - nextIndex - 1;
			int count = 1 + (int)(Math.ceil((double)prevLength/(k-1))+Math.ceil((double)nextLength/(k-1)));
//			System.out.println("\t"+i+" : "+prevIndex+", "+nextIndex+" : "+prevLength+", "+nextLength+" : "+count);
			if (min>count)
				min=count;
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 48916
#include <cstdio>
#include <utility>

using namespace std;

//????????¢??°???

int partition( int n, int A[], int r){

    int x = A[ r ];
    int i, j;

    i = -1;

    for( int j = 0 ; j < r ; j++ ){

        if( A[j] <= x ){

            i = i + 1;

            swap( A[i], A[j]);

        }

    }

    swap( A[i+1], A[r] );

    return i+1;

}


//??¬???

int main(){

    int n, i, r, j;

    scanf("%d", &n);

    r = n - 1;

    int A[n];

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

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

    }

    j = partition( n, A, r);

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

        if(i) printf(" ");

        if( i == j ) printf("[%d]", A[i]);
        else printf("%d", A[i]);

    }

    printf("\n");

}

Measured memory_bytes: 2984
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  const int N_MAX = 1000000;
  int table[N_MAX];

  for (int i = 0; i < N_MAX; i++) {
    table[i] = 0;
  }
  table[0] = table[1] = 1;
  int sq = sqrt(N_MAX);
  for (int i = 2; i < sq+1; i++) {
    if (table[i] == 0) {
      for (int j = i*2; j < N_MAX; j += i) {
        table[j] = 1;
      }
    }
  }
  int n;
  while (cin >> n) {

    int ans = 0;
    for (int i = 0; i <= n; i++) {
      if (table[i] == 0) ans++;
    }
    cout << ans << endl;

  }

  return 0;
}

Measured memory_bytes: 0
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )
import Data.List ( sortBy )

readInt :: IO Int
readInt = fst . fromJust . C.readInt <$> C.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  n   <- readInt
  ass <- readInts
  print $ f n ass

sort' :: [Int] -> [Int]
sort' = sortBy (flip compare)

f :: Int -> [Int] -> Int
f n ass = h (sort' ass) n 0

h :: [Int] -> Int -> Int -> Int
h _        0 acc = acc
h (_:b:bs) n acc = h bs (n-1) (b+acc)


Measured memory_bytes: 51580
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c;
  while(cin>>a>>b>>c,a||b||c) {
    int N; cin >> N;
    int info_[4][N];
    FOR(i,0,N) FOR(j,0,4) cin >> info_[j][i];
    int info[a+b+c+1];
    FOR(i,0,a+b+c+1) info[i] = 2;
    // ???????????????????????¨?????????
    FOR(i,0,N) if(info_[3][i] == 1) FOR(j,0,3) info[info_[j][i]] = 1;

    // ?????????????????¨?????????
    FOR(i,0,N) {
      if(info_[3][i] == 0) {
        int cnt = 0;
        FOR(j,0,3) cnt += info[info_[j][i]];
        if(cnt == 4) {
          FOR(j,0,3) if(info[info_[j][i]] == 2) info[info_[j][i]] = 1000;
        }
      }
    }
    FOR(i,1,a+b+c+1) cout << (info[i] == 1000 ? 0 : info[i]) << '\n';
  }
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> Rsum(n,0);
  int Rmax = count(all(s),'R');
  Rsum[0] = Rmax;
  rep(i,n){
    if(i == 0) Rsum[i] -= s[i] == 'R';
    else Rsum[i] = Rsum[i-1] - (s[i] == 'R');
  }
  vector<int> Wsum(n,0);
  rep(i,n){
    if(i == 0) Wsum[i] = s[i] == 'W';
    else Wsum[i] = Wsum[i-1] + (s[i] == 'W');
  }
  //cout << 0 << Rmax << ",";
  //rep(i,n) cout << Wsum[i] << Rsum[i] << ",";
  int ans = Rmax;
  rep(i,n){
    ans = min(ans,max(Rsum[i],Wsum[i]));
  }
  cout << ans << endl;
}


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

const int INF = 1e9 + 7;

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

  int ans = INF;
  for ( int i = 0; i <= n; i++ ) {
    int ct = 0;
    // 6
    int use6 = i;
    while ( use6 > 0 ) { ct += use6%6; use6 /= 6; }
    // 9
    int use9 = n-i;
    while ( use9 > 0 ) { ct += use9%9; use9 /= 9; }
    ans = min(ans, ct);
  }

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


Measured memory_bytes: 3592
MAX = 1.0 / 0.0
class Node
  attr_accessor :c, :cf
  def initialize
    @c = {}
    @cf = {}
  end
end

def dfs(s, t, g)
  stack = [[s, MAX]]
  done = {}
  done[s] = true
  while stack.size > 0
    u = stack[-1][0]
    return stack if u == t
    flag = true
    g[u].cf.each{|v, c|
      next if done[v]
      next if c == 0
      done[v] = true
      stack << [v, c]
      flag = false
      break
    }
    if flag
      stack.pop
    end
  end
  return nil
end

vn, e = gets.split.map(&:to_i)
g = Array.new(vn){Node.new}
e.times{
  u, v, c = gets.split.map(&:to_i)
  g[u].c[v] = c
  g[u].cf[v] = c
}

sum = 0
loop do
  #detect path from s to t
  path = dfs(0, vn-1, g)

  if path
    #maximum flow by the path is
    max = MAX
    path.size.times{|i|
      max = path[i][1] if max > path[i][1]
    }
    sum += max

    #subtract the flow
    (path.size-1).times{|i|
      s = path[i][0]
      t = path[i+1][0]
      g[s].cf[t] -= max
      g[t].cf[s] ||= 0
      g[t].cf[s] += max
      if g[s].cf[t] == 0
        g[s].cf.delete(t)
      end
    }
  else
    #there is no path
    break
  end
end

p sum

Measured memory_bytes: 9564
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    long long N, M;
    cin >> N >> M;

    long long ans = 0LL;
    if (N == 1 && M == 1) {
        cout << 1 << endl;
    } else if (N == 1 || M == 1) {
        cout << 1LL * (max(M, N) - 2) << endl;
    } else {
        cout << (N - 2) * (M - 2) << endl;
    }
}

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

TWO = [2**i for i in range(0,18)]

ans = 0
for i in range(1,N+1):
    j = 0
    for t in TWO:
        if i*t >= K:break
        j += 1
    ans += 0.5 ** j
    
print(ans/N)

Measured memory_bytes: 3060
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

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

bool check(int N, int M, vector<vector<vector<int>>> &dp) {
    bool r = false;
    for (int x = 0; x < N; x++) {
        for (int y = 0; y < N; y++) {
            for (int z = 0; z < N; z++) {
                for (int i = 0; i < 13; i++) {
                    int xx = x;
                    int yy = y;
                    int zz = z;
                    int color = dp[x][y][z];
                    int count = 0;
                    while (xx >= 0 && xx < N && yy >= 0 && yy < N && zz >= 0 && zz < N && dp[xx][yy][zz] != -1 && dp[xx][yy][zz] == color) {
                        xx += dx[i];
                        yy += dy[i];
                        zz += dz[i];
                        count++;
                    }
                    if (count >= M) return true;
                }
            }
        }
    }
    return false;
}

int main() {

    while (true) {

        int N, M, P;
        cin >> N >> M >> P;

        if (!(N | M | P))break;

        //dp[x][y][z]
        vector<vector<vector<int>>> dp(N, vector<vector<int>>(N, vector<int>(N, -1)));

        int result = -1;
        int times;
        for (int i = 0; i < P; i++) {

            int x, y;
            cin >> x >> y;
            x--, y--;

            if (result != -1) continue;

            int turn = i % 2;
            int j = 0;
            while (dp[x][y][j] != -1) j++;
            dp[x][y][j] = turn;

            bool r = check(N, M, dp);
            if (r) result = turn, times = i;
        }

        if (result == -1) {
            cout << "Draw" << endl;
        }
        if (result != -1) {
            if (times % 2 == 0) {
                cout << "Black" << " " << times + 1 << endl;
            }
            if (times % 2 == 1) {
                cout << "White" << " " << times + 1 << endl;
            }
        }

    };

    return 0;
}






























































Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)


int main(){
    int N;
    int A[2][100];
    int S[3][100] = {};
    cin >> N;
    rep(i,N){
        cin >> A[0][i];
    }
    rep(i,N){
        cin >> A[1][i];
    }
    int tmp = 0;
    rep(i,N){
        S[0][i] = tmp + A[0][i];
        tmp = S[0][i];
    }
    tmp = 0;
    rep(i,N){
        S[1][N-1-i] = tmp + A[1][N-1-i];
        tmp = S[1][N-1-i];
    }
    int M=0;
    rep(i,N){
        M = max(M, S[1][i] + S[0][i]);
    }
    cout << M << endl;

    //cout <<  (flag ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
def factorize(n):
    fct = []  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop() 
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

N, M = list(map(int, input().split()))

if M == 1:
    print(1)
else:
    re = 1
    fa = factorize(M)
    div_list = divisorize(fa)

    for i in range(len(div_list)):
        num = 1
        for j in range(len(div_list[-1 - i])):
            l = div_list[-1-i][j]
            num *= l[0] ** l[1]
        d = M // num 
        if d >= N and num > re:
            re = num
    print(re)

Measured memory_bytes: 3064
def cin; gets.split.map(&:to_i) end
def cout(*x); puts x.join(" ") end

exit if $0 != __FILE__

INF = 10**18
a,b,qq = cin
s = Array.new(a) {gets.to_i}
s << -INF << INF
s.sort!
t = Array.new(b) {gets.to_i}
t << -INF << INF
t.sort!

#p s
#p t

qq.times do
  q = gets.to_i
  si = s.bsearch_index {|x| x >= q}
  ti = t.bsearch_index {|x| x >= q}

  r = INF
  [s[si-1], s[si]].each { |ss|
    [t[ti-1], t[ti]].each { |tt|
#      p "#{ss}, #{tt}"
      d1 = (ss - q).abs + (ss - tt).abs
      d2 = (tt - q).abs + (tt - ss).abs
      r = [r, d1, d2].min
    }
  }
  puts r
end

  

Measured memory_bytes: 7536
#include<stdio.h>
int main(){
  char c=0,s[10],b[300]={};
  int i;
  scanf("%s",s);//printf("a\n");
  for(i=0;s[i];i++)b[s[i]]++;
  for(i=0;i<300;i++){//printf("b\n");
    if(b[i]==2)c++;
  }//printf("c\n");
  printf("%s\n",c==2?"Yes":"No");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
int a[2][101];

cin>>n;
for(int i=0;i<2;i++){
	for(int j=0;j<n;j++){
		cin>>a[i][j];
	}
}
int max=0;
for(int i=0;i<n;i++){
	int tmp=0;
	for(int j=0;j<=i;j++){
		tmp+=a[0][j];
	}
	for(int k=i;k<n;k++){
		tmp+=a[1][k];
	}
	if(tmp>max) max=tmp;
}
cout << max << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int n, m;
    cin >> n >> m;
    
    cout << (n-1)*(m-1) << endl;
    
    return 0;
}

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

using namespace std;

const int N=2e5+5,OO=0x3f3f3f3f,M=1e9+7;
int t,n,m,k;
int forb[15];

bool cool(int x){
    while(x){
        if(forb[x%10])
            return 0;
        x/=10;
    }
    return 1;
}

int main() {
    cin>>n>>k;
    for(int i=0,a;i<k;++i)
        scanf("%d",&a),++forb[a];
    for(int i=n;;++i){
        if(cool(i)){
            cout<<i;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
import bisect
# import heapq # priolity-queue
# from time import time
# from itertools import product,permutations,\
    # combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

# mod = int(1e9+7)
mod = 998244353
INF = 1<<50

def readInt():
    return list(map(int,input().split()))

def main():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        ans += (n-1)//i
    print(ans)
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 8948
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>s;
	if(s=="ABC"){
		cout<<"ARC";
	}else{
		cout<<"ABC";
	}
	return 0;
}

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

def f(s):

    if int(s) > n:
        return 0

    if set(list(s)) == {"0", "3", "5", "7"}:
        ans = 1
    else:
        ans = 0

    for c in list("753"):
        ans += f(s + c)

    return ans

print(f("0"))

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

int main(){
  int x;
  cin >> x;
  for(int i=0;i<300;i++){
    for(int j=0;j<300;j++){
      if(i*i*i*i*i-j*j*j*j*j==x){
        cout << i << " " << j << endl;
        return 0;
      }
      else if(-(i*i*i*i*i)-j*j*j*j*j==x){
        cout << -i << " " << j << endl;
        return 0;
      }
      else if(i*i*i*i*i+j*j*j*j*j==x){
        cout << i << " " << -j << endl;
        return 0;
      }
      else if(-(i*i*i*i*i)+j*j*j*j*j==x){
        cout << -i << " " << -j << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 3580
#include <iostream>

using namespace std;

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

    cin >> n >> x;

    for(int i=0; i<n; i++)
    {
        cin >> l;
        
        sum += l;
        
        if(sum <= x) cnt++;

    }

    cout << cnt << endl;

    return 0;
}


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

using namespace std;

int main() {
  
  int N, K;
  while(cin >> N >> K && (N|K)) {
    int cnt = 0;
    vector<int> v(K);
    for(int i=0; i<K; i++) cin >> v[i];
    sort(v.begin(), v.end());
    bool zflag = false;
    if(v[0] == 0) zflag = true;
    int fst = 0, snd = 0;
    int len = 0;
    int zerocnt = 1;
    int prev = v[zflag];
    for(int i=1+zflag; i<K+1; i++) {
      if(i<K && prev+1 == v[i]) { snd = i; prev = v[i]; }
      else if(i < K && zflag && zerocnt) { zerocnt--; fst --; i--; prev ++; }
      else {
        len = max(len, snd-fst+1);
        fst = i;
        if(zflag) { zerocnt = 1; }
        prev = v[i];
      }
    }
    cout << len << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1272
#include<stdio.h>
int main()
{
   int N,M,t=0;
   scanf("%d%d",&N,&M);
  while(M--)
  {
      int A;
      scanf("%d",&A);
      t=t+A;
  }
  if(t<=N)
  {
      printf("%d\n",N-t);
  }
  else
    printf("-1\n");
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll =  long long ;
using P = pair<int,int> ;
const int INF = 1e9;
const int MOD = 1000000007;

ll gcd(ll i,ll j){
        if(j == 0) return i;
        return gcd(j,i%j);
}

int main(){
    int k;
    cin >> k;
    ll ans = 0;
    rep(p,k)rep(q,k){
        int now = gcd(p,q);
        rep(r,k) ans += gcd(now,r);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
a, b, c, d = gets.strip.split.map(&:to_i)
A = (a..b).to_a
B = (c..d).to_a
if (A+B).length - (A+B).uniq.length == 0
  puts 0
else
  puts (A+B).length - (A+B).uniq.length - 1
end

Measured memory_bytes: 1788
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int func(int x, int y){
    if(abs(y) > abs(x)){
        if(y>0) {
            if(x>0) {
                return y - x;
            } else {
                return 1 + x + y;
            }
        } else {
            if(x>0) {
                return -y-x+1;
            } else {
                return 2 + x - y;
            }
        }
    } else {
        if(y>0) {
            if(x>0) {
                return 1 + y + x;
            } else {
                return y - x;
            }
        } else {
            if(x>0) {
                return 1 + y + x;
            } else {
                return 2 + y - x;
            }
        }

    }
}
int f(int x, int y){
    if(y-x < 0) return MOD;
    return y - x;
}
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    int x, y; cin>>x>>y;
    int res = MOD;
    //res = min(res, func(x, y));
    //res = min(res, 1+func(-x, y));
    //res = min(res, 1+func(x, -y));
    //res = min(res, 2+func(-x, -y));
    res = f(x, y);
    res = min(res, 1+f(-x, y));
    res = min(res, 1+f(x, -y));
    res = min(res, 2+f(-x, -y));
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long W = sc.nextLong();
		long w[] = new long[N+1];
		long v[] = new long[N+1];
		
		for(int i=1; i<=N; i++){
			w[i]=sc.nextLong();
			v[i]=sc.nextLong();
		}
		
		int a=0;
		int b=0;
		int c=0; 
		int d=0;
		
		long va[] = new long[N+1];
		long vb[] = new long[N+1];
		long vc[] = new long[N+1];
		long vd[] = new long[N+1];
		
		va[0]=0;
		vb[0]=0;
		vc[0]=0;
		vd[0]=0;
		
		for(int i=1; i<=N; i++){
			if(w[i]==w[1]){
				a++;
				va[a]=v[i];
			}
			if(w[i]==w[1]+1){
				b++;
				vb[b]=v[i];
			}
			if(w[i]==w[1]+2){
				c++;
				vc[c]=v[i];
			}
			if(w[i]==w[1]+3){
				d++;
				vd[d]=v[i];
			}
		}
		
		Arrays.sort(va);
		Arrays.sort(vb);
		Arrays.sort(vc);
		Arrays.sort(vd);
		
				
		long sum=0;
		long sumtmp=0;
		for(int i=0; i<=a; i++){
			for(int j=0; j<=b; j++){
				for(int k=0; k<=c; k++){
					for(int m=0; m<=d; m++){
						sum=0;
						for(int n=N; n>N-i; n--){
							sum = sum + va[n];
						}
						for(int n=N; n>N-j; n--){
							sum = sum + vb[n];
						}
						for(int n=N; n>N-k; n--){
							sum = sum + vc[n];
						}
						for(int n=N; n>N-m; n--){
							sum = sum + vd[n];
						}
						double y = 10000000;
						double x = (double)(w[1]/y)*i+(double)((w[1]+1)/y)*j+(double)((w[1]+2)/y)*k+(double)((w[1]+3)/y)*m;
						
						if(x<=(double)(W)/y){
							if(sum>sumtmp){
								sumtmp=sum;
							}
						}
					}
				}
			}
		}
		System.out.println(sumtmp);
	}
}

Measured memory_bytes: 23048
#include <stdio.h>
#include <stdlib.h>

  int stack[100];
  int top=0;
void push(int num)
{

  if(top==100){
    printf("stack overflow\n");
    exit(2);
  }
  stack[top] = num;
  top++;
}

int pop(void)
{

  if(top==0){
    printf("stack is empty\n");
    exit(3);
  }
  top--;
  return stack[top];
}
int main(){
  int num1,num2,status,num;
  char str[100];

  while((status=scanf("%s",str))!=EOF){
    if(*str=='+'){
      num1=pop();
      num2=pop();
      push(num1+num2);
    }else if(*str=='-'){
      num2=pop();
      num1=pop();
      push(num1-num2);
    }else if(*str=='*'){
      num1=pop();
      num2=pop();
      push(num1*num2);
    }else{
      num=atoi(str);
      push(num);
    }

  }
  printf("%d\n",pop());

  return 0;
}





Measured memory_bytes: 2044
N = int(input())
A = list(map(int,input().split()))
B = [0,0]
i = 0
A.sort()
while(i < len(A) - 1):
  if A[i] == A[i + 1]:
    B.append(A[i])
    i += 1
  i += 1
print(B[len(B) - 1] * B[len(B) - 2])

Measured memory_bytes: 14100
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n, m;
	cin >> n >> m;

	long long ans = (long long) n * m;
	if (n > 1) {
		ans -= 2 * m;
	}

	if (m > 1) {
		ans -= 2 * n;
	}

	if (n > 1 && m > 1) {
		ans += 4;
	}

	cout << ans << "\n";

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#define fo(i,n) for(long long i=0;i<n;i++)
#define ll long long int
#define inf 999999999999999999
#define pb push_back
#define MOD 1000000007
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
//cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
//freopen("explicit.in", "r", stdin);
//freopen("explicit.out", "w", stdout);
 
void SieveOfEratosthenes() 
{ 
    bool prime[10000001];
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=10000000; p++) 
    { 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (ll i=p*p; i<=10000000; i += p) {
                prime[i] = false; 
            }
        } 
    }  
} 
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
	if(b%a==0)
	   return a;
	return gcd(b%a,a);
}
ll nCrModpDP(ll n, ll r, ll p) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C));   
    C[0] = 1;
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll nCrModp(ll n, ll r, ll p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
  
   return (nCrModp(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p; 
} 
ll a[2000005];
bool check(ll m,ll n,ll k)
{
	ll c=0;
	// cout<<m<<endl;
	for(ll i=0;i<n;i++)
	{
		if(a[i]%m==0)
		{
			c=c+a[i]/m-1;

		}
		else
		{
			c=c+a[i]/m;
		}
	}
	if(c<=k)
		return true;
	else
		return false;


}
int32_t main() 
{
    fio
	ll j,i,n,t,l,r,h,k,m,maxi,d,x;
	cin>>n>>k;
	
	for(j=0;j<n;j++)
		cin>>a[j];
	l=0;
	h=10000000000;
	ll ans;
	while(l<h-1)
	{
		m=l+(h-l)/2;
		if(check(m,n,k))
		{
			h=m;
			ans=m;
		}
		else
		{
			l=m;
		}
	}
	cout<<ans;

}



	

		

Measured memory_bytes: 5172
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
#define CAT(a,b)a b
#define VASIZE(a,b,N,...)N
template<class T>auto size(T&&a)->decltype(a.size(), int()) { return a.size(); }
template<class T, class = enable_if_t<is_integral<T>::value, T>>int size(T a) { return a; }
#define REP(t,a,N)for(int t=size(a),_l##t=size(N);t<_l##t;t++)
#define RREP(t,a,N)for(int t=size(N)-1,_l##t=size(a);t>=_l##t;t--)
#define rep(t,...)CAT(REP,VASIZE(__VA_ARGS__,(t,__VA_ARGS__),(t,0,__VA_ARGS__)))
#define rrep(t,...)CAT(RREP,VASIZE(__VA_ARGS__,(t,__VA_ARGS__),(t,0,__VA_ARGS__)))
#define all(a)(a).begin(),(a).end()
typedef long long ll;
typedef unsigned long long ull;
void Calc();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0); cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

/*---------------------------------------------------------------------*/

void Calc() {
  int n, k;
  in, n, k;
  auto d = in.Array(k);
  rep(i, n, (int)1e9) {
    string s = to_string(i);
    bool ok = true;
    for (auto& j : d) {
      if (s.find(j + '0') != string::npos) {
        ok = false;
        break;
      }
    }
    if (ok) {
      cout << (i) << endl;
      break;
    }
  }
}


Measured memory_bytes: 256
//author Eterna
#define Hello the_cruel_world!
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<utility>
#include<cmath>
#include<climits>
#include<deque>
#include<functional>
#include<numeric>
#define ABS(x) ((x) >= 0 ? (x) : (-(x)))
#define pb(x) push_back(x)
#define lowbit(x) ((x) & (-(x)))
#define FRIN freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\in.txt", "r", stdin)
#define FROUT freopen("C:\\Users\\Administrator.MACHENI-KA32LTP\\Desktop\\out.txt", "w", stdout)
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define outd(x) printf("%d\n", x)
#define outld(x) printf("%I64d\n", x)
#define memset0(arr) memset(arr, 0, sizeof(arr))
#define il inline
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int maxn = 1e5;
const int INF = 0x7fffffff;
const int mod = 1e9 + 7;
const double eps = 1e-7;
const double Pi = acos(-1.0);
inline int read_int() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
inline ll read_ll() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
char s[maxn + 5];
int n;
int solve(char st) {
	int res = 0;
	for (int i = 1; i <= n; ++i) {
		if (s[i] != st) ++res;
		if (st == '1')st = '0';
		else st = '1';
	}
	return res;
}
int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	//cout << n << endl;
	cout << min(solve('0'), solve('1')) << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 384
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    int m = sc.nextInt();
    String[] a = new String[n];
    String[] b = new String[m];

    for (int i = 0; i < n; i++) {
      a[i] = sc.next();
    }
    for (int i = 0; i < m; i++) {
      b[i] = sc.next();
    }

    for (int i = 0; i < n - m + 1; i++) {
      for (int j = 0; j < n - m + 1; j++) {
        if (check(i, j, m, a, b)) {
          os.println("Yes");
          return;
        }
      }
    }
    os.println("No");
  }

  private static boolean check(int x, int y, int m, String[] a, String[] b) {
    for (int j = 0; j < m; j++) {
      if(!a[y + j].substring(x, x + m).equals(b[j])) return false;
    }
    return true;
  }
}


Measured memory_bytes: 21844
import itertools

def calculateFunction(x, y, z):
    tmp = x + y + z
    return tmp * tmp - (x*y + y*z + z*x)

lis = []
for i in range(110):
    lis.append(i+1)

fullset = [0] * 10000
for team in itertools.product(lis, repeat = 3):
    ans = calculateFunction(team[0], team[1], team[2])
    if (ans <= 10000):
        fullset[ans - 1] += 1

X = int(input())

for i in range(X):
    print(fullset[i])

Measured memory_bytes: 9152
if __name__ == '__main__':
    n = int(input())
    s = list(input())
    ans = 0
    for i in range(10):
        for j in range(10):
            for k in range(10):
                pin = str(i) + str(j) + str(k)
                t = 0
                for x in s:
                    if pin[t] == x:
                        t += 1
                    if t == 3:
                        ans += 1
                        break
    print(ans)


Measured memory_bytes: 44460
#include<bits/stdc++.h>
using namespace std;
int main() {
    long long a,b,h,m;
    cin >> a >> b >> h >> m;
  a*= 1000000; b*= 1000000;
    double pi = 3.14159265358979323846;
    double kaku = ((double)(m*6 - h*30)-m/(double)2.0)*pi/(double)180.0;
    double c = 2.0*a*b*cos(kaku);
    double d = a*a+b*b-c;
    double k = sqrt(d)/1000000.0;
    printf("%.9f\n", k);
}

Measured memory_bytes: 4156
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;

int main() {
    int y, m, d;
    char i, j;
    cin >> y >> i >> m >> j >> d;
    if(m <= 4 and d <= 30) puts("Heisei");
    else puts("TBD");
}

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

using namespace std;

bool IsPrime(int num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
            return false;
    }
    return true;
}

int main()
{
  int n; cin >> n;
  int ans = 0;
  while(n)
  {
      int y; cin >> y;
      if(IsPrime(y)) ans++;
      n--;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,num;
	cin>>a>>b>>num;
	if (a<b)  swap(a,b);
	if (num%a==0)  cout<<num/a<<endl;
	else cout<<(num/a)+1<<endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
	cin.tie(NULL);
	cout.tie(NULL);
	int a,b,c,k;
	cin>>a>>b>>c;
	cin>>k;
	int i=0;
	while(b<=a)
	{
		i++;
		b*=2;
	}
	while(c<=b)
	{
		i++;
		c*=2;
	}
	if(i>k)
	cout<<"No"<<endl;
	else
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ull = unsigned long long;
using P = pair<int, int>;


ull E = 1000000007;

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == 'B') {
            s[i] = 0;
            for (int j = i - 1; j >= 0; --j) {
                if (s[j] != 0) {
                    s[j] = 0;
                    break;
                }
            }
        }
    }
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == 0) continue;
        cout << s[i];
    }
    cout << endl;
}


Measured memory_bytes: 888
N=input()
N=N.replace("A","0")
N=N.replace("T","0")
N=N.replace("G","0")
N=N.replace("C","0")
n=0
while n < 11:
  if "0"*(10-n) in N:
    print(10-n)
    break
  elif n==10:
    print(0)
    break
  else:
    n=n+1

Measured memory_bytes: 3064
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

void solve(string S, string T, ll A, ll B, string U) {
  cout << (U == S ? A - 1 : A) << " " << (U == T ? B - 1 : B) << endl;
}

int main() {
  string S;
  cin >> S;
  string T;
  cin >> T;
  ll A;
  cin >> A;
  ll B;
  cin >> B;
  string U;
  cin >> U;
  solve(S, T, A, B, U);
  return 0;
}


Measured memory_bytes: 256
from collections import deque

N,Q = list(map(int, input().split()))
tre = [[] for _ in range(N)]
val = [0] * N
for i in range(N-1):
    a,b = list(map(int, input().split()))
    tre[a-1].append(b-1)
    tre[b-1].append(a-1)

for i in range(Q):
    p,x = list(map(int, input().split()))
    val[p-1] += x

stack = deque([0])
visited = [False] * N
visited[0] = True
while stack:
    cur = stack.pop()
    for target in tre[cur]:
        if visited[target]:
            continue
        visited[target] = True
        stack.append(target)
        val[target] += val[cur]

print(*val)

Measured memory_bytes: 64768
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, M;
  cin >> N >> M;

  vector<bool> ok(N, false);
  vector<int> ng(N, 0);
  REP(i, M){
    int p;
    cin >> p; p--;
    string s;
    cin >> s;
    if(s == "AC") ok[p] = true;
    else{
      if(!ok[p]) ng[p]++;
    }
  }

  pair<int, int> ans = {0, 0};
  REP(i, N){
    if(ok[i]){
      ans.first++;
      ans.second += ng[i];
    }
  }

  cout << ans.first << " " << ans.second << "\n";

  return 0;
}

Measured memory_bytes: 1024