akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  int sl = s.length(), tl = t.length();
  vector<vector<int>> dp(sl + 1, vector<int>(tl + 1));
  for(int j = 1; j <= tl; j++) {
    for(int i = 1; i <= sl; i++) {
      if(s[i - 1] == t[j - 1])
        dp[i][j] = dp[i - 1][j - 1] + 1;
      else
        dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
    }
  }
  string out;
  int x = sl, y = tl;
  while(dp[x][y]) {
    if(dp[x - 1][y] < dp[x][y] && dp[x][y - 1] < dp[x][y]) {
      out.push_back(s[x - 1]);
      x--, y--;
    } else if(dp[x - 1][y] < dp[x][y])
      y--;
    else
      x--;
  }
  reverse(out.begin(), out.end());
  cout << out << "\n";
  // printf("\t\t");
  // for(int i = 0; i <= sl; i++) printf("%d\t", i);
  // printf("\n\t\t\t");
  // for(int i = 1; i <= sl; i++) printf("%c\t", s[i - 1]);
  // printf("\n");
  // for(int i = 0; i <= tl; i++) {
  //   printf("%d\t%c\t", i, t[i - 1]);
  //   for(int j = 0; j <= sl; j++) { printf("%d\t", dp[j][i]); }
  //   printf("\n");
  // }
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std; using ll = long long;
using ull = unsigned long long; using P = pair<int, int>;
const int INF = 1e9; const int MOD = 1000000007;
const int dx[] = {-1,0,1,0}; const int dy[] = {0,-1,0,1};
//const int dx[] = {-1,-1,-1, 0, 0, 1, 1, 1}; const int dy[] = {-1, 0, 1,-1, 1,-1, 0, 1};
#define PI 3.14159265358979323846264338327950L //setprecision(15)
ll v[100000+1];
ll A[100000+1];
int main() {
	ll N, X, M; cin >> N >> X >> M;
	ll cnt = 1;
	ll tmp = X;
	ll loop = 0;
	ll before_loop = 0; ll after_loop = 0;
	while (1) {
		tmp = tmp % M;
		if (v[tmp] > 0) {
			loop = cnt - v[tmp];
			for (int i = v[tmp]; i < cnt; i++) {
				after_loop += A[i];
			}
			for (int i = 0; i < v[tmp]; i++) {
				before_loop += A[i];
			}
			break;
		}
		v[tmp] = cnt;
		A[cnt] = tmp;
		cnt++;
		tmp *= tmp;
	}
	ll ans;
	if (N < v[tmp]) ans = before_loop;
	else {
		ans = before_loop;
		ans += ( (N - (cnt - loop - 1)) / loop ) * after_loop;
		int tmp3 = (N - (cnt - loop - 1)) % loop;
		for (int i = v[tmp]; i < v[tmp]+tmp3; i++) {
			ans += A[i];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4688
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    long long N, a[10001], i, ans=0;

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> a[i];

        while(a[i] % 2 == 0){
            a[i] /= 2;

            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int r, D, x; cin >> r >> D >> x;
    for(int i=0;i<10;i++){
        x = r * x - D;
        cout << x << endl;
    }
}

Measured memory_bytes: 256
n = input()
a = map(int, raw_input().split())

n1 = 0
n2 = 0
n3 = 0
for ai in a:
    if ai == 1:
        n1 += 1
    elif ai == 2:
        n2 += 1
    else:
        n3 += 1

dp = [[[0] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n + 1):
    for j in range(n + 1):
        for k in range(n + 1):
            if i + j + k > n:
                continue
            if i + j + k == 0:
                continue

            nr = float(n - i - j - k)
            dp[i][j][k] = nr / n
            if i > 0:
                dp[i][j][k] += (1.0 + dp[i - 1][j + 1][k]) * i / n
            if j > 0:
                dp[i][j][k] += (1.0 + dp[i][j - 1][k + 1]) * j / n
            if k > 0:
                dp[i][j][k] += (1.0 + dp[i][j][k - 1]) * k / n
            if n > i + j + k:
                dp[i][j][k] /= (1 - nr / n)
print(dp[n3][n2][n1])


Measured memory_bytes: 344732
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
 
// int power(int a,int n)
// {
//     a %= mod;
//     if(n == 1)return a;
//     if(n == 0)return 1;
//     if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
//     return power((a*a)%mod,n/2)%mod;
// }
// const int inf = (int) 1e18;
 
// int inverse(int x){
//     return power(x,mod-2)%mod;//little fermat....
// }

const int md = 998244353;
int dp[3005][3005];

void solve(){
    int n,s;
    cin >> n >> s;
    vector<int>v(n+5);
    FOR(i,1,n+1)cin >> v[i];
    memset(dp,0,sizeof dp);
    RFOR(i,n,0){
        FOR(j,1,3005){
            dp[i][j] = dp[i+1][j];
            if(j > v[i])dp[i][j] += dp[i+1][j-v[i]],dp[i][j] %= md;
            else if(j == v[i])dp[i][j] += n-i+1,dp[i][j] %= md;
        }
    }
    FOR(i,1,n+1)dp[i][0] = n-i+1;
    int ans = 0;
    FOR(i,1,n+1)ans += dp[i][s]%md;ans %= md;
    cout << ans << "\n";
}

signed main()   
{
    showoff;
    int T = 1;
    //cin >> T;
    FOR(t,1,T+1){
        solve();
    }
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...


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

using ll=long long;
const ll z=0;

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> s(M),c(M),map(N+1,0);
  for(int i=0;i<M;i++){
    cin >> s[i] >> c[i];
  }
  int ans=0;
  for(int i=0;i<M-1;i++){
    for(int j=i+1;j<M;j++){
      if(s[i]==s[j]&&c[i]!=c[j]){
        ans=-1;
      }
    }
  }
  for(int i=0;i<M;i++){
    if(s[i]==1&&c[i]==0&&N!=1){
      ans=-1;
    }
  }
  if(ans==-1)
    cout << ans << endl;
  else{
    for(int i=0;i<M;i++){
      map[s[i]]=c[i];
    }
    for(int i=N;i>=1;i--){
      if(map[1]==0&&N!=1){
        map[1]=1;
      }
      ans +=map[i]*pow(10,N-i);
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 384
import math
K = int(input())
 
# gcd(a, b, c)=gcd(gcd(a,b), c) が成り立つ
s = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    d = math.gcd(a, b) # gcd(a, b)は先に計算しておく
    for c in range(1, K+1):
      s += math.gcd(d, c)
      
print(s)

Measured memory_bytes: 9164
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		//String S = sc.next();
		//int N = Integer.parseInt(sc.next());
		//out.println();
		// ArrayList<String> list = new ArrayList<String>();
		// list.stream().sorted().distinct();
		String A =sc.next();
		String B =sc.next();
		String C =sc.next();
		if(A.charAt(A.length()-1)==B.charAt(0) &&
		B.charAt(B.length()-1)==C.charAt(0)){
			out.println("YES");
		}else{
			out.println("NO");
		}

		out.flush();	
	}
}

Measured memory_bytes: 23764
import math

a, b, h, m = map(int, input().split())

deg_h = 360 / 12
deg_m = 360 / 60

H = h * deg_h + m * (deg_h/60)
M = m * deg_m
deg = abs(H - M)

if deg > 180:
    deg = 360 - deg

rad = (deg/180) * math.pi
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(rad))
print(c)


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

int main()
{
  int n;
  cin >> n;
  vector<int> w(n);
  int sum = 0;
  rep(i, n) 
  {
    cin >> w.at(i);
    sum += w.at(i);
  }

  int mini = sum;
  int prefix_sum = 0;
  for (int i = 0; i < n; i++)
  {
    prefix_sum += w.at(i);
    mini = min(mini, abs(prefix_sum - (sum - prefix_sum)));
  }

  cout << mini << endl;

  

  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 5;
int x[N] = {0};
int h,w,a,b;

int f1(int a){
	for(int i = 1; i <= a; i++)
		cout << 1;
	for(int i = a+1; i <= w; i++){
		cout << 0;		
	}
	cout << endl;
}

int f2(int a){
	for(int i = 1; i <= a; i++)
		cout << 0;
	for(int i = a+1; i <= w; i++){
		cout << 1;
	}
	cout << endl;
}

int main()
{
	while(cin >> h >> w >> a >> b){
		for(int i = 1; i <= b; i++){
			f1(a);
		}
		for(int i = b+1; i <= h; i++){
			f2(a);
		}
	}
	return 0;
 } 

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
//freopen("input.txt" , "r" , stdin);
//freopen("output.txt" , "w" , stdout);
#define ll long long
#define endl  '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i,n)  for(ll i=0;i<n;i++)
#define REP1(i1,n)  for(ll i=1;i<n;i++)
#define pb push_back
#define mk make_pair
int main()
{
   IOS
   int n;
   cin>>n;
   int  a[n];
   ll sum=0;
   map<ll,ll>m;
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
       sum+=a[i];
       m[a[i]]++;
   }
    ll t,b,c;
     cin >> t;
    while ( t-- ){
        cin >> b >> c;
        ll timesb = m[b];
        ll  timesc = m[c];
        sum-=(b*timesb);
        m[c]+=timesb;
        sum+=(timesb*c);
        m[b] = 0;
        cout << sum << "\n";
       }
       }
    //for(ll i=0;i<len;i++)cout<<v[i]<<" ";



/*

Alhamdulilla...

*/


Measured memory_bytes: 9916
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
      String t = sc.next();
      boolean juage = false;
      for(int  i = 0;i<s.length();i++){
         if(s.charAt(i)!=t.charAt(i)){
            System.out.println("No");
         }
         if(s.charAt(i)==t.charAt(i)){
            juage = true;
         }
         else{
            juage = false;
            break;
         }
      }
         if(juage){
            if(s.length()+1==t.length()){
               System.out.println("Yes");
            
         }
      }
   }
}

Measured memory_bytes: 35420
#include <iostream>

using namespace std;
double dp[310][310][310] = {};
int a[310],cnt[4] = {};
int main(){
	cout.precision(20);
	int i,j,k,n;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
		cnt[a[i]]++;
	}
	for(k=0;k<=300;k++){
		for(j=0;j<=300;j++){
			for(i=0;i<=300;i++){
				if(i+j+k==0) continue;
				long double a = 0,b = 0,c = 0,x,y,z,d;
				if(i) a = dp[i-1][j][k];
				if(j) b = dp[i+1][j-1][k];
				if(k) c = dp[i][j+1][k-1];
				d = i + j + k;
				x = i, y = j, z = k;
				dp[i][j][k] = ((double)n + x*a + y*b + z*c)/d;
			}
		}
	}
	cout << dp[cnt[1]][cnt[2]][cnt[3]] << endl;
}

Measured memory_bytes: 227584
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59
using ld = long double;

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //cout << fixed << setprecision(6);

    int n;

    ll arr[5][5010] = {0};

    arr[0][0] = 1;
    for (int i = 0; i < 4; ++i)
    {
        for (int j = 0; j <= 4000; ++j)
        {
            for (int k = 0; k <= 1000; ++k)
            {
                if (j - k >= 0)
                    arr[i + 1][j] += arr[i][j - k];
                else
                    break;
            }
        }
    }

    //cout << arr[4][0] << endl;
    while (cin >> n)
    {
        cout << arr[4][n] << endl;
    }
    return 0;
}


