akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main() {
  int L,R; cin>>L>>R;
  if (R - L >= 2018) {
    cout << 0 << endl;
    return 0;
  }

  int R_L = R - L;
  int L_mod = L % 2019;
  int L_rem = 2019 - L_mod;
  if (R_L >= L_rem) {
    cout << 0 << endl;
  } else {
    int R_mod = R % 2019;
    int min_mod = 2019;
    for (int i = L_mod; i < R_mod; i++) {
      for (int j = i+1; j < R_mod+1; j++) {
        min_mod = min(min_mod, (i*j%2019));
      }
    }
    cout << min_mod << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>

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

using namespace std;

int main(void){
    
    int i,j=0,k = 0,l=0,m = 0,n= 0;
    double a,b,c,d,e,f;
    double x1[1000],x2[1000];
    double gyouretusiki;
    
    while((cin >> a >> b >> c >> d >> e >> f))
    {
        
        gyouretusiki = (a*e - d*b);
    
        x1[n] = (c/a) - (b/gyouretusiki)*(f -((d*c)/a));
    
        x2[n] = ((a) /(gyouretusiki))*(f-((d*c)/a));
        
        REP(i,5)
        {
            x1[n] = x1[n]*10;
            x2[n] = x2[n]*10;
        }
            x1[n] += 0.5;
            x2[n] += 0.5;
            x1[n] = (int)x1[n];
            x2[n] = (int)x2[n];
        REP(i,5)
        {
            x1[n] =x1[n]/10;
            x2[n] = x2[n]/10;
        }
        n++;
    }
    REP(i,n)
    printf("%.3f %.3f\n",x1[i],x2[i]);
    return 0;
    
}

Measured memory_bytes: 1244
#include <iostream>
#include <map>
#include <string>

int main()
{
  std::map<std::string, int> m;
  int n;
  std::cin >> n;
  for (int i = 0; i < n; ++i)
  {
    std::string s;
    std::cin >> s;
    m[s]++;
  }
  std::cin >> n;
  for (int i = 0; i < n; ++i)
  {
    std::string s;
    std::cin >> s;
    m[s]--;
  }
  
  int ans = 0;
  for (auto &p : m)
  {
    if (ans < p.second) ans = p.second;
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define priority_queue pque;
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
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<class T>inline bool chmax(T& a,T b){if(a < b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a > b){a=b;return true;}return false;};



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

  int n, k;
  cin >> n >> k;
  int h[n];
  rep(i, n) cin >> h[i];
  sort(h, h + n, greater<int>());

  int ans = 0;
  rep(i, n) {
    if(h[i] >= k) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
X, K, D = map(int, input().split())
k = abs(X)//D
dk = K-k
dd = min(abs(X-k*D), abs(X+k*D))

if dk>=0:
    if dk%2:
        print(min(abs(dd-D), abs(dd+D)))
    else:
        print(abs(dd))
else:
    print(min(abs(X-K*D), abs(X+K*D)))


Measured memory_bytes: 9192
#include <iostream> 
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

using ll = long long;
#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, a, n) for(int i = a; i < n; i++)
#define all(in) in.begin(), in.end()
int Sum(int array[], int p, int expect){
    int sum = 0;
    for(int i = 0; i < p; i++){
        if(i != expect) sum += array[i];
    }
    return sum;
}
int main(){
    int n, m;
    while(true){
        cin >> n >> m;
        if(n == 0 && m == 0)break;
        int T[n], H[m];
        int sum = 0;
        rep(i, n){

            cin >> T[i];
            sum += T[i];
        }
        rep(i, m){
            cin >> H[i];
            sum += H[i];
        }
        pair<int, int> ans;
        int anssum = INF;
        if(sum % 2  == 1){
            cout << -1 << endl;
            continue;
        }else{
            for(int i = 0; i < n; i++){
                for(int k = 0; k < m; k++){

                    int count = 0;
                    if(Sum(T, n, i) +  H[k] == Sum(H, m, k) + T[i]){
                        count = T[i] + H[k];
                        if(count < anssum){
                            ans.first = T[i], ans.second = H[k];
                            anssum = count;
                        }
                    }
                } 
            }

            if(anssum == INF){
                cout << -1 << endl;
            }else{
                cout << ans.first << " " << ans.second << endl;
            }

        }
    }

    return 0;
}


Measured memory_bytes: 2988
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	int n, m;
	cin >> n;
	vector<int>T(n);
	int res = 0;
	rep(i, n) {
		cin >> T[i];
		res += T[i];
	}
	cin >> m;
	vector<int>p(m), x(m);
	rep(i, m) {
		int ans = res;
		cin >> p[i] >> x[i];
		p[i]--;
		ans -= T[p[i]] - x[i];
		cout << ans << endl;
	}
	return 0;
}


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

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) a.begin(), a.end()

int bit(int a, int i) { return (a >> i) & 1; }

typedef long long ll;

const int MOD = 1e9 + 7;
const int N = 20, M = N * (N - 1) / 2;

void add(int &a, int b) {
	if ((a += b) >= MOD)
		a -= MOD;
}

int n, m, c[N][N], cnt[1 << (N - 1)];
struct Edge {
	int a, b;
} e[M];

int mask;
bool dfs(int a, int b, int p = -1) {
	if (a == b) {
		mask = 0;
		return 1;
	}
	forn(i, n)
		if (c[a][i] && i != p && dfs(i, b, a)) {
			mask |= 1 << (c[a][i] - 1);
			return 1;
		}
	return 0;
}

int f[1 << (N - 1)][M]; // 380mb = 10^6/2 * 190 * 4
int g[1 << (N - 1)][M]; 

void solve() {
	memset(c, 0, sizeof(c));
	memset(cnt, 0, sizeof(cnt));
	forn(i, m) {
		int a, b;
		cin >> a >> b, a--, b--;
		e[i] = {a, b};
		if (i < n - 1)
			c[a][b] = c[b][a] = i + 1;
		else {
			dfs(a, b), cnt[mask]++;
			// printf("%d -> %d : mask = %d\n", a, b, mask);
		}
	}

	int en = n - 1, all = 1 << en;
	// forn(i, all)
	// 	printf("cnt[%d] = %d\n", i, cnt[i]);
	forn(i, en)
		for (int mask = all - 1; mask > 0; mask--)
			if (bit(mask, i))
				cnt[mask] += cnt[mask ^ (1 << i)];
	// forn(i, all)
	// 	printf("sum_cnt[%d] = %d\n", i, cnt[i]);

	memset(f, 0, sizeof(f[0]) * all);
	memset(g, 0, sizeof(g[0]) * all);
	f[0][0] = 1;

	forn(mask, all) {
		int bn = 0;
		forn(i, n)
			bn += bit(mask, i);
		for (int e = cnt[mask]; e > 0; e--)
			if (f[mask][e]) {
				// printf("mask=%d e=%d : fix one free edge, [%d,%d] += %d\n", mask, e, mask, e - 1, f[mask][e]);
				add(f[mask][e - 1], (ll)f[mask][e] * e % MOD);
				add(g[mask][e - 1], (g[mask][e] + (ll)(en - bn) * f[mask][e]) * e % MOD);
			}
		forn(i, en)
			if (!bit(mask, i)) {
				int mask1 = mask | (1 << i), de = cnt[mask1] - cnt[mask];
				// printf("mask: %d -> %d, de = %d : %d -> %d\n", 
				// 	mask, mask1, de, cnt[mask], cnt[mask1]);
				forn(e, cnt[mask] + 1)
					if (f[mask][e]) {
						// printf("mask=%d e=%d : add vertex %d, [%d,%d] += %d\n", 
						// 	mask, e, i, mask1, e + de, f[mask][e]);
						add(f[mask1][e + de], f[mask][e]);
						add(g[mask1][e + de], g[mask][e]);
					}
			}
	}
	cout << (g[all - 1][0] + (ll)f[all - 1][0] * (en + 1) * en / 2) % MOD << endl;
}

int main() {
	while (cin >> n >> m && n)	
		solve();
}

Measured memory_bytes: 783928
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  int n, m; cin >> n >> m;
  vector<int> p(m);
  vector<string> s(m);
  rep(i,m) cin >> p[i] >> s[i];
  vector<int> ac(n,0), tmp(n,0);
  int pena=0;
  rep(i,m){
    if(s[i]=="AC"){
      if(ac[p[i]-1]==0) pena += tmp[p[i]-1];
      ac[p[i]-1]=1;
    }
    else if(s[i]=="WA" && ac[p[i]-1]==0) tmp[p[i]-1]++;
  }
  cout << accumulate(all(ac),0) << " " << pena;
  
return 0;
}


Measured memory_bytes: 6912
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  ll a[4];
  cin>>m;
  a[0]=m/1000;
  m = m - m/1000 * 1000;
  a[1]=m/100;
  m = m - m/100 * 100;
  a[2]=m/10;
  m = m - m/10 * 10;
  a[3]=m;
  for(int i = 0 ; i < 1<<4;i++){
    ll ans = a[0];
    rep(j,3){
      if(i>>j & 1) ans += a[j+1];
      else ans -= a[j+1];
    }
    if(ans == 7) {
      cout<<a[0];
      rep(j,3){
        if(i>>j & 1) cout<<"+"<<a[j+1];
        else cout<<"-"<<a[j+1];
      }
      cout<<"="<<7<<endl;
    return ;
    }
  }

}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

/* 二項係数 C(n,k) mod p を計算 */
const int MOD = 1000000007;
const int MAX = 201000;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
  COMinit();
  ll n,m,k; cin >> n >> m >> k;
  ll cx = 0, cy = 0;
  FOR(i,1,m){
    (cx += i*(m-i)%MOD) %= MOD;
  }
  (cx *= n*n%MOD) %= MOD;
  FOR(i,1,n){
    (cy += i*(n-i)%MOD) %= MOD;
  }
  (cy *= m*m%MOD) %= MOD;
  ll ans = (cx+cy)%MOD * COM(n*m-2,k-2) %MOD;
  cout << ans << endl;
}



Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	ini(n);
	vl a;
	map<ll,ll> map1;
	FOR(i,0,n){
		inl(x);
		a.push_back(x);
		map1[x]++;
	}
	ll total = 0;
	for(auto x1:map1){
		if(x1.second>=2){
			total+=(x1.second*(x1.second-1))/2;
		}
	}
	FOR(i,0,n){
		ll tmp = total;
		if (map1[a[i]] ==2) {
			tmp -= 1;
		}
		if(map1[a[i]]>2){
			tmp -=((map1[a[i]]*(map1[a[i]]-1))/2);
			tmp += (((map1[a[i]] - 1) * (map1[a[i]] - 2)) / 2);
		}
		out(tmp);
	}
	return 0;
}

