akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main () {
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  bool check = false;
  int count = 0;
  while (!check){
    if (A >= B) B *=2;
    else if  (B >= C) C *= 2;
    count ++;
    if ((A < B)&&(B < C)) check = true;
  }
  if (K >= count) cout << "Yes" << endl;
  else cout << "No" << endl;
} 

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

int main()
{
	int x, a, b, c, cnt = 0;
	cin >> a >> b >> c >> x;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			if (x - i * 500 - j * 100 >= 0) {
				if ((x - i * 500 - j * 100) / 50 <= c) cnt++;
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) (V).begin(),(V).end()

vector<vector<int>> T(10000);

int main() {
	int N;
	cin >> N;
	int a, b;
	for (int i = 0;i < N - 1;i++) {
		cin >> a >> b;
		a--; b--;
		T[a].push_back(b);
		T[b].push_back(a);
	}

	vector<int> C(N);
	for (int i = 0;i < N;i++)
		cin >> C[i];
	sort(all(C));

	queue<int> lf;
	vector<int> size(10000);
	for (int i = 0;i < 10000;i++) {
		size[i] = T[i].size();
		if (size[i] == 1)
			lf.push(i);
	}
	vector<int> Po(N, 0);
	int ans = 0;

	for (int i = 0;i < N;i++) {
		a = lf.front();
		int it = T[a].size();
		if (i == N - 1) {
			Po[a] = C[i];
			break;
		}
		for (int j = 0;j < it;j++) {
			b = T[a][j];
			if (Po[b] == 0) {
				//まだその頂点には数が入っていない
				size[b]--;
				if (size[b] == 1)
					lf.push(b);
				Po[a] = C[i];
				ans += C[i];
				break;
			}
		}
		lf.pop();
	}
	cout << ans << endl;
	for (int i = 0;i < N;i++) {
		cout << Po[i] << " ";
	}
	cout << endl;
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

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

  int x; cin >> x;
  vi v = {100, 101, 102, 103, 104, 105};

  vi dp(100001, 0);
  dp[0] = 1;
  for(int i=0;i<=100000;++i) {
    for(int j=0;j<6;++j) {
      if(dp[i] && i + v[j] <= 100000) {
        dp[i+v[j]] = 1;
      }
    }
  }
  cout << dp[x] << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
using namespace std;

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

int main() {
	map<pii,ll> mp;
	int H, W, N;
	cin >> H >> W >> N;
	for(int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		for(int j = 0; j < 3; j++) {
			for(int k = 0; k < 3; k++) {
				int y, x;
				y = a-j;
				x = b-k;
				if(0 < y && 0 < x && y+2 <= H && x+2 <= W)
					mp[pii(y,x)]++;
			}
		}
	}
	vector<ll> res(10);
	for(int i = 0; i < res.size(); i++) res[i] = 0;
	res[0] = ((ll)H-2)*((ll)W-2);
	for(auto it = mp.begin(); it != mp.end(); ++it) {
		res[it->second]++;
		res[0]--;
	}
	for(int i = 0; i < res.size(); i++)
		cout << res[i] << endl;
}


Measured memory_bytes: 56448
#include<iostream>
using namespace std;
int main(){
  long w,h,x,y;
  cin >> w >> h >> x >> y;
  double ans = (double)(w*h)/2;
  int i;
  if(x*2 == w && y*2 == h)  i= 1;
  else i=0;
  cout << ans <<" "<< i;
}

Measured memory_bytes: 256
X, Y, Z, K = [int(x) for x in input().split()]
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
C = [int(c) for c in input().split()]
A = sorted(A, reverse=True)
B = sorted(B, reverse=True)
C = sorted(C, reverse=True)
ABC = []
for a in range(len(A)):
    for b in range(len(B)):
        for c in range(len(C)):
            if (a+1)*(b+1)*(c+1) > K:
                break
            ABC.append(A[a] + B[b] + C[c])
ABC = sorted(ABC, reverse=True)
for i in range(K):
    print(ABC[i])

Measured memory_bytes: 9564
/* To Kaise Hain Aaplog*/

/* Yalgaar Ho */

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl

void shuru_krte_hai_bina_kisi_bakchodi_ke()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}

const ll mod = 1e9 + 7;

int main()
{
    //shuru_krte_hai_bina_kisi_bakchodi_ke();
    vector<pair<int,int>> v;
    for(int i=0;i<5;i++){
        int x;
        cin>>x;
        v.push_back({x,i+1});
    }
    sort(v.begin(),v.end());
    cout<<v[0].second<<"\n";
    
    return 0;
}

Measured memory_bytes: 3584
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
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 fi first
#define sc second
#define rep(i,x) for(int i=0;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 main(){
	ll a,b,c;
	cin >> a >> b >> c;
	if(a%2==0 || b%2 == 0 || c%2 == 0){
		puts("0");
	}
	else{
		cout << min(a*b,min(b*c,c*a)) << endl;
	}
}

Measured memory_bytes: 256
from fractions import gcd
N = int(input())
alst = list(map(int, input().split()))
ans = alst[0]
for i in range(1, N):
    if ans > alst[i]:
        ans = gcd(ans, alst[i])
    else:
        ans = gcd(alst[i], ans)
print(ans)


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