Measured memory_bytes: 3432
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
    os << p.first << ":" << p.second;
    return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

// edit

void solve() {
//    int a,b;
//    cin >> a >> b;
//
//    cout << a * b << endl;
    int N;
    cin >> N;
    
    vector<ll> A(N);
    REP(i, N) cin >> A[i];
    
    long double tapu = 1.;
    ll tapi = 1;
    for(auto e : A){
        tapu *= e;
        tapi *= e;
    }
    
    if(tapu > 1e18){
        cout << -1 << endl;
    }else if(tapi > 1e18){
        cout << -1 << endl;
    }else{
        cout << tapi << endl;
    }
    
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


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

int main()
{
	int S;
	int h, m, s;

	scanf("%d", &S);

	if (S < 0 || 86400 < S) {
		fprintf(stderr, "invalid input\n");
		exit(1);
	}

	h = S / (60 * 60);
	m = (S - (h * 60 * 60)) / 60;
	s = S - (h * 60 * 60) - (m * 60);
	printf("%d:%d:%d\n", h, m, s);

    return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;




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

	int N;
	cin >> N;
	vector<int> A(N);
	map<int, ll> mp;
	REP(i, N) {
		cin >> A[i];
		mp[A[i]]++;
	}
	ll res = 0;
	ITER(itr, mp){
		res += itr->second * (itr->second - 1) / 2;
	}
	REP(i, N) {
		int n = mp[A[i]];
		ll ans = res;
		if (n > 1) ans = ans - n * (n - 1) / 2 + (n - 1) * (n - 2) / 2;
		cout << ans << endl;
	}


	return 0;
}


Measured memory_bytes: 11776
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int ,int> P;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
const int max_size = (1e5+5);

int main( void ){
	int array[max_size] = {};
	int N;
	cin >> N;
	rep(i,0,N){
		int input;
		cin >> input;
		rep(i,input-1,input+2){
			if (i < 0)
				continue;
			array[i]++;
		}
	}
	int maximum = 0;
	rep(i,0,max_size){
		maximum = max(maximum, array[i]);
	}
	cout << maximum << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 640
n=int(input())
a=list(map(lambda x:int(x)-1, input().split()))
ans=sum(list(map(int,input().split())))
c=list(map(int,input().split()))

for i in range(n-1):
  if a[i]+1==a[i+1]:
    ans+=c[a[i]]

print(ans)

Measured memory_bytes: 9144
#include<bits/stdc++.h>
const int maxn=2e5+10;
using namespace std;

int a[maxn];
int sum[maxn];
int cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++) scanf("%d",&a[i]),sum[i]=a[i]+sum[i-1];
    int pos=k,maxsum=sum[k];
    for(int i=k+1;i<=n;i++)
    {
        if(maxsum<(sum[i]-sum[i-k]))
        {
            pos=i;maxsum=sum[i]-sum[i-k];
        }
    }
    double ans=0;
    for(int i=pos-k+1;i<=pos;i++)
    {
        int temp=0;
        for(int j=1;j<=a[i];j++) temp+=j;
        ans+=temp*1.0/a[i];
    }
    printf("%0.12f",ans*1.0);
    return 0;
}