Measured memory_bytes: 11120
#include<iostream>
#include<vector>
#define MAX 10
using namespace std;
int n, m, cnt = 0, p[MAX];
int sw[MAX];
vector<int> v[MAX];

void count(int sw[]){
  for ( int i = 0; i < m; i++){
    int on = 0;
    for ( int j = 0; j < v[i].size(); j++){
      int k = v[i][j];
      on += sw[k];
    }
    if ( on % 2 != p[i]){
      return;
    }
  }
  cnt ++;
}

void rec(int sw[], int pos){
  if ( pos > n){
    count(sw);
  } else {
    sw[pos] = 0;
    rec(sw, pos + 1);
    sw[pos] = 1;
    rec(sw, pos + 1);
  }
}

int main(){
  cin >> n >> m;
  int k, s;
  for ( int i = 0; i < m; i++){
    cin >> k;
    for ( int j = 0; j < k; j++){
      cin >> s;
      v[i].push_back(s);
    }
  }
  for ( int i = 0; i < m; i++){
    cin >> p[i];
  }

  rec(sw, 1);

  cout << cnt << endl;

  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 A = sc.next();
		String B = sc.next();
		String C = sc.next();
		sc.close();
		char c1 = A.charAt(A.length() - 1);
		char c2 = B.charAt(0);
		char c3 = B.charAt(B.length() - 1);
		char c4 = C.charAt(0);
		if(c1 == c2 && c3 == c4) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 22612
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
ans=0

for i in range(N):
    A=list(map(int,input().split()))
    total=C
    for j in range(M):
        total+=B[j]*A[j]
    if total>0:
        ans+=1

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
  int num_len =0;
  int num,basic_num;

  scanf("%d",&basic_num);
  num = basic_num;
  while(num !=0){
    num = num/10;
    num_len++;
  }

  if(num_len == 1){
    num = basic_num;
    printf("%d",num);
  }else if(num_len ==2){
    num = 9;
    printf("%d",num);
  }else if(num_len ==3){
    num = 9 + (basic_num-99);
    printf("%d",num);
  }else if(num_len ==4){
    num = 9 + 900;
    printf("%d",num);
  }else if(num_len ==5){
    num = 9 + 900 + (basic_num-9999);
    printf("%d",num);    
  }else if(num_len ==6){
    num = 9 + 900 + 90000;
    printf("%d",num);
  }
  return 0;
}
 

