akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>
#include <math.h>
using namespace std;

int main(int argc,char** argv)
{

	int a[3],count=0,oki;
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);

	if( a[0]==a[1]){
		while(a[0]<a[2]){
			a[0]++;
			count++;
		}
	}
	else if( (a[1]-a[0])%2 == 0 ){
		while(a[0]<a[2] && a[1]<a[2]){
			a[0]++;
			a[1]++;
			count++;
		}
		oki = min(a[0],a[1]);
		while(oki < a[2]){
			oki = oki+2;
			count++;
		}
	}
	else{
		a[0]++;
		a[2]++;
		count++;
		while(a[0]<a[2] && a[1]<a[2]){
			a[0]++;
			a[1]++;
			count++;
		}
		oki = min(a[0],a[1]);
		while(oki < a[2]){
			oki = oki+2;
			count++;
		}
	}
	cout << count << endl;
	return 0;

}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    ll n;
    cin >> n;
    vi num(200);
    rep(i, 100) {
        num[i] = i+1;
    }
    n++;

    int now = 0, cou = 0;
    ll x = 1;
    while(n) {
        if(n&1) {
            num[100+now+cou] = 100-cou;
            cou++;
        }
        now++;
        n >>= 1;
    }
    now -= 2;
    rep(i, now) {
        int j = 100;
        while(num[j]) j++;
        num[j] = i+1;
    }

    vi::iterator itr = find(all(num), 0);
    int m = itr-num.begin()+1;
    cout << m << endl;
    rep(i, m) {
        if(i == m-1) i++;
        cout << num[i] << (i == m?'\n':' ');
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
 
typedef long long ll;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define DBGV(v,n) forn(i,n) cout << v[i] << " "; cout << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl

vector < vector <bool> > visto(3005,vector<bool>(3005,false));
vector < vector <ll> > dp(3005,vector<ll>(3005,0));

ll juego(int x, int y, vector <ll> &v)
{
	if(visto[x][y]==true) return dp[x][y];
	visto[x][y]=true;
	if(x==y) 
	{
		dp[x][y]=v[x];
		return dp[x][y];
	}
	dp[x][y]=max(v[x]-juego(x+1,y,v),v[y]-juego(x,y-1,v));
	return dp[x][y];
}

 
int main()
{ 
	FIN;
	
	#ifdef input
		freopen("test2.txt", "r", stdin);
	#endif
	
	int n;
	cin >> n;
	vector <ll> v(n);
	forn(i,n) cin >> v[i];
	if(n==1) {cout << v[0] << endl; return 0;}
	cout << max(v[0]-juego(1,n-1,v),v[n-1]-juego(0,n-2,v)) << endl;
	//forn(i,n) forn(j,n) {cout << dp[i][j] << " "; cout << endl;}
	
	return 0;
}


Measured memory_bytes: 72448
#include <algorithm>
#include <iostream>
#include <climits>
using namespace std;
int main(void){
    int N;
    int ans=INT_MAX;
    int A;
    cin>>N;

    for(int i=0; i<N; i++){
    int crack_Count=0;
    cin>>A;
    while(A%2==0){
        crack_Count++;
        A/=2;
    }
    ans=min(ans,crack_Count);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)

#define SORT(c) sort((c).begin(),(c).end())
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

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();}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int WHITE = 0;
const int GRAY = 1;
const int BLACK = 2;
const int MAX = 10001;
int N, T;

struct init{
    init(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
} init;


void input(){
  std::cin >> N >> T;
}

void solve(){
  int c, t;
  int c_min = INTINF;
  REP0( i, N ){
    std::cin >> c >> t;
    if ( t <= T ) {
      c_min = min( c_min, c );
    }
  }
  if ( c_min == INTINF ) {
    std::cout << "TLE" << '\n';
  }else{
    std::cout << c_min << '\n';
  }

}


int main(int argc, char const *argv[]) {
  input();
  solve();

  return 0;
}


Measured memory_bytes: 256
use std::io;
use std::cmp::{max, min};

fn read_line() -> String {
    let mut s: String = String::new();
    io::stdin().read_line(&mut s).unwrap();
    return s.trim().to_string();
}

fn read_nums() -> Vec<i32> {
    return read_line().split(' ').map(|x| x.parse::<i32>().unwrap()).collect();
}

fn read_num() -> i32 {
    return read_line().parse::<i32>().unwrap();
}

fn accum(v: &Vec<i32>) -> Vec<i64> {
    let n = v.len();
    let mut ret: Vec<i64> = vec![0; n + 1];

    for i in 0..n {
        ret[i + 1] = ret[i] + (v[i] as i64);
    }

    return ret;
}

// [low, high)
fn calc(s: &Vec<i64>, low: i32, high: i32) -> (i64, i64) {
    let tot = s[high as usize] - s[low as usize];
    let mut l = low;
    let mut h = high - 2;

    while l <= h {
        let m = (l + h) / 2;
        let v = s[(m + 1) as usize] - s[low as usize];
        if v + v < tot {
            l = m + 1;
        } else {
            h = m - 1;
        }
    }

    if l == high - 1 { l = l - 1; }
    let mut a = s[(l + 1) as usize] - s[low as usize];
    let mut b = s[high as usize] - s[(l + 1) as usize];

    if h >= low {
        let (c, d) = (s[(h + 1) as usize] - s[low as usize], s[high as usize] - s[(h + 1) as usize]);

        if max(a, b) - min(a, b) > max(c, d) - min(c, d) {
            a = c;
            b = d;
        }
    }

    return (a, b);
}

fn main() {
    let n = read_num();
    let a = read_nums();
    let s = accum(&a);

    let mut best: i64 = 10000000000000000;

    for i in 0..n {
        if i - 0 < 2 || n - i < 2 {
            continue;
        }

        let (a, b) = calc(&s, 0, i);
        let (c, d) = calc(&s, i, n);

        // println!("{}: {} {} {} {}", i, a, b, c, d);

        let mx = max(a, max(b, max(c, d)));
        let mn = min(a, min(b, min(c, d)));

        best = min(best, mx - mn);
    }

    println!("{}", best);
}

Measured memory_bytes: 9464
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  string s;
  cin>>s;
  int n=s.length();
  map<char,int> m;
  m['A']=1;
  m['C']=1;
  m['G']=1;
  m['T']=1;
  int cnt=0,ans=0;
  rep(i,0,n){
    if(m.find(s[i])!=m.end()) cnt++;
    else {
      ans=max(ans,cnt);
      cnt=0;
    }
  }
  ans=max(ans,cnt);
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3588
N = int(input())
Hn = list(map(int,input().split()))[::-1]
minnum = Hn[0]
check = True
for i in range(1,len(Hn)):
    if Hn[i-1]-Hn[i]<-1:
        check = False
        break
    elif Hn[i-1]-Hn[i]==-1:
        Hn[i]-=1
    else:
        continue
if check:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14396
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include <numeric>
#include<vector>

#define LL long long
#define MOD 1000000007

using namespace std;

LL gcd(LL C, LL D) {
	if (C < D) gcd(D, C);

	if (C%D == 0)return D;
	else gcd(D, C%D);
}

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

int main() {

	int N;

	cin >> N;
	
	int X = ceil((float)N / 1.08f);
	if (N !=(int)(X * 1.08)) {
		cout << ":("  << endl;
	}
	else {
		cout << X << endl;
	}
	cin >> N;
}





Measured memory_bytes: 384
'''
https://atcoder.jp/contests/abc144/tasks/abc144_d
'''
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7
    import math
    a,b,x = map(int, input().split())
    if a*a*b/2 >= x:
        n = 2*x / (a*b)
        s = b / ((n**2 + b**2)**0.5)
        print(90-math.degrees(math.acos(s)))
    else:
        x = a*a*b - x
        n = 2*x / (a*a)
        s = a / ((n**2 + a**2)**0.5)
        print(math.degrees(math.acos(s)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <stdio.h>

int
main(int argc, char *argv[])
{
    int N, K;
    int h[100000];
    int i;
    int ride=0;

    scanf("%d%d", &N, &K);
    for (i=0; i<N; i++) {
        scanf("%d", h+i);
        if (*(h+i)>=K)
            ride++;
    }
    printf("%d\n", ride);

    return 0;
}

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

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	int n;
	cin >> n;
	vector<int> p(n);
	for (int i = 0; i < n; i++) cin >> p[i];

	int min = INT_MAX;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (p[i] < min) ans++;
		if (p[i] < min) min = p[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
char s[50][99],*p;d[5]={0,1,0,-1},t[50][50]={1},i,u,v,x,y,f,c,P['~~'][2];main(l,h,w){for(scanf("%d%d\n",&h,&w);i<h;)for(gets(p=s+i++);*p;)c+=*p++==46;for(;f<l;)for(x=P[f][i=0],y=P[f++][1];i<4;u>=0&v>=0&u<h&v<w&&(!t[u][v]||t[u][v]>t[x][y]+1)&&s[u][v]-35&&(t[P[l][0]=u][P[l++][1]=v]=t[x][y]+1))u=x+d[i],v=y+d[++i];printf("%d",(f=t[h-1][w-1])?c-f:-1);}

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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int d1,d2,d3;
  d1=max(a,b)-min(a,b);
  d2=max(b,c)-min(b,c);
  d3=max(a,c)-min(a,c);
  if (d3<=d || (d1<=d && d2<=d)) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <cstdio>
 
using namespace std;
 
int main() 
{
 
    int n, q,i,count = 0;
    int S[10000], T[500];
 
    cin >> n;
    for (i = 0; i < n; i++) {
        cin >> S[i];
    }
 
    cin >> q;
    for (i = 0; i < q; i++) {
        cin >> T[i];
        for (int j = 0; j < n; j++) {
            if (T[i] == S[j]) {
                count++;
                break;
            }
        }
    }
 
    cout << count << endl;
 
    return 0;
 
}

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

int main() {
    int N, M;
    cin >> N >> M;
    int A[N], B[N], C[M], D[M], ans[N];
    for(int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }
    for(int i = 0; i < M; i++) {
        cin >> C[i] >> D[i];
    }
    for(int i = 0; i < N; i++) {
        int x = A[i];
        int y = B[i];
        int min_dist = abs(x - C[0]) + abs(y - D[0]);
        int res = 1;
        for(int j = 0; j < M; j++) {
            int dist = abs(x - C[j]) + abs(y - D[j]);
            if(dist < min_dist) {
                min_dist = dist;
                res = j+1;
            }
        }
        ans[i] = res;
    }
    for(int i = 0; i < N; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define in(x) cin >> x
#define inv(x)                                                                 \for (auto &t : (x)) cin >> t
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define outv(x)                                                                \
  for (auto &t : (x))                                                          \
  out((x))
#define outsv(x)                                                               \for (auto &t : (x)) outs((x))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i++)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(n)-1; i < (int)(x); i++)
#define sz(x) ((int)(x).size())
#define sz(x) ((int)(x).size())
#define inf 1e9
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;
}
using ll = int64_t;

void Main() {
  string x, y;
  in(x);
  in(y);
  out(x == y ? '=' : (x > y ? '>' : '<'));

  return;
}

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


Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
#include <stdbool.h>
//#include <limits.h>
#include <math.h>

bool primeCheck(int m)
{
  if (m == 1)
    return false;
  if (m == 2)
    return true;
  bool b = true;
  int i;
  for (i = 2; i <= sqrt((double)m)+1; i++)
  {
    if (m % i != 0)
      continue;
    b = false;
    break;
  }
  return b;
}


int main() {
  int q;
  scanf("%d", &q);
  int l[q], r[q];
  for (int i=0; i<q; i++)
    scanf("%d%d", l+i, r+i);
  int f[50001];
  f[0] = 0;
  for (int i=1; i<50001; i++) {
    if (primeCheck(2*i-1)) {
      if (primeCheck(i)) {
        f[i] = f[i-1]+1;
        continue;
      }
    }
    f[i] = f[i-1];
  }
  for (int i=0; i<q; i++) {
    printf("%d\n", f[(r[i]+1)/2] - f[(l[i]-1)/2]);
  }
  return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef priority_queue<long long> prque;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define aout(i,n,a) for(long long i=0;i<(long long)(n);i++){if(i){cout<<" ";}cout<<a[i];if(i==n-1){cout<<endl;}}
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define vsort(v) sort((v).begin(),(v).end())
#define vrsort(v) sort((v).rbegin(),(v).rend())
#define vreverse(v) reverse((v).begin(),(v).end())
#define pf(a) push_front(a)
#define pb(a) push_back(a)
#define INF 1998021900
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  ll u;string p;
  cin>>u>>p;
  //caricurate
  if(u%2){cout<<"No"<<endl;return 0;}
  rep(i,(u/2)){
  if(p[i]!=p[i+(u/2)]){cout<<"No"<<endl;return 0;}
  }
  cout<<"Yes"<<endl;
  //output
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, T;
    ll sum = 0;
    ll prev = 0;
    cin >> N >> T;
    rep(i, N) {
        ll t;
        cin >> t;
        sum += min(T, t - prev);
        prev = t;
    }
    sum += T;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<string>
#include<cstdlib>
#include<bitset>
#include<sstream>
#include<queue>
#include<stack>
#include<list>
#include<limits>
#include<iomanip>

using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pt;
typedef pair<ll,ll> pll;

#define Max 1000001
#define intinf 2147483647
#define longlonginf 9223372036854775807
#define MOD 998244353
#define MOD2 1000000007
#define fastio ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define vint vector<int>
#define vll vector<long long>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define F(i,n) for(int i = 0;i<n;i++)
#define Fr(i,l,r) for(int i = l;i <= r;i++)
#define rF(i,n) for(int i = n-1;i>=0;i--)


//#define min(a,b) a>b?b:a
//#define max(a,b) a>b?a:b
#define all(arr) arr.begin(),arr.end()
//#define sort(vec) sort(vec.begin(),vec.end())
//#define reverse(vec) reverse(vec.begin(),vec.end())


ll Lpow(ll a,ll b)
{
    ll ans = 1;
    while(b > 0)
    {
        if(b%2)
            ans = (ans*a);
        a = (a*a);
        b = b/2;
    }
    return ans;
}

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

int dp[1002][1002];

signed main()
{
    fastio;
    
    int n,m;
    cin >> n >> m;
    
    vector<string> arr(n);
    F(i,n)
    {
        cin >> arr[i];
    }
    
    int i = 0;
    while(i < m && arr[0][i] == '.')
    {
        dp[0][i] = 1;
        i++;
    }
    
    i = 0;
    while(i < n && arr[i][0] == '.')
    {
        dp[i][0] = 1;
        i++;
    }
    
    for(int i = 1;i<n;i++)
    {
        for(int j = 1;j<m;j++)
        {
            if(arr[i][j] == '#')
                dp[i][j] = 0;
            else
                dp[i][j] = (dp[i-1][j] + dp[i][j-1])%MOD2;
        }
    }
    
    cout << dp[n-1][m-1] << endl;
    
    return 0;
}


Measured memory_bytes: 5248
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }

int K, A, B;

signed main()
{
	cin >> K;
	cin >> A >> B;
	for (int i = A; i <= B; i++)
	{
		if (i % K == 0)
		{
			cout << "OK" << endl;
			return 0;
		}
	}

	cout << "NG" << endl;
}





Measured memory_bytes: 3596
var lines = []; var ans = Infinity;
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
})

rl.on('close', function () {
    var N = Number(lines[0]);
    var S = lines[1].split("");

    // 一番左端の人がリーダだったケースを考える
    // 東向いている人は，全員西向きにする
    var result = 0;
    for (var string of S) { result += (string === "E" ? 1 : 0) }

    // リーダを変えて考える．リーダを東向きに一人ずつずらしていく
    for (var i = 0; i < N; i++) {
        // 一つ前のリーダが西を向いていたら，方向を変える人が1人増える
        result += (S[i - 1] === "W" ? 1 : 0)

        // 現在のリーダーがが東を向いていたら，方向を変える人間が1人減る
        result -= (S[i] === "E" ? 1 : 0)

        ans = Math.min(ans, result);
    }

    console.log(ans);

});

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

#define MAX_N 50

using namespace std;

int R[MAX_N]{};

int main() {
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    ++R[a - 1];
    ++R[b - 1];
  }
  for (int i = 0; i < N; ++i) {
    printf("%d\n", R[i]);
  }
}

Measured memory_bytes: 3228
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n%10==3){
    cout<<"bon\n";
  }
  else if(n%10==0 || n%10==1 || n%10==6 || n%10==8){
    cout<<"pon\n";
  }
  else{
    cout<<"hon\n";
  }
}

Measured memory_bytes: 3632
#![allow(non_snake_case)]
use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    use std::collections::{HashMap, HashSet};
    let mut map: HashMap<usize, usize> = HashMap::new();
    let N: usize = read();
    for i in 1..=N {
        let v: usize = read();
        map.insert(i, v);
    }
    let mut visited: HashSet<usize> = HashSet::new();
    let mut now = 1;
    visited.insert(1);
    let mut ans = 0;
    while let Some(&v) = map.get(&now) {
        ans += 1;
        if v == 2 {
            println!("{}", ans);
            return;
        } else if v == 1 || visited.get(&v).is_some() {
            break;
        }
        now = v;
        visited.insert(v);
    }
    println!("{}", -1);
}


