akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

typedef long long LL;
static LL INF = (1LL<<62);

int E[200002] = {0};
map<int, int> M;

int f(int s, int e, int pos){
	int c = 0, b = -1, ret = 0;
	if(s > e || E[s] == 1 || E[e] == 1){
		return 1;
	}
	if(s == e){
		return 0;
	}
	if(pos <= 0){
		for(auto itr = M.begin(); itr != M.end(); itr++){
			int k = itr->first;
			int v = itr->second;
			if(s <= k && k <= e -1){
				return 1;
			}
		}
		return 0;
	}
	if(pos >= 1){
		b = E[pos];
		E[pos] = 1;
	}
	for(int i=s; i<=e; i++){
		if(E[i] == 1){
			c++;
		}
		else{
			c = 0;
		}
		if(c >= 2){
			break;
		}
	}
	if(c >= 2){
		ret = 1;
	}
	else{
		ret = 0;
	}
	if(pos >= 1){
		E[pos] = b;
	}
	return ret;
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL N, A, B, C ,D;
	string S;
	cin >> N >> A >> B >> C >> D;
	cin >> S;
	int p = 0, c = 0;
	for(int i=0; i<S.size(); i++){
		if(S[i] == '#'){
			E[i+1] = 1;
			if(c == 0){
				p = i+1;
			}
			c++;
		}
		else{
			if(c > 1){
				M[p] = 1;
			}
			c = 0;
		}
	}

	if(C < D){
		if(f(B, D, -1) == 1 || f(A, C, -1) == 1){
			printf("No\n");
		}
		else{
			printf("Yes\n");
		}
		return 0;
	}

	if(f(B, D, -1) == 1){
		printf("No\n");
		return 0;
	}
	if(f(A, C, D) == 0){
		printf("Yes\n");
		return 0;
	}
	for(int k=0; k<=D-B; k++){
		if(B+k-1 < 1 || B+k+1 >= N){
			continue;
		}
		if(D-k-1 < 1 || D-k+1 >= N){
			continue;
		}
		if(E[B+k-1] != 0 || E[B+k] != 0 || E[B+k+1] != 0){
			continue;
		}
		if(f(B, B+k, -1) == 0 && f(B+k, D, -1) == 0 && f(A, C, B+k) == 0){
			printf("Yes\n");
			return 0;
		}
		if(E[D-k-1] != 0 || E[D-k] != 0 || E[D-k+1] != 0){
			continue;
		}
		if(f(D-k, D, -1) == 0 && f(B, D-k, -1) == 0 && f(A, C, D-k) == 0){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}


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

int main()
{
    int A, B;
    cin >> A >> B;
    
    if (A >= 13) {
        cout << B << endl;
    }else if (6 <= A && A <= 12){
        cout << B/2 << endl;
    }else{
        cout << 0 << endl;
    }

}

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

int main() {
  // ここにプログラムを追記
  int a;
  cin >> a;
  int sum = 0;
  //1桁目
  sum += a%2;
  //2桁目
  int b = a/10;
  sum += b%2;
  //3桁目
  int c = b/10;
  sum += c%2;
 
  cout << sum << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
 
public class Main implements Runnable {
 
  public void run() {
    BetterScanner scanner = new BetterScanner(System.in);
  
    int n = scanner.nextInt();
    int a = scanner.nextInt();
    int b = scanner.nextInt();

    if ((b - a) % 2 == 0) {
      System.out.println("Alice");
    } else {
      System.out.println("Borys");
    }
  }
 
  public static void main(String[] args) {
    Main main = new Main();
    main.run();
  }
 
  // scanner slightly faster than usual ones
  public static class BetterScanner {
 
    private InputStream stream;
    private byte[] buffer = new byte[1024];
    private int pointer = 0;
    private int bufferLength = 0;
 
    public BetterScanner(InputStream stream) {
      this.stream = stream;
    }
 
    private boolean updateBuffer() {
      if (pointer >= bufferLength) {
        pointer = 0;
        try {
          bufferLength = stream.read(buffer);
        } catch (IOException exception) {
          exception.printStackTrace();
        }
        return bufferLength > 0;
      } else {
        return true;
      }
    }
 
    private int read() {
      if (updateBuffer()) {
        return buffer[pointer ++];
      } else {
        return -1;
      }
    }
 
    public boolean hasNext() {
      skipUnprintable();
      return updateBuffer();
    }
 
    private void skipUnprintable() { 
      while (updateBuffer() && !isPrintableChar(buffer[pointer])) {
        pointer ++;
      }
    }
 
    public String next() {
      if (hasNext()) {
        StringBuilder builder = new StringBuilder();
        int codePoint = read();
        while (isPrintableChar(codePoint)) {
          builder.appendCodePoint(codePoint);
          codePoint = read();
        }
        return builder.toString();
      } else {
        throw new NoSuchElementException();
      }
    }
 
    public long nextLong() {
      if (hasNext()) {
        long number = 0;
        boolean minus = false;
        int codePoint = read();
        if (codePoint == '-') {
          minus = true;
          codePoint = read();
        }
        if (codePoint >= '0' && codePoint <= '9') {
          while (true) {
            if (codePoint >= '0' && codePoint <= '9') {
              number *= 10;
              number += codePoint - '0';
            } else if (codePoint < 0 || !isPrintableChar(codePoint)) {
              return (minus) ? -number : number;
            } else {
              throw new NumberFormatException();
            }
            codePoint = read();
          }
        } else {
          throw new NumberFormatException();
        }
      } else {
        throw new NoSuchElementException();
      }
    }
 
    public int nextInt() {
      long number = nextLong();
      if (number >= Integer.MIN_VALUE && number <= Integer.MAX_VALUE) {
        return (int)number;
      } else {
        throw new NumberFormatException();
      }
    }
 
    private boolean isPrintableChar(int codePoint) {
      return codePoint >= 33 && codePoint <= 126;
    }
 
  }
 
}

Measured memory_bytes: 21204
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
      os << *i;
  }
  return os;
}

ll W;
ll c[10],d[10];

void init(ll B[100]){
  rep(i,W-1){
    if(B[i]==1){
      c[i]++;
    }
  }
  rep(i,W){
    if(i==0){
      if(B[i]==0){
        d[i]++;
      }
    }
    else if(i==W-1){
      if(B[i-1]==0){
        d[i]++;
      }
    }
    else{
      if(B[i]==0 && B[i-1]==0){
        d[i]++;
      }
    }
  }
}

void dfs(ll i,ll B[100]){
  if(i>=W-1){
    init(B);
    return;
  }
  else{
    dfs(i+1,B);
    B[i]=1;
    dfs(i+2,B);
    B[i]=0;
  }
}

ll dp[1007][10];

int main(){
  ll H,K,B[100];
  rep(i,99){
    B[i]=0;
  }
  cin >> H >> W >> K;
  dfs(0LL,B);
  dp[0][0]=1;
  Rep(i,1,H+1){
    rep(j,W){
      dp[i][j]=(j>0 ? dp[i-1][j-1]*c[j-1] : 0)+dp[i-1][j]*d[j]+(j<W-1 ?  dp[i-1][j+1]*c[j] : 0);
      dp[i][j]%=MOD;
    }
  }
  cout << dp[H][K-1] << endl;
}

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

using ll = long long;
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
// #define INF 1e9
const ll INF = 1LL << 60;

void warshallFloyd(vector<vector<ll>>& g){
  int n = g.size();
  REP(k, n){
    REP(i, n){
      REP(j, n){
        if(g[i][k] == INF || g[k][j]==INF) continue;
        if(g[i][k] + g[k][j] < g[i][j]){
          g[i][j] = g[i][k] + g[k][j];
        }
      }
    }
  }
}

int main(){
  int V, E;
  cin >> V >> E;
  vector<vector<ll>> g(V, vector<ll>(V, INF));
  REP(i, E){
    int s, t;
    ll d;
    cin >> s >> t >> d;
    g[s][t] = d;
  }
  REP(i, V){
    g[i][i] = 0;
  }
  warshallFloyd(g);
  REP(i, V){
    if(g[i][i] < 0){
      cout << "NEGATIVE CYCLE" << endl;
      return 0;
    }
  }
  REP(i, V){
    REP(j, V){
      if(g[i][j] == INF){
        cout << "INF" << (j != V-1 ? " " : "");
      }
      else{
        cout << g[i][j] << (j!=V-1 ? " " : "");
      }
    }
    cout << endl;
  }
  return 0;
}




Measured memory_bytes: 3236
ch = input()
if ch == 'a' or ch == 'b' or ch == 'c' or ch == 'd' or ch == 'e' or ch == 'f' or ch == 'g' or ch == 'h':
  print('a')
elif ch == 'i' or ch == 'j' or ch == 'k' or ch == 'l' or ch == 'm' or ch == 'n' or ch == 'o':
  print('a')
elif ch == 'p' or ch == 'q' or ch == 'r' or ch == 's' or ch == 't' or ch == 'u' or ch == 'v':
  print('a')
elif ch == 'w' or ch == 'x' or ch == 'y' or ch == 'z':
  print('a')
else:
 print('A')


Measured memory_bytes: 9132
#include<stdio.h>
#define MAX 44

int main(){
  int n, i; 
  int F[50];

  scanf("%d", &n);
  if(n>MAX){
    printf("Number must be smaller than 44!\n");
    return -1;
  }
  
  F[0] = F[1] = 1;
  for ( i = 2; i <= n; i++ ){
    F[i] = F[i-1] + F[i-2];
  }

  printf("%d\n", F[n]);

  return 0;
}



Measured memory_bytes: 2720
import java.io.*;
import java.util.*;

public class Main {
	private static final int READ_COUNT = 1;
	private static List<String> strList = new ArrayList<>();
	
	public static void main(String[] args) {
		read();
		
		int a = Integer.parseInt(strList.get(0).split(" ")[0]);
		int b = Integer.parseInt(strList.get(0).split(" ")[1]);
		
		System.out.println((a * b) - (a + b - 1));
	}
	
	private static void read() {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			}
		} catch (IOException e) {
		}
	}
}