int main() {
int N;
cin >> N;
string B[100];
for(int i = 0; i < N; i++) cin >> B[i];

int M;
cin >> M;
string R[100];
for(int i = 0; i < M; i++) cin >> R[i];
int ans = 0;
for(int i = 0; i< N; i++){
int kari= 0;
for(int j = 0; j < N; j++){
    if(B[i]== B[j])kari++;
}
for(int j = 0; j < M; j++){
    if(B[i]== R[j])kari--;
}
ans = max(kari,ans);
}
cout << ans << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int main() {
    int n,l;
    cin >> n >> l;

    int ans = n*(n+1)/2 + (l-1)*n;

    if(0<l){
        ans -= l;
    }else if(l+n-1<0){
        ans -= l+n-1;
    }
    

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli A,B,C,D;
  string a,b,c;
  cin >>a;
  a[3]='8';
  Out(a);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vvi vector<vector<int>> 
#define vi vector<int> 
#define vpii vector<pair<int,int>> 
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define ffor(i,n) for(int i = 0; i < n; ++i)
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0; i < s.length(); ++i)
    {
        int x = (s[i] - 'A');
        x += n;
        x %= 26;
        s[i] = (x + 'A');
    }
    cout << s;
}

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

const int _mx = 2e6;
int a[_mx+5];

int main() {
    // freopen("in.txt", "r", stdin);

    string s;
    LLI a, b, n, ans;
    stack <LLI> st;
    while (cin >> s) {
        if (s[0] == '+') {
            a = st.top(); st.pop();
            b = st.top(); st.pop();
            st.push(a + b);
        }
        else if (s[0] == '-') {
            a = st.top(); st.pop();
            b = st.top(); st.pop();
            st.push(b - a);
        }
        else if (s[0] == '*') {
            a = st.top(); st.pop();
            b = st.top(); st.pop();
            st.push(a * b);
        }
        else {
            n = s[0] - '0';
            for (int j = 1; j < s.size(); j++) n = n * 10 + (s[j] - '0');
            st.push(n);
        }
    }
    cout << st.top() << endl;

    return 0;
}



Measured memory_bytes: 3180
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cstring>
using namespace std;
#define ref goto refrain
int main(){
	char str[1000];
	cin>>str;
	int q;
	cin>>q;
	string order;
	int a,b;
	char rep[1000];
	for(int i=0;i<q;i++){
		cin>>order;
		cin>>a;
		cin>>b;
		if(order=="replace"){
			cin>>rep;
			for(int j=0;a<=b;j++){
				str[a]=rep[j];
				a++;
			}
		}
		else if(order=="reverse"){
			while(a<=b){
				char temp=str[a];
				str[a]=str[b];
				str[b]=temp;
				a++;
				b--;
			}
		}
		else if(order=="print"){
			for(a=a;a<=b;a++){
				printf("%c",str[a]);
			}
			cout<<endl;
		}
	}
	return 0;
}
		
	

Measured memory_bytes: 1192
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def fact(n):
        if n < 4:
            return [n,1]
        i = 2
        res = [1,n]
        while i*i <= n:
            if n%i == 0:
                res.append(i)
                m = n//i
                if m != i:
                    res.append(m)
            i += 1
        res.sort(reverse = True)
        return res
    n,k = LI()
    a = LI()
    s = sum(a)
    f = fact(s)
    for i in f:
        s = [j%i for j in a]
        s.sort()
        s = list(accumulate(s))
        for j in range(n-1):
            sl = s[j]
            sr = i*(n-j-1)-s[-1]+s[j]
            if sl == sr:
                break
        if sl <= k:
            print(i)
            return
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 41708
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <fstream>

#define size_t int64_t
// std::sort(&a[0], &a[4], [](auto& x, auto& y){return x[0] < y[0];});
//accumulate(&s2[n], &s2[m-1], 0);
// atoi()
using namespace std;
typedef long l;
typedef long long ll;

size_t mod(size_t a, size_t b) {
    return ((b + (a % b)) % b);
}

ll modular_pow(ll base, ll exponent, int modulus)
{
    ll result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base) % modulus;
        exponent = exponent >> 1;
        base = (base * base) % modulus;
    }
    return result;
}

// template<typename A, size_t N, typename T>
// void Fill(A (&array)[N], const T &val){
//     std::fill( (T*)array, (T*)(array+N), val );
// }


int main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  std::cin >> n;

  string s1,s2;
  std::cin >> s1;
  std::cin >> s2;

  ll ans = 0;

  if(n == 1){
    std::cout << 3 << '\n';
    return 0;
  }
  int type; // 1 tate , 2 yoko
  if(s1[0] == s2[0]){
    ans = 3;
    type = 1;
  }else{
    ans = 6;
    type = 2;
  }

  for (ll i = type; i < n;) {
    if(s1[i] == s2[i]){
      ans =  mod(ans * (3 - type),1000000007);
      type = 1;
      i+= 1;
    }else{
      ans = mod(ans * (type + 1), 1000000007);
      type = 2;
      i+=2;
    }
  }

  std::cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 256
