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

#define ll long long int
#define mp make_pair 
#define pb push_back
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);
#define ff first
#define ss second
#define MOD  1000000007
#define ll_MAX 922337203685477999
#define endl "\n"
inline ll absdiff(ll a,ll b) {return (a>b)?a-b:b-a;}
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;}
ll gcd(ll a,ll b){if(a==0||b==0) return a+b;  else return gcd(b%a,a); }

int main()
{
    // fast
    ll t_c;t_c = 1;
    // cin>>t_c;
    for (ll ti = 0; ti < t_c; ++ti)
    {   
        ll h,a;cin>>h>>a;
        if(h%a==0) cout<<h/a;
        else cout<<h/a+1;
    }
    return 0;
}   

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int A[n];
  for(int i=0;i<n;i++) cin>>A[i];
  int ans=0;
  bool flag=1;
  while(flag){
    flag=0;
    for(int j=n-1;j>0;j--){
      if(A[j]<A[j-1]){
	swap(A[j],A[j-1]);
	flag=1;
	ans++;
      }
    }
  }
  for(int i=0;i<n;i++) cout<<A[i]<<" \n"[i==n-1];
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,avg;
  double davg;
  cin >> a >> b;
  avg = (a + b)/2;
  davg =((double)a + (double)b) /2;
  if(davg - (double)avg >= 0.5){
    cout << (a + b) /2 + 1 << endl;
  }else{
    cout << (a + b) /2 << endl;
  }
}

Measured memory_bytes: 256
import sys
from collections import deque
input=sys.stdin.readline
sys.setrecursionlimit(10**6)
import math

a,b,h,m=map(int,input().split())
nowh=30*h+(30/60)*m
nowm=6*m
#print(nowh,nowm)
if nowh==nowm:
    print(max(a,b)-min(a,b))
    exit()
if nowh==0:
    nowm=min(nowm,360-nowm)
    print((a**2+b**2-2*a*b*math.cos(math.radians(nowm)))**0.5)
elif nowm==0:
    nowh=min(nowh,360-nowh)
    print((a**2+b**2-2*a*b*math.cos(math.radians(nowh)))**0.5)
else:
    now=max(nowh,nowm)-min(nowh,nowm)
    #print(now)
    #print(math.cos(math.radians(now)))
    print((a**2+b**2-2*a*b*math.cos(math.radians(now)))**0.5)

Measured memory_bytes: 9796
from heapq import heappush, heappop

def dijkstra1(V, n, inf, source):
    # O(ElogV)

    dist = [inf] * (n+1)
    dist[source] = 0
    q = [(0, source)]

    while q:
        cost, u = heappop(q)
        if dist[u] < cost:
            continue
        for c, v in V[u]:
            if dist[v] > dist[u] + c:
                dist[v] = dist[u] + c
                heappush(q, (dist[v], v))

    return dist