Measured memory_bytes: 1792
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void) {

    double N,K; cin>>N>>K;
    int ans = 0;
    if(N<=K) cout<<1<<endl;
    else{
        cout<<1+ceil((N-K)/(K-1))<<endl;
    }


    return 0;
}

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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    int N;
    cin >> N;
    vector<int> v;
    while(N > 0){
        v.push_back(N % 10);
        N /= 10;
    }
    reverse(ALL(v));
    int dp[15][2][2][2][2][2][2] = {0};
    dp[0][0][0][0][0][0][0] = 1;
    rep(i, v.size()) rep(j, 2) rep(k, 2) rep(l, 2) rep(m, 2) rep(n, 2) rep(o, 2){
        int lim = j ? 9 : v[i];
        rep(d, lim + 1){
            bool shichigosannigai = n ? (d != 3 && d != 5 && d != 7) : (d != 0 && d != 3 && d != 5 && d != 7);
            dp[i + 1][j || d < lim][k || d == 3][l || d == 5][m || d == 7][n || d > 0][o || shichigosannigai] += dp[i][j][k][l][m][n][o];
        }
    }
    int ans = 0;
    rep(j, 2){
        rep(n, 2){
            ans += dp[v.size()][j][1][1][1][n][0];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef DEMETRIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define SZ(x) ((int)x.size())
using namespace std;
typedef long long ll;

vector<int> g[1024];
int n;
bitset<5024> b;
int w[1024];
int s[1024];

int main(){
	scanf("%d",&n);
	fore(i,1,n){
		int k;
		scanf("%d",&k);k--;
		g[k].pb(i);
	}
	fore(i,0,n)scanf("%d",w+i);
	for(int x=n-1;x>=0;--x){
		b.reset();b[0]=1;
		for(int y:g[x])b=(b<<w[y])|(b<<(s[y]-w[y])),s[x]+=s[y];
		int k=-1;
		fore(i,0,w[x]+1)if(b[w[x]-i]){k=i;break;}
		if(k<0){puts("IMPOSSIBLE");return 0;}
		s[x]+=k;
	}
	puts("POSSIBLE");
	return 0;
}

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

using namespace std;

#define MAX 100
#define INF (1<<29)
typedef pair<int, int> pii;

int main()
{
    int n, d, m;
    while (cin >> n >> d, n) {
        int N = 0;
        vector<int> cap[MAX];        
        for (int i = 0; i < n; i++) {
            cin >> m;
            cap[i].resize(m);
            for (int j = 0; j < m; j++, N++) {
                cin >> cap[i][j];                
            }
        }
        bool possible = 1;
        vector<int> cur(n, 0), sum(n, 0);        
        while (N--) {
            int p = -1, maxi = -INF;
            vector<pii> v(n);
            for (int i = 0; i < n; i++) {
                v[i] = pii(sum[i], i);
            }
            sort(v.begin(), v.end());
            for (int i = 0; i < n; i++) {
                if (cur[i] == (int)cap[i].size()) {
                    continue;
                }
                int j = 0;
                for (; j < n; j++) {
                    if (v[j].second != i) {
                        break;
                    }
                }
                if (sum[i] + cap[i][cur[i]] > maxi &&
                    sum[i] + cap[i][cur[i]] - v[j].first <= d) {
                    maxi = sum[i] + cap[i][cur[i]];
                    p = i;
                }
            }
            if (p == -1) {
                possible = 0;
                break;
            }
            
            sum[p] += cap[p][cur[p]++];
        }
        cout << (possible ? "Yes" : "No") << endl;
    }
    return 0;
}

Measured memory_bytes: 3096
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod7=1000000007LL;
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add(LL _x, LL _y, LL _mod=mod7){
  _x+=_y;
  return _x>=_mod ? _x-_mod : _x;
}
inline LL sub(LL _x, LL _y, LL _mod=mod7){
  _x-=_y;
  return _x<0 ? _x+_mod : _x;
}
inline LL mul(LL _x, LL _y ,LL _mod=mod7){
  _x*=_y;
  return _x>=_mod ? _x%_mod : _x;
}
LL mypow(LL _a, LL _x, LL _mod){
  if(_x == 0) return 1LL;
  LL _ret = mypow(mul(_a, _a, _mod), _x>>1, _mod);
  if(_x & 1) _ret=mul(_ret, _a, _mod);
  return _ret;
}
LL mymul(LL _a, LL _x, LL _mod){
  if(_x == 0) return 0LL;
  LL _ret = mymul(add(_a, _a, _mod), _x>>1, _mod);
  if(_x & 1) _ret=add(_ret, _a, _mod);
  return _ret;
}
void sleep(double sec = 1021){
  clock_t s = clock();
  while(clock() - s < CLOCKS_PER_SEC * sec);
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
void build(){

}
LL a, b, c, k;
void init(){
  a=getint();
  b=getint();
  c=getint();
  k=getint();
}
void solve(){
  k %= 2;
  LL ans=a-b;
  if(k) ans=b-a;
  cout<<ans<<endl;
}
int main(){
  build();
  //__ = getint();
  while(__ --){
    init();
    solve();
  }
}


Measured memory_bytes: 256
/**
 *      ///----- My Info -----///
 *      Code by: Ernesto Abreu
 *      Codeforces User: Ernest0_0Abreu
 *      Country: Cuba
 *      E-mail: ernestoabreup@gmail.com
 *      CopyRight
**/
#include <bits/stdc++.h>
#ifdef Ernest0_0Abreu
#include <debug/to_string.h>
#endif
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
    	///----- My Template -----///
///======================================================================================================================================
/// Red-Black Tree
// #include <ext/pb_ds/assoc_container.hpp>  // .find_of_order(x); .order_of_key(x);
// using namespace __gnu_pbds;
// typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > indexed_set;
/// Function
#define pi (acos(-1))
#define lg2(x) 31-__builtin_clz(x)
#define lgx(x,b) log(b)/log(x)
/// Macros
#define fst first
#define scd second
#define left (node<<1)
#define right ((node<<1)+1)
#define size(x) (int)(x.size())
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
/// Debug
#define _end cout << "\n"
#ifdef Ernest0_0Abreu
#define db(x) cerr << "[ "<< #x << " ]: " << to_string(x) << "\n"
#define dbrange(x,begin,end) cerr << "[ "<< #x << " ]: " << to_string(x,begin,end) << "\n"
#define dbname(x) cerr << to_string(x,#x) << "\n"
#define dbnamerange(x,begin,end) cerr << to_string(x,#x,begin,end) << "\n"
#define dbmat(x,begin_n,end_n,begin_m,end_m) cerr << to_string(x,#x,begin_n,end_n,begin_m,end_m) << "\n"
#define dbST(x,end) cerr << to_string(x,end) << "\n";
#define dbendl cerr << "\n";
#else 
#define db(x) ;
#define dbrange(x,begin,end) ;
#define dbname(x) ;
#define dbnamerange(x,begin,end) ;
#define dbmat(x,begin_n,end_n,begin_m,end_m) ;
#define dbST(x,end) ;
#define dbendl ;
#endif
/// Typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/// Constant
const int MAXN = 2e5+7;
const int MOD = 1e9;
const ull BASE = 311;
const ld EPS = 1e-9;
const int INF = ((1<<30)-1);
const ll INFLL = ((1ll<<62ll)-1ll);
const ll oo = 2e18;
/// Hash Prime Numbers: 2, 277, 293, 307, 331, 337, 1009, 2027;
/// Module Prime Numbers: 3, 998244353, 1000000007, 1000000009, 1000000021, 1000000033;
///=======================================================================================================================================
#define int long long
		///----- My code -----///

int ar[MAXN], cnt[MAXN];

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

	int N;
	cin >> N;
	int ans = 0;
	for(int i = 1; i <= N; ++i){
		cin >> ar[i];
		if(i+ar[i] < MAXN) cnt[i+ar[i]-1]++;
		if(i-ar[i]-1 < 1) continue;
		ans += cnt[i-ar[i]-1];
	}

	cout << ans;

	return 0;
}


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

int main(){
  int a, b, k;
  cin >> a >> b >> k;

  for(int i=a; i<a+k; i++){
    if(i > b - k)
      break;
    cout << i << endl;
  }

  for(int i=b-k+1; i<=b; i++){
    if(i<=a) i=a;
    cout << i << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strs = br.readLine().split(" ");
		int[] d = new int[n];
		int ave = 0;
		for(int i = 0 ; i < n ; i++){
			d[i] = Integer.parseInt(strs[i]);
			ave += d[i];
		}
		ave = Math.round((float)ave/n);
		int score = 0;
		for(int i = 0 ;i < d.length ; i++){
			score += (ave-d[i])*(ave-d[i]);
		}
		
		System.out.println(score);
		
		return;
	}
}


Measured memory_bytes: 7764
#include<stdio.h>
#define N 100
#define INFINITY 2000000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int prim(void);

int n,G[N+1][N+1];

int main(){
  int i,j,e;
  
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      scanf("%d",&e);
      if(e==-1) G[i][j]=INFINITY;
      else G[i][j]=e;
    }
  }

  printf("%d\n",prim());

  return 0;
  
}

