akhauriyash/Code-Regression huggingface dataset:
n,y = map(int,input().split())
yukichi = -1
higuchi = -1
noguchi = -1
for i in range(n+1):
    for j in range(n+1-i):
        if 10000*i+5000*j+1000*(n-i-j)==y:
            yukichi = i
            higuchi = j
            noguchi = n-i-j

print("{} {} {}".format(yukichi,higuchi,noguchi))


Measured memory_bytes: 2940
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
vector<pair<int,int> >g[110000];
int t[110000];
void dfs(int a,int b,int c){
	t[a]=c;
	for(int i=0;i<g[a].size();i++){
		if(g[a][i].first==b)continue;
		dfs(g[a][i].first,a,(c+g[a][i].second)%2);
	}
}
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a-1;i++){
		int p,q,r;scanf("%d%d%d",&p,&q,&r);p--;q--;
		g[p].push_back(make_pair(q,r));
		g[q].push_back(make_pair(p,r));
	}
	dfs(0,-1,0);
	for(int i=0;i<a;i++)printf("%d\n",t[i]);
}


Measured memory_bytes: 9344
N = int(input())
def sub(l, d):
  if d == N:
    s = "".join(["abcdefghijklmnopqrstuvwxyz"[i] for i in l])
    print(s)
    return
  for j in range(max(l)+1+1):
    sub(l+[j], d+1)
sub([0], 1)


Measured memory_bytes: 4412
#include <iostream>
using namespace std;
#define fin(ans) cout << (ans) << '\n'
int main()
{
    int A[3];
    cin >> A[0] >> A[1] >>A[2];
    sort(A,A+3);
    if(A[0] == A[1] && A[1] == A[2]){
        fin("No");
    }else if ((A[0] != A[1] && A[1] != A[2]) ){
        fin("No");
    }else{
        fin("Yes");
    }
    
        return 0;
}

Measured memory_bytes: 3072
#include <stdio.h>