/* This Template is property of Pranav Khiste aka desmond_kaneki*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi(x,n) for(ll i=x;i<n;i++)
#define fj(x,n) for(ll j=x;j<n;j++)
#define fit(a,b) for(auto it=a;it!=b;it++)
#define vll vector<ll>
#define pb push_back
#define qll queue<ll>
#define p push
#define mp make_pair
#define fst first
#define snd second
#define pll pair<ll,ll>
#define vpll vector<pll>
#define debug(x) cout<<#x<<' '<<x<<endl;
#define endl '\n'
#define SUP LLONG_MAX
#define INF -1000000000000
#define MAX_N 100005
#define test() ll var;  cin>>var; while(var--)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fileio freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);  // use cin cout only!!
vll v[2005];
ll dis[2005][2005],vis[2005];
void bfs(ll source)
{
    queue<ll> q;
    q.push(source);
    memset(vis,0,sizeof(vis));
    vis[source]=1;
    dis[source][source]=0;
    while(!q.empty())
    {
        ll cur=q.front();
        q.pop();
            fit(v[cur].begin(),v[cur].end())
            {
                if(vis[*it]==0)
                {
                    dis[source][*it]=dis[source][cur]+1;
                    vis[*it]=1;
                    q.push(*it);
                }
            }
    }
}
main()
{
    ll n,x,y;
    cin>>n>>x>>y;
    fi(2,n)
    {
        v[i].pb(i+1);
        v[i].pb(i-1);
    }
    v[1].pb(2);
    v[n].pb(n-1);
    v[x].pb(y);
    v[y].pb(x);
    fi(1,n+1)
    {
        bfs(i);
    }
    ll ans[n];
    memset(ans,0,sizeof(ans));
    fi(1,n+1)
    {
        fj(1,n+1)
        {
            ll z=dis[i][j];
            ans[z]++;
        }
    }
    fi(1,n)
        cout<<ans[i]/2<<endl;
}


Measured memory_bytes: 31744
n,m,v,p=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=p
border=a[p-1]
d=0
for i in range(p,n):
    # 考察対象はi+1位の問題
    if border>a[i]+m:#全員から票を集めてもp位になれない
        break
    # i+1位の問題をp位にできるパターンを分析
    # i+1位からn位の問題にm票投票
    vote=m*(n-i)
    # 1位からp-1位の問題にm票投票
    vote+=m*(p-1)
    # p位～i位の問題にi+1位と同じ票数になるように投票。このとき一問あたりの得票数はmを超えない
    vote+=d+(a[i]+m-border)*(i-p+1)
    # d:p位からi位問題の得票数をp位と同じにするのに必要な票数。一個当たりの票数はmを超えない。
    if vote>=v*m:
        ans+=1
    d+=border-a[i]
print(ans)

Measured memory_bytes: 14964
import java.util.*;
public class Main {

	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int yy = sc.nextInt();
			int mm = sc.nextInt();
			int dd = sc.nextInt();
			String y = "" + yy;
			String m = "" + mm;
			String d = "" + dd;
			if(m.length() == 1) m = "0" + m;
			if(d.length() == 1) d = "0" + d;
			int sum = Integer.parseInt(y + m + d);
			if(sum < 18680908){
				System.out.println("pre-meiji");
				continue;
			}
			else if(sum < 19120730){
				System.out.print("meiji ");
				System.out.print(yy - 1868 + 1);
			}
			else if(sum < 19261225){
				System.out.print("taisho ");
				System.out.print(yy - 1912 + 1);
			}
			else if(sum < 19890108){
				System.out.print("showa ");
				System.out.print(yy - 1926 + 1);
			}
			else{
				System.out.print("heisei ");
				System.out.print(yy - 1989 + 1);
			}
			System.out.println(" " +mm + " " + dd);
		}
	}

	public static void main(String [] args){
		new Main().doit();
	}
}

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

using namespace std;

typedef long long ll;

ll MOD = 1000000007;

int main(int, char**) {
	set<ll> S;
	ll n; cin >> n;
	for (int i=0; i<n; i++) {
		ll a; cin >> a;
		if (S.count(a)) {
			cout << "NO" << endl;
			return 0;
		} else {
			S.insert(a);
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 9600
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;
mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;
#[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
#[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
        where
        <T as FromStr>::Err: Debug,
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse().unwrap())
                .collect()
        }
}
#[allow(unused_macros)]
macro_rules ! get { ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; 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 ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { println ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }

fn main() {
    let n = get!(usize);
    let mut ds = get!(usize; n);

    ds.sort();
    ds.dedup();

    println!("{}", ds.len());
}


Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main(void){
   int N,M;
   cin>>N>>M;
   int P[60]={};
   int S[60]={};
   for(int i=0;i<N;i++){
       int a,b;
       cin>>a>>b;
       P[i]=a;
       S[i]=b;
   }
   int Q[60]={};
   int R[60]={};
   for(int i=0;i<M;i++){
       int c,d;
       cin>>c>>d;
       Q[i]=c;
       R[i]=d;
   }
   for(int i=0;i<N;i++){
       int distance=abs(P[i]-Q[0])+abs(S[i]-R[0]);
       int point;
       for(int j=M-1;j>=0;j--){
           if(distance>=abs(P[i]-Q[j])+abs(S[i]-R[j])){
               distance=abs(P[i]-Q[j])+abs(S[i]-R[j]);
               point=j+1;
           }
       }
       cout<<point<<endl;
   }
}


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

int grade(int pm, int pe, int pj);

int main(void){
  int n;
  int pm,pe,pj;
  while(1){
    cin>>n;
    if(n==0){break;}
    for(int i=0;i<n;i++){
      cin>>pm>>pe>>pj;
      cout<<(char)(grade(pm,pe,pj)+'A')<<endl;
    }
  }
  return 0;
}

int grade(int pm, int pe, int pj){
  if(pm==100 or pe==100 or pj==100){return 0;}
  if(pm+pe>=180){return 0;}
  if(pm+pe+pj>=240){return 0;}
  else if(pm+pe+pj>=70*3){return 1;}
  else if((pm+pe+pj>=50*3) and (pe>=80 or pm>=80)){return 1;}
  else{return 2;}
}



Measured memory_bytes: 2988
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
  ll ans=1;
  for(int i=1;i<=n;i++)
       ans*=a;
    return ans;
}

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

 long double a,b;
 cin>>a>>b;
 cout<<(ll)(a*b)<<endl;
return 0;
}



Measured memory_bytes: 3752
#include <iostream>
#include <string>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define PB push_back
#define SizeS 8000
#define SizeX SizeS*2+1
 
using namespace std;
typedef vector<int> vint;
 
//何回目で、どの位置か
bool dpx[SizeS][SizeX];
bool dpy[SizeS][SizeX];
 
int main(void){
    string s;
    cin>>s;
    int x,y;
    cin>>x>>y;
    vint vx,vy;
    int c=0;
    bool vh=1;
    rep(i,s.size()){
        if(s[i]=='F')c++;
        else{
            if(vh){vx.PB(c);vh=0;}
            else{vy.PB(c);vh=1;}    
            //cout<<c<<" "<<endl;
            c=0;
        }
    }
    if(vh){vx.PB(c);vh=0;}
    else{vy.PB(c);vh=1;}   
    rep(i,SizeS)rep(j,SizeX){dpx[i][j]=0;dpy[i][j]=0;}
    dpx[0][SizeS]=1;
    dpy[0][SizeS]=1;
    int i=1;
    rep(j,SizeX){
        dpx[i][j]=(j-vx[i-1]>0 && dpx[i-1][j-vx[i-1]]);
    }
    for(int i=2;i<vx.size()+1;i++){
        rep(j,SizeX){
            dpx[i][j]=((j+vx[i-1]<SizeX && dpx[i-1][j+vx[i-1]])||(j-vx[i-1]>0 && dpx[i-1][j-vx[i-1]]));
            //cout<<"i:"<<i<<" j:"<<j<<" dpxij:"<<dpx[i][j]<<endl;
        }
    }
    for(int i=1;i<vy.size()+1;i++){
        rep(j,SizeX){
            dpy[i][j]=dpy[i][j]=((j+vy[i-1]<SizeX && dpy[i-1][j+vy[i-1]])||(j-vy[i-1]>0 &&dpy[i-1][j-vy[i-1]]));
            //cout<<"i:"<<i<<" j:"<<j<<" dpyij:"<<dpy[i][j]<<endl;
        }
    }
    
    if(dpx[vx.size()][x+SizeS] && dpy[vy.size()][y+SizeS])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 250368
#include <cstdio>
#include <iostream>
#define ri register int
using namespace std;

const int N = 15;
const int M = 1 << N | 3;
const int mod = 1e9 + 7;

int n, m;
int G[N], f[M], cnt[M];
int tab[M][N], top[M];

inline void prt(int x) {
  if (!x) return;
  prt(x >> 1);
  cerr << (x & 1);
}

int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, x, y; i <= m; i ++) {
    scanf("%d%d", &x, &y);
    G[x - 1] |= 1 << (y - 1);
  }
  int tot = 1;
  for (int i = 1; i <= m; i ++) tot = (tot << 1) % mod;
  for (int i = 1; i < (1 << N); i ++)
    cnt[i] = cnt[i - (i & (- i))] + 1;
  int U = 1 << n;
  for (int i = 1; i < U; i ++)
    for (int j = 0; j < n; j ++)
      if ((i >> j) & 1) tab[i][++ top[i]] = j;
  for (int i = 0; i < U; i ++)
    if ((i & 1) == ((i >> 1) & 1)) {
      for (int j = i; j; j = (j - 1) & i)
        if (f[j]) {
          ri w = i ^ j, res = 1;
          for (ri k = top[j]; k && res; k --)
            res = ((1LL << cnt[G[tab[j][k]] & w]) - 1) * res % mod;
          for (ri k = top[w]; k && res; k --)
            res = (1LL << cnt[G[tab[w][k]] & j]) * res % mod;
          f[i] = (f[i] + 1LL * f[j] * res) % mod;
        }
      f[i] ++;
    }
  printf("%d\n", (tot - f[U - 1] + mod) % mod);
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k[100],count=0;
  cin>>n;
  for(int i=0;i<n;++i){
   cin>>k[i];
  }
  for(int i=1;i<=n;++i){
   if(k[i-1]==k[i]){
     ++count;
     k[i]=10000;
   }
  }
  cout<<count<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{

    void solve(){
	Scanner sc = new Scanner(System.in);

	int n = sc.nextInt();
	while(n--!=0){

	    String s = sc.next();
	    int winner = 1;
	    for(int i=0; i<s.length()-1; i++){
		String ns = String.valueOf(s.charAt(i)-'0' + s.charAt(i+1)-'0');
		s = ns + s.substring(i+2,s.length());
		i--;
		winner = 1-winner;
	    }

	    System.out.println(winner==1 ? "Audrey wins." : "Fabre wins.");
	}
    }

    public static void main(String[] args){
	new Main().solve();
    }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
//#define int long long

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

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

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

    int n;
    cin >> n;
    map<int, int> mp;
    int ans = 0;
    REP(i, n){
        int x;
        cin >> x;
        mp[min(x/400, 8)]++;
    }
    REP(i, 8) if(mp[i] > 0) ans++;

    cout << max(ans, 1) << " " << ans + mp[8] << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 10 10:05:08 2019

@author: shinjisu
"""


# ARC 073 C
def getInt(): return int(input())


def getIntLines(n): return [int(input()) for i in range(n)]


def zeros(n): return [0]*n


def genBits(n):  # n個の0/1のリストを生成　[0]から変化
    bits = zeros(n)
    for i in range(2**n):
        for k in range(n):
            bits[k] = i % 2
            i //= 2
        yield bits


def dmp(x):
    global debug
    if debug:
        print(x)


def probC_TLE():
    N = getInt()
    S = getIntLines(N)
    dmp((N, S))
    maxPoint = 0
    for bit in genBits(N):
        point = 0
        for i in range(N):
            point += S[i]*bit[i]
        if point % 10 == 0:
            point = 0
        maxPoint = max(point, maxPoint)
        dmp((point, maxPoint))
    return maxPoint


def probC():
    N = getInt()
    S = getIntLines(N)
    dmp((N, S))
    tens = []
    nonTens = []
    for i in range(N):
        if S[i] % 10 == 0:
            tens.append(S[i])
        else:
            nonTens.append(S[i])
    total = sum(nonTens)
    dmp(total)
    if total > 0 and total % 10 == 0:
        total -= min(nonTens)
    dmp(total)
    if total > 0:
        total += sum(tens)
    dmp(total)
    return total


debug = False
print(probC())


Measured memory_bytes: 3064
n = int(input())
a = [int(input()) for _ in range(n)]
ans = 0
for i in range(n - 1):
    m = a[i] // 2
    ans += m
    if a[i] % 2 == 1:
        if a[i + 1] > 0:
            ans += 1
            a[i + 1] -= 1
ans += a[n - 1] // 2
print(ans)

Measured memory_bytes: 7072
#include <bits/stdc++.h>
#define MAX 500005
#define INF 0x3f3f3f3f
#define ll long long
using namespace std;

struct edge{
    int x, y;
    ll w;
    friend bool operator <(edge a, edge b){
        return a.w < b.w;
    }
}e[MAX];

int n, m, cnt, fa[MAX];
ll d[MAX];

int find(int x){
    if(fa[x] == x) return x;
    return fa[x] = find(fa[x]);
}

ll ans;
void kruskal(){
    sort(e+1, e+cnt+1);
    for(int i = 1; i <= cnt; ++i){
        int x = e[i].x, y = e[i].y;
        if(find(x) == find(y)) continue;
        fa[find(x)] = find(y);
        ans += e[i].w;
    }
}

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n; ++i){
        fa[i] = i;
        d[i] = INF;
    }
    int x, y;
    ll w;
    for(int i = 1; i <= m; ++i){
        scanf("%d%d%lld", &x, &y, &w);
        x++, y++;
        e[++cnt] = (edge){x, y, w};
        d[x] = min(d[x], w+1), d[y] = min(d[y], w+2);
    }
    for(int i = 1; i <= n; ++i) d[i%n+1] = min(d[i%n+1], d[i]+2);
    for(int i = 1; i <= n; ++i) d[i%n+1] = min(d[i%n+1], d[i]+2);
    for(int i = 1; i <= n; ++i) e[++cnt] = (edge){i, i%n+1, d[i]};
    kruskal();
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 15232
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[100001]={0};
int b[100002]={0};
int main()
{
	int n;
	cin>>n;
	for (int i=1;i<=n;++i)
	{
		scanf("%d",&a[i]);
		if (a[i]==i) b[i]=1;
	}
	int ans=0;
	int num=0;
	for (int i=1;i<=n+1;++i)
	    if (b[i]==0)
	    {
	    	if (num!=0)
	    	{
	    	    ans+=ceil(num*0.5);
	    	    num=0;
	        }
	    }
	    else num++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <queue>
using namespace std;
int main(void){
    // Your code here!
    int N, M;
    int field[500][500];
    int field_dist[500][500];
    vector<vector<int>> edges(8, vector<int>());
    
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        edges[a-1].push_back(b-1);
        edges[b-1].push_back(a-1);
    }

    int count = 0;
    queue<vector<int>> q;
    vector<int> init{0};
    for(int i = 0; i < N; i++)
        init.push_back(0);
    init[1] = 1;
    q.push(init);
    while(q.size() > 0){
        vector<int> cur = q.front();
        q.pop();
        
        int sum = 0;
        for(int i = 0; i < N; i++)
            sum += cur[i+1];
            
        if(sum == N){
            count++;
            continue;
        }
        
        for(auto e:edges[cur[0]]){
            if(cur[e+1] == 0){
                vector<int> temp{e};
                for(int i = 0; i < N; i++)
                    temp.push_back(cur[i+1]);
                temp[e+1] = 1;
                q.push(temp);
            }
            
        }
    }
    
    cout << count << endl;
    
    return 0;    
}


Measured memory_bytes: 640
package main

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

func out(x ...interface{}) {
	//	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

type Data struct {
	x, y, a int
}

func main() {
	sc.Split(bufio.ScanWords)

	W := getInt()
	H := getInt()
	N := getInt()
	d := make([]Data, N)
	for i := 0; i < N; i++ {
		d[i].x = getInt()
		d[i].y = getInt()
		d[i].a = getInt()
	}

	var r [100][100]int
	out(W, H, N, d)

	for _, v := range d {
		switch v.a {
		case 1: // x < xi
			out("1:", v.x)
			for y := 0; y < H; y++ {
				for x := 0; x < v.x; x++ {
					out(x, y)
					r[y][x] = 1
				}
			}
		case 2: // x > xi
			out("2:")
			for y := 0; y < H; y++ {
				for x := v.x; x < W; x++ {
					out(x, y)
					r[y][x] = 1
				}
			}
		case 3: // y < yi
			out("3:")
			for y := 0; y < v.y; y++ {
				for x := 0; x < W; x++ {
					r[y][x] = 1
				}
			}
		case 4: // y > yi
			out("4:")
			for y := v.y; y < H; y++ {
				for x := 0; x < W; x++ {
					r[y][x] = 1
				}
			}
		}
	}

	ans := 0

	for y := 0; y < H; y++ {
		for x := 0; x < W; x++ {
			if r[y][x] == 0 {
				ans++
			}
			//			fmt.Print(r[y][x])
		}
		//		fmt.Println("")
	}
	fmt.Println(ans)
}


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

#define INF 1000050000

long long dp[100005][102];

int main()
{
	int n, w;
	int weight[100005];
	int value[100005];
	scanf("%d%d", &n, &w);
	for(int i = 1; i <= n; i++) {
		scanf("%d%d", &weight[i], &value[i]);
	}
	memset(dp, 0, sizeof(dp));
	long long ans = 0;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= w; j++) {
			dp[j][i] = max(dp[j][i], dp[j][i-1]);
			if(j - weight[i] < 0) continue;
			dp[j][i] = max(dp[j][i],  dp[j-weight[i]][i-1]+value[i]);
		}
	}
	printf("%lld\n", dp[w][n]);
}

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

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            var n = inputLongArray[0];
            var k = inputLongArray[1];

            var p = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).OrderBy(x => x).ToArray();

            long result = 0;
            for (int i = 0; i < k; i++)
            {
                result += p[i];
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28664
#include<stdio.h>
#include<iostream>
#include<algorithm> // sort(ALL())
#include<string>
#include<string> // to_string()
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue> // push(), front(), pop() 先入れ先出し
#include<map> // 連想配列 map<string, int>
#include<iomanip>
#include<set>
#include<utility>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b);  i++)
#define REP(i, n)    for(int i=0;   i<(n);  i++)
#define REP1(i, n)   for(int i=1;   i<=(n); i++)
#define pb push_back
#define mp make_pair
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define EPS 1e-7
#define ALL(obj) (obj).begin(), (obj).end()
using ul    = unsigned long;
using ll    = long long;
using ld    = long double;
using vint  = vector<int>;
using vll   = vector<ll>;
using pint  = pair<int, int>;
using pll   = pair<ll, ll>;
using vpint = vector<pint>;
using vpll  = vector<pll>;
const int INF = (int)1e9 + 1;
const int MOD = (int)1e9 + 7;
#define INT(argu) (int)(argu+EPS)



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

  string n;
  int k;
  scan(n); scan(k);
  int di = n.length();
  vint lab;

  vint p;
  REP(i, di){
    if(n[i] != '0'){
      p.push_back( n[i] - '0' ); // n[0]=p[0], n[i]=x, n[j]=y
      lab.push_back( i ); // 0, i, j
      if(p.size()==3) break;
    }
  }
  int num = lab.size(); // 1 or 2 or 3

  if(di<k || ( di<=3 && atoi(n.c_str())<111 && k==3 ) ){
    cout << "0" << endl;
    return 0;
  }

  if(k==1){
    cout << (di-1)*9 // 0 [x0..0]
          + p[0] // x 0..0
         << endl; //
  }else if(k==2){
    if(num>=2){
      cout << (di-1)*(di-2)/2*9*9 // 0 [xy0...0]
            + (p[0]-1)*(di-1)*9 // x [y0...0]
            + (di-lab[1]-1)*9 // p[0] 0..0 0 [x0..0]
            +  p[1] // p[0] 0...0 x 0...0
            << endl;
    }else if(num==1){
      cout << (di-1)*(di-2)/2*9*9 // 0 [xy0...0]
            + (p[0]-1)*(di-1)*9 // x [y0...0]
            << endl;
    }
  }else if(k==3){
    if(num>=3){
      cout << (di-1)*(di-2)*(di-3)/6*9*9*9 // 0[xyz0...0]
            + (p[0]-1)*(di-1)*(di-2)/2*9*9 // x[yz0...0]
            + (p[1]-1)*(di-lab[1]-1)*9 // p[0] 0..0 x[y0...0]
            + (di-lab[1]-1)*(di-lab[1]-2)/2*9*9 // p[0] 0..0 0 [xy0..0]
            + p[2] // p[0] 0..0 p[1] 0..0 x 0..0
            + (di-lab[2]-1)*9 // p[0] 0..0 p[1] 0..0 0 [x0..0]
           << endl;
    }else if(num==2){
      cout << (di-1)*(di-2)*(di-3)/6*9*9*9 // 0[xyz0...0]
            + (p[0]-1)*(di-1)*(di-2)/2*9*9 // x[yz0...0]
            + (p[1]-1)*(di-lab[1]-1)*9 // p[0] 0..0 x [y0...0]
            + (di-lab[1]-1)*(di-lab[1]-2)/2*9*9 // p[0] 0..0 0 [xy0..0]
           << endl;
    }else if(num==1){
      cout << (di-1)*(di-2)*(di-3)/6*9*9*9 // 0[xyz0...0]
            + (p[0]-1)*(di-1)*(di-2)/2*9*9 // x[yz0...0]
           << endl;
    }
  }

//  REP(i, (int)(p.size()) ){
//    cout << p[i] << "\t" << lab[i] << endl;
//  }
//  cout << fixed << setprecision(10) <<  << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
long a[3<<17],b[3<<17],sa,sb,ans=1e15;
int n;
priority_queue<long>P,Q;
map<long,int>M;
main()
{
	cin>>n;
	for(int i=0;i<3*n;i++)cin>>a[i];
	for(int i=0;i<n;i++)
	{
		sa+=a[i];
		P.push(-a[i]);
	}
	for(int i=n;i<3*n;i++)
	{
		b[i-n]=a[i];
	}
	sort(b,b+2*n);
	for(int i=0;i<n;i++)sb+=b[i];
	long f=b[n-1];
	for(int i=n;i<2*n;i++)
	{
		Q.push(-b[i]);
		M[b[i]]++;
	}
	ans=sa-sb;
	for(int i=n;i<2*n;i++)
	{
		sa+=a[i];
		P.push(-a[i]);
		sa+=P.top();
		P.pop();
		if(a[i]<=f)
		{
			sb-=a[i];
			long q=-Q.top();
			while(M[q]==0)
			{
				Q.pop();
				q=-Q.top();
			}
			M[q]--;
			sb+=f=q;
			Q.pop();
		}
		else M[a[i]]--;
		ans=max(ans,sa-sb);
	}
	cout<<ans<<endl;
}

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

int max(int a, int b);
int min(int a, int b);
int cmp(const void *p, const void *q);

int main(int argc, char const *argv[])
{
    int n;
    int l[10] = {0};
    int i;
    int sum = 0;

    scanf("%d", &n);

    for(i = 0; i < n; i++) {
        scanf("%d", &l[i]);
    }

    qsort(l, sizeof(l) / sizeof(int), sizeof(int), cmp);

    for(i = 1; i < n; i++)
        sum += l[i];

    printf("%s", sum > l[0] ? "Yes" : "No");
    return 0;
}

int max(int a, int b) {
    return a > b ? a : b;
}

int min(int a, int b) {
    return a < b ? a : b;
}

int cmp(const void *p, const void *q) {
    return -(*(int*)p - *(int*)q);
}

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

bool isPrime(int x) {
  bool res = true;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      res = false;
      break;
    }
  }
  return res;
}

int main() {
  int X;
  cin >> X;
  
  while(true) {
    if (isPrime(X)) {
      cout << X << endl;
      return 0;
    }
    X++;
  }
}



Measured memory_bytes: 256
# coding: utf-8

s = input()
n = len(s)
h = int((n-1)/2)
Ans = 'No'
sl = s[0:h]
slr = sl[::-1]
sr = s[-1: -h - 1:-1]
if sl == sr and sl == slr:
  Ans = 'Yes'
print(Ans)


Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
   long long int a,b,sum;
    char ch;
    scanf("%lld %c %lld",&a,&ch,&b);
    if(ch==43)
    {
        sum=a+b;
    }
    if(ch==45)
    {
        sum=a-b;
    }
    printf("%lld\n",sum);
    return 0;
}


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

//#define getchar getchar_unlocked
//#define putchar putchar_unlocked
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define ff first
#define ss second
#define err stderr
#define out stdout

typedef long long int ll;
typedef long double ld;
typedef short int sh;

inline void readI(int *i)
{
	register int t=0;
	register char z=getchar();
	int znak=1;
	if (z=='-')
	{
		znak=-1;
	}
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
		if (z=='-')
		{
			znak=-1;
		}
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*i=(t*znak);
}
inline void readUI(int *i)
{
	register int t=0;
	register char z=getchar();
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*i=t;
}
inline void readL(ll *l)
{
	register ll t=0;
	register char z=getchar();
	int znak=1;
	if (z=='-')
	{
		znak*=-1;
	}
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
		if (z=='-')
		{
			znak=-1;
		}
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*l=(t*znak);
}
inline void readUL(ll *l)
{
	register ll t=0;
	register char z=getchar();
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*l=t;
}
inline void writeL(ll l)
{
	if (l==0)
	{
		putchar(48);
	}
	else
	{
		if (l<0)
		{
		   l*=-1;
		   putchar(45);
		}
		int _tab[21];
		int wsk=0;
		while (l>0)
		{
			++wsk;
			_tab[wsk]=(l%10)+48;
			l/=10;
		}
		for (int j=wsk; j>=1; --j)
		{
			putchar(_tab[j]);
		}
	}
}
inline void writeS(string s)
{
	int l=s.length();
	for (int i=0; i<l; ++i)
	{
		putchar(s[i]);
	}
}
inline void space()
{
	putchar(32);
}
inline void endl()
{
	putchar(10);
}

#define debug if(1)
#define debug2 if(1)
#define debug3 if(1)
#define debug4 if(1)
#define MAXK (int)(1e5)+5

int n, k, a;
vector <int> v;
int nim[MAXK], odw[MAXK];

int main()
{
	readUI(&n);
	readUI(&k);
	for (int i=1; i<=n; ++i)
	{
		readUI(&a);
		v.eb(a);
	}
	for (int i=v[0]; i<=k; ++i)
	{
		for (int j=0; j<n; ++j)
		{
			if (i-v[j]<0)
			{
				break;
			}
			odw[nim[i-v[j]]]=i;
		}
		int poz=0;
		while (odw[poz]==i)
		{
			++poz;
		}
		nim[i]=poz;
	}
	fprintf (out, "%s\n", nim[k] ? "First" : "Second");
	return 0;
}
/*
*/




Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define pb push_back
#define MOD 1000000007
#define INF 1000000000
#define EPS 0.0000000001
typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //---------------------------------------------

    int n, k;
    cin >> n >> k;
    vector<int> d(k);
    for (int i = 0; i < k; i++)
    {
        cin >> d[i];
    }
    bool dd = true;
    string ans;
    for (int i = n; i <= n * 10; i++)
    {
        string s = to_string(i);

        int x = s.size();
        dd = true;
        for (int iii = 0; iii < x; iii++)
        {
            for (int j = 0; j < k; j++)
            {
                if ((s[iii] - '0') == d[j])
                {
                    dd = false;
                }
            }
        }
        if (dd == true)
        {
            ans = s;
            break;
        }
    }
    
        cout << ans << endl;
    
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  int dx = tx - sx, dy = ty - sy;
  cout << string(dx,'R') << string(dy,'U');
  cout << string(dx, 'L') << string(dy, 'D');
  cout << 'D' << string(dx+1,'R') << string(dy+1,'U') << 'L';
  cout << 'U' << string(dx+1, 'L') << string(dy+1, 'D') << 'R' <<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define M 100001
