akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

def partition(A, p, r):
	x = A[r]
	i = p - 1

	for j in range(p, r):
		# A[j] > x???????????????????????????j????¢???????????????????
		if A[j] <= x:
			# A[j] <= x(A[j]???x??\?????????)
			i += 1
			tmp = A[i]
			A[i] = A[j]
			A[j] = tmp
	tmp = A[i + 1]
	A[i + 1] = A[r]
	A[r] = tmp

	return i + 1

if __name__ == '__main__':
	#MAX = 100000
	#A = [0] * MAX

	n = int(input())
	A = list(map(int, input().split()))

	q = partition(A, 0, n - 1)

	for i in range(n):
		if i:
			print(" ", end="")
		if i == q:
			print("[", end="")
		if i == n - 1:
			print(A[i])
		else:
			print(A[i], end="")
		if i == q:
			print("]", end="")

Measured memory_bytes: 18256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int n;
int num[500000];
long long ans;
string s;
int main(){
    cin>>s;
    int n=s.size()+1;
    s=">"+s+"<";
    for(int i=0;i<n;i++){
        if(s[i]=='<')num[i]=num[i-1]+1;
    }for(int i=n;i;i--){
        if(s[i]=='>')num[i-1]=max(num[i]+1,num[i-1]);
    }
    for(int i=0;i<n;i++)ans+=num[i];
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2840
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define dbprint(s) {cout<<"db:"<<s<<endl;}
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){

  int r;
  cin >> r;
  double R = (double)r * 2 * M_PI;
  cout << R << endl;

  return 0;
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 1e9 + 7;
const ll SQ = 330;

int main () {
    ios::sync_with_stdio(0), cin.tie(0);
    ll n, k;
    cin >> n >> k;
    ll cur = k;
    ll res = 1;
    while (cur <= n) {
    	cur *= k;
    	res ++;
	}
	cout << res;
    return (0);
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
	char a[10];
	scanf("%s", a);
	int cnt = 0;
	int ans = 0;
	int len = strlen(a);
	for (int i = 0; i < len; i++) {
		if (a[i] == 'S') {
			cnt = 0;
		} else {
			cnt++;
			if (cnt > ans) {
				ans = cnt;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1680
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
    string S;
    string T;
    int N;

    cin >> S >> T;
    cin >> N;

    int s_s = 0;
    int s_e = 0;
    int t_s = 0;
    int t_e = 0;

    int s_a = 0;
    int S_asum[S.length()];
    for(int j=1;j<=S.length();j++){
        if(S[j-1] == 'A'){
            s_a++;
        }
        S_asum[j] = s_a;
    }
    int t_a = 0;
    int T_asum[T.length()];
    for(int j=1;j<=T.length();j++){
        if(T[j-1] == 'A'){
            t_a++;
        }
        T_asum[j] = t_a;
    }
    S_asum[0] = 0;
    T_asum[0] = 0;

    for(int i=0;i<N;i++){

        cin >> s_s >> s_e >> t_s >> t_e;
        int s_tmp = 0;
        int t_tmp = 0;

        s_tmp = S_asum[s_e] - S_asum[s_s-1];
        t_tmp = T_asum[t_e] - T_asum[t_s-1];

        s_a =  s_tmp + ((s_e - s_s + 1) - s_tmp) * 2;
        t_a = t_tmp + ((t_e - t_s + 1) - t_tmp) * 2;

        string ans = "NO";
        if(s_a % 3 == t_a % 3){
            ans = "YES";
        }
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

const int mod = 998244353, N = 3005;

int n, s;
int a[N];
int f[N];

int main() {
	scanf("%d %d", &n, &s);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = s; j > a[i]; j--) f[j] = (f[j] + f[j - a[i]]) % mod;
		f[a[i]] = (f[a[i]] + i) % mod;
		ans = (ans + (ll)f[s] * (n - i + 1) % mod) % mod;
		f[s] = 0;
	}
	printf("%d\n", ans);
	return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 0;

typedef long long int ll;

using namespace std;

int main(){
    int n,m;cin>>n>>m;
    vector<int> graph[n];
    fore(i,0,m){
        int a,b;cin>>a>>b;a--;b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    
    bool posible = false;
    
    for(auto it:graph[0]){
        for(auto i:graph[it]){
            if(i == n-1){
                posible = true;
            }
        }
    }
    
    if(posible){
        cout<<"POSSIBLE";
    }else{
        cout<<"IMPOSSIBLE";
    }
	return 0;
}

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

#define REP( i, n )     for( int (i) = 0; (i) < (n); (i)++ )
#define ALL( a )        (a).begin(), (a).end()

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main(){
    char c; cin >> c;
    if( c == 'A' ) cout << 'T' << endl;
    else if( c == 'T' ) cout << 'A' << endl;
    else if( c == 'G' ) cout << 'C' << endl;
    else cout << 'G' << endl;
}


Measured memory_bytes: 256
n, k = list(map(int, input().split()))
if k>(n-2)*(n-1)//2:
  print(-1)
  exit()
m = 0
edge = [[] for i in range(n)]
edge[0].append(1)
m += 1
for i in range(2, n):
  edge[1].append(i)
  m += 1
rem = (n-2)*(n-1)//2-k
for i in range(n):
  if rem==0:
    break
  if i==1:
    continue
  for j in range(i+1, n):
    if rem==0:
      break
    if j==1:
      continue
    edge[i].append(j)
    m += 1
    rem -= 1
print(m)
for i, row in enumerate(edge):
  for e in row:
    print(i+1, e+1)

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

int main()
{
	string s;
	cin>>s;
	if(s=="SUN")cout<<7;
	else if(s=="SAT")cout<<1;
	else if(s=="FRI")cout<<2;
	else if(s=="THU")cout<<3;
	else if(s=="WED")cout<<4;
	else if(s=="TUE")cout<<5;
	else if(s=="MON")cout<<6;
	return 0;
}


Measured memory_bytes: 256
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
// ------ Class ------ //
template <class T> class Graph2 {
public:
	// ------ Basics ------ //
	static const T INF = numeric_limits<T>::max();
	int V, E; vector<vector<pair<int, T> > > G;
	Graph2() : V(0), E(0), G(vector<vector<pair<int, T> > >()) {}
	Graph2(int v) : V(v), E(0), G(vector<vector<pair<int, T> > >(v)) {}
	Graph2(vector<vector<pair<int, T> > > g) : V(g.size()), G(g) { for (int i = 0; i < g.size(); i++) E += g[i].size(); }
	int size() { return V; }
	void add1(int v1, int v2, T w) { G[v1].push_back(make_pair(v2, w)); E++; }
	void add2(int v1, int v2, T w) { add1(v1, v2, w); add1(v2, v1, w); }
	bool operator==(const Graph2& g) const { return G == g.G; }
	bool operator!=(const Graph2& g) const { return G != g.G; }
	vector<pair<int, T> > operator[](int x) { return G[x]; }

	// ------ Algorithms ------ //
	vector<T> dist(int s) {
		priority_queue<pair<T, int> > que; que.push(make_pair(0, s));
		vector<T> d(V, INF); d[s] = 0;
		while (!que.empty()) {
			pair<T, int> t = que.top(); que.pop();
			int u = t.second;
			for (int i = 0; i < G[u].size(); i++) {
				int v = G[u][i].first; T e = G[u][i].second;
				if (d[v] > d[u] + e) {
					d[v] = d[u] + e;
					que.push(make_pair(-d[v], v));
				}
			}
		}
		return d;
	}
	long long treediameter() {
		vector<int> v1 = dist(0);
		vector<int> v2 = dist(max_element(v1.begin(), v1.end()) - v1.begin());
		return *max_element(v2.begin(), v2.end());
	}
};
int V, s, t, w;
int main() {
	scanf("%d", &V);
	Graph2<int> G(V);
	for(int i = 0; i < V - 1; i++) {
		scanf("%d%d%d", &s, &t, &w);
		G.add2(s, t, w);
	}
	cout << G.treediameter() << endl;
}

Measured memory_bytes: 10040
#include <iostream>
#include <string>
#include <algorithm>
#include <bitset>
#include <math.h>

using namespace std;
int main(void){
    long long s,t,sum=0;
    int n=-1;
    cin>>s;
    t=s;
    while(t>0){
        t/=10;
        n++;
    }
    for(int i=0;i<(1<<n);i++){
        t=s;
        for(int j=0,k=1;j<n;j++,k++){
            if((1&(i>>j))==1){
               long long ll=pow(10,k);
               k=0;
               sum+=t%ll;
               t=t/ll;
            }
        }
        sum+=t;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,x,ans,s,a[3],b[3];
int main(){
   
  cin>>n;
   
  r(i,n){
    cin>>x;
    a[x%3]++;
  }
   
  if(a[1]||a[2]){
     
    b[2]=a[2],b[1]=a[1];
     
    int ans1=0,ans2=0,s1=0,s2=0;
     
    if(a[1]){
       
      s1++,a[1]--,ans1++;
       
      while(1){
     
    int f=0;
    if(s1%3==2&&a[2])s1+=2,a[2]--,ans1++,f++;
    if(s1%3==1&&a[1])s1++,a[1]--,ans1++,f++;
    if(!f)break;
     
      }
       
      if(a[2]||a[1])ans1++;
    }
     
    if(b[2]){
      s2+=2,b[2]--,ans2++;
      while(1){
    int f=0;
    if(s2%3==2&&b[2])s2+=2,b[2]--,ans2++,f++;
    if(s2%3==1&&b[1])s2++,b[1]--,ans2++,f++;
    if(!f)break;
      }
      if(b[2]||b[1])ans2++;
    }
    cout<<max(ans1,ans2)+a[0]<<endl;
  }
   
  else cout<<1<<endl;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof(a))
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

const int N = 100005;

ll n, x, m;
int dist[N], nxt[N];

ll getDist(int start, int cur) {
	if (nxt[cur] == start) return cur;
	return cur + getDist(start, nxt[cur]);
}

ll getDistWithSomeDistance(int cur, int d, int t) {
	if (t == 0) return 0;
	if (d == t) return cur;
	return cur + getDistWithSomeDistance(nxt[cur], d+1, t);
}

int getLength(int start, int cur) {
	if (nxt[cur] == start) return 1;
	return 1 + getLength(start, nxt[cur]);
}

int main() {
	scanf("%lld %lld %lld", &n, &x, &m);
	reset(nxt, -1);
	dist[x] = 1;
	ll ans = x;
	int cnt = 1;
	while (cnt < n) {
		ll tmp = (x*x) % m;
		if (tmp == 0) {
			break;
		}
		nxt[x] = tmp;
		if (dist[tmp] > 0) {
			n -= dist[x];
			ll dist = getDist(tmp, tmp);
			int len = getLength(tmp, tmp);
			ans += (n/len) * dist;
			ans += getDistWithSomeDistance(tmp, 1, n % len);
			break;
		}
		dist[tmp] = dist[x] + 1;
		ans += tmp;
		x = tmp;
		cnt++;
	}

	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4556
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N;
    Scd(N);

    vi a(N),b(N);
    Rep(i,N){
        Scd(a[i]);
    }
    Rep(i,N){
        Scd(b[i]);
    }

    vector<vi> e(N+1);
    Rep(i,N+1) Repe(j,N+1,1){
        e[i].push_back(i);
        e[i].push_back(i%j);
    }

    deque<int> q;
    vi use(51,1);
    vi nes(51,0);
    vi seen(51,0);

    auto bfs = [&]( int l, int r ){
        bool linked = false;
        q.push_back(l);
        fill( seen.begin(), seen.end(), 0 );
        seen[l] = 1;
        while( q.size() ){
            int from = q.front();
            q.pop_front();
            Repe(mi,51,1){
                int to = from%mi;
                if( ( use[mi] or nes[mi] ) and !seen[to] ){
                    seen[to] = 1;
                    q.push_back(to);
                }
            }
            if( from == r ) linked = true;
        }
        return linked;
    };

    bool ok = true;
    Rep(i,N){
        ok = ok && bfs( a[i], b[i] );
    }
    if( !ok ){
        printf ("%d\n", -1 );
        return 0;
    }

    ll ans = 0;
    for( int ri = 50; ri > 0; ri-- ){
        use[ri] = 0;
        ok = true;
        Rep(li,N) ok = ok && bfs( a[li], b[li] );
        if( !ok ) nes[ri] = 1, ans += 1LL<<ri;
    }

    printf ("%lld\n", ans );

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
ll K;
vector<int> A;
void input(){
    fast_io();
    cin >> N >> K;
    for (int i = 0; i < N; i++)
    {
        int a; cin >> a;
        a--;
        A.push_back(a);
    }
}

int solve(){
    vector<vector<int>> dp(110,vector<int>(N,0));

    for (int k = 0; k < N; k++)
    {
        dp[0][k] = A[k];
    }    


    for (int i = 0; i < 100; i++)
    {
        for (int k = 0; k < N; k++)
        {
            dp[i+1][k] = dp[i][dp[i][k]];
        }    
    }

    int ans = 0;
    int i=0;
    while(K){
        if(K&1) ans = dp[i][ans];
        K>>=1;
        i++;
        DBG(ans)
    }
    cout << (ans+1) << endl;
    return 0;
}   

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

Measured memory_bytes: 91108
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<ii, int>;
#define vt vector
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const int MOD = 1e9 + 7;
const int INF = INT_MAX;
// const int N = ;

int x;

void solve() {
    cin >> x;
    cout << (x >= 30 ? "Yes\n" : "No\n");
}

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

Measured memory_bytes: 3600
n = int(input())
h = [int(i) for i in input().split()]

s = [float('inf')] * n
s[0] = 0
for i in range(n):
    for j in range(i+1, min(i+3, n)):
        s[j] = min(s[j], s[i] + abs(h[i]-h[j]))

print(s[n-1])

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

int main(){
	string a, b;
	int x, i = 0;
	cin >> a >> b;
	while((x = a.find(b, i)) != -1){
		cout << x << '\n';
		i = x + 1;
	}
	return 0;
}

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

#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9, MOD = INF + 7;
 
/////////////////////////////////////////////////////////////////////
 
const int N = 1e2 + 5, M = 3e2 + 5;

int A[N];

int main() {
 
	sync;
	
	int n; cin >> n;
	ll ans = INF * INF;
	for (int i = 0; i < n; i++) cin >> A[i];
	for (int x = - M; x <= M; x++) {
		ll cost = 0;
		for (int i = 0; i < n; i++) cost += 1LL * (x - A[i]) * (x - A[i]);
		ans = min(ans, cost);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MAXN 300009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
multiset<int>a;
set<PII>b,s;
int arr[MAXN];
int main(){
	//~ #ifndef ONLINE_JUDGE
    //~ freopen("file.in", "r", stdin);
	//~ #endif	
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n*3;i++)
		scanf("%d",&arr[i]);
	ll A=0,B=0;
	for(int i=1;i<=n;i++)
		A+=arr[i],a.insert(arr[i]);
	for(int i=n+1;i<=n*3;i++){
		if((int)b.size()>=n and b.rbegin()->ff>arr[i]){
			B-=b.rbegin()->ff;
			s.insert(*b.rbegin());
			b.erase(*b.rbegin());
		}
		if((int)b.size()<n)
			b.insert(mp(arr[i],i)),B+=arr[i];
		else
			s.insert(mp(arr[i],i));
	}	
	ll ans=A-B;
	for(int i=n+1;i<=n*2;i++){	
		if(*a.begin()<arr[i]){
			A-=*a.begin();
			a.erase(a.begin());
			a.insert(arr[i]);
			A+=arr[i];
		}
		if(s.count(mp(arr[i],i)))
			s.erase(mp(arr[i],i));
		if(b.count(mp(arr[i],i))){
			b.erase(mp(arr[i],i));
			B-=arr[i];
			B+=s.begin()->ff;
			b.insert(*s.begin());
			s.erase(*s.begin());
		}
		umax(ans,A-B);
	}
	printf("%lld\n",ans);
	return 0;
}
//~ big small


Measured memory_bytes: 15488
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABiscuitGenerator solver = new ABiscuitGenerator();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABiscuitGenerator {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int t = in.nextInt();
            int res = 0;
            for (int i = 1; i * a <= t; i++) {
                res += b;
            }
            out.println(res);
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        public void close() {
        }

    }
}



Measured memory_bytes: 23380
#include <stdio.h>

int card[4][13];
const char mark[]={'S','H','C','D'};

int main()
{
	int i,j,n;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		char a;
		int x;
		scanf(" %c %d",&a,&x);
		if(a=='S') card[0][x-1]=1;
		else if(a=='H') card[1][x-1]=1;
		else if(a=='C') card[2][x-1]=1;
		else if(a=='D') card[3][x-1]=1;
	}
	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			if(card[i][j]==0){
				printf("%c %d\n",mark[i],j+1);
			}
		}
	}
	return 0;
}



Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int MAXN = 5e2 + 10;
int n, arr[MAXN];
ll dp[MAXN][MAXN], pd[MAXN];

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

	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> arr[i];

	for (int i = 1; i <= n; i++) pd[i] = pd[i-1] + arr[i];
	for (int i = 1; i <= n; i++) dp[i][i] = 0;
	for (int a = 2; a <= n; a++) {
		for (int i = 1; i + a - 1 <= n; ++i) {
			dp[i][i + a - 1] = 1e18;
			for(int j = i; j < i + a - 1; j++)
				dp[i][i + a - 1] = min(dp[i][i + a - 1], dp[i][j] + dp[j + 1][i + a - 1] + pd[i + a - 1] - pd[i - 1]);
		}
	}

	cout << dp[1][n] << '\n';

	return 0;
}


Measured memory_bytes: 1920
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    string s,t;
    int a,b;
    string u;
    cin>>s>>t>>a>>b>>u;
    if(s==u){
        cout<<a-1<<" "<<b<<endl;
    }
    else{
        cout<<a<<" "<<b-1<<endl;
    }
}

Measured memory_bytes: 256
n,w=map(int,input().split())
cost=[[0 for i in range(w+1)] for j in range(n+1)]
value=[tuple(map(int,input().split())) for i in range(n)]
for i in range(1,n+1):
  for j in range(w+1):
    weight_=value[i-1][0]
    value_=value[i-1][1]
    if j < weight_:
      cost[i][j]=cost[i-1][j]
    else:
      cost[i][j]=max(cost[i-1][j-weight_]+value_,cost[i-1][j])
print(cost[-1][-1])


Measured memory_bytes: 171656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));		
		char s[] = br.readLine().toCharArray();
		char t[] = br.readLine().toCharArray();
		br.close();

		int row = t.length;
		int col = s.length;
		int tb[][] = new int[row + 1][col + 1];

		for ( int r = 0; r < row; r++ ) {
			for ( int c = 0; c < col; c++ ) {
				if ( t[r] == s[c] ) {
					tb[r + 1][c + 1] = tb[r][c] + 1;
				} else {
					tb[r + 1][c + 1] = Math.max(tb[r + 1][c], tb[r][c + 1]);
				}
			}
		}

		int r = row;
		int c = col;
		ArrayDeque<Character> stack = new ArrayDeque<Character>();
		stack.add(' ');
		while ( tb[r][c] != 0 ) {

			// 左上に行けるとき
			if ( tb[r - 1][c - 1] == tb[r][c] ) {
				r -= 1;
				c -= 1;
			} else
			// 上
			if ( tb[r - 1][c] == tb[r][c] ) {
				r -= 1;
			} else
			// 左
			if ( tb[r][c - 1] == tb[r][c] ) {
				c -= 1;
			} else
			// 行き止まり
			{
				stack.addFirst((Character) s[c - 1]);
				r -= 1;
				c -= 1;
			}
		}
		
		StringBuilder sb = new StringBuilder();
		while ( stack.size() > 0 ) {
			sb.append(stack.pollFirst());
		}
		System.out.println(sb);

//		StringBuilder sb = new StringBuilder();
//		while ( stack.size() > 0 ) {
//			sb.append(stack.pollLast());
//		}
//		System.out.println(sb);
	}
}