Measured memory_bytes: 21204
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;


public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
 
    /**
     * @param args
     */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int[]			num = null;
		int				max = 0;
		Stack<int[]>	stk = new Stack<int[]>();

		while((num = parseNum()) != null) {
			max = Math.max(max, num[0]);
			stk.push(num);
		}

		if (stk.size() > 0) {
			long[][]	np = new long[max+2][100*(max+1)+1];

			np[0][0] = (long)1;
			for(int i = 0; i <= 100; i++){
				for(int j = max; j >= 0; j--){
					for(int k = 0;k + i <= 100*(max+1); k++){
						np[j + 1][k + i] += np[j][k];
					}
				}
			}

			for (int i = 0; i < stk.size(); i++) {
				int[]	tmp = stk.get(i);
	            System.out.println(np[tmp[0]][tmp[1]]);
			}
		}
	}

	private static int[] parseNum() {
		int[]	param = null;
		String	strin = null;

		if ((strin = parseStdin()) != null) {
			String[]	lines = strin.split(" ");

			param    = new int[2];
			param[0] = Integer.parseInt(lines[0]);
			param[1] = Integer.parseInt(lines[1]);

			if (param[0] == 0 && param[1] == 0) {
				param = null;
			}
		}
 
		return param;
	}

	private static String parseStdin() {
        String  stdin = null;
        
        try {
        	String  tmp = br.readLine();
        	if (tmp != null) {
            	if (!tmp.isEmpty()) {
            		stdin = tmp;
            	}
        	}
        }
        catch (IOException e) {}
 
        return stdin;
	}
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  int d[n];
  REP(i, n) cin >> d[i];
  int ans = 0;
  REP(i, n) for (int j = i + 1; j < n; ++j) ans += d[i] * d[j];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)