#define NIL -1
using namespace std;



struct Node{int parent, left , right;};

Node A[M];int D[M];

void setDepth(int x, int y){
    D[x] = y;
    if(A[x].right != NIL) setDepth(A[x].right, y);
    if(A[x].left != NIL) setDepth(A[x].left, y+1);
}

void children(int x){
    int c = A[x].left;
    int i = 0;
    while ( c != NIL){
        if(i != 0) cout << ", " ;
        printf("%d",c);
        c = A[c].right;
        i ++;
    }
}
void output(int x){
    printf("node %d: parent = %d, depth = %d, ",x,A[x].parent,D[x]);
    
    if(A[x].parent == NIL) printf("root, ");
    else if(A[x].left == NIL) printf("leaf, ");
    else printf("internal node, ");
    
    cout << "[";
    children(x);
    cout << "]" << endl;
}

int main(){
    int n,id,k,c,r,l;
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        A[i].parent = NIL;
        A[i].left = NIL;
        A[i].right = NIL;
    }
    for(int i = 0; i < n; i++){
        scanf("%d %d",&id,&k);
        for(int j = 0; j < k; j++){
            scanf("%d",&c);
            if(j == 0) A[id].left = c;
            else A[l].right = c;
            l = c;
            A[c].parent = id;
            
        }
    }
    for(int i = 0; i < n; i++){
        if(A[i].parent == NIL) r = i; 
    }
    setDepth(r,0);
    for(int i = 0; i < n; i++){
        output(i);
    }
    
    return 0;
}




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