Measured memory_bytes: 82644
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) {
 if (a < b) { a = b; return true; } return false; 
 }
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
 }
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,a,b;
cin>>n>>a>>b;
  ll c=a-b;
  vll h(n);
  rep(i,n) cin>>h[i];
  ll r=1e9;
  ll l=0;
  while(l+1<r){
    ll mid=(l+r)/2;
    ll cu=0;
    rep(i,n){
      if(h[i]>mid*b){
        cu+=(h[i]-mid*b+c-1)/c;
      }
    }
    if(cu>mid){
      l=mid;
    }
    else r=mid;
  }
  COUT(r);
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		boolean ch=false;
		long ans=0;
		int acou=0;
		for(int i=0; i<s.length(); i++){
			if(s.charAt(i)=='A'){
				acou++;
				ch=true;
			}else if(i<s.length()-1 && ch && s.charAt(i)=='B' && s.charAt(i+1)=='C'){
				i++;
				ans+=acou;
			}else{
				acou=0;
				ch=false;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 26832
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
using namespace std;
typedef long long LL;
typedef double ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
const int INF=1<<30;
int DP[111],L[111];
int main(){
	int N,x;
	cin >> N;
	N*=2;
	FOR(i,1,N+1) 
		cin >> L[i];
	sort(L+1,L+N+1);
	int answer=0;
	FOR(i,1,N+1){
		if(i&1)
		answer+=L[i];
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 256
def pr(x):
    cnt = 0
    for i in range(1, int(x**0.5)+1):
        if i**2 == x:
            cnt += 1
        elif x % i == 0:
            cnt += 2
    return cnt

n = int(input())
ans = 0
for i in range(1, n+1, 2):
    if pr(i) == 8:
        ans += 1
print(ans)

Measured memory_bytes: 9448
while True:
    N = int(raw_input())

    if N == 0:
        break

    xy = [map(int, raw_input().split()) for _ in range(N)]

    M = int(raw_input())

    table = [[False for _ in range(21)] for _ in range(21)]
    table[10][10] = True
    cur = [10, 10]

    for i in range(M):
        d, l = raw_input().split()
        l = int(l)
        if d == 'N':
            for i in range(l):
                cur[1] += 1
                table[cur[0]][cur[1]] = True
        if d == 'E':
            for i in range(l):
                cur[0] += 1
                table[cur[0]][cur[1]] = True
        if d == 'S':
            for i in range(l):
                cur[1] -= 1
                table[cur[0]][cur[1]] = True
        if d == 'W':
            for i in range(l):
                cur[0] -= 1
                table[cur[0]][cur[1]] = True

    flag = True

    for (x, y) in xy:
        if not table[x][y]:
            flag = False
            break

    print 'Yes' if flag else 'No'



Measured memory_bytes: 4684
#include <stdio.h>

int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	
	if(a < b && b < c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#define lowbit(a) ((a)&(-(a)))
using namespace std;

void file(bool opt)
{
	if (opt&&fopen("in.txt", "r"))
	{
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
}

int n, m;
int a[100000+5];
struct node {
	int sum, num;
}p[100000+5];

bool cmp(node a, node b)
{
	if (a.num == b.num)
		return a.sum < b.sum;
	return a.num < b.num;
}
priority_queue<int,vector<int>,greater<int>>que;
long long sum = 0;
int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]),sum+=a[i],que.push(a[i]);
	for (int i = 1; i <= m; i++)
		scanf("%d%d", &p[i].sum, &p[i].num);
	sort(p + 1, p + 1 + m, cmp);
	for (int i = m; i >= 1; i--)
	{
		for (int j = 1; j <= p[i].sum; j++)
		{
			if (que.top() >= p[i].num)break;
			sum -= que.top();
			que.pop();
			que.push(p[i].num);
			sum += p[i].num;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1912
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 100005;
const int MaxM = 1000;

int n, k;
int M;
struct Point {
	int x, y;
	char c;
	Point () {}
	Point (int _x, int _y, char _c) {
		x = _x; y = _y; c = _c;
	}
}PP[MaxN + 5];
int sum[4 * MaxM + 5][4 * MaxM + 5];

void init() {
	M = 2 * k;
	memset(sum, 0, sizeof(sum));
	for(int i = 1; i <= n; i++)
		scanf("%d %d %c", &PP[i].x, &PP[i].y, &PP[i].c);
}

int cal(int lx, int ly, int ux, int uy) {
	return sum[lx][ly] - sum[lx][uy + 1] - sum[ux + 1][ly]
	           + sum[ux + 1][uy + 1];
}

void change() {
	for(int i = 1; i <= n; i++) {
		if(PP[i].c == 'B') {
			int tx = PP[i].x % M;
			int ty = PP[i].y % M;
			sum[tx][ty]++;
		}
		else if(PP[i].c == 'W') {
			int tx = (PP[i].x) % M;
			int ty = (PP[i].y + k) % M;
			sum[tx][ty]++;
		}
	}
	for(int i = 0; i < M; i++) {
		for(int j = 0; j < M; j++) {
			sum[i + M][j] = sum[i][j];
			sum[i][j + M] = sum[i][j];
			sum[i + M][j + M] = sum[i][j];
		}
	}
	for(int i = 2 * M - 1; i >= 0; i--) {
		for(int j = 2 * M - 1; j >= 0; j--) {
			sum[i][j] = sum[i][j] + sum[i + 1][j] + 
			                sum[i][j + 1] - sum[i + 1][j + 1];
		}
	}
}

void solve() {
	int best = 0;
	for(int i = 0; i < M; i++) {
		for(int j = 0; j < M; j++) {
			int tmp = cal(i, j, i + k - 1, j + k - 1)
		                 + cal(i + k, j + k, i + M - 1, j + M - 1);
			best = max(best, tmp);
		}
	}
	printf("%d\n", best);
}

int main()
{
	while(scanf("%d %d", &n, &k) != EOF)
	{
		init();
		change();
		solve();
	}
	return 0;
}

Measured memory_bytes: 64000
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

int main()
{
	int n, a[10] = {}, i, j, sum = 0, c, d = 0;

	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (i = -1; i <= 1; i++) {
		c = 0;
		sum += pow(3, n - 1);
		if ((a[0] + i) % 2 != 0) {
			for (j = 1; j < n; j++) {
				if (a[j] % 2 == 0) {
					c++;
				}
			}
			if (c == 0) {
				d += 1;
			}
			else {
				d += pow(2, c);
			}
		}
	}

	cout << sum - d << endl;

	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, k, n, num = 0, ans, t1 = 0, t2 = 0;
  scanf("%lld", &n);
  char s[n +10];
  ll dp[n][3], sum[n][3];
  for(i = 0; i < n; ++i) for(j = 0; j < 3; ++j) dp[i][j] = 0, sum[i][j] = 0;
  scanf("%s", s);
  if(s[0] == 'J') sum[0][0] = 1;
  else if(s[0] == 'O') sum[0][1] = 1;
  else sum[0][2] = 1;
  for(i = 1; i < n; ++i) {
    for(j = 0; j < 3; ++j) sum[i][j] = sum[i - 1][j];
    if(s[i] == 'J') ++sum[i][0];
    else if(s[i] == 'O') ++sum[i][1];
    else ++sum[i][2];
  }
  if(s[0] == 'O') t1 = sum[n - 1][2] - sum[0][2];
  for(i = 1; i < n; ++i) if(s[i] == 'O') num += sum[i - 1][0] * (sum[n - 1][2] - sum[i][2]), t1 += (sum[i - 1][0] + 1) * (sum[n - 1][2] - sum[i][2]), t2 += sum[i - 1][0] *(sum[n - 1][2] - sum[i][2] + 1);
  ans = (t1 > t2 ? t1 : t2);
  //printf("%lld %lld ", t1, t2);
  for(i = 0; i < n; ++i) if(ans < num + sum[i][0] * (sum[n - 1][2] - sum[i][2])) {
    ans = num + sum[i][0] * (sum[n - 1][2] - sum[i][2]);
    //printf("%lld\n", i);
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 7496
#include <iostream>
using namespace std;
int main()
{
	int n,x,f=0,h;
	cin>>n;
	h=n;
	while(h!=0)
	{
		x=h%10;
		f+=x;
		h=h/10;
	} 
	if(n%f==0)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}

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

const int INF = 1 << 25;
int dp[41][410][410];

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

	int N, Ma, Mb;
	cin >> N >> Ma >> Mb;

	fill((int*)begin(dp), (int*)end(dp), INF);
	dp[0][0][0] = 0;
	for(int i = 0; i < N; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		for(int j = 0; j <= 400; j++) {
			for(int k = 0; k <= 400; k++) {
				if(dp[i][j][k] == INF) continue;
				dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
				dp[i + 1][j + a][k + b] = min(dp[i + 1][j + a][k + b], dp[i][j][k] + c);
			}
		}
	}

	int ans = INF;
	for(int j = 1; j <= 400; j++) {
		for(int k = 1; k <= 400; k++) {
			if(j * Mb == k * Ma) ans = min(ans, dp[N][j][k]);
		}
	}

	if(ans == INF) ans = -1;
	cout << ans << endl;
}

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

typedef long long ll;

const int N = 2e3 + 5;

struct A {
  int l;
  ll sum;
} dp[N][N];

char s[N];
char ans[2 * N];
int cn;
ll k;

int dfs(int l, int r) {
  if(dp[l][r].l != -1) return dp[l][r].l;
  if(l == r) {
    dp[l][r] = (A){1, 1}; return 1;
  }
  if(l > r) {
    dp[l][r] = (A){0, 1}; return 0;
  }
  if(s[l] == s[r]) {
    dp[l][r].l = dfs(l + 1, r - 1) + 2;
    dp[l][r].sum = dp[l+1][r-1].sum;
    return dp[l][r].l;
  }
  int la = dfs(l + 1, r);
  int ra = dfs(l, r - 1);
  dp[l][r].l = min(la, ra) + 2;
  if(la + 2 == dp[l][r].l) dp[l][r].sum += dp[l+1][r].sum;
  if(ra + 2 == dp[l][r].l) dp[l][r].sum += dp[l][r-1].sum;
  //cout << dp[l][r].sum << endl;
  if(dp[l][r].sum > k) dp[l][r].sum = k + 1;
  return dp[l][r].l;
}

void dfsn(int l, int r, int be) {
  if(l == r) {
    ans[be] = s[l]; return ;
  }
  if(l > r) return ;
  int len = dp[l][r].l;
  if(s[l] == s[r]) {
    ans[be] = ans[be+len-1] = s[l];
    dfsn(l+1, r-1, be+1); return ;
  }
  int la = dp[l+1][r].l;
  int lb = dp[l][r-1].l;
  if(la != dp[l][r].l-2) {
    ans[be] = ans[be+len-1] = s[r];
    //if(dp[l][r].l != lb+2) cout<<"error!"<<endl;
    //cout << be << " " << len << " " << s[r] << endl;
    dfsn(l, r-1, be+1); return ;
  } else
  if(lb != dp[l][r].l-2) {
    ans[be] = ans[be+len-1] = s[l];
    //cout << be << " " << len << " " << s[l] << endl;
    dfsn(l+1, r, be+1); return ;
  }
  //cout << dp[l+1][r].sum << " " << dp[l][r-1].sum << endl;
  if(s[l] < s[r]) {
    if(dp[l+1][r].sum >= k) {
      ans[be] = ans[be+len-1] = s[l];
      //cout << be << " " << len << " " << s[l] << endl;
      dfsn(l+1, r, be+1); return ;
    } else {
      ans[be] = ans[be+len-1] = s[r];
      k -= dp[l+1][r].sum;
      //cout << be << " " << len << " " << s[r] << endl;
      dfsn(l, r-1, be+1); return ;
    }
  } else if(s[l] > s[r]) {
    if(dp[l][r-1].sum >= k) {
      ans[be] = ans[be+len-1] = s[r];
      //cout << be << " " << len << " " << s[r] << endl;
      dfsn(l, r-1, be+1); return ;
    } else {
      ans[be] = ans[be+len-1] = s[l];
      k -= dp[l][r-1].sum;
      //cout << be << " " << len << " " << s[l] << endl;
      dfsn(l+1, r, be+1); return ;
    }
  }
}

int main() {
  //freopen("out", "w", stdout);
  scanf("%s%lld", s, &k);
  int len = strlen(s);
  for(int i = 0; i < len; ++ i)
    for(int j = 0; j < len; ++ j)
      dp[i][j].l = -1, dp[i][j].sum = 0;

  int m = dfs(0, len-1); cn = 0;
  //cout << dp[1][len-1].sum << endl;
  if(k > dp[0][len-1].sum) {
    puts("NONE"); return 0;
  }
  //cout << m << endl;
  dfsn(0, len-1, 0);
  ans[m] = '\n';
  printf("%s", ans);
  return 0;
}
/*
thdstodxtksrnfacdsohnlfuivqvqsozdstwaszmkboehgcerwxawuojpfuvlxxdfkezprodnettawsyqazekcftgqbrrtkzngaxzlnphynkmsdsdleqaxnhehwzgzwtldwaacfczqkfpvxnalnnhfzbagzhqhstcymdeijlbkbbubdnptolrmemfxlmmzhfpshykxvzbjmcnsusllpyqghzhdvljdxrrebeef
11469362357953500
*/


Measured memory_bytes: 66044
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


/////////////////////////////////////////////////////////////////////////////////////////
int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    int v = 0,e = 0;
    for (int i = 0;i < n;i++){
        cin >> h[i];
        v += h[i];
    }

    for (int i = 0;i < n-1;i++){
        e += min(h[i],h[i+1]);
    }

    cout << v - e << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
 
    if (e-a <= k) {
      cout << "Yay!" << endl;
    } else {
      cout << ":(" << endl;
    }
 
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()

array = [0]
result = 0
if S[0] == '1':
    flag = False

else:
    flag = True
    array.append(0)

flag2 = False

for i in range(N):
    if S[i] == '0':
        if not flag:
            flag = True
            array.append(i)
            if len(array) == K * 2 + 2:
                flag2 = True
                result = max(array[-1] - array[0], result)
                del array[0]
                del array[0]
            

    else:
        if flag:
            flag = False
            array.append(i)

result = max(N - array[0], result)

print(result if flag2 else N)


Measured memory_bytes: 5344
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}
	int size(int a) {
		return par[root(a)];
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};


int main(){
	int n, k;
	cin >> n >> k;
	hei(llint) a(n + 1, 0);
	rep(i, 1, n + 1)a[i] = i + a[i - 1];
	llint ans = 0;
	rep(i, k, n + 2) {
		llint x = a[i - 1];
		llint y = a[n] - a[max(n - i,0)];
		ans += (y - x + 1) % mod;
        ans%=mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4824
#include<stdio.h>
#include<stdlib.h>
int main(void){
 
  int A,B,count=0,solve=0;
 
  scanf("%d %d",&A,&B);
 
  for(count=0;count<=1000000000;count=count+1){
    if(abs(A-count)==abs(B-count)){
      solve=count;
      printf("%d",solve);
    }
  }
 
  if(solve==0){
    printf("IMPOSSIBLE");
      }
  return 0;
 
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
using namespace std;
int main() {
        int n;
        cin >> n;
        vector<int> p(n);
        for (int i = 0; i < n; ++i) {
                cin >> p[i];
        }   
        int c = 0;
        for (int i = 0; i < n-2; ++i) {
                if ((p[i] < p[i+1] && p[i+1] < p[i+2]) or (p[i] > p[i+1] && p[i+1] > p[i+2])) {
                        ++c;
                }   
        }   
        cout << c << endl;
        return 0;
}

Measured memory_bytes: 256
// A - +-x

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

int main(){
	int K, X;
	cin >> K >> X;

	int left = max(-1000000, X-K+1);
	int right = min(1000000, X+K-1);

	for (int i=left; i<=right; i++) {
		cout << i;
		if (i < right) {
			cout << " ";
		}
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>

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

using namespace std;

int main(){
    string s;
    cin >> s;
    string o = "AKIHABARA";
    int i = 0;
    int j = 0;
    while(j < o.size()){
        if(i < s.size() && s[i] == o[j]){
            i ++;
            j ++;
        }else if (o[j] == 'A'){
            j ++;
        }else{
            break;
        }
    }
    if(i == s.size() && j == o.size()){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
var
        a,ans:array[1..100000]of int64;
        i,n:longint;
        o:int64;
begin
        read(n);
        for i:=1 to n do
        begin
                read(a[i]);
                if i mod 2=1 then o:=o+a[i] else o:=o-a[i];
        end;
        ans[1]:=o div 2;
        for i:=2 to n do ans[i]:=a[i-1]-ans[i-1];
        for i:=1 to n-1 do write(2*ans[i],' ');
        writeln(2*ans[n]);
end.

Measured memory_bytes: 2688
/*
  C - 一次元リバーシ / 1D Reversi
  <http://abc047.contest.atcoder.jp/tasks/arc063_a>
  [Tips]
  ・文字列の長さはstrlen。
  ・strcmpは"文字列"同士の比較。そのため、引数はポインタをとる。
  ・単純な"文字"の比較なら、引き算でできる。
*/

#include <stdio.h>
#include <string.h>

int main(int argc, char const *argv[]) {
  char S[100000];
  int i;
  int c = 0;

  scanf("%s", S);
  for( i=0; i<strlen(S)-1; i++ ){
    if( (S[i]-S[i+1]) != 0 ){
      c++;
    }
  }

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

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h> 
 
int main() {
 
  int n,i,a[101],s,k,t,count,b,c,d;
 
  while(1) {
 
  count  = 0;
 
  scanf("%d",&n);
  if(n == 0) break;
 
  for(i=0;i<n;i++) {
 
    scanf("%d",&a[i]);
 
  }
 
  scanf("%d",&s);
 
  c = n-1;
  b = 0;
  k = (b+c) / 2;
  
  while(b <= c) {
    
 
    count++;
    if(a[k] == s || b  == c) break;
     
    if(a[k] < s) {
      b = k+1;
      k = (b+c)/2;
    }
    else {
      c = k-1;
      k = (b+c) /2;
    }
    
  }
 
  printf("%d\n",count);
  }
 
  return 0;
 
}

Measured memory_bytes: 600
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def solve(inp):
    N = int(inp.readline().strip())
    A = list(map(int, inp.readline().strip().split(' ')))
    s = 0
    for a in A:
        s += 1 / a
    return str(1 / s)


def main():
    import sys
    result = solve(sys.stdin)
    if result is not None and result != '':
        print(result)


if __name__ == '__main__':
    main()


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

int main(){
  int H,N;
  cin >> H >>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }

  int sum=0;
  for(int x:A){
    sum += x;
  }
  if(sum >= H){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int main(){
    int64_t n;
    cin>>n;
    vector<int> a(12);
    a[0]=1;
    a[1]=6;a[7]=9;
    rep(i,5){
        a[i+2] = a[i+1]*6; 
    }
    rep(i,4){
        a[8+i] = a[7+i]*9;
    }
    sort(a.begin(),a.end());
    int ans=0;
    vector<int> dp(n+1);
    for(int i=0;i<=5;i++){
        dp[i]= i;
    }
    int m;
    for(int i=6;i<=n;i++){
        m = 1000000;
        for(int j=0;j<12;j++){
            if(i-a[j]>=0){
                m = min(m,dp[i-a[j]]);
            }
            else{
                break;
            }
        }
        dp[i]=m+1;
    }
    cout<<dp[n]<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
    
int main(){
    int n=0, even=0, odd=0;
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        int x;
        scanf("%d", &x);
        if(x%2==0)
        {
            even++;
        }
        else
        {
            odd++;
        }
    }
    if(odd%2==0)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    

    return 0;
}

Measured memory_bytes: 256