def judge(n,s):
    if s[n-5:n] == "erase":
        return n-5
    elif s[n-5:n] == "dream":
        return n-5
    elif s[n-6:n] == "eraser":
        return n-6
    elif s[n-7:n] == "dreamer":
        return n-7
    else:
        return -1

while n>=5:
    n = judge(n,s)

if n == 0:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define MP make_pair
#define llu unsigned long long
#define U unsigned int
#define ff first
#define ss second
#define SIZE 100005
#define pie 3.14159265358979323
#define minuss 1e-6
#define pair pair<ll,ll>
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL)
#define BIG 1000000000000
#define INF 1000000000000005
#define N 10000
vector<ll>vec;
map<string,ll> mps;
map<ll,string> mpss;
set<ll>s1;
set<string>s2;
map<string,ll>::iterator str;
set<ll>::iterator itr;
/*
std::cout << std::fixed;
std::cout << std::setprecision(1);
std::cout << VALUE NAME<<endl;
*/
ll tra[100006],tra1[100006];


int main()
{
    fast_cin;
    ll t;

        map<ll,ll>mp;
        map<ll,ll>::iterator it;
        string s,s1;
        ll lock=0,sum=0,co=0,ans;
        ll n,m,k;
        cin>>n>>m>>k;
        ll a[n+1],b[m+1],aa[n+1],bb[m+1];
        aa[0]=0;
        bb[0]=0;
        for(int i=1; i<=n; i++)
        {
            cin>>a[i];
            aa[i]=aa[i-1]+a[i];
        }
        for(int i=1; i<=m; i++)
        {
            cin>>b[i];
            bb[i]=bb[i-1]+b[i];
        }

        sum=n+m;
        while(co<=sum)
        {
            ll mid=(co+sum)/2;
            lock=BIG;
            for(int i=0; i<=mid; i++)
            {
                if(i<=n&&(mid-i)<=m)
                {
                    lock=min(lock,aa[i]+bb[mid-i]);
                }
            }

            if(lock==k)
            {
                ans=mid;
                break;
            }
            else if(lock<k)
            {
                ans=mid;
                co=mid+1;
            }
            else if(lock>k)
                sum=mid-1;
            
        }
        cout<<ans;

        s1.clear();
        vec.clear();

}



Measured memory_bytes: 9808
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    _ = INT()
    A = LIST()
    c = Counter(A)
    print(len(c.keys()) - (sum(c.values()) - len(c.keys())) % 2)


if __name__ == '__main__':
    main()