int main(void){
	int a1[3],a2[3];
	int b1[3],b2[3];
	int c1[3],c2[3];
	int x=0,y=0,z=0;
	
	scanf("%d %d %d %d %d %d",&a1[0],&a1[1],&a1[2],&a2[0],&a2[1],&a2[2]);
	scanf("%d %d %d %d %d %d",&b1[0],&b1[1],&b1[2],&b2[0],&b2[1],&b2[2]);
	scanf("%d %d %d %d %d %d",&c1[0],&c1[1],&c1[2],&c2[0],&c2[1],&c2[2]);
	
	x=(3600*a2[0]+60*a2[1]+a2[2])-(3600*a1[0]+60*a1[1]+a1[2]);
	y=(3600*b2[0]+60*b2[1]+b2[2])-(3600*b1[0]+60*b1[1]+b1[2]);
	z=(3600*c2[0]+60*c2[1]+c2[2])-(3600*c1[0]+60*c1[1]+c1[2]);
	
	printf("%d %d %d\n",x/3600,(x-3600*(x/3600))/60,x-60*(x/60));
	printf("%d %d %d\n",y/3600,(y-3600*(y/3600))/60,y-60*(y/60));
	printf("%d %d %d\n",z/3600,(z-3600*(z/3600))/60,z-60*(z/60));
	
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define endl "\n"
#define inf (ll)1e18+1
using namespace std::chrono;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll k,n;
    cin>>n>>k;
    vector<ll> ar(n);
    ll sum=0;
    for(ll x=0;x<n;x++)
    {
        cin>>ar[x];
        sum+=ar[x];
    }
    sort(ar.begin(),ar.end());
    ll ans=0;
    for(ll x=0;x<n-k;x++){
        ans+=ar[x];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

struct Card{
  char suit;
  char value;
};

void bubble(struct Card A[],int n){
  int i,j;
  struct Card t;

  for(i = 0;i < n;i++){
    for(j = n - 1;j >= i + 1;j--){
      if(A[j].value < A[j - 1].value){
	t = A[j];
	A[j] = A[j - 1];
	A[j - 1] = t;
      }
    }
  }
}

void selection(struct Card A[],int n){
  int i,j,mini;
  struct Card t;

  for(i = 0;i < n;i++){
    mini = i;

    for(j = i;j < n;j++){
      if(A[j].value < A[mini].value){
	mini = j;
      }
    }

    t = A[i];
    A[i] = A[mini];
    A[mini] = t;
  }
}

void print(struct Card A[],int n){
  int i;

  for(i = 0;i < n;i++){
    if(i > 0) printf(" ");
    printf("%c%c",A[i].suit,A[i].value);
  }
  printf("\n");
}

int isStable(struct Card C1[],struct Card C2[],int n){
  int i;

  for(i = 0;i < n;i++){
    if(C1[i].suit != C2[i].suit){
      return 0;
    }
  }

  return 1;
}

int main(){
  struct Card C1[101],C2[101];
  int i,n;
  char ch;

  scanf("%d\n",&n);

  for(i = 0;i < n;i++){
    scanf("%c%c ",&C1[i].suit,&C1[i].value);
  }

  for(i = 0;i < n;i++){
    C2[i] = C1[i];
  }

  bubble(C1,n);
  selection(C2,n);

  print(C1,n);
  printf("Stable\n");
  print(C2,n);
  if(isStable(C1,C2,n) == 1){
    printf("Stable\n");
  }
  else{
    printf("Not stable\n");
  }

  return 0;
}



Measured memory_bytes: 2112
import queue

n,m = list(map(int, input().split()))
puted = [1]*(n+1)

ab = [[] for i in range(n+1)]
for i in range(m):
	a,b = list(map(int, input().split()))
	ab[a].append(b)
	ab[b].append(a)

q = queue.Queue()
flg = [-1]*n
flg[0] = 0
q.put(1)

while not q.empty():
	item = q.get()
	for i in ab[item]:
		if puted[i]:
			flg[i-1]=item
			q.put(i)
			puted[i]=0

if -1 in flg:
	print("No")
	exit()

print("Yes")
for i in range(1,len(flg)):
	print(flg[i])


Measured memory_bytes: 35236
import sys
lines = sys.stdin.readlines()
for line in lines:
    inp = int(line)
    s = 0
    for a in range(10):
        for b in range(10):
            for c in range(10):
                for d in range(10):
                    if a+b+c+d==inp:
                        s+=1
    print (s)

Measured memory_bytes: 7656
N, q = map(int, input().split())
job = {}
for i in range(N):
    name, t = input().split()
    job[name] = int(t)

from collections import deque
Q = deque(job.keys())


time = 0
while len(Q):
    cur = Q.popleft()
    if job[cur] > q:
        job[cur] -= q
        Q.append(cur)
        time += q
    else:
        time += job[cur]
        print("{} {}".format(cur, time))


Measured memory_bytes: 11824
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	long long N;

	long long x = 0;
	long long last_a;
	
	cin >> N;
	cin >> last_a;

	for ( int i = 0; i < (N-1); i++ )
	{
		long long Ai;

		cin >> Ai;
		if ( last_a <= Ai )
		{
			last_a = Ai;
		}
		else
		{
			x += last_a - Ai;
		}
	}

	cout << x << endl;

	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll

#define MAX 3000005

int dis[MAX];

signed main(){
  int n;
  cin>>n;
  for(int i=1; i<=n; i++){
    cin>>dis[i];
  }
  
  int maxl=1;
  bool clear_fir=true;
  for(int i=1; i<=n; i++){
    if(dis[i]>=10){
      int d=dis[i]/10;
      maxl=max(maxl,i+d);
    }else{
      if(maxl>i) continue;
      else clear_fir=false;
    }
  }
  
  int minl=n;
  bool clear_sec=true;
  for(int i=n; i>=1; i--){
    if(dis[i]>=10){
      int d=dis[i]/10;
      minl=min(minl,i-d);
    }else{
      if(minl<i) continue;
      else clear_sec=false;
    }
  }
  
  if(clear_sec&&clear_fir){
    cout<<"yes"<<en;
  }else{
    cout<<"no"<<en;
  }
}



Measured memory_bytes: 5444
A, B = map(int, input().split())
S = input()

if(S[A] != "-"):
    print("No")
else:
    a = S[:A]
    b = S[A+1:]
    if(len(a) == A and len(b) == B and a.isdecimal() and b.isdecimal()):
        print("Yes")
    else:
        print("No")

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

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

int main() {
    int w,a,b; cin >> w >> a >> b;
    int l = min(a,b);
    int r = max(a,b); 
    
    if(r > l+w) cout << r - l - w << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	h := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&h[i])
	}

	count := 0
	for {
		l, r := -1, -1
		for i := 0; i < n; i++ {
			if l == -1 && h[i] > 0 {
				l, r = i, i
			} else if h[i] > 0 {
				r = i
			}

			if l != -1 && h[i] == 0 {
				break
			}
		}
		if l == -1 {
			break
		}

		count++
		for i := l; i <= r; i++ {
			h[i]--
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
#include<stdio.h>

int main() {
   int N,T;
   scanf("%d %d", &N,&T);
   int c[N];
   int t[N];
   for(int i = 0; i < N; i++) {
      scanf("%d %d", &c[i], &t[i]);
   }
   int min = 1001;
   for(int i = 0; i < N; i++) {
      if(T >= t[i]) {
         if(min >= c[i]) {
            min = c[i];
         }
      }
   }
   if(min == 1001) {
      printf("TLE");
   } else {
      printf("%d", min);
   }
}


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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; }

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

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n,m; cin>>n>>m;
  string s; cin>>s;
  
  reverse(all(s));
  vll ans;
  ll pos=0;
  while(pos!=n){
    bool ok=false;
    for(ll i=min(n-pos,m); i>0; i--){
      if(s[pos+i]=='0'){
        pos+=i;
        ans.push_back(i);
        ok=true;
        break;
      }
    }
    if(!ok){
      cout<<-1<<endl;
      return 0;
    }
  }
  reverse(all(ans));
  for(auto e: ans){
    cout<<e<<" ";
  }
  cout<<endl;
}

Measured memory_bytes: 1480
x,y=gets.chomp.split(" ").map{|n| n.to_i}
@min = 999999999999999
def min(a)
	if(@min > a)
		@min = a
	end
end
min(y-x) if(y-x >= 0)
min(y+x+1) if(y+x >= 0)
min(-y-x+1) if(-y-x >= 0)
min(-y+x+2) if(-y+x >= 0)
puts @min



Measured memory_bytes: 3836
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a,b,c;
vector<ll> v;
map<ll,ll> mp,mp2;
int main(void){
    cin>>n;
    for(ll i=0LL;i<=1000;i++){
        mp2[i*i*i*i*i]=i;
        v.push_back(i*i*i*i*i);
    }
    for(auto x:v){
        //cout<<x<<" "<<n<<endl;
        if(mp2[x+n]>0){
            cout<<mp2[x+n]<<" "<<mp2[x]<<endl;
            return 0;
        }
        if(n-x>=0&&mp2[n-x]>0){
            cout<<mp2[n-x]<<" "<<-mp2[x]<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3700
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.read1(in.readLine());
		solver.read2(in.readLine());
		// solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
	}

	public void read1(String str) {
		String[] strArr = str.split("\\s+");
		m1 = Integer.parseInt(strArr[0]);
		// System.out.println(N);
	}

	int m1;

	public void read2(String str) {
		String[] strArr = str.split("\\s+");
		int m2 = Integer.parseInt(strArr[0]);
		if (m1 == m2)
			System.out.println("0");
		else
			System.out.println("1");
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
}


Measured memory_bytes: 22612
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readS(T)(size_t n,ref T t){t=new T(n);foreach(ref v;t){auto r=rdsp;foreach(ref j;v.tupleof)pick(r,j);}}

void main()
{
  int n; readV(n);
  struct P { int x, y; }
  P[] p; readS(n, p);

  foreach (ref pi; p)
    if (pi.x < pi.y) swap(pi.x, pi.y);

  auto xa = p.map!"a.x".reduce!max;
  auto xi = p.map!"a.x".reduce!min;
  auto ya = p.map!"a.y".reduce!max;
  auto yi = p.map!"a.y".reduce!min;
  auto ans = (xa-xi).to!long*(ya-yi);

  p.sort!"a.y < b.y";
  auto y = p.map!"a.y".array;
  auto sta = new SegmentTree!(int, max)(y);
  auto sti = new SegmentTree!(int, min)(y, int.max);

  auto mi = ya-yi;
  foreach (i, pi; p) {
    sta[i] = pi.x;
    sti[i] = pi.x;
    auto mi2 = sta[0..$]-sti[0..$];
    if (mi2 > mi) break;
    mi = mi2;
  }

  ans = min(ans, (xa-yi).to!long*mi);
  writeln(ans);
}

class SegmentTree(T, alias pred = "a + b")
{
  import core.bitop, std.functional;
  alias predFun = binaryFun!pred;

  const size_t n, an;
  T[] buf;
  T unit;

  this(size_t n, T unit = T.init)
  {
    this.n = n;
    this.unit = unit;
    an = n == 1 ? 1 : (1 << ((n-1).bsr + 1));
    buf = new T[](an*2);
    if (T.init != unit) buf[] = unit;
  }

  this(T[] init, T unit = T.init)
  {
    this(init.length, unit);
    buf[an..an+n][] = init[];
    foreach_reverse (i; 1..an)
      buf[i] = predFun(buf[i*2], buf[i*2+1]);
  }

  void opIndexAssign(T val, size_t i)
  {
    buf[i += an] = val;
    while (i /= 2)
      buf[i] = predFun(buf[i*2], buf[i*2+1]);
  }

  pure T opSlice(size_t l, size_t r)
  {
    l += an; r += an;
    T r1 = unit, r2 = unit;
    while (l != r) {
      if (l % 2) r1 = predFun(r1, buf[l++]);
      if (r % 2) r2 = predFun(buf[--r], r2);
      l /= 2; r /= 2;
    }
    return predFun(r1, r2);
  }

  pure T opIndex(size_t i) { return buf[i+an]; }
  pure size_t opDollar() { return n; }
}


Measured memory_bytes: 10492
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long INF = 1LL << 60; 

ll exp2(ll a)
{
  ll res = 0;
  while(a%2 == 0)
  {
    a /= 2;
    res++;
  }
  return res;
}

int main()
{
  ll N; cin >> N;
  vector<ll> A(N), B(N);
  ll ans = INF;
  rep(i,N)
  {
    cin >> A[i];
    B[i] = exp2(A[i]);
    if(B[i] < ans) ans = B[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n=sc.nextInt();
			int x=sc.nextInt();
			if(n==0&&x==0){
				break;
			}else{
				int count=0;
				if(x<6){
					System.out.println("0");
				}else{
					if(x-3>n){
						for(int i=n;i>x/3;i--){
							for(int j=i-1;j>1;j--){
								if(x-i-j<j){
									if(x-i-j>0){
									count++;
									}
								}else{
									break;
								}
							}
						}
					}else{
						for(int i=x-3;i>x/3;i--){
							for(int j=i-1;j>1;j--){
								if(x-i-j<j){
									if(x-i-j>0){
										count++;
									}
								}else{
									break;
								}
							}
						}						
					}
					System.out.println(count);
				}
			}
		}
	}
}

Measured memory_bytes: 26472
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  string s;
  cin >>s;
  string t,k;
  string p,q;
  ll l,m;
  t+=s[0];
  t+=s[1];
  k+=s[2];
  k+=s[3];
  p=s[3];
  q=s[1];
  if(s[0]=='0'){
   l=stoi(q);
  }
  else l=stoi(t);
  if(s[2]=='0') m=stoi(p);
  else m=stoi(k);
  if(l==0){
    if(m==0||m>13){
      cout <<"NA"<<endl;
      return 0;
    }
    else{
      cout <<"YYMM"<<endl;
      return 0;
    }
  }
  if(m==0){
    if(l==0||l>13){
      cout <<"NA"<<endl;
      return 0;
    }
    else{
      cout <<"MMYY"<<endl;
      return 0;
    }
  }
  if(l<13){
    if(m<13){
      cout <<"AMBIGUOUS"<<endl;
      return 0;
    }
    else {
      cout <<"MMYY"<<endl;
      return 0;
    }
  }
  else{
    if(m<13){
      cout <<"YYMM"<<endl;
      return 0;
    }
    else{
      cout <<"NA"<<endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

int main(void) {
	int a, b;
	cin >> a >> b;
	if (a <= 0 && 0 <= b) {
		cout << "Zero\n";
	} else {
		int neg = a < 0 ? b >= 0 ? abs(a) & 1 : abs(a - b + 1) & 1: 0;
		if (neg) cout << "Negative\n";
		else cout <<"Positive\n";
	}
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int N;
    cin >> N;
    vector<ll>A(N);
    rep(i,N) cin >> A[i];

    sort(all(A));
    ll ans = 0;
    ll tmp = 0;
    ll last = A[0];
    rep(i,N)
    {
        if( last != A[i] )
        {
            if( (tmp+2)%2!=0 ) ans++;
            last = A[i];
            tmp = 1;
        }
        else tmp++;
    }
    if( (tmp+2)%2!=0 ) ans++;

    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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() {
    ll n, x;
    cin >> n >> x;
    vector<ll> a(n, 0);
    ll sum = 0;
    rep1(i, n) cin >> a[i];
    ll ans = 0;
    rep1(i, n-1){
        if (a[i]+a[i+1]>x){
            ll add = a[i] + a[i+1] - x;
            ans += add;
            a[i+1] = max((ll)0, a[i+1]-add);
        }
    }
    cout << ans << endl;
    //printf("%.12f", ans);
}

Measured memory_bytes: 4032
#include "bits/stdc++.h"

using namespace std;

void solve()
{
	int n;
	cin >> n;
	vector<long> as(n), bs(n);
	for (int i = 0; i < n; i++) cin >> as[i];
	for (int i = 0; i < n; i++) cin >> bs[i];
	long res = 0;
	for (int i = 0; i < n; i++)
	{
		long d = bs[i] - as[i];
		if (d >= 0) res += d/2;
		else if (d < 0) res += d;
	}
	cout << (res >= 0 ? "Yes" : "No") << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define Rep(i,n) for (int i = (int)(n); i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define rever(vec) reverse(all(vec));
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>
struct edge { int to, cost; };
using P = pair<int, int>;
using PP = pair<P, int>;
using D = pair<double, double>;
const int mod2 = 998244353;
const int mod = (int)1e9 + 7, inf = (int)1e16;
const string sp = " ";

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

int fact[1000000];
void f_init(int n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= n; ++i) {
		fact[i] *= fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

int comb(int n, int r) {
	if (n < r) return 0;
	int ans = fact[n] * modpow(fact[n - r], mod - 2) % mod * modpow(fact[r], mod - 2);
	if (ans < 0) return ans + mod;
	return ans;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	int ans= fact[n] * modpow(fact[n - r], mod - 2) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

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

int lcm(int a, int b) {
	return a * b / gcd(a, b);
}

bool pri(int p) {
	for (int i = 2; i * i <= p; ++i) if (p % i == 0) return false;
	return p > 1;
}

map<int, int> factring(int n) {
	map<int, int>ans;
	for (int i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

P operator+(const P& a, const P& b) {
	return P(a.first + b.first, a.second + b.second);
}
P operator-(const P& a, const P& b) {
	return P(a.first - b.first, a.second - b.second);
}

class unionfind {
private:
	int par[200010], rankth[200010], sizeth[200020];
public:
	void init(int n) {
		rep(i, n) {
			par[i] = i;
			rankth[i] = 0;
			sizeth[i] = 1;
		}
	}
	int root(int x) {
		while (par[x] != x) {
			x = par[x] = par[par[x]];
		}
		return x;
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) return;
		if (rankth[x] < rankth[y]) {
			par[x] = y;
			sizeth[y] += sizeth[x];
		}
		else {
			par[y] = x;
			if (rankth[x] == rankth[y]) rankth[x]++;
			sizeth[x] += sizeth[y];
		}
	}
};

int n;
double p[3001], ans[3001][3001]; // i個投げたときj個表がでる確率
double cnt;
signed main() {
	cin >> n;
	rep(i, n) {
		cin >> p[i];
	}
	ans[1][0] = 1.0 - p[0];
	ans[1][1] = p[0];
	for (int i = 2; i <= n; ++i) {
		rep(j, i + 1) {
			if (j == 0) {
				ans[i][j] = (1.0 - p[i - 1]) * ans[i - 1][j];
			}
			else {
				ans[i][j] = p[i - 1] * ans[i - 1][j - 1] + (1.0 - p[i - 1]) * ans[i - 1][j];
			}
		}
	}
	for (int i = n / 2 + 1; i <= n; i++) {
		cnt += ans[n][i];
	}
	printf("%.10Lf\n", cnt);
}

Measured memory_bytes: 139776
S=input()
a=int(S[:2])
b=int(S[2:])
if 1<=a<=12 and 1<=b<=12:
    print("AMBIGUOUS")
    quit()
if (a>12 or a<1)and (b>12 or b<1):
    print("NA")
    quit()
if 1<=a<=12:
    print("MMYY")
    quit()
if 1<=b<=12:
    print("YYMM")
    quit()


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'
#define all(x) x.begin(), x.end()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


using vvll = vector< vector<ll> >;
using vll = vector<ll> ;

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

ll fast(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        y >>= 1;
    }
    return res;
}

ll inv(ll n){
    return fast(n,mod-2);
}


void pre(){


}


void solve(){

    ll n;
    cin >> n;
    n = n + n*n + n*n*n;
    cout << n;

    
}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 3604
let solve a b c x =
  let rec decide_a p x = (* 500円をp枚使っていて、x円残っている *)
    if x = 0 then 1 else
    (if p < a then decide_a (p+1) (x-500) else 0) + decide_b 0 x
  and decide_b q x =
    if x = 0 then 1 else
    (if q < b then decide_b (q+1) (x-100) else 0) + decide_c 0 x
  and decide_c r x =
    if x = 0 then 1 else
    (if r < c then decide_c (r+1) (x-50) else 0)
  in decide_a 0 x

let () =
  Scanf.scanf "%d %d %d %d\n" (fun a b c x -> 
  Printf.printf "%d\n" @@ solve a b c x
  )

Measured memory_bytes: 2432
s = input()
k = int(input())
s = s + '0'

e = 1
l = []
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        e+=1
    else:
        l.append(e)
        e=1

s = s[:-1]

if len(s)==1:
    print(k//2)    
else:
    if s[0]!=s[-1]:
        print(k*sum([i//2 for i in l]))
    else:
        if k==1:
            print(k*sum([i//2 for i in l]))
        else:
            if len(l)==1:
                print((k*l[0])//2)
            else:
                a = l.pop(0)
                b = l.pop(-1)
                l.append(a+b)
                print(k*sum([i//2 for i in l])-(a+b)//2+a//2+b//2)

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

using namespace std;
using ll = long long;

const long long INF = 1LL << 60;

ll dp[3001][3001] = {};

int main() {
    #ifdef MYLOCAL
        ifstream in("input.txt");
        cin.rdbuf(in.rdbuf());
    #endif

    string s, t; cin >> s >> t;

    dp[0][0] = 0;
    for (int i = 0; i < s.size(); ++i) {
        for(int j = 0; j <= t.size(); ++j) {
            if (s[i] == t[j]) {
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
            }
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j]);
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1]);
        }
    }

    int i = s.size();
    int j = t.size();
    string ans;
    while(i > 0 && j > 0){
        if (dp[i][j] == dp[i-1][j]) {
            --i;
        }
        else if (dp[i][j] == dp[i][j-1]) {
            --j;
        }
        else { // dp[i][j] == dp[i-1][j-1] + 1
            ans = s[i-1] + ans;
            --i, --j;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 70656
import java.util.Scanner;

public class Main
{
	public static void main(String[] args) 
	{
		Scanner	sc = new Scanner(System.in);
		String input = sc.nextLine();
		String output = "";

		if(input.equals("Sunny"))
		{
			output = "Cloudy";
		}
		else if(input.equals("Cloudy"))
		{
			output = "Rainy";
		}
		else if(input.equals("Rainy"))
		{
			output = "Sunny";
		}

		System.out.print(output);
	}
}

Measured memory_bytes: 21716
s = int(input())
l = [s]
a = set(l)
for i in range(10**6):
  if l[-1] % 2 == 0:
    n = l[-1] // 2
  else:
    n = 3*l[-1] + 1
  if n not in a:
    a.add(n)
    l.append(n)
  else:
    print(len(l)+1)
    break

Measured memory_bytes: 9004
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int main(){
	int a,b;
	while(cin>>a>>b) printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
	return 0;
}

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

int main() {
    string N;
    cin >> N;
    int L = N.length();
    vector<int> dp0(L, 0), dp1(L, 0);
    dp0[0] = N[0] - '0';
    dp1[0] = N[0] - '0' - 1;
    for (int i = 0; i < L - 1; i++) {
        dp0[i + 1] = dp0[i] + N[i + 1] - '0';
        if (N[i + 1] == '0') {
            dp1[i + 1] = dp1[i] + 9;
        } else {
            dp1[i + 1] = max(dp1[i] + 9, dp0[i] + N[i + 1] - '0' - 1);
        }
    }
    cout << max(dp0[L - 1], dp1[L - 1]) << endl;
}


Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let s:Vec<i64> = read::<String>().chars()
        .map(|x| x.to_digit(10).unwrap() as i64)
        .collect();
    let k:usize = read();
    let target:Vec<i64> = s.into_iter().take(k).collect();
    let ans = if target.iter().all(|&x| x == 1) {
        1
    } else {
        *target.iter().filter(|&x| *x != 1).nth(0).unwrap()
    };
    println!("{}",ans );
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int f=0,i;
    string s;
    cin>>s;
    for(i=0;i<3;i++){
        if(s[i]=='7')
        {
            f=1;
            break;
        }
}
if(f)
    std::cout << "Yes" << std::endl;
else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int a0;
int l;

void solve(){
  map<int,int> a;
  int ax=a0;
  REP(i,21){
    a[ax]=i;
    int c[10]={};
    REP(j,l){
      c[ax%10]++;
      ax/=10;
    }
    int large=0,small=0;
    REP(j,10){
      while(c[j]>0){
	large/=10;
	large+=j*pow(10,l-1);
	small*=10;
	small+=j;
	c[j]--;
      }
    }
    ax=large-small;
    if(a.count(ax)==1){
      cout<<a[ax]<<" "<<ax<<" "<<i-a[ax]+1<<endl;
      break;
    }
  }
}

int main(){ _;
  while(cin>>a0>>l,(a0|l)!=0){
    solve();
  }
}

Measured memory_bytes: 1244
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String week = sc.next();

		if(week.equals("SUN")) {
			System.out.println(7);
		}
		if(week.equals("MON")) {
			System.out.println(6);
		}
		if(week.equals("TUE")) {
			System.out.println(5);
		}
		if(week.equals("WED")) {
			System.out.println(4);
		}
		if(week.equals("THU")) {
			System.out.println(3);
		}
		if(week.equals("FRI")) {
			System.out.println(2);
		}
		if(week.equals("SAT")) {
			System.out.println(1);
		}
	}
}

Measured memory_bytes: 21716
ptss = 3.times.map do
  pts = 8.times.map do
    p, t = gets.split
    [p.to_i, t.to_f]
  end
  pts.sort_by { |(p, t)| t }
end

ptss.each do |pts|
  p1, p2 = pts.shift 2
  printf "%d %.2f\n", p1[0], p1[1]
  printf "%d %.2f\n", p2[0], p2[1]
end

p1, p2 = [*ptss[0], *ptss[1], *ptss[2]].sort_by { |(p, t)| t }.shift 2
printf "%d %.2f\n", p1[0], p1[1]
printf "%d %.2f\n", p2[0], p2[1]


Measured memory_bytes: 6904
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

LL dp[2][1<<17];
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  while(cin >> N,N){
	VI sat(N);
	VI sched(N, 0);
	REP(i,N){
	  int M; cin >> M >> sat[i];
	  REP(j,M){
		int s, e;
		cin >> s >> e;
		s -= 6, e -= 6;
		FOR(k,s,e)
		  sched[i] |= 1 << k;
	  }
	}

	LL ans = 0;
	int crt = 0, nxt = 1;
	fill((LL*)dp, (LL*)dp+2*(1<<17), -1);
	dp[crt][0] = 0;
	REP(i,N){
	  for(int bit=0;bit<(1<<17);++bit)
		dp[nxt][bit] = dp[crt][bit];
	  for(int bit=0;bit<(1<<17);++bit){
		if(dp[crt][bit] < 0) continue;
		if(bit & sched[i]) continue;
		dp[nxt][bit | sched[i]] = max(dp[nxt][bit | sched[i]],
									  dp[crt][bit] + sat[i]);
	  }
	  swap(crt, nxt);
	}
	REP(bit,(1<<17))
	  ans = max(ans, dp[crt][bit]);
	cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3244
#include "bits/stdc++.h"
using namespace std;

int main() {
    long long A, B;
    cin >> A >> B;

    long long XOR_A, XOR_B;
    if (A % 2 == 0) {
        if ((A / 2) % 2 == 0) XOR_A = 0;
        else XOR_A = 1;
    }
    else {
        if ((A / 2) % 2 == 0) XOR_A = A - 1;
        else XOR_A = A;
    }
    if ((B + 1) % 2 == 0) {
        if (((B + 1) / 2) % 2 == 0) XOR_B = 0;
        else XOR_B = 1;
    }
    else {
        if (((B + 1) / 2) % 2 == 0) XOR_B = B;
        else XOR_B = B + 1;
    }

    long long ans = XOR_A ^ XOR_B;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 105
#define MOD 1000000007

int main()
{
    //freopen("output.txt","r",stdin);
    //freopen("input.txt","w",stdout);
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    int n;
    cin >> n;
    int check=0;
    for(int i=1;i<=9;i++)
    {
        for(int k=1;k<=9;k++)
        {
            if(i*k==n) check=1;
        }
    }
    if(check)
    {
        cout << "Yes" << endl;
    }else
    {
        cout << "No" << endl;
    }

}





Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
count = 0

for i in range(n):
    minj = i
    for j in range(i, n):
        if A[j] < A[minj]:
            minj = j
    if i != minj:
        a = A[i]
        A[i] = A[minj]
        A[minj] = a
        count += 1
        
print(' '.join(map(str, A)))
print(count)  


Measured memory_bytes: 5596
N, M = map(int, input().split())
l = []
for i in range(N):
  l.append(list(map(int, input().split())))
  
ans = [0] * (M+1)
for i in range(N):
  n = l[i]
  for j in range(1, n[0]+1):
    ans[n[j]] += 1
    
cnt = 0
for i in range(M+1):
  if ans[i] == N:
    cnt += 1
print(cnt)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;

void solve() {
	int n, m, x; cin >> n >> m >> x;
	vector<int> c(n);
	vector<vector<int>> a(12, vector<int>(12));
	for (int i = 0; i < n; ++i) {
		cin >> c[i];
		for (int j = 0; j < m; ++j) {
			cin >> a[i][j];
		}
	}
	int ans = INF;
	bool cost_flg = false;
	for (int bit = 0; bit < (1 << n); ++bit) {
		int cost = 0;
		vector<int> skill(m);
		for (int i = 0; i < n; ++i) {
			if (bit & (1 << i)) {
				cost += c[i];
				for (int j = 0; j < m; ++j) {
					skill[j] += a[i][j];
				}	
			}
		}
		bool flg = true;
		for (int i = 0; i < m; ++i) {
			if (skill[i] < x) flg = false;
		}
		if (flg) {
			ans = min(ans, cost);
			cost_flg = true;
		}
	}
	if (cost_flg) {
		cout << ans << endl;
	} else {
		cout << -1 << endl;
	}
	return;
}
int main() {
	solve();
	return 0;
}

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

typedef long long ll;
ll h, w;

int main()
{
	scanf("%lld%lld", &h, &w);
	if(h == 1 || w == 1) puts("1");
	else {
		if(h > w) swap(h, w);
		//printf("h:%lld, w:%lld\n", h, w);
		ll line1 = (w + 1) / 2 * ((h + 1) / 2);
		ll line2 = w / 2 * (h / 2);
		//printf("line1:%lld, line2:%lld\n", line1, line2);
		printf("%lld\n", line1 + line2);
	}
	return 0;
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll A,B;
cin >> A >> B;
if(A<10) cout << B+(100*(10-A));
else cout << B;
}

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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int A, B;
    cin >> A >> B;
    if(max(A,B) > 8) cout << ":(" << endl;
    else cout << "Yay!" << endl; 
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

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

    	int n=sc.nextInt();


    	System.out.println(n/3);

    }

}







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

using namespace std;

int main(){
    int s,k,x,y,z,r=0;
    cin >> k >> s;
    for(x=0;x<=k;x++){
        if(s-x>2*k)continue;
        for(y=x;y<=k;y++){
            for(z=y;z<=k;z++){
                if(x+y+z==s){
                    if(x==y&&y==z){
                        r++;
                    }else if(x==y||y==z||x==z){
                        r+=3;
                    }else{
                        r+=6;
                    }
                }
            }
        }
    }
    cout << r << endl;
}

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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair

using namespace std;

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

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int d = 0;
    int j = i;
    while (j) j /= 10, d++;
    if (d & 1) ans++;
  }
  cout << ans << '\n';
  return (0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t=1;
	
	while(t--)
	{
		ll n;
		long double d;
		cin>>n;
		cin>>d;
		ll count=0;
		while(n--)
		{
			ll x,y;
			cin>>x>>y;
			long double dis=sqrt((x*x)+(y*y));
			if(dis<=d)
			{
				count++;
			}
		}
		cout<<count<<endl;
	}
	return 0;
}

Measured memory_bytes: 3800
#include<iostream>
using namespace std; 
int main(){
    int r;
    cin >> r;

    if(r < 1200){
        cout << "ABC" << endl;
    }else if(r >= 1200 && r < 2800){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
    return 0;
}

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

int main(){
  long long N;
  cin >> N;
  long long a[N+1], A[N+1] = {};
  for(int i = 2; i <= N ; i++) {
    cin >> a[i];
    ++A[a[i]];
  }

  for(int i = 1; i <= N; i++) cout << A[i] <<"\n";
}


Measured memory_bytes: 6720
if __name__ == '__main__':
    n = int(input())
    red = []
    blue = []
    for i in range(n):
        a, b = map(int, input().split())
        red.append((a, b))
    for i in range(n):
        c, d = map(int, input().split())
        blue.append((c, d))
    red.sort(key=lambda x: x[1], reverse=True)
    blue.sort()
    ans = 0
    for i in range(n):
        for j in range(len(red)):
            a, b, c, d = red[j][0], red[j][1], blue[i][0], blue[i][1]
            if a < c and b < d:
                ans += 1
                del red[j]
                break
    print(ans)


Measured memory_bytes: 3064
import java.util.Scanner

object Main extends App  {
  val sc = new Scanner(System.in)

  val a = sc.nextInt
  val b = sc.nextInt

  val order = Map(
    2  ->  1,
    3  ->  2,
    4  ->  3,
    5  ->  4,
    6  ->  5,
    7  ->  6,
    8  ->  7,
    9  ->  8,
    10 ->  9,
    11 -> 10,
    12 -> 11,
    13 -> 12,
    1  -> 13
  )

  val res =
    if(order(a) > order(b)) "Alice"
    else if (order(a) < order(b)) "Bob"
    else "Draw"

  println(res)
}


Measured memory_bytes: 25544
#include<stdio.h>
void dicemove(char com,int *A);
void serch0 (int *A,int *B);
void serch1(int *A,int *B);
int check(int *A,int *B);
int main(void)
{
  int A[6],B[6];
  int i,j,k,n=1;
  for(i=0;i<6;i++){scanf("%d",&A[i]);}
  for(i=0;i<6;i++){scanf("%d",&B[i]);}
  serch0(A,B);
  for(j=0;j<7;j++)
    {
  for(i=0;i<4;i++)
    {if(A[0]!=B[0]){break;}
      dicemove('M',A);
 n= check(A,B);
 if(!n){printf("Yes\n"); break;}
    }
  
  if(!n){break;}
  if(n && j<4){dicemove('N',A);}
  else if(n && j>3){dicemove('E',A);}
    }
  if(j == 7){printf("No\n");}

  return 0;
}
void dicemove(char com,int *A){	
  int temp;
  switch(com){
	case 'E':
	  temp=A[0]; A[0]=A[3]; A[3]=A[5];A[5]=A[2]; A[2]=temp;
	  break;
	case 'N':
	  temp=A[0]; A[0]=A[1]; A[1]=A[5]; A[5]=A[4]; A[4]=temp;
	  break;
	case 'S':
	  temp=A[0]; A[0]=A[4]; A[4]=A[5]; A[5]=A[1]; A[1]=temp;
	  break;
	case 'W':
	  temp=A[0]; A[0]=A[2]; A[2]=A[5]; A[5]=A[3]; A[3]=temp;
	  break;
        case 'M':
          temp=A[1]; A[1]=A[3]; A[3]=A[4]; A[4]=A[2]; A[2]=temp;
	  break;
	}
}
void serch0(int *A,int *B){
  int i;
  for(i=0;i<4;i++)
    {if(A[0] == B[0]){break;}
      dicemove('E',A);
    }
 if(A[0]!=B[0]){
   for(i=0;i<4;i++)
     {
dicemove('N',A);
   if(A[0] == B[0]){break;}
     }
 }
}
void serch1(int *A,int *B){
  int i;
  for(i=0;i<4;i++)
    {if(A[1] == B[1]){break;}
      dicemove('M',A);
    }
}
int check(int *A,int *B){
  int i;
  for(i=0;i<6;i++)
    {
      if(A[i] != B[i]){break;}
    }
  if(i == 6){return 0;}
  else {return 1;}
}

Measured memory_bytes: 580
N, M, X = map(int, input().split())
A = list(map(int, input().split()))
cst = 0
cst2 = 0
for i in range(M):
    if A[i]<X:
        cst += 1
    elif A[i]>X:
        cst2 +=1
print(min(cst, cst2))

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include<set>
#include<vector>
#include<algorithm>
using namespace std;
int main(void){
    int n,k,x,y,sum=0;
    cin>>n>>k>>x>>y;
    for(int i=0;i<n;i++){
        if(i+1<=k) sum+=x;
        else sum+=y;
    }
    cout<<sum<<endl;
    return 0;
    // Your code here!
    
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i <(int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i,k,n) for (int i = (int)(n)-1; i >= k; i--)
#define mod 1000000007
#define inf 999999999


int main(){
  int a,b,c,d,e,f;
  cin >> a >> b >> c >> d >> e >> f;
  double ma = 0.0;
  int ansa= a*100,ansb= 0;
  rep(i1,31){
    rep(i2,31){
      rep(i3,51){
        rep(i4,51){
          int m = i1*a*100+i2*b*100+i3*c+i4*d;
          if(m==0) break;
          int s = i3*c+i4*d;
          if(m > f) break;//ビーカーに入るか？
          if((i1*a+i2*b)*e < s) break;//溶けるか？
          if(ma<(double)s*100/m){
            ma = (double)s*100/m;
            ansa = m;
            ansb = s;
          }
        }
      }
    }
  }
  cout << ansa << " " << ansb << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(long long x, long long a, long long b){
    a = abs(x- a);
    b = abs(x - b);
    if (a < b){
        cout << "A" << endl;
    } else {
        cout << "B" << endl;
    }
}

int main(){

    long long x;
    scanf("%lld",&x);
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(x, a, b);
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rFOR(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<< #x << " = "<<(x)<<endl
#define int long long

using ll = long long;
const ll mod = LLONG_MAX;

typedef pair<int,int> P;

int a[110];
signed main(){
  int n;
  cin>>n;
  rep(i,n)cin>>a[i];
  sort(a,a+n);

  cout<<a[n-1]-a[0]<<endl;

}


Measured memory_bytes: 256
#include <stdio.h>

long long c(long long m,long long n){
    long long result = 1;
    long long i = 0;
        if(n == 1 || m == n-1){
            return m;
        }else if(n ==0){
            return 0;
        }else if(n ==m){
            return 1;
        }
         else{
            for(i = n;i<=m;i++){
                result *= i;
            }
            for(i = 1;i<=n;i++){
                result /= i;
            }
        }

    return result;
}

int main()
{
    int sum = 0;
    long long num1 = 0;
    long long num2 = 0;

    scanf("%d%lld%lld",&sum,&num1,&num2);

    if(sum <= 0 || num1 <= 0 || num2 <= 0){
        printf("0");
    }else{

        if(num1 == num2){
            if(sum > 1){
                printf("1");
            }
            else if (sum == 1){
                printf("1");
            }else{
                printf("0");
            }
        }else if(num1 > num2){
            printf("0");
        }else{
            if(sum == 1){
                printf("0");
            }else if (sum >=2){
                printf("%lld",(long long )(num2-num1)*(sum-2)+1);
            }

        }
    }

    return 0;
}


Measured memory_bytes: 128
//shara's here
//SPEEEEEEEEEED IS KEEEEEEEEEEY
#include <bits/stdc++.h>
using namespace std;
//fold
typedef int q;
typedef double w;
typedef string s;
typedef long long ll;
//using ll = long long;
typedef long double ld;
const ll INF = 1e18 + 10;
const ll MINF = -(1e18 + 10);
#if defined(ONLINE_JUDGE)
#include "/home/xsharawi/Desktop/cpp/debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define push_back pb
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
//endfold
int main(){
    speed;
	ll x,y,cnt=0;
	cin>>x>>y;
	while(x>0){
		x-=y;
		cnt++;
		}
		cout<<cnt<<endl;
		
















































return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/




Measured memory_bytes: 256