int prim(){
  int i,v,u,minv;
  int weight[N+1],MST_parent[N+1],color[N+1];

  for(i=1;i<=n;i++){
    weight[i]=INFINITY;
    MST_parent[i]=-1;
    color[i]=WHITE;
  }

  weight[1]=0;

  while(1){
    minv=INFINITY;
    u=-1;
    for(i=1;i<=n;i++){
      if(minv>weight[i] && color[i]!=BLACK){
	u=i;
	minv=weight[i];
      }
    }

    if(u==-1) break;
    color[u]=BLACK;
    for(v=1;v<=n;v++){
      if(color[v]!=BLACK && G[u][v]!=INFINITY){
	if(weight[v]>G[u][v]){
	  weight[v]=G[u][v];
	  MST_parent[v]=u;
	  color[v]=GRAY;
	}
      }
    }
    
  }

  int sum=0;
  for(i=1;i<=n;i++){
    if(MST_parent[i]!=-1) sum+=G[i][MST_parent[i]];
  }

  return sum;
}




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

int main(){
    int w, a, b;
    cin >> w >> a >> b;
    if(a <= b){
        for(int i = 0;;i++){
            if(b <= a + w + i && a + w + i <= b + w){
                cout << i << endl;
                return 0;
            }
        }
    }
    else{
        for(int i = 0;;i++){
            if(a <= b + w + i && b + w + i <= a + w){
                cout << i << endl;
                return 0;
            }
        }
    }
}

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

