akhauriyash/Code-Regression huggingface dataset:
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 Jaynil
 */
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);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int a[] = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            int c = 0;
            boolean set = false;
            for (int i = 0; i < 100; i++) {
                set = false;
                for (int j = 0; j < n; j++) {
                    if (a[j] != 0) {
                        set = true;
                        a[j]--;
                        continue;
                    } else {
                        if (set) {
                            c++;
                            set = false;
                        }
                    }
                }
                if (set) c++;
            }
            out.println(c);
        }

    }

    static class InputReader {
        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());
        }

    }
}



Measured memory_bytes: 21972
//in the name of allah
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> ii;
const int MAXN = 1e5+10;
int a[MAXN] , n;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for(int i=0 ; i<n ; i++)
		cin >> a[i];
	int mn = *min_element(a , a+n) , mx = *max_element(a , a+n);
	if(mx-mn > 1){
		cout << "No\n";
		return 0;
	}
	if(mx == mn){
		if(a[0] * 2 > n && a[0] != n-1)
			cout << "No\n";
		else
			cout << "Yes\n";
		return 0;
	}
	int t=0 , all=0;
	for(int i=0 ; i<n ; i++)
		if(a[i] == mn)
			t ++;
	for(int i=0 ; i<n ; i++){
		if(a[i] == mx)
			all = a[i]; 
	}
	if(all <= t){
		cout << "No\n";
		return 0;
	}
	if((n-t) < (all-t)*2){
		cout << "No\n";
		return 0;
	}
	cout << "Yes\n";
}

//.


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

using namespace std;

#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;

const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;

int dp[3005][3005];
int n, m;
string a, b;

int f(int i, int j){
	if(i == n || j == m) return 0;
	if(dp[i][j] != -1) return dp[i][j];
	if(a[i] == b[j]) return dp[i][j] = 1 + f(i + 1, j + 1);
	return dp[i][j] = max(f(i + 1, j), f(i, j + 1));
}

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

	cin >> a >> b;
	n = a.size(), m = b.size();
	memset(dp, -1, sizeof dp);
	f(0, 0);
	string S;
	int i = 0, j = 0;
	while(i < n && j < m){
		if(a[i] == b[j]){
			S += a[i];
			i++, j++;
		}
		else if(dp[i + 1][j] > dp[i][j + 1]) i++;
		else j++;
	}
	cout << S;
}

Measured memory_bytes: 35840
n,a,b = map(int, input().split())

ans = 0
for i in range(1,n+1):
  num = i
  N = 0
  while i > 9:
    N += i%10
    i //= 10
  N += i
  
  if a <= N <= b:
    ans += num
    
print(ans)

Measured memory_bytes: 3060
/*
    author: Salam_35
    Created at :

*/

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