Measured memory_bytes: 6500
S = input()
T = ['dream', 'dreamer', 'erase', 'eraser']

for i, t in enumerate(T):
    T[i] = t[::-1]

cursor = 0
S = S[::-1]

while cursor < len(S):
    for t in T:
        if t == S[cursor:cursor+len(t)]:
            cursor += len(t)
            break
    else:
        print('NO')
        exit()

print('YES')

Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main(){
    int n, i, j, tmp, count = 0;
    cin >> n;
    int array[n];
    for(i = 0; i < n; i++) cin >> array[i];
    for(i = 0; i < n; i++){
        for(j = n-1; j > i; j--){
            if(array[j] < array[j-1]){
                tmp = array[j];
                array[j] = array[j-1];
                array[j-1] = tmp;
                count++;
            }
        }
    }
    for(i = 0; i < n-1; i++) cout << array[i] << " ";
    cout << array[i] << endl << count << endl;
    return 0;
}


Measured memory_bytes: 3100
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,h[100005];
ll dp[100005];
 
int main()  {

  int n,colm, row;
  // 空白文字で区切られた数字を 3 つ取得
  std::cin >> n;
  std::cin >> colm;
  std::cin >> row;
  int i,j,ans;
  ans = 0;
  //printf("n=%d,colm=%d,row=%d\n", n,colm,row);
  for (i=0;i<n;i++){
  	for (j=0;j<n;j++){
    	if((i+row <= n) && (j+colm <= n)){
			ans++;
			//printf("j=%d,i=%d\n",j,i);
		}
    }
  }	
  
  printf("%d\n",ans);
   
}

Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let N = get!(usize);
    let mut ds = {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<usize>().unwrap())
                .collect::<Vec<_>>()
        };
    ds.sort();
    let min = ds[N/2-1]+1;
    let max = ds[N/2];
    if min > max {
        println!("0");
        return;
    }
    println!("{}", max - min + 1);
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

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

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