int n, s, ans;

void dfs(int num, int sum, int count){
    if (sum == s && count == 0){
        ans++;
        return;
    }

    if (count == 0 || num == 10) return;

    dfs(num+1, sum+num, count-1);
    dfs(num+1, sum, count);
}

int main(int argc, char const *argv[]){
    while (cin>>n>>s, n||s){
        ans = 0;
        dfs(0, 0, n);
        cout<<ans<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 1145141919
#define MOD 1000000007
#define ALL(a) begin(a),end(a)
#define ms(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator > (const edge& e) const { return cost > e.cost; }
};

const int V = 100000;
int d[V];
vector<edge> es[V];
int v, e;
void daik(int s)
{
	fill(ALL(d), INF);
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));

	while (!que.empty())
	{
		P p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first) continue;
		REP(i, es[v].size())
		{
			edge e = es[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}

}

int main()
{
	int s;
	cin >> v >> e >> s;
	REP(i, e)
	{
		int a, b, c;
		cin >> a >> b >> c;
		es[a].push_back(edge{ a, b, c });
	}
	daik(s);

	REP(i, v)
	{
		if (d[i] == INF) puts("INF");
		else cout << d[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 13724
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,Classes;
var
  h,w,i,j,count,x,y,sw,m,n,c:Integer;
  a:array of string;
  s123,s1,s2,s3:string;
  tf:Boolean;
  nyu:TStringList;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(h);
    Readln(w);

    SetLength(a,h);

    {for i := 0 to w+1 do begin
      a[0][i]:='#';
      a[h+1][i]:='#';
    end;
    for i := 0 to h - 1 do begin
      a[i][0]:='#';
      a[i][w+1]:='#';
    end;}

    for i := 0 to h - 1 do
      Readln(a[i]);

    for i := 0 to w+1 do
      Write('#');
    Writeln;
    for i := 0 to h-1 do begin
      Write('#');
      Write(a[i]);
      Writeln('#');
    end;
    for i := 0 to w+1 do
      Write('#');
    Writeln;
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 320
#include<stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  int divnum[200]={};
  int count=0;
  for(int i=1;i<=n;){
    int temp=i;
    divnum[i-1];
    for(int j=1;j<=i;){
      if(temp%j==0){
	    divnum[i-1]++;
      }
      j+=2;
    }
    i+=2;
  }
  for(int j=0;j<n;){
    if(divnum[j]==8){
      count++;
    }
    j+=2;
  }
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 3000;
long double p[MAXN];
long double dp[MAXN][MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> p[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      if (j)
        dp[i][j] += dp[i - 1][j - 1] * p[i - 1];
      dp[i][j] += dp[i - 1][j] * (1 - p[i - 1]);
    }
  }
  long double ans = 0.0;
  for (int i = 0; i <= n; i++) {
    if (i > n - i)
      ans += dp[n][i];
  }
  cout << fixed << setprecision(12);
  cout << ans << "\n";
  // for(int i = 0; i <= n; i++){
  //   cout << dp[n][i] << " ";
  // }
  return 0;
}

Measured memory_bytes: 139136
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;
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; }

int main(){
    ll n,m;
    cin>>n>>m;
    ll ans=0;
    if(2*n>=m){
        cout<<m/2;
    }else{
        ans+=n;
        m-=2*n;
        ans+=m/4;
        cout<<ans<<endl;
    }
}

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

int main(){

	while(true){
		int n;
		cin>>n;

		if(n==0)
			break;
		
		char c[100];
		for(int i=0; i<n; i++){
			cin>>c[i];
		}
		int cnt[26]={0};

		for(int i=0; i<n; i++){
			cnt[(int)(c[i]-'A')]++;
			int max1=-1;
			int max2=-1;

			for(int j=0; j<26; j++){
				if(cnt[j]>max1){
					max2=max1;
					max1=cnt[j];
				}
				else if(cnt[j]>max2){
					max2=cnt[j];
				}
			}

			if(max1-max2>n-(i+1)){
				for(int j=0; j<26; j++){
					if(cnt[j]==max1){
						cout<<(char)(j+'A')<<' ';
						break;
					}
				}
				cout<<(i+1)<<endl;
				break;
			}
			if(i==n-1){
				cout <<"TIE"<<endl;
				break;
			}
		}
	}
	return 0;
}
	
			

Measured memory_bytes: 3052
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();
		if(a<=b) {
			System.out.println(a);
		}else {
			System.out.println(a-1);
		}
		sc.close();
	}
}


