akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main(){
    string s;   cin>>s;
    if(s.size()%2==0)s.pop_back();
    s.pop_back();
    int ans=0;
    do{
        for(int j=0;j<s.size()/2;j++){
            if(s[j]!=s[s.size()/2+j])break;
            if(j==s.size()/2-1)ans=s.size(); 
        }
        s.pop_back();
        s.pop_back();
    } while (!(ans));
    cout<<ans<<endl;
    return 0;
}

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

int main(){
	int n,m;
	cin>>n>>m;
	vector<pair<int,int>>g(n),c(m);
	for(auto&i:g)cin>>i.first>>i.second;
	for(auto&i:c)cin>>i.first>>i.second;
	vector<int>ans(n,inf);
	for(int i=0;i<n;++i){
		for(int j=0,k=inf,tmp;j<m;++j){
			tmp=abs(g.at(i).first-c.at(j).first)+abs(g.at(i).second-c.at(j).second);
			if(k>tmp){
				ans.at(i)=j+1;
				k=tmp;
			}
		}
	}
	for(auto&i:ans)cout<<i<<"\n"s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,count=0;
    cin>>n;
    
    for(int i=1;i<n;i++){
        for(int j=1;j>0;j++){
            if((n-1)/(j*i)==0){
                break;
            }else{
                count++;
                continue;
            }
        }
        
    }
    cout<<count<<endl;
}


