akhauriyash/Code-Regression huggingface dataset:
// Created by  Ambesh kumar
#include "bits/stdc++.h"

//I already compile this file in my computer system to save the time
//if get the compiler error then you should change this header to
// #include "bits/stdc++.h"  ---> #include <bits/stdc++.h>

using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0, lim - 1);
	return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1000000007;
const int N = 3e5, M = N;
//=================================================================================================================================//

vi g[N];
int a[N];

void solve() {
	int i, j, n, m;

	cin >> n;

	int mat[n][2];



	fo(i, n)
	cin >> mat[i][0] >> mat[i][1];


	bool y = false;

	fo(i, n - 2)
	{

		if (mat[i][0] == mat[i][1] && mat[i + 1][0] == mat[i + 1][1] && mat[i + 2][0] == mat[i + 2][1])
		{

			cout << "Yes" << '\n' ;
			y = true;
			break;

		}


	}



	if (!y)
		cout << "No" << '\n' ;

}





int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());

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

	return 0;
}







Measured memory_bytes: 10704
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	/*
	public static int search(int sum, int count, int size, int o_size, int m, int[] odd, int[] even){
		if(count == size){
			return sum == 0 ? 1 : 0;
		}
		
		int ret = 0;
		for(int i = 0; i < m; i++){
			if(count < o_size){
				ret += search((sum + odd[i]) % 10, count + 1, size, o_size, m, odd, even);
			}else{
				ret += search((sum + even[i]) % 10, count + 1, size, o_size, m, odd, even);
			}
		}
		
		return ret;
	}
	*/
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();
		final char[] str = new StringBuilder(sc.next()).reverse().toString().toCharArray();
		final int m = sc.nextInt();
		int[] a = new int[m];
		
		for(int i = 0; i < m; i++){
			a[i] = sc.nextInt();
		}
		
		int[] odd_mod = new int[m];
		int[] even_mod = new int[m];
		
		for(int i = 0; i < m; i++){
			odd_mod[i] = a[i];
			even_mod[i] = ((a[i] * 2) / 10) + ((a[i] * 2) % 10);
		}
		
		int odd_count = 0, even_count = 0;
		int first_mod = 0;
		
		for(int i = 0; i < str.length; i++){
			if((i + 1) % 2 == 1){
				if(str[i] == '*'){
					odd_count++;
				}else{
					first_mod += (str[i] - '0');
					first_mod %= 10;
				}
			}else{
				if(str[i] == '*'){
					even_count++;
				}else{
					first_mod += ((str[i] - '0') * 2) / 10 + ((str[i] - '0') * 2) % 10;
					first_mod %= 10;
				}
			}
		}
		
		if(odd_count == 0 && even_count == 0){
			System.out.println(first_mod == 0 ? 1 : 0);
			return;
		}
		//System.out.println(first_mod);
		
		
		long[][] dp = new long[odd_count + even_count][10];
		for(int i = 0; i < odd_count + even_count; i++){
			if(i == 0){
				if(i < odd_count){
					for(int j = 0; j < m; j++){
						dp[i][(first_mod + odd_mod[j]) % 10]++;
					}
				}else{
					for(int j = 0; j < m; j++){
						dp[i][(first_mod + even_mod[j]) % 10]++;
					}
				}
			}else{
				if(i < odd_count){
					for(int j = 0; j < 10; j++){
						for(int k = 0; k < m; k++){
							dp[i][(j + odd_mod[k]) % 10] += dp[i-1][j];
						}
					}
				}else{
					for(int j = 0; j < 10; j++){
						for(int k = 0; k < m; k++){
							dp[i][(j + even_mod[k]) % 10] += dp[i-1][j];
						}
					}
				}
			}
			//System.out.println(Arrays.toString(dp[i]));
		}
		
		//System.out.println(search(first_mod, 0, odd_count + even_count, odd_count, m, odd_mod, even_mod));
		System.out.println(dp[odd_count + even_count - 1][0]);
	}

}

Measured memory_bytes: 12000
import java.io.*;
import java.util.*;
public class Main {
    static boolean check(String s){
        if (s.length()<=1)
            return true;
        for (int i =0;i<s.length()/2;i++){
            if (s.charAt(i)!=s.charAt(s.length()-i-1))
                return false;
        }
        return true;
    }
    public static void main(String[] args) throws IOException, InterruptedException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        double l = sc.nextDouble()/3;
        pw.println(l*l*l);
        pw.flush();
    }
    static int gcd(int x,int y){
        if (x==0)
            return y;
        return gcd(y%x,x);
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }

}

