akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 35,inf = 1e9;
int n,m,q,tot,cnt[N],id[N][N];
ll pre[100010];
struct node{
	ll s,p,c;
}a[N][N];

namespace MCMF{
	const int N = 1010, M = 10010;
	int tot=-1,first[N],to[M<<1],last[M<<1];
	ll flow[M<<1],cost[M<<1];
	inline void init(){
		fil(first,-1);
	}
	inline void add(int x,int y,ll w,ll f){
		to[++tot]=y,flow[tot]=w,cost[tot]=f,last[tot]=first[x],first[x]=tot;
	}
	inline void Add(int x,int y,ll w,ll f){
		add(x,y,w,f),add(y,x,0,-f);
	}
	const ll inf = 1ll<<60;
	ll dis[N],Flow[N];
	int pre[N],pos[N];
	bool vis[N];
	inline bool spfa(int s,int t,int n){
		For(i,1,n) vis[i]=0,dis[i]=Flow[i]=inf;
		queue<int>q;q.push(s),dis[s]=0;
		while (!q.empty()){
			int u=q.front();q.pop(),vis[u]=0;
			for (int i=first[u];i!=-1;i=last[i]){
				int v=to[i];
				if (dis[u]+cost[i]<dis[v]&&flow[i]){
					dis[v]=dis[u]+cost[i],Flow[v]=min(Flow[u],flow[i]),pre[v]=u,pos[v]=i;
					if (!vis[v]) q.push(v),vis[v]=1;
				}
			}
		}
		return dis[t]!=inf;
	}
	inline vector<ll> solve(int S,int T,int n){
		vector<ll>ans;
		while (spfa(S,T,n)){
			if (Flow[T]>100000000) return ans.pb(dis[T]),ans;
			For(i,1,Flow[T]) ans.pb(dis[T]);
			for (int i=T;i!=S;i=pre[i]) flow[pos[i]]-=Flow[T],flow[pos[i]^1]+=Flow[T];
		}
		return ans;
	}
};

int main(){
	n=read();
	int S=1,T=2;
	tot=2,MCMF::init();
	For(i,1,n){
		cnt[i]=read(),id[i][0]=++tot;
		For(j,1,cnt[i]){
			a[i][j]=(node){read(),read(),read()};
			id[i][j]=++tot;
		}
		MCMF::Add(S,id[i][0],inf,0),MCMF::Add(id[i][cnt[i]],T,inf,0);
		sort(a[i]+1,a[i]+1+cnt[i],[](node a,node b){
			return a.s<b.s;
		});
		For(j,1,cnt[i]){
			MCMF::Add(id[i][j-1],id[i][j],a[i][j].p,0);
			MCMF::Add(id[i][j-1],id[i][j],1e9,a[i][j].c);
		}
	}
	m=read();
	while (m--){
		int u=read(),v=read(),w=read(),l=0;
		For(i,1,cnt[u]){
			while (l<cnt[v]&&a[v][l+1].s<=a[u][i].s+w) ++l;
			if (l==cnt[v]) break;
			MCMF::Add(id[v][l],id[u][i],1e9,0);
		}
	}
	auto p=MCMF::solve(S,T,tot);
	pre[0]=p[0];
	FOR(i,1,siz(p)) pre[i]=pre[i-1]+p[i];
	q=read();
	while (q--){
		ll A=read();
		int pos=lower_bound(all(p),A)-p.begin();
		if (pos==siz(p)) puts("-1");
			else printf("%lld\n",A*pos-(pos==0?0:pre[pos-1]));
	}
}

Measured memory_bytes: 4108
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, y = [int(x) for x in input().split()]
    A = 10000
    B = 5000
    C = 1000
    a = y // A
    y %= A
    b = y // B
    y %= B
    c = y // C
    total = a + b + c
    while total < n:
        if n - total > 3 and b:
            b -= 1
            c += 5
            total += 4
        elif a:
            a -= 1
            b += 2
            total += 1
        else:
            break

    if total != n:
        print(-1, -1, -1)
    else:
        print(a, b, c)



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""


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