ll K, N, A[1000010];

signed main(){
    cin >> K >> N;
    REP(i, N) cin >> A[i];
    ll ans = K - A[0] - (K - A[N - 1]);
    REP(i, N - 1){
        ans = min(ans, K - (A[i + 1] - A[i]));
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define dump(x)  cout << #x << " = " << (x) << endl;

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
//             0123456789 - digits. check the limits, int vs long
const int MX = 100001;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;
    // freopen("ex.in","r",stdin);
    // freopen("ex.out","w",stdout);
    int n;
    cin >> n;
    int a[n];
    int mx = 0;
    int curCombo = 0;
    int cur, prev;
    cin >> prev;
    for (int i = 1; i < n; i++){
        cin >> cur;
        if (cur <= prev) {
            curCombo++;
        } else {
            mx = max(mx, curCombo);
            curCombo = 0;
        }
        prev = cur;
    }
    mx = max(mx, curCombo);
    cout << mx << "\n";
    return 0;
}

Measured memory_bytes: 256
N = int(input())
B_list = [int(i) for i in input().split()]
A_list = [10000000] * N

for i in range(len(B_list)) :
    B = B_list[i]
    if (min(B,A_list[i]) == B) :
        A_list[i] = B
    
    A_list[i+1] = B

# print(A_list)
print(sum(A_list))


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

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n)
    {
        if(n & 1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return result;
}

struct HASH{
  size_t operator()(const pair<long long,long long>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};

const double N=1e9;

int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    IOS

    int n;
    cin>>n;
    double s[n];
    for(int i=0;i<n;i++)
    	cin>>s[i];

    ll b[n]={0};

    for(int i=0;i<n;i++)
    	b[i] = llround(s[i]*N);

    unordered_map<pair<ll,ll>,ll,HASH> mp;
    for(int i=0;i<n;i++)
    {
    	ll two=0,five=0;
    	while(b[i] && (b[i]%2==0))
    	{
    		b[i]/=2;
    		two++;
    	}

    	while(b[i] && (b[i]%5==0))
    	{
    		b[i]/=5;
    		five++;
    	}

    	mp[{two,five}]++;
    }

    ll ans=0;
    for(auto x1:mp)
    {
    	for(auto x2:mp)
    	{
    		if(x1.first.first+x2.first.first>=18 && x1.first.second+x2.first.second>=18)
    		{
    			if(x1<x2)
    				ans+=x1.second*x2.second;
    			else if(x1==x2)
    				ans+=(x1.second*(x1.second-1))/2;
    		}	
    	}
    }

    cout<<ans<<endl;

    
    return 0;
}

Measured memory_bytes: 6860
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  int s,a=0,b=0;
  cin>>s;
  if(s/100<=12&&s/100!=0) a++;
  if(s%100<=12&&s%100!=0) b++;
  if(a==0&&b==0) cout<<"NA"<<endl;
  else if(a==1&&b==1) cout<<"AMBIGUOUS"<<endl;
  else if(a==0&&b==1) cout<<"YYMM"<<endl;
  else cout<<"MMYY"<<endl;
}


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