Measured memory_bytes: 23124
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // long long64_t, long long*_t
#include <cstdio> // prlong longf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack 
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <list>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n,0);
  for(int i=1; i<n; i++){
      cin >> a[i];
      b[(a[i]-1)]++;
  }
  for(int i=0; i<n; i++){
      cout << b[i] << endl;
  }
}


Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

int uin,vin;

template< typename G >
struct DoublingLowestCommonAncestor {
  const int LOG;
  vector< int > dep;
  const G &g;
  vector< vector< int > > table;

  DoublingLowestCommonAncestor(const G &g) : g(g), dep(g.size()), LOG(32 - __builtin_clz(g.size())) {
    table.assign(LOG, vector< int >(g.size(), -1));
  }

  void dfs(int idx, int par, int d) {
    table[0][idx] = par;
    dep[idx] = d;
    for(auto &to : g[idx]) {
      if(to != par) dfs(to, idx, d + 1);
    }
  }

  void build() {
    dfs(vin, -1, 0);
    for(int k = 0; k + 1 < LOG; k++) {
      for(int i = 0; i < table[k].size(); i++) {
        if(table[k][i] == -1) table[k + 1][i] = -1;
        else table[k + 1][i] = table[k][table[k][i]];
      }
    }
  }

  int query(int u, int v) {
    if(dep[u] > dep[v]) swap(u, v);
    for(int i = LOG - 1; i >= 0; i--) {
      if(((dep[v] - dep[u]) >> i) & 1) v = table[i][v];
    }
    if(u == v) return u;
    for(int i = LOG - 1; i >= 0; i--) {
      if(table[i][u] != table[i][v]) {
        u = table[i][u];
        v = table[i][v];
      }
    }
    return table[0][u];
  }
  pair<int,int> chu(int u, int mid){ //chu par
    for(int i = LOG - 1; i >= 0; i--) {
      if((mid >> i) & 1) u = table[i][u];
    }
    int par = table[0][u];
    return mp(u,par);
  }

  
};
//距離 ind
pair<int,int> dfs(int v, int par, UnWeightedGraph &g){
  int kyori=0;;
  pair<int,int> ret={0,v};
  for(auto i:g[v]){
    if(i==par) continue;
    auto tp=dfs(i,v,g);
    int dis=tp.first;
    int ind=tp.second;
    if(kyori < dis+1){
      kyori=dis+1;
      ret=mp(dis+1,ind);
    }
  }
  
  return ret;

}



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

  int n;
  cin >> n;
  UnWeightedGraph g(n);
  cin >> uin >> vin;
  --uin;--vin;

  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    --a;--b;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }
  DoublingLowestCommonAncestor< UnWeightedGraph > lca(g);
  lca.build();
  int dis=lca.dep[uin];
  int mid=(dis-1)/2;
  //  cout << "dist u-v " << dis << endl;
  //  cout << "mid kyori " << mid  << endl;
  auto st=lca.chu(uin,mid);
  //  cout << "chuten par " << st.first << " "  << st.second << endl;
  
  int ind=dfs(st.first, st.second,g).second;
  int kyori = lca.dep[ind];
  //  cout << "kyori ind " << kyori <<" " << ind << endl;
  int ans= max(kyori-1,0);
  cout << ans << endl;

  

  return 0;
    

}


