akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long ans = 100;
        long sum = 0;
        while(ans<N)
        {
            ans = ans + (long)(ans /100);
            sum++;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 35732
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
ll inv(ll a){
    return powmod(a, MOD-2);
}
ll f[5000001], invf[5000001];
void fac(int n){
    f[0]=1;
    for(ll i=1; i<=n; i++) f[i]=f[i-1]*i%MOD;
    invf[n]=inv(f[n]);
    for(ll i=n-1; i>=0; i--) invf[i]=invf[i+1]*(i+1)%MOD;
}
ll comb(int x, int y){
    if(!(0<=y && y<=x)) return 0;
    return f[x]*invf[y]%MOD*invf[x-y]%MOD;
}
int main()
{
    int n, k;
    cin>>n>>k;
    fac(2*n);
    if(k>=n-1){
        cout<<comb(2*n-1, n)<<endl;
        return 0;
    }
    ll ans=0;
    for(int i=0; i<=k; i++){
        (ans+=comb(n, i)*comb(n-1, i))%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8448
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
long long N;
long long ga,gb,sa,sb,ba,bb;
cin>>N;
cin>>ga>>sa>>ba;
cin>>gb>>sb>>bb;
//１回目の取引
//全てにおいてbの方が金属購入がお得ならAでは買わない
long long tmp=0;
long long value[N+10]={};

  for(int i=1;i<=N;++i){
    tmp=i;
    if(i>=ga){
      tmp=max(tmp,value[i-ga]+gb);
    }
    if(i>=sa){
      tmp=max(tmp,value[i-sa]+sb);
    }
    if(i>=ba){
      tmp=max(tmp,value[i-ba]+bb);
    }
    value[i]=tmp;}

long long next=value[N];
//2かいめの取引
long long value_2[next+10]={};
  for(int i=1;i<=next;++i){
    tmp=i;
    if(i>=gb){
      tmp=max(tmp,value_2[i-gb]+ga);
    }
    if(i>=sb){
      tmp=max(tmp,value_2[i-sb]+sa);
    }
    if(i>=bb){
      tmp=max(tmp,value_2[i-bb]+ba);
    }
    value_2[i]=tmp;}

cout<<value_2[next]<<"\n";

return 0;
}

Measured memory_bytes: 195584
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

int main(void) {
	int x;
	cin >> x;
	int sum = 0;
	for (int i = 0; i <= x; i++) {
		sum += i;
		if (sum >= x) {
			cout << i;
			return 0;
		}
	}
	return 0;
}

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

#define ll long long
#define ull unsigned long long
#define dbg(args...)    do { cerr << #args << ' ' ; print(args); } while(0); cerr << endl;
#define Max 100005
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PI acos(-1)
#define all(a)           a.begin(),a.end()
long long limit = 4294967296;
int MOD = 1000000007;
template <typename T>
void print(const T& x)
{
    cerr<<x<<' ';
}

template <typename T1, typename... T2>
void print(const T1& first, const T2&... anst)
{
    print(first);
    print(anst ...) ;
}

/*direction array*/

/***4 moves***/
/*
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
*/
/***8 moves***/
/*
int dx[] = { 0,  0, -1, -1, -1, +1, +1, +1 } ;
int dy[] = {-1, +1, -1,  0, +1, -1,  0, +1 } ;
*/

/*direction array ends*/

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)));
}
int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);

    fastIO;
    ll n; cin>>n;
    ll ara[n+5];
    for(ll i=0; i<n; i++)
        cin>>ara[i];

    ll mod = 1e9 + 7, suffixSum = 0;
    ll ans = 0;

    for(ll i=n-1; i>=0; i--)
    {
        ans += ara[i] * suffixSum;
        suffixSum += ara[i];
        ans %= mod;
        suffixSum %= mod;
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 5228
#include <cstdio>
#include <cctype>
#include <utility>
#include <deque>
#include <climits>
using namespace std;

#define _gp(l) const auto gcu{getchar##l}; const auto pcu{putchar##l}
#ifdef __linux
_gp(_unlocked);
#else
_gp();
#endif
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
_T _DEF(T,in,int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int,in,){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c=gcu();return c==EOF?n=0,false:(n=in<T>(c),true);}
_SCAN(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=(char)c;}}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);} _OUT(const char *s){while(*s)pcu(*s++);} _OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{
	int e,b=0,s=1; range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
	struct it { int v, s; it (int _v, int _s) : v(_v), s(_s) {} operator int()const{return v;} operator int&(){return v;} int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin() {return {b, s};} it end() {return {e, s};}};

using D = deque<int>;

int main() {
	D p(8), c {4, 1, 4, 1, 2, 1, 2, 1}, r;
	range r8(8);
	for (;;) {
		for (int &i: p)
			if(!scan(i))
				return 0;
		int m {INT_MAX};
		for (int i {}; i < 8; i++) {
			int a {};
			c.push_front(c.back());
			c.pop_back();
			for (int j: r8)
				a += max(0, p[j] - c[j]);
			if (a < m) {
				m = a;
				r = c;
			} else if (a == m && c < r)
				r = c;
		}
		for (int i: r8)
			out(r[i], " \n"[i == 7]);
	}
}


Measured memory_bytes: 2528
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#define FOR(i,j,k) for(int i=j;i<=k;i++)
using namespace std;
int main (int argc, char *argv[])
{
	std::ios::sync_with_stdio(false);
	string temp;cin>>temp;
	bool a,b,c,d;
	a=b=c=d=false;
	FOR(i,0,temp.size()-1){
		if (temp[i]=='N')	a=true;
		if (temp[i]=='W')	b=true;
		if (temp[i]=='S')	c=true;
		if (temp[i]=='E')	d=true;
	}
	if ((a&&b&&c&&d) || (a&&c&&!b&&!d) || (b&&d&&!a&!c))	puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int rh_cnt;
vector<long long> rh_base;
vector<long long> rh_mod;
vector<long long> rh_inv;
vector<vector<long long>> rh_pow;
struct rolling_hash{
	int sz;
	vector<long long> hash;
	rolling_hash(){
		sz = 0;
		for (int i = 0; i < rh_cnt; i++){
		  hash.push_back(i);
		}
	}
	int size(){
		return sz;
	}
	void push_back(char c){
		sz++;
		for (int i = 0; i < rh_cnt; i++){
			hash[i] = (hash[i] * rh_base[i] + (int) c) % rh_mod[i];
		}
	}
	void push_front(char c){
		sz++;
		for (int i = 0; i < rh_cnt; i++){
			hash[i] = (hash[i] + (int) c * rh_pow[i][sz]) % rh_mod[i];
		}
	}
	void pop_back(char c){
		sz--;
		for (int i = 0; i < rh_cnt; i++){
			hash[i] = (hash[i] - (int) c + rh_mod[i]) * rh_inv[i] % rh_mod[i];
		}
	}
	void pop_front(char c){
		sz--;
		for (int i = 0; i < rh_cnt; i++){
			hash[i] = (hash[i] - (int) c * rh_pow[i][sz] % rh_mod[i] + rh_mod[i]) % rh_mod[i];
		}
	}
	bool operator ==(rolling_hash RH){
		if (sz != RH.sz){
			return false;
		}
		for (int i = 0; i < rh_cnt; i++){
			if (hash[i] != RH.hash[i]){
				return false;
			}
		}
		return true;
	}
};
int main(){
  rh_cnt = 1;
  rh_base = {1000003};
  rh_mod = {998244353};
  rh_inv = {114156894};
  for (int i = 0; i < rh_cnt; i++){
    rh_pow.push_back(vector<long long>(1, 1));
    for (int j = 1; j <= 1000000; j++){
      long long tmp = rh_pow[i].back() * rh_base[i] % rh_mod[i];
      rh_pow[i].push_back(tmp);
    }
  }
  string T;
  cin >> T;
  string P;
  cin >> P;
  int N = T.size();
  int M = P.size();
  if (N >= M){
    rolling_hash t;
    for (int i = 0; i < M; i++){
      t.push_back(T[i]);
    }
    rolling_hash p;
    for (int i = 0; i < M; i++){
      p.push_back(P[i]);
    }
    vector<int> ans;
    if (t == p){
      ans.push_back(0);
    }
    for (int i = 0; i < N - M; i++){
      t.push_back(T[i + M]);
      t.pop_front(T[i]);
      if (t == p){
        ans.push_back(i + 1);
      }
    }
    int cnt = ans.size();
    for (int i = 0; i < cnt; i++){
      cout << ans[i] << endl;
    }
  }
}


Measured memory_bytes: 20228
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            string[] a = cin.ReadLine.Split(' ');
            int r = 1;
            foreach (var v in a)
            {
                if(v == "0"){
                    break;
                }
                r += 1;
            }
            WriteLine(r.ToString());
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 26124
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
using namespace std;


int main() {
	int d[5], k;
	int ans = 0;

	cin >> d[0] >> d[1] >> d[2] >> d[3] >> d[4] >> k;
	for (int i = 0; i < 4; i++) {
		for (int j = i + 1; j <= 4; j++) {
			if (d[j] - d[i] > k) {
				ans = 1;
				break;
			}
		}
	}
	if (ans) {
		cout << ":(" << endl;
	}
	else {
		cout << "Yay!" << endl;
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb(a) push_back(a)
ll MAX=1e18;
// ll solve()
// {
//     ll n;
//     cin>>n;
//     vector<ll>num(n);
//     for(ll i=0;i<n;i++)
//     cin>>num[i];
//     ll res=1;
//     for(auto x:num)
//     {
//         res*=x;
//         //if(res>MAX) return -1;
//     }
//     if(res>MAX) return -1;
//     return res;
// }
ll solve2()
{
    ll a,b;
    cin>>a>>b;
    ll ans=a*b;
    return ans;
}
int main() {
    cout<<solve2()<<"\n";
	return 0;
}

Measured memory_bytes: 3604
import math
def main():
    a,b = map(int,input().split())
    for i in range(1,100000):
        if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
            print(i)
            return 
    print(-1)
    


    return 

if __name__=="__main__":
    main()

Measured memory_bytes: 38768
/**Hey, What's up?*/

#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<long long>v,v1;
vector<long long>::iterator it,jt;
map<string,long long>mp;
int main()
{
    fastio;
    long long a=0,b=0,c,d,e,f=0,l,g,m,n,k,i,j,t,p,q,r,lo=0,hi=0,mid;
    cin>>n>>k;
    p=0;
    q=0;
    r=0;
    for(i=0; i<n; i++)
    {
        cin>>a;
        if(a>0)
        {
            p++;
            v.push_back(a);
        }
        else if(a<0)
        {
            q++;
            v1.push_back(a);
        }
        else
            r++;
    }
    sort(v.begin(),v.end());
    sort(v1.begin(),v1.end());
    d=p*q;
    if(k<=d)
    {
        lo=-1000000000000000002;
        hi=-1;
        while(lo<=hi)
        {
            f=0;
            mid=(lo+hi)/2;
            for(i=0; i<v1.size(); i++)
            {
                d=mid/v1[i];
                if(mid%v1[i])d++;
                it=lower_bound(v.begin(),v.end(),d);
                f+=v.end()-it;
            }
            if(f>=k)
            {
                g=mid;
                hi=mid-1;
            }
            else
                lo=mid+1;
        }
        cout<<g<<'\n';
        return 0;

    }
    d+=r*(p+q)+(r-1)*r/2;
    if(k<=d)
    {
        cout<<0<<'\n';
        return 0;
    }
    k-=d;
    for(i=0; i<v1.size(); i++)
    {
        v1[i]*=-1;
    }
    sort(v1.begin(),v1.end());
    lo=1;
    hi=1e18+2;
    while(lo<=hi)
    {
        f=0;
        mid=(lo+hi)/2;
        for(i=0; i<v1.size(); i++)
        {
            d=mid/v1[i];
            it=upper_bound(v1.begin(),v1.end(),d);
            p=it-v1.begin();
            if(p>i)p--;
            f+=p;
        }
        for(i=0; i<v.size(); i++)
        {
            d=mid/v[i];
            it=upper_bound(v.begin(),v.end(),d);
            p=it-v.begin();
            if(p>i)p--;
            f+=p;
        }
        f/=2;
        if(f>=k)
        {
            g=mid;
            hi=mid-1;
        }
        else
            lo=mid+1;
    }

    cout<<g<<'\n';
    return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
  ll n;
  cin >> n ; 
  n--;
  vector<char> ans;
  if(n<26){
    cout << (char)('a'+ ('b'-'a')*n);
    return 0;
  }
  else{
    while(n/26>0){
      ans.push_back((char)('a'+ ('b'-'a')*(n%26)));
      n = n/26;
      n--;
    }
    ans.push_back((char)('a'+ ('b'-'a')*(n%26)));
    reverse(begin(ans),end(ans));
    for(char &e:ans)cout<< e ;
      return 0;
      }
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
 
int main() {
 
  char C; cin >> C;
  
  string S = "abcdefghijklmnopqrstuvwxyz";
  for(int i = 0; i< 26; i++){
    if(S.at(i) == C) cout << S.at(i+1);
  }

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int count = b / a;
		if (count > c) count = c;
		System.out.println(count);
	}
}


Measured memory_bytes: 23764
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<stdio.h>
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair

int N;
int h[100000];
int K;
int dp[1000000];

int rec(int p){
    int ans = 1000000;
    int sub[K];
    if(dp[p]>=0){
        ans = dp[p];
    }else if(p==N-1){
        ans = 0;
    }else{
        REP(i,K){
            if(p+i+1>N-1){
                sub[i] = 1000000;
            }else{
                sub[i]=rec(p+i+1)+abs(h[p]-h[p+i+1]);
            }
        }

        ans = sub[0];
        REP(i,K){
            if(sub[i]<ans){
                ans =sub[i];
            }
        }
    }
    dp[p] = ans;
    return ans;
    
}

int solve(){
   scanf("%d %d", &N,&K);
   
   REP(i, N){
       scanf("%d",&h[i]);
       dp[i] = -1;
   }
   printf("%d",rec(0));



    return 0;
}

int main(){
    solve();
}

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

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

    int countmaru=0;
    int count=0;
    rep(i,s.length()){
        if(s[i]=='o') countmaru++;
        count++;
        
    }
    
    if(countmaru+15-s.length()>=8){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll dp[2][2][2][100001];
vector <ll> a,b,c;
ll solve(ll x,ll y,ll z,ll n){
	if(n==0){return 0;}
  	if(dp[x][y][z][n]!=-1){return dp[x][y][z][n];}
  	else{
    	if(x==1){return dp[x][y][z][n] = max(solve(0,1,0,n-1)+b[n-1],solve(0,0,1,n-1)+c[n-1]);}
      	else if(y==1){return dp[x][y][z][n] = max(solve(1,0,0,n-1)+a[n-1],solve(0,0,1,n-1)+c[n-1]);}
      	else if(z==1){return dp[x][y][z][n] = max(solve(1,0,0,n-1)+a[n-1],solve(0,1,0,n-1)+b[n-1]);}
      	else{return dp[x][y][z][n] = max(solve(1,0,0,n-1)+a[n-1],max(solve(0,0,1,n-1)+c[n-1],solve(0,1,0,n-1)+b[n-1]));}
    }
}
int main(){
	
  	ll i=0,j=0,k=0,n=0,z=0,x=0,y=0,d=0,e=0,f=0;
  	cin >> n;
  	memset(dp,-1,sizeof(dp));
  	for(i=0;i<n;i++){
    	cin >> x >> y >> z;
      	a.push_back(x);
      	b.push_back(y);
      	c.push_back(z);
    }
  	k = solve(0,0,0,n);
  	//for(i=0;i<=n;i++){cout << dp[i]<<endl;}
  	d = max(dp[0][0][1][n],dp[0][0][0][n]);
  	e = max(dp[0][1][0][n],dp[0][1][1][n]);
  	f = max(dp[1][0][0][n],dp[1][1][1][n]);
  	z = max(dp[1][0][1][n],dp[1][1][0][n]);
  	cout << max(max(d,e),max(f,z))<<endl;
}

Measured memory_bytes: 15328
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}

signed _main(){
  int n; cin >> n;
  int N=n;
  v<int> ans;
  while(n>1){
    if(isPrime(n)){
      ans.push_back(n);
      break;
    }
    for(int i=2;i*i<=N;i++){
      if(n%i==0){
        ans.push_back(i);
        n/=i;
        break;
      }
    }
  }
  unordered_map<int,int> mp;
  fore(i,ans){
    mp[i]++;
  }
  /*
  sort(ans.begin(),ans.end());
  cout << N << ": ";
  rep(i,ans.size()-1) cout << ans[i] << " ";
  cout << ans[ans.size()-1] << endl;
  */
  int res=0;
  fore(i,mp){
    double temp=(-1.0+sqrt(1.0+8.0*(double)i.second))/2.0;
    res+=floor(temp);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back


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

    ll A, B, K;
    cin >> A >> B >> K;

    if(K<=A) cout << A-K << " " << B << endl;
    else if(K<=A+B) cout << 0 << " " << A+B-K<< endl;
    else cout << 0 << " " << 0 << endl;

    return 0;
}

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

int f(int i, int h[], int dp[]) {
	if(i>=n)
	return 0;
	if(dp[i]!=-1)
	return dp[i];
	
	if(i==n-1)
	dp[i] = 0;
	else {
		int ans = INT_MAX;
		for(int j = i+1; j<=i+k && j<n; ++j)
		ans = min(ans, abs(h[i]-h[j]) + f(j, h, dp));
		dp[i] = ans;
	}
	return dp[i];
}

int main() {
	
	cin>>n>>k;
	int h[n], dp[n];
	for(int i=0; i<n; ++i) {
		cin>>h[i];
		dp[i]=-1;
	}
	cout<<f(0, h, dp);
	return 0;
}

Measured memory_bytes: 12100
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n, k;
    cin >> n >> k;
    VL a(n);
    REP(i,n) a[i] = in();
    sort(ALL(a));
    reverse(ALL(a));
    REP(i,min(k, n)) a[i] = 0;
    ll ans = 0;
    REP(i,n) ans += a[i];
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll a, b, c;
    cin >> a >> b >> c;
    ld ld1 = 1;
    if (a + b + (ll)(2*sqrt(a * b * ld1)) < c) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 256
X, N = map(int, input().split())
P = list(map(int, input().split()))

not_p = set(range(102)) - set(P)

min_value = 200
min_list = []

for v in not_p:
    dist = abs(X-v)

    if dist < min_value:
        min_value = dist
        min_list = [v]

    if dist == min_value:
        min_list.append(v)

print(min(min_list))


Measured memory_bytes: 9188
#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
long long x;
cin>>x;
int cnt=0;
for(int i=0;i*(i+1)/2<x;i++)
cnt=i;
cnt+=1;
cout<<cnt;
system("pause");
return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define sd(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define met(a,b); memset(a,b,sizeof(a));
typedef long long ll;
using namespace std;
double pai=3.141592653589793;
 
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
 
// inline long long read() {
//     long long tmp=0, fh=1; char c=getchar();
//     while (c<'0'||c>'9') {if (c=='-') fh=-1; c=getchar();}
//     while (c>='0'&&c<='9') tmp=tmp*10+c-48, c=getchar();
//     return tmp*fh;
// }
ll h[200005];
int main(){
    ll h;
    ll ans=0,c=1;
    cin>>h;
    while(h!=1)
    {
        ans+=c;
        h/=2;
        c*=2;
    }
    ans+=c;
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pi = pair<int,int>;

string d = "URDL";
const int dy[4] = {-1,0,1,0};
const int dx[4] = {0,1,0,-1};

inline bool query(int idx){
    printf("? %c\n", d[idx]);
    fflush(stdout);

    char s[10];
    scanf("%s",s);
    return s[0]=='Y';
}

const int B = 505;
const int N = 1010;
bool already[N][N], trail[N][N];

void dfs(int y, int x){
    // printf(" (%d %d)\n",y,x);
    rep(i,4){
        if(already[y+dy[i]+B][x+dx[i]+B]) continue;
        bool res = query(i);
        already[y+dy[i]+B][x+dx[i]+B] = true;
        if(res){
            dfs(y+dy[i],x+dx[i]);
            trail[y+dy[i]+B][x+dx[i]+B] = true;
            query(i^2);
        }
    }
}

int main(){
    int h,w;
    cin >>h >>w;
    vector<string> s(h);
    rep(i,h) cin >>s[i];

    trail[B][B] = true;
    already[B][B] = true;
    dfs(0,0);

    int ty = h, tx = w;
    rep(i,N)rep(j,N)if(trail[i][j]){
        int py = i-B, px = j-B;
        if(py < ty){
            ty = py;
            tx = px;
        }
        else if(py == ty) tx = min(tx,px);
    }

    set<pi> fix_trail;
    rep(i,N)rep(j,N)if(trail[i][j]){
        int py = i-B, px = j-B;
        fix_trail.insert({py-ty, px-tx});
    }

    auto IN = [&](int y, int x){
        return 0<=y && y<h && 0<=x && x<w;
    };

    vector<vector<bool>> vis(h,vector<bool>(w));
    rep(i,h)rep(j,w){
        if(s[i][j]=='.' || vis[i][j]) continue;

        queue<pi> que;
        vector<pi> cc;
        vis[i][j] = true;
        que.push({i,j});
        cc.pb({i,j});
        while(!que.empty()){
            pi now = que.front();
            que.pop();
            rep(k,4){
                int ny=now.fi+dy[k], nx = now.se+dx[k];
                if(IN(ny,nx) && s[ny][nx]=='#' && !vis[ny][nx]){
                    vis[ny][nx] = true;
                    que.push({ny,nx});
                    cc.pb({ny,nx});
                }
            }
        }

        int my=h, mx=w;
        for(pi p:cc){
            if(p.fi < my){
                my = p.fi;
                mx = p.se;
            }
            else if(p.fi == my) mx = min(mx,p.se);
        }

        set<pi> fix_cc;
        for(pi p:cc) fix_cc.insert({p.fi-my, p.se-mx});

        if(fix_cc == fix_trail){
            printf("! %d %d\n", i-ty, j-tx);
            fflush(stdout);
            break;
        }
    }

    return 0;
}



Measured memory_bytes: 51980
#include <stdio.h>
#include <string.h>
int main(){
    int a,b,q,i;
    char str[1001],o[10],p[1001],v[2];
    scanf("%s %d",str,&q);
    while(q--){
        scanf("%s %d %d",o,&a,&b);
        if(strcmp(o,"replace")==0){
            scanf("%s",p);
            for(i=0;i<b-a+1;i++){
                str[a+i]=p[i];
            }
        }
        if(strcmp(o,"reverse")==0){
            for(i=0;i<(b-a+1)/2;i++){
                v[0]=str[a+i];
                str[a+i]=str[b-i];
                str[b-i]=v[0];
            }
        }
        if(strcmp(o,"print")==0){
            for(i=a;i<=b;i++){
                printf("%c",str[i]);
            }
            putchar('\n');
        }
    }
    return 0;
}


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

int main(){
  int N, M; cin >> N >> M;
  vector<int> L(M), R(M);
  for(int i = 0; i < M; i++){
    cin >> L[i] >> R[i];
  }
  int min_LR, max_LR;
  max_LR = *max_element(L.begin(), L.end());
  min_LR = *min_element(R.begin(), R.end());
  if(min_LR - max_LR + 1 < 0) cout << 0 << endl;
  else cout << min_LR - max_LR + 1 << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

#define MAX_N 100010

int main(void) {
	int N, M, x[MAX_N],y[MAX_N];
	int i,state[MAX_N],red[MAX_N],num;
	
	scanf("%d %d", &N,&M);
	
	for (i=0;i<M;i++) 
		scanf("%d %d", &x[i],&y[i]);
	
	for (i=1;i<=N;i++)
		state[i]=1;
	
	red[1]=1;
	
	for (i=0;i<M;i++) {
		state[x[i]]--;
		state[y[i]]++;
		if (red[x[i]]==1)
			red[y[i]]=1;
		if (state[x[i]]==0) 
			red[x[i]]=0;
	}
	
	num=0;
	for (i=1;i<=N;i++) {
		if (red[i]==1)
			num++;
	}

	printf("%d\n" ,num);
	
	return 0;
}

Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;
int main()
{
	int K, N, max_dist = 0, start_pos = 0, temp = 0, all_dist = 0;
	cin >> K >> N;
	vector<int> A(N, 0);
	cin >> A.at(0);
	for (int i = 1; i < N; i++)
	{
		cin >> A.at(i);
		temp = A.at(i) - A.at(i - 1);
		if (temp > max_dist)
		{
			max_dist = temp;
		}
	}
	temp = K - A.at(N - 1) + A.at(0);
	if (temp > max_dist)
	{
		max_dist = temp;
	}
	all_dist = A.at(N - 1) + (K - A.at(N - 1));
	all_dist -= max_dist;
	cout << all_dist << endl;
	return 0;
}

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

int h, n, sum=0;


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

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

  if (h <= sum) {
    printf("Yes");
  }else {
    printf("No");
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1844674407370955161
typedef long long int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int main()
{
    int N;
    ll K;
    cin >> N >> K;
    ll A[N];
    ll s=0;
    REP(i, 0, N)
    {
        cin >> A[i];
        s += A[i];
    }

    vector<ll> t = enum_div(s);
    t.push_back(s);
    ll ans = 1;
    REP(i, 0, t.size())
    {
        ll f = t[i];
        ll B[N];
        ll tmp = 0;
        int idx = N - 1;
        REP(j, 0, N)
        {
            B[j] = A[j] % f;
        }
        sort(B, B + N);
        
        
        
        REP(j,0,N){
            if(B[j]%f!=0){
                tmp += B[j];
                for (int k = N - 1; k > j;k--){
                    if(B[k]%f!=0){
                        if(B[j]>=(f-B[k])){
                            B[j] -= (f - B[k]);
                            B[k] = f;
                            
                        }else{
                            B[k] += B[j];
                            B[j] = 0;
                        }
                    }
                }
            }
        }
        

        bool flag = true;
        REP(j,0,N){
            if(B[j]%f!=0){
                flag = false;
            }
        }
        if(flag&&tmp<=K){
            if(f>ans){
                ans = f;
            }
        }

    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a // gcd (a, b) * b

n = int(input())
a = list(map(int, input().split()))
l = 1
for ai in a:
    l = lcm(l, ai)

ans = 0
mod = 10**9 + 7
for ai in a:
    ans += l // ai

print(ans % mod)


Measured memory_bytes: 4084
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
--import Data.Array.Unboxed
import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe

-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
-- templete

f n = let t = g [] n in if null t then "0" else t

g t 0 = t
g t n = let (q,r) = divMod n 4 in g (intToDigit r:t) q

main = takeWhile (/=(-1)) . map readInt . lines <$> getContents >>= mapM_ (putStrLn . f)
    



Measured memory_bytes: 4060
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <chrono>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)
#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_i = pair<double, int>;
using i_d = pair<int, double>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr ll LL2_MOD = 1000000007;
static constexpr ll INF = 1LL << 60;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

static map<type_index, const char *const> scanType = {
  { typeid(int), "%d" }, { typeid(ll), "%lld" }, { typeid(double), "%lf" }, { typeid(char), "%c" }};

template <class T> static void scan(vector<T>& v);
static void scan(vector<string>& v, bool isWord = true);
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; }

ll dp[101][100001];

int main(int argc, char *argv[]) {
  //INFILE();

  ll n, w;
  cin >> n >> w;

  vector<ll> weights(static_cast<int>(n));
  vector<ll> values(static_cast<int>(n));
  REP(i, 0, n) {
    cin >> weights[i] >> values[i];
  }

  REP(i, 0, n) {
    REP(j, 0, w + 1) {
      if (j == 0) {
        dp[i + 1][j + weights[i]] = values[i];
        continue;
      }

      if (dp[i][j] <= 0) continue;
      chmax(dp[i + 1][j], dp[i][j]);
      if (j + weights[i] > w) continue;
      chmax(dp[i + 1][j + weights[i]], dp[i][j] + values[i]);
    }
  }

  cout << *max_element(ALL(dp[n])) << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}


Measured memory_bytes: 77184
#include <iostream>

using namespace std;

int main(void){
  int n, b, i;
  char a[100];
  cin >> n;
  if(n % 2 == 1){
    cout << "No" << endl;
    return 0;
  }
  b = n / 2;
  for(i = 0;i < b; i++){
    cin >> a[i];
  }
  for(; i < n; i++){
    cin >> a[i];
    if(a[i] != a[i-b]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
     
int main(void){
     
  int A[100][100] = {0};
  int b[100] = {0};
  int sum = 0;
  int n,m;
  register int i,j;
     
  scanf("%d %d",&n,&m);
  for(i = 0;i < n;i++){
    for(j = 0;j < m;j++){
      scanf("%d",&A[i][j]);
    }
  }
  for(i = 0;i < m;i++){
    scanf("%d",&b[i]);
  }
  for(i = 0;i < n;i++){
    sum = 0;
    for(j = 0;j < m;j++){
      sum += (A[i][j] * b[j]);
    }  
    printf("%d\n",sum);
  }
  return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a[k-1];
  return 0;
}


Measured memory_bytes: 3552
#include <cstdio>
#include <algorithm>
#define LL long long
#define MOD 1000000007
using namespace std;

int n, num, freee;
bool val[8];

int main(){
	scanf("%d",&n);
	for(int i = 0; i < n; i++ ){
		int x; scanf("%d",&x);
		if(x>=3200) freee++;
		else{
			if(val[x/400]) continue;
			val[x/400] = true;
			num++;
		}
	}
	int ans = num;
	if(num==0) ans = 1;
	int ans2 = num+freee;
	if(ans2==0) ans2 = 1;
	printf("%d %d\n",ans,ans2);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstring>
using namespace std ;
int main()
{
   	char a[100],b[100];
   	char temp;
   	int i;
    while( cin>>a>>b )
    {
    	int cnt=0;
    	while( strcmp(a,b) )  //a和b不同 
    	{
    		temp=a[ strlen(a)-1 ];
    		for(i=strlen(a)-2;i>=0;i--)
    		{
    			a[i+1]=a[i];
			}
			a[0]=temp;
			cnt++;
			if( cnt>strlen(a) )
				break;
		}
		if( cnt> strlen(a) )
		{
			cout<<"No\n";
		}
		else
			cout<<"Yes\n";
	}
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Random;


public class Main {
	
	public static void main(String[] args) {
		new Main().run();
	}
	
	final long MOD=(long)1e9+7;

	long ADD(long a,long b) {
		return a+b>=MOD?a+b-MOD:a+b;
	}

	void run() {
		FastScanner sc=new FastScanner();
		int K=sc.nextInt();
		int A=sc.nextInt();
		int B=sc.nextInt();
		boolean ans=false;
		for (int i=A;i<=B;++i) if (i%K==0) ans=true;
		System.out.println(ans?"OK":"NG");
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}




class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
    	return (int)nextLong();
    }
}

Measured memory_bytes: 32472
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7;
const int N = 51;

int mul(int a, int b) {
	return ((ll)a * b) % MOD;
}

int add(int a, int b) {
	return (a + b) % MOD;
}

map<int, int> dp[N][N];
map<int, int> ndp[N][N];

int n;

void rec(int i) {
	for (int fp = 0; fp <= n; fp++) {
		for (int sp = 0; sp <= n; sp++) {
			for (auto t : dp[fp][sp]) {
				int cs, v;
				tie(cs, v) = t;
				for (int up = 0; up < 2; up++) {
					for (int dw = 0; dw < 2; dw++) {
						if (up ^ dw && !up) {
							ndp[fp][sp][cs] = add(ndp[fp][sp][cs], v);
						} 
						{
							int nfp = fp;
							int nsp = sp;
							if (dw) nfp--;
							if (up) nsp--;
							if (!up) nfp++;
							if (!dw) nsp++;
							if (nfp < 0) continue;
							if (nsp < 0) continue;
							// if (cs == 0 && fp == 1)
							int cntplus = (2 * (i + 1) - nfp - nsp) / 2;
							int cntmins = 2 * (i + 1) - cntplus;
							if (cntplus > n || cntmins > n) continue;
							int rcs = cs;
							if (up) rcs += i;
							else rcs -= i;
							if (dw) rcs += i;
							else rcs -= i;
							int rv = v;
							if (up) rv = mul(rv, sp);
							if (dw) rv = mul(rv, fp);
							ndp[nfp][nsp][rcs] = add(ndp[nfp][nsp][rcs], rv);
						}
					}
				}
			}
		}
	}
	for (int f = 0; f <= n; f++) {
		for (int s = 0; s <= n; s++) {
			dp[f][s] = ndp[f][s];
			ndp[f][s].clear();
		}
	}
}

// void sgen() {
// 	map<int, int> ans;
// 	vector<int> v(n);
// 	iota(v.begin(), v.end(), 0);
// 	do {
// 		int c = 0;
// 		for (int i = 0; i < n; i++) c += abs(v[i] - i);
// 		ans[c]++;
// 	} while (next_permutation(v.begin(), v.end()));
// 	cerr << "ok: " << endl;
// 	for (auto [k, v] : ans) {
// 		cerr << k << ' ' << v << endl;
// 	}
// }

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	cin >> n;
	// sgen();
	dp[0][0][0] = 1;
	for (int i = 0; i < n; i++) {
		rec(i);
		// if (i == 0) {
		// 	cerr << dp[1][1][0] << endl;
		// }
		// if (i == 1) {
		// 	cerr << dp[1][1][0] << endl;
		// }
	}
	int k;
	cin >> k;
	cout << dp[0][0][k] << endl;
	// cerr << "my: " << endl;
	// for (auto [k, v] : dp[0][0]) {
	// 	cerr << k << ' ' << v << endl;
	// }
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

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

    string w[n];
    rep(i, n) cin >> w[i];
    set<string> st;
    st.insert(w[0]);
    for (int i = 1; i < n; i++)
    {

        if ((w[i - 1][w[i - 1].size() - 1] != w[i][0]) || st.find(w[i]) != st.end())
        {
            OP("No");
            return 0;
        }
        st.insert(w[i]);
    }
    OP("Yes");

    return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<-1<<endl;return 0
//ios::sync_with_stdio(false);
//<< setprecision(5)
const int mod=1000000007;
const int big=1e9+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	ios::sync_with_stdio(false);
	llint n;cin>>n;
	for(llint a=1;a<=3500;a++){
		for(llint b=1;b<=3500;b++){
			if((4*a*b-n*(a+b))<=0){continue;}
			llint c=a*b*n/(4*a*b-n*(a+b));
			if(c*(4*a*b-n*(a+b))==a*b*n){
				cout<<a<<" "<<b<<" "<<c<<endl;return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j,k;
  int n,m;
  cin>>n>>m;
  vector<string> a(n);
  vector<string> b(m);
  rep(i,n)cin>>a[i];
  rep(i,m)cin>>b[i];
  int ans=0;
  rep(i,n-m+1)rep(j,n-m+1){
    bool tmp=true;
    rep(k,m)
      if(b[k]!=a[j+k].substr(i,m))tmp=false;
    if(tmp)ans=1;
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256