int main(int argc, char* argv[]) {
  int* n;
  n = new int[3];
  for ( int i = 0; i < 3; i++) cin >> n[i];
  sort(n, n + 3);

  cout << n[0] << " " << n[1] << " " << n[2] << endl;

  return 0;
}

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

using namespace std;
typedef long long ll;

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

  int x, a, b;
  cin >> x >> a >> b;

  if (abs(x - a) < abs(x - b)) cout << "A" << "\n";
  else cout << "B" << "\n";
}


Measured memory_bytes: 3592
using System;
using System.Collections.Generic;

namespace AtCoder_
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] array = { 0, 0, 0, 0, 0 };

            array[0] = int.Parse(Console.ReadLine());
            array[1] = int.Parse(Console.ReadLine());
            array[2] = int.Parse(Console.ReadLine()); 
            array[3] = int.Parse(Console.ReadLine());
            array[4] = int.Parse(Console.ReadLine());

            int sum = 0;
            int min = 10;

            for(int i=0; i<5; i++)
            {
                int amari = array[i] % 10;
                if (amari != 0)
                {
                    if (amari < min)
                    {
                        min = amari;
                    }
                    sum = sum + array[i] - amari + 10;
                }
                else
                {
                    sum += array[i];
                }
            }
            sum = sum + min - 10;

            Console.WriteLine(sum);

            

        }
        static void MainStream()
        {

        }
    }
}


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

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)

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

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