Measured memory_bytes: 21844
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#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;
typedef pair<int, int> P;
const int mod = 1e+9 + 7;

//マクロ
#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
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main()
{
  int n;
  cin >> n;
  float ans = 2 * n * 3.1415926535;
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 3752
#include<stdio.h>
int n,t,i,j,dp[100005],f[100005]={0};
int main()
{
	dp[0]=1;
	scanf("%d%d",&n,&t);
	for(i=0;i<t;i++)
	{
		scanf("%d",&j);
		f[j]=1;
	}
	for(i=1;i<=n;i++)
	{
		if(f[i]==0)
		{
			if(i>=2)
			dp[i]=dp[i-1]+dp[i-2];
			else if(i==1)
			dp[i]=dp[i-1];
		}
		else
		{
			dp[i]=0;
		}
		dp[i]%=1000000007;
	}
	printf("%d",dp[n]);
}

Measured memory_bytes: 896
N = int(input())
l = [0]*N

for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      if (x**2+y**2+z**2+x*y+y*z+z*x)<=N:
        l[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1

for i in l:
  print(i)

Measured memory_bytes: 9216
n = int(input())
a = []
dict = []
for i in range(n):
    a.append(int(input()))
    dict.append([list(map(int, input().split())) for _ in [0] * a[-1]])
cnt = 0
for i in range(2 ** n):
    flag = 0
    c = ('0' * n + bin(i)[2:])[-n:]
    for i in range(n):
        if c[i] == '0':
            continue
        for j, k in dict[i]:
            if (k == 1 and c[j - 1] == '0') or (k == 0 and c[j - 1] == '1'):
                flag = 1
                break
    if flag == 1:
        continue
    cnt = max(cnt, c.count('1'))
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	int a[26] = {}, b, c;
	bool flag = true;
	string S;
	cin >> S;
	for (int i = 0; i < 4; i++)
	{
		a[S[i] - 'A']++;
	}
	for (int i = 0; i < 4; i++)
	{
		if (a[S[i]-'A'] != 2)flag = false;
	}
	if (flag) {
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	list := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&list[i])
	}

	result := "APPROVED"

	for i := 0; i < n; i++ {
		if list[i]%2 == 0 {
			if list[i]%3 == 0 || list[i]%5 == 0 {
				result = "APPROVED"
			} else {
				result = "DENIED"
				break
			}
		} else {
			result = "APPROVED"
		}
	}
	fmt.Println(result)
}


