akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <bitset>
#include <tuple>
#include <stack>

using namespace std;
int main(){
    int A, B, C;
    cin >> A >> B >> C;
    int ans = 0;
    ans = max(10*A+B+C, ans);
    ans = max(A+10*B+C, ans);
    ans = max(A+B+10*C, ans);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
require 'complex'
include Math

current = 0
direction = PI / 2

while line = gets
  arr = line.split(",")
  r = arr[0].to_i
  theta = arr[1].to_i * PI / 180

  break if r == 0 and theta == 0
  
  current += Complex.polar(r, direction)

  direction -= theta
end

puts current.real.to_i
puts current.imag.to_i

Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

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

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N,A,B;
    cin >> N >> A >> B;
    string S;
    cin >> S;
    REP(i,N){
        if(S[i] == 'c'){
            cout << "No" << "\n";
        }else if(S[i] == 'a'){
            if(A+B>0){
                cout << "Yes" << "\n";
                A--;
            }else{
                cout << "No" << "\n";
            }
        }else{
            if(A+B>0&&B>0){
                cout << "Yes" << "\n";
                B--;
            }else{
                cout << "No" << "\n";
            }
        }
    }
}

Measured memory_bytes: 848
import bisect
import itertools
import sys

def main(args):
    
    A, B, Q = map(int,input().split())
    S = [0]*A
    T = [0]*B
    for i in range(A):
        S[i] = int(input())
    for i in range(B):
        T[i] = int(input())
    
    S = [-10**18] + S + [10**18]
    T = [-10**18] + T +[10**18]
    
    def solve(j, t, start):
        jinja_l = S[j-1]
        jinja_r = S[j]
        tera_l = T[t-1]
        tera_r = T[t]
        jinja = [jinja_l, jinja_r]
        tera = [tera_l ,tera_r]
        
        ans = float('inf')
        for u,v in list(itertools.product(jinja, tera)):
            ans = min(ans, abs(start-u)+abs(v-u))
            ans = min(ans, abs(v-start)+abs(v-u))
        
        return ans
    
    for i in range(Q):
        x = int(input())
        ans = solve(bisect.bisect_left(S, x), bisect.bisect_left(T ,x), x)
        print(ans)
        
if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 84124
#include "bits/stdc++.h"
#define ll long long
#define mk make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
using namespace std;
const int MAXN=1e5+9;
vector<int> g[MAXN];
bool reached[MAXN];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int x,y;
		cin>>x>>y;
		g[x].pb(y);
		g[y].pb(x);
	}
	queue<int> q;
	q.push(1);
	reached[1]=true;
	int ans[n+1];
	memset(ans,0,sizeof(ans));
	int cnt=0;
	while(!q.empty())
	{
		int pos=q.front();
		q.pop();
		for(int i=0;i<g[pos].size();i++)
		{
			if(!reached[g[pos][i]])
			{
				q.push(g[pos][i]);
				reached[g[pos][i]]=true;
				ans[g[pos][i]]=pos;
				cnt++;
			}
		}
	}
	if(cnt!=n-1)
	{
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	for(int i=2;i<=n;i++)
	{
		cout<<ans[i]<<endl;
	}
	return 0;
}

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

int main(){
  int n,k;
  cin>>n>>k;
  deque<int> dq;
  for(int i=0; i<n; i++){
    int v; cin>>v;
    dq.push_back(v);
  }
  int op=min(n,k);
  ll ans=0;
  for(int l=0; l<=op; l++){
    for(int r=0; r<=op-l; r++){
      vector<int> v;
      deque<int> dq2=dq;
      for(int i=0; i<l; i++){
        int tmp=dq2.front();
        dq2.pop_front();
        v.push_back(tmp);
      }
      for(int i=0; i<r; i++){
        int tmp=dq2.back();
        dq2.pop_back();
        v.push_back(tmp);
      }
      int rv=k-r-l;
      int s=v.size();
      rv=min(rv,s);
      sort(v.begin(), v.end());
      for(int i=0; i<rv;i++){
        if(v[i]>=0) continue;
        v[i]=0;
      }
      ll total=accumulate(v.begin(),v.end(),0LL);
      ans=max(ans,total);
    }
  }
  cout<<ans<<endl;
}


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