Measured memory_bytes: 128
import java.io.*;
import java.util.*;
class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	
    public static void main(String args[]) throws Exception
    {
		long n=sc.nextLong();long min=Long.MAX_VALUE;
		
		
		for(long i=1;i*i<=n;i++)
		{
			
			if(n%i==0)
			{
				min=Math.min(min,Math.max(Long.toString(i).length(),Long.toString(n/i).length()));
			}
		}
		
		out.println(min);out.close();
		
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

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

int main(){
  int N, T;
  cin >> N >> T;
  int minc = 999999;
  for(int i = 0; i < N; i++){
    int c, t;
    cin >> c >> t;
    if(t <= T){
      minc = min(minc, c);
    }
  }
  if(minc == 999999){
    cout << "TLE" << endl;
  }
  else{
    cout << minc << endl;    
  }
}
      



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
 
int main(){
  
  char a[4];
  char b[4];
  int sum=0;
  cin >>a;
  cin>>b;
 
  if (a[0]==b[0])
  sum++;
 if (a[1]==b[1])
  sum++;
   if (a[2]==b[2])
  sum++;
  cout <<sum;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define MMOD(i) ((i%MOD)+MOD)%MOD;
#define all(v) v.begin() , v.end()
#define vec(i,j) vector<vector<ll>>(i,vector<ll>(j,0))
const ll INF=99999999999999;
const ll MOD=1000000007;
const ll MAX_N=100010;
ll a,b,c,d,e,x,y,z,k,m,n,l,q,h,w,ans=0;
vl v(200001,1),v1,dp(200001);
vp p,p1;
string s;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
   cin>>n>>m;
   rep(i,m){
       cin>>a;
       v[a]=0;
   }

   dp[0]=1;
   dp[1]=1;
   for(ll i=2;i<n+1;i++){
       dp[i]=(dp[i-1]*v[i-1]+dp[i-2]*v[i-2])%MOD;
   }
   
   cout<<dp[n]<<endl;
}

Measured memory_bytes: 3456
//Badwaper gg
#include<bits/stdc++.h>
#define inf 1e9
#define eps 1e-6
#define mp make_pair
#define pb push_back
#define re register ll
#define fr first
#define sd second
#define FOR(i,a,b) for(re i=a;i<=b;i++)
#define REP(i,a,b) for(re i=a;i>=b;i--)
#define lowbit(x) x&(-x)
#define Z(x) (x>=mod?x-mod:x)
#define N 500010 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
inline ll read()
{
	char ch=getchar();
	ll s=0,w=1;
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
	return s*w;
}
const int mod=998244353;
int n,fac[N],inv[N],m,P;
inline int ksm(int a,int b)
{
	int ans=1;if(b<0)return 0;
	while(b){if(b&1)ans=1LL*ans*a%mod;b>>=1;a=1LL*a*a%mod;}
	return ans;
}
inline int C(int n,int m){if(n<m)return 0;return 1LL*fac[n]*inv[m]%mod*inv[n-m]%mod;}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),m=read();P=max(n,m);
	fac[0]=1;FOR(i,1,P)fac[i]=1LL*fac[i-1]*i%mod;
	inv[0]=inv[1]=1;FOR(i,2,P)inv[i]=1LL*(mod-mod/i)*inv[mod%i]%mod;
	FOR(i,1,P)inv[i]=1LL*inv[i-1]*inv[i]%mod;
	int ans=0,c=1;
	FOR(i,0,P)ans=Z(ans+1LL*c*C(n,i)%mod*C(m,i)%mod*fac[i]%mod*ksm(m+1,n-i)%mod*ksm(n+1,m-i)%mod),c=mod-c;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 7568