Measured memory_bytes: 3632
/*
ЗАПУСКАЕМ 
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░ 
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>

using namespace std;
template<typename T1, typename T2> inline void chkmin(T1 &a, T2 b) {if (a > b) a = b;}
template<typename T1, typename T2> inline void chkmax(T1 &a, T2 b) {if (a < b) a = b;}
#define files(FILENAME) read(FILENAME); write(FILENAME)
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define left left228
#define right right228
#define y1 y1228
#define mp update_pair
#define pb push_back
#define y2 y2228
const string FILENAME = "input";
const int MAXN = 100228;

int n, m;
set<int> g[MAXN];
vector<int> order;
int cnt[MAXN];

void dfs(int u) {
	while (!g[u].empty()) {
		int a = *g[u].begin();
		g[u].erase(a);
		g[a].erase(u);
		order.pb(u);
		//cout << u << ' ' << a << endl;
		dfs(a);
	}
	//order.pb(u);
}



int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
  //	read(FILENAME);
	cin >> n >> m;
	int ft = 0;
	int ft1 = 0;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		g[a].insert(b);
		g[b].insert(a);
		
	}	
	for (int i = 1; i <= n; i++) {
		if (sz(g[i]) == 4) {
			ft++;
		} else {
			if (sz(g[i]) == 2) {
				ft1++;
			}
		}
		if (sz(g[i]) & 1) {
			cout << "No\n";
			return 0;
		}
	}
	if (ft == 2 && ft1 == n - 2) {
		for (int i = 1; i <= n; i++) {
			if (sz(g[i]) == 4) {
				for (auto x: g[i]) {
					int cur = x;
					int pr = i;
					while (true) {
						if (sz(g[cur]) == 4) {
							break;
						}
						for (auto xx: g[cur]) {
							if (xx != pr) {
								pr = cur;
								cur = xx;
								break;
							}
						}
					}
					if (cur == i) {
						cout << "Yes\n";
						exit(0);
					}
				}
			}
		}
		cout << "No\n";
		return 0;
	}
	dfs(1);
	for (int i = 0; i < sz(order); i++) {
		cnt[order[i]]++;
		//cout << order[i] << endl;
	}
	for (int i  = 1; i <= n; i++) {
		//cout << cnt[i] << endl;
		if (cnt[i] >= 3) {
			cout << "Yes\n";
			return 0;
		}
	}
	int cnts = 0;
	for (int i  = 1; i <= n; i++) {
		if (cnt[i] >= 2) {
			cnts++;
		}
	}
	if (cnts >= 2) {
		cout << "Yes\n";
			return 0;
	}
	cout << "No\n";
	return 0; 	
}

Measured memory_bytes: 18936
import java.util.*;
public class Main {
    public static void main(String[] ano) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
        	int a =scan.nextInt();
        	int b =scan.nextInt();
        	int n =scan.nextInt();
        	scan.nextLine();
        	int s=0;
        	a%=b;
        	for(int i=1;i<=n;i++){
        		a*=10;
        		s +=a/b;
        		a%=b;
        	}
        	System.out.println(s);
        }
}
}

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

int n, m, a;

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

    for (int i = 0 ; i < m; i++) {
        cin >> a;
        n -= a;
    }
    cout << ((n < 0) ? -1 : n) << endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,p;
	long long ans=0;
	string s;
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>p>>s;
	if(p==2)
		for(int i=0;i<n;i++) {
			if((s[i]-'0')%2==0) ans+=i+1;
		}
	else if(p==5)
		for(int i=0;i<n;i++) {
			if((s[i]-'0')%5==0) ans+=i+1;
		}
	else {
		int t=0,pw=1;
		vector<int>v(p,0);
		v[0]=1;
		for(int i=n-1;i>=0;i--) {
			t=(t+(s[i]-'0')*pw)%p;
			ans+=v[t];
			v[t]++;
			pw=pw*10%p;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}
//const int INF = 0x3f3f3f3f;
//const int mod=1e9+7;
//const double pi="3.14159265359;
//###################################################################

int main(){
    string a;
    cin>>a;
    int sum=0;
    for(int i=0;a[i];i++)sum+=a[i]-'0';
    if(sum%9)cout<<"No";
    else cout<<"Yes";
}

Measured memory_bytes: 3704
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
typedef pair<int, int> P;
int cnt[64][64] = {};
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    //int N = 200000;
    P p[200010];
    rep(i, N) {
        double a; cin >> a;
        //double a = 1.0;
        int c = (a * 1000000000) + 0.5;
        int cnt2 = 0, cnt5 = 0;
        while(c % 2 == 0) {cnt2++; c /= 2;}
        while(c % 5 == 0) {cnt5++; c /= 5;}
        //mp[{cnt2, cnt5}]++;
        cnt[cnt2][cnt5]++;
        p[i] = {cnt2, cnt5};
    }
    //rep(i, N) cout << p[i].first << " " << p[i].second << endl;
    int ans = 0;
    rep(i, N) {
        int cnt2 = p[i].first;
        int cnt5 = p[i].second;
        cnt[cnt2][cnt5]--;
        rep(a, 50) {
            rep(b, 50) {
                if(cnt2 + a >= 18 && cnt5 + b >= 18) {
                    ans += cnt[a][b];
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
  string S;
  cin>>S;
  int K;
  cin>>K;
  map<string,int>mp;
  string temp;
  for(int i=0;i<S.size();i++){
    for(int j=1;j<=K;j++){
      temp=S.substr(i,j);
      mp[temp]++;
    }
  }
  int cnt=0;
  for(auto itr=mp.begin();itr !=mp.end();itr++){
    cnt++;
    if(cnt==K){
      cout<<itr->first<<endl;
      return 0;
    }
  }
  
    
  
  
  return 0;
}


Measured memory_bytes: 4744
N = int(input())
*H, = map(int,input().split())

flag = True
for i in range(1,len(H)):
	if H[i-1] > H[i]:
		if H[i-1]-1 == H[i]:
			H[i]+=1
		else:
			flag = False
			break

if flag:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 15020
#include <stdio.h>

int main(void){
  int i,n,a[100];
  scanf("%d",&n);
  
  for(i=0;i<n;i++) 
    scanf("%d",&a[i]);

  for(i=1;i<=n;i++){
    printf("%d",a[n-i]);
    if(i==n)
      printf("\n");
    else
      printf(" ");
  }
  return 0;
}


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

const int N = 1e4 + 5;
int n, mod, ans, c[N], f[N];

inline void add(int &x, int y)
{
	x += y;
	x >= mod ? x -= mod : 0;
}

int main()
{
	scanf("%d%d", &n, &mod);
	int half = n >> 1;
	for (int i = 2; i <= half + 1; ++i)
		c[i] = i - 1;
	for (int i = half + 2; i <= n; ++i)
		c[i] = n - i + 2;

	f[0] = 1;
	for (int i = 2; i <= n; ++i)
		for (int j = c[i]; j < n; ++j)
			add(f[j], f[j - c[i]]);
	for (int j = 0; j < n; ++j)
		ans = (1ll * (n - j) * f[j] + ans) % mod;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
n = int(input())
t, a = map(int, input().split())
hh = tuple(map(int, input().split()))

ans = 0
for i in range(1, n):
    if abs(t - hh[ans] * 0.006 - a) > abs(t - hh[i] * 0.006 - a):
        ans = i
print(ans + 1)


Measured memory_bytes: 9204
#include <bits/stdc++.h>
#define MAX 100010
using namespace std;


int main(void)
{
	int N, K;
	cin >> N >> K;
	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		int t;
		cin >> t;
		if (t >= K) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << (a[0] + a[1] == a[2] ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
using System;

namespace C___Tax_Increase
{
    class Program
    {
        static void Main (string[] args)
        {
            var input = Console.ReadLine ().Split (' ');
            var a = int.Parse (input[0]);
            var b = int.Parse (input[1]);
            for (var i = 13; i <= 1000; i++)
            {
                if (Math.Floor (i * 0.08) == a && Math.Floor (i * 0.10) == b)
                {
                    Console.WriteLine (i);
                    return;
                }
            }
            Console.WriteLine (-1);
        }
    }
}

Measured memory_bytes: 13140
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {k: u16, a: u16, b: u16};

    // 少数型出なければ以下の式でb以下で最大の
    // kの灰煤を出すことができる
    let x = b / k * k;

    if a <= x {
        println!("OK")
    } else {
        println!("NG")
    }
}


Measured memory_bytes: 2144
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {
	char S[4];
	scanf("%s", S);

	int ans = 0;

	for (int i = 0; i < 4; i++) {
		if (S[i] == '+') {
			ans++;
		}
		else {
			ans--;
		}
	}

	printf("%d", ans);


}

Measured memory_bytes: 128
import sys
from collections import defaultdict, Counter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def prime_factorize(n):
    a = Counter()
    while n % 2 == 0:
        a[2] += 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a[f] += 1
            n //= f
        else:
            f += 2
    if n != 1:
        a[n] += 1
    return a


def main():
    N, *A = map(int, read().split())

    lcm_prime = Counter()
    for a in A:
        for p, n in prime_factorize(a).items():
            if lcm_prime[p] < n:
                lcm_prime[p] = n

    l = 1
    for p, n in lcm_prime.items():
        l = l * pow(p, n, MOD) % MOD

    ans = 0
    for a in A:
        ans = (ans + pow(a, MOD - 2, MOD)) % MOD

    ans = ans * l % MOD

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 75308
n=int(input())
a=list(map(int,input().split()))
size=len(a)
def gcd(a,b):
    while True:
        r=a%b
        if r==0:
            return b
        a,b=b,r
forward=[]
backward=[]
temp=a[0]
for ele in a:
    temp=gcd(temp,ele)
    forward.append(temp)

temp=a[len(a)-1]
for ele in reversed(a):
    temp=gcd(temp,ele)
    backward.append(temp)
backward.reverse()
ans=max(backward[1],forward[len(a)-2])
for i in range(len(a)-2):
    temp=gcd(forward[i],backward[i+2])
    ans=max(ans,temp)
print(ans)



Measured memory_bytes: 14428
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
#define int long long

void solve() {
	int n, m; cin >> n >> m;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    int res = 0;
    rep(i, n - 1) {
        int x = a[i], y = (a[i] <= a[i + 1] ? a[i + 1] : a[i + 1] + m);
        if(x < m && m <= y) {
            res += 1 + (y - m);
        } else {
            res += (y - x);
        }
    }
    int ans = res;
    vector<int> cnt(3 * m, 0);
    map<int, int> mp;
    rep(i, n - 1) {
        int x = a[i], y = (a[i] <= a[i + 1] ? a[i + 1] : a[i + 1] + m);
        if(x == y || x + 1 == y) continue;
        mp[(a[i + 1] + 1) % m] += (y - x - 1);
        cnt[x + 2] --;
        cnt[y + 1] ++;
    }
    rep(i, 3 * m - 1) {
        cnt[i + 1] += cnt[i];
    }
    rep(i, m) {
        cnt[i] += cnt[i + m];
        cnt[i] += cnt[i + 2 * m];
    }
    for(int k = 1; k < m; ++k) {
        res += mp[k];
        res += cnt[k];
        chmin(ans, res);
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 9600
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;

void fastIO() {
	std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
}

#define FOR(i,f,t) for(int i=f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=f; i>(int)t; i--)
#define FORE(i,c) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

template<typename T, typename U> inline void mnze(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void mxze(T &x, U y) { if(x < y) x = y; }

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(_i, (x)) cerr <<*_i <<", "; cerr <<"\n"; }}
#define debuga(x, sz) {{cerr <<#x <<" = "; FOR(_i, 0, sz) cerr << x[_i] <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

const int MAXN = 2e5+5;

char S[MAXN];
int n, a[MAXN], nxt[MAXN][26], lst[26];

int dp[MAXN], go[MAXN];
int f(int i){
	if(i>=n) return 0;
	int &ret = dp[i];
	if(ret!=-1) return ret;
	ii r = {2*n,0};
	FOR(c,0,26){
		mnze(r, make_pair(1+f(nxt[i][c]),c));
	}
	go[i] = r.snd;
	return ret = r.fst;
}

int main(){
	scan(S);
	n = strlen(S);
	FOR(i,0,n) a[i] = S[i]-'a';
	FOR(i,0,26) lst[i] = n;
	FORR(i,n-1,-1){
		FOR(j,0,26) nxt[i][j] = lst[j];
		lst[a[i]] = i;
	}
	ms(dp,-1);
	ii ans = {2*n,0};
	FOR(i,0,26){
		mnze(ans, make_pair(1+f(lst[i]),i));
	}
	ms(S,0);
	int p=lst[ans.snd], i=0;
	S[i++] = ans.snd+'a';
	while(p<n-1){
		S[i++] = go[p]+'a';
		p = nxt[p][go[p]];
	}
	printf("%s\n",S);
}

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

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

	int N; cin >> N;

	map<char, int> cnt;
	for (char c = 'a'; c <= 'z'; c++) {
		cnt[c] = 55;
	}

	for (int i = 0; i < N; i++) {
		string s; cin >> s;
		map<char, int> scnt;
		for (auto c : s) {
			scnt[c]++;
		}
		for (char c = 'a'; c <= 'z'; c++) {
			cnt[c] = min(cnt[c], scnt[c]);
		}
	}

	string ans;
	for (auto p : cnt) {
		for (int i = 0; i < p.second; i++) {
			ans += p.first;
		}
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<string> test(N);
  for (int i = 0; i < N; i++) {
    cin >> test.at(i);
  }
  int c0 = 0;
  int c1 = 0;
  int c2 = 0;
  int c3 = 0;
  
  for (int i = 0; i < N; i++) {
    if (test.at(i) == "AC") {
      c0++;
    }
    else if (test.at(i) == "WA") {
      c1++;
    }
    else if (test.at(i) == "TLE") {
      c2++;
    }
    else {
      c3++;
    }
  }
  cout << "AC" << " x " << c0 << endl;
  cout << "WA" << " x " << c1 << endl;
  cout << "TLE" << " x " << c2 << endl;
  cout << "RE" << " x " << c3 << endl;
  return 0;
}

Measured memory_bytes: 6424
#include <iostream>
using namespace std;
int main() {
	int h, w;
	while (cin>>h>>w && (h!=0 && w!=0)) {
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (i % 2 == 0) {
					if (j % 2 == 0) cout<<"#";
					else cout<<".";
				} else {
					if (j % 2 == 0) cout<<".";
					else cout<<"#";
				}
			}
			cout<<endl;
		}
		cout<<endl;
	}
}

Measured memory_bytes: 1152
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int C = sc.nextInt();
		char[] s = sc.next().toCharArray();
		int[] L = new int[N], R = new int[N];
		int wait = C, sum = 0;
		for(int i = 0; i < N; i++) {
			if(wait >= C) {
				if(s[i] == 'o') {
					wait = -1;
					L[sum] = i;
					sum++;
				}
			}
			wait++;
			if(sum == K)
				break;
		}
		boolean l = false;
		wait = C; sum = K;
		for(int i = N-1; i >= 0; i--) {
			if(s[i] == 'o')
				l = true;
			if(!l)
				continue;
			if(wait >= C) {
				if(s[i] == 'o') {
					wait = -1;
					sum--;
					R[sum] = i;
				}
			}
			wait++;
			if(sum == 0)
				break;
		}
		for(int i = 0; i < K; i++)
			if(L[i] == R[i])
				System.out.println(L[i]+1);
	}
}

Measured memory_bytes: 52016
#include <bits/stdc++.h>
#define LL unsigned long long

int main() {
	LL r, c, ans = 0;
	std::cin >> r >> c;
	if(r == 1 || c == 1) std::cout << "1";
	else {
		for(int i = 1; i <= r; ++i) {
			if(i & 1) {
				if(c & 1) ans += (LL)(c / 2) + 1;
				else
					ans += (LL)(c / 2);
			}
			else
				ans += (LL)(c / 2);
		}
		std::cout << ans;
	}
	return 0;
}
/*
4 4

*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<string>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  if(s[1]==s[2] && (s[0]==s[1] || s[3]==s[1])){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main()
{
char inputa[65535];
char inputb[65535];
char numbuff[1000];
int numbers[1000];
int numnum;
int match;

fgets( inputa, 65535, stdin );
fgets( inputb, 65535, stdin );
if (strchr(inputa, '\n') != NULL) inputa[strlen(inputa) - 1] = '\0';
if (strchr(inputb, '\n') != NULL) inputb[strlen(inputb) - 1] = '\0';

numnum = 0;
for( int i=0; inputb[i] !=0; i++ ) {
if( inputb[i] == ' ' ) {
continue;
}

int j=0;
while( inputb[i] != 0 && inputb[i] != ' ' ) {
numbuff[j++] = inputb[i++];
}
numbuff[j]=0;
numbers[numnum++] = atoi(numbuff);

if( inputb[i-1] == 0 ) {
i--;
}
}

match=0;
for( int i =0; i < atoi(inputa) -2; i++ ) {
 /* printf("<<%d>><<%d>><<%d>>\n", numbers[i], numbers[i+1], numbers[i+2]); */