int main(){
	int A, B, K;
	cin >> A >> B >> K;
	int count = 0;
	for (int i = B;i >= 1;--i) {
		if (A % i == 0 && B % i == 0) {
			count++;
		}
		if (count == K) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=100010;
int fi[N*2],ne[N*2],la[N*2],a[N*2];
int i,j,k,n,m,x,y,t,f[N],ans,cnt[N],K;
int read(){
	int x=0,f=1;
	char ch=getchar();
	while (ch<'0'||ch>'9'){f=ch=='-'?-f:f;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
void add(int x,int y){
	k++;a[k]=y;
	if (fi[x]==0)fi[x]=k;else ne[la[x]]=k;
	la[x]=k;
}
int dfs(int x){
	int la=0,ch=0;
	for (int i=fi[x];i;i=ne[i])la=max(la,dfs(a[i])),ch++;
	la++;
	if (x==1)return 0;
	if (la>=K&&f[x]!=1)ans+=1,la=-1;
	return la;
}
int main(){
	n=read();K=read();
	for (i=1;i<=n;i++)f[i]=read();
	if (f[1]!=1)ans++,f[1]=1;
	for (i=2;i<=n;i++)add(f[i],i);
	dfs(1);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
const int N=200010;
int n,a[N],m,b[N],ty,bucket[10],t[N],d[N];
bool cmp(int x,int y){
	return (x&ty)<(y&ty);
}
void hsort(int gg,int *r){
	for (int i=1; i<=n; ++i) t[i]=r[i];
	bucket[0]=bucket[1]=0;
	for (int i=1; i<=n; ++i) ++bucket[(r[i]>>gg)&1];
	bucket[1]+=bucket[0];
	for (int i=n; i>=1; --i) d[bucket[(r[i]>>gg)&1]--]=i;
	for (int i=1; i<=n; ++i) r[i]=t[d[i]];
}
int jw(int gg){
	//sort(a+1,a+n+1,cmp);
	//sort(b+1,b+m+1,cmp);
	hsort(gg,a); hsort(gg,b);
	int dpos=m+1,res(0);
	for (int i=1; i<=n; ++i){
		while (dpos>1&&(b[dpos-1]&ty)+(a[i]&ty)>ty) --dpos;
		//cerr<<dpos<<" "<<ty<<endl; 
		if ((m+1-dpos)&1) res^=1;
	}
	return res;
}
void test(){
	for (int i=1; i<=n; ++i) a[i]=rand()%8;
	hsort(0,a);
	for (int i=1; i<=n; ++i) printf("%d ",a[i]); puts("");
	hsort(1,a);
	for (int i=1; i<=n; ++i) printf("%d ",a[i]); puts("");
	hsort(2,a);
	for (int i=1; i<=n; ++i) printf("%d ",a[i]); puts("");
}
int main(){
	scanf("%d",&n); m=n;	
	//test();
	for (int i=1; i<=n; ++i) scanf("%d",&a[i]);
	for (int i=1; i<=m; ++i) scanf("%d",&b[i]);
	int ans=0;
	for (int i=0; i<29; ++i){
		if (i) ans^=jw(i-1)<<i;
		//cerr<<"ans"<<ans;
		ty|=1<<i;
		if (m&1)
		for (int j=1; j<=n; ++j) ans^=a[j]&(1<<i);
		//cerr<<"i"<<i<<" "<<ans<<" "<<ty<<endl;
		if (n&1)
		for (int j=1; j<=m; ++j) ans^=b[j]&(1<<i);
		//cerr<<"i"<<i<<" "<<ans<<" "<<ty<<endl;
	}
	cout<<ans<<endl;
} 

Measured memory_bytes: 3328
#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 sax(x) cout << "!!!!!!!!!!! " << #x << " = " << x << '\n'
#define inf (sizeof(int) == 4 ? (int)1E9 : (int)1E18)
#define one(x) x.insert(x.begin(), 0);
#define TCT template <class T>
#define TCT12 template <class T1, class T2>
#define IS istream
#define OS ostream
#define OP operator

//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//tree_order_statistics_node_update> imsi;

TCT IS& OP>>(IS &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
TCT OS& OP<<(OS &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; /*O << '\n';*/ return O;}
TCT OS& OP<<(OS &O, const unordered_set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const unordered_multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT IS& OP>>(IS &I, deque<T>& v) {for (T &e: v) I >> e; return I;}
TCT OS& OP<<(OS &O, const deque<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, priority_queue<T> v) {while (!v.empty()) {O << v.top() << ' '; v.pop();} return O;}
TCT OS& OP<<(OS &O, stack<T> v) {while (!v.empty()) {O << v.top() << '\n'; v.pop();} return O;}
TCT OS& OP<<(OS &O, queue<T> v) {while (!v.empty()) {O << v.front() << ' '; v.pop();} return O;}
TCT12 IS& OP>>(IS &I, pair<T1,T2>& p) {return I >> p.first >> p.second;}
TCT12 OS& OP<<(OS &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
TCT12 OS& OP<<(OS &O, const unordered_map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
TCT12 OS& OP<<(OS &O, const map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
typedef pair<int,int> pii;
typedef vector<int> vi;


//RRRRRRRRL
//

void _main() {
        int a; cin >> a;
        string b; cin >> b;
        b.erase(b.begin() + 1);
        cout << (a * stoll(b)) / 100;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 3656
import math
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N = I()

ans = 1
for i in range(N):
    ans *= (i+1)
    ans %= MOD

print(ans)

Measured memory_bytes: 27124
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import numpy as np


read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *B = map(int, read().split())
A = [B[0]]

for i, j in zip(B, B[1:]):
    if i <= j:
        A.append(i)
    else:
        A.append(j)
print(sum(A) + B[-1])


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() 
{
    int x,y;
    cin>>x>>y;
    if(y%2==1)
        cout<<"No\n";
    else
    {
        if(y<=4*x && y>=2*x)
            cout<<"Yes\n";
        else    cout<<"No\n";
    }
}

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

int main( int argc, char *argv[] )
{
int a;
int b;
int c;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> a;
	cin >> b;
	cin >> c;
	if( a == b && b == c )
		cout << 1 << endl;
	else if( a == b || b == c || a == c )
		cout << 2 << endl;
	else
		cout << 3 << endl;

	return 0;
}


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


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N, M; cin >> N >> M;
  vector<vector<bool>> fav(N, vector<bool>(M));
  for (int i = 0; i < N; i++) {
    int k; cin >> k;
    for (int j = 0; j < k; j++) {
      int a;
      cin >> a; a--;
      fav.at(i).at(a) = true;
    }
  }
  int cnt = 0;
  for (int j = 0; j < M; j++) {
    bool all = true;
    for (int i = 0; i < N; i++) {
      if (!fav.at(i).at(j)) {
	all = false;
	break;
      }
    }
    if (all) cnt++;
  }
  cout << cnt << endl;
  return 0;
}



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

#define mp make_pair
#define pb push_back
#define fst first
#define snd second
#define int long long
#define MMAX 16384
#define fast_io() ios::sync_with_stdio(false)
#define FOR(i, l, r) for(int i = (l); i < (r); i++)

typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef set<int> si;
typedef double ld;
typedef pair<ld, ld> dd;

const ll INF = 1000000000000000000LL;
const int NMAX = 710;
const int mod = 1e9+7;
const ld eps = 1e-10;
const ld PI = acos(-1);

int N, M;

vvi matrix;
vvi adj;
vi vis;
vi vals;
bool bipartite = true;

int dfs(int v, int n){
    //cout << "dfs " <<  v << " " << n << endl;
    int s = v;
    vis[n] = v;
    for(int k : adj[n]){
        //cout<<k<<endl;
        if(!vis[k]) s += dfs(-v, k);
        else if(vis[k] != -v and n != k) bipartite = false;
    }
    return s;
}

int dp[2*NMAX+10][NMAX];

int f(int diff, int i){
    //cout << "f " << diff << " " << i << endl;
    int &res = dp[diff+NMAX][i];
    if(res != INF) return res;
    if(i == vals.size()) return res = diff;
    int a = f(diff+vals[i], i+1);
    int b = f(diff-vals[i], i+1);
    if(abs(a) < abs(b)) return res = a;
    return res = b;
}

signed main(){
    fast_io();
    FOR(i, 0, 2*NMAX+10) FOR(j, 0, NMAX) dp[i][j] = INF;
    cin >> N >> M;
    adj.resize(N);
    matrix.assign(N, vi(N, 1));
    vis.assign(N, 0);
    FOR(i, 0, M){
        int a, b;
        cin >> a >> b;
        a--; b--;
        matrix[a][b] = 0;
        matrix[b][a] = 0;
    }
    
    FOR(i, 0, N) FOR(j, 0, N)  if(matrix[i][j]) adj[i].pb(j);
    FOR(i, 0, N) if(!vis[i]) vals.pb(dfs(1, i));

    if(!bipartite){
        cout << -1 << endl;
        return 0;
    }

    //for(int v : vals) cout << v << " ";
    //cout<<endl;
    int k = f(0, 0);
    int a = (N+k)/2, b = (N-k)/2;
    cout << a*(a-1)/2 + b*(b-1)/2 << endl;
}

Measured memory_bytes: 17664
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
 
//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//infinity
#define INTINF 2000000000
#define LONGINF 20000000000
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
int main(){
	int n, k;
	cin >> n >> k;
	int a[n+1];
	REP(i, n+1){
		a[i] = 0;
	}

	REP(i, n){
		int t;
		cin >> t;
		a[t]++;
	}
	sort(a, a + n + 1, greater<int>() );

	int count = 0;
	FOR(i, k, n+1){
		count += a[i];
	}
	cout << count << endl;
	return 0;
}


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

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> sum(N + 1);
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		sum[i + 1] = (sum[i] + A) % M;
	}
	unordered_map<int, int> cnt;
	ll res = 0;
	for (int i = 0; i <= N; i++) {
		res += cnt[sum[i]]++;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 4108
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N, r;
	scanf("%d", &N);
	
	int A[N];
	int B[N];
	for(r=0; r<N; r++){
		scanf("%d", &B[r]);
		A[r] = B[r];
	}
	
	sort( A, A+N );
	
	for(r=0; r<N; r++){
		if(B[r] == A[N-1]) printf("%d\n", A[N-2]);
		else printf("%d\n", A[N-1]);
	}
	
	
	return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    string S;
    cin >> S;
    if (S == "AAA" || S == "BBB") {
        cout << "No" << '\n';
    }else {
        cout << "Yes" << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int main() {
    int N, M, match[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    cin >> N >> M;
    vector<int> A(M);
    for(int i = 0; i < M; ++i)
        cin >> A[i];
    sort(A.begin(), A.end(), greater<int>());
    vector<int> dp(N + 5, -1);
    dp[0] = 0;
    for(int i = 2; i <= N; ++i) {
        for(int j = 0; j < M; ++j) {
            if(i - match[A[j]] >= 0)
                dp[i] = max(dp[i - match[A[j]]] + 1, dp[i]);
        }
    }
    int res = N;
    while(res > 0) {
        for(int i = 0; i < M; ++i) {
            if(res >= match[A[i]] && dp[res - match[A[i]]] == dp[res] - 1) {
                cout << A[i];
                res -= match[A[i]];
                break;
            }
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)




function count_change(S, T)
    count = 0
    #@show S
    #@show T
    for (s, t) in zip(S, T)
        if s != t
            count += 1
        end
    end
    return count
end

function main()
    S = collect(chomp(readline()))
    T = collect(chomp(readline()))
    min_count = 100000
    for i in 1:length(S) - length(T) + 1
        now_count = count_change(S[i:i + length(T)-1], T)
        if min_count > now_count
            min_count = now_count
        end
    end
    println(min_count)
end

main()

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

int main() {
    int x,y;
    cin>>x>>y;
    if(x == 1 && y == 1){
        cout<<"1000000\n";
    }else{
        int ans = 0;
        map<int,int> mp;
        mp[3] = 100000;
        mp[2] = 200000;
        mp[1] = 300000;
        if(mp.find(x) != mp.end()){
            ans += mp[x];
        }
        if(mp.find(y) != mp.end()){
            ans += mp[y];
        }
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
sc = []
for _ in range(m):
    sc.append(list(map(int,input().split())))
tmp = [-1,-1,-1]
flag = False
for b in sc:
    s = b[0]
    c = b[1]
    if n >1 and s == 1 and c == 0:
        flag = True
        break
    if tmp[s-1] != -1 and tmp[s-1] != c:
        flag = True
        break
    tmp[s-1] = c
ans = 0

if not flag:
    for i in range(n):
        if tmp[i] == -1:
            if n == 1:
                tmp[i] = 0
            elif i == 0:
                tmp[i]=1
            else:
                tmp[i]=0
    for i in range(n):
        m = 10**(n-1-i)
        ans = ans + tmp[i]*m
else:
    ans = -1
print(ans)

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

int main()
{
    int N;
    cin >> N;
    
    float count = 0;
    for (int i=1; i<=N; i++){
        if(i % 2 == 1) count++;
    }
    cout << count/N << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    string str;
    getline(cin, str);
    const int N = str.size();
    int t = 1;
    while (true){
        unordered_map<char, int> count;
        loop(i, N - t + 1){
            unordered_set<char> a;
            loop(j, t){
                a.emplace(str[i + j]);
            }
            for (auto& ai : a){
                ++count[ai];
            }
        }
        // for (auto& elem : count){
        //     printf("%c : %d\n", elem.first, elem.second);
        // } puts("");
        bool break_flag = false;
        for (auto& elem : count){
            if (N - t + 1 <= elem.second){
                break_flag = true;
                break;
            }
        }
        if (break_flag) break;
        ++t;
    }
    printf("%d\n", t - 1);
}


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

int main() {
  int A, B, count = 0;
  int x1, x2, x4, x5;
  cin >> A >> B;
  
  for(int i = A; i <= B; i++){
    x1 = i % 10;
    x2 = (i / 10) % 10;
    x4 = (i / 1000) % 10;
    x5 = i / 10000;
    
    if(x1 == x5 && x2 == x4){
      count++;
    }
    
  }
  cout << count << endl;
}


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

using namespace std;

const int N = 2005;
const int K = 10005;

int n, k;
char s[N][K];
int len[N];
bitset<K> dp[N];
pair<int, int> v[2][K];
int nv, tnv;

int main() {
  scanf("%d %d",&n,&k);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s[i]);
    len[i] = strlen(s[i]);
  }
  dp[n + 1][0] = 1;
  for (int i = n; i > 0; i--) {
    dp[i] = dp[i + 1] | (dp[i + 1] << len[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (dp[i + 1][k - len[i]]) {
      v[0][nv++]= make_pair(i, 0);
    }
  }
  for (int iter = 1,i = 1; iter <= k; iter++, i ^= 1) {
    tnv = 0;
    char c = 'z';
    for (int j = 0; j < nv; j++) {
      c = min(c, s[v[i ^ 1][j].first][v[i ^ 1][j].second]);
    }
    putchar(c);
    int bid = n + 1;
    for (int j = 0; j < nv; j++) {
      int id = v[i ^ 1][j].first;
      int pos = v[i ^ 1][j].second;
      if (s[id][pos] != c) {
        continue;
      }
      if (pos < len[id] - 1)
        v[i][tnv++] = make_pair(id, pos+1);
      else {
        bid = min(bid, id);
      }
    }
    for (int j = bid + 1; j <= n; j++) {
      if (k - iter - len[j] >= 0 && dp[j + 1][k - iter - len[j]]) {
        v[i][tnv++] = make_pair(j, 0);
      }
    }
    nv = tnv;
  }
  putchar('\n');
  return 0;
}

Measured memory_bytes: 21504
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  map<int, int> mp;
  mp[a]++;
  mp[b]++;
  mp[c]++;
  if (mp[5] == 2 && mp[7] == 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <thread>
#include <chrono>
#include <random>
#include <fstream>
#include <time.h>


int main()
{
    int D,N;
    int ans;

    std::cin >> D >> N;

    if(D == 0){ 
        if(N == 100) ans = N+1;
        else ans = N;
    }
    else{
        if(N == 100){
            ans = (N+1)*pow(100, D);
        }
        else ans = N*pow(100, D);
    }




    std::cout << ans;


    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		double ans = 0;
		for (int i = 0; i < n; i++) {
			double x = sc.nextDouble();
			String u = sc.next();
			
			if (u.equals("BTC")) {
				ans += x * 380_000L;
			} else {
				ans += x;
			}
		}

		pr.printf("%.6f%n", ans);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 23252
n,m,k = list(map(int,input().split()))
aarr = list(map(int,input().split()))
barr = list(map(int,input().split()))
a = 0
ans = n

for i in range(n):
    if a+aarr[i] > k:
        ans = i
        break
    a += aarr[i]

res = ans
num = 0
idx = 0
while res >= 0 and idx < m:
    if a+barr[idx] <= k:
        a += barr[idx]
        idx += 1
        num += 1
        ans = max(ans,res+num)
    elif res == 0:
        break
    else:
        a -= aarr[res-1]
        res -= 1

print(ans)

Measured memory_bytes: 40612
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define fi first
#define se second
#define endl '\n'
#define int int64_t
#define double long double
template<int D, typename T>struct dense:public vector<dense<D-1,T>>{static_assert(D>=1,"dim err");template<typename... Args>dense(int n=0,Args... args):vector<dense<D-1,T>>(n,dense<D-1,T>(args...)){}};
template<typename T>struct dense<1,T>:public vector<T>{dense(int n=0,const T& val=T()):vector<T>(n,val){}};
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using reverse_queue = priority_queue<T, vector<T>, greater<T>>;
mt19937_64 rnd(time(0));
const int64_t FIXED_RANDOM = rnd();
template<typename T> struct custom_hash{T operator()(T x)const{return (T) x^FIXED_RANDOM;}}; // check hash in whether int64 or int32
template<typename T1, typename T2> using hash_map = gp_hash_table<T1, T2, custom_hash<T1>>;
const int MAXN = (int) 3e5 + 2;
const int INF = numeric_limits<int>::max() >> 1;
const int MOD = (int) 1000000007;
// Tao luyện kỹ thuật trong 8 năm mày luyện kỹ thuật trong buồng tắm nam
signed main(){
  ios_base::sync_with_stdio(0); 
  cin.tie(0);
  // freopen("FDT.txt", "r", stdin);
  int k;
  cin >> k;
  while(k --) cout << "ACL";
}

Measured memory_bytes: 3656
import math

def main():
    X = int(input())
    kazu = int(math.sqrt(X)) + 1

    for index in range(-kazu-1,kazu+1):
        B = index
        A5 = B**5 + X
        if(A5 < 0):
            continue
        A = math.pow(A5, (1.0/5.0))
        if int(A)**5 - B**5 == X :
            print (str(int(A)) +" "+  str(B))
            break



if __name__ == '__main__':
    main()


Measured memory_bytes: 9384
while True:
    s=input()
    if s=='-':
        break
    m=int(input())
    s=list(s)
    for i in range(m):
        h=int(input())
        for j in range(h):
            pop=s.pop(0)
            s.append(pop)
    a=''.join(s)
    print(a)


Measured memory_bytes: 5592
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
#define ll long long

#define sondos ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;

   int x, y, c = 0;

   int main() {

       sondos

           int a, b, c; cin >> a >> b >> c;
       cout << (((c / max(a, b))* max(a, b)  )>= c ? (c / max (a, b)) : ((c / max(a, b)) + 1));

            
           return 0;
   }

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

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

const int INF=1e9;
const int MOD=1e9+7;

int main(){
    ll N; cin >> N;
    for(ll i=1;i<=3500;i++){
        for(ll j=1;j<=50000;j++){
            ll x=N*i*j;
            ll y=(4*i*j-(i+j)*N);
            if(y<=0) continue;
            if(x%y==0){
                cout << i << " " << j << " " << x/y << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <queue>
#include <functional>

using ll = long long int;

constexpr int MAX_N = 100000, INF = (int)1e8;

using P = std::pair<ll, int>;

int n, m, k, s;
int p, q;
bool can[MAX_N];
int cost[MAX_N];
std::vector<int> G[MAX_N], edges[MAX_N];

int d[MAX_N];

void init() {
	std::fill(d, d + n, INF);
	std::queue<int> que;
	for (int i = 0; i < n; ++i) {
		if (can[i]) {
			d[i] = 0;
			que.emplace(i);
		}
	}

	while (!que.empty()) {
		int v = que.front(); que.pop();
		if (d[v] > s)
			continue;
		cost[v] = q;
		for (int i = 0; i < G[v].size(); ++i) {
			if (d[G[v][i]] == INF) {
				d[G[v][i]] = d[v] + 1;
				que.emplace(G[v][i]);
			}
		}
	}
}

constexpr ll INF_L = (ll)1e15;

ll dis[MAX_N];

ll dijkstra(int s, int g) {
	std::fill(dis, dis + n, INF_L);
	std::priority_queue<P, std::vector<P>, std::greater<P>> que;
	dis[s] = 0;
	que.emplace(dis[s], s);
	while (!que.empty()) {
		P p = que.top(); que.pop();
		int v = p.second;
		if (v == g)
			return dis[v];
		if (dis[v] < p.first)
			continue;
		for (int i = 0; i < edges[v].size(); ++i) {
			if (dis[edges[v][i]] > dis[v] + cost[edges[v][i]]) {
				dis[edges[v][i]] = dis[v] + cost[edges[v][i]];
				que.emplace(dis[edges[v][i]], edges[v][i]);
			}
		}
	}
	return -1;
}

int main() {
	std::cin >> n >> m >> k >> s
		>> p >> q;
	int a;
	for (int i = 0; i < k; ++i) {
		std::cin >> a;
		can[a - 1] = true;
	}
	int x, y;
	for (int i = 0; i < m; ++i) {
		std::cin >> x >> y;
		--x;
		--y;
		G[x].emplace_back(y);
		G[y].emplace_back(x);
		if (!can[x] && !can[y]) {
			edges[x].emplace_back(y);
			edges[y].emplace_back(x);
		}
	}
	for (int i = 0; i < n; ++i)
		cost[i] = p;
	init();
	ll ans = dijkstra(0, n - 1);
	ans -= cost[n - 1];
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 17768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int64_t,int64_t> pll;
typedef vector<int64_t> vl;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
const long double PI = acos(-1);
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define ALL(a) begin(a),end(a)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

void solve() 
{
    int a,b,c;cin>>a>>b>>c;
    if(a+b+c>=22)cout<<"bust"<<endl;
    else cout<<"win"<<endl;

}

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


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

# 全ての値の合計を求め、負の値が偶数個であれば全ての値は非負の値にできる為、合計値を出力
# 負の値の数が奇数個の場合は1つだけが負の値になる為、この場合は最小値を負の値にして合計を出力
ans = 0
count = 0
for i in range(n):
  if a[i] < 0: count += 1 # 負の値をカウント
  a[i] = abs(a[i])
  ans += a[i] # 全ての値を足していく
if count%2 == 0: print(ans) # 負の値が偶数個であればそのまま出力
else:
  ans -= 2*min(a) # 負の値が奇数個であれば最小値の値分減らして出力
  print(ans)

Measured memory_bytes: 20100
#include <iostream>
#include<string>
#define FOR(x, u) for (int x = 0; x < u; x++)
typedef long long ll;
using namespace std;
void solve()
{     
    int n,j;
    ll count=0,r=0,g=0,b=0;
    string s;
    cin>>n>>s;
    FOR(j,n)
    {
        if(s[j]=='R')   r++;
        if(s[j]=='G')   g++;
        if(s[j]=='B')   b++;
    }
    count=r*g*b;
    for(int i=0;i<n-2;i++)
    {
        for(int k=i+2;k<n;k++)
        {
            if((k+i)%2==0)
            {   
                j=(k+i)/2;
                if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k])
                    count--;
            }
        }
    }
    cout<<count;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    //cin>>t;
    while (t--)
    {
        solve();
        cout << "\n";
    }
    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
    return 0;
}

Measured memory_bytes: 3836
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <climits>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

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

int N;

set<string> se;
vector<pair<string, int>> vp;
int main() {
    //cout << fixed << setprecision(15);

    cin >> N;

    for(int i=0; i<N; ++i){
        string s; cin >> s;
        int p; cin >> p;
        se.insert(s);
        vp.push_back({s, p});
    }

    for(auto e: se){
        vector<int> v;
        for(int i=0; i<N; ++i){
            if(e == vp[i].first){
                v.push_back(vp[i].second);
            }
        }
        sort(all(v));
        reverse(all(v));

        for(int i=0; i<v.size(); ++i){bool f = false;
            for(int j=0; j<N; ++j){
                if(vp[j].first == e && vp[j].second == v[i]){
                    cout << j+1 << endl;
                    f = true;
                }
                if(f) break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <unordered_map>
// #include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
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;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
void pvarr_int(int *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%d%c", arr[i], i == n ? '\n' : ' ');}}
void pvarr_LL(ll *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%lld%c", arr[i], i == n ? '\n' : ' ');}}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","r",stdin);
    int a;
    cin >> a;
    cout << a + a*a + a*a*a << endl;
    return 0;
}




Measured memory_bytes: 3196
# -*- coding: utf-8 -*-
"""
Created on Wed May  6 16:43:04 2020

@author: shinba
"""
from sys import exit

def kaibun(s):
    l = s[::-1]
    if s == l:
        return True
    else:
        return False

S = input()
N = len(S)
if not kaibun(S):
    print("No")
    exit()
if not kaibun(S[:(N-1)//2]):
    print("No")
    exit()
if not kaibun(S[(N+1)//2:]):
    print("No")
    exit()
    
print("Yes")
        


Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_LEN = 300;

const int dxs[] = {0, -1, -1,  0};
const int dys[] = {0, -1,  0, -1};

/* typedef */

/* global variables */

int dp[MAX_LEN + 1][MAX_LEN + 1], prvs[MAX_LEN + 1][MAX_LEN + 1];

/* subroutines */

string max_substr(string str, int i0) {
  int len = str.length();

  memset(dp, 0, sizeof(dp));
  memset(prvs, 0, sizeof(prvs));

  for (int i = 0; i < i0; i++)
    for (int j = 0; j < len - i0; j++) {
      if (str[i] == str[i0 + j]) {
	dp[i + 1][j + 1] = dp[i][j] + 1;
	prvs[i + 1][j + 1] = 1;
      }
      else if (dp[i][j + 1] >= dp[i + 1][j]) {
	dp[i + 1][j + 1] = dp[i][j + 1];
	prvs[i + 1][j + 1] = 2;
      }
      else {
	dp[i + 1][j + 1] = dp[i + 1][j];
	prvs[i + 1][j + 1] = 3;
      }
    }

  int si = i0, sj = len - i0;
  stringstream ss;
  
  for (;;) {
    int di = prvs[si][sj];
    if (di == 0) break;
    si += dxs[di];
    sj += dys[di];
    if (di == 1) ss << str[si];
  }

  string res = ss.str();
  reverse(res.begin(), res.end());
  return res;
}

/* main */

int main() {
  for (;;) {
    string str;
    cin >> str;
    if (str == "#END") break;

    int len = str.length();
    string maxstr;

    for (int k = 1; k < len; k++) {
      string s = max_substr(str, k);
      if (maxstr.length() < s.length()) maxstr = s;
    }

    cout << maxstr << endl;
  }

  return 0;
}

Measured memory_bytes: 1924
N = int(input())

def calc(x):
    if x % 3 == 0:
        return True
    for i in str(x):
        if i == '3':
            return True
    return False

ret = []
for i in range(1, N+ 1):
    if calc(i):
        ret.append(i)

ret2 = ''
for r in ret:
    ret2 = ret2 + ' ' + str(r)
print(ret2)


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }

int gcd(int a, int b){
  if(a == 0) return b;
  else return gcd(b%a, a);
}

int32_t main(){
  DESYNC;
  int a,b;
  cin >> a >> b;
  cout << max(0LL, a - 2*b) << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, n;
int main() {

    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    scanf("%lld", &n);

    n = 4 * n;

    b = min(b, 2 * a);

    c = min(c, 2 * b);

    d = min(d, 2 * c);

    long long ans = (n / 8) * d;

    n = n % 8;

    ans += (n / 4) * c;

    n = n % 4;

    ans += (n / 2) * b;

    n = n % 2;

    ans += n * a;

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

    return 0;
}

Measured memory_bytes: 256
A,B,C,X,Y=map(int,input().split())
ans=0
if X>Y:
    r=Y
else:
    r=X
if A+B>2*C:
    ans+=2*C*r
else:
    ans+=(A+B)*r
X-=r
Y-=r

if X!=0:
    if A>2*C:
        ans+=2*C*X
    else:
        ans+=A*X
else:
    if B>2*C:
        ans+=2*C*Y
    else:
        ans+=B*Y

print(ans)

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

#define MAX_V 5000
#define ll long long
using namespace std;

ll par[MAX_V],ran[MAX_V];
void init(int n){
	for(int i=0;i<n;i++){
		par[i] = i;
		ran[i] = i;
	}
}

ll find(ll x){
	if(par[x]==x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y){
	x = find(x);
	y = find(y);
	if(x==y) return;
	if(ran[x]<ran[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if(ran[x]==ran[y]) ran[x]++;
	}
}

bool same(ll x, ll y){
	return find(x)==find(y);
}

struct edge{ll u,v,cost;};
ll n,m;
vector<edge> E;
vector<edge> G[MAX_V];

bool comp(const edge& e1, const edge& e2){
	return e1.cost<e2.cost;
}

ll kruscal(){
	sort(E.begin(),E.end(),comp);
	init(n);
	long long res = 0;
	for(int i=0;i<E.size();i++){
		edge e = E[i];
		if(!same(e.u,e.v)){
			unite(e.u,e.v);
			res += e.cost;
			G[e.u].push_back({e.u,e.v,e.cost});
			G[e.v].push_back({e.v,e.u,e.cost});
		}
	}
	return res;
}

bool used[MAX_V];
ll d[MAX_V];
ll x[MAX_V][MAX_V];
void dfs(int s){
	used[s] = true;
	for(int i=0;i<G[s].size();i++){
		edge e = G[s][i];
		if(!used[e.v]){
			d[e.v] = max(d[s],e.cost);
			dfs(e.v);
		}
	}
}

int main(){
	int i,j;
	cin >> n >> m;
	for(i=0;i<m;i++){
		ll a,b,c;
		cin >> a >> b >> c;
		a--; b--;
		edge e;
		e.u = a; e.v = b; e.cost = c;
		E.push_back(e);
	}
	
	ll res = kruscal();
	
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			used[j] = false;
			d[j] = 0;
		}
		dfs(i);
		for(j=0;j<n;j++){
			x[i][j] = d[j];
		}
	}
	int q;
	cin >> q;
	for(i=0;i<q;i++){
		int s,t;
		cin >> s >> t;
		s--; t--;
		cout << res - x[s][t] << endl;
	}
}


Measured memory_bytes: 170472
#include<stdio.h>
#include<string.h>
#include<math.h>

int main(){
	char moji[100];
	scanf("%s",moji);
	
	for(int i=0; i<strlen(moji); i++){
		if ( moji[i] != moji [ strlen(moji)-1-i ] ) {
			printf("No");
			return 0;
		}
	}
	
	for(int i=( strlen( moji ) + 3 ) / 2 - 1 ; i<strlen(moji); i++ ){
		if ( moji[i] != moji [ strlen(moji)-1-i + ( strlen( moji ) + 3 ) / 2 - 1 ] ) {
			printf("No");
			return 0;
		}
	}	
	
	printf("Yes");
	
	return 0;
	


}

Measured memory_bytes: 128
N, M = map(int, input().split())
ab = [sorted(list(map(int, input().split()))) for _ in range(M)]

fst = []
scnd = {}

for i in ab:
  if i[0]==1:
    fst.append(i[1])
  if N in i:
    idx = i.index(N)
    scnd[i[1-idx]] = 0

#print(scnd,fst)
    
for j in fst:
  if j in scnd:
    print("POSSIBLE")
    exit()
print("IMPOSSIBLE")
  

Measured memory_bytes: 91736
using System;

class aoj1041{
	public static void Main(){
		while(true){
			string str = Console.ReadLine();
			if(string.Compare(str, "END OF INPUT") == 0) return;
			char[] line = str.ToCharArray();
			int count = 0;
			for(int i = 0; i < line.Length; i++){
				if(line[i] == ' '){
					Console.Write(count);
					count = 0;
				}else{
					count++;
				}
			}
			Console.WriteLine(count);
		}
	}
}

Measured memory_bytes: 6288
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;

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

int main() {
	ll n;
	cin >> n;
	vector<ll> A(n);
	vector<ll> D(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	D[0] = 0;
	for (int i = 1; i < n; i++) {
		if (A[i] < A[i - 1] + D[i - 1]) D[i] = A[i - 1] + D[i - 1] - A[i];
		else D[i] = 0;
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) ans += D[i];
	cout << ans;
	return 0;

}

Measured memory_bytes: 6436
#include <iostream>
using namespace std;
int main(void){
    int n,ans=100000;
    cin>>n;
    for(int i=0;i<n;i++){
        ans+=ans*0.05;
        if(ans%1000==0){
            ans/=1000;
            ans*=1000;
        }
        else{
            ans/=1000;
            ans+=1;
            ans*=1000;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

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

void solve(void){
  ll n; cin >> n;
  vector<ll> v(n, 0);
  rep(n, i) cin >> v[i];

  sort(v.begin(), v.end(), greater<ll>());

  ll alice = 0;
  ll bob = 0;

  rep(n, i) {
    if (i % 2 == 0) alice += v[i];
    else bob += v[i];
  }

  cout << alice - bob << endl;
}

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

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


int main() {
  int a1, a2, a3;
  string ans = "win";
  cin >> a1 >> a2 >> a3;
  if((a1+a2+a3) > 21){
    ans = "bust";
  }

  cout << ans <<  endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

#define N 101

int top,S[N];

int pop(){
  if(top==0){
    fprintf(stderr,"stack is empty\n");
    exit(2);
  }
  return S[top--];
}

void push(int a){
  if(top==100){
    fprintf(stderr,"stack over flow\n");
    exit(1);
  }
  S[++top]=a;
}

int main(){
  int num,a;
  char in[1000000];
  
  S[top]=NULL;
  
  while(scanf("%s",&in)!=-1){
    if(in[0]==42||in[0]==43||in[0]==45){
      switch(in[0]){
      case 42:
	push(pop()*pop());
	break;
      case 43:
	push(pop()+pop());
	break;
      case 45:
	a=pop();
	push(pop()-a);
	break;
      }
    }else{
      push(atoi(in));
    }
  }
  printf("%d\n",S[top]);
  return 0;
}



Measured memory_bytes: 2140
//I am so vegetable
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _defor(i,a,b) for((i) = (a);(i)<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
//#define _LOCAL_
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll N = 1e5 + 5;
const int MOD = 1e9 + 7;
const double exps = 1e-8;
int main() {
#ifdef _LOCAL_
	ifstream cin("E:\\acm dream\\in.txt");
	ofstream cout("E:\\acm dream\\out.txt");
#endif
	//srand((unsigned)time(nullptr));
	FIO;
	ll a, b, c; cin >> a >> b >> c;
	if ((double)a + (double)b - (double)c + 2.0 * sqrtl(a * b) < 0)cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256