from collections import Counter
s = input().rstrip()

n = len(s)
dp = [0] * (n+1)

for i in range(n-1, -1, -1):
    dp[i] = (dp[i+1] + pow(10, (n-i-1), 2019) * int(s[i])) % 2019

c = Counter(dp)

ans = 0
for i in c.values():
    ans += i * (i-1) // 2

print(ans)

Measured memory_bytes: 70808
from collections import deque

n, q = map(int, input().split())
Q = deque()
for i in range(n):
    name,time = input().split()
    Q.append([name, int(time)])

sum =0
while Q:
    qt = Q.popleft()
    if qt[1] <= q:
        sum += qt[1]
        print(qt[0], sum)
    else:
        sum += q
        qt[1] -= q
        Q.append(qt)

Measured memory_bytes: 16224
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
 
		int money = 0;
 
		int n = sc.nextInt();
		int k = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
 
		for(int day = 1; day <= n; day++) {
 
			if(day <= k) {
				money += x;
			} else {
				money += y;
			}
		}
 
		System.out.println(money);
	}
 
}

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

int main(){
  int N;
  cin >>N;
  string box = "blender";
  int count=0;
  vector<string> S(N);
  for(int i=0;i<N;i++){cin >> S.at(i);}
  
  sort(S.begin(), S.end());
  
  for(int i=0;i<N;i++){
    if(box != S.at(i)){
      count++;
    }
    box = S.at(i);
  }
  cout <<count<<endl;
}

Measured memory_bytes: 9596
N,M=input().split()
N=int(N)
M=int(M)
H=input().split()
H=list(map(int,H))
my_list=[1]*N

for i in range(M):
  r,s=input().split()
  r=int(r)-1
  s=int(s)-1
  if H[r]>H[s]:
    my_list[s]=0
  elif H[r]<H[s]:
    my_list[r]=0
  else:
    my_list[r]=0
    my_list[s]=0

count=0
for j in my_list:
  count+=j
print(count)

Measured memory_bytes: 20048
import java.util.Arrays;
import java.util.Scanner;
public class Main { //A

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
      	if((X-7)*(X-5)*(X-3)==0){
         	System.out.println("YES"); 
        }else{System.out.println("NO");
        }
	}

}


Measured memory_bytes: 23252
#define _CRT_SECURE_NO_WARNINGS

//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
void Swap(int x[], int i, int j);


int N;
int P[3][100000];

void QSort(int x[], int left, int right)
{
	int i, j;
	int pivot;

	i = left;                      /* ソートする配列の一番小さい要素の添字 */
	j = right;                     /* ソートする配列の一番大きい要素の添字 */

	pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

	while (1) {                    /* 無限ループ */

		while (x[i] < pivot)       /* pivot より大きい値が */
			i++;                   /* 出るまで i を増加させる */

		while (pivot < x[j])       /* pivot より小さい値が */
			j--;                   /*  出るまで j を減少させる */
		if (i >= j)                /* i >= j なら */
			break;                 /* 無限ループから抜ける */

		Swap(x, i, j);             /* x[i] と x[j]を交換 */
		i++;                       /* 次のデータ */
		j--;
	}

	if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
		QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
	if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
		QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

void Swap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}