int main() {
	int n;cin>>n;
	int a[N];
	rep(i,n) cin>>a[i];
	int l=0,r=0;
	int s=a[0];
	ll ans=1LL;
	while(l<n-1||r<n-1){
		if(r<n-1&&s+a[r+1]==(s^a[r+1])){
			ans++;
			s+=a[r+1];
			r++;
		}
		else if(r>l){
			ans+=r-l;
			s-=a[l];
			l++;
		}
		else{
			ans++;
			l++;
			r++;
			s=a[l];
		}
	}
	cout<<ans<<endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()

const int MAX = 1e5+10;

int N;
vii edge[MAX];
int color[MAX];

void dfs(int n, int c) {
    int col = 1;
    FORE (e, edge[n]) {
        int i = e.first, b = e.second;
        if (color[i] != 0) continue;
        while (col == c) col++;
        color[i] = col+1;
        dfs(b, col);
        col++;
    }
}

void solve() {
    int max_color = 0;
    REP (i, N) max_color = max(max_color, (int)edge[i].size());
    dfs(0, 0);

    cout << max_color << endl;
    REP (i, N-1) cout << color[i]-1 << endl;
}

int main() {
    cin >> N;
    int ans = 0;
    REP (i, N-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        edge[a].PB(MP(i, b)); edge[b].PB(MP(i, a));
    }
    solve();
}

Measured memory_bytes: 8704
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Beg086C
{
    class Program
    {
        static void Main(string[] args)
        {
            var yes = "Yes";
            var no = "No";
            var N = int.Parse(Console.ReadLine());
            var ts = new int[N+1];
            var xs = new int[N+1];
            var ys = new int[N+1];
            ts[0] = 0;
            xs[0] = 0;
            ys[0] = 0;
            var tooFar = false;
            var nonParity = false;
            for (int i =1;i<N + 1;i++)
            {
                var s = Console.ReadLine().Split(' ').Select(s0 => int.Parse(s0)).ToArray();
                ts[i] = s[0];
                xs[i] = s[1];
                ys[i] = s[2];
                tooFar = ts[i] - ts[i - 1] < Math.Abs(xs[i] - xs[i - 1]) + Math.Abs(ys[i] - ys[i - 1]);
                nonParity = (ts[i] - ts[i - 1]) % 2 == 0 ? (xs[i] + ys[i] + xs[i - 1] + ys[i - 1]) % 2 != 0 :
                                                           (xs[i] + ys[i] + xs[i - 1] + ys[i - 1]) % 2 != 1;
                if (tooFar||nonParity)
                {
                    Console.WriteLine(no);
                    break;
                }
            }
            if (!(tooFar || nonParity))
                Console.WriteLine(yes);


        }
    }
}


Measured memory_bytes: 16352
// {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

#ifdef SHIK
template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, __VA_ARGS__); \
} while (0)

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T, size_t N>
ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
#else
#define dump(...)
#endif