#define chmin(a, b) (a = min(a, b))

const int INF = 1e9 + 10;

int n;
int a[10010];
int dp[2][5010][3];

int main()
{
	cin >> n;
	for (int i = 0; i < n - 1; i++){
		cin >> a[i];
	}
	
	fill_n(**dp, 2 * 5010 * 3, INF);
	dp[0][0][0] = 0;
	for (int i = 0; i < n; i++){
		int s = i & 1;
		int t = s ^ 1;
		fill_n(*dp[t], 5010 * 3, INF);
		for (int j = 0; j <= n / 2; j++){
			chmin(dp[t][j + 1][0], dp[s][j][0] + a[i]);
			chmin(dp[t][j][0], dp[s][j][0] + a[i]);
			chmin(dp[t][j + 1][0], dp[s][j][1] + a[i]);
			chmin(dp[t][j][0], dp[s][j][2] + a[i]);
			chmin(dp[t][j + 1][1], dp[s][j][0]);
			chmin(dp[t][j + 1][1], dp[s][j][1]);
			chmin(dp[t][j][2], dp[s][j][0]);
			chmin(dp[t][j][2], dp[s][j][2]);
		}
	}

	cout << dp[n & 1][n / 2][0] << endl;
}

Measured memory_bytes: 1316
#include <bits/stdc++.h>
#define F(i, a, b) for (int i = (a); i < (b); ++i)
#define F2(i, a, b) for (int i = (a); i <= (b); ++i)
#define dF(i, a, b) for (int i = (a); i > (b); --i)
#define dF2(i, a, b) for (int i = (a); i >= (b); --i)
#define maxn 300010
using namespace std;
typedef long long LL;
int ans[maxn];
int main() {
    int n,a,b;
    scanf("%d%d%d", &n,&a,&b);
    int temp=a+b-1, nn=n;
    if (temp>n || n>1LL*a*b) puts("-1");
    else {
        if (a==1) F2(i, 1, n) ans[i]=n-i+1;
        else if (b==1) F2(i, 1, n) ans[i]=i;
        else {
            int x=n-temp,
                grp=x/(a-1),
                rem=x%(a-1);
            dF2(i, a, 1) ans[i]=n--;
            F2(i, 1, grp) {
                int t=(i+1)*a, s=i*a+1;
                dF2(j, t, s) ans[j]=n--;
            }
            int s=(grp+1)*a+1, t=s+rem;
            dF2(i, t, s) ans[i]=n--;
            F2(i, t+1, nn) ans[i]=n--;
            n=nn;
        }
        F2(i, 1, nn) printf("%d ", ans[i]); puts("");
    }
    return 0;
}


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

int main() {
  ll A, B, V, W, T;
  cin >> A >> V >> B >> W >> T;

  if (abs(A - B) <= (V - W) * T)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 3648