int fuck1(int p, int *start) {
	int n;
	int s = *start;
	int cnt = 0;
	for (n = s; n<N; n++) {
		if (P[0][n] < p) {
			if (n == N - 1) {
				cnt = N;
				return cnt;
			}
#ifdef DEBUG
			printf("fuck1 %d<%d continue\n", P[0][n], p);

#endif
			*start = n+1;
			continue;
		}
		cnt = n; 
#ifdef DEBUG
		printf("fuck1 cnt=%d\n", cnt);

#endif
		break;
	}
	return cnt;
}
int fuck2(int p, int *start) {
	int n;
	int s = *start;
	int cnt = 0;
	for (n = s; n<N; n++) {
		if (P[2][n] <= p) {
			if (n == N-1) {
				cnt = 0;
				return cnt;
			}
#ifdef DEBUG
			printf("fuck2 %d>%d continue\n", P[2][n], p);

#endif
			*start = n+1;
			continue;
		}
		cnt = N-n;
#ifdef DEBUG
		printf("fuck2 cnt=%d\n", cnt);
#endif
		break;
	}
	return cnt;
}

int main() {
#ifdef DEBUG

#endif
	scanf("%d", &N);

	int i, j;
	for (i = 0; i < 3; i++) {
		for (j = 0; j < N; j++) {
			scanf("%d", &P[i][j]);
		}
		QSort(P[i], 0, N - 1);
	}
	int start1 = 0;
	int start2 = 0;
	int cnt1, cnt2;
	long long int ans = 0;
	for (i = 0; i < N; i++) {
		cnt1 = fuck1(P[1][i], &start1); //
		cnt2 = fuck2(P[1][i], &start2); //

#ifdef DEBUG
		printf("cnt1=%d\n", cnt1); printf("cnt2=%d\n", cnt2);
#endif
		ans += (long long int)cnt1 * cnt2;
	}

	printf("%lld\n", ans);
}

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

using namespace std;

const int MOD = 998244353;

long long modPow(long long a, long long p){
    if(p == 0) return 1;
    auto res = modPow(a, p/2);
    res = (res*res)%MOD;
    if(p%2) res = (res*a)%MOD;
    return res;
}

int main(){
    int N; cin >> N;
    int maxSize = N+1;
	vector<long long> inv(maxSize);
	vector<long long> fact(maxSize);
	vector<long long> factInv(maxSize);
	for(int i=0;i<2;i++) inv[i] = fact[i] = factInv[i] = 1;
	for(int i=2;i<maxSize;i++){
		inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
		fact[i] = fact[i-1] * i % MOD;
		factInv[i] = factInv[i-1] * inv[i] % MOD;
	}
	auto comb = [&](int n, int r){
		if(n < r || r < 0) return 0LL;
		return fact[n] * factInv[n-r] % MOD * factInv[r] % MOD;
	};
    long long res = modPow(3, N);
    for(int i=N/2+1;i<=N;i++){
        res = (res + MOD - 2 * comb(N, i) * modPow(2, N-i) % MOD) % MOD;
    }
    cout << res << endl;
}

Measured memory_bytes: 234624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace AtCoder
{
    class Pair
    {
        public Pair(long a,long b)
        {
            this.right = b;
            this.left = a;
        }
        public long right;
        public long left;
    }

    class ball
    {
        public enum COLOR {B,R}
        public COLOR c = COLOR.R;
        public int num = 0;
    }

    class Program
    {
        static void Main(string[] args)
        {
            new BG042().slove();
            #if DEBUG
                Console.WriteLine("続行するには何かキーを押してください．．．");
                Console.ReadLine();
            #endif

        }
    }

    class BG042
    {
        public void slove()
        {
            var a = getLineLongs()[0];
            var b = getLineInts();
            var c = new int[b.Length+1];
            long i;
            for (i = 0; i < b.Length; i++)
            {
                c[b[i] - 1] = c[b[i] - 1] + 1;
            }
            for(i = 0; i < c.Length; i++)
            {
                puts(c[i]);
            }
        }


        public static int[] getCharInts()
        {
            //return getChar().Select(p => int.Parse(p.ToString())).ToArray();
            var a = new List<int>();
            var b = getChar();
            int i;
            for (i = 0; i < b.Count(); i++)
            {
                a.Add(int.Parse(b[i].ToString()));
            }
            return a.ToArray();
        }


        public static long[] getLineLongs()
        {
            return getLine().Select(p => long.Parse(p)).ToArray();
        }



        public static char[] getChar()
        {
            return getLine()[0].ToCharArray();
        }

        public static int[] getLineInts()
        {
            return getLine().Select(p => int.Parse(p)).ToArray();
        }

        public static String[] getLine()
        {
            String line = Console.ReadLine();
            String[] sp = line.Split(' ');
            if (sp.Length == 1)
            {
                //System.out.println(line);
                return new String[] { line };
            }
            else
            {
                return sp;
            }
        }
       

        void puts(Object mes)
        {
            Console.WriteLine(mes);
        }
    }


}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