Measured memory_bytes: 512
//
/*==========================================================*/
/*    Template ver 2017-0720    |    Created by JollyBee    */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
const double EPS=(double)1e-9;
const double PI=(double)acos(-1.0);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define FOR(i,n) for(int i=0;i<n;i++)
#define REPP(i,l,r,c) for(int i=l;i<=r;i+=c)
#define REP(i,l,r) REPP(i,l,r,1)
#define FORD(i,n) for(int i=n-1;i>=0;i--)
#define REVV(i,l,r,c) for(int i=l;i>=r;i-=c)
#define REV(i,l,r) REVV(i,l,r,1)
//random
int irand(int lo, int hi){
    return (((double)rand())/(RAND_MAX+1.0)) * (hi-lo+1) + lo;
}
//ll to string
string toString(ll x) {
    stringstream ss;
    ss << x;
    return ss.str();
}
//string to ll
ll toNumber(string S) {
    ll ret;
    sscanf(S.c_str(),"%lld",&ret);
    return ret;
}
// std::fill(start, end, value);
// for(auto it: DS){}

const int INF=(int)2e9;
const ll MOD=(ll)1e9+7;
/*==========================================================*/
/*                     END OF TEMPLATE                      */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/

const int N = (int)5e3;

char s[N+5];

queue< vi > dat;