if( ( numbers[i] < numbers[i+1] && numbers[i+1] < numbers[i+2]  )  ||
    ( numbers[i] > numbers[i+1] && numbers[i+1] > numbers[i+2]  ) ) {

 /* printf("match <<%d>><<%d>><<%d>>\n", numbers[i], numbers[i+1], numbers[i+2]); */
match++;
}
}

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

}

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

int main() {
  int N, K, sum, ans;
  cin >> N >> K;
  
  // おかしをもっているすぬけ君=1な配列
  vector<int> vec(N);
  
  for (int i = 0; i < K; i++) {
    int di;
    cin >> di;
    
    for (int j = 0; j < di; j++){
      int aij;
      cin >> aij;
      vec.at(aij - 1) = 1;
    }
  }
  
  sum = accumulate(vec.begin(), vec.end(), 0);
  ans = N - sum;
  
  cout << ans << endl;
}

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

int main() {
	long long a,b,c;
	cin>>a>>b>>c;
	if(a%2==0||b%2==0||c%2==0)
		cout<<0<<endl;
	else
	{
		cout<<min(min(a*b,b*c),c*a)<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
  int N, L;
  cin >> N >> L;
  string S[N], s;
  for(int i = 0; i < N; i++) {
    cin >> S[i];
  }
 
  sort(S, S + N);
  
  for(int i = 0; i < N; i++) {
    s += S[i];
  }
  
  cout << s << endl;
  
  return 0;
}

Measured memory_bytes: 256
using System;

namespace abc051A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string A = Console.ReadLine();
            string B = A.Substring(0, 5);
            string C = A.Substring(6, 7);
            string D = A.Substring(14, 5);
            Console.WriteLine(B + " " + C + " " + D);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORr(i, k, n) for(int i = (k); i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORr(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

int main(void){
  int n;
  cin >> n;
  vector<int> a(n+1), b(n);
  REP(i, n+1) cin >> a[i];
  REP(i, n) cin >> b[i];

  ll ans = 0;
  REP(i, n){
    if(a[i] > b[i]){
      a[i] -= b[i];
      ans += b[i];
      b[i] = 0;
      continue;
    }else{
      b[i] -= a[i];
      ans += a[i];
      a[i] = 0;
    }
    if(a[i+1] > b[i]){
      a[i+1] -= b[i];
      ans += b[i];
      b[i] = 0;
    }else{
      b[i] -= a[i+1];
      ans += a[i+1];
      a[i+1] = 0;
    }
  }
  cout << ans << endl;
  return 0;
}

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

#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { for (auto &_e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	char a,b;
	cin>>a>>b;
	if(a=='H'){
		if(b=='H'){
			cout<<'H'<<endl;
		}
		else{
			cout<<'D'<<endl;
		}
	}
	else{
		if(b=='H'){
			cout<<'D'<<endl;
		}
		else{
			cout<<'H'<<endl;
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define li long int
#define ld long double
#define pl pair<long long, long long>
#define pi pair<int, int>
#define ppl pair<pl, ll>
#define ppi pair<int, pi>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LLFOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define MOD 1000000007
#define M2 998244353
//std::cout <<setprecision(30) << av << endl;
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--){
        ld r;
        cin >> r;
        ld a = 2*3.1415926*r;
        std::cout <<setprecision(10) << a << endl;


    }
}


Measured memory_bytes: 3808
#include<stdio.h>
#include<stdlib.h>
 
struct node{
    struct node *x;
    struct node *y;
    struct node *z;
    int key;
};
 
typedef struct node * Node;
 
void inorder(Node);
void preorder(Node);
void insert(int);
 
Node root;
 
int main(){
  int n,in,i;
    char input[7];
 
    scanf("%d",&n);
 
    for(i=0;i<n;i++){
        scanf("%s",input);
 
        if(input[0]=='i'){
            scanf("%d",&in);
            insert(in);     
        }
        else{
            if(root!=NULL){
                inorder(root);
                printf("\n");
                preorder(root);
                printf("\n");
            }
        }
    }
 
    return 0;
}
 
 
void insert(int in){
    Node new,work,move;
 
    new=(Node)malloc(sizeof(struct node));
    new->key=in;
    new->x=NULL;
    new->y=NULL;
 
    work=NULL;
    move=root;
    while(move!=NULL){
        work=move;
        if(move->key > in){
            move=move->x;
        }
        else{
            move=move->y;
        }
    }
 
    new->z=work;
    if(work==NULL) root=new;
    else if(work->key > in) work->x=new;
    else work->y=new;
 
}
 
 
void inorder(Node work){
    if(work->x != NULL) inorder(work->x);
    printf(" %d",work->key);
    if(work->y != NULL) inorder(work->y);
}
 
 
void preorder(Node work){
    printf(" %d",work->key);
    if(work->x != NULL) preorder(work->x);
    if(work->y != NULL) preorder(work->y);
}

Measured memory_bytes: 24040
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    vector<int> x(5);
    for (int i = 0; i < 5; ++i) {
        cin >> x[i];
    }
    for (int i = 0; i < 5; ++i) {
        if (x[i] == 0) {
            cout << i + 1 << "\n";
            return 0;
        }
    }
    return 0;
}

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

int countMatch(const string &s, int i,
               const string &t)
{
    int ans = 0;
    const int N = t.size();
    for (int j = 0; j < N; ++j) {
        if (s[i+j] == t[j]) {
            ++ans;
        }
    }

    return ans;
}

int main()
{
    string s, t;
    cin >> s >> t;
    int sl = s.size(), tl = t.size();

    int maxMatch = 0;
    for (int i = 0; i+tl <= sl; ++i) {
        maxMatch = max(maxMatch, countMatch(s, i, t));
    }

    cout << tl - maxMatch << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const ll MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<62;


int main(void) {

    string s;
    cin>>s;
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
        fin(-1);
        return 0;
    }
    map<char,int> m;
    for(int i=0;i<26;i++){
        m['a'+i]=0;
    }
    for(int i=0;i<s.size();i++){
        m[s[i]]++;
    }
    if(s.size()<26){
        for(auto it=m.begin();it!=m.end();it++){
            if(it->second==0){
                s+=it->first;
                break;
            }
        }
        fin(s);
        return 0;
    }
    else{
        for(int i=25;i>=0;i--){
            int c=s[i];
            m.erase(s[i]);
            s.pop_back();
            for(char C=c+1;C<='z';C++){
                if(m[C]==0){
                    cout<<s<<C<<endl;
                    return 0;
                }
            }
        }
        return 0;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        // 変数宣言
        int n;
        int k;
        int result = 0;
        int temp;

        // 標準入力
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        k = sc.nextInt();
        sc.close();

        temp = n;

        // 演算処理
        for( int index=1; temp >= k ; index++ ){
            temp = temp / k ;
            result = index;
        }
        result++;

        // 出力結果
        System.out.println( result );

    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000005
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P> > vec;
// vector<vector<int>> data(3, vector<int>(4));

using Weight = ll;
using Flow = ll;
struct Edge {
    ll src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) {}
    Edge(ll s, ll d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, ll a, ll b, Weight w = 1) {
    g[a].emplace_back(a, b, w);
    g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, ll a, ll b, Weight w = 1) { g[a].emplace_back(a, b, w); }

Graph to_rooted(const Graph &g, ll r = 0) {
    ll n = g.size();
    Graph ng(n);
    std::vector<ll> ord(n, -1);
    std::queue<ll> q;
    q.push(r);
    ll k = 0;
    while (q.size()) {
        ll u = q.front();
        q.pop();
        for (auto &e : g[u]) {
            ll v = e.dst;
            if (ord[v] == -1) {
                ord[v] = k++;
                q.push(v);
                ng[u].emplace_back(e);
            }
        }
    }
    return ng;
}

ll res[200001];
bool used[200001];
vector<ll> dp(200001, INF);
vector<long long> a(200001), u(200001), v(200001);
Graph g(200001);

void solve(ll piv, long long N) {
    used[piv] = true;
    ll p = *lower_bound(dp.begin(), dp.end(), a[piv]);
    *lower_bound(dp.begin(), dp.end(), a[piv]) = a[piv];
    res[piv] = POSL(dp, INF);
    for (auto x : g[piv]) {
        if (!used[x.dst]) solve(x.dst, N);
    }
    *lower_bound(dp.begin(), dp.end(), a[piv]) = p;
}

int main() {
    long long N;
    scanf("%lld", &N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &a[i]);
    }

    for (int i = 0; i < N - 1; i++) {
        scanf("%lld", &u[i]);
        scanf("%lld", &v[i]);
        u[i]--;
        v[i]--;
    }

    rep(i, N) { add_edge(g, u[i], v[i]); }

    solve(0, N);
    rep(i, N) cout << res[i] << endl;
    return 0;
}


Measured memory_bytes: 42748
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#define rep(i,n) for(int i = 0;i<(n);i++);
using namespace std;
using ll = long long;
const ll INF = 100100100100100;
ll memo[87];
ll fibo(ll n) {
	if (n == 0)return 2;
	else if (n == 1)return 1;
	if (memo[n] != 0) return memo[n];
	return memo[n] = fibo(n - 1) + fibo(n - 2);
}
int main() {
	ll N;
	cin >> N;
	cout << fibo(N) << endl;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n; cin >> n;
  ll ans = 0;
  for(int i = 1; i <= n; ++i){
    if(i % 3 != 0 && i % 5 != 0)ans += i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip> //do setprecision
#include <ctime>
#include <complex>
using namespace std;

int main(void){
	int A,B,X;
	cin >> A;
	cin >> B;
	cin >> X;
	if((A<=X) && (X<=A+B)){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE long long
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<30;
long long llinf=1ll<<60;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct
int main(void){
    int n,m,a[1000],i,j,ans;
    while(1){
        n=in();
        m=in();
        if(!n)break;
        rep(i,n)a[i]=in();
        ans=0;
        rep(i,n){
            rep(j,n){
                if(i!=j&&a[i]+a[j]<=m){
                    ans=max(ans,a[i]+a[j]);
                }
            }
        }
        if(!ans)puts("NONE");
        else print(ans);
    }
    return 0;
}


Measured memory_bytes: 2144
N, Y = list(map(int, input().split()))

for i in range(N + 1):
    for j in range(0, N - i + 1):
        if i + j <= N:
            tmp = 10000 * i + 5000 * j + 1000 * (N - i - j)
            if tmp == Y:
                print(str(i) + " " + str(j) + " " + str(N - i - j))
                exit()

print("-1 -1 -1")

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    N = II()
    h_list = LI()

    cnt = 0
    max_cnt = 0
    current = h_list[0]
    for h in h_list[1:]:
        if current >= h: # 今が右以上
            cnt += 1
            if cnt >= max_cnt:
                max_cnt = cnt
        else:
            cnt = 0
        current = h
    print(max_cnt)
solve()

Measured memory_bytes: 14168
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// *st.find_by_order(index), 0-based
// order_of_key(e)

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll K; cin>>K;
	ll val=7%K, mul=1;
	for (int i=1; i<=2e6; i++) {
		if(val==0) {
			cout<<i<<"\n";
			return 0;
		}
		mul=(mul*10)%K;
		val=(val+7*mul)%K;
	}
	cout<<-1<<"\n";
	return 0;
}

Measured memory_bytes: 3664
#include<stdio.h>
#include<iostream>


using namespace std;

int main(){
  int h,w,n;
  cin>>h>>w>>n;
  
  int unit=h>w?h:w;
  int ans=1,tmp=unit;
  while(true){
    if(tmp>=n)
      break;
    tmp+=unit;
    ans++;
  }
  
  cout<<ans;
  
  return 0;
}

Measured memory_bytes: 256
package main

import "fmt"
import "math"

func main() {
	var X, Y float64
	fmt.Scan(&X, &Y)

	var condX, condY float64

	condX = (4*X - Y) / 2.
	condY = (Y - 2*X) / 2.

	//fmt.Println(condX, condY)

	if condX >= 0 && condY >= 0 {
		if math.Floor(condX) == condX && math.Floor(condY) == condY {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1824
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<string> v(2);
	REP(i, 2)cin >> v[i];
	if (v[0][0] == v[1][2] && v[0][1] == v[1][1] && v[0][2] == v[1][0])cout << "YES" << endl;
	else cout << "NO" << endl;
}


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

// 不要な変数、コメントを取り除いた再提出
int main()
{
  int n;
  cin >> n;
  
  int count = 0;
  // 1 <= a * b < n を満たすa, bを求める
  int product = n - 1;
  while (product > 0) {
    for (int i = 1; i * i <= product; i++) {
      if (product % i == 0) {
        if (i * i == product) {
          // a = b
          count++;
        } else {
          // a ≠ b
          count += 2;
        }
      }
    }
    product--;
  }
  
  cout << count << endl;
}

Measured memory_bytes: 3528
#include<iostream>

int main(){
  int d,n,sum;

  while(std::cin >> d){
    n = 600/d;
    for(int i=0;i<n;i++){
      sum += i*i*d*d*d;
    }
    std::cout << sum << std::endl;
    sum = 0;
  }
}

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

int dp[8005][16005];
int a[8001];
string s;
int x,y;
int k,w;
int main()
{
	getline(cin,s);
	cin>>x>>y;
	for(int i=0;i<=s.size()-1;i++)
	{
		if(s[i]=='T')
		{
			k++;
			a[k]=w;
			w=0;
		}
		else
			w++;
	}
	k++;
	a[k]=w;
	
	dp[1][a[1]+8000]=1;
	for(int i=3;i<=k;i+=2)
		for(int j=0;j<=16000;j++)
		{
			if(j+a[i]<=16000)
				dp[i][j]=dp[i-2][j+a[i]];
			if(j-a[i]>=0)
				dp[i][j]=dp[i][j]||dp[i-2][j-a[i]];
		}
	
	dp[0][8000]=1;
	for(int i=2;i<=k;i+=2)
		for(int j=0;j<=16000;j++)
		{
			if(j+a[i]<=16000)
				dp[i][j]=dp[i-2][j+a[i]];
			if(j-a[i]>=0)
				dp[i][j]=dp[i][j]||dp[i-2][j-a[i]];
		}
	int ans=0;
	if(k%2==1)
		ans=dp[k][x+8000]&&dp[k-1][y+8000];
	else
		ans=dp[k][y+8000]&&dp[k-1][x+8000];
	
	if(ans==0) cout<<"No";
	else cout<<"Yes";
	return 0;
}

Measured memory_bytes: 497792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
ll p[1000];

int main(){
    ll ans = 0;
    int x, y;
    cin >> x >> y;

    p[1] = 300000;
    p[2] = 200000;
    p[3] = 100000;

    ans += p[x] + p[y];
    if (x == 1 && y == 1) ans += 400000;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	long long x,i,j;
	scanf("%lld",&x);
	for(i=-200;i<=200;i++)
		for(j=-200;j<=200;j++){
			if(i*i*i*i*i-j*j*j*j*j==x){
				printf("%lld %lld\n",i,j);
				return 0;
			}
		}
}


Measured memory_bytes: 1732
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
	int a, b, c, i, cnt=0;
	scanf("%d %d %d", &a, &b, &c);
	for (i = a; i <= b; i++) {
		if ((c%i) == 0){
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 596
N = int(input())
a = [0]*(N + 1)
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            if i**2 + j**2 + k**2 + i*j + j*k + k*i <= N:
                a[i**2 + j**2 + k**2 + i*j + j*k + k*i] += 1
for i in range(N):
    print(a[i + 1])

Measured memory_bytes: 9136