ll gcd(ll a, ll b){
  if(a<b)
    return gcd(b, a);

  if(b == 0)
    return a;

  return gcd(b, a%b);

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

  ll a,b;
  cin >> a >> b;

  cout << a*b/gcd(a, b) << endl;
}


Measured memory_bytes: 256
(* int array -> int *)
let rec f n ans arr =
  if n = 0 then ans
  else
    let subarr = Array.sub arr 0 n in
    let c = Array.get arr n in
    let m = Array.fold_right max subarr c in
    if m <= c then f (n-1) (ans+1) arr
    else f (n-1) ans arr

let () =
  Scanf.scanf "%d\n"
    (fun n ->
       Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x))
       |> f (n-1) 1)
  |> print_int


Measured memory_bytes: 384
def factorization(n):
    m=n
    counter_map={}
    i=2
    tmp=1
    while n!=1:
        #因数に持つか判定
        if n%i==0:
            n=n//i
            #素数判定
            for j in range(2,int(i**(1/2))+1):
                if i%j==0:
                    break
            else:
                tmp*=i
                if i not in counter_map:
                    counter_map[i]=1
                    tmp=1
                else:
                    if tmp not in counter_map:
                        counter_map[tmp]=1
                        tmp=1
        else:
            i+=1
            tmp=1
        if i>int(m**(1/2)) and n!=1:
            counter_map[n]=1
            break
        #print(i,n,counter_map)
    return counter_map


a=int(input())
b=factorization(a)
#print(b)
sum=0

# for i in b.keys():
#     counter=0
#     for j in range(1,41):
#         if b[i]>=1+(j+2)*(j-1)//2:
#             counter=j
#         else:
#             break
#     sum+=counter

# print(sum)

print(len(b))


Measured memory_bytes: 64884
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
static long[] check = new long[2];

	static void Main()
	{
    bool isAnswer = true;
    long answer = 0;
    long lookedMemo = -1;
		int n = int.Parse(Console.ReadLine());
		long[] numsaa = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long[] numsbb = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);

    long[][] numsa = new long[n][];//数と初期位置番号
    long[][] numsb = new long[n][];
    for(int i = 0; i < n; i++)
    {
      numsa[i] = new long[2];
      numsb[i] = new long[2]; 
      numsa[i][0] = numsaa[i];
      numsa[i][1] = i;
      numsb[i][0] = numsbb[i];
      numsb[i][1] = i;
    }
    Array.Sort(numsb, (a, b) => b[0].CompareTo(a[0]));

    List<long[]> list = new List<long[]>();
    for(int i = 0; i < n; i++)
      list.Add(new long[2]{numsb[i][0], numsb[i][1]});

    while(list.Count > 0)
    {
      list = PopHeap(list);
      long minusNum = 0;//引く値
      if(check[1]-1 >= 0) minusNum += numsbb[check[1]-1];
      else minusNum += numsbb[n-1];
      if(check[1]+1 < n) minusNum += numsbb[check[1]+1];
      else minusNum += numsbb[0];

      //Console.WriteLine(check[0]+" "+check[1]);

      if(check[0] < numsaa[check[1]] || lookedMemo == check[1])
      {
        isAnswer = false;
        break;
      }

      long maxMinus = (check[0] - numsaa[check[1]])/minusNum;//最大何回引けるか
      answer += maxMinus;
      check[0] -= minusNum*maxMinus;
      numsbb[check[1]] -= minusNum*maxMinus;
      lookedMemo = check[1];
      //Console.WriteLine(check[0]+"a"+check[1]);

      if(check[0] != numsaa[check[1]]) list = PushHeap(list, new long[2]{check[0],check[1]});
      //Console.WriteLine(list.Count);
    }

		if(isAnswer) Console.WriteLine(answer);
    else Console.WriteLine(-1);
	}

  static List<long[]> PushHeap(List<long[]> nums, long[] addNum)//現在のヒープnumsにaddNumを追加
{
  int n = nums.Count;
  nums.Add(addNum);

  while (n > 0)
  {
    int i = (n-1)/2;
    if (nums[n][0] > nums[i][0])//親のほうが大きいなら入れ替え。
    {
      long tmp0 = nums[n][0];
      long tmp1 = nums[n][1];
      nums[n][0] = nums[i][0];
      nums[n][1] = nums[i][1];
      nums[i][0] = tmp0;
      nums[i][1] = tmp1;
    }
    n = i;
  }
  return nums;
}

