akhauriyash/Code-Regression huggingface dataset:
// B

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};

int main(){
  string s;
  cin>>s;
  for (int i(0);i<s.size()-1;i++){
    for (int j(i);j<s.size();j++){
      //iからjまでを取り除く
      string t = s;
      //cout << i << j << endl;
      for (int k(i);k<j;k++){
        t.erase(t.begin() + i);
      }
      if (t == "keyence"){
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
}




Measured memory_bytes: 256
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
f=[int(i) for i in input().split()]

a.sort()
f.sort(reverse=True)

def score(x):
    syugyo = 0
    for A,F in zip(a,f):
        sup = x//F
        if sup < A:
            syugyo += A-sup
    if syugyo <= k:
        return True
    return False


left = 0
right = a[-1]*f[0]+1
while left < right-1:
    mid = (left+right)//2
    if score(mid):
        right = mid
    else:
        left = mid
print(left+1 if left != 0 else 0)


Measured memory_bytes: 32788
#include <stdio.h>
int main() {
	int a[10],i,b[3];
	for (i = 0; i < 10; i++) scanf("%d", &a[i]);
	for (i = 0; i < 3; i++) b[i] = 0;
	for (i = 0; i < 10; i++) {
		if (b[0] < a[i]) {
			b[2] = b[1];
			b[1] = b[0];
			b[0] = a[i];
		}
		else if (b[1] < a[i]){
			b[2] = b[1];
			b[1] = a[i];
		}
		else if (b[2] < a[i]){
			b[2] = a[i];
		}
	}
	for (i = 0; i < 3; i++){
		printf("%d", b[i]);
		putchar('\n');
	}
	
	return(0);
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
#include<array>
#define nguyendz the_best


#define ll long long
#define ld long double
#define pb push_back
#define all(n) n.begin(),n.end()
#define eb emplace_back
#define endl "\n"
#define pll pair<ll,ll>
#define YES cout <<"YES"<<endl;
#define NO cout <<"NO"<<endl;
#define ff first
#define ss second
#define setpre(x) fixed<<setprecision(x)


using namespace std;
const ll maxn=2e5+100;
vector<ll> adj[maxn];

ll a[maxn];
ll st[4*maxn];

ll st1[4*maxn];
ll  get(ll id,ll left,ll right,ll x,ll y)
{
    if (left>y||right<x)
        return 0;
    if (x<=left&&right<=y)
    {
        return st[id];
    }
    ll mid =(left+right)/2;
    return max(get(id*2,left,mid,x,y),get(id*2+1,mid+1,right,x,y));

}

void update(ll id,ll left,ll right, ll pos,ll diff)
{
    if (pos<left||pos>right)
        return ;
    if (left==right)
    {
        st[id]=diff;
        return;
    }
    ll mid =(left+right)/2;
    update(id*2,left,mid,pos,diff);
    update(id*2+1,mid+1,right,pos,diff);
    st[id]=max(st[id*2],st[id*2+1]);

}
ll  getmn(ll id,ll left,ll right,ll x,ll y)
{
    if (left>y||right<x)
        return INT_MAX;
    if (x<=left&&right<=y)
    {
        return st1[id];
    }
    ll mid =(left+right)/2;
    return min(getmn(id*2,left,mid,x,y),getmn(id*2+1,mid+1,right,x,y));

}

void updatemn(ll id,ll left,ll right, ll pos,ll diff)
{
    if (pos<left||pos>right)
        return ;
    if (left==right)
    {
        st1[id]=diff;
        return;
    }
    ll mid =(left+right)/2;
    updatemn(id*2,left,mid,pos,diff);
    updatemn(id*2+1,mid+1,right,pos,diff);
    st1[id]=min(st1[id*2],st1[id*2+1]);

}
ll par[maxn];
ll find_par(ll u)
{
    if (u==par[u])
        return u;
    return par[u]=find_par(par[u]);
}
void dsu(ll a, ll b)
{
    ll u=find_par(a);
    ll v=find_par(b);
    if (u!=v)
    {
        par[u]=v;
    }
}
ll dd[maxn];
ll dd1[maxn];
map<vector<ll> , ll > mp;
ll b[maxn];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//   freopen("test.txt","r",stdin);
    //  freopen("PAINT.INP", "r", stdin);
    // freopen("PAINT.OUT", "w", stdout);

   ll n,k ;
    cin>> n>>k ;
    ll ans=0 ;
    for (int i=1; i<=n; i++)
        par[i]=i,dd1[i]=0,dd[i]=0;
    for (int i=1; i<=n; i++)
    {
        cin>>a[i];
        update(1,1,n,i,a[i]);
        updatemn(1,1,n,i,a[i]);
    }
    bool x=false;
    ll pre;
    for (int i=1; i<=n;)
    {
        ll j=i;
        while (j<n&&a[j+1]>a[j])
            j++;
        ll kc= j-i+1;
        for (int t=0; t<=kc-k; t++)
        {
            dd[i+t]=1;
            pre=i+t;
        }
        i=j+1;
    }
    for (int i=1; i<=n; i++)
    {
        if(dd[i])
        {
              dsu(i,pre);
        }
    }
    for (int i=k+1; i<=n; i++)
    {

        ll t= i-k;
        ll mn= getmn(1,1,n,t,i);
        ll mx= get(1,1,n,t,i);

        if (mx==a[i]&&mn==a[t])
        {
            dsu(t,t+1);

        }
    }
    for (int i=1; i<=n-k+1; i++)
    {
        ll u=find_par(i);
        //cout <<u<<" "<<i<<endl;
        if (!dd1[u])
        {
            dd1[u]=1;
            ans++;
        }
    }
    cout <<ans;

}


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

int main(){
    int N, M;
    int tr[21][21];
    while(true){
        scanf("%d", &N);
        if(N == 0) break;
        for(int i = 0; i <= 20; i++){
            fill(tr[i], tr[i] + 21, 0);
        }
        for(int i = 0; i < N; i++){
            int x, y;
            scanf("%d%d", &x, &y);
            tr[x][y] = 1;
        }
        scanf("%d", &M);
        int cnt = 0;
        int rx = 10, ry = 10;
        for(int i = 0; i < M; i++){
            char d; int s;
            scanf(" %c%d", &d, &s);
            int dx, dy;
            if(d == 'N'){
                dx = 0, dy = 1;
            }else if(d == 'E'){
                dx = 1, dy = 0;
            }else if(d == 'S'){
                dx = 0, dy = -1;
            }else{
                dx = -1, dy = 0;
            }
            while(s--){
                rx += dx;
                ry += dy;
                if(tr[rx][ry] == 1){
                    tr[rx][ry] = 0;
                    cnt += 1;
                }
            }
        }
        if(cnt == N){
            puts("Yes");
        }else{
            puts("No");
        }
    }
    return 0;
}

Measured memory_bytes: 1168
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <limits>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

int main()
{
    ll X, N;
    scanf("%lld %lld", &X, &N);

    map<ll, ll> num;
    for (ll i = 0; i < N; i++)
    {
        ll p;
        scanf("%lld", &p);
        num[p] = 1;
    }

    ll ans;
    for (ll i = 0; i < 100; i++)
    {
        if (num[X - i] == 0)
        {
            ans = X - i;
            break;
        }
        else if (num[X + i] == 0)
        {
            ans = X + i;
            break;
        }
    }

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


Measured memory_bytes: 3800
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define rep(i,m,n) for(int i = (m);i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
#define Vec(a) vector <int> a
#define F first
#define S second
const int INF = 1 << 20;
const int MOD = 1e9+7;

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



int main(){

    ll n,m;
    cin >> n >> m;
    string s,t;
    cin >> s;
    cin >> t;
    if(s[0] != t[0]){
        cout << -1 << endl;
        return 0;
    }
    ll l = 1;
    ll gg,gd;
    gd = gcd(n,m);
    gg = (n*m)/gd;
    if(gg == n){
        ll a = gg / m;
        bool f = true;
        rep(i,1,m){
            if(t[i] != s[a*i]){
                f = false;
            }
        }
        if(!f){
            cout << -1 << endl;
            return 0;
        }
    }
    if(gg == m){
        ll a = gg / n;
        bool f = true;
        rep(i,1,n){
            if(s[i] != t[a*i]){
                f = false;
            }
        }
        if(!f){
            cout << -1 << endl;
            return 0;
        }
    }
    vector <ll> a;
    ll  as = gg / m;
    ll  at = gg/n;
    bool f = true;
    for(int i = 1;i < min(n/as,m/at)+1;i++){
        if(s[as*i] != t[at*i]){
            f = false;
        }

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

    

    return 0;
}


Measured memory_bytes: 512
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int box[] = new int[9];
    int N = sc.nextInt();
    
    for(int i = 0;i < 9;i++){
      box[i] = 0;
    }
    
    for(int i = 0;i < N;i++){
      int s = sc.nextInt();
      if(3200 <= s){
        box[8]++; 
      }else if(2800 <= s){
        box[7]++; 
      }else if(2400 <= s){
        box[6]++; 
      }else if(2000 <= s){
        box[5]++; 
      }else if(1600 <= s){
        box[4]++; 
      }else if(1200 <= s){
        box[3]++; 
      }else if(800 <= s){
        box[2]++; 
      }else if(400 <= s){
        box[1]++; 
      }else{
        box[0]++; 
      }
    }
    int min = 0;
    int max = 0;
    for(int i = 0;i < 8;i++){
      if(box[i] > 0)min++;
    }
    max = min+box[8];
    if(min == 0){
      min = 1;
    }
    System.out.println(min+" "+max);
  }
}

Measured memory_bytes: 22868
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;

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

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

const long long int mod=1e9+7;



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

	for(int i=X-K+1;i<X+K;++i){
		if(i>=-1000000 && i<=1000000) cout << i << " ";
	}

	cout << endl;


	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mk make_pair
#define int long long
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
bool vis[100000];
main(){
  int n,m,s,t,x,y;
  cin>>n>>m>>s>>t;
  s--;t--;
  vector<int> v[100000];
  set<pair<int,int> >ss;
  r(i,m){
    cin>>x>>y;
    x--;y--;
    ss.insert(mk(x,y));
    ss.insert(mk(y,x));
    v[x].push_back(y);
    v[y].push_back(x);
  }
  int s1[n],t1[n];
  memset(s1,1e6,sizeof(s1));
  memset(t1,1e6,sizeof(t1));
  queue<pair<int,int> >q;
  q.push(mk(s,0));
  vis[s]=1;
  while(!q.empty()){
    pair<int,int>p=q.front();q.pop();
    s1[p.first]=p.second;
    int pp=p.first;
    r(i,v[pp].size()){
      if(!vis[v[pp][i]]){
    vis[v[pp][i]]=1;
    q.push(mk(v[pp][i],p.second+1));
      }
    }
  }
  memset(vis,0,sizeof(vis));
  q.push(mk(t,0));
  vis[t]=1;
  while(!q.empty()){
    pair<int,int>p=q.front();q.pop();
    t1[p.first]=p.second;
    int pp=p.first;
    r(i,v[pp].size()){
      if(!vis[v[pp][i]]){
    vis[v[pp][i]]=1;
    q.push(mk(v[pp][i],p.second+1));
      }
    }
  }
  int po=s1[t],cc=0;
  vector<int> d[100000];
  r(i,n)if(s1[i]<n)d[s1[i]].push_back(i);
  r(i,n)if(t1[i]<n){
    int tt=po-t1[i]-2;
    if(tt>-1)cc+=d[tt].size();
  }
  cout<<cc<<endl;
}

Measured memory_bytes: 40668
N = gets.to_i
arr = gets.split.map(&:to_i)
count = 0
# binding.pry
catch :done do
  loop do
    arr.each_index do |i|
      throw :done if (arr[i] % 2) != 0
      arr[i] /= 2
    end
    count += 1
  end
end
puts count

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n, k;
  cin >> n >> k;
  vll p(n + 1);
  rep(i, k) {
    ll d;
    cin >> d;
    vll a(d);
    rep(j, d) {
      ll a;
      cin >> a;
      p[a] = 1;
    }
  }

  ll ans = 0;
  REP(i, n + 1) {
    if (p[i] == 0) {
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3664
S=str(input())
P=str(input())

A=S.count(P)

if A==0:
    B=S+S
    C=B.count(P)
    if C==0:
        Q=0
    else:
        Q=C
else:
    Q=A
    


if Q==0:
    print('No')
    
else:
    print('Yes')


Measured memory_bytes: 5556
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    a, b, c, x, y = MI()

    ans = 0
    if a + b <= 2 * c:
        mn = min(x, y)
        ans = a * mn + b * mn + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)

    else:
        mn = min(x, y)
        ans = mn * 2 * c + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)

    print(ans)



if __name__ == '__main__':
    solve()


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

int a,b;

int main(){
	cin >> a >> b;
	int t1 = a*60 + b;
	cin >> a >> b;
	int t2 = a*60 + b;
	cin >> a;
	printf("%d\n",max(0,t2-t1-a));
	return 0;
}


Measured memory_bytes: 3760
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){

	int N;

	int check = 1;
	int count = 0;
	scanf("%d",&N);
	int a[N];

	for(int i=1; i<N+1; i++){
		scanf("%d",&a[i]);
	}

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

	}

	while(check != 2){
		check = a[check];
		count ++;
		if(count > N){
			printf("%d",-1);
			return 0;
		}
	}

	printf("%d",count);
	return 0;
}

Measured memory_bytes: 512
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

struct rest
{
	char oras[20];
	int scor, poz;
};

bool comp(rest a, rest b)
{
	if (strcmp(a.oras, b.oras) == 0)
		return a.scor > b.scor;
	return (strcmp(a.oras, b.oras) < 0);
}

int n;
rest v[105];

int main()
{
	int i;

	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> v[i].oras >> v[i].scor;
		v[i].poz = i;
	}
	sort(v + 1, v + 1 + n, comp);
	for (i = 1; i <= n; i++)
		cout << v[i].poz << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll A, B;
    cin >> A >> B;

    ll res = 0;

    if(B<100 or B-A<100){
        for(ll i=A;i<=B;i++) res ^= i;
    }else{
        REP(i, 4-A%4){
            res ^= (A+i);
            dump(A+i)
        }
        ll K = B%4+1;
        REP(i, K){
            dump(i)
            res ^= (B-i);
            dump(B-i)
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::{min, max};
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn gcd(mut a: i32, mut b: i32) -> i32 {
    while b != 0 {
        let r = a % b;
        a = b; b = r;
    }
    a
}
fn lcm(x: i32, y: i32)->i32{
    return x /gcd(x, y) * y;
}
fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!{
        n: usize, m:usize,
        a: [(usize, usize); m], 
    }
    let mut first = vec![false; n + 5];
    let mut second = vec![false; n + 5];
    for i in 0..m{
        if a[i].0 == 1{
            first[a[i].1] = true; 
        }
        if a[i].1 == n{
            second[a[i].0] = true;
        }
    }
    let mut flag = false;
    for i in 0..n{
        if first[i] && second[i]{
            flag = true;
        }
    }
    if flag{
        puts!("POSSIBLE\n");
    }else{
        puts!("IMPOSSIBLE\n");
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}




Measured memory_bytes: 12540
#include<iostream>
#define m 52000
using namespace std;

bool ba[m + 1] = { true };
void cp() {
	int co = 0;
	for (int i = 0; i < m + 1; i++) {
		ba[i] = { true };
	}
	for (int i = 2; i*i <= 52000; i++) {
		if (ba[i]) {
			for (int j = i*i; j <= 52000; j += i) {
				ba[j] = { false };
			}
		}
	}

	return;
}

int main() {
	int n;
	cp();
	while (cin >> n, n) {
		int c = 0;
		for (int i = 2;i <= n / 2;i++) {
			int j = n - i;
			if (ba[i] == true && ba[j] == true)c++;
		}
		cout << c << endl;
	}
	return 0;
}

Measured memory_bytes: 3056
# abc128 C
import itertools
n,m = map(int, input().split()) # n個のスイッチとm個の電球

# index i のスイッチとつながる電球がconnect[i]に格納される
connect = []

for i in range(m):
    condi = list(map(int, input().split()))[1:]
    connect.append(condi)
        
    
state = list(itertools.product([0,1], repeat = n))

ans = input().split()

def abc128c(n, m, state, condi, ans):
    pika = [0 for i in range(m)]
    for i in range(m):
        
        on_off = 0
        for j in condi[i]:
            on_off += state[j-1]
        if on_off % 2 == ans[i]:
            pika[i] = 1
    output = 0
    
    if pika == [1 for i in range(m)]:
        output =1
    
    
    return output

# print(abc128c(2, 2, (1,1), [[1,2], [2]], [0,1]))
# abc128c(n, m, a, connect, list(map(int, ans)))
count = 0
for a in state:
    count += abc128c(n, m, a, connect, list(map(int, ans)))
    
print(count)

Measured memory_bytes: 3188
#include <stdio.h>
int main()
{
    char ch;
    int cnt[500];
    for (int i = 0; i < 500; i++){
        cnt[i] = 0;
    }
    while (scanf(" %c", &ch) != EOF){
        if (ch >= 'A' && ch <= 'Z'){
            ch += 'a' - 'A';
        }
        cnt[ch]++;
    }
    for (int i = 'a'; i <= 'z'; i++){
        printf("%c : %d\n", i, cnt[i]);
    }
    return 0;
}


Measured memory_bytes: 2076
// D - Div Game
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	ll ans = 0, N; cin>>N;
	for(ll c, p=2; p*p<=N; ++p){
		for(c=0; N%p==0; ++c) N/=p;
		for(ll i=1; c>0; i++){
			c -= i;
			if(c >= 0) ans++;
		}
	}
	if(N > 1) ans++;
	cout<< ans <<endl;
}


Measured memory_bytes: 3648
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const (
	maxBufsize = 1000000
)

func inputs(lines int, rdr *bufio.Reader) []string {
	var strSlice []string

	//rdr := bufio.NewReaderSize(os.Stdin, maxBufsize)

	for i := 0; i < lines; i++ {

		line := ReadLine(rdr)
		strSlice = append(strSlice, line)

	}

	return strSlice
}

// ReadLine is to read long line
func ReadLine(rdr *bufio.Reader) string {
	buf := make([]byte, 0, maxBufsize)
	for {
		l, p, e := rdr.ReadLine()

		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}

	return string(buf)
}

func main() {
	rdr := bufio.NewReaderSize(os.Stdin, maxBufsize)
	line0 := inputs(1, rdr)

	tmp0 := strings.Split(line0[0], " ")
	N, _ := strconv.Atoi(tmp0[0])
	K, _ := strconv.Atoi(tmp0[1])

	lineD := inputs(2*K, rdr)

	A := make([]int, N+1)

	count := 0

	for i := 0; i < K; i++ {
		tmpAi := strings.Split(lineD[2*i+1], " ")

		for j := 0; j < len(tmpAi); j++ {
			Aij, _ := strconv.Atoi(tmpAi[j])

			if A[Aij] == 0 {
				A[Aij]++

			}
		}
	}

	for i := 1; i < N+1; i++ {
		if A[i] == 0 {
			count++
		}
	}
	fmt.Println(count)
}


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

int main()
{
	ull a,b,k;
	cin>>a>>b>>k;
	if (a>k)
		cout<<a-k<<' '<<b;
	else
		if (b>k-a)
			cout<<0<<' '<<a+b-k;
		else
			cout<<0<<' '<<0;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int[] h = new int[n];
		for (int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		int cnt = 0;
		int max = 0;
		for (int i = n - 1; i >= 1; i--) {
			if (h[i] <= h[i - 1]) {
				cnt++;
				max = Math.max(max, cnt);
			} else {
				cnt = 0;
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 50320
#include <iostream>
#include <memory>
#include <memory.h>
#include <cmath>
#include <fstream>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>
#define USE_MATH_DEFINES
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 30;
const double EPS = 1E-9;

typedef pair<xy_t, bool> dat;

namespace std{
	bool operator < (const xy_t &a, const xy_t &b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a)*b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

int ccw(xy_t a, xy_t b, xy_t c){
	b -= a; c -= a;
	if(cross(b, c) > EPS) return +1;
	if(cross(b, c) < EPS) return -1;
	if(dot(b, c) < 0) return  +2;
	if(norm(b) < norm(c)) return -2;
	return 0;
}

bool intersectSS(const line &s, const line &t){
	return ccw(s.first, s.second, t.first) *
		ccw(s.first, s.second, t.second) <= 0 &&
		ccw(t.first, t.second, s.first) * 
		ccw(t.first, t.second, s.second) <= 0;
}

xy_t crosspoint(const line &l1, const line &l2){
	double a = cross(l1.second - l1.first, l2.second - l2.first);
	double b = cross(l1.second - l1.first, l1.second - l2.first);
	return l2.first + b / a * (l2.second - l2.first);
}

int main(){
	int t;
	cin >> t;
	while(t--){
		int n;
		double xa, ya, xb, yb;
		cin >> xa >> ya >> xb >> yb;
		line l1(xy_t(xa, ya), xy_t(xb, yb));
		cin >> n;
		vector<dat> vd;

		for(int i = 0; i < n; i++){
			double xs, ys, xt, yt;
			int o, l;
			cin >> xs >> ys >> xt >> yt >> o >> l;
			line l2(xy_t(xs, ys), xy_t(xt, yt));
			if(intersectSS(l1, l2)){
				vd.push_back(dat(crosspoint(l1, l2), l ^ o));
			}
		}
		sort(vd.begin(), vd.end());
		int res = 0;
	//	cout << vd[0].first << endl;
		for(int i = 0; i < (int)vd.size() - 1; i++){
			if(vd[i].second != vd[i+1].second) res++;
	//		cout << vd[i+1].first << endl;
		}
		cout << res << endl;
	}
	return 0;
}

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

int main(){
  int count=0;
  int A;
  string S;
  cin>>S;
  A=(int)S.length();
  rep(i,A/2){
    if(S[i]!=S[A-i-1]){
      count++;
    }
  }
  cout<<count;
}
  

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n--){
        string str;
        cin>>str;
        bool fin=false;
        for(int i = 1; i < str.size(); i++){
            if(str[i]==str[i-1]){
                fin=true;
                break;
            }
        }
        if(fin){
            cout<<"No"<<endl;
            continue;
        }
        char l,r;
        l='L';r='R';
        // ツ右ツ堕ォツつゥツづァ
        if(str[0]=='R'){
            for(int i = 1; i < str.size(); i++){
                if(i%2==1)
                    l=str[i];
                else
                    r=str[i];
                // ツ妥δ督鳴青ォツ板サツ津ィ
                if((l=='U'&&r=='L')||(l=='R'&&r=='U')||(l=='R'&&r=='L')){
                    fin=true;
                    break;
                }
            }
            if(fin){
                cout<<"No"<<endl;
                continue;
            }
        }
        // ツ債カツ堕ォツつゥツづァ
        else if(str[0]=='L'){
            for(int i = 1; i < str.size(); i++){
                if(i%2==1)
                    r=str[i];
                else
                    l=str[i];
                // ツ妥δ督鳴青ォツ板サツ津ィ
                if((l=='U'&&r=='L')||(l=='R'&&r=='U')||(l=='R'&&r=='L')){
                    fin=true;
                    break;
                }
            }
            if(fin){
                cout<<"No"<<endl;
                continue;
            }
        }
        else{
            // u or dツつェツ催渉可づ個湘ェツ債づ債猟シツ堕ォツ篠篠つキ
            for(int i = 1; i < str.size(); i++){
                if(i%2==1)
                    l=str[i];
                else
                    r=str[i];
                // ツ妥δ督鳴青ォツ板サツ津ィ
                if((l=='U'&&r=='L')||(l=='R'&&r=='U')||(l=='R'&&r=='L')){
                    fin=true;
                    break;
                }
            }
            if(fin){
                fin=false;
                for(int i = 1; i < str.size(); i++){
                    if(i%2==1)
                        r=str[i];
                    else
                        l=str[i];
                    // ツ妥δ督鳴青ォツ板サツ津ィ
                    if((l=='U'&&r=='L')||(l=='R'&&r=='U')||(l=='R'&&r=='L')){
                        fin=true;
                        break;
                    }
                }
                if(fin){
                    cout<<"No"<<endl;
                    continue;
                }
            }
        }
        cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1048
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int X;
	int ans = 1;
	cin >> X;
	for (int i = 2; i <= X; i++) {
		int tmp = i * i;
		while (tmp <= X) {
			ans = max(ans, tmp);
			tmp *= i;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
function getLines(input){
	return input.split("\n").map((s)=>s.trim())
}
function parseLine(line){
	return line.split(" ").map((s)=>s.trim());
}
function parseLineToInt(line){
	return line.split(" ").map((s)=>parseInt(s.trim()));
}
// parameter "input" gets all data
function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.	
	var s = parseLineToInt(input)
	var a=s[0],b=s[1],k=s[2];
	var turn = true;
	while(k>0){
		if(turn){
			if(a%2==1){
				a--;
			}
			a/=2;
			b+=a;
		}else{
			if(b%2==1){
				b--;
			}
			b/=2;
			a+=b;
		}	
		turn=!turn
		k--;
	}
	console.log(a,b)
	
}
// Don't edit this line!
//Main(require("fs").readFileSync(__dirname+'/in.txt', "utf8"));
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
#include <stdio.h>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  double xA, yA, xB, yB, xC, yC, xD, yD;

  while ( scanf ( "%lf%lf%lf%lf%lf%lf%lf%lf",
            &xA, &yA, &xB, &yB, &xC, &yC, &xD, &yD ) == 8 )
  {
    puts ( ( xB - xA ) * ( xD - xC ) + ( yB - yA ) * ( yD - yC ) == 0.
         ? "YES"
         : "NO" );
  }

  return ( 0 );
}

Measured memory_bytes: 0
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String ans = "Yes";
		int N = sc.nextInt();
		long[] H = new long[N];
		for (int i = 0; i < N; i++) {
			H[i] = sc.nextLong();
		}
		long pre = 0;
		for (int i = 0; i < N; i++) {
			if (pre < H[i]) {
				pre = H[i] - 1;
			} else if (pre > H[i]) {
				ans = "No";
				break;
			}
		}
		System.out.println(ans);
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22100
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

#[allow(unused_macros)]
macro_rules! echo {
    ($($e:expr),+) => ( { $(println!("{}", $e))+ } );
}

fn dfs(
    idx: usize,
    cs: &Vec<Vec<usize>>,
    mut skills: Vec<usize>,
    c: usize,
    mut c_min: usize,
    n: usize,
    x: usize,
) -> isize {
    if idx >= n {
        if skills.iter().all(|&s| s >= x) {
            c_min = std::cmp::min(c, c_min);
            return c_min.clone() as isize;
        } else {
            return -1;
        }
    }

    let a = dfs(idx + 1, cs, skills.clone(), c, c_min, n, x);

    let c = c + cs[idx][0];
    for (i, s) in skills.iter_mut().enumerate() {
        *s += cs[idx][i + 1];
    }

    let b = dfs(idx + 1, cs, skills.clone(), c, c_min, n, x);

    if a != -1 && b != -1 {
        return std::cmp::min(a, b);
    } else if a == -1 && b == -1 {
        return -1;
    } else if a == -1 {
        return b;
    } else {
        return a;
    }
}

fn main() {
    input! {
        n: usize,
        m: usize,
        x: usize,
        cs: [[usize; m + 1]; n],
    }

    let ans = dfs(0, &cs, vec![0; m], 0, std::usize::MAX, n, x);

    echo!(ans);
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> candle(N);
  for (int &e : candle) cin >> e;
  int L = candle[0];
  int R = candle[K-1];
  int ans = R-L+min(abs(L), abs(R));
  for (int i = 0; i < N-K; i++) {
    L = candle[i+1];
    R = candle[K+i];
    int a = R-L+min(abs(L),abs(R));
    ans = min(ans, a);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void print() { cout << "\n"; }
template <class T, class... Args>
void print(const T &x, const Args &... args) { cout << x << " "; print(args...);}
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

struct info { int k, value; };


int n;
vector<int> A, dp, ans;
vector<vector<int> > G;
const int INF = 1001001001;

void dfs(int i, int par) {
  int k = lower_bound(all(dp), A[i]) - dp.begin();
  info c;
  if (k < n) {
    c = {k, dp[k]};
    dp[k] = A[i];
  }
  else c = {-1, -1};
  ans[i] = lower_bound(all(dp), INF) - dp.begin();
  for (auto to : G[i]) {
    if (to != par) dfs(to, i);
  }
  if (c.k != -1) {
    dp[k] = c.value;
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  cin >> n;
  A = vector<int>(n);
  rep(i,n) cin >> A[i];
  G = vector<vector<int> >(n);
  rep(i,n-1) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  } 
  ans = vector<int>(n);
  ans[0] = 1;
  dp = vector<int>(n+5, INF);
  dp[0] = A[0];
  for (auto to : G[0]) {
    dfs(to, 0);
  }
  rep(i,n) {
    cout << ans[i] << "\n";
  }
  return 0;
}

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


def main():
  N, A, B, C = map(int, input().split())
  values = [A, B, C]
  moves = [input().strip() for _ in range(N)] + ['AB']
  cmds = []

  for move, next_move in zip(moves[:-1], moves[1:]):
    if move == 'AB':
      i, j, lc, rc = 0, 1, 'A', 'B'
    elif move == 'AC':
      i, j, lc, rc = 0, 2, 'A', 'C'
    elif move == 'BC':
      i, j, lc, rc = 1, 2, 'B', 'C'

    if next_move == 'AB':
      ni, nj = 0, 1
    elif next_move == 'AC':
      ni, nj = 0, 2
    elif next_move == 'BC':
      ni, nj = 1, 2

    if values[i] == 0 and values[j] == 0:
      cmds = None
      break
    elif values[i] < values[j]:
      cmds.append(lc)
      values[i] += 1
      values[j] -= 1
    elif values[i] > values[j]:
      cmds.append(rc)
      values[i] -= 1
      values[j] += 1
    elif ni == i or nj == i:
      cmds.append(lc)
      values[i] += 1
      values[j] -= 1
    elif ni == j or nj == j:
      cmds.append(rc)
      values[i] -= 1
      values[j] += 1
    else:
      cmds.append(lc)
      values[i] += 1
      values[j] -= 1

  if cmds is not None:
    print('Yes')
    for c in cmds:
      print(c)
  else:
    print('No')


if __name__ == '__main__':
  main()


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

int main(){
	int n;
  	cin >> n;
  for(int i = 0 ; i <= n ;++i)
    if((int)(i * 1.08) == n){
     cout << i << '\n';
      return 0;
    }
  cout << ":(" << '\n';
  
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<map>
#include<string>
#include<stdio.h>
#include<math.h>
#include <algorithm>

using namespace std;

int main(void) {

	int a, b;

	cin >> a >> b;
	int sum = 0;

	for (int i = 1; i < a+1; i++) {
		if (a >= i + b - 1) sum++;
	}

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,i,c=0,x;
  cin>>n;
  string a;
  cin>>a;
  for(i=0;i<(n-2);i++)
  {
      if(a[i]=='A' && a[i+1]=='B' && a[i+2]=='C')
      {
          c++;
      }
  }
  cout<<c;
return 0;

}


Measured memory_bytes: 256
a = [0,0,0,0,0]
t = "MARCH"
gets.to_i.times do
  s = gets.chomp
  5.times do |i|
    a[i] += 1 if s[0] == t[i]
  end
end
ans = 0
for i in 0..2
  for j in i+1..3
    for k in j+1..4
      ans += a[i]*a[j]*a[k]
    end
  end
end
p ans

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    string s;
    cin>>s;
    int n=s.size();
    for(int i=0;i<n;i++){
        for(int j=i;j<=n;j++){
            string tmp = s.substr(0,i)+s.substr(j);
            // cout<<tmp<<endl;
            if(tmp=="keyence"){
                cout<<"YES"<<endl;
                return 0;
            }
        }
    }
    cout<<"NO"<<endl;





    return 0;
}


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


int main(){
  int H,W,N; cin>>H>>W>>N;
  int sr,sc; cin>>sr>>sc;
  string S,T; cin>>S>>T;
  int l=0,r=W+1,u=0,d=H+1;
  for(int i=N-1;i>=0;i--){
    if(S[i]=='L') l++;
    if(S[i]=='R') r--;
    if(S[i]=='U') u++;
    if(S[i]=='D') d--;
    if(r-l<=1||d-u<=1){
      cout<<"NO\n";
      return 0;
    }
    
    if(i){
      if(T[i-1]=='L') r=min(W+1,r+1);
      if(T[i-1]=='R') l=max(0,l-1);
      if(T[i-1]=='U') d=min(H+1,d+1);
      if(T[i-1]=='D') u=max(0,u-1);
    }
  }
  if(l<sc&&sc<r&&u<sr&&sr<d) cout<<"YES\n";
  else cout<<"NO\n";
  return 0;
}


Measured memory_bytes: 776
//Author: AnandRaj uux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define forn(i,f,n) for(int i=f;i<f+n;i++)
#define rforn(i,l,n) for(int i=l;i>l-n;i--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 1e9+7,MAX = 1e5+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
//////////////////Sieve////////////////////

int main()
{
	double l;
	cin>>l;
	double side=l/3;
	double vol=side*side*side;
	printf("%.7f\n",vol);
}		

Measured memory_bytes: 256
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<time.h>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<fstream>
#include<stdio.h>
#include<sstream>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
bool flag;
struct edge
{
    int y;
    edge * next;
};
edge * li[100005];
edge * new_edge()
{
    static edge a[200005];
    static int top=0;
    return &a[top++];
}
void inserts(int x,int y)
{
    edge * t=new_edge();
    t->y=y;
    t->next=li[x];
    li[x]=t;
}
void insert_edge(int x,int y)
{
    inserts(x,y);
    inserts(y,x);
}
int l[100005],r[100005];
int w[100005];
bool vis[100005];
void dfs(int x)
{
    vis[x]=true;
    edge * t;
    for (t=li[x];t!=0;t=t->next)
    {
        if (vis[t->y]) continue;
        dfs(t->y);
        l[x]=max(l[x],l[t->y]-1);
        r[x]=min(r[x],r[t->y]+1);
    }
    if (l[x]>r[x])
    {
        flag=true;
    }
    if (w[x]==-1) return;
    if (l[x]%2!=w[x]%2)
    {
        if (l[x]>-1000000) flag=true;
    }
    if (l[x]>w[x])
    {
        flag=true;
    }
    if (w[x]>r[x])
    {
        flag=true;
    }
    l[x]=w[x];
    r[x]=w[x];
}
void dfs2(int x,int val)
{
    if (w[x]==-1)
    {
        w[x]=val;
    }
    vis[x]=false;
    edge * t;
    for (t=li[x];t!=0;t=t->next)
    {
        if (vis[t->y])
        {
            int temp=val;
            if (temp<l[t->y]) temp++; else temp--;
            dfs2(t->y,temp);;
        }
    }
}
int main()
{
    #ifdef absi2011
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int n;
    scanf("%d",&n);
    int i;
    for (i=1;i<n;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        x--;
        y--;
        insert_edge(x,y);
    }
    int q;
    scanf("%d",&q);
    for (i=0;i<n;i++)
    {
        l[i]=-10000000;
        r[i]=200000000;
        vis[i]=false;
        w[i]=-1;
    }
    for (i=0;i<q;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        x--;
        w[x]=y;
    }
    flag=false;
    dfs(0);
    if (flag)
    {
        puts("No");
        return 0;
    }
    puts("Yes");
    dfs2(0,l[0]);
    for (i=0;i<n;i++)
    {
        printf("%d\n",w[i]);
    }
    return 0;
} 


Measured memory_bytes: 10752
#include <stdio.h>
#include <inttypes.h>

char S[222222];

uint64_t keisan[2][2019];

int main(void) {
	int i, j;
	uint64_t kotae = 0;
	if (scanf("%222220s", S + 1) != 1) return 1;
	keisan[0][0] = 1;
	for (i = 1; S[i] != '\0'; i++) {
		for (j = 0; j < 2019; j++) {
			keisan[i % 2][(j * 10 + (S[i] - '0')) % 2019] = keisan[(i - 1) % 2][j];
		}
		kotae += keisan[i % 2][0];
		keisan[i % 2][0]++;
	}
	printf("%" PRIu64 "\n", kotae);
	return 0;
}


Measured memory_bytes: 1952
#include <iostream>
#include <vector>

using namespace std;

int main() {
	vector<int> a;
	vector<int> b;
	vector<int> c;
	int anz;
	cin >> anz;
	a.resize(anz);
	b.resize(anz);
	c.resize(anz-1);
	for (int i = 0; i < anz; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < anz; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < (anz-1); i++) {
		cin >> c[i];
	}
	
	int statisfaction = 0;
	for (int i = 0; i < anz; i++) {
		statisfaction += b[a[i]-1];
		if (i < anz-1) {
			if (a[i]+1 == a[i+1]) {
				statisfaction += c[a[i]-1];
			}
		}
	}
	cout << statisfaction << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll  long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define e endl
#define bc __builtin_popcount
#define MAXN 200005
#define debug cout<<"we are debuuging"<<endl;
#define MOD 998244353
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
   string s,t;
   cin>>s>>t;
   int n=s.size();
   int cnt=0;
   for(int i=0;i<n;i++)
   {
        if(s[i]!=t[i])
          cnt++;
   }
   cout<<cnt;


}


Measured memory_bytes: 3912
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;
const int IMAX = 200010;
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}
class unko {
public:
	int fac[IMAX + 1], ifac[IMAX + 1], inv[IMAX + 1];
	constexpr unko() : fac(), ifac(), inv() {
		fac[0] = 1;
		rep1(i, IMAX) fac[i] = ll(fac[i - 1]) * i % mod;
		ifac[IMAX] = modpow(fac[IMAX], mod - 2);
		for (int i = IMAX; i > 0; i--) ifac[i - 1] = ll(ifac[i]) * i % mod;
		inv[0] = 1;
		rep1(i, IMAX) inv[i] = ll(ifac[i]) * fac[i - 1] % mod;
	}
} f;

int N;
const int VN = 200000;
int to[VN * 2 + 2], ne[VN * 2 + 2], he[VN + 1];
int *kari;
int n[VN + 1];
void dfs(int v) {
	n[v]++;
	int mae = 0;
	for (int i = he[v]; i; i = ne[i]) {
		int t = to[i];
		if (n[t]) {
			if (mae) ne[mae] = ne[i];
			else he[v] = ne[i];
		}
		else {
			dfs(t);
			n[v] += n[t];
			mae = i;
		}
	}
}
void dfs2(int v) {
	for (int i = he[v]; i; i = ne[i]) {
		int t = to[i];
		n[t] = ll(n[v]) * kari[n[t]] % mod;
		dfs2(t);
	}
}

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

	
	cin >> N;
	int k = 2;
	rep1(i, N - 1) {
		int a, b;
		cin >> a >> b;

		to[k] = b;
		ne[k] = he[a];
		he[a] = k++;
		to[k] = a;
		ne[k] = he[b];
		he[b] = k++;
	}

	int s = N / 2 + 1;
	int saidai = 0;
	n[s]++;
	for (int i = he[s]; i; i = ne[i]) {
		int t = to[i];
		dfs(t);
		n[s] += n[t];
		chmax(saidai, n[t]);
	}

	ll tmp = 1;
	rep1(i, N) tmp = (tmp * n[i]) % mod;
	n[s] = modpow(tmp, mod - 2) * f.fac[N] % mod;

	int ka[VN + 1];
	kari = ka;
	rep1(i, saidai) kari[i] = ll(i) * f.inv[N - i] % mod;

	for (int i = he[s]; i; i = ne[i]) {
		int t = to[i];
		n[t] = ll(n[s]) * kari[n[t]] % mod;
		dfs2(t);
	}
	rep1(i, N) co(n[i]);

	Would you please return 0;
}

Measured memory_bytes: 7680
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int max,sum,a,b,c,n;
    max=0;
    scanf("%d%d%d",&a,&b,&c);
    sum=a+b+c;
    if(a>b)
        max=a;
    else max=b;
    if(c>max)
        max=c;
    n=max*3-sum;
    if(n%2!=0)
        printf("%d\n",(n+3)/2);
    else
        printf("%d\n",n/2);
    return 0;
}


Measured memory_bytes: 128