Measured memory_bytes: 62388
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
const int SIZE=262144;
struct SegTree{
	ll f[SIZE<<2]={};
	void addpoint(int pos,int v){
		pos+=SIZE-1; 
		f[pos]=v;
		while(pos){
			pos=pos-1>>1;
			f[pos]=min(f[pos+pos+1],f[pos+pos+2]);
		}
	}
	ll query(int l,int r,int l1=0,int r1=SIZE-1,int k=0){
		if(l<=l1&&r1<=r)return f[k];
		if(r<l1||r1<l)return (ll)1e18;
		int mid=l1+r1>>1;
		ll vl=query(l,r,l1,mid,k+k+1);
		ll vr=query(l,r,mid+1,r1,k+k+2);
		return min(vl,vr);
	}
}odd,even;
int n,cnt=0;
int a[222222],pos[222222];
set<pair<int,pair<int,int> > >S;//start,segment
void add_set(int l,int r){
	if(l>=r)return;
	int T1=(l&1?odd.query(l,r-1):even.query(l,r-1)),T2=(pos[T1]&1?even.query(pos[T1],r):odd.query(pos[T1],r));
	if(pos[T1]<l){
		stack<int>st;while(1)st.pop();
	}
	if(T2>=3e5)return;cnt++;
	S.insert(make_pair(T1,make_pair(l,r)));
}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)pos[a[i]]=i;
	for(int i=1;i<=n;i+=2)odd.addpoint(i,a[i]),even.addpoint(i,inf);
	for(int i=2;i<=n;i+=2)even.addpoint(i,a[i]),odd.addpoint(i,inf);
	add_set(1,n);
	while(S.begin()!=S.end()){
		int v1=S.begin()->first;
		pair<int,int>segment=S.begin()->second;
		int v2=(pos[v1]&1?even.query(pos[v1],segment.second):odd.query(pos[v1],segment.second));
		cout<<v1<<" "<<v2<<" ";
		odd.addpoint(pos[v1],inf);even.addpoint(pos[v1],inf);
		odd.addpoint(pos[v2],inf);even.addpoint(pos[v2],inf);
		S.erase(S.begin());int l,r;tie(l,r)=segment;
		if(pos[v1]<l){
			cout<<"sjcakioi";
			return 0;
		}
		add_set(l,pos[v1]-1);add_set(pos[v1]+1,pos[v2]-1);add_set(pos[v2]+1,r);
	}
	cerr<<endl<<cnt<<endl;
	return 0;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))
#define endl '\n'

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <ll, ll> pll;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
//g++ -std=c++11 your_file.cpp -o your_program

ll mypow(ll a, ll b){
	ll ans=1;
	while(b){
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ifstream in("");
	ofstream out("");
	clock_t begin = clock();
	string s;
	cin >> s;
	int res = INF;
	REP(i, SZ(s) - 2){
		int tmp = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
		res = min(res, abs(753 - tmp));
	}
	cout << res << endl;
	clock_t end = clock();
    double esecs = double(end - begin) / CLOCKS_PER_SEC;
    //cout << esecs << " seconds" << endl;
	return 0;	
}

Measured memory_bytes: 256
fun main(args:Array<String>) {
	val x = readLine()!!.toInt()
	if(x<=3){
		println(1)
		return
	}
	(2..32).map{ b->
		val bp = mutableListOf<Int>()
		var acc=b*b
		while(acc<=x){
			bp.add(acc)
			acc*=b
		}
		return@map bp
	}.flatten().max().let{ println(it) }
	
}

Measured memory_bytes: 33648
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    int n;
    scan(n);

    auto luca = new long[](100);
    luca[0] = 2, luca[1] = 1;

    foreach (i ; 2 .. 100) {
        luca[i] = luca[i - 1] + luca[i - 2];
    }

    writeln(luca[n]);
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}



struct Queue(T) {
    private {
        int N, head, tail;
        T[] data;
    }

    this(int n) {
        N = n + 1;
        data = new T[](N);
    }

    bool empty() {
        return head == tail;
    }

    bool full() {
        return (tail + 1) % N == head;
    }

    T front() {
        return data[head];
    }

    void push(T x) {
        assert(!full);
        data[tail++] = x;
        tail %= N;
    }

    void pop() {
        assert(!empty);
        head = (head + 1) % N;
    }