static List<long[]> PopHeap(List<long[]> nums)//ヒープnumsからポップ
{
  int n = nums.Count - 1;
  check[0] = nums[0][0];//捨てる値の保存
  check[1] = nums[0][1];
  nums[0][0] = nums[n][0];//最小値である根を削除してリストの最後を持ってくる
  nums[0][1] = nums[n][1];
  nums.RemoveAt(n);

  for (int i = 0, j; (j = 2*i+1) < n; )
  {
    if ((j != n-1) && (nums[j][0] < nums[j+1][0]))// ２つの子のうち、値の小さい方を選ぶ
      j++;
    if (nums[i][0] < nums[j][0])//子が親より小さいなら入れ替え
    {
    long tmp0 = nums[j][0];
    long tmp1 = nums[j][1];
    nums[j][0] = nums[i][0];
    nums[j][1] = nums[i][1];
    nums[i][0] = tmp0;
    nums[i][1] = tmp1;
    }
    i = j;
  }
  return nums;
}
  
}

Measured memory_bytes: 67172
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
//ll dx[4] = {1, 0, -1, 0};
//ll dy[4] = {0, 1, 0, -1};

vector<ll> g[114514];
vector<ll> h[114514];
bool used[114514] = {};
ll d[114514][3];
ll d2[114514][3];

int main() {
	IOS();
	ll n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		ll u, v;
		cin >> u >> v;
		g[u].push_back(v);
		h[v].push_back(u);
	}
	ll s, t;
	cin >> s >> t;

	queue<P> que;
	que.emplace(s, 0);
	Fill(d, INF);
	d[s][0] = 0;

	while (!que.empty()) {
		P p = que.front();
		que.pop();
		for (int i = 0; i < g[p.first].size(); i++) {
			int next = g[p.first][i];
			ll mod   = (p.second + 1) % 3;
			if (d[next][mod] > p.second + 1) {
				que.emplace(next, p.second + 1);
				ll x =
					d[next][mod] = p.second + 1;
			}
		}
	}
	que.emplace(t, 0);
	Fill(d2, INF);
	d2[t][0] = 0;
	while (!que.empty()) {
		P p = que.front();
		que.pop();
		for (int i = 0; i < h[p.first].size(); i++) {
			int next = h[p.first][i];
			ll mod   = (p.second + 1) % 3;
			if (d2[next][mod] > p.second + 1) {
				que.emplace(next, p.second + 1);
				d2[next][mod] = p.second + 1;
			}
		}
	}
	ll ans = INF;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < 3; j++) {
			ll tmp = d[i][j] + d2[i][(3 - j) % 3];
			ans	= min(ans, tmp / 3);
		}
	}
	dump(ans > 1e7 ? -1 : ans);

	return 0;
}


Measured memory_bytes: 17408
#include <iostream>
using namespace std;
string s;
string yomi(int a,int b){
  string ret;
  for(int i = a; b >= i; i++){
    ret.push_back(s[i]);
  }
  return ret;
}
int main(){
  cin>>s;
  int q; cin>>q;
  for(int i = 0; q > i; i++){
    string sq;int a,b;cin>>sq>>a>>b;
    if(sq == "print"){
      for(int j = a; b >= j; j++){
        cout << s[j];
      }
      cout << endl;
    }else if(sq == "reverse"){
      string tmp = yomi(a,b);
      for(int j = b; a <= j; j--){
        s[j] = tmp[b-j];
      }
    }else if(sq == "replace"){
      string c;cin>>c;
      for(int j = a; b >= j; j++){
        s[j] = c[j-a];
      }
    }
    
  }
}


Measured memory_bytes: 3192
#114c
import math

N = int(input())

#1 以上 N 以下の整数のうち、七五三数 は何個あるでしょうか？
#ここで、七五三数とは以下の条件を満たす正の整数です。
#    十進法で表記したとき、数字 7, 5, 3 が「それぞれ」 1 回以上現れ、これら以外の数字は現れない。

def search_max(under_list,ans):
    next_list = []
    top_multiplication = 10**(int(math.log10(under_list[0]))+1)
    
    for i in [3,5,7]:
        for j in under_list:
            number = i*top_multiplication + j
            
            if N >= number:
                next_list.append(number)
                
                #七五三数かのチェック
                set_number = set((str(number))) 
                if "3" in set_number and "5" in set_number and  "7" in set_number:
                    ans += 1
                    #print(number)
            else:
                #Nを超えたら終了
                return ans
    
    #桁を増やしてさらに探索
    return search_max(next_list,ans)

if N < 357:
    print(0)