int main(){
    while (!dat.empty()) dat.pop();
    int n; scanf("%d", &n);
    scanf("%s", s);

    if (1) {
        vi temp; temp.clear();
        for (int i=0; i<n; i++ ) temp.push_back(i);
        dat.push(temp);
    }
    int res = 0;
    for (int length=0; !dat.empty(); length++) {
        res = length;
        int sz = (int)dat.size();

        for (int xxx=0; xxx<sz; xxx++) {
            vi temp = dat.front(); dat.pop();

            vi ret[35]; for (int i=0; i<33; i++) ret[i].clear();
            for (int x: temp) {
                if (s[x] == '\0') continue;
                int idx = s[x]-'a';
                if (ret[idx].empty()) {
                    ret[idx].push_back(x+1);
                } else {
                    ret[idx].push_back(x+1);
                }
            }

            for (int i=0; i<33; i++) {
                if((int)ret[i].size() > 1) {
                    if (ret[i].front() + length + 1 <= ret[i].back()) {
                        dat.push(ret[i]);
                    }
                }
            }
        }
    }

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


Measured memory_bytes: 512
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int[] X = new int[(1<<N)*2 -1];
		for(int i=0;i<(1<<N);i++){
			X[(1<<N)-1+i] = A[i];
		}
		for(int i=(1<<N)-2;i>=0;i--){
			int a = X[2*i+1];
			int b = X[2*i+2];
			X[i] = a == b ? a: (Math.Max(a,b) - Math.Min(a,b));
		}
		Console.WriteLine(X[0]);
	}
	int N;
	int[] A;
	public Sol(){
		N = ri();
		A = new int[1<<N];
		for(int i=0;i<(1<<N);i++) A[i] = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 9808
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <cmath>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod - 2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

int main()
{
	int n;
	int h[100100];
	long long dp[100100];

	cin >> n;

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

	dp[0] = 0;
	// n = 2
	dp[1] = abs(h[0] - h[1]);

	for (int i = 2; i < n; i++)
	{
		dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2]);
	}

	cout << dp[n - 1];
}


Measured memory_bytes: 32640
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define sum(x) accumulate(all(x),0)
#define gll greater<ll>()

void solve(){
 ll n,k,d;
  cin >> n >> k >> d;
  
  ll ans=0;
  
  rep(i,n,k+1) if(i%d==0) ans++;
  
  cout << ans << endl;
}

int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(void){

	int i, j,a,b;
	while(1){
		scanf("%d %d", &a,&b);
		if(a==0 && b==0)
			break;
		
		for(i=1;i<=a;i++){
			for(j=1;j<=b;j++){
		if((i+j)%2==0)
			printf("#");
		else
			printf(".");
		}
		printf("\n");
	}
	printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
<?php
  
//1問目
while ($line = fgets(STDIN)) {
   $tmp[] = trim($line);
}

// 配列の各要素をさらに分解します
foreach ($tmp as $key => $value) {
  $array[] = explode(" ", $value);
}

$c = $array[0][0];
$answer = ++$c;
echo $answer;

Measured memory_bytes: 4728
import java.io.*;
public class Main {
	public static void main(String[]args)throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String[] word=str.split(" ",0);
		int lengthC=word.length;
		for(int i=0;i<lengthC;i++){
			char[] chara=word[i].toCharArray();
			for(char charac:chara){
				if (charac>=97 && charac<=122){
					charac=(char) (charac-32);
					System.out.print(charac);
				}else{
					System.out.print(charac);
				}
			}
			if (i!=lengthC-1){
				System.out.print(" ");
			}else{
				System.out.println();
			}
		}
		
	}
}

Measured memory_bytes: 24188