    void clear() {
        head = tail = 0;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PI 3.14159265358979323846
using namespace std;
int main(){
  double a,b,x;cin>>a>>b>>x;
  if(x>a*a*b/2)cout<<setprecision(10)<<atan((a*a*b-x)*2/((double)a*a*a))*360/(2*PI);//すぐに漏れる 
  else cout<<setprecision(10)<<90-360*atan(2*x/((double)a*b*b))/(2*PI);
   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
	int l;
    int ans = 0;
    bool flag = false;
    cin >> l;
    vector<int> c(l);
    map<int, int> m;
    stack<int> s;
    rep(i,0,l){
        cin >> c[i];
        if(l == 1){
            if(c[i] > 0){
                cout << "OK" << endl;
                return 0;
            }else{
                cout << 1 << endl;
                return 0;
            }
        }
        if(flag) continue;
        if(c[i] > 0){
            if(m[c[i]] == 1){
                flag = true;
                ans = i+1;
            }else{
                m[c[i]] = 1;
                s.push(c[i]);
            }
        }else{
            int num = s.top();
            if(m[abs(c[i])] == 0){
                flag = true;
                ans = i+1;
            }else{
                if(num == abs(c[i])){
                    s.pop();
                    m[abs(c[i])] = 0;
                }else{
                    flag = true;
                    ans = i+1;
                }
            }
        }
    }
    if(ans == 0){
        cout << "OK" << endl;
        return 0;
    }else{
        cout << ans << endl;
        return 0;
    }
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define MAX 200005
#define INF 200005

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

ll gcd(ll i,ll j){
  if(i<j){
    swap(i, j);
  }
  ll r=i%j;
  while(r!=0){
    i=j;
    j=r;
    r=i%j;
  }
  return j;
}

ll f(ll num)
{
    if (num < 2) return 1;
    else if (num == 2) return 2;
    else if (num % 2 == 0) return 2; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return i;
        }
    }

    // 素数である
    return num;
}

vector<ll> factorList(ll x) {
  vector<ll> res;
  while (x != 1) {
    res.push_back(f(x));
    x /= f(x);
  }
  return res;
}


int main(){
  ll a, b;
  cin >> a >> b;
  vector<ll> v=factorList(gcd(a, b));
  set<ll> s;
  rep(i, v.size()){
    s.insert(v[i]);
  }

  cout << s.size()+1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

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

int main(){
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll g = GCD(max(C, D), min(C, D));
    ll l = (C * D) / g;
    //A-1以下において、該当するものの個数を求める
    ll ac = (A-1) / C;
    ll ad = (A-1) / D;
    ll acd = (A-1) / l;
    ll cnt_a = (A-1) - (ac + ad - acd);
    //B以下において、該当するものの個数を求める
    ll bc = B / C;
    ll bd = B / D;
    ll bcd = B / l;
    ll cnt_b = B - (bc + bd - bcd);
    ll ans = cnt_b - cnt_a;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
// #include <vector>
// #include <set>
// #include <queue>
// #include <stack>
// #include <algorithm>

using namespace std;

int N, M;
int a, b;
int cnt = 0;
int height[100010];
bool isGood[100010];

int main(){
    cin >> N >> M;
    for (int i = 1; i <= N; ++i){
        cin >> height[i];
        isGood[i] = true;
    }
    for(int j = 1; j <= M; ++j){
        cin >> a >> b;
        if(height[a] >= height[b]){
            isGood[b] = false;
        }
        if(height[b] >= height[a]){
            isGood[a] = false;
        }
    }
    for(int i = 1; i <= N; ++i){
        if(isGood[i]) {cnt++;}
    }
    cout << cnt;
    return 0;
}

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

int main(){
  set<int> bad;
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < K; i++){
    int x;
    cin >> x;
    bad.insert(x);
  }
  int ans = N;
  bool ok = false;
  while(ok == false){
    ok = true;
    int test = ans;
    while(test>0){
      int digit;
  	  digit = test % 10;
      if(bad.find(digit) != bad.end()){
        ok = false;
        break;
      }
      test /= 10;
    }
    if(ok == true){
      cout << ans << endl;
	  break;
    }
    ans++;
  }
  return 0;
}


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

using namespace std;

int main() {
	string n, d = "dream", dr = "dreamer", e = "erase", er = "eraser";
	int len, dx, ex;

	cin >> n;

	len = n.size();

	while (1) {
		if (n.find("er", len - 2)!=EOF) {
			dx = n.find(dr, len - 7);
			ex = n.find(er, len - 6);
		}
		else {
			dx = n.find(d, len -5);
			ex = n.find(e, len - 5);
		}
		if (dx == -1 && ex == -1) {
			cout << "NO";
			return 0;
		}
		if (dx == 0 || ex == 0) {
			cout << "YES";
			return 0;
		}
		if (dx > 0)
			n.erase(dx, len - 1);
		if (ex > 0)
			n.erase(ex, len - 1);
		len = n.size();
	}
}

Measured memory_bytes: 512
/**
 *      purpose : 
 *      author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *      created : 
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<typename T> inline void chmin(T &a, T b) { if (a > b) a = b; return; }
template<typename T> inline void chmax(T &a, T b) { if (a < b) a = b; return; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec) { os << '{'; for (size_t i = 0; i < vec.size(); ++i) { os << vec[i]; if (i != vec.size() - 1) os << ','; } os << '}'; return os; }
template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

constexpr int64 MOD = 998244353;

template<typename T> T mod_pow(T x, T n, T mod) {
  T res = 1;
  while (n > 0) {
    if (n & 1) (res *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return res;
}

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

  int n; cin >> n;
  map<int, int64> mp;
  for (int i = 0; i < n; ++i) {
    int d; cin >> d;
    if (i == 0 && d != 0) {
      cout << 0 << endl;
      return 0;
    }
    ++mp[d];
  }

  if (mp[0] != 1) {
    cout << 0 << endl;
    return 0;
  }

  int64 ans = 1;
  for (int i = 0; i < n; ++i) {
    (ans *= mod_pow(mp[i], mp[i + 1], MOD)) %= MOD;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6528
#include "bits/stdc++.h"
#define double long double
#define int long long
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf 10000000000000000 //10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define P pair<int,int>
#define prique priority_queue<P,vector<P>,greater<P>>
using namespace std;
struct edge { int to, cost; };
int n, q, k;
vector<edge>g[114514];
int d[114514];
void dijkstra(int s) {
	prique que;
	rep(i, n) d[i] = inf;
	d[s] = 0;
	que.push(P(0, s));
	while (que.size()) {
		P p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first) continue;
		rep(i, g[v].size()) {
			edge e = g[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}
signed main() {
	cin >> n;
	rep(i, n - 1) {
		int a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		edge e;
		e.to = b;
		e.cost = c;
		g[a].push_back(e);
		edge w;
		w.to = a;
		w.cost = c;
		g[b].push_back(w);
	}
	cin >> q >> k;
	k--;
	dijkstra(k);
	rep(i, q) {
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		cout << d[x] + d[y] << endl;
	}
}


Measured memory_bytes: 11504
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::ops::Bound::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;
//use ac_library_rs::*;

#[fastout]
fn main() {
    input! {
        n: i64,
    }

    let mut ans = 0i64;
    for a in 1..n {
        ans += (n - 1) / a;
    }

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


Measured memory_bytes: 2196
n = int(input())
uvw = [list(map(int, input().split())) for _ in range(n-1)]

g = [[] for _ in range(n)]

for u, v, w in uvw:
    u -= 1
    v -= 1
    g[u].append([v, w])
    g[v].append([u, w])


WHITE = 0
GRAY = 1
BLACK = 2

ds = [0] * n
colors = [WHITE] * n
ps = [-1] * n


def dfs(s):
    stack = []

    ds[s] = 0
    colors[s] = BLACK
    ps[s] = -1
    stack.append(ds[s])

    while stack:
        u = stack[-1]
        colors[u] = GRAY

        for v, w in g[u]:
            if colors[v] == WHITE:
                stack.append(v)
                ds[v] = ds[u] + w
                ps[v] = u
                g[u].remove([v, w])
                g[v].remove([u, w])
                break

        else:
            stack.pop()
            colors[u] = BLACK

    return ds, ps


dfs(0)

for d in ds:
    print(d % 2)


Measured memory_bytes: 69660
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <tuple>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repdm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)

int main()
{
  string S;
  ll K;
  cin >> S >> K;

  ll cnt = 0;
  string last;
  for (int i = 0; i < S.size(); i++)
  {
    if ((S[i] - '0') == 1)
    {
      cnt++;
      continue;
    }
    last = S[i];
    break;
  }

  if (cnt >= K)
  {
    cout << 1;
    return 0;
  }
  cout << last;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>

using namespace std;


/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back


/*---  Type ---*/
typedef long long ll;


/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// 4-direction
int dy4[] = {0,  1, -1,  0};
int dx4[] = {1,  0,  0, -1};

// 8-direction
int dy8[] = {0,  1,  1,  1,  0, -1, -1, -1};
int dx8[] = {1,  1,  0, -1, -1, -1,  0,  1};

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  rep(i, ty-sy) cout << 'U';
  rep(i, tx-sx) cout << 'R';

  cout << 'D';
  rep(i, tx-sx-1) cout << 'L';
  rep(i, ty-sy-1) cout << 'D';
  cout << 'L';

  cout << 'L';
  rep(i, ty-sy+1) cout << 'U';
  rep(i, tx-sx+1) cout << 'R';
  cout << 'D';

  cout << 'R';
  rep(i, 2) cout << 'D';
  rep(i, tx-sx-1) cout << 'L';
  rep(i, ty-sy-1) cout << 'D';
  rep(i, 2) cout << 'L';
  cout << 'U' << endl;

  return 0;
}

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

numR = 0
numG = 0
numB = 0

for _s in s:
	if _s == "R":
		numR += 1
	if _s == "G":
		numG += 1
	if _s == "B":
		numB += 1

ans = numR * numB * numG

for inv in range((len(s)-1)//2+1):
	if inv == 0:
		continue
	for ck in range(len(s)-(inv*2+1)+1):
		if s[ck] != s[ck+inv] and s[ck] != s[ck+inv*2] and s[ck+inv] != s[ck+inv*2]:
			ans -= 1

print(ans)


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

int main() {
  int n; cin >> n;
  int sum =0, m = 0;
  
  for(int i = 0; i < n; i++){
    int p; cin >> p;
    sum += p;
    m = max(m, p);
  }
  sum -= m/2;
  
  cout << sum << endl;
}


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

int main()
{
    int num, cardnum; //cnumだと警告が出る
    cin >> num;
    char mark;
    //check用データの作成,スペード=1,ハート=2,クラブ=3,ダイヤ=4
    int check[5][14] = {0}; //54×4にしていた。 memory dumpしていたみたい？

    for (int i = 1; i < num + 1; i++)
    {
        cin >> mark >> cardnum;
        if (mark == 'S')
        {
            check[1][cardnum] = 1;
        }
        else if (mark == 'H')
        {
            check[2][cardnum] = 1;
        }
        else if (mark == 'C')
        {
            check[3][cardnum] = 1;
        }
        else
        {
            check[4][cardnum] = 1;
        }
    }

    for (int j = 1; j < 5; j++)
    {
        for (int i = 1; i < 14; i++)
        {
            if (check[j][i] == 0) //j=1 S, j=2 H, j=3 C, j=4 D,
            {
                if (j == 1)
                {
                    cout << 'S' << ' ' << i << endl;
                }
                else if (j == 2)
                {
                    cout << 'H' << ' ' << i << endl;
                }
                else if (j == 3)
                {
                    cout << 'C' << ' ' << i << endl;
                }
                else
                {
                    cout << 'D' << ' ' << i << endl;
                }
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3100
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
//Constant
const int V=9;
//Quick Read
int Read(){
	int x=0;
	bool neg=false;
	char c=getchar();
	while(isdigit(c)==false)neg^=c=='-',c=getchar();
	while(isdigit(c)==true)x=x*10+c-'0',c=getchar();
	return neg==true?-x:x;
}
inline void Read(int &x){x=Read();}
//Main
bool ban[V+1];
int main(){
	// freopen("ARC058C.in","r",stdin);
	// freopen("ARC058C.out","w",stdout);
	int n=Read(),k=Read();
	for(int i=1;i<=k;++i)ban[Read()]=true;
	while(true){
		int x=n;
		bool ok=true;
		while(x!=0){
			if(ban[x%10]==true){
				ok=false;
				break;
			}
			x/=10;
		}
		if(ok){
			printf("%d\n",n);
			break;
		}
		++n;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
signed main(){
    string s; cin>>s;
    int n=(int)s.size();
    int beg=0,lst=n-1;
    int ans=0;
    while(true){
        
        if(beg==lst||beg>lst)break;
        if(s[beg]=='x'&&s[beg]!=s[lst]){
            ans++;
            beg++;
        }else if(s[lst]=='x'&&s[beg]!=s[lst]){
            ans++;
            lst--;
        }else if(s[beg]==s[lst]){
            beg++;
            lst--;
        }else if(s[beg]!=s[lst]){
            return puts("-1")*0;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 512
import java.util.*;
 
public class Main {
  public static void main(String[] args)  {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int a = Integer.parseInt(s.substring(0, 1));
    int b = Integer.parseInt(s.substring(1, 2));
    int c = Integer.parseInt(s.substring(2, 3));
    int d = Integer.parseInt(s.substring(3, 4));
    
    if (a + b + c + d == 7) {
      System.out.println(a + "+" + b + "+" + c + "+" + d + "=7");
      return;
    }
    if (a + b + c - d == 7) {
      System.out.println(a + "+" + b + "+" + c + "-" + d + "=7");
      return;
    }
    if (a + b - c + d == 7) {
      System.out.println(a + "+" + b + "-" + c + "+" + d + "=7");
      return;
    }
    if (a + b - c - d == 7) {
      System.out.println(a + "+" + b + "-" + c + "-" + d + "=7");
      return;
    }
    if (a - b + c + d == 7) {
      System.out.println(a + "-" + b + "+" + c + "+" + d + "=7");
      return;
    }
    if (a - b + c - d == 7) {
      System.out.println(a + "-" + b + "+" + c + "-" + d + "=7");
      return;
    }
    if (a - b - c + d == 7) {
      System.out.println(a + "-" + b + "-" + c + "+" + d + "=7");
      return;
    }
    if (a - b - c - d == 7) {
      System.out.println(a + "-" + b + "-" + c + "-" + d + "=7");
      return;
    }
  }
}

Measured memory_bytes: 39332
N=int(input())
A=list(map(int,input().split()))
ave_A=sum(A)/N

min_a=10**10
for i,a in enumerate(A):
  if min_a>abs(ave_A-a):
    min_a=abs(ave_A-a)
    min_i=i
    
print(min_i)

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

using namespace std;

int main()
{
    char s[200];
    cin>>s;
    int len = strlen(s);
    for(int i=(len-2)/2;i>0;--i)
    {
        int x = 0;
        for(int j=0;j<i;++j)
        {
            if(s[j] == s[j+i])  x++;
        }
        if(x==i)
        {
            cout<<2*i<<endl;
            return 0;
        }
    }

    return 0;
}


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

int n,m,i,j,k,ans;
int a[305][305],b[305];
bool ban[305];

int main()
{
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;++i)
	for(j=1;j<=m;++j)
	scanf("%d",&a[i][j]);
	ans=n;
	for(i=1;i<=m;++i)
	{
		for(j=1;j<=m;++j)b[j]=0;
		for(j=1;j<=n;++j)
		for(k=1;k<=m;++k)
		if(!ban[a[j][k]])
		{
			++b[a[j][k]];
			break;
		}
		for(j=k=1;j<=m;++j)if(b[j]>b[k])k=j;
		ban[k]=true;
		if(b[k]<ans)ans=b[k];
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
string s,t;
lli dp[3001][3001];
lli lcs(lli x,lli y){
	if(x==0 || y==0)
	return 0;
	if(dp[x][y]!=-1)
	return dp[x][y];
	if(s[x-1]==t[y-1])
	dp[x][y]=lcs(x-1,y-1)+1;
	else{
		dp[x][y]=max(lcs(x-1,y),lcs(x,y-1));
	}
	return dp[x][y];
}
int main(){
	cin>>s>>t;
	for(lli i=0;i<=s.length();i++){
		for(lli j=0;j<=t.length();j++)
		dp[i][j]=-1;
	}
	lli ans=lcs(s.length(),t.length());
	lli x=s.length(),y=t.length();
	string a;
	while(x>0 && y>0){
		if(s[x-1]==t[y-1]){
		a+=s[x-1];
		x--;
		y--;
		}
		else{
			if(dp[x-1][y]>dp[x][y-1])
			x=x-1;
			else
			y=y-1;
		}
	}
	reverse(a.begin(),a.end());
	cout<<a;
	return 0;
}


Measured memory_bytes: 70912
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define nl '\n'
#define INF 2147483647
#define si(i) scanf("%d", &i)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll n, x;

ll eat( ll sz, ll btm ){
    if( sz == 0 ){
        if( btm > 0 ) return 1;
        else return 0;
    }
    if( btm <= ((ll)1 << (sz + 1)) - 2 ) return eat( sz - 1, btm - 1);
    else return ((ll)1<<sz) + eat( sz - 1, btm - ( (ll)1 << (sz + 1)) + 1  );
}

int main(){
    cin >> n >> x;
    cout << eat( n, x ) << nl;
}

Measured memory_bytes: 256
inps = input().split()
k = int(inps[0])
n = int(inps[1])
ap = input().split()
ap = [int(s) for s in ap]
a = []
for i in range(n):
    if i == 0:
        a.append(ap[0] + k - ap[n - 1])
    else:
        a.append(ap[i] - ap[i-1])
print(k - max(a))

Measured memory_bytes: 26436
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()
	n := readInt()

	println(800*n - 200*(n/15))
}


Measured memory_bytes: 640
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	int A, B, C;
	string ans = "NO";
	cin >> A >> B >> C;

	FOR(i, 0, 10000) {
		LL now = (i + 1)*A;
		if (now%B == C) {
			ans = "YES";
			break;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
A, B, K = map(int, input().split())
X = []

for i in range(0, K):
    if A + i <= B:
        X.append(A + i)
for i in range(K-1, -1, -1):
    if B-i in X:
        continue
    else:
        if B - i >= A:
            X.append(B - i)
for i in range(len(X)):
    print(X[i])


Measured memory_bytes: 3060
n=int(input())
d={}
for k in range(2,10**6):
  while n%k<1: n//=k; d[k]=d.get(k,0)+1
a=0
for i in d.values():
  t=c=0
  while t+c<i: c+=1; t+=c
  a+=c
print(a+(n>1))

Measured memory_bytes: 9120
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
using namespace std;

int main() {
	string s;
	int cnt=0;
	cin >> s;
	if (s[0] == '+') cnt++;
	if (s[1] == '+') cnt++;
	if (s[2] == '+') cnt++;
	if (s[3] == '+') cnt++;

	if (s[0] == '-') cnt--;
	if (s[1] == '-') cnt--;
	if (s[2] == '-') cnt--;
	if (s[3] == '-') cnt--;

	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  string s;
  ll k;
  cin>>s>>k;
  int i=0;
  while(i<s.size() && s[i]=='1'){
    i++;
  }
  if(k<=i){
    cout<<'1'<<endl;
  }
  else{
    cout<<s[i]<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm> 
#include<cstdio>
#include<cctype>
#include<string>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const int N = 1e6+5;
const double pi = acos(-1.0);
const ll mod = 1e9+7;
int main()
{
 int k,a,b;
 cin>>k>>a>>b;
 for(int i=a;i<=b;i++){
 	if(i%k==0){
 		cout<<"OK"<<endl;
 		return 0; 
  }
 }
  cout<<"NG"<<endl; 
	return 0;
}



Measured memory_bytes: 3636