Measured memory_bytes: 19704
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(2e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
	if (y == 0) 
		return 1; 
	ll p = power(x, y/2) % MOD; 
	p = (p * p) % MOD; 
  
	return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work
ll fact[INIT]={0};

int main()
{
	#ifndef ONLINE_JUDGE
	if (fopen("INPUT.txt", "r"))
	{
		freopen ("INPUT.txt" , "r" , stdin);
		//freopen ("OUTPUT.txt" , "w" , stdout);
	}
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	clock_t clk;
	clk = clock();
//-----------------------------------------------------------------------------------------------------------//

	fact[0]=1;
	FORI(i,1,INIT)
	{
		fact[i]=(fact[i-1]*i)%MOD;
	}
	READV(N);
	READV(K);
	ll ans=0;
	FORI(i,0,min(N-1,K)+1)
	{
		if(true)
		{
			ll a1=(fact[N]*modInverse(fact[i]))%MOD;
			a1=(a1*modInverse(fact[N-i]))%MOD;
			a1=(a1*fact[N-1])%MOD;
			a1=(a1*modInverse(fact[i]))%MOD;
			a1=(a1*modInverse(fact[N-1-i]))%MOD;
			ans=(ans+a1)%MOD;
		}
	}
	cout<<ans<<endl;

//-----------------------------------------------------------------------------------------------------------//


	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

	return 0;
}

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

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> a(H);
	for (int i = 0; i < H; i++) {
		cin >> a[i];
	}

	vector<bool> row(H, false);
	vector<bool> col(W, false);
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}
    for (int i = 0; i < H; i++) {
		if (row[i]) {
			for (int j = 0; j < W; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 3516
#include<iostream>
// #include<fstream>
using namespace std;
#define MAX 100001
#define NIL -1

// leftChild represent a node's child which is on the most left side 
// rightSibling represent a brother node which is to the right of the current node
struct Node { int parent, leftChild, rightSibling; };

Node nodes[MAX];
int n, depthOfNode[MAX];

void printNode(int nodeId);
void setDepth(int currentNode, int depth);

int main(){
	int i,j; // for loop
	int childNode, parentNode, degreeOfNode, previousChildNode, root;
	// ifstream input;
	// input.open("input");

	cin >> n;
	// input >> n;

	// initialize
	for (i = 0; i < n; i++)
		nodes[i].parent = nodes[i].leftChild = nodes[i].rightSibling = NIL;

	for (i = 0; i < n; i++){
		cin >> parentNode >> degreeOfNode;
		// input >> parentNode >> degreeOfNode;
	
		for (j = 0; j < degreeOfNode; j++){
			cin >> childNode;
			// input >> childNode;

			if (j == 0)
				nodes[parentNode].leftChild = childNode;
			else
				nodes[previousChildNode].rightSibling = childNode;

			previousChildNode = childNode;
			nodes[childNode].parent = parentNode;
		}

	}

	for (i = 0; i < n; i++) {
		if (nodes[i].parent == NIL) {
			root = i;
			break;
		}
	}

	// recursively set depth
	setDepth(root, 0);

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

	return 0;
}

void setDepth(int currentNode, int depth) {
	depthOfNode[currentNode] = depth;
	if (nodes[currentNode].leftChild != NIL)
		setDepth(nodes[currentNode].leftChild, depth + 1);
	if (nodes[currentNode].rightSibling != NIL)
		setDepth(nodes[currentNode].rightSibling, depth);
}

void printNode(int nodeId) {
	int i, childNode;
	cout << "node " << nodeId << ": ";
	cout << "parent = " << nodes[nodeId].parent << ", ";
	cout << "depth = " << depthOfNode[nodeId] << ", ";

	if (nodes[nodeId].parent == NIL)
		cout << "root, ";
	else if (nodes[nodeId].leftChild == NIL)
		cout << "leaf, ";
	else
		cout << "internal node, ";

	cout << "[";

	for (i = 0, childNode = nodes[nodeId].leftChild; 
		childNode != NIL;
		i++, childNode = nodes[childNode].rightSibling) 
	{
		if (i != 0) cout << ", ";

		cout << childNode;
	}

	cout << "]" << endl;
}

Measured memory_bytes: 4612
//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
	int n;cin>>n;
	long long ans = n/500*1000;
	n%=500;
	ans += n/5*5;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
#include <list>
using namespace std;
typedef long long int lli;
typedef pair<int,int> P;
#define F first
#define S second
const int INF=1000000000;

int main(){
	int n;
	while(cin>>n&&n){
		vector<pair<char,char> > table(n);
		for(int i=0; i<n; ++i){
			char t1,t2;
			cin >> t1 >> t2;
			table[i].F=t1;
			table[i].S=t2;
		}
		int m;
		cin >> m;
		string ans;
		for(int i=0; i<m; ++i){
			char tmp;
			cin >> tmp;
			for(int j=0; j<n; ++j){
				if(table[j].F==tmp){
					tmp=table[j].S;
					break;
				}
			}
			ans+=tmp;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1332
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

const ll MAX = 1e6+100;
const ll MOD = 1e9 + 7;
vector<ll> fac(MAX);
vector<ll> finv(MAX);
vector<ll> inv(MAX);

void COMinit(){
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(ll 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;
  }
}

ll nCr(ll n, ll r){
  if(n < r) return 0;
  if(n < 0 || r < 0) return 0;
  return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N; cin >> N;
  COMinit();
  if(N < 3){
    cout << 0 << endl;
    return 0;
  }
  ll now = N-3;
  ll ans = 1;
  ll cnt = 2;
  while(now >= 3){
    now -= 3;
    ans += nCr((cnt-1)+(now), (cnt-1));
    ans %= MOD;
    cnt ++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 26624
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;
 
#define Pr(f,...) printf(f,##__VA_ARGS__),fflush(stdout)
 
typedef long long ll;
 
const int N=105,P=1e9+7;

int add(int x,int y){ x+=y; return x>=P?x-P:x; }
int mul(int x,int y){ return 1ll*x*y%P; }
void upd(int &x,int y){ x=add(x,y); }

int n=50,f[N][N],C[N][N],ans;

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("dat.in","r",stdin);
	freopen("my.out","w",stdout);
#endif
	scanf("%d",&n); 
	C[0][0]=1;
	rep(i,1,n){
		C[i][0]=1;
		rep(j,1,i)C[i][j]=add(C[i-1][j-1],C[i-1][j]);
	}
	f[1][0+n]=n,f[1][-1+n]=n;
	rep(i,1,n-1)rep(j,-n,n)if(f[i][j+n])rep(a,0,n-i)rep(b,0,n-a-i){
		if((!a&&!b)||(j+a-b)%2!=0||j<-a-b||j>a+b||(j&1)!=((a+b)&1))continue;
		upd(f[i+a+b][(j+a-b)/2+n],mul(f[i][j+n],mul(C[a+b][a],C[n-i][a+b])));
	}
	printf("%d\n",f[n][0+n]); 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define     mod             1e9+7
#define     MOD             998244353
#define     ll              long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     pb              emplace_back
#define     pf              emplace_front
#define     all(p)          p.begin(), p.end()
#define     rep(i,a,b)      for( i=a;i<b;++i)
#define     repr(i,a,b)     for( i=a;i>=b;i--)
#define     up              upper_bound
#define     lb              lower_bound
#define     t()             int test;cin>>test;while(test--)
#define     setbits(x)      __builtin_popcountll(x)
#define     si              set<int>
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     que_min         priority_queue <int, vi, greater<int> >
#define     isOn(S, j)      (S & (1 << j))
#define     setBit(S, j)    (S |= (1 << j))
#define     clearBit(S, j)  (S &= ~(1 << j))
#define     toggleBit(S, j) (S ^= (1 << j))
#define     lowBit(S)       (S & (-S))
#define     setAll(S, n)    (S = (1 << n) - 1)
#define     isPowerOfTwo(S) (!(S & (S - 1)))
#define     nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
#define     turnOffLastBit(S) ((S) & (S - 1))
#define     turnOnLastZero(S) ((S) | (S + 1))
#define     turnOffLastConsecutiveBits(S) ((S) & (S + 1))
#define     turnOnLastConsecutiveZeroes(S) ((S) | (S - 1))
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

int N=1e5;    

 
int32_t main()
 
{  
    

    IOS;
    string s;
    cin>>s;
    int n=s.length();
   // cout<<n<<endl;
    if(s[n-1]=='s'){
    	s.push_back('e');
  		s.push_back('s');  	
	}
	else{
		s.push_back('s');
	}
	cout<<s;
    	
    

   
}

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

using namespace std;

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

	unsigned long long ans = 0;

	for (int i = 0; i < n; i++)
	{
		unsigned long long a;
		cin >> a;

		ans += (a - 1);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
//created by missever

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

struct node
{
    char c;
    long long l;
};

node a[2005],b[1005],c[1005],d[2005];
int na,nb,nc,nd;

int main()
{
    char e;
    int i,j,k;
    while(scanf(" %c",&e) && e != '$')
    {
        a[na].c = e;
        scanf("%lld",&a[na++].l);
    }
    while(scanf(" %c",&e) && e != '$')
    {
        b[nb].c = e;
        scanf("%lld",&b[nb++].l);
    }
    while(scanf(" %c",&e) && e != '$')
    {
        c[nc].c = e;
        scanf("%lld",&c[nc++].l);
    }
    for(i = 0; i <= na - nb; i++)
    {
        if(a[i].c != b[0].c || a[i].l < b[0].l) continue;
        if(nb == 1)
        {
            for(nd = 0; nd < i; nd++) d[nd] = a[nd];
            for(k = 0; k < nc; k++) d[nd++] = c[k];
            if(a[i].l > b[0].l)
            {
                d[nd] = a[i];
                d[nd++].l -= b[0].l;
            }
            for(k = i + 1; k < na; k++) d[nd++] = a[k];
            break;
        }
        else
        {
            for(j = 1; j < nb; j++)
            {
                if(a[i+j].c != b[j].c || a[i+j].l != b[j].l) break;
            }
            if(j >= nb - 1)
            {
                if(a[i+nb-1].c == b[nb-1].c && a[i+nb-1].l >= b[nb-1].l)
                {
                    for(nd = 0; nd < i; nd++) d[nd] = a[nd];
                    if(a[i].l > b[0].l)
                    {
                        d[nd] = a[i];
                        d[nd++].l -= b[0].l;
                    }
                    for(k = 0; k < nc; k++) d[nd++] = c[k];
                    if(a[i+nb-1].l > b[nb-1].l)
                    {
                        d[nd] = a[i+nb-1];
                        d[nd++].l -= b[nb-1].l;
                    }
                    for(k = i + nb; k < na; k++) d[nd++] = a[k];
                    break;
                }
            }
        }
    }
    if(i <= na - nb)
    {
        na = 0;
        a[na] = d[0];
        for(i = 1; i < nd; i++)
        {
            if(d[i].c == a[na].c) a[na].l += d[i].l;
            else a[++na] = d[i];
        }
        na++;
    }
    for(i = 0; i < na; i++) printf("%c %lld ",a[i].c,a[i].l);
    printf("$\n");
    return 0;
}

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

using namespace std;

typedef long long ll;

int32_t main(){

    int n, k;
    cin >> n >> k;
    ll arr[n];
    for(int i = 0; i < n; i++)
        cin >> arr[i];

    sort(arr, arr+n);
    ll tot = 0;
    for(int i = 0; i < n-k; i++)
        tot += arr[i];
    cout << tot << endl;
    return 0;
}

Measured memory_bytes: 1792
namespace ABC062_Grouping
{
    using System;
    using System.Linq;

    class Program
    {
        private static int[][] groupArray = new int[][]
        {
            new int[]{ 1, 3, 5, 7, 8, 10, 12 },
            new int[]{ 4, 6, 9, 11 },
            new int[]{ 2 },
        };

        static void Main(string[] args)
        {
            // 入力
            int[] items = Console.ReadLine().Split(' ').Select(elem => int.Parse(elem)).ToArray();

            // 処理
            string answer = "No";
            foreach (var group in groupArray)
            {
                if (group.Contains(items[0]) && group.Contains(items[1]))
                {
                    answer = "Yes";
                    break;
                }
            }


            // 出力
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13396
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>

using namespace std;

int main()
{
	char op;
	int A,B;
	scanf("%d %c %d",&A,&op,&B);
	if( op == '+')
	printf("%d\n",A + B);
	else if( op == '-')
	printf("%d\n",A - B);
	return 0;
}


Measured memory_bytes: 128
// https://atcoder.jp/contests/abc112/tasks/abc112_d

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 1e5;
const int M_MAX = 1e9;

int N, M;

void solve() {
  int ans = 1;
  for (int i = 1; i * i <= M; i++) {
    if (M % i == 0) {
      if (M / i >= N) ans = max(ans, i);
      if (i >= N) ans = max(ans, M / i);
    }
  }
  printf("%d\n", ans);
}

void input() {
  scanf("%d%d", &N, &M);
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
        using namespace std;
        int main()
        {
          int a,b; cin>>a>>b;
          if(a%10==0||b%10==0)
          {
            cout<<"-1";
            return 0;
          }
          if(a>=10||b>=10)
          {
            cout<<"-1";
            return 0;
          }
          cout<<a*b;
          return 0;
        }

Measured memory_bytes: 256
main :: IO ()
main = do
  _ <- getLine
  as <- fmap (map read . words) getLine :: IO [Int]
  print . solve $ as

solve :: [Int] -> Int
solve (a:b:[]) = if a == b then 1 else 0
solve (a:b:c:as)
  | a == b = if b == c
    then (1 + solve (c:as))
    else (1 + solve (b:c:as))
  | otherwise = solve $ b:c:as
solve _ = 0


Measured memory_bytes: 892
#include <bits/stdc++.h>
#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)
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;

int main() {
  ll x;
  cin >> x;
  int i = 0;
  ll money = 100;
  while (true) {
    money = (ll)floor(money * 1.01);
    i++;
    if (money + 1 > x) {
      break;
    }
  }
  cout << i << endl;
}


Measured memory_bytes: 3768
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>

using namespace std;

int main() {
    string s;
    cin >> s;
    
    int fir = stoi(s.substr(0,2));
    int sec = stoi(s.substr(2));
    string typ;
    
    if ((0 < fir) && (fir <= 12)) {
        if ((0 < sec) && (sec <= 12)) {
            typ = "AMBIGUOUS";
        }
        else {
            typ = "MMYY";
        }
    
    } else {
    
        if ((0 < sec) && (sec <= 12)) {
            typ = "YYMM";
        }
        else {
            typ = "NA";
        }

    }
    cout << typ << endl;


    return 0;
}


Measured memory_bytes: 256
D,G=map(int,input().split())
pc=[0]+[list(map(int,input().split())) for _ in range(D)]
def f(G,i):
  if i==0:
    return 1e9
  n=min(G//(i*100),pc[i][0])
  s=n*i*100
  if n==pc[i][0]:
    s+=pc[i][1]
  if s<G:
    n+=f(G-s,i-1)
  return min(n,f(G,i-1))
print(f(G,D))

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

int main()
{
    long long int a[3];
    for (int i = 0;i<3;i++)
        cin >> a[i];
    sort(a, a + 3);
    if(a[2]%2==0||a[1]%2==0||a[0]%2==0)
        cout << 0;
    else
        cout << a[0] * a[1];
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int a,b;
	string ch;
	while(1){
		cin>>a>>ch>>b;
		if(ch=="?")		break;
		else if(ch=="+")	cout<<a+b<<endl;
		else if(ch=="-")	cout<<a-b<<endl;
		else if(ch=="*")	cout<<a*b<<endl;
		else	cout<<a/b<<endl;
		
	}
	return 0;
}


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

using namespace std;

int main()
{
    string S,T;
    cin >> S >> T;
    int l = S.length();
    int count = 0;
    for(int i = 0; i < l; i++)
    {
        if(S[i] != T[i]) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3912
/*author : Yashvardhan
Sunday, May 10, 2020
9:50 PM
*/

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

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}

set<int> tmp;
int n;
void solve(int i, string s){
	
	int val;
	if(!i) val = inf;
	else val = stoll(s);
	if(val <= n){
		set<char> ts;
		for(auto it : s){
			ts.insert(it);
		}
		if(ts.size() == 3) tmp.insert(val);
	} 
	if(i == 10){
		return;
	}
	vector<char> arr = {'3', '5', '7'};
	for(auto it : arr){
		solve(i + 1, s + it);
	}
}

signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	cin >> n;
	
	solve(0,"");
	cout << tmp.size() << endl;

	t2 = clock();
	cerr << endl << t2-t1 << endl;
	
	return 0;
}



Measured memory_bytes: 1536
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, a, b;
const int maxN = (int)1e5 + 10;
ll x[maxN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    cin >> n >> a >> b;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        cin >> x[i];
        if (i > 1) {
            ans += min(a * (x[i] - x[i - 1]), (ll)b);
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
while (inp = gets) && inp.chomp! != '0'
  ss = []
  n = inp.to_i
  n.times{ss << gets.chomp}
  g = Array.new(26){Array.new(26,false)}
  ng = false
  n.times{|i|
    i.times{|j|
      if [ss[i].size,ss[j].size].min.times{|k|
          if ss[i][k] != ss[j][k]
            g[ss[j][k].ord-'a'.ord][ss[i][k].ord-'a'.ord] = true
            break
          end
        }
        ng = true if ss[i].size < ss[j].size
      end
    }
  }
  26.times{|k|
    26.times{|i|
      26.times{|j|
        g[i][j] |= g[i][k]&&g[k][j]
        ng |= i==j && g[i][j]
      }
    }
  }
  puts ng ? 'no' : 'yes'
end

Measured memory_bytes: 6136
#include<stdio.h>
#include<string.h>
int main()
{
	int n,i,t,d[201]={0},s[2];
	for(;scanf("%d",&n),n;memset(d,0,sizeof(d)))
	{
		s[0]=s[1]=n;
		for(i=0;i<n;d[t]=1,i++)
			scanf("%d",&t);
		for(i=1,t=0,n*=2;s[0]!=0&&s[1]!=0;)
		{
			if(d[i]!=-1&&d[i]!=t)
			{
				s[t]--;
				d[i]=-1;
				t^=1;
			}
			i=i%n+1;
			if(i==1)
				t^=1;
		}
		printf("%d\n%d\n",s[1],s[0]);
	}
	return 0;
}

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  int D, N;
  cin >> D >> N;
  ll v;
  v = 1;
  for (int i = 0; i < D; i++) {
    v *= 100;
  }
  if (N == 100)
    N++;
  cout << v * N << endl;
  return 0;
}

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

#define endl '\n'

using namespace std;

string s;
void read()
{
    cin >> s;
}

void solve()
{
    if (s[2] == s[3] && s[4] == s[5])
        cout << "Yes" << endl;

    else
        cout << "No" << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    read();
    solve();
}


Measured memory_bytes: 256
if __name__ == '__main__':
    n = int(input())
    graph = [[0 for i in range(n)] for _ in range(n)]
    frist = [0 for _ in range(n)]
    end = [0 for _ in range(n)]
    visit = [False for _ in range(n)]
    # get the group
    for i in range(n):
        datas = [int(num) for num in input().split(' ')]
        if datas[1] > 0:
            for j in datas[2:]:
                graph[datas[0] - 1][j - 1] = 1

    visit[0] = True
    frist[0] = s = 1
    stack = [0]

    while len(stack) != 0:
        point = stack.pop(-1)
        flag = False
        for i in range(n):
            if graph[point][i] == 1 and visit[i] is False:
                visit[i] = True
                flag = True
                s += 1
                frist[i] = s
                stack.append(point)
                stack.append(i)
                break
        if flag is False:
            s += 1
            end[point] = s
        
        if len(stack) == 0:
            for i in range(n):
                if visit[i] is False:
                    visit[i] = True
                    s += 1
                    frist[i] = s
                    stack.append(i)
                    break
            
    for i in range(n):
        print('%d %d %d' % (i+1, frist[i], end[i]))


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

using namespace std;

int MAX_POINTS = 100;

struct cross_point{
	int index;
	double rate;
	cross_point(int _index, double _rate) {
		index = _index;
		rate = _rate;
	}
	bool operator<(const cross_point &right) const {
		return rate < right.rate;
	}
};

double cross_rate(double a, double b, double c, double d, double e, double f, double g, double h) {
	double child = (g-e)*(f-b)-(h-f)*(e-a);
	double mother = (g-e)*(d-b)-(h-f)*(c-a);
	return (mother==0.0)?-1.0:child/mother;
}

int main() {
	int n;
	scanf("%d",&n);
	while(n>0) {
		double lines[MAX_POINTS][4];
		vector<vector<cross_point> > cross_points(n);
		for(int i = 0; i < n; i++) {
			cross_points[i] = vector<cross_point>();
		}
		for(int i = 0; i < n; i++) {
			int a,b,c,d;
			scanf("%d%d%d%d",&a,&b,&c,&d);
			lines[i][0] = a;
			lines[i][1] = b;
			lines[i][2] = c;
			lines[i][3] = d;
		}

		for(int i = 0; i < n-1; i++) {
			for(int j = i+1; j <n; j++) {
				double rate = cross_rate(lines[i][0],lines[i][1],lines[i][2],lines[i][3],lines[j][0],lines[j][1],lines[j][2],lines[j][3]);
				double rate2 = cross_rate(lines[j][0],lines[j][1],lines[j][2],lines[j][3],lines[i][0],lines[i][1],lines[i][2],lines[i][3]);
				if(rate>=0.0&&rate<=1.0) {
					cross_points[i].push_back(cross_point(j,rate));
					cross_points[j].push_back(cross_point(i,rate2));
				}
			}
		}
		
		for(int i = 0; i < n; i++) {
			sort(cross_points[i].begin(),cross_points[i].end());
		}

		int ans = 0;
		bool drawed[100];
		for(int i = 0; i < n; i++) drawed[i] = false;
		for(int i = 0; i < n; i++) {
			drawed[i] = true;
			double len = (lines[i][0]-lines[i][2])*(lines[i][0]-lines[i][2])+(lines[i][1]-lines[i][3])*(lines[i][1]-lines[i][3]);
			double rate = 0.0;
			for(int j = 0; j < cross_points[i].size(); j++) {
				if(drawed[cross_points[i][j].index]) {
					double distance = len*(cross_points[i][j].rate-rate)*(cross_points[i][j].rate-rate);
					if(distance>=1.0e-20) ans++;
					rate = cross_points[i][j].rate;
				}
			}
			if(len*(1.0-rate)*(1.0-rate)>=1.0e-20) ans++;
		}
		printf("%d\n",ans+1);
		scanf("%d",&n);
	}
}



Measured memory_bytes: 2736
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
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; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  ll n; cin >> n;
  int mi=inf;
  for(ll i=1 ; i*i<=n ; i++){
    if(n%i == 0){
      string s = to_string(i);
      string t = to_string(n/i);
      int ss=s.size(), ts=t.size();
      chmin(mi, max(ss, ts));
    }
  }
  cout << mi << endl;
  return 0;
}


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

int main(int argc, const char * argv[]) {
    // insert code here...
    int N;
    cin >> N;
    int res = 0;
    int n = N;
    while (true) {
        res += n % 10;
        if (n % 10 == 0) break;
        else n /= 10;
    }
    
    if (N % res == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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



int main() {
  string s;
  cin >> s;
  string ans = "No";
  if(s[2]==s[3] && s[4]==s[5]) ans = "Yes";
  cout << ans << endl;
  
  
  return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

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

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T>
inline T LCM(T a, T b) { return (a + (b - 1)) / b; }
template<class T>
inline T round_int(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

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

bool cmp(ii a, ii b) {
	return a.second < b.second;
}

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

	vii a;
	a.resize(m);

	rep(i, m) cin >> a[i].first >> a[i].second;
	sort(ASC(a), cmp);

	int res = 0;
	int end_time = 0;
	rep(i, m) {
		if (a[i].first >= end_time) {
			end_time = a[i].second;
			res++;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


void solve(){
    int N, K;
    cin >> N >> K;
    vector<int> cnt(N);
    REP(i,K){
        int d;
        cin >> d;
        REP(j,d){
            int a;
            cin >> a;
            --a;
            cnt[a]++;
        }
    }
    int ans = 0;
    REP(i,N) if(cnt[i] == 0) ans++;
    cout << ans << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}


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

int main(){
	int N, i, ans = 0;
	scanf("%d", &N);
	vector<int> V(N), C(N);
	for(i = 0; i < N; i++){
		scanf("%d", &V[i]);
	}
	for(i = 0; i < N; i++){
		scanf("%d", &C[i]);
	}
	for(i = 0; i < N; i++){
		ans += max(0, V[i] - C[i]);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=1<<29,MOD=1e9+7;

int main(){
	int n,k; cin>>n>>k;
	long ans=0;
	for(int b=k+1;b<=n;b++){
		ans+=n/b*(b-k);
		if(n-(n/b*b)!=0){
			if(!k){
				ans+=n-(n/b*b);
			}else{
				ans+=max(0,n-(n/b*b)-k+1);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 200;
int n;
int v[N];
int main() {
	cin>>n;
	bool ok = true;
	for(int i = 0; i < n; ++i) {
		cin>>v[i];
		if(v[i] % 2 == 0) {
			if(v[i] % 3 != 0 and v[i] % 5 != 0) {
				ok = false;
				break;
			}
		}
	}
	if(ok) puts("APPROVED");
	else puts("DENIED");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    for(int i=0;i<10000;i++) cout<<-1<<endl;
}



Measured memory_bytes: 1120
import java.math.BigInteger;
import java.util.Scanner;

// 提出時にclass Main に書き換え
public class Main {
	public static void main(String[] args)  {
		// 標準入力を受け取る
		Scanner sc = new Scanner(System.in);
		BigInteger N = sc.nextBigInteger(); // BigInteger Nを受け取る
		sc.close(); // 標準入力を終了

		// Nを9で割った数の余り
		BigInteger m = N.remainder(BigInteger.valueOf(9));

		if(m.compareTo(BigInteger.ZERO) == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

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

int six_ten(char x){
	if(x >= '0' && x <= '9'){
		return x - '0';
	}
	else{
		return 10 + (x - 'a');
	}
}
 
int main(){
    int color_data[8][3] = { {0, 0, 0}, 
                   {0, 0, 255}, 
                   {0, 255, 0},
                   {0, 255, 255}, 
                   {255, 0, 0}, 
                   {255, 0, 255},
                   {255, 255, 0}, 
                   {255, 255, 255}};

	string color[8] = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"};
	string s;
	while(true){
		cin >> s;
		if(s == "0")break;
		int r,g,b;
		r = 16 * six_ten(s[1]) + six_ten(s[2]);
		g = 16 * six_ten(s[3]) + six_ten(s[4]);
		b = 16 * six_ten(s[5]) + six_ten(s[6]);

		double maxi = DBL_MAX;
		int key;
		for(int i = 0; i < 8; i++){
			double R = r - color_data[i][0];
			double G = g - color_data[i][1];
			double B = b - color_data[i][2];
			R *= R;
			G *= G;
			B *= B;
			double RGB = sqrt(R + G + B);
			if(RGB < maxi){
				maxi = RGB;
				key = i;
			}
		}
		cout << color[key] << endl;
	}
    return 0;
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int ans=0;
	while(n>=500)
	{
		n-=500;
		ans+=1000;
	}
	while(n>=5)
	{
		n-=5;
		ans+=5;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256