int main(){
    int h,w;
    cin >> h >> w;
    char x[h+2][w+2] = {};
    int count[h+2][w+2] = {};
    for(int i = 1; i < h+1; i++){
        for(int j = 1; j < w+1; j++){
            cin >> x[i][j];
        }
    }
    for(int i = 1; i < h+1; i++){
        for(int j = 1; j < w+1; j++){
            if(x[i][j] == '#'){
                count[i][j] += 100;
                count[i-1][j-1] += 1;
                count[i-1][j] += 1;
                count[i-1][j+1] += 1;
                count[i][j-1] += 1;
                count[i][j+1] += 1;
                count[i+1][j-1] += 1;
                count[i+1][j] += 1;
                count[i+1][j+1] += 1;
            }
        }
    }
    for(int i = 1; i < h+1; i++){
        for(int j = 1; j < w+1; j++){
            if(count[i][j] >= 100){
                cout << '#';
            }else{
                cout << count[i][j];
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""

int prime[1001];
void prime_factor(int n){
  for(int i=2; i*i<=n; i++){
    while(n%i == 0){
        prime[i]++;
        n /= i;
    }
  }
  if(n != 1) prime[n]++;
}


int main(void)
{
    int N;cin>>N;
    long long ans = 1;
    for(int i=2; i<=N; i++) prime_factor(i);

    for(int i=2; i<=N; i++){
      if(prime[i]>0) ans = ans*(prime[i]+1) % MOD;
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Control.Monad

readString = map BS.unpack . BS.words
readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words

getString = readString <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getNString n = map readString <$> replicateM n BS.getLine

pp (ss:sss) = do
  putStrLn $ "#" ++ concat ss ++ "#"
  when (sss /= []) $ pp sss

main = do
  [h, w] <- getIntList
  sss <- getNString h
  let line = replicate (w + 2) '#'
  putStrLn line
  pp sss
  putStrLn line

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


int main() {
  int n, k, r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p >> t;

  int r_count = 0, s_count = 0, p_count = 0;

  for (int j = k; j < n; j++) {
    if (t.at(j) == t.at(j - k)) {
      t.at(j) = 'x';
    }
  }

  
  for (int i = 0; i < n; i++) {
    if (t.at(i) == 'r') {
      p_count++;
    } else if (t.at(i) == 's') {
      r_count++;
    } else if (t.at(i) == 'p'){
      s_count++;
    }
  }

    
  long long get_point;
  get_point = r_count * r + s_count * s + p_count * p;
  cout << get_point;
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

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

int main() {
	cout << 7 << endl << 11 << endl << 53 << endl;
	return 0;
}

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

using namespace std;

int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(a<b&&b<c)
  {
      cout <<"Yes" << endl;
  }
  else
  {
      cout << "No" << endl;
  }
  
  return(0);

}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

int main(){
    vector<ll> v = {0, 1, 2, 3};
    vector<vector<bool>> edges(4, vector<bool>(4, 0));
    for(ll i = 0; i < 3; i++) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        edges[a][b] = edges[b][a] = 1;
    }
    bool ok = 0;
    do {
        bool tmp = 1;
        for(ll i = 0; i < 3; i++) tmp &= edges[v[i]][v[i + 1]];
        ok |= tmp;
    }while(next_permutation(v.begin(), v.end()));
    cout << (ok ? "YES\n" : "NO\n");
    return 0;
}


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

using namespace std;

const int N = 1234567;

int dist[N];
vector < pair <int, int> > g[N];
vector <int> new_g[N], all[N];
int was[N];
int x[N];
int ptr[N];

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int foo, bar, qwe;
    scanf("%d %d %d", &foo, &bar, &qwe);
    foo--; bar--;
    g[foo].push_back(make_pair(qwe, bar));
    g[bar].push_back(make_pair(qwe, foo));
    all[qwe].push_back(foo);
    all[qwe].push_back(bar);
  }
  for (int i = 0; i < n; i++) {
    sort(g[i].begin(), g[i].end());
    ptr[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    was[i] = -1;
  }
  int new_n = n;
  for (int i = 0; i < N; i++) {
    new_g[i].clear();
  }
  for (int color = 0; color < N; color++) {
    if (all[color].empty()) {
      continue;
    }
    for (int it = 0; it < (int) all[color].size(); it++) {
      int v = all[color][it];
      if (was[v] == color) {
        continue;
      }
      int b = 0, e = 1;
      x[0] = v;
      was[v] = color;
      while (b < e) {
        while (ptr[x[b]] < (int) g[x[b]].size()) {
          int c = g[x[b]][ptr[x[b]]].first;
          if (c != color) {
            break;
          }
          int u = g[x[b]][ptr[x[b]]].second;
          if (was[u] != color) {
            was[u] = color;
            x[e] = u;
            e++;
          }
          ptr[x[b]]++;
        }
        b++;
      }
      for (int i = 0; i < e; i++) {
        new_g[x[i]].push_back(new_n);
        new_g[new_n].push_back(x[i]);
      }
      new_n++;
    }
  }
  for (int i = 0; i < new_n; i++) {
    dist[i] = -2;
  }
  int b = 0, e = 1;
  x[0] = 0;
  dist[0] = 0;
  while (b < e) {
    for (int j = 0; j < (int) new_g[x[b]].size(); j++) {
      int u = new_g[x[b]][j];
      if (dist[u] == -2) {
        dist[u] = dist[x[b]] + 1;
        x[e] = u;
        e++;
      }
    }
    b++;
  }
  printf("%d\n", dist[n - 1] / 2);
  return 0;
}


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

int main()
{
  long N;
  long ans = 0;

  cin >> N;

  for (int i = 1; i <= N; i++)
  {
    if (i % 3 != 0 && i % 5 != 0)
    {
      ans += i;
    }
  }

  cout << ans << endl;
}


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

int main(){
  
int N, kazu;
  cin >> N;
int c[26][N];
  for(int i = 0;i < 26;i++){
  for(int j = 0;j < N;j++) c[i][j] = 0;
  }
  
string s;
  
  for(int i = 0;i < N;i++){
  cin >> s;
    for(int j = 0;j < s.size();j++) c[s.at(j) - '0' - 49][i]++;    
  }
  
  for(int i = 0;i < 26;i++){
  kazu = 51;
    for(int j = 0;j < N;j++){
    kazu = min(kazu, c[i][j]);
    }
    if(kazu > 0){
      while(kazu){    
      if(i == 0)cout << 'a';
      else if(i == 1)cout << 'b';  
        else if(i == 2)cout << 'c';
        else if(i == 3)cout << 'd';
        else if(i == 4)cout << 'e';
        else if(i == 5)cout << 'f';
        else if(i == 6)cout << 'g';
        else if(i == 7)cout << 'h';
        else if(i == 8)cout << 'i';
        else if(i == 9)cout << 'j';
        else if(i == 10)cout << 'k';
        else if(i == 11)cout << 'l';
        else if(i == 12)cout << 'm';
        else if(i == 13)cout << 'n';
        else if(i == 14)cout << 'o';
        else if(i == 15)cout << 'p';
        else if(i == 16)cout << 'q';
        else if(i == 17)cout << 'r';
        else if(i == 18)cout << 's';
        else if(i == 19)cout << 't';
        else if(i == 20)cout << 'u';
        else if(i == 21)cout << 'v';
        else if(i == 22)cout << 'w';
        else if(i == 23)cout << 'x';
        else if(i == 24)cout << 'y';
        else if(i == 25)cout << 'z';
        
        kazu--;
    }
  }
  }

  return 0;
  
}

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

#define int long long
#define F first
#define S second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define endl '\n'
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define INF 1e+18

using namespace std;

int a[100001][3] , dp[100001][3] ; 

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

   	int t ;
   	cin >> t ; 
   	for(int i = 0 ; i < t ; i++){
   		for(int j = 0 ; j < 3 ; j++){
   			cin >> a[i][j] ; 
   		}
   	}

   	for(int i = 0 ; i < 3 ; i++){
   		dp[0][i] = a[0][i] ; 
   	}

   	for(int i = 1 ; i < t ; i++){
   		for(int j = 0 ; j < 3; j++){
   			int maxx = -1 ;
   			for(int k = 0 ; k < 3 ; k++){
   				if(j != k){
   					maxx = max(maxx , dp[i - 1][k]) ;
   				}
   			}
   			dp[i][j] = maxx + a[i][j] ; 
   		}
   	}

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


Measured memory_bytes: 4992
import scala.io.StdIn._
import scala.annotation.tailrec

object Main {
    def main(args: Array[String]): Unit = { 
        digit(readLine().split(" ").map(_.toDouble))
    }   

    @tailrec
    def digit(n: Seq[Double]): Unit = {
       val d: Double = n(1) * n(3) - n(0) * n(4)
       val x: Double = zero((n(1) * n(5) - n(4) * n(2)) / d)
       val y: Double = zero((n(2) * n(3) - n(0) * n(5)) / d)
       println(f"$x%.3f $y%.3f")
       val next: String = readLine()
       if(next == null) Unit else digit(next.split(" ").map(_.toDouble))
    }

    def zero(n: Double): Double = if(Math.abs(n) == 0) 0 else n
}

Measured memory_bytes: 44168
require 'prime'
x = gets.to_i

x.times do |i|
  y = (x - i)
  if y == 1
    puts 1
    next
  end

  factors = y.prime_division
  min = (factors.min_by{|e| e[1] })[1]
  next if min == 1
  next unless factors.all?{|e| e[1]%min == 0 }

  puts y
  exit
end


Measured memory_bytes: 2044
#include<stdio.h>

int main(){

    int A,B,C,D;

    scanf("%d %d %d %d", &A, &B, &C, &D);

    int flag_1=0,flag_2=0;
    int i=0;

    while( flag_1 == 0 && flag_2 == 0 ){

        i += 1;

        if( i % 2 == 1 ){

            C -= B;

            if( C <= 0 ){
                flag_1 += 1;
                printf("Yes\n");
            }
        }
        else{
            A -= D;

            if( A <= 0 ){
                flag_2 += 1;
                printf("No\n");
            }
        }

    }

    return 0;

}







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

int main() {
  int A, B, C, X;
  scanf("%d %d %d %d",&A,&B,&C,&X);
  int ans=0;
  for (int i=0; i<=A; i++) {
    for (int j=0; j<=B; j++) {
      for (int k=0; k<=C; k++) {
        if (500*i+100*j+50*k==X) {
          ans++;
        }
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    w = []
    for i in range(n):
        ww = input()
        w.append(ww)

    if n != len(set(w)):
        print('No')
        return
    last_c = w[0][-1]
    for i, top_c in enumerate(w):
        if i == 0:
            continue
        
        if last_c == top_c[0]:
            last_c = top_c[-1]
        else:
            print('No')

            return
    print('Yes')
if __name__ =='__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

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

  int i; 
  vector<long> h(n);
  for(i=0;i<n;i++){
    cin >> h[i];
  }

  if(n<=k){
    cout << 0 << endl;
  }else{
    std::sort(h.begin(), h.end());
  
    int look[n-k];
    long sum=0;
    for(i=0;i<n-k;i++){
        look[i]=h[i];
        sum = sum + h[i];
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
#define asn ans
bool dbg = false;


void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    for (auto& c : s) {
        if (c == '7') {
            Yes();
            return 0;
        }
    }
    No();


    solve();
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int n, k, ans, mod = 1e9+7;
vector<Int> a;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> k;
	a.resize(n);
	for(auto &i:a) cin >> i;
	for(Int i=0; i<n; ++i)
		for(Int j=i+1; j<n; ++j)
			if(a[i] > a[j])
				++ans;
	ans *= k;
	ans %= mod;
	vector<Int> c(2010);
	for(auto i:a) ++c[i];
	for(size_t i=1; i<c.size(); ++i)
		c[i] += c[i-1];
	for(Int i=1; i<=2000; ++i){
		Int t = (k * (k-1) / 2) % mod;
		t = (t * c[i-1]) % mod;
		t = (t * (c[i] - c[i-1])) % mod;
		ans = (ans + t) % mod;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include <stdlib.h>
using namespace std;

int main(void) {
	long long int sum;
	int n;
	cin >> n;
	sum = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			for (int k = 1; k <= n; k++) {
				int num = i;
				if (num > j) num = j;
				if (num > k)num = k;
				for (int l = num; l >= 1; l--) {
					if (i % l == 0 && j % l == 0 && k % l == 0) {
						sum += l;
						break;
					}
				}
			}
		}
	}
	cout << sum << endl;
	 return 0;
	
}

Measured memory_bytes: 3156
s = list(input())
t = list(input())

s.sort()
t.sort()
t.reverse()

for S,T in zip(s,t):
	if 'S' == 'T':
		continue

	elif ord(S) < ord(T):
		print("Yes")
		exit(0)

	elif ord(T) < ord(S):
		print("No") 
		exit(0)

if len(s) < len(t):
	print("Yes")

else:
	print("No")

Measured memory_bytes: 3064
#include <stdio.h>

int n,q,A[20];

int solve(int i,int m){
  int res;
  if(m == 0) return 1;
  if(i >= n) return 0;
  if(res = solve(i+1,m)) return res;
  if(res = solve(i+1,m-A[i])) return res;;
  return res;
}


int main(){
  int i,M[200],check,a;
  scanf("%d",&n);
  for(i=0; i<n; i++)  scanf("%d",&A[i]);
  scanf("%d",&q);
  for(i=0; i<q; i++)  scanf("%d",&M[i]);

  for(i=0; i<q; i++){
    check = solve(0,M[i]);
    if(check == 1) printf("yes\n");
    else if(check == 0) printf("no\n");
  }

  return 0;

}

Measured memory_bytes: 1008
import numpy as np

N = int(input())
A = [int(input()) for i in range(N)]
A = np.array(A)
first = max(A)
arg = A.argsort()
first_idx = arg[-1]
second_idx = arg[-2]
second = A[second_idx]
for i in range(len(A)):
  if i==first_idx:
    print(second)
  else:
    print(first)

Measured memory_bytes: 21856
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// #define int ll

typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<bool> > vvb;
typedef map<int, bool> mib;

typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vpll;

typedef vector<string> vs;

typedef long double ld;

#define _GLIBCXX_DEBUG

#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n-1); i >= 0; --i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << '\n'
#define hyphen() cerr << "--\n"

#define ALL(vec) (vec).begin(), (vec).end()
#define REVALL(vec) (vec).rbegin(), (vec).rend()

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

#define fst first
#define snd second
#define pb push_back
#define mp(x,y) make_pair((x),(y))

const int MOD = (int)1e9 + 7;
const int INF = numeric_limits<int>::max();

// Sieve of Eratosthenes
vi get_primes(int input) {
    int N = max(input, 100);

    vb Alive(N, true);
    Alive.at(0) = false;
    Alive.at(1) = false;

    // i番目の素数が分かる (0-origin)
    vi Ps;

    FORE(smallest, 2, (int)(sqrt(N)+1)) {
        if (!Alive.at(smallest)) {
            continue;
        }

        for(int i = smallest * 2; i < N; i += smallest) {
            Alive.at(i) = false;
        }
    }

    REP(i, N) {
        if (Alive.at(i)) {
            Ps.pb(i);
        }
    }

    return Ps;
}

bool is_like_2017(mib is_prime_map, int N) {
    if (!is_prime_map.count(N)) {
        return false;
    }

    if (!is_prime_map.count((N+1) / 2)) {
        return false;
    }

    return true;
}

signed main() {
    int Q;
    cin >> Q;

    int N = (int)1e5 + 1;

    vector<int> Ls(Q);
    vector<int> Rs(Q);
    REP(i, Q) {
        cin >> Ls.at(i) >> Rs.at(i);
    }

    vi primes = get_primes(N);
    mib is_prime_map;

    for(auto p : primes) {
        is_prime_map[p] = true;
    }

    mib like_2017_map;
    for(auto p : primes) {
        if (p != 2 && is_prime_map.count((p + 1) / 2)) {
            like_2017_map[p] = true;
        }
    }

    // 累積和を求めておく
    vi Acc(N);
    Acc.at(0) = 0;

    int sum = 0;
    FORE(i, 1, N-1){
        if (i % 2 == 0) {
            Acc.at(i) = Acc.at(i-1);
            continue;
        }

        sum += like_2017_map.count(i) ? 1 : 0;
        Acc.at(i) = sum;
    }

    REP(i, Q) {
        int l = Ls.at(i);
        int r = Rs.at(i);

        int ans;
        if (l == 0) {
            ans = Acc.at(r);
        } else {
            ans = Acc.at(r) - Acc.at(l-1);
        }
        cout << ans << endl;
    }

}


Measured memory_bytes: 2304
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

const int64_t INF = 1e+18;

struct edge {
    int to;
    int64_t weight;
};

void Dijkstra(int s, vector<vector<edge>> &G, vector<int64_t> &d) {
    fill(d.begin(), d.end(), INF);
    d[s] = 0;
    priority_queue<pair<int64_t, int>, vector<pair<int64_t, int>>, greater<pair<int64_t, int>>> q;
    q.push(make_pair(0, s));
    
    while (!q.empty()) {
        pair<int, int> p = q.top(); q.pop();
        int v = p.second;
        
        if (d[v] < p.first) continue;
        
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.weight) {
                d[e.to] = d[v] + e.weight;
                q.push(make_pair(d[e.to], e.to));
            }
        }
    }
    
    return;
}

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

    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m; cin >> n >> m;
    int s, t; cin >> s >> t; s--; t--;
    
    vector<vector<edge>> G_yen(n, vector<edge>()), G_Snuuk(n, vector<edge>());
    for (int i = 0; i < m; i++) {
        int u, v, a, b; cin >> u >> v >> a >> b;
        u--; v--;
        G_yen[u].push_back({v, a});
        G_yen[v].push_back({u, a});
        G_Snuuk[u].push_back({v, b});
        G_Snuuk[v].push_back({u, b});
    }
    
    vector<int64_t> d_yen(n), d_Snuuk(n);
    Dijkstra(s, G_yen, d_yen); Dijkstra(t, G_Snuuk, d_Snuuk);
    
    vector<int64_t> cost(n);
    cost[n - 1] = d_yen[n - 1] + d_Snuuk[n - 1];
    for (int i = n - 2; i >= 0; i--) {
        cost[i] = min(cost[i + 1], d_yen[i] + d_Snuuk[i]);
    }
    
    for (int i = 0; i < n; i++) {
        cout << (int64_t)1e+15 - cost[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 19016
N = int(input())
a = list(map(int, input().split()))

sum_a = 0
ans_1 = 0
for i in range(N):
    sum_a += a[i]
    if sum_a >= 0 and i%2 == 0:
        ans_1 += sum_a + 1
        sum_a = -1
    elif sum_a <= 0 and i%2 != 0:
        ans_1 += -sum_a + 1
        sum_a = 1
        
sum_a = 0
ans_2 = 0
for i in range(N):
    sum_a += a[i]
    if sum_a >= 0 and i%2 != 0:
        ans_2 += sum_a + 1
        sum_a = -1
    elif sum_a <= 0 and i%2 == 0:
        ans_2 += -sum_a + 1
        sum_a = 1

print(min(ans_1, ans_2))

Measured memory_bytes: 14212
#include<stdio.h>
#include<stdlib.h>
#define N 2000001
   
void CountingSort(int*,int*,int);

int n;
   
main(){
   
  int i,max=0;
  int *A,*B;
  scanf("%d",&n);
  A = (int*)malloc(sizeof(int)*n);
  B = (int*)malloc(sizeof(int)*n);

  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
    if(max<A[i]) max=A[i];
  }
  CountingSort(A,B,max);
  for(i=1;i<=n-1;i++){
    printf("%d ",B[i]);
  }
  printf("%d\n",B[n]);
  return 0;
}
   
   
void CountingSort(int* A,int* B,int k){
   
  int i,C[N],j;
   
  for(i=0;i<=k;i++){
    C[i]=0;
  }
  for(j=1;j<=n;j++){
    C[A[j]]++;
  }
  for(i=1;i<=k;i++){
    C[i]=C[i]+C[i-1];
  }
  for(j=n;j>=1;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
}

Measured memory_bytes: 16276
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
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;
}

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

   vector<int> l(n,0);
   vector<int> r(n,0);

   rep(i,n){
      if(i==0) continue;
      else if(s[i]=='E') r[0]++;
   }
   rep(i,n){
      if(i==0) continue;
      if(s[i-1]=='W') l[i]=l[i-1]+1;
      else{
         l[i]=l[i-1];
      }
      if(s[i]=='E') r[i]=r[i-1]-1;
      else{
         r[i]=r[i-1];
      } 
   }
   int ans=INFINITY;
   rep(i,n){
      ans=min(ans,r[i]+l[i]);
   }
   cout<<ans;
   return 0;
}


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


void solve(long long A, long long B, long long C){
	cout << min(B/A,C) << endl;
	return;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


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

int main() {
	int n, len, idx=0;
	string s, s1, s2;
	
	cin>>n>>s; len=s.length();
	s1=s.substr(0,len/2); s2=s.substr(len/2,len+1);
	
	if(s1==s2) cout<<"Yes";
	else cout<<"No";
	
	return 0;
}

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

int main () {
  string s;
  cin >> s;

  for(char c: s) {
    if(c == '1') {
      cout << '9';
    } else {
      cout << '1';
    }
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順
#include <map>

using namespace std;
using ll = long long int;

int main(){
    int N;cin>>N;
    map<char,int> s;
    map<map<char,int>,ll> count; 
    for(int i=0;i<N;i++){
        string c;cin>>c;
        s.clear();
        for(int j=0;j<10;j++){
            s[c[j]]++;
        }
        count[s]++;
    }
    ll ans = 0;
    for(auto i=count.begin();i!=count.end();++i){
        ans += i->second * (i->second - 1) / 2; 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 49152
from itertools import permutations

N, M = map(int, input().split())
matrix = [[0] * N for i in range(N)]
ans = 0

for i in range(M):
    a, b = map(int, input().split())
    matrix[a-1][b-1] = 1
    matrix[b-1][a-1] = 1
    

for order in list(permutations(range(N))):
    if order[0] != 0:
        break
        
    check = 1
    for i in range(N-1):
        check *= matrix[order[i]][order[i+1]]
    ans += check
    
print(ans)

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

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

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

    // start
    int a, b;
    cin >> a >> b;
    if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
        cout << "Possible" << endl;
    else
        cout << "Impossible" << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
const double EPS=1e-10;
typedef struct P{double x,y;int o,l;}P;
int C,N,XS,YS,XT,YT,O,L,XA,YA,XB,YB,i,b,tx,ty,c,T,R;
double r,s;
P ST[105];
int cmp(const void* a,const void* b)
{
	P* A=(P*)a;
	P* B=(P*)b;
	if(abs(A->x-B->x)<0)
	{
		if(A->y-B->y<0)return -1;
		if(B->y>A->y<0)return 1;
	}
	if(A->x-B->x<0)return -1;
	if(B->x-A->x<0)return 1;
	return 0;
}

int main()
{
	for(scanf("%d",&C);C--;)
	{
		memset(ST,0,sizeof(ST));
		scanf("%d%d%d%d%d",&XA,&YA,&XB,&YB,&N);
		for(i=c=0;i<N;i++)
		{
			scanf("%d%d%d%d%d%d",&XS,&YS,&XT,&YT,&O,&L);
			tx=XS-XA;
			ty=YS-YA;
			b=(XB-XA)*(YT-YS)-(YB-YA)*(XT-XS);
			if(b==0)continue;
			r=(double)((YT-YS)*tx-(XT-XS)*ty)/b;
			s=(double)((YB-YA)*tx-(XB-XA)*ty)/b;
			if(r<EPS||s<EPS||1.0-r<EPS||1.0-s<EPS)continue;
			if(r>EPS&&1.0-r>EPS){P ins={XA+r*(XB-XA),YA+r*(YB-YA),O,L};ST[c++]=ins;}
			else{P ins={XS+s*(XT-XS),YS+s*(YT-YS),O,L};ST[c++]=ins;}
		}
		qsort(ST,c,sizeof(P),cmp);
		R=999;
		for(L=0;L<2;L++)
		{
			for(T=L,i=b=0;i<c;i++)
			{
				if(ST[i].o==1&&ST[i].l!=T){b++;T^=1;}
				if(ST[i].o!=1&&ST[i].l==T){b++;T^=1;}
			}
			R=R<b?R:b;
		}
		printf("%d\n",R);
	}
	return 0;
}

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

bool isPrime(ll num)
{
    if (num == 1)
    {
        return false;
    }
    for (ll i = 2; i < sqrt(num); ++i)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll X;
    cin >> X;
    while (true)
    {
        if (isPrime(X))
        {
            break;
        }
        ++X;
    }
    cout << X << endl;
}

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

#define FasterIO  ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0) ;

int main() {
    long long n , k ;
    cin >> n >> k ;
    long long ar[n + 5] ;
    for(int i = 1 ; i <= n ; i++) {
        cin >> ar[i] ;
    }
    sort(ar + 1, ar + n + 1) ;
    long long flag = 0 ;
    for(int i = n ; i >= 1 ; i--) {
        if(k) {
            k-- ;
        } else {
            flag += ar[i] ;
        }
    }
    cout << flag << "\n" ;
    return 0 ;
}

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

namespace AtCoder
{
    class Program
    {

        static void Main()
        {
            //ここから
            long[] str = ReadLineToLongArray();
            long A = str[0];
            long B = str[1];

            int n = (int)((B - A) % 4);

            long ans=A;
            if(n!=0)
            {
                if (A % 2 == 0)
                {
                    if (n == 1)
                    {
                        ans = A ^ (A + 1);
                    }else if (n == 2)
                    {
                        ans = A ^ (A + 1) ^ B;
                    }
                    else
                    {
                        ans = 0;
                    }
                }
                else if (n == 1)
                {
                    ans = A ^ B;
                }else if (n == 2)
                {
                    ans = A ^ (A + 1) ^ (A + 2);
                }
                else
                {
                    ans = A ^ (A + 1) ^ (A + 2) ^ B;
                }
            }
            else
            {
                if (A % 2 == 0)
                {
                    ans = B;
                }
            }

            //ここまで


            Console.WriteLine(ans);
            Console.ReadKey();
        }


        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }



        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }



    }
}


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

int main()
{
  int N, A, B;
  cin >> N >> A >> B;
  
  // 最大
  cout << min(A, B) << " ";
  
  // 最小
  if(((A + B) - N) <= 0)
    cout << "0" << endl;
  else
    cout << (A + B) - N << endl;
}

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

using namespace std;

int main() {
	int n;
	cin>>n;
	
	string str1, str2, of="overflow";
	for(int i=0; i<n; i++){
		cin>>str1>>str2;
		int size1=str1.size();
		int size2=str2.size();

		if(size1 > 80 || size2 > 80){
			cout<<of<<endl;
		}
		else{
			int num1[80] = {0}, num2[80] = {0}, buf[81] = {0};

			for(int i=0; i<size1; i++){ num1[size1-1-i] = (str1[i]-'0'); }
			for(int i=0; i<size2; i++){ num2[size2-1-i] = (str2[i]-'0'); }
			for(int i=0; i<80; i++){ buf[i] = num1[i]+num2[i]; }
			for(int i=0; i<80; i++){
				if(buf[i] > 9){
					buf[i+1] += buf[i]/10;
					buf[i] = buf[i]%10;
				}
			}
			if(buf[80] != 0) cout<<of<<endl;
			else{
				int flag = 79;
				while(buf[flag] == 0 && flag != 0){ flag--; }

				for(int i=flag; i>=0; i--){
					cout<<buf[i];
				}
				cout<<endl;
			}

		}
	}
	return 0;
}

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

using namespace std;

int main(){
    int n, k, d;
    map<int, bool> mp;
    for(int i=0; i<10; ++i) mp[i] = true;
    cin >> n >> k;
    for(int i=0; i<k; ++i){
        cin >> d;
        mp[d] = false;
    }
    while(true){
        string sPay = to_string(n);
        int counter = sPay.size();
        for(auto c : sPay){
            if(mp[c-'0']) --counter;
        }
        if(counter == 0) break;
        else ++n;
    }
    cout << n << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
li = [list(map(int, input().split())) for _ in range(n)]
ans = []

for cx in range(101):
    for cy in range(101):
        for i in li:
            if i[2] != 0:
                ans.append([cx, cy, i[2] + abs(i[0]-cx) + abs(i[1] -cy)])
                break

for i in li:
    if len(ans) ==1:
        break
    if i[2] != 0:
        for j in reversed (range(len(ans[:]))):
            if ans[j][2] - abs(i[0]-ans[j][0]) - abs(i[1]-ans[j][1]) != i[2]:
                ans.pop(j)
    if i[2] == 0:
        for j in reversed (range(len(ans[:]))):
            if ans[j][2] - abs(i[0]-ans[j][0]) - abs(i[1]-ans[j][1]) > i[2]:
                ans.pop(j)

print(" ".join(map(str, ans[0])))

Measured memory_bytes: 4468
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
using namespace std;

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

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

Measured memory_bytes: 3088
row = input().split()
s = row[0]
s = s[::-1]

dvide = ["dream", "dreamer", "erase", "eraser"]
for i in range(4):
    dvide[i] = dvide[i][::-1]
can = True
i=0
while i < len(s):
    can2 = False
    for j in range(4):
        d = dvide[j]
        if d == s[i:i+len(dvide[j])]:
            i += len(dvide[j])
            can2 = True
    if can2 == False:
        can = False
        break


if can:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
const ll mod = 1000000007LL;
int main() {
  int n;
  cin >>n;
  string s1,s2;
  cin >> s1;
  cin >> s2;
  
  ll ans = 1;
  ll i = 0;
  ll isSide = 0;
  while(i<n){
    if(s1[i] == s2[i]){
      if(i==0) ans = (ans*3)%mod;
      else ans = (ans*(2-isSide))%mod;
      isSide = 0;
      i++;
    }else{
      if(i == 0)ans = (ans*6)%mod;
      else ans = (ans*(2+isSide)) % mod;
      isSide = 1;
      i+=2;
    }
  }
  cout<<ans%mod<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int n, x;
	cin >> n >> x;
	vector<int>m(n);
	for (int i = 0; i < n; i++)
		cin >> m[i];

	sort(m.begin(), m.end());
	int sum = 0;
	for (int i = 0; i < m.size(); i++)
		sum += m[i];

	int ans = n;

	while (sum <= x) {
		sum += m[0];
		ans++;
	}

	cout << ans-1 << endl;

	return 0;
}

Measured memory_bytes: 256
package main
 
import(
  "fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)
 
var sc = bufio.NewScanner(os.Stdin)
 
func Rr() []string {
  sc.Scan()
  slice := strings.Split(sc.Text(), " ")
  return slice
}
 
func abc057c(N int){
	ans := 10
	for i := 1; i*i<=N; i++{
		if N%i == 0{
			current := strconv.Itoa(N/i)
			current_i := strconv.Itoa(i)
			in := 0 
			if len([]rune(current)) < len([]rune(current_i)){
				in = len([]rune(current_i))
			}else{
				in = len([]rune(current))
			}
			if in < ans{
				ans = in
			}
		}
	}
	fmt.Println(ans)
}	
 
func main(){
	N := 0
	fmt.Scan(&N)
	abc057c(N)
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (){
        ll n; cin >> n;
        vector <ll> v(n); for (auto &x : v) cin >> x;
        sort(v.begin(), v.end(), greater<int>());
        --n;
        ll i = 0;
        ll res = v[i]; ++i; --n;
        while (n >= 2){
            res += 2 * v[i];
            ++i; n -= 2;
        }
        if (n) res += v[i];
        cout << res << endl;
    return 0;
}





Measured memory_bytes: 4840
n = int(input())
arr = []
for i in range(n-1):
    arr.append(tuple(map(int, input().split())))

for i in range(n-1):
    c1, s1, f1 = arr[i]
    ct = s1+c1
    for j in range(i+1, n-1):
        c2, s2, f2 = arr[j]
        while ct > s2:
            s2 += f2
        ct = s2 + c2
    print (ct)
print (0)

Measured memory_bytes: 74144
#include <stdio.h>

int main()
{
  int num1, num2;
  scanf("%d %d", &num1, &num2);
  if ( num1 > 0 && num1 < 10 && num2 > 0 && num2 < 10 )
    printf("%d\n", num1*num2);
  else
    printf("-1\n");
  
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main() {
  int i,j;
  int h,w;

  while(1){
    scanf("%d %d",&h,&w);

    if(h == 0 && w == 0) break;

    for(i = 0; i < h; i++){
      for(j = 0; j < w; j++){
        if(i == 0 || i == h - 1 || j == 0 || j == w - 1){
	  printf("#");
	}else {
	  printf(".");
	}
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2104
#include<cstdio>
#include<algorithm>
#include<iostream>
#define N 200005
#define int long long
using namespace std;
int P,n,q,m;
long long Q,V[N],ans[N],a[N];
void CL(int x,long long v)
{
	int P;
	P=upper_bound(a+1,a+m+1,x)-a-1;
	if (!P)
	{
		ans[1]+=v;
		ans[x+1]-=v;
		return;
	}
	V[P]+=v*(x/a[P]);
	CL(x%a[P],v);
}
main()
{
	scanf("%lld%lld",&n,&q);
	m++;
	a[m]=n;
	for (int i=1;i<=q;i++)
	{
		scanf("%lld",&Q);
		while (Q<=a[m])
			m--;
		a[++m]=Q;
	}
	V[m]=1;
	for (int i=m;i>1;i--)
	{
		V[i-1]+=V[i]*(a[i]/a[i-1]);
		CL(a[i]%a[i-1],V[i]);
	}
	ans[0]=0;
	ans[1]+=V[1];
	ans[a[1]+1]-=V[1];
	for (int i=1;i<=n;i++)
	{
		ans[i]+=ans[i-1];
		printf("%lld\n",ans[i]);
	}
	return 0;
}


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

typedef unsigned long ul;

int main()
{
  int N;
  cin>>N;
  vector<ul> L(N+1);
  L.at(0)=2;
  L.at(1)=1;
  for(int i=2; i<=N; i++)
  {
    L.at(i)=L.at(i-1)+L.at(i-2);
  }
  cout<<L.at(N)<<endl;
}


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

using namespace std;
typedef long long ll;

int main(){
    int h, n;
    cin >> h >> n;
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        sum += a;
    }

    cout << (h <= sum ? "Yes" : "No") << endl;
}


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


int main(){
  ll N, M;
  cin >> N >> M;
  vector<ll> a;
  for(int i=1; i*i<=M; i++){
    if(!(M%i)){
      a.push_back(i);
      a.push_back((M/i));
    }
  }
  sort(a.begin(), a.end());
  ll ans = 0;
  for(auto d: a){
    if(d<=(M/N)){
      ans = max(d, ans);
    }
  }
  cout << ans << endl;
  
}


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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    string s; cin >> s;
    int n = s.size();
    vector<int> ans(n+1,0);
    queue<int> q;
    for (int i = 0; i < n; i++) {
        if (s[i] == '<') {
            ans[i+1] = ans[i] + 1;
        }
    }
    for (int i = n; i >= 1; i--) {
        if (s[i-1] == '>') {
            ans[i-1] = max(ans[i-1],ans[i]+1);
        }
    }
    ll res = 0;
    for (int i: ans) {
        res += i;
        //cout << i << ' ';
    }
    //cout << '\n';
    cout << res << '\n';
}



Measured memory_bytes: 2844
def main():
    n = int(input())
    xyh = [list(map(int, input().split())) for _ in range(n)]
    xyh.sort(key = lambda x:x[2], reverse = True)
    x_ = xyh[0][0]
    y_ = xyh[0][1]
    h_ = xyh[0][2]
    for i in range(101):
        for j in range(101):
            top = h_ + abs(i - x_) + abs(j - y_)
            for x, y, h in xyh[1:]:
                h_2 = top - abs(i - x) - abs(j - y)
                if h != max(h_2, 0):
                    break
            else:
                print(i, j, top)
                return
                
main()

Measured memory_bytes: 73872
n, m = map(int, input().split())

a = []
b = list((0 for i in range(m)))

for i in range(n):
    a.append(list(map(int, input().split())))
    
for a_ in a:
    k = a_[0]
    for k_ in range(k):
        b[(a_[k_ + 1]) - 1] += 1
        
ans = 0
for b_ in b:
    if b_ == n:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int asc(const void *a, const void *b) {
  long long *A = (long long *)a;
  long long *B = (long long *)b;
  if (*A > *B) return 1;
  if (*A < *B) return -1;
  return 0;
}

int main(void){
    long long int i, j, k, n, x, ans=0, po=0;
    scanf("%lld", &n);
    long long int s[n];
    for(i=0; i<n; i++) scanf("%lld", &s[i]);
    qsort(s, sizeof(s) / sizeof(long long int), sizeof(long long int), asc);
    for(i=0; i<n-2; i++){
        for(j=i+1; j<n-1; j++){
            for(k=j+1; k<n; k++){
                if(s[i]+s[j] > s[k] && s[i]!=s[j] && s[j]!=s[k] && s[k]!=s[i]) ans++;
            }
        }
    }
    printf("%lld", ans);

    
}

Measured memory_bytes: 1728
#include<iostream>
using namespace std;
int main(void){
  string s[2];
  string ss[2];
  cin>>s[0];
  cin>>s[1];
  for(int i=0;i<2;i++){
    for(int j=0;j<3;j++){
      if(s[1-i][2-j]!=s[i][j]){
        cout<<"NO"<<endl;
        return 0;
      }
    }
  }
  cout<<"YES"<<endl;
  return 0;
}

Measured memory_bytes: 256