template<typename T>
void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( long long &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }

void R() {}
template<typename T, typename... U>
void R( T& head, U&... tail ) {
    _R(head);
    R(tail...);
}

template<typename T>
void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
template<typename T>
void _W( const vector<T> &x ) {
    for ( auto i=x.cbegin(); i!=x.cend(); i++ ) {
        if ( i!=x.cbegin() ) putchar(' ');
        _W(*i);
    }
}

void W() {}
template<typename T, typename... U>
void W( const T& head, const U&... tail ) {
    _W(head);
    putchar(sizeof...(tail)?' ':'\n');
    W(tail...);
}

#ifdef SHIK
#define FILEIO(...)
#else
#define FILEIO(name) do {\
    freopen(name ".in","r",stdin); \
    freopen(name ".out","w",stdout); \
} while (0)
#endif

// }}}

char s[20];
LL ans;
void go( int p, LL x, LL z ) {
    dump(p,x,z);
    if ( !s[p] ) {
        ans+=x+z;
        return;
    }
    go(p+1,x*10+s[p]-'0',z);
    go(p+1,s[p]-'0',z+x);
}

int main() {
    R(s);
    go(0,0,0);
    W(ans/2);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

char in[7][7];
int main() {
	int N = 2, M = 3, i, j;
	for (i = 0; i < N; i++) scanf("%s", in[i]);

	for (i = 0; i < N; i++) {
		for (j = 0; j < M; j++) {
			if (in[i][j] != in[N - 1 - i][M - 1 - j]) return !printf("NO\n");
		}
	}
	return !printf("YES\n");
}

Measured memory_bytes: 256
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
//#define MOD (ll)(998244353)
#define MOD (ll)(1e9+7)
#define INF (1e15)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int dp[100010][13];

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	string s; cin>>s;
	memset(dp,0,sizeof(dp));
	if(s[0]=='?')
		For(i,0,12) dp[0][i]=(i<10);
	else
		For(i,0,12) dp[0][i]=(i==s[0]-'0');
	int n=sz(s);
	For(i,1,n-1){
		if(s[i]=='?'){
			For(j,0,9) For(k,0,12){
				dp[i][(k*10+j)%13]+=dp[i-1][k];
			}
		}
		else{
			For(k,0,12){
				dp[i][(k*10+s[i]-'0')%13]+=dp[i-1][k];
			}
		}
		For(k,0,12) dp[i][k]%=MOD;
	}
	cout<<dp[n-1][5]<<"\n";
	return 0;
}