def solve():
    INF = 10**25
    N, M = map(int, input().split())
    V = {i:[] for i in range(1, 3*N+1)}
    for _ in range(M):
        u, v = map(int, input().split())
        V[u].append((1, v+(N)))
        V[u+(N)].append((1, v+(2*N)))
        V[u+(2*N)].append((1, v))

    S, T = map(int, input().split())
    dist = dijkstra1(V, 3*N, INF, S)[T]
    print(-1 if dist==INF else dist//3)


if __name__ == "__main__":
    solve()

Measured memory_bytes: 115936
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;

template <typename T> void max_self(T& a, T b){
  a = max(a,b);
}

template <typename T> void min_self(T& a, T b){
  a = min(a,b);
}

void solve(){	
  int n;cin>>n;
  int op = n%10;
  if(op == 3){
    cout<<"bon\n";
  }else if(op==0 || op==1 || op==6 || op==8){
    cout<<"pon\n";
  }else{
    cout<<"hon\n";
  }
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //int t; cin >> t;
  //while(t--) solve();
  //
  solve();
  return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// ----------------------------------------------------------------------------

int main(){
  int x,y,W,H,r;
  cin >> W >> H >> x >> y >> r;
  if(x-r < 0 || W < x+r || y-r < 0 || H < y+r){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return 0;
}



Measured memory_bytes: 3116
# Bubble sort: ALDS1_2_A

def bsort(A, N):
    flag = 1
    swap = 0
    while flag:
        flag = 0
        for j in reversed(range(1, N)):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1
                swap += 1
    return swap

N = int(raw_input())
A = [int(i) for i in raw_input().split()]

swap = bsort(A, N)
print " ".join([repr(i) for i in A])
print swap



Measured memory_bytes: 4660
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#define fi first
#define se second
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	double x;
	double max=0,min=10000000;
	while(true){
		if (cin.eof())break; 
		cin>>x;
		if(x>max) max=x;
		if(x<min) min=x;
	}
	cout<<max-min<<endl;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise fixed(cout);cout<<setprecision(16);
using namespace std;

ostream& operator << (ostream &out, vector<int> &v) { for(auto a:v) out << a<<" "; out<<endl; }

int main()
{
    int n;
    cin >> n;
    vll v(n+2),prefL(n+2),prefR(n+2);

    ll g=0;
    for(int i=1;i<=n;i++) {
        cin >> v[i];
        g=__gcd(g,v[i]);
        prefL[i]=g;
    }
    g=0;
    for(int i=n;i>=1;i--){
        g=__gcd(g,v[i]);
        prefR[i]=g;
    }
    ll gmax=0;
    for(int i=1;i<=n;i++){
        gmax=max(gmax,__gcd(prefL[i-1],prefR[i+1]));
    }
    cout << gmax <<endl;
}


Measured memory_bytes: 2560
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX=3e3 + 10;
ll N,A[MAX];
ll dp[MAX][MAX];
ll solve(int l,int r,int turn) // turn 1 == taro
{
    if(l==r){
            if(turn)return A[l];
            return 0;
    }
    if(l>r||r<l)return 0;
    if(dp[l][r]!=-1)return dp[l][r];
    ll res=0,a=0,b=0;
    if(turn)a=A[l];
    if(turn)b=A[r];
    /*if(A[l]>A[r])
    {
        res = a+solve(l+1,r,turn^1);
    }
    else if(A[l]<A[r])
    {
        res = b+solve(l,r-1,turn^1);
    }
    else
    {*/
        res = a+solve(l+1,r,turn^1);
        if(turn)
        res = max(res,b+solve(l,r-1,turn^1));
        else res = min(res,b+solve(l,r-1,turn^1));
    //}
    return dp[l][r]=res;
}
int main ()
{
    memset(dp,-1,sizeof dp);
    ll s=0;
    cin >> N;
    for(int i=0;i<N;i++){
            cin >> A[i];s+=A[i];
    }
    ll x = solve(0,N-1,1);
    ll y = s-x;
    //cout<<x<<endl;
    //cout<<y<<endl;
    cout<<x-y<<endl;
    return 0;
}



Measured memory_bytes: 71296
import sys
def main():
  n, m = map(int, input().split())
  l = list(map(int, input().split()))
  d = sum(l) / (4 * m)
  cnt = 0;
  for li in l:
    if li >= d:
      cnt = cnt + 1
  if cnt >= m :
    print ("Yes")
  else :
    print ("No")
  return

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <cstdio>
#define maxn 100010
int cnt[2][maxn], M[2], Q[2], m[2], q[2];
int n;
int main() {
	scanf("%d", &n); 
	for (int i = 1, x, p; i <= n; i++) {
		scanf("%d", &x); p = i % 2;
		cnt[p][x]++;
		if (M[p] < cnt[p][x]) M[p] = cnt[p][x], Q[p] = x;
	}
	if (Q[0] != Q[1]) {
		printf("%d\n", n - M[0] - M[1]);
		return 0;
	}
	for (int i = 1; i <= 100000; i++) {
		if (m[0] < cnt[0][i] && i != Q[0]) m[0] = cnt[0][i], q[0] = i;
		if (m[1] < cnt[1][i] && i != Q[1]) m[1] = cnt[1][i], q[1] = i;
	}
	if (M[0] - m[0] > M[1] - m[1]) printf("%d\n", n - M[0] - m[1]);
	else printf("%d\n", n - m[0] - M[1]);
	return 0;
}

Measured memory_bytes: 896
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String x = scn.next();
		String y = scn.next();
      	char[] c1 = x.toCharArray();
      	char[] c2 = y.toCharArray();
      	char ch1 = c1[0];
      	char ch2 = c2[0];
      	int cx = (int)ch1;
      	int cy = (int)ch2;
      	if(cx>cy) System.out.println(">");
      	if(cy>cx) System.out.println("<");
      	if(cx==cy) System.out.println("=");
	}
}

Measured memory_bytes: 35616
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def nCr(com_n, com_r):
    if com_n < com_r: return 0
    return fac[com_n] * ifac[com_r] % md * ifac[com_n - com_r] % md

def nHr(hn,hr):
    return nCr(hn+hr-1,hr)

md = 998244353
n_max = 5000
fac = [1]
for i in range(1, n_max + 1): fac.append(fac[-1] * i % md)
ifac = [1] * (n_max + 1)
ifac[n_max] = pow(fac[n_max], md - 2, md)
for i in range(n_max - 1, 1, -1): ifac[i] = ifac[i + 1] * (i + 1) % md

def solve():
    res=0
    for p in range(min(t,n)//2+1):
        cur=nCr(t//2,p)*nHr(k,n-2*p)
        if p&1:res-=cur
        else:res+=cur
        res%=md
    return res

k,n=MI()
ans=[]
for t in range(2,k+2):
    a=solve()
    ans.append(a)
    print(a)
ans.reverse()
for a in ans[1:]:print(a)


Measured memory_bytes: 9644
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<ll>
#define ti tuple<int, int, int>

int main() {

    ll N;
    cin >> N;

    vector<vl> M(10, vl(10, 0));
    string s;
    int st, ed;
    for (int i = 1; i <= N; i++) {
        s = to_string(i);
        st = s[0] - '0';
        ed = s[s.size()-1] - '0';
        M[st][ed]++;
    }

    ll ans = 0;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            ans += M[i][j] * M[j][i];
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
    int S;
    cin >> S;
    int a[100000],b[100000],c[100000];
    for(int i=0;i<S;i++) cin >> a[i] >> b[i] >> c[i];

    int dp[100000][3]={-1};
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    for(int i=1;i<S;i++){
        for(int j=0;j<3;j++){ 
            if(j==0) dp[i][j] = max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
            if(j==1) dp[i][j] = max(dp[i-1][2]+b[i],dp[i-1][0]+b[i]);
            if(j==2) dp[i][j] = max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]); 
        }
    }

    for(int i=0;i<S;i++){
     //   for(int j=0;j<3;j++) cout << "i:" << i  << " " << "j:" << j << " "<< "dp:" <<  dp[i][j] << " ";
      //  cout << endl;
    }
    cout << max({dp[S-1][0],dp[S-1][1],dp[S-1][2]}) << endl;
    return 0;
 }

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<cmath>
using namespace std;
typedef pair<int,int> pii;
#define MAXN 200007
#ifdef LOCAL
#define DBG(...) printf(__VA_ARGS__)
#else
#define DBG(...) (void)(0)
#endif
int L, R, X;
struct segtree {
	int data[MAXN<<2], down[MAXN<<2];
	segtree() {
		memset(data,0,sizeof data);
		memset(down,0,sizeof down);
	}
	void opa(int p, int l, int r) {
		if(l>=L && r<=R) {
			data[p]=max(data[p],X), down[p]=max(down[p],X);
			return;
		}
		if(down[p]) {
			data[p*2]=max(data[p*2],down[p]);
			data[p*2+1]=max(data[p*2+1],down[p]);
			down[p*2]=max(down[p*2],down[p]);
			down[p*2+1]=max(down[p*2+1],down[p]);
			down[p]=0;
		}
		int m=(l+r)/2;
		if(m>=L) opa(p*2,l,m);
		if(m<R) opa(p*2+1,m+1,r);
	}
	int opq(int p, int l, int r) {
		if(l==L && r==L) {
			return data[p];
		}
		if(down[p]) {
			data[p*2]=max(data[p*2],down[p]);
			data[p*2+1]=max(data[p*2+1],down[p]);
			down[p*2]=max(down[p*2],down[p]);
			down[p*2+1]=max(down[p*2+1],down[p]);
			down[p]=0;
		}
		int m=(l+r)/2;
		if(m>=L) return opq(p*2,l,m);
		return opq(p*2+1,m+1,r);
	}
} segh, segv;
int main() {
#ifndef LOCAL
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
	int n, q; cin >> n >> q;
	long long ans=1ll*(n-2)*(n-2);
	while(0<q--) {
		int i,x; cin >> i >> x;
		if(i==1) {
			L=x;
			int va=segh.opq(1,1,n);
			ans-=n-va-2;
			L=1; R=n-va-1; X=n-x;
			segv.opa(1,1,n);
		} else {
			L=x;
			int va=segv.opq(1,1,n);
			ans-=n-va-2;
			L=1; R=n-va-1; X=n-x;
			segh.opa(1,1,n);
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 16136
#include <bits/stdc++.h>
using namespace std;
int n, m, x;
int ans = INT_MAX;
vector<int> xx;
void subset(vector< vector<int> > &v, int ind, int &c) {
    if(ind >= n) {
        return;
    }
    subset(v, ind+1, c);
    c += v[ind][0];
    int ok = 1;
    for(int i = 1; i <= m; i++) {
        xx[i-1] += v[ind][i];
        if(xx[i-1] < x)
            ok = 0;
    }
    if(ok) {
        ans = min(ans, c);
    } else {
        subset(v, ind+1, c);
    }
    for(int i = 1; i <= m; i++) {
        xx[i-1] -= v[ind][i];
    }
    c -= v[ind][0];
    return;
}

int main() {
  cin >> n >> m >> x;
  xx.resize(m);
  vector< vector<int> > v(n, vector<int> (m+1, 0));
  for(int i = 0; i < n; i++) {
      for(int j = 0; j < m+1; j++) {
          cin >> v[i][j];
      }
  }
  int c = 0;
  subset(v, 0, c);
  if(ans == INT_MAX){
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    int counter =0;
    string m , n ;
    cin>>m>>n;
    for(int i =0 ; i< m.length() ; i++){
            if(m[i] != n[i]){
                counter++;
            }


    }
   cout<<counter;
return 0;
}


Measured memory_bytes: 3916
import java.util.*;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[3];
		for(int i = 0; i < 3; i++) a[i] = sc.nextInt();
		Arrays.sort(a);
		boolean ok = false;
		if(a[0] + a[1] == a[2]) ok = true;
		System.out.println((ok)?"Yes":"No");
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n ,k;
  cin >> n >> k;
  vector<int> d(10);
  for (int i=0;i<k;i++){
    int x;
    cin >> x;
    d.at(x)++;
  }
  for(int i=n;;i++){
    string s = to_string(i);
    bool b = true;
    for(int j=0;j<s.size();j++){
      if(d[s[j]-'0']){
        b = false;
      }
    }
     if(b){
        cout << i << endl;
        break;
      }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int N,X;
    cin >> N >> X;
    vec<int> m(N);
    rep(i, N) cin >> m[i];
    ll sum = accumulate(all(m),0);
    sort(all(m));
    cout << N + (X-sum)/m[0] << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <vector>
#define mid ((l + r) >> 1)
#define lson (x << 1)
#define rson ((x << 1) | 1)
using namespace std;
typedef long long LL;
const LL N = 998244353;

LL val[800005];

void pushup(LL x){
	val[x] = max(val[lson],val[rson]);
}

void modify(LL x,LL l,LL r,LL L,LL R,LL v){
	if(L > R) return;
	if(L <= l && r <= R){
		val[x] = v;
		return;
	}
	if(L <= mid) modify(lson,l,mid,L,R,v);
	if(R > mid) modify(rson,mid + 1,r,L,R,v);
	pushup(x);
}

LL query(LL x,LL l,LL r,LL L,LL R){
	if(L > R) return -1;
	if(L <= l && r <= R) return val[x];
	LL ret = 0;
	if(L <= mid) ret = max(ret,query(lson,l,mid,L,R));
	if(R > mid) ret = max(ret,query(rson,mid + 1,r,L,R));
	pushup(x); return ret;
}

struct node{
	LL x,d;
}s[400005];
bool cmp(node x,node y){
	return x.x < y.x;
}

LL n,ans = 0;
LL mr[400005],suf[400005] = {0},dp[400005] = {0};

LL kpw(LL x,LL y){
	LL ans = 1,tmp = x % N;
	while(y){
		if(y & 1) ans = (ans * tmp) % N;
		tmp = (tmp * tmp) % N;
		y >>= 1;
	}
	return ans;
}

int main(){
	cin >> n;
	for(LL i = 1;i <= n;i ++) cin >> s[i].x >> s[i].d;
	sort(s + 1,s + 1 + n,cmp);
	
	suf[n + 1] = 0;
	for(LL i = n;i >= 1;i --){
		mr[i] = i;
		LL L = i,R = n,MID,tmp = i;
		while(L <= R){
			MID = (L + R) >> 1;
			if(s[i].x + s[i].d > s[MID].x){
				tmp = MID;
				L = MID + 1;
			}
			else R = MID - 1;
		}
		mr[i] = max(i,query(1,1,n,i + 1,tmp)); modify(1,1,n,i,i,mr[i]);
		if(mr[i] == n) dp[i] = 1;
		else dp[i] = (suf[mr[i] + 1] + 1) % N;
		suf[i] = (suf[i + 1] + dp[i]) % N;
		ans = (ans + dp[i]) % N;
	}
	ans = (ans + 1LL) % N;
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 20224
//#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl '\n'
#define all(c) c.begin(),c.end()
const int MOD=1e9+7;
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
	int n,m,ans=0;
	cin>>n>>m;
	vector<int> v(m),p(m);
	for(int i=0;i<m;i++){
		int k;
		cin>>k;
		for(int j=0;j<k;j++){
		  int x;
		  cin>>x;
		  x--;
		  v[i]|=(1<<x);	
		}
	}
	for(auto& it:p)cin>>it;
	for(int mask=0;mask<(1<<n);mask++){
	   int val=0;
	   for(int i=0;i<m;i++){
		     int cnt=0;
		     for(int j=0;j<n;j++){
				 if((mask&(1<<j)) and (v[i]&(1<<j)))cnt++; 
				}
		  if(cnt%2==p[i])val++;
		  }
	  if(val==m)ans++;	
	}
	cout<<ans<<endl;
}
int32_t main(){
  IOS;
  solve();
  //debug();
 #ifdef LOCAL_DEFINE
 cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
 #endif	
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
  int w,h,x,y,r;
  scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
  if(w-r>=x&&r<=x&&h-r>=y&&r<=y){
   printf("Yes\n");
  }else{
   printf("No\n");
   }
}


Measured memory_bytes: 2680
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
typedef pair<int, int> P;
int a[114], b[114];


signed main() {
	int q; cin >> q;
	rep(x, q) {
		cin >> a[x] >> b[x];
		if (a[x] > b[x])swap(a[x], b[x]);

		if (a[x] == b[x]) {
			cout << a[x] * 2 - 2 << endl;
		}
		else if (abs(a[x] - b[x]) == 1) {
			cout << a[x] * 2 - 2 << endl;
		}
		else {
			int mn = sqrt(a[x] * b[x]);
			if (mn*mn == a[x] * b[x])mn--;
			if (mn*mn + mn >= a[x] * b[x])cout << mn * 2 - 2 << endl;
			else cout << mn * 2 - 1 << endl;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<pair<int, int>> vec;
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		vec.push_back({a,b});
	}
	bool good = false;
	for(int i=2;i<n;i++){
		if((vec[i].first == vec[i].second) && (vec[i-1].first == vec[i-1].second) && (vec[i-2].first == vec[i-2].second)){
			cout<<"Yes"<<endl;
			good = true;
			break;
		}
	}
	if(!good)	cout<<"No"<<endl;
}


Measured memory_bytes: 3636
s = raw_input()

s_str = list(str(s))
list_0 = []
list_1 = []
count_0 = 0
count_1 = 0

for i in range(0,len(s_str)):
 if i%2 == 0:
  list_0.extend(s_str[i])
 else:
  list_1.extend(s_str[i])

v0 = list_0.count("1")
v1 = list_1.count("1")

if v0 > v1:
 v = v1 + list_0.count("0")
else:
 v = v0 + list_1.count("0")

print v

Measured memory_bytes: 7616
//-------All power is within you,you can do Anything and Everything.---------//
 
    #include <bits/stdc++.h>
    using namespace std;
  
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
 
    #define pb push_back
    #define MP make_pair
    #define F first
    #define S second
    #define int long long
    #define fo(i,a,b) for(int i=a;i<b;i++)
    #define rfo(i,b,a) for(int i=b;i>=a;i--)
    #define deb(x) cout<<#x<<" "<<x<<endl;
    #define mem( a, val ) memset(a, val, sizeof( a ) )
    #define deci( x ) cout<<fixed<<setprecision( x );
    #define bitcount( x ) __builtin_popcountll( x )
    #define endl "\n" 
 
    
    typedef vector<int> vi;
    typedef pair<int,int> pi; 
    
    const int MOD =  1000000007 ;
    const int MAX = 2e6 + 7;
    const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ V $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//  
    
    int i,j,k,t,n,q,l,r,mid;
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ F $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
    
    int x,tot;
    void solve()
    {
        cin>>x;
        tot=1000*(x/500);
        x%=500;
        tot+=5*(x/5);
        cout<<tot<<endl;
 
    }
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
//                          GAME STARTS FROM HERE                            //
 
    int32_t main() 
    {
    
        // int start,stop=clock();
        // cout<<"time:"<<(stop-start)/double(CLOCKS_PER_SEC)*1000<<endl;
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
    
        // cin>>t;while(t--)
            solve();
    
        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <numeric>
#include <limits>

const long long int Z = 1000000007;
const long long int INF = 1 << 30;
int flag = 0;
using ll = long long;

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

}
 ll lcm(ll a, ll b) {
	 ll g = gcd(a, b);
	 return a / g * b;
 }

int main() {
	int n, a[100][100];
	std::cin >> n;
	for (int i = 1;i <= 2;i++) {
		for (int j = 1;j <= n;j++) {
			std::cin >> a[i][j];
		}
	}
	int ans = 0;
	for (int i = 1;i <= n;i++) {
		int b = 0;
		for (int j = 1;j <= i;j++) {
			b += a[1][j];
		}
		for (int j = i ;j <= n;j++) {
			b += a[2][j];
		}
		if (ans < b) {
			ans = b;
		}
	}
	std::cout<<ans<<std::endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
#define PI acos(-1)
using namespace std;
int main(){
  int a,b,n;
  while(cin>>a>>b>>n){
    int sum=0;
    a%=b;
    rep(i,n){
      a*=10;
      sum+=a/b%10;
      a%=b;

    }
    cout<<sum<<endl;
  }

}

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

use std::collections::BinaryHeap;

fn main() {
    let (_n, m) = get!(usize, usize);
    let mut q = get!(String).split_whitespace().map(|w| w.parse::<u64>().unwrap()).collect::<BinaryHeap<_>>();
    for _ in 0..m {
        if let Some(a) = q.pop() {
            q.push(a/2);
        }
    }
    println!("{}", q.into_iter().sum::<u64>());
}

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

int main(){
    int n;
    double t,a;
    cin >> n >> t >> a;
    int h[n];
    rep(i,n)cin >> h[i];
    int ans = 0;
    rep(i,n){
        if(i == 0)continue;
        double x = t-h[i]*0.006;
        double y = t-h[ans]*0.006;
        if(abs(y-a) >= abs(x-a))ans = i;
    }
    cout << ans+1 << endl;
    return 0;
}

Measured memory_bytes: 256
import math

def comb(n, r, mod):
    return math.factorial(n + r - 1)//(math.factorial(n - 1)*math.factorial(r))%mod

s = int(input())
mod = 10**9 + 7
ans = 1

if s < 3:
    ans = 0

for i in range(2, 700): #分割数, 1の時は1通りなので除外
    if s < 3*i:
        break
    r = s - i*3
    ans = (ans + comb(i, r, mod))%mod

print(ans)


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

int main()
{

	int join_time[9], leave_time[9], ans[9];

	for(int i = 0; i < 3; i++) {
		cin >> join_time[i] >> join_time[i + 3] >> join_time[i + 6];
		cin >> leave_time[i] >> leave_time[i + 3] >> leave_time[i + 6];
	}

	for(int i = 0; i < 3; i++) {
		if(join_time[i + 6] > leave_time[i + 6]) {
			ans[i + 6] = leave_time[i + 6] + (60 - join_time[i + 6]);
			leave_time[i + 3] - 1 < 0 ? leave_time[i + 3] = 59, leave_time[i]-- : leave_time[i + 3]--;
		}
		else {
			ans[i + 6] = leave_time[i + 6] - join_time[i + 6];
		}
		join_time[i + 3] > leave_time[i + 3] ? ans[i + 3] = leave_time[i + 3] + (60 - join_time[i + 3]), leave_time[i]-- : ans[i + 3] = leave_time[i + 3] - join_time[i + 3];
		ans[i] = leave_time[i] - join_time[i];
	}

	for(int i = 0; i < 3; i++) cout << ans[i] << " " << ans[i + 3] << " " << ans[i + 6] << endl;

	return 0;

}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mod 1000000007
using namespace std;

void fast(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
}

int main(){
    fast();
    ll t=1;
//    cin>>t;
    while(t--){
    	ll n,ans=0;
    	cin>>n;
    	for(ll i=1;i<=n;i++){
    		ll x;
    		cin>>x;
    		if(x%2==1 and i%2==1)
    		++ans;
		}
		cout<<ans;
	}
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(a) (a).begin(), (a).end()
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;

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

  double z;
  for (int i = 1; i <= n; ++i) {
    int ans = 0;
    for (int x = 1; x * x <= n ; ++x) {
      for (int y = 1; y * y <= n; ++y) {
        if (i >= (x * x + y * y + x * y)) {
          z = (-(double)(x + y) + sqrt(static_cast<double>((x + y) * (x + y) + 4 * (i - x * x - y * y - x * y)))) / 2.0;
          if  (z == ceil(z) && z >= 1) {
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }
}


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

using namespace std;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int vis[68][68];
string str;
string solve="";
vector<char>ak47;
int main()
{
	int a,b,c,d,e,f,g,h,i,j,k,l=0,p,q,r,s,t,sum=0;
	cin>>a>>b>>c;
	 for(i=1;i<=10;i++)
	 {
	 	if(i==1)
	 	{
	 		cout<<a*c-b<<'\n';
	 		sum=a*c-b;
		 }
		 else
		 {
		 	sum=sum*a-b;
		 	cout<<sum<<'\n';
		 }
	 }
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k,x,y,a;
cin>>n>>k>>x>>y;
if((n-k)>=0)
a=k*x+(n-k)*y;
else if((n-k)<0)
a=n*x;
cout<<a<<endl;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int x,y,a,b;
  	a=0,b=0;
  	cin >> x >> y;
    if(x==2){
    	a=3;
    }
  	else if(x==4 || x==6 || x==9 || x==11){
    	a=2;
    }
  	else{
    	a=1;
    }
  	if(y==2){
    	b=3;
    }
  	else if(y==4 || y==6 || y==9 || y==11){
    	b=2;
    }
  	else{
    	b=1;
    }
  	if(a==b)
  		cout << "Yes" << endl;
  	else
      	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 1000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	ll n;
	cin >> n;
	ll a[n];
	bool ok = true;
	for(int i=0; i<n; i++)cin >> a[i];
	for(int i=n-2; i>=0; i--){
		if(a[i]>a[i+1]){
			a[i]--;
			if(a[i]>a[i+1])ok = false;
		}
	}
	if(ok){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
    return 0;
}




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

using namespace std;

int main(){
    int64_t a,b,c,d,e;
    int64_t res,n,inter ;

    cin >>n >>a >>b >>c >>d >>e;
    inter = min({a,b,c,d,e});


    if(n%inter==0){
        cout <<  n/inter+4 <<endl;
    }else{
        cout << n/inter+5 <<endl;
    }

    }

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

int n, k;

int main() {
	cin >> n >> k;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    int a; cin >> a;
    if (a >= k) cnt++;
  }
  cout << cnt;

	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

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

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b) - 1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define rb(i,x) for (auto& i : x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define UNIQUE(x) (x).resize(unique(all(x)) - begin(x))

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define F first
#define S second

#define pow10(n) stoll("1"+string(n,'0'))

#define debug(x) cout << ">>> " << #x << ": " << x << '\n'

const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LNF = 1e18;

void setIO(string s) {
	ios_base::sync_with_stdio(0); cin.tie(0);
//#ifndef ONLINE_JUDGE
//	freopen((s+".in").c_str(),"r",stdin);
////	freopen((s+".out").c_str(),"w",stdout);
//#endif
}

char a[7][7];

int main() {
    
    setIO("input");
    int n, m, k; cin >> n >> m >> k;
    for(int i=0; i<n; ++i) {
        for(int j=0; j<m; ++j)
            cin >> a[i][j];
    }

    int ans = 0;
    for(int i=0; i<=(1 << n)-1; ++i) {
        for(int j=0; j<=(1<<m)-1; ++j) {
            int black = 0;
            for(int y=0; y<n; ++y) {
                for(int x=0; x<m; ++x) {
                    if((i & (1<<y)) == 0 && (j & (1<<x)) == 0 && a[y][x] == '#')
                        ++black;
                }
            }
            if(black == k)
                ++ans;
        }
    }
    cout << ans;

}

/*  ! CHECK THIS IF YOU GET IT WRONG !
	* int overflow, array bounds, NO VLAs
	* uninitialized local variables, rounding errors
	* intermediate result type, scientific
	* special cases (n = 0 or 1?)
	* reset your variables in scope
	* INF not large enough for ans, adding value to _MAX
	* using wrong variables, sorting extra 0s in global array
	* comment out input from file
	* operator precedence
*/

Measured memory_bytes: 3552
int printf(const char * restrict, ...) __attribute__((__format__ (__printf__, 1, 2)));
int scanf(const char * restrict format, ...);
typedef __typeof__(sizeof(int)) size_t;
size_t strlen(const char *s);
int strcmp(const char *s1, const char *s2);

int main(void){
    int n,ans=1;
    scanf("%d",&n);
    char w[n][120];
    for (int i=0; i<n; i++){
        scanf("%s",w[i]);
    }
    for (int i=0; i<n-1; i++){
        if (w[i][strlen(w[i])-1]!=w[i+1][0]){
            ans=0;
        }
    }
    for (int i=0; i<n; i++){
        for (int j=0; j<n; j++){
            if (i!=j && strcmp(w[i],w[j])==0){
                ans=0;
            }
        }
    }
    if (ans==1){
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0 ;
}

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

int main() {
	int a, b, c, k;
	int max = 0;
	cin >> a >> b >> c >> k;
	vector<int> array;
	array.push_back(a);
	array.push_back(b);
	array.push_back(c);
	for (int i = 0; i < k; i++) {
		sort(array.begin(), array.end());
		array[2] *= 2;
	}
	cout << array[0] + array[1] + array[2] << endl;

	return 0;
}

Measured memory_bytes: 256
import scala.io.{StdIn => in}

object Main extends App {
  val Array(n, m) = in.readLine.split(" ").map(_.toInt)

  val (l, r) = (1 to m)./:((0,n)) { (acc, e) =>
    val Array(l, r) = in.readLine.split(" ").map(_.toInt)
    (acc._1 max l, acc._2 min r)
  }

  val ans = if(l > r) 0 else r - l + 1
  println(ans)
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  int n; scanf("%d", &n);
  long long ans = 0, sum = 0;
  for (int a, i = 0; i < n; ++i) {
    scanf("%d", &a);
    sum += a;
    if (a) continue;
    ans += sum/2;
    sum = 0;
  }
  printf("%lld", ans+sum/2);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return true; } return false;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return true; } return false;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  string s;
  cin >> s;
  vector<int32> rsum(n+1,0);
  REP(i,n)rsum[i+1] = rsum[i] + (s[i]=='R'?1:0);
  int32 ans = inf;
  REP(i,n+1){
    int32 lw = i - rsum[i];
    int32 rr = rsum[n] - rsum[i];
    int32 swp = min(lw,rr);
    chmin(ans, lw + rr - swp);
  }
  ANS(ans);
  return 0;
}

Measured memory_bytes: 5172
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, xat[100008], yat[100008];
bool used[100008]; 
ll INF = 1e9+1;
vector<vector<ll>> x(100008, vector<ll>(2));
vector<vector<ll>> y(100008, vector<ll>(2));

bool compare(vector<ll> a, vector<ll> b){return a[0] < b[0];}

int main() {
	cin >> n;
	for(ll i = 1; i <= n; i++){
		cin >> x[i][0] >> y[i][0];
		x[i][1] = i;
		y[i][1] = i;
		used[i] = false;
	}
	sort(x.begin()+1, x.begin()+(n+1), compare);
	sort(y.begin()+1, y.begin()+(n+1), compare);
	
	for(ll i = 1; i <= n; i++){
		xat[x[i][1]] = i;
		yat[y[i][1]] = i;
	}
	
	
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, 1));
	
	ll sum = 0;
	while(!que.empty()){
		P p = que.top(); que.pop();
		ll number = p.second;
		
		if(used[number]){continue;}
		else{
			sum += p.first;
			ll nowx = xat[number];
			ll nowy = yat[number];
			used[number] = true;
			if(nowx != 1){que.push(P(x[nowx][0]-x[nowx-1][0], x[nowx-1][1]));}
			if(nowx != n){que.push(P(x[nowx+1][0]-x[nowx][0], x[nowx+1][1]));}
			if(nowy != 1){que.push(P(y[nowy][0]-y[nowy-1][0], y[nowy-1][1]));}
			if(nowy != n){que.push(P(y[nowy+1][0]-y[nowy][0], y[nowy+1][1]));}
		}
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 19060
#include <stdio.h>
#include<string.h>

int main(){
	char s[200001];
	int a,b;
	int i,j;
	scanf("%s",s);
	for(i = 0;i<strlen(s);i++){
		if(s[i]=='A'){
			a = i;
			break;
		}
	}
	for(j = strlen(s);j>0;j--){
		if(s[j]=='Z'){
			b = j;
			break;
		}
	}
	printf("%d",b-a+1);
	return 0;
}


Measured memory_bytes: 384
import java.io.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
int count=0;
while((line=br.readLine())!=null){
int a=0;
boolean f=false;
for(int i=0;i<line.length();i++){
if(!f){
count+=a;
a=0;
}
f=false;
if(line.charAt(i)>='0'&&line.charAt(i)<='9'){
a=a*10+(int)(line.charAt(i)-'0');
f=true;
}
}
count+=a;
}
System.out.println(count);
}
}

Measured memory_bytes: 16860
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

bool money[109];

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

	int N, M, X; cin >> N >> M >> X;
	for (int i = 0; i < M; i++) {
		int tmp; cin >> tmp;
		money[tmp] = true;
	}

	int sum1 = 0;
	int sum2 = 0;
	for (int i = 0; i < X; i++) if (money[i]) sum1++;
	for (int i = X + 1; i < N; i++) if (money[i]) sum2++;
	cout << min(sum1, sum2) << endl;

	return 0;
}

Measured memory_bytes: 256
N=int(input())
t=[0]*N
x=[0]*N
y=[0]*N
for i in range(N):
    t[i],x[i],y[i]=map(int,input().split())
sx=0
sy=0
st=0
flag=True
for i in range(N):
    l=abs(x[i]-sx)+abs(y[i]-sy)
    if flag==False:
        break
    if l<=(t[i]-st) and ((t[i]-st)-l)%2==0:
        flag=True
    else:
        flag=False
    sx=x[i]
    sy=y[i]
    st=t[i]
if flag==True:
    print('Yes')
else:
    print('No')

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

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

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    ll ans = 0;
    for(int i = 1; i < N; i++){
        if(a[i] >= a[i-1])continue;
        ans += a[i-1] - a[i];
        a[i] = a[i-1];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4016
#!/usr/bin/env python3
import sys


def solve(s: str, t: str):
    n, m = len(s), len(t)
    dp = [[0]*(m+1) for _ in range(n+1)]

    for i in range(n):
        for j in range(m):
            if s[i] == t[j]:
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1], dp[i][j] + 1)
            else:
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

    ans = ""
    while m > 0 and n > 0:
        if s[n-1] == t[m-1]:
            ans = s[n-1] + ans
            n -= 1
            m -= 1
        elif dp[n][m] == dp[n-1][m]:
            n -= 1
        else:
            m -= 1
    print(ans)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    t = next(tokens)  # type: str
    solve(s, t)


if __name__ == '__main__':
    main()


Measured memory_bytes: 112220
#include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;

int main() {
    #ifdef LOCAL_RUN
    freopen("task.in", "r", stdin);
    freopen("task.out", "w", stdout);
    //freopen("task.err", "w", stderr);
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);

    string s;
    cin >> s;

    int cnt[26] = {0};
    int last[26] = {-1};
    for (int i = 0; i < 26; ++i) {
        last[i] = -1;
    }
    for (int i = 0; i < SZ(s); ++i) {
        int c = s[i] - 'a';
        cnt[c] = max(cnt[c], i - last[c] - 1);
        last[c] = i;
    }
    for (int i = 0; i < 26; ++i) {
        cnt[i] = max(cnt[i], SZ(s) - last[i] - 1);
    }
    cout << *min_element(cnt, cnt + 26) << '\n';
}


Measured memory_bytes: 256
/*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГИ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░ 
*/
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <cassert>
#include <iomanip>
 
 
 
using namespace std;
 
 
 
 
#define ll long long



int main() {
	int x;
	scanf("%d", &x);
	int i = 1;
	while (i * (i + 1) / 2 < x) {
		i++;
	}
	cout << i << endl;
	return 0;
}






















Measured memory_bytes: 256
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> inline void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> inline void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const long long INF = 1LL<<60;

int main() {
    ll n;
    cin >> n;
    map<ll, ll> a;
    ll sum = 0;
    rep(i,n) {
        ll t;
        cin >> t;
        sum += t;
        ll temp = 0;
        auto it = a.find(t);
        if (it!=a.end()) {
            temp = it->second;
        }
        a[t] = 1 + temp;
    }
    ll q; cin >> q;
    rep(i, q) {
        ll b,c;
        cin >> b >> c;
        auto it = a.find(b);
        if (it!=a.end()) {
            sum -= it->second * b;
            sum += it->second * c;
            auto it2 = a.find(c);
            if(it2 != a.end()) {
                ll temp2 = it2->second + it->second;
                a.erase(c);
                a[c] = temp2;
            } else {
                a[c] = it->second;
            }
            a.erase(b);
        }

        print(sum);
    }

    return 0;
}


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

using namespace std;
typedef long long ll;

const int maxN = 1e5 + 5;
int n, m;
vector<int> adj[maxN];
ll dp[maxN];

ll solve(int v) {
    if (dp[v] != -1) return dp[v];
    ll temp = 0;
    for (auto it : adj[v]) {
        temp = max(temp, solve(it) + 1);
    }
    return dp[v] = temp;
}

int main() {
    ios_base::sync_with_stdio(false);

    cin >> n >> m;
    int x, y;
    for (int i = 1 ; i <= m; i++) {
        cin >> x >> y;
        adj[x].push_back(y);
    }
    memset(dp, -1, sizeof(dp));
    ll ans = 0;
    for (int i = 1; i <= n; i++) ans = max(ans, solve(i));
    cout << ans;

    return 0;
}


Measured memory_bytes: 8576
import java.util.*

fun main(args : Array<String>) {
    println(inOutExec(Scanner(System.`in`)))
}

class CityInfo(val pref: Int, val year: Int, var index: Int = 0)

fun inOutExec(scanner: Scanner): String {
    val numOfPref = scanner.nextInt()
    val numOfCity = scanner.nextInt()

    val citiesIn2 = ArrayList<CityInfo>(numOfCity)
    repeat(numOfCity) {
        citiesIn2.add(CityInfo(scanner.nextInt(), scanner.nextInt()))
    }

    val cityCounter = Array(numOfPref) {0}
    citiesIn2.sortedBy { it.year }
            .forEach {
                cityCounter[it.pref-1]++
                it.index = cityCounter[it.pref-1]
            }

    val sb = StringBuilder()
    for (city in citiesIn2) {
        sb.append(city.pref.toString().padStart(6, '0'))
                .append(city.index.toString().padStart(6, '0'))
                .append("\n")
    }
    return sb.toString()
}


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

int main (){
  int a,c;
  string b;
  for(int i = 0; i < 20000; i++){
    cin >> a >> b >> c;

    if(b == "+") cout << a + c << endl;
    else if(b == "-") cout << a - c << endl;
    else if(b == "*") cout << a * c << endl;
    //else if(b == "/") && (c == 0) Nothing done
    else if((b == "/") && (c != 0)) cout << a / c << endl;
    else if(b == "?") break;
  }
}



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

int main(){
	int N;
	cin >> N;
	string x[N];
	string u[N];
	int yen = 0;
	double btc = 0;
	for(int i = 0; i < N; i++) cin >> x[i] >> u[i];
	for(int i = 0; i < N; i++){
		if(u[i] == "JPY") yen += atoi(x[i].c_str());
		else btc += atof(x[i].c_str());
	}
	double res = (double)yen + btc * 380000;
	cout << res << endl;
}


Measured memory_bytes: 256
def q2():
    """ B - Uneven Numbers """
    N = int(input())
    keta = 1
    d = N
    while True:
        d, _ = divmod(d, 10)
        if d > 0:
            keta += 1
        else:
            break

    ans = 0
    if keta == 1:
        ans = N
    elif keta == 2:
        ans = 9
    elif keta == 3:
        ans = 9 + (N - 100) + 1
    elif keta == 4:
        ans = 9 + 900
    elif keta == 5:
        ans = 9 + 900 + (N - 10000) + 1
    elif keta == 6:
        ans = 9 + 900 + 90000
    print(ans)


if __name__ == '__main__':
    q2()


Measured memory_bytes: 3064