else:
    under_list = [3,5,7]
    ans = search_max(under_list,0)
    print(ans)

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    int N,K;
    string S,result = "";
    cin >> N >> S >> K;
    char target = S.at(K-1);
    VI Mo(N);
    REP(i,N){
        Mo[i]=S.at(i);
        if(Mo[i]!=target){
            Mo[i]='*';
        }
    }
    REP(i,N){
        result += Mo[i];
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long  n,n1,k=0;
    cin>>n;
    int i;
    for(i=1;i<=n;i++)
    {
        cin>>n1;
        if(n1!=i)
            k++;
    }
    if(k<=2)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int> > vp;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define out(n) cout << (n) << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int n, m, d[100001] = {0};
  cin >> n >> m;

  int a, b;
  rep(i, 0, m) {
    cin >> a >> b;
    d[a]++, d[b]++;
  }

  rep(i, 0, n + 1) {
    if(d[i] & 1) {
      out("NO")
      return 0;
    }
  }

  out("YES")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
typedef long long ll;
#define dbg          cout<<"Freak"<<endl;
#define dbgg(i)      cout<<i<<endl;
using namespace std;
ll t;
ll arr[200005];
int main()
{
    ll a,b,c,d,e,f,i,j;
    cin>>a>>b;
    f=a;
    while(a--)
    {
        cin>>t;
        while(t--)
        {
            cin>>c;
            arr[c]++;
        }
    }
    d=0;
    for(i=1;i<=b;i++)
    {
        if(arr[i]==f)d++;
    }
    cout<<d<<endl;

return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define REP1(i,n) for(long long i=1;i<=(n);i++)
#define REP2D(i,j,h,w) for(long long i=0;i<(h);i++) for(long long j=0;j<(w);j++)
#define REP2D1(i,j,h,w) for(long long i=1;i<=(h);i++) for(long long j=1;j<=(w);j++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();++ite)
#define ALL(a) ((a).begin()),((a).end())
#define RANGE(a) (a),((a)+sizeof(a))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define ENTER printf("\n")
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<(a)<<endl
#ifdef DEBUG
#define DBPRT(a) cout << "[Debug] - " << #a << " : " << (a) << endl
#define DBSTART if(1){
#define DBEND }
#else
#define DBPRT(a) do{}while(0)
#define DBSTART if(0){
#define DBEND }
#endif
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
#define PRTLST2D(arr2,d1,d2) do{cout<<"L\t";REP(_i,d2) cout<<_i<<"\t"; cout<<endl; REP(_i,d1){cout<<_i<<"\t";REP(_j,d2){cout<<arr2[_i][_j]<<"\t";}cout<<endl;}}while(0);

#define TOSUM(arr,sum,n) {sum[0]=arr[0];REP1(i,n-1) sum[i]=sum[i-1]+arr[i];}

#define MIN(target,v1) (target)=min(target,v1)
#define MAX(target,v1) (target)=max(target,v1) 
#define P1 first
#define P2 second
#define PB push_back
#define UB upper_bound
#define LB lower_bound
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,0,1,1,0,0,-1};
const int Move_[8][2] = {-1,0,-1,-1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p) {os<<"( "<<p.P1<<" , "<<p.P2<<" )";return os;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {ITE(v) os << (ite-v.begin()) << " : " << *ite <<endl;return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v) {os<<" { ";ITE(v) {os<<*ite;if(ite!=--v.end()){os<<" , ";}} os<<" } ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& m) {ITE(m) {os<<ite->P1<<"\t\t|->\t\t"<<ite->P2<<endl;} return os;}

//---------------------
#define MAXN 55
//---------------------

ll n;
ll d[MAXN];

int main(){
	cin >> n;
	REP(i,n) cin >> d[i];
	ll res = 0;
	REP(i,n-1) FOR(j,i+1,n){
		res += d[i]*d[j];
	}
	PRT(res);
	return 0;
}









Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int L,R,d;
    cin>>L>>R>>d;
    int cou=0;
    for(int i=L;i<=R;i++){
        if(i%d==0)cou++;
    }
    cout<<cou<<endl;
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a[13] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1}, b, c;
    cin >> b >> c;
    if (a[b] == a[c]) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int K, A, B, x, y, flag = 0;
    scanf("%d", &K);
    scanf("%d %d", &A, &B);
    for(x=A; x<=B; x++){
        y=x%K;
        if(y==0){
            flag++;
            break;
        }
    }
    if(flag>0) printf("OK\n");
    else printf("NG\n");
    return 0;
}


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



int main() 
{
    int n;
    cin >> n;
    map<int, int> mp;
    for (int i = 1; i <= n;i++)
    {
        int a;
        cin >> a;
        mp[a] = i;
    }

    for (int i = 1; i <= n;i++)
    {
        cout << mp[i] << " ";
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 5504
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

unsigned countBits(int number)
{      
    return (int)log2(number)+1;
}

int main() {
    int n;
    cin>>n;
    long long lst[n] = {};
    long long maxLength = 60;
    for(int i = 0; i < n; i += 1) {
      cin>>lst[i];
    }
    
    long long olstmaxLength[maxLength] = {0};
    for(int i = 0; i < n; i += 1) {
    
        for(int j = 0; j < maxLength; j += 1) {
          if((lst[i]&(1ll<<j)) == (1ll<<j)) {
        	olstmaxLength[j] += 1;
          }
        }
    }
    
    long long mod = 1e9+7;
    
    long long sum = 0;
    for(int i = 0; i < maxLength; i += 1) {
        sum = (sum + (1ll<<i)%mod*olstmaxLength[i]%mod*(n-olstmaxLength[i]))%mod;
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 2560