/*        speed up       */
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define sci(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define load(array,size)  for(ll i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(ll i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF    1LL<<19
#define pll pair<ll,ll>
#define mst(arr,value) memset(arr,value,sizeof(arr));
#define tst() _fastio;int testsalam;cin >> testsalam;while(testsalam--)
#define Mod 100000007
#define YES cout<<"Yes"<<endl;
#define NO cout<<"No"<<endl;
#define endl '\n'
//void inversemod(ll n, ll mod, ll invmod[],ll MOD){for(int i=2; i<=n; ++i) invmod[i]=MOD-MOD/i*invmod[MOD%i]%MOD;}
//void bigmod( ll a, ll b ,ll mod){ll r = 1;a = a%mod;while(b){if( b%2 ) r = (r*a)%mod;b = b/2;a = (a*a)%mod; }return (ll)r;}
string inttostr(ll n){std::stringstream ss;ss << n;string out=ss.str();return out;}
ll stringtoint(string s){istringstream iss (s);ll n;iss >> n;return n;}
template <typename T> T gcd(T a,T b){if(a < 0)return gcd(-a,b);if(b < 0)return gcd(a,-b);return (b == 0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a,T b) {if(a < 0)return lcm(-a,b);if(b < 0)return lcm(a,-b);return a*(b/gcd(a,b));}
typedef vector<ll>vec;
typedef pair<ll,ll> pii;
typedef map<ll,ll>mpll;
typedef set<ll>seet;

int main()
{

    int n,k;
    cin >> n >> k;
    int v[n+10];
    for (int i = 0; i < n; ++i)
    {
    	cin >> v[i];
    }
    sort(v,v+n);
    ll sum=0;
    int id=0;
    while(k--)
    	sum+=v[id++];
    cout<<sum<<endl;
}
/*
 		remember:
 		ll vs int
 		array size
 		case for 1 2 3
*/


Measured memory_bytes: 3632
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007
#define M_PI           3.14159265358979323846  /* pi */
#define sec second
#define fir first
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define entire(a) (a).begin(),(a).end()
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
void solve()
{
  string s;
  cin>>s;
  ll sum=0;
  rep(i,s.length()){
  	sum+=(48-s[i]);
  }
 	cout<<(sum%3==0?"Yes":"No")<<endl;
}


int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  fast
  int T=1;
  // cin >> T;
  while (T--)
  {
    solve();
  }
  return 0;
}


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

const int N = 2e5 + 100, MOD = 1000 * 1000 * 1000 + 7;

int sum(int a, int b) {
	a += b;
	if(a < 0)
		a += MOD;
	else if(a >= MOD)
		a -= MOD;
	return a;
}

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

int n, m, k, s, ans, fac[N], inv[N];

void pre_pro() {
	inv[1] = 1;
	for (int i = 2; i < N; i++)
		inv[i] = mul(MOD - MOD / i, inv[MOD % i]);
	fac[0] = inv[0] = 1;
	for (int i = 1; i < N; i++) {
		inv[i] = mul(inv[i], inv[i - 1]);
		fac[i] = mul(fac[i - 1], i);
	}
}

int c(int a, int b) {
	return (a > b? 0: mul(fac[b], mul(inv[a], inv[b - a])));
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	pre_pro();
	cin >> n >> m >> k;
	for (int i = 1; i < m; i++)
		s = sum(s, mul(mul(m - i, i), mul(n, n)));
	for (int i = 1; i < n; i++)
		s = sum(s, mul(mul(n - i, i), mul(m, m)));
	cout << mul(s, c(k - 2, n * m - 2));
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstring>
#define M 1000003
using namespace std;
char a[M][13];
void init()
{
    for(int i=0;i<M;i++)
        a[i][0] = '\0';
}
int getkey(char s[])
{
    int i = 0,key = 0,mul = 1,j;
    for(i=0;s[i]!='\0';i++)
    {
        switch(s[i]){
            case 'A':j = 1;break;
            case 'G':j = 2;break;
            case 'C':j = 3;break;
            case 'T':j = 4;
        }
        key += mul*j;
        mul *= 5;
    }
    return key;
}
int h1(int key)
{
    return key%M;
}
long long int h2(int i)
{
    return i*i;
}
bool insert(char s[])
{
    int key = getkey(s);
    int i,index;
    for(i=0;i<M;i++)
    {
        index = (h1(key)+h2(i))%M;
        if(a[index][0]=='\0')
        {
            strcpy(a[index],s);
            return true;
        }
        else if(strcmp(a[index],s)==0)
            return true;
        else
            continue;
    }
    return false;

}
bool find(char s[])
{
    int key,i,index;
    key = getkey(s);
    for(i=0;i<M;i++)
    {
        index = (h1(key)+h2(i))%M;
        if(a[index][0]=='\0')
            return false;
        else if(strcmp(a[index],s)==0)
            return true;
        else
            continue;
    }
    return false;
}
int main()
{
    int n;
    char s1[7],s2[13];
    cin>>n;
    init();
    while(n--)
    {
        cin>>s1>>s2;
        if(s1[0]=='i')
        {
            insert(s2);
        }
        else
        {
            if(find(s2))
                cout<<"yes"<<endl;
            else
                cout<<"no"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 15784
#include <iostream>
#include <string>
using namespace std;
inline string change(string S, int n) {
	char tmp = S[0];
	for (int i = 0; i < n; i++)
	{
		S[i] = S[i + 1];
	}
	S[n - 1] = tmp;

	return S;
}

int main() {
	string S, T;
	bool flg = false;
	cin >> S >> T;
	for (int i = 0; i < (int)S.length(); i++)
	{
		if (S == T) {
			flg = true;
			break;
		}
		S = change(S, S.length());
	}
	
	cout << ((flg) ? "Yes" : "No") << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int main(){
	int N,L;
	cin>>L>>N;
	int m=0;
	rep(i,N){
		int x,w;
		cin>>x>>w;
		m+=x*w;
	}
	if(m==0) puts("0");
	if(m>0) printf("1\n-1 %d\n",m);
	if(m<0) printf("1\n1 %d\n",-m);
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	ll ans=1;
	cin>>n;
	vl num(100003);
	num[0]=3;
	vl v(n);
	rep(i,n)cin>>v[i];
	rep(i,n){
		ll tmp=num[v[i]]-num[v[i]+1];
		if(tmp>3)ans=0;
		else{
			ans*=tmp;
			ans%=MOD;
			num[v[i]+1]++;
		}
		//puta(i,ans);
	}
	puta(ans);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  int ans = 0;
  int mn = INF;
  for (int i = 0; i < n; ++i) {
    if (p[i] < mn) {
      mn = p[i];
      ++ans;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) for(auto&& x : v){cout << x << " ";} cout << endl
#define printVV(vv) for(auto&& v : vv){for(auto&& x : v){cout << x << " ";}cout << endl;}
#define printP(p) cout << p.first << " " << p.second << endl
#define printVP(vp) for(auto&& p : vp) printP(p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;
template<typename T> using Graph = vector<vector<T>>;

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

int H, W;
vector<string> s;

bool inside(int x, int y) {
    return 0 <= x && x < H && 0 <= y && y < W;
}

bool valid(int i, int j) {
    if (i == 0) return false;
    if (s[i][j] != '-') return false;;
    rep(k, 8) {
        int ni = i + dx[k], nj = j + dy[k];
        if (!inside(ni, nj)) continue;
        if (s[ni][nj] == 'x') return false;
        if ((k == 1 || k == 3) && s[ni][nj] == 'o') return false;
    }
    return true;
}

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

    cin >> H >> W;
    s.resize(H);
    rep(i, H) cin >> s[i];

    int ans = 0;
    rep(i, H) {
        rep(j, W) {
            ans += valid(i, j);
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3260
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define Endl endl
#define mod  1000000007
#define mkp make_pair
#define pb push_back
#define cin(n) scanf("%d",&n)
#define cout(n) printf("%d ",n)
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d ",n)
#define bitget(n) __builtin_popcountll(n)

ll dx[] = {1,1,0,-1,-1,-1,0,1};
ll dy[] = {0,-1,-1,-1,0,1,1,1};
ll dxx[] = {1,-1,0,0};
ll dyy[] = {0,0,-1,1};
ll modexpo(ll x,ll y){if(y==0)return 1;if(y%2){ll viky=modexpo(x,y/2);
return (((x*viky)%mod)*viky)%mod;}else{ll viky=modexpo(x,y/2);return (viky*viky)%mod;
}}
ll intpoint(ll x1, ll y1, ll x2, ll y2) { return ( __gcd(abs(x1-x2),abs(y1-y2))+1); }
bool isvalid(ll x,ll y,ll n,ll m) { return (x>=0&&x<n&&y>=0&&y<m); }
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// int pp = uniform_int_distribution<int>(0, kk-1)(rng);
// ---------------------///////////////---------------------------------
// ---------------------///////////////----------------------------------
// -------------/////////////////---------------------------------///////
ll dp[100011],ap[100011],n;

ll get_ans(ll st){
  if(st == n){
    return 0;
  }
  if(dp[st]!=-1){
    return dp[st];
  }
  ll ans = 0;
  if(st+2>n){
    ans = abs(ap[st]-ap[st+1]) + get_ans(st+1);
  }else{
      ans = min(abs(ap[st]-ap[st+1]) + get_ans(st+1),abs(ap[st]-ap[st+2])+get_ans(st+2));
    }
  dp[st] = ans;
  return dp[st];
}

int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll t,i,j,l,r,q,k,kk,x,p,m;
    cin>>n;
    for(i=1;i<=n;i++){
      cin>>ap[i];
      dp[i] = -1;
    }
    get_ans(1);
    // for(i=1;i<=n;i++){
    //   cout<<dp[i]<<" ";
    // }
    cout<<dp[1]<<" ";
return 0;
}

Measured memory_bytes: 4224
#include<stdio.h>
#include<math.h>
int main(){
  int n;
  double a,b,x,y;

  while(scanf("%d,%lf,%lf",&n,&a,&b) != EOF ){  /*出席番号、体重、身長の入力*/
    y=pow(b,2);   /*身長の２乗*/
    if(a/y>=25){    /*体重÷身長の２乗が２５以上なら*/
      printf("%d\n",n);   /*出席番号の表示*/
    }
  }

  return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
 
// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
using namespace __gnu_pbds;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const int INF = 1e16;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 1e9 + 7;

const int maxn = 3e3 + 7;
int dp[maxn][maxn];

int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++)
        cin >> v[i], dp[i][i] = v[i];
    for(int i = 2; i <= n; i++)
        for(int j = 0; j + i - 1 < n; j++)
        {
            int l = j, r = j + i - 1;
            dp[l][r] = max(v[l] - dp[l+1][r], v[r] - dp[l][r-1]);
        }
    cout << dp[0][n-1] << endl;
    return 0;
}

Measured memory_bytes: 70016
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};
const main=()=>{
  let n=tn(),s=tnn(n),target=1,ans=0
  for(let i=0;i<n;i++){
    if(target==s[i]){
      target++
    }else ans++
  }
  if(target==1)to(-1)
  else to(ans)
}
main()


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

int binary( int n )
{
    int l =1;
    int r = 50000;
    while( l<r)
    {
        int mid= (l+r)/2;
        if( int(mid* 1.08) > n)
        {
            r= mid;
        }
        if( int(mid*1.08) < n)
        {
            l = mid+1;
        }
        if( int(mid*1.08)== n)
            return mid;
    }
    return 0;
}
int main()
{
    int n;
    cin>>n;
    int ans = binary(n);
    if( ans==0)
        cout<<":(";
    else cout<<ans;

}

Measured memory_bytes: 3644
s=list(input())

out=0
for p in range(1,2**(len(s)-1)):
  plus_p=list(str(bin(p))[2:])
  plus_p.reverse()
  plus_p=[i for i,pp in enumerate(plus_p) if pp=='1']
  for j in range(len(plus_p)):
    if j==0:
      out+=int(''.join(s[0:plus_p[j]+1]))
    if j<len(plus_p)-1:
      out+=int(''.join(s[plus_p[j]+1:plus_p[j+1]+1]))
    else:
      out+=int(''.join(s[plus_p[j]+1:]))
print(out+int(''.join(s)))

Measured memory_bytes: 3064
import qualified Data.ByteString.Char8 as BC
import Data.Maybe
import Data.List
import Data.Ord

readIntsLine :: IO [Int]
readIntsLine = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

readIntsLines :: IO [[Int]]
readIntsLines = map (map (fst . fromJust . BC.readInt) . BC.words) . BC.lines <$> BC.getContents

solve :: [Int] -> [(Int, Int)] -> [Int]
solve as [] = as
solve [] _ = []
solve (a:as) (bc:bcs) = res : solve as (nextbc ++ bcs)
  where (res, nextbc) = proc a bc

proc :: Int -> (Int, Int) -> (Int, [(Int, Int)])
proc a (b, c)
  | a >= c = (a, [(b, c)])
  | b == 1 = (c, [])
  | otherwise = (c, [(b - 1, c)])

main :: IO ()
main = do
  getLine
  as <- sort <$> readIntsLine
  let toTuple [a, b] = (a, b)
  bcs <- sortOn (Down . snd) . map toTuple <$> readIntsLines
  print . sum $ solve as bcs


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

int mass[102][102];
int gx,gy;
bool goal_flag;
void DFS(int x,int y,int c){
    if(mass[y][x]!=c || mass[y][x]==0)return;
    if(x==gx&&y==gy){goal_flag=true;return;}
    mass[y][x]=0;
    DFS(x+1,y,c);
    DFS(x-1,y,c);
    DFS(x,y+1,c);
    DFS(x,y-1,c);
}

int main(){
  int h,w;
  int start_x,start_y;

  int n;
  int c,d,x,y;
  while(1){
    cin>>w>>h;
    if(w==0&&h==0)break;
    cin>>start_x>>start_y;
    cin>>gx>>gy;
    cin>>n;
    for(int i=0;i<h+2;i++){
      for(int j=0;j<w+2;j++){
        mass[i][j]=0;
      }
    }

    for(int i=0;i<n;i++){
        cin>>c>>d>>x>>y;
        for(int j=0;j<2;j++){
          for(int k=0;k<4;k++){
            if(d==0){mass[y+j][x+k]=c;}
            else if(d==1){mass[y+k][x+j]=c;}
          }
        }
    }
    goal_flag=false;
    DFS(start_x,start_y,mass[start_y][start_x]);
    if(goal_flag)cout<<"OK";
    else cout<<"NG";
    cout<<endl;
  }
}



Measured memory_bytes: 3108
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main() {
  string s;
  cin >> s;
  string u = s.substr(5,2);
  string m = s.substr(8,2);
  string su = u + m;
  int ans = stoi(su);
  if (ans <= 430) {
    cout << "Heisei" << endl;
  }
  else cout << "TBD" << endl;
}

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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
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 (b<a) { a=b; return 1; } return 0; }

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


int main() {
    cout<<fixed<<setprecision(10);


    ll a,b,c;
    scanf("%ld %ld.%ld", &a, &b, &c);

    // cout<<a<<b<<c;

    ll ans = a*b + (a*c)/100;
    cout<<ans<<endl;


    return 0;

}


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

int main() {
  int h;
  cin >> h;
  int w;
  cin >> w;
  vector<string> a(h);
  for (int i = 0; i < h; i++) {
    cin >> a[i];
  }

  vector<bool> row(h, false);
  vector<bool> col(w, false);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (a[i][j] == '#') {
        row[i] = true;
        col[j] = true;
      }
    }
  }

  for (int i = 0; i < h; i++) {
    if (row[i]) {
      for (int j = 0; j < w; j++) {
        if (col[j]) {
          cout << a[i][j];
        }
      }
      cout << endl;
    }
  }
}


Measured memory_bytes: 256
// by DenyTianly
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long LL;

const LL inf = 1LL << 62;

int main(){
	LL h, w;
	scanf("%lld %lld", &h, &w);
	LL per = h*w/3;
	// row
	
	LL t = per/h, mx = 1LL << 62;
//	printf("%d\n\n", t);
	for ( LL i = -2; i <= 2; i ++ ) {
		LL row = (t+i);
		if(row < 0) continue;
		row *= h;
		LL s = (h*w-row);
		LL h1 = h, w1 = w -(t+i), MAX = -100000, MIN = 1LL << 62;
		
		if(h1%2 == 0 || w1%2 == 0) {	// 平均化 
			s /= 2;
			MAX = max(MAX, max(row, s)); MIN = min(MIN, min(row, s));
		} else {
			LL q = min(h1, w1);
			LL ano = h1+w1-q;
			
			LL one = q*(ano/2);
			s -= one;
			MAX = max(row, max(s, one));
			MIN = min(row, min(s, one));
		}
		
//		printf("%lld %lld %lld %lld\n", MAX, MIN, h1, w1);
		mx = min(mx, abs(MAX-MIN));
	}
	
	// column
	LL t2 = per/w;
	for ( LL i = -2; i <= 2; i ++ ) {
		LL col = (t2+i);
		if(col < 0) continue;
		col *= w;
		LL s = (h*w-col);
		LL h1 = h -(t2+i), w1 = w, MAX = -100000, MIN = 1LL << 62;
		
		if(h1%2 == 0 || w1%2 == 0) {	// 平均化 
			s /= 2;
			MAX = max(MAX, max(col, s)); MIN = min(MIN, min(col, s));
		} else {
			LL q = min(h1, w1);
			LL ano = h1+w1-q;
			
			LL one = q*(ano/2);
			s -= one;
			MAX = max(col, max(s, one));
			MIN = min(col, min(s, one));
		}
		
//		printf("%lld %lld %lld %lld\n", x, s, h1, w1);
		mx = min(mx, abs(MAX-MIN));
	}
	
	printf("%lld\n", mx);

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {

	vint a(3);
	rep(i, 3)cin >> a[i];
	sort(a);
	reve(a);//でかい順になった（はず）
	cout << a[0] * 10 + a[1] + a[2] << rt;

	please AC;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
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; }

int main() {
	int n, m;
	cin >> n >> m;
	vector<int>cnt(m, 0);
	rep(i, n) {
		int k;
		cin >> k;
		for (int j = 0;j < k;++j) {
			int A;
			cin >> A;
			--A;
			++cnt[A];
		}
	}
	int ans = 0;
	rep(i, m) {
		if (cnt[i] == n)++ans;
	}
	cout << ans << endl;
}

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

const int Max=200010;
int n,m,ans;
int num[Max];

int main()
{
	scanf("%d",&n);n++;
	for(int i=1;i<=n;i++) scanf("%d",&num[i]);
	sort(num+1,num+n+1);
	ans=num[2]-num[1];
	for(int i=3;i<=n;i++) ans=__gcd(num[i]-num[i-1],ans);
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int A1[100001];
char A2[100001];
int input1[100001];
char input2[100001];

void swap1(int* a, int* b){
  int tmp = *a;
  *a = *b;
  *b = tmp;
}

void swap2(char* a, char* b){
  char tmp = *a;
  *a = *b;
  *b = tmp;
}

int partition(int p, int r){
  int x = A1[r];
  int i = p - 1, j;
  for(j=p;j<r;j++){
    if(A1[j] <= x){
      i++;
      swap1(&A1[i], &A1[j]);
      swap2(&A2[i], &A2[j]);
    }
  }
  swap1(&A1[i+1], &A1[r]);
  swap2(&A2[i+1], &A2[r]);
  return i+1;
}

void quic_sort(int p, int r){
  if(p < r){
    int q = partition(p, r);
    quic_sort(p, q-1);
    quic_sort(q+1, r);
  }
}

int check(int n){
  int i, j;
  for(i=1;i<n;i++){
    if(A1[i-1] == A1[i]){
      int a, b;
      for(j=0;j<n;j++){
        if(A1[i-1] == input1[j] && A2[i-1] == input2[j]) a = j;
        if(A1[i] == input1[j] && A2[i] == input2[j]) b = j;
      }
      if(a > b) return 0;
    }
  }
  return 1;
}

int main(){
  int n, i;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    getchar();
    scanf("%c%d", &A2[i], &A1[i]);
  }
  for(i=0;i<n;i++){
    input1[i] = A1[i];
    input2[i] = A2[i];
  }
  quic_sort(0, n-1);
  printf("%s\n", (check(n) ? "Stable" : "Not stable"));
  for(i=0;i<n;i++) printf("%c %d\n", A2[i], A1[i]);
  return 0;
}




Measured memory_bytes: 2720
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int>A(N);
  for(int i = 0;i < N;i++){
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  for(int i = 0;i < N - 1;i++){
    if(A.at(i) == A.at(i + 1)){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#define N 200005
using namespace std;
int n,top;
int s[N],st1[N],st2[N];
bool check(int a){
	top=0;
	for(int i=1;i<=n;i++){
		if(s[i]<=s[i-1]){
			if(a==1) return 0;
			while(top>0&&st1[top]>s[i]) top--;
			if(st1[top]==s[i]) st2[top]++;
			else top++,st1[top]=s[i],st2[top]=1;
			while(st2[top]>=a&&top!=0){
				if(st1[top]-st1[top-1]==1) st2[top-1]++,top--;
				else{st1[top]--;st2[top]=1;break;}
			}
			if(top==0&&st2[top]!=0) return 0;
		}
	}
	return 1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&s[i]);
	int l=1,r=n;
	while(l+1<r){
		int mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid;
	}
	if(check(l)) printf("%d\n",l);
	else printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 1024
n=int(input())
a=list(map(int, input().split()))
a=sorted(a,reverse=True)
l=len(a)
skip=False
ans=1
flag=0
for i in range(l) :
    if skip :
        skip=False
        continue
    if i == l-1 :
        print(0)
        break
    if a[i] == a[i+1] :
        ans *= a[i]
        flag += 1
        skip=True
        if flag == 2 :
            print(ans)
            break

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

int main() {
  int n;cin>>n;
  vector<pair<string,int>>pr(n);
  int cnt=0;
  rep(i,n){
    string s;int t;cin>>s>>t;
    pr[i]=make_pair(s,t);
    cnt+=t;
  }
  string x;cin>>x;
  int ans=0;
  rep(i,n){
    ans+=pr[i].second;
    if(x==pr[i].first)break;
  }
  cout<<cnt-ans<<endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
# define ll int64_t
#define rep(i,n) for(ll i=0;i<n;i++)
#define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}





int main(void){
    ll n,k,mini=10000000000000;
    cin>>n>>k;
    vector<ll> h(n);
    rep(i,n) cin>>h[i];
    sort(ALL(h));
    rep(i,n-k+1){
        if(mini>h[k-1+i]-h[i]) mini=h[k-1+i]-h[i];
        if(mini==0) break;
    }
    cout<<mini<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ls x<<1
#define rs x<<1|1
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=1e7+19;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+100;
int a[maxn],f[maxn];
int cmp(int a,int b){return a>b;}
int check(ll x,ll k,int n){
	ll ans=0;
	for(int i=1;i<=n;i++){
		ll val=1ll*a[i]*f[i];
		if(val<=x)continue;
		else {
			ans+=(val-x+f[i]-1)/f[i];
		}
	}
	return ans<=k;
}
void solve()
{
	int n;scd(n);
	ll k;scanf("%lld",&k);
	rep1(i,n)scd(a[i]);
	rep1(i,n)scd(f[i]);
	sort(a+1,a+n+1);
	sort(f+1,f+n+1,cmp);
	ll l=0,r=1000000000000,ans;
	while(l<=r){
		ll mid=l+r>>1;
		if(check(mid,k,n)){
			r=mid-1;
			ans=mid;
		}
		else l=mid+1;
	}
	ac;
}
int main(){
    //IOS;
    solve();
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <stdio.h>
typedef long long int LL;
#define fr(i,p,n) for(LL i=p;i<n;i++)
#define fr1(i,p,n) for(LL i=p;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define precise cout << std::setprecision(10) << std::fixed;

using namespace std;
 
int main()
{
        string s;
        cin>>s;
        string t;
        cin>>t;
        LL ans=0;
        fr(i,0,s.length()){
            if(s[i]!=t[i]) ans++;
            }
         cout<<ans<<endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  if(N==1){
    cout << 1 << "\n";
    return 0;
  }
  
  int cnt = 1;
  vector<bool> ud;
  for(int i=1;i<N;i++){
    if(A.at(i-1)==A.at(i)){
      continue;
    }else{
      ud.push_back( A.at(i-1) < A.at(i) );
    }
  }
  for(int i=0;i<ud.size()-1;i++){
    if(ud.at(i)!=ud.at(i+1)){
      cnt++;
      i++;
    }
  }
  cout << cnt << "\n";
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<ll,int> pint;
const int inf=1000000;
const ll longinf=1LL<<62 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;
vector<pint> v[101010];


typedef pair<double,double> P;
double eps=1e-8;
double add(double x,double y){
    if(abs(x+y)<eps*(abs(x)+abs(y)))return 0;
    return x+y;
}

P operator+ (P x,P y){
    return P{add(x.first,y.first),add(x.second,y.second)};
}

P operator- (P x,P y){
    return P{add(x.first,-y.first),add(x.second,-y.second)};
}

P operator* (P x,double y){
    return P{x.first*y,x.second*y};
}

double dot(P x,P y){
    return add(x.first*y.first,x.second*y.second);
}

double det(P x,P y){
    return add(x.first*y.second,-x.second*y.first);
}

bool onseg(P p1,P p2,P q){
    return det(q-p1,p2-p1)==0 && dot(p1-q,p2-q)<=0;
}

P intersection(P p1,P p2,P q1,P q2){
    return p1+(p2-p1)*(det(q2-q1,q1-p1)/det(q2-q1,p2-p1));
}

P symmetry(P p1,P p2,P q){
    P n={(p2-p1).second,-(p2-p1).first};
    P m=intersection(p1,p2,q,q+n);
    return m*2-q;
}

typedef pair<P,P> PP;

PP expr(string s,int&i);
PP factor(string s,int& i);
PP num(string s,int& i);


bool isdigit(char c){
    if(c=='-')return true;
    int x=c-'0';
    return 0<=x&&x<=9;
}
PP expr(string s,int& i){
    PP ret=factor(s,i);
    while(s[i]=='@'){
    i++;
    PP res=factor(s,i);
    if(ret.second.first>500){
        if(res.second.first>500)ret={ret.first,res.first};
        else ret={symmetry(res.first,res.second,ret.first),{1000,1000}};
    }
    else {
        if(res.second.first<500)ret={intersection(ret.first,ret.second,res.first,res.second),{1000,1000}};
        else ret={symmetry(ret.first,ret.second,res.first),{1000,1000}};
    }
    }
    return ret;
}

PP factor(string s,int& i){
    if(isdigit(s[i]))return num(s,i);
    i++;
    PP ret=expr(s,i);
    i++;
    return ret;
}

PP num(string s,int& i){
    bool nega=false;
    if(s[i]=='-'){nega=true;i++;}
    double res=s[i]-'0';
    i++;
    while(isdigit(s[i])){
        res=10*res+s[i]-'0';
        i++;
    }
    if(nega)res=-res;
    nega=false;
    i++;
    if(s[i]=='-'){nega=true;i++;}
    double ret=s[i]-'0';
    i++;
    while(isdigit(s[i])){
        ret=10*ret+s[i]-'0';
        i++;
    }
    if(nega)ret=-ret;
    return PP{{res,ret},{1000,1000}};
}

int main(){
    string s;
    while(cin>>s,s!="#"){
        int j=0;
        PP ans=expr(s,j);
        cout<<ans.first.first<<" "<<ans.first.second<<endl;
    }

    return 0;
}



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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;
///////////////////////////////////////////////
// for template
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    int D,T,S;
    cin >> D >> T >> S;
    if (D  > T * S){
        puts("No");
    }else{
        puts("Yes");
    }
}

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

int main(){
  int cnt = 0;
  string s;
  cin >> s;
  int l = s.length();
  for(int i=0; i<l/2; i++){
    if(s[i]!=s[l-1-i]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	rep(i,k) {
		int d;
		cin >> d;
		rep(j,d) {
			int a;
			cin >> a;
			a--;
			v[a]++;
		}
	}
	int ans = 0;
	rep(i,n) if (!v[i]) ans++;
	cout << ans << endl;
}

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

int main(){
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << x2-y2+y1 << " " << y2+x2-x1 << " " << x1-y2+y1 << " " << y1+x2-x1 << endl;
}

Measured memory_bytes: 256
// Problem : C - Maximum Volume
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms

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

#define int         long long int
#define all(a)      (a).begin(),(a).end()
#define f           first
#define s           second
#define endl        '\n'
#define MOD         1000000007

void solve()
{
	int l ;
	cin >> l ;
	double ll = l ;
	double x, y, z ;
	x = y = z = ll / 3 ;
	double ans = x * y * z ;
	cout << fixed << setprecision(12) << ans << endl ; 
}

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

    int t = 1 ;
    //cin >> t ;
    while(t--)
    {
        solve() ;
    }
    return 0 ;
}

Measured memory_bytes: 256
# Problem https://atcoder.jp/contests/abc082/tasks/abc082_b
# Ruby 1st Try
sStr = gets.chomp
tStr = gets.chomp
ssStr = sStr.chars.sort.join
tsStr = tStr.chars.sort.reverse.join
if ssStr < tsStr
    puts("Yes")
else
    puts("No")
end
# p ssStr
# p tsStr

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    char x,y;
    cin >> x >> y;

    char ans;
    if(x == y) ans = '=';
    else if(x < y) ans = '<';
    else ans = '>';

    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
nums = [[] for _ in range(N)]
cou = 0

for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    nums[a].append(b)
    nums[b].append(a)

def search(path):
    global cou
    n = path[len(path) - 1]
    if len(path) == N:
        cou += 1
    else:
        for x in nums[n]:
            if x not in path:
                path.append(x)
                search(path)
                path.pop()

search([0])
print(cou)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[m];
		int[] d = new int[m];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
			b[i] = Integer.parseInt(sc.next());
		}
		for (int i = 0; i < m; i++) {
			c[i] = Integer.parseInt(sc.next());
			d[i] = Integer.parseInt(sc.next());
		}
		for (int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE;
			int index = 0;
			for (int j = 0; j < m; j++) {
				int tem = Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j]);
				if (tem < min) {
					min = tem;
					index = j;
				}
			}
			System.out.println(index + 1);
		}
	}
}

Measured memory_bytes: 19924
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef map<char,int> M;
const ll mod=1000000000+7;

int main(){
    ll N;
    cin>>N;
    if(N<10)cout<<N;
    else{
        ll cnt=0;
        ll k=10;
        while(k<=N){
            cnt+=(9*k/10);
            k*=100;
        }
        k/=100;
        if(10*k>N)cout<<cnt;
        else cout<<cnt+(N-10*k+1);
        cout<<endl;
    }
}

Measured memory_bytes: 256
p = []
for i in range(1,11111+1):
    flag = True
    N = i*5+1
    for j in range(2,int(N**0.5)+1):
        if N%j == 0:
            flag = False
            break
    if flag:
        p.append(N) 
N = int(input())
for i in range(N):
    print(p[i],end = " ")

Measured memory_bytes: 40816
ntimes :: Int -> IO a -> IO [a]
ntimes 0 _  = return []
ntimes n io = do
    x  <- io
    xs <- ntimes (n - 1) io
    return $ x : xs

main :: IO ()
main = do
    [n, _] <- map read . words <$> getLine
    grid   <- ntimes n getLine
    mapM_ (\r -> putStrLn $ r ++ "\n" ++ r) grid


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a, b) accumulate(all(a), b)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
ll const INF = 1e18;

template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    ios();
    int n, m;
    cin >> n >> m;
    vector<int> s(n), t(m);
    for(auto& i : s) cin >> i;
    for(auto& i : t) cin >> i;

    vector<vector<ll>> dp(n+1, vector<ll>(m+1, 1));
    vector<ll> add(1e5+10, 0);
    
    REP(i, n){
        int x = s[i];
        REP(j, m){
            int y = t[j];
            if(x == y){
                add[j] += dp[i][j];
                add[j] %= MOD;
            }
            dp[i+1][j+1] = dp[i+1][j] + add[j];
            dp[i+1][j+1] %= MOD;
        }
    }

    cout << dp[n][m] << endl;

    return 0;
}


Measured memory_bytes: 32384
O, E = input(), input()

ans = ''
if len(O) == len(E):
  for i in range(len(O)):
    ans += O[i]
    ans += E[i]
elif len(O) - len(E) == 1:
  for i in range(len(E)):
    ans += O[i]
    ans += E[i]
  else:
    ans+=O[-1]
    
print(ans)

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

public class Main{
  public static void main(String [] args)throws Exception{

    BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
    String [] inp = br.readLine().split(" ");
    int a = Integer.parseInt(inp[0]);
	int b = Integer.parseInt(inp[1]);
	int c = Integer.parseInt(inp[2]);
    if(a<5||a>7||b<5||b>7||c<5||c>7){
      System.out.println("NO");
    }else if((a+b+c)==17){
      if(a!=6 &&b!=6 && c!=6){
        System.out.println("YES");
      }else{
        System.out.println("NO");
      }
    }
  	else{
      System.out.println("NO");
    }

    
  }
}

Measured memory_bytes: 21076
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (b - a <= 0) {
            System.out.println("delicious");
        } else if (b - a <= x) {
            System.out.println("safe");
        } else {
            System.out.println("dangerous");
        }
    }
}


Measured memory_bytes: 21972