Measured memory_bytes: 10624
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

vector<int> tims;
int mn=INF;

int ck(int d){
    int res=INF;
    for(auto t:tims) chmin(res,min(abs(t-d),24-abs(t-d)));
    return res;
}

void ins(int d){
    int res;
    if(d!=0&&d!=12){
        if(ck(d)<ck(24-d)) d=24-d;
    }
    res=ck(d);
    tims.push_back(d);
    chmin(mn,res);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    
    map<int,int> dic;
    rep(i,N){
        int d;cin>>d;
        dic[d]++;
    }
    
    tims.push_back(0);
    for(auto a:dic){
        int d=a.first;
        int n=a.second;
        if(n>=3){
            mn=0;break;
        }
        if(n>=2) ins(d);
        if(n>=1) ins(d);
    }
    cout1(mn)
}

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

void solve(){
    if(tp>=30) {
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

int main(){
    cin>>tp;

    solve();
    return 0;
}


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

using namespace std;

#define long long long
#define INF 2e18
#define MOD (long) (998244353)

int main()
{
    long t = 1;
    //cin >> t;

    while (t--) {
        long a, b;
        cin >> a >> b;

        printf("%lld\n", a*b);
    }
}


Measured memory_bytes: 3720
import bisect

n=int(input())
arr=list(map(int,input().split()))
acum=[0]
for i in range(n):
  acum.append(acum[-1]+arr[i])
ans=10**18
for i in range(2,n-1):
  suma=acum[i]
  sumb=acum[n]-suma
  posa=bisect.bisect_right(acum,suma//2)
  diffa=10**18
  if posa>=2:
    mina=min(acum[posa-1],acum[i]-acum[posa-1])
    maxa=max(acum[posa-1],acum[i]-acum[posa-1])
    diffa=maxa-mina
  if posa!=i:
    tmina=min(acum[posa],acum[i]-acum[posa])
    tmaxa=max(acum[posa],acum[i]-acum[posa])
    tdiffa=tmaxa-tmina
    if tdiffa<diffa:
      diffa=tdiffa
      mina=tmina
      maxa=tmaxa
  posb=bisect.bisect_right(acum,suma+sumb//2)
  diffb=10**18
  if posb>=i+2:
    minb=min(acum[posb-1]-acum[i],acum[n]-acum[posb-1])
    maxb=max(acum[posb-1]-acum[i],acum[n]-acum[posb-1])
    diffb=maxb-minb
  if posa!=n+1:
    tminb=min(acum[posb]-acum[i],acum[n]-acum[posb])
    tmaxb=max(acum[posb]-acum[i],acum[n]-acum[posb])
    tdiffb=tmaxb-tminb
    if tdiffb<diffb:
      diffb=tdiffb
      minb=tminb
      maxb=tmaxb
  ans=min(ans,max(maxa,maxb)-min(mina,minb))
print(ans)

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

using namespace std;

using ull = unsigned long long;

template<typename T>
constexpr T GCD(T a, T b) {
    return (a % b ? GCD(b, a % b) : b);
}

template<typename T>
constexpr T LCM(T a, T b) {
    return a * b / GCD(a, b);
}

struct Task{
        ull A, B;
    };

int main() {
    int N;
    ull elapsed = 0;
    cin >> N;
    vector<Task> task(N);
    for(int i = 0; i < N; ++i) {
        cin >> task[i].A >> task[i].B;
    }
    sort(task.begin(), task.end(), [&](Task x, Task y){
        return (x.B < y.B);
    });
    for(auto t : task) {
        elapsed += t.A;
        if(t.B < elapsed){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3328