akhauriyash/Code-Regression huggingface dataset:
#define TEST_MODE true

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;             \
                                   c > 0 ? i < b : i > b; \
                                   i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long

#ifdef LOCAL_ENV

#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x)
#define dumpl(x) dump(x) << endl
#else
const bool test = false;
#define dump(x) 
#define dumpl(x)
#endif

#else
const bool test = false;
#define dump(x) 
#define dumpl(x)
#endif

int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, 1, 0, -1 };
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
	vector<string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep))
	{
		v.push_back(buffer);
	}
	return v;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
	return accumulate(begin, end, 0ll);
}

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

template<typename T>
T bit_count(T N) {
	T cnt = 0;
	while (N) {
		if (N & 1) cnt++;
		N >>= 1;
	}
	return cnt;
}

struct Point {
	int y, x;
	bool operator < (const Point& r) {
		if (x < r.x) return true;
		else return false;
	}
};

class Solver {
public:
	string S;
	int K;

	char ans() {
		if (S[0] != '1') return S[0];
		int id = S.size();
		rep(i, S.size()) {
			if (S[i] != '1') {
				id = i;
				break;
			}
		}
		if (K < id) return '1';
		else return S[id];
	}

	void solve() {
		cin >> S;
		cin >> K;
		K -= 1;

		cout << ans() << endl;
	}
};

signed main()
{
	srand((unsigned int)time(NULL));
	cout << fixed << setprecision(20);
	auto ptr = new Solver();
	ptr->solve();
	delete ptr;
	//while (true) {
	//	if (cin.eof() == true) break;
	//	auto ptr = new Solver();
	//	ptr->solve();
	//	delete ptr;
	//}
	return 0;
}

Measured memory_bytes: 256
/*Filename: aoj0006.cpp
 *Author: Mushiyo
 */

#include <iostream>

using namespace std;

int main(){
	string str;

    while(cin >> str){
        for(int i = str.size() - 1; i>= 0; --i){
        	cout << str[i];
        }
        cout << endl;
    }

	return 0;
}

Measured memory_bytes: 1172
h,w=map(int,input().split())
s=[]
s.append(["$"]*(w+2))
for i in range(h):
    s.append(list("$"+input()+"$"))
s.append(["$"]*(w+2))
c=[]
for j in range(h+2):
    v=[]
    for k in range(w+2):
        v.append(0)
    c.append(v)
for y in range(1,h+1):
    for x in range(1,w+1):
        if s[y-1][x-1]=="#":
            c[y][x]+=1
        if s[y-1][x]=="#":
            c[y][x]+=1
        if s[y-1][x+1]=="#":
            c[y][x]+=1
        if s[y][x-1]=="#":
            c[y][x]+=1
        if s[y][x+1]=="#":
            c[y][x]+=1
        if s[y+1][x-1]=="#":
            c[y][x]+=1
        if s[y+1][x]=="#":
            c[y][x]+=1
        if s[y+1][x+1]=="#":
            c[y][x]+=1
for y in range(1,h+1):
    ans=""
    for x in range(1,w+1):
        if s[y][x]==".":
            ans+=str(c[y][x])
        else:
            ans+=s[y][x]
    print(ans)

Measured memory_bytes: 3188
#include <iostream>
//#include <string>
//#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int a,b,c,count = 0;

  cin >> a >> b >> c;

  for (int i=a; i<=b; i++) {
    if (c % i == 0) count++;
  }

  cout << count << endl;
  
  return 0;
}



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

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

typedef long long ll;

#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--)
//定数
//#define INF 1000000000000 //10^12:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

const ll INF=ll(1e18)+1;

int main(){
    ll N,K;
    cin>>N>>K;
    vector<ll> a(N);
    rep(i,N){
      cin>>a[i];
    }
    sort(a.begin(),a.end());
    ll l=-INF, r=INF;
    while(r-l>1){
        ll x=(l+r)/2;
        bool ok=[&]{
            ll tot=0;
            rep(i,N){
                if(a[i]>=0){
                    int l=-1, r=N;
                    while(r-l>1){
                        int c=(r+l)/2;
                        if(a[i]*a[c]<x) l=c; else r=c;
                    }
                    tot+=r;
                }
                else{
                    int l=-1, r=N;
                    while(r-l>1){
                        int c=(r+l)/2;
                        if(a[i]*a[c]<x) r=c; else l=c;
                    }
                    tot+=N-r;
                }
                if(a[i]*a[i]<x) tot--;
            }
            tot/=2;
            return tot < K;
        }();
        if(ok) l=x; else r=x;
    }
    cout << l << endl;
    return 0;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)

#define MAX 10000
#define INFTY (1 << 29)

class Unionfind {
  public:
    vector<int> par; // 節点
    vector<int> rank; // 木の高さ
    vector<int> size; // 節点が属する木の節点数
    int treeNum; // 木の数
    Unionfind(int N) : par(N), rank(N, 0), size(N, 1) {
      for (int i = 0; i < N; i++) {
        par[i] = i;
      }
      treeNum = N;
    }
    // 節点(木)追加
    void addNode(int x) {
      par[x] = x;
      rank[x] = 0;
      size[x] = 1;
      treeNum++;
    }
    // 根を探すと同時に経路上にある節点の親が根になるように代入
    int root(int x) {
      return par[x] == x ? x : par[x] = root(par[x]);
    }
    // 同じ木に属しているか
    bool same(int x, int y) {
      return root(x) == root(y);
    }
    // rankが低い方の木をrankが高い方の木の根に結びつける(結びつけた後の新しい木の高さが高くなることがないため)
    void unite(int x, int y) {
      x = root(x);
      y = root(y);
      treeNum--;
      if (x == y) {
        return;
      }
      if (rank[x] < rank[y]) {
        par[x] = y;
        size[y] += size[x];
      } else {
        par[y] = x;
        size[x] += size[y];
        if (rank[x] == rank[y]) {
          rank[x] += 1;
        }
      }
    }
};

class Edge {
  public:
    int source, target, cost;
    Edge(int source = 0, int target = 0, int cost = 0):
    source(source), target(target), cost(cost) {}
    bool operator < (const Edge &e) const {
      return cost < e.cost;
    }
};

int kruskal (int N, vector<Edge> edges) {
  int totalCost = 0;
  sort(All(edges));
  Unionfind uf = Unionfind(N + 1);

  int source, target;
  rep(i, 0, edges.size()) {
    Edge e = edges[i];
    if (!uf.same(e.source, e.target)) {
      totalCost += e.cost;
      uf.unite(e.source, e.target);
    }
  }

  return totalCost;
};

int main() {
  int N, M, cost;
  int source, target;

  cin >> N >> M;

  vector<Edge> edges;
  rep(i, 0, M) {
    cin >> source >> target >> cost;
    edges.pb(Edge(source, target, cost));
  }

  cout << kruskal(N, edges) << endl;
};



Measured memory_bytes: 5420
#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<ll,ll>pl;

const int MAX_N = 40;

ll v[MAX_N];
ll w[MAX_N];
vector<pl> x,y;

void solve(int s,int t,vector<pl> &x)
{
	int z = t-s;
	rep(i,1<<z){
		pl p = pl(0,0);
		rep(j,z){
			if(i&(1<<j)){
				p.first += w[s+j];
				p.second += v[s+j];
			}
		}
		x.push_back(p);
	}
}

int main()
{
	int n;
	ll lm;
	cin >> n >> lm;
	rep(i,n){
		cin >> v[i] >> w[i];
	}
	solve(0,n/2,x);
	solve(n/2,n,y);
	sort(x.begin(),x.end());
	x.erase(unique(x.begin(),x.end()),x.end());
	sort(y.begin(),y.end());
	ll t=0;
	ll maxv = -(1LL<<60);
	ll ans = 0;
	for(int i=x.size()-1;i>=0;i--){
		while(t < y.size() && x[i].first+y[t].first <= lm){
			maxv = max(maxv,y[t].second);
			t++;
		}
		ans = max(ans,maxv+x[i].second);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 43724
#include<iostream>
#include<algorithm>
#include<vector>
int main(void) {
	int a, b, c;
	int t[5];
	std::cin >> a;
	std::cin >> b;
	std::cin >> c;
	int ans = 0;
	for (int l1 = 0; l1 <= a; l1++) {
		t[4] = l1 * 0.0001;
		t[3] = l1 * 0.001 - t[4] * 10;
		t[2] = l1 * 0.01 - t[3] * 10 - t[4] * 100;
		t[1] = l1 * 0.1 - t[2] * 10 - t[3] * 100 - t[4] * 1000;
		t[0] = l1 - t[1] * 10 - t[2] * 100 - t[3] * 1000 - t[4] * 10000;
		if (t[0] + t[1] + t[2] + t[3] + t[4] <= c && t[0] + t[1] + t[2] + t[3] + t[4] >= b) { 
			ans += l1;
		}
	}
	std::cout  << ans << std::endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <bitset>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S, T;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;


int main(){
    cin>>N>>M;
    vec pena(N,0);
    ll psum = 0, acsum = 0;
    rep(i,M){
        cin>>A>>S;
        --A;
        if(S == "AC" && pena[A] >= 0){
            psum += pena[A];
            pena[A] = -1;
            ++acsum;
        }else if(S == "WA" && pena[A] >= 0){
            ++pena[A];
        }
    }
    cout<<acsum<<' '<<psum<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

const int INF = 1e9+5;
const ll LINF = 1e18;

int main(){
  int x,y,z;
  cin >> x >> y >> z;
  int res = x-z;
  if(res <= 0) res = 0;
  else{
    res/=(y+z);
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

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

#define judge 1e-11
int c;
int p,q,a,n;
void dfs(double now,int cou,int den_pro,int next){
	if(cou>n)return;
	if(den_pro>a)return;
	if(fabs(now)<=judge){
		c++;
		return;
	}
	if(now<0){
		return;
	}
	if(now-(double)(n-cou)/next>judge)return;
	for(int i=next;i<=a;i++){
		if(den_pro*i>a)break;
		double nn=now-(double)1/i;
		dfs(nn,cou+1,den_pro*i,i);
	}
	return ;
}

int main(){
	while(1){
		c=0;
		cin>>p>>q>>a>>n;
		if(p==0&&q==0&&a==0&&n==0)break;
		dfs((double)p/q,0,1,1);
		cout<<c<<endl;
	}
	return 0;
}


Measured memory_bytes: 3092
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.concurrent.ConcurrentHashMap;

class Main {

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

	void run() {
		Scanner sc = new Scanner();
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a + b == 15) {
			System.out.println("+");
		} else if (a * b == 15) {
			System.out.println("*");
		} else {
			System.out.println("x");
		}
	}

	class Scanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

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

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

		private void skipUnprintable() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr]))
				ptr++;
		}

		public boolean hasNext() {
			skipUnprintable();
			return hasNextByte();
		}

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

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

		int nextInt() {
			return (int) nextLong();
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Measured memory_bytes: 23252
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <climits>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <array>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define io() ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define fi first
#define se second
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define v(T) vector<T>
#define p(T, N) pair<T, N>
#define tp(A, B, C) tuple<A, B, C>
#define ii p(int, int)
#define vi v(int)
#define vii v(p(int, int))
#define vvi v(v(int))
#define vl v(long long)
#define vll v(p(long long, long long))
#define si set<int>
#define msi map<string, int>
#define rsz(a) resize(a)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define qsortsi(v) sort(v.begin(), v.end(), [](pair<int, int> a, pair<int, int> b){return a.se < b.se;})
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(make_pair(a, b))
#define pt(a, b, c) emplace_back(make_tuple(a, b, c))
#define elif else if
#define fori(i, n) for(ll i = 0; i < n; ++i)
#define foris(i, a, b) for(ll i = a; i < b; ++i)
#define forise(i, a, b) for(ll i = a; i <= b; ++i)
#define ford(i, n) for(ll i = n; i >= 0; --i)
#define fords(i, a, b) for(ll i = a; i >= b; --i)
#define fordse(i, a, b) for(ll i = a; i > b; --i)
#define fora(i, a) for (auto &i: a)
#define rev(a) reverse(a.begin(), a.end())
#define revf(a, b, c) (reverse(a.begin() + b, a.begin() + c))
#define umap unordered_map
#define uset unordered_set
#define pq(T) priority_queue<T>
#define rpq(T) priority_queue<T, vector<T>, greater<T> >
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
const int mod = 1000000007;
int digits(int n) {
  n = abs(n);
  if(n < 10) return 1;
  elif(n < 100) return 2;
  elif(n < 1000) return 3;
  elif(n < 10000) return 4;
  elif(n < 100000) return 5;
  elif(n < 1000000) return 6;
  elif(n < 10000000) return 7;
  elif(n < 100000000) return 8;
  elif(n < 1000000000) return 9;
  else return 10;
}


int main() {
  io();
  
  string s, t;
  int a, b;
  string c;
  cin >> s >> t >> a >> b >> c;
  if(c == s) --a;
  elif(c == t) --b;
  cout << a << " " << b;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int K = sc.nextInt();
		long res = (long) (Math.pow(K-1, N-1) * K);
		System.out.println(res);
	}
}

Measured memory_bytes: 23636
#include <stdio.h>
int main(void)
{
	int a,b;

	scanf("%d",&a); scanf("%d",&b);
	
	if (a < b) {
		printf("a < b\n");
	} else if (a > b) {
		printf("a > b\n");
	} else {
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<array>
using namespace std;
int main(){
int N,ans=0;
cin>>N;
int A[N];
for (int i = 0; i < N; i++) {
  cin>>A[i];
  A[i]=A[i]-1;
  ans=ans+A[i];
}
cout<<ans<<endl;












}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int N=1e5+10;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
vector<int> E[N];
int n,m,a[N],f[N];
int getf(int x) { return x==f[x]?x:f[x]=getf(f[x]); }
pii op[N];int tot=0;
int fa[N],son[N],siz[N],dep[N],top[N];
void dfs1(int u) {
    siz[u]=1;
    for(int v:E[u])
        if(v!=fa[u]) {
            fa[v]=u; dep[v]=dep[u]+1; dfs1(v);
            siz[u]+=siz[v];
            if(siz[son[u]]<siz[v]) son[u]=v;
        }
}
void dfs2(int u,int tp) {
    top[u]=tp; if(son[u]) dfs2(son[u],tp);
    for(int v:E[u])
        if(v!=fa[u]&&v!=son[u]) dfs2(v,v);
}
int lca(int u,int v) {
    while(top[u]!=top[v]) {
        if(dep[top[u]]<dep[top[v]]) swap(u,v);
        u=fa[top[u]];
    }
    return dep[u]<dep[v]?u:v;
}
bool dfs3(int u,int fa) {
    dep[u]=1;
    for(int v:E[u])
        if(v!=fa) {
            if(!dfs3(v,u)) return 0;
            a[u]+=a[v];
        }
    return (!fa)||(a[u]&1);
}
int main() {
    cin>>n>>m;
    for(int i=1;i<=n;i++) f[i]=i;
    for(int i=1;i<=m;i++) {
        int u=gi(),v=gi();
        if(getf(u)!=getf(v)) f[getf(u)]=getf(v),E[u].pb(v),E[v].pb(u);
        else op[++tot]=mp(u,v);
    }
    for(int i=1;i<=n;i++) if(!dep[i]) dep[i]=1,dfs1(i),dfs2(i,i);
    for(int i=1;i<=tot;i++) a[op[i].fi]++,a[op[i].se]++,a[lca(op[i].fi,op[i].se)]-=2;
    memset(dep,0,sizeof(dep));
    for(int i=1;i<=n;i++)
        if(!dep[i]) {
            if(!dfs3(i,0)) return puts("NO"),0;
        }
    puts("YES");
    return 0;
}


Measured memory_bytes: 8832
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9+7;
//const ll MOD = 998244353;
//const ll MOD = 924844033;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), outendl())
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

//below here

int main(){
	int n;
	cin >> n;
	int ans = 0;
	for(int i=1;i<=n;++i){
		if((to_string(i).size())&1)++ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = n % 2
a = list(map(int, input().split()))
a.sort()
mi = a[0]
ma = a[n - 1]
l = []
for i in range(1, n - 1):
    if a[i] < 0:
        l.append((ma, a[i]))
        ma -= a[i]
    else:
        l.append((mi, a[i]))
        mi -= a[i]
l.append((ma, mi))
print(ma - mi)
for x, y in l:
    print(x, y)

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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,r,n) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

#define cout cout << setprecision(12)

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void dbg(T a) { cout << a << ' ' << endl; }

ll n, ans = 0, sum = 0, cnt = 0;
string s;

/*--------------------template--------------------*/

int main() {
    cin >> n >> s;
	int a, b, c;
	REP(i,1000) {
    	a = i % 10;         // 1
		b = i / 10 % 10;    // 10
    	c = i / 100;        // 100
    	//cout << c << b << a << endl;
    	auto itr_100 = s.find(to_string(c));
    	if (itr_100 != string::npos) {
        	auto itr_10 = s.find(to_string(b),itr_100+1);
        	if (itr_10 != string::npos/* && itr_10 != itr_100*/) {
              	auto itr_1 = s.find(to_string(a),itr_10+1);
            	if (itr_1 != string::npos/* && itr_1 != itr_10*/) {
                	cnt++;
                }
            }
        }
    }
	dbg(cnt);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	cout<<fixed<<setprecision(10);
	ll n;
	cin>>n;
	double prob[n+1];
	for(ll i=1;i<=n;i++)
		cin>>prob[i];
	// First i coins se j heads kaise laaye!
	double dp[n+1][n+1]={1};
	for(ll i=1;i<=n;i++)
	{
		for(ll j=0;j<=i;j++)
		{
			if(j==0)
				dp[i][j]=dp[i-1][j]*(1-prob[i]);
			else
				dp[i][j]=dp[i-1][j]*(1-prob[i]) + dp[i-1][j-1]*prob[i];
		}
	}
	double ans=0;
	for(ll j=(n+1)/2;j<=n;j++)
		ans+=dp[n][j];
	cout<<ans<<"\n";
}

Measured memory_bytes: 74108
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<utility>
#include<array>
#include<cassert>
#include<list>
#include<experimental/any>
#include<cstring>
#include<cctype>
#include<ctime>
#include<cstdbool>
#include<cstdint>
#include<cstddef>
#include<set>
#include<unordered_set>
#include<bitset>

using namespace std;
using experimental::any;
 
#define SPEEDY cin.tie(0);ios::sync_with_stdio(false);
 
#define REP(i,n) for(int i=0;i<(n);i++)
#define ARREP(i,n,X) for(int i=0;i<(n);i++)cin>>X[i]
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)
#define BitFOR(N) REP(Bit,1<<(N))
 
#define MODE 0
#define DEB(X) if(MODE)cout<< #X <<": "<<X<<" ";
#define DEB2(X) if(MODE)cout<<X<<" ";
#define ARDEB(i,X) if(MODE)cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define TFDEB(f) if(MODE){(f)? cout<<"true ":cout<<"false ";}
#define FORDEB(n,X) if(MODE)for(int i=0;i<(n);i++)ARDEB(i,X)
#define END if(MODE)cout<<endl;
 
typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define ALL(X) X.begin(),X.end()
struct edge{int to,cost;};
//struct edge{int from,cost,to;};
struct P2{int x,y;};
#define BIT(Bit,n) bitset<n>(Bit)
#define Endl endl
 
const int MOD7=1000000007;
const int INF=100000000;
const int SET=1000;
 
int main(){
	int n,m;
	char s[55][55],t[55][55],dim=0;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>s[i];
	}
	for(int i=0;i<m;i++){
		cin>>t[i];
	}
	REP(i,n-m+1)REP(j,n-m+1){
		dim=0;
		for(int k=0;k<m;k++){
			int count=0;
			for(int l=0;l<m;l++){
				if(s[i+k][j+l]==t[k][l]){
					count++;
				}
			}
			if(count==m){
				dim++;
			}
		}
		if(dim==m){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
 
  vector <string> a,b;
  string tmp;
  int n,i;
 
  cin>>n;
  for(i=0;i<n;i++)
  {
    cin>>tmp;
    a.push_back(tmp);
  }

  b.assign(a.begin(),a.end());

  for(i=0;i<n-1;i++)
  {
   for(int j=n-2;j!=i-1;j--) 
   {
    if(a[j][1]>a[j+1][1])
    {
     swap(a[j],a[j+1]);
    }
   }
  }

  for(i=0;i<n-1;i++)
  {
   cout<<a[i]<<" ";
  }
  cout<<a[n-1]<<endl<<"Stable"<<endl;
 
  for(i=0;i<n-1;i++)
  {
    int now,minnum=101;
    for(int j=i;j<n;j++)
    {
      if(minnum>b[j].at(1)-'0')
      {
        now=j;
        minnum=b[j].at(1)-'0';
      }
    }
    if(i!=now)  swap(b[i],b[now]);
  }
 
  for(i=0;i<n-1;i++)
  {
    cout<<b[i]<<" ";
  }

  cout<<b[n-1]<<endl;

  if(a==b)
  {
   cout<<"Stable"<<endl;
  }else{
    cout<<"Not stable"<<endl;
  }

  return 0;
 
}


Measured memory_bytes: 3220
import java.util.Scanner;
public class Main {
    public static void main (String args[]){
        try(Scanner sc = new Scanner (System.in)){
            int w = sc.nextInt();
            int n = sc.nextInt();
            int[] values = new int[w];
            for(int i=0;i< values.length;i++){
                values[i]= i+1;
            }
            for(int i =0; i<n; i++){
                String str = sc.next();
                String [] ab = str.split(",");
                int a = Integer.parseInt(ab[0])-1;
                int b = Integer.parseInt(ab[1])-1;
                int value = values[a];
                values[a] = values[b];
                values[b] = value;
            }
            for (int i=0; i< values.length; i++){
                System.out.println(values[i]);
            }
        }
    }   
}


Measured memory_bytes: 26028
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;

int main(){
	int n;
	cin>>n;
	vector<int>a(n),b(n),c(n);
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)cin>>b[i];
	for(int i=0;i<n;i++)cin>>c[i];
	sort(a.begin(),a.end());
	sort(c.begin(),c.end());
	ll ans=0;
	for(int i=0;i<n;i++){
		auto itr1=upper_bound(c.begin(),c.end(),b[i]);
		ll num2=c.end()-itr1;
		auto itr2=lower_bound(a.begin(),a.end(),b[i]);
		ll num1=itr2-a.begin();
		ans+=num1*num2;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1408
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

		int N, K;

		N = sc.nextInt();
		K = sc.nextInt();
		int[] d = new int[K];

		int[][] A = new int[K][K];
		Set<Integer> set = new HashSet<Integer>();
		for (int i = 0; i < K; i++) {
			d[i] = sc.nextInt();
			for (int j = 0; j < d[i]; j++) {
				set.add(sc.nextInt());

			}
		}

		int w = N - set.size();
		System.out.println(w);

	}
}


Measured memory_bytes: 46112
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val a = Array(0L, 0L, 0L, 0L, 0L) // m a r c h
    for(i <- 0 until n) {
      val s = sc.next()
      if (s.charAt(0) == 'M') {
        a(0) += 1
      } else if (s.charAt(0) == 'A') {
        a(1) += 1
      } else if (s.charAt(0) == 'R') {
        a(2) += 1
      } else if (s.charAt(0) == 'C') {
        a(3) += 1
      } else if (s.charAt(0) == 'H') {
        a(4) += 1
      }
    }
    var ans = 0L
    for(i <- 0 until a.length) {
      for(j <- (i+1) until a.length) {
        for(k <- (j+1) until a.length) {
          ans += a(i)*a(j)*a(k)
        }
      }
    }
    println(ans)
  }
}


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

using namespace std;

const int N = 1e5 + 5;
int n, arr[N], dp[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> arr[i];
    }

    dp[1] = 0;
    dp[2] = abs(arr[2] - arr[1]);

    for(int i = 3; i <= n; i++){
        dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2]));
    }
    cout << dp[n] << '\n';
    return 0;
}

Measured memory_bytes: 1024
// abc167_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, M, X;
    cin >> N >> M >> X;

    vector<ll> C(N);
    vector<vector<ll>> A(N, vector<ll>(M, 0));
    REP(i, N){
        cin >> C[i];
        REP(j, M) cin >> A[i][j];
    }

    ll ans = INF;
    REP(p, 1 << N){

        vector<ll> D(M, 0);
        ll cost = 0;
        REP(i, N) if ((p >> i) & 1){

            cost += C[i];
            REP(j, M){
                D[j] += A[i][j];
            }

        }

        bool is_valid = true;
        REP(j, M){
            if (D[j] < X) {
                is_valid = false;
                break;
            }
        }

        if (is_valid){
            ans = min(ans, cost);
        }
    }

    if (ans == INF){
        print(-1);
    } else {
        print(ans);
    }


    return 0;
}


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

int main(){
    int n;
    cin >> n;
    int a[n], x = 0;
    for(int i = 0; i < n; i++)  cin >> a[i], x ^= a[i];
    for(int i = 0; i < n; i++)  cout << (a[i]^x) << " \n"[i==n-1];
    return 0;
}

Measured memory_bytes: 4300
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;

struct Info{
	bool operator<(const struct Info &arg) const{
		return average > arg.average;
	};
	int dist,average;
};

void func(int N, int M){

	Info info[N];

	int sum = 0;

	for(int i = 0; i < N; i++){
		scanf("%d %d",&info[i].dist,&info[i].average);
		sum += info[i].dist*info[i].average;
	}

	sort(info,info+N);

	for(int i = 0; i < N; i++){
		if(info[i].dist < M){
			M -= info[i].dist;
			sum -= info[i].dist*info[i].average;
		}else{
			sum -= M*info[i].average;
			M = 0;
			break;
		}
	}

	printf("%d\n",sum);
}

int main(){

	int N,M;

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		func(N,M);
	}

    return 0;
}

Measured memory_bytes: 2708
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
 
using namespace std;


int MOD=1000000007;


int main() {
	int N,M,k,ans=0,c=0;
	cin >> N >> M;
	vector<vector<int>> s(M+10);
	for(int i=0; i<M; i++){
		cin >> k;
		s[i].resize(k);
		for(int j=0; j<k; j++){
			cin >> s[i][j];
			s[i][j]--;
		}
	}
    vector<int> p(M+10);
	for (int i = 0; i < M; ++i) 
	cin >> p[i];
 
	for (int i=0; i<(1<<N); i++) {
		bool ok=true;
		for (int j=0; j<M; j++) {
			c=0;
			for (int id:s[j]) {
				if ((i>>id) & 1) {
					c++;
				}
			}
			c%=2;
			if (c!=p[j]) {
				ok=false;
			}
		}
		if(ok) {
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
Mod = 1000000007



def main(): #startline--------------------------------------------
    N = int(input())
    s = [input() for i in range(N)]
    S = [[j for j in i] for i in s]
    p = []
    for i in range(N):
        S[i].sort()
        S[i] = "".join(S[i])
    S.sort()
    cnt = 0
    keep = "start"
    S.append("A")
    for i in S:
        if keep == "start":
            keep = i
            cnt += 1
        elif keep == i:
            cnt += 1
            keep = i
        else:
            p.append(cnt*(cnt-1)//2)
            cnt = 1
            keep = i
    print(sum(p))
        
if __name__ == "__main__":
    main() #endline===============================================




def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Measured memory_bytes: 33324
def test():
    n = int(input())
    s = input()
    a = []
    for i in range(n-1):
        if s[i+1] != s[i]:
            a.append(s[i])
    a.append(s[n-1])
    print(len(a))


if __name__ == "__main__":
    test()


Measured memory_bytes: 3956
#include<iostream>
#include<map>
typedef long long ll;
const int maxn=2e6+16;
using namespace std;
ll n,m,p;
map<ll,ll>mp;
ll sum[maxn];
ll num[maxn];
int main()
{
	ll res=0;
	scanf("%lld%lld",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&num[i]);
        sum[i]=sum[i-1]+num[i];
    }
    for(int i=1;i<=n;i++)
        sum[i]=(sum[i]-i%m+m)%m;
    ll low=min(m-1,n);
    for(int i=0;i<=low;i++)
    {
        res+=mp[sum[i]];
        mp[sum[i]]++;
    }
    for(int i=low+1;i<=n;i++)
    {
        mp[sum[i-m]]--;
        res+=mp[sum[i]];
        mp[sum[i]]++;
    }
    printf("%lld\n",res);
    return 0;
}

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

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

    if(n != 100) cout << (int)pow(100, d) * n << endl;
    if(n == 100) cout << (int)pow(100, d) * (n+1) << endl;
    return 0;
}

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

int main(){
  int H,W;
  string s,s_inside;

  while(1){
    cin>>H>>W;
    s="";
    s_inside="#";
    if(H==0) break;

    for(int i = 0; i<W; i++){
      s+="#";
    }
    for(int i = 1; i<W-1; i++){
      s_inside += ".";
    }
    s_inside += "#";

    cout<<s<<endl;
    for(int i = 1; i<H-1; i++){
      cout<<s_inside<<endl;
    }
    cout<<s<<endl;

    cout<<endl;
  }

  return 0;
}

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

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

  int n,m;
  cin>>n>>m;
  std::vector<ll> v1(n),v2(n),v3(m),v4(m);
  for(int i=0;i<n;i++){
    cin>>v1[i]>>v2[i];
  }
  for(int i=0;i<m;i++){
    cin>>v3[i]>>v4[i];
  }
  for(int i=0;i<n;i++){
    ll dist = abs(v1[i]-v3[0])+abs(v2[i]-v4[0]);
    int ans = 0;
    for(int j=1;j<m;j++){
      ll t = abs(v1[i]-v3[j])+abs(v2[i]-v4[j]);
      if(dist > t) {
        dist = t;
        ans = j;
      }
    }
    cout<<ans+1<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
S = [""]*H
for i in range(H):
    S[i] = list(input())

for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            
            if i > 0:
                if S[i-1][j] == "#":
                    continue
            if j > 0:
                if S[i][j-1] == "#":
                    continue
            if j < W-1:
                if S[i][j+1] == "#":
                    continue
            if i < H-1 :
                if S[i+1][j] == "#":
                    continue
                
            print("No")
            exit()

print("Yes")

Measured memory_bytes: 9096
N,K=map(int,input().split())
*A,=map(int,input().split())

i=0
L=0
R=0
while i<N:
    j=0
    while j<N:
        L+=(j<i and A[i]>A[j])
        R+=(i<j and A[i]>A[j])
        j+=1
    i+=1

ans=(R+L)*(K-1)*K//2+K*R
print(ans%(10**9+7))

Measured memory_bytes: 9200
#include <iostream>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << (a*b > c*d ? a*b : c*d) << endl;
  return 0;
}


Measured memory_bytes: 256
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();

            if (a >= 3200)
            {
                Console.WriteLine(s);
            }
            else
            {
                Console.WriteLine("red");
            }
        }
    }
}


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

int main() {
  int N;
  cin >> N;
  int sum=0, t=N;
  
  while(t>0){
    sum += t%10;
    t /= 10;
  }
  if(N%sum==0){
  cout << "Yes" <<endl;
  }
  else{
    cout << "No" << endl;   
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010], p, v, m, n;
bool chck(int x){
    int vv=v-1, tmp=0;
    multiset<int> st;
    // cout<<x<<endl;
    for(int i=0; i<n; ++i){
        // cout<<a[i]<<" ";
        if(i==x)
        continue;
        if(a[i]>a[x]+m){
            ++tmp;
        }
        if(a[i]>a[x]+m || a[i]<=a[x]){
            --vv;
        }
        else{
            st.insert(-(a[x]+m-a[i]));
        }
    }
    if(tmp>p-1){
        // cout<<"!!"<<endl;
        return 0;
    }
    if(vv<=0){
        return 1;
    }
    // cout<<tmp<<endl;
    // cout<<"__|"<<tmp<<endl;
    tmp=p-1-tmp;
    // cout<<tmp<<endl;
    while(tmp-- && st.size()){
        st.erase(--st.end());
        --vv;
    }
    if(vv<=0){
        return 1;
    }
    ll sm=0, tmp1;
    // cout<<vv<<" "<<tmp<<endl;
    while(vv){
        // cout<<st.size()<<endl;
        if(st.size()==0)
            return  0;
        tmp=-*st.begin();
        sm+=tmp;
        st.erase(st.begin());
        while(sm<m){
            if(st.size()==0)
                return 0;
            tmp=-*st.begin();
            sm+=tmp;
            st.erase(st.begin());
        }
        --vv;
        tmp1=tmp-(sm-m);
        tmp=min(m, tmp)-tmp1;
        st.insert(-tmp);
        sm=0;
    }
    return 1;
}
int main(){
    while(cin>>n>>m>>v>>p){
        ll ans=0;
        for(int i=0; i<n; ++i){
            scanf("%d",a+i);
        }
        sort(a, a+n);
        reverse(a, a+n);
        int st=0, nd=n-1, md;
        while(st<nd){
            md=(st+nd+1)/2;
            // cout<<st<<" "<<md<<" "<<nd<<endl;
            if(chck(md)){
                st=md;
            }
            else{
                nd=md-1;
            }
        }
        cout<<st+1<<endl;
    }
  return 0;
}




Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>

using namespace std;

int main()
{
    long long int x;
    long long int cnt = 0;
    long long int num = 100;

    cin >> x;

    while (num < x) {
        cnt++;
        num += num * 0.01;
    }

    cout << cnt << endl;

}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAX 3010
ll dp[MAX][MAX];
ll v[MAX];
bool been[MAX][MAX];
ll f(int i,int j){
    if(i > j) return 0;
    if(been[i][j]) return dp[i][j];
    been[i][j] = true;
    return dp[i][j] = max(v[i]-f(i+1,j),v[j]-f(i,j-1));
}
int main(){
    memset(been,false,sizeof(been));
    int n;cin >> n;
    for(int i = 0;i<n;i++) cin >> v[i];
    cout << f(0,n-1) << '\n';
    return 0;
}

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

int main(){
    int a,b ;
    cin >> a >> b ;
    if (a<10 && b<10)
    {
        /* code */
        cout << a*b << endl ;
    }else
    {
        cout << "-1" << endl ;
    }
    
    
    
    
}

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

typedef long long ll;

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,l,n) for(int i=(l);i<(n);i++)

int main(){
    int N,W;
    cin >> N >> W;
    int value[N+1];
    int weight[N+1];
    value[0]=weight[0]=-1;
    for(int i=1;i<=N;i++){
        cin >> value[i] >> weight[i];
    }
    int dp[N+1][W+1];
    for(int i=0;i<N+1;i++){
        dp[i][0] = 0;
    }
    for(int i=0;i<W+1;i++){
        dp[0][i] = 0;
    }
    for(int i=1;i<N+1;i++){
        for(int j=1;j<W+1;j++){
            if(weight[i] > j) dp[i][j]=dp[i-1][j];
            else{
                dp[i][j] = max(dp[i-1][j],dp[i-1][j-weight[i]]+value[i]);
            }
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}



Measured memory_bytes: 7036
#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

int prime[50000];
char flag[50001];

int getPrime()
{
	
	flag[0] = flag[1] = 0;
	
	memset(flag, 1, sizeof(flag));
	for (int i = 2; i < 50001; i++){
		if (flag[i] == 1){
			for (int j = 2; i * j < 50001; j++){
				flag[i * j] = 0;
			}
		}
	}
	int cnt = 0;
	for (int i = 2; i < 50001; i++){
		if (flag[i] == 1){
			prime[cnt++] = i;
		}
	}
	
	return (cnt);
}

int main(void)
{
	int primeCount;
	
	primeCount = getPrime();
	
	while (1){
		int n;
		int ans;
		
		scanf("%d", &n);
		
		if (n == 0){
			break;
		}
		
		ans = 0;
		for (int i = 0; prime[i] <= n / 2; i++){
			if (binary_search(prime + i, prime + primeCount, n - prime[i]) == true){
				ans++;
			}
		}
		
		printf("%d\n", ans);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//SUNEET KUMAR -->  ਸੁਨੀਤ   
// 🖕🖕🖕
int power(int a,int n)//binary expo
{
    int r;
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
        r=power(a,n/2);
    if(n%2==0)
        return ((r)%mod)*((r)%mod)%mod;
    else
        return ((((r)%mod)*((r)%mod))%mod*((a)%mod))%mod;
}
int max(int a,int b)
{
    if(a>b)
        return a;
    else
        return b;
}
 
 signed main()
 {
     int h,w;
     cin>>h>>w;
     int a[h+3][w+3],dp[h+3][w+3];

     for(int i=1;i<=h;i++)
     {
         for(int j=1;j<=w;j++)
         {
             char x;
             cin>>x;
             if(x=='.')
             {
                  a[i][j]=1;//unblocked
             }
             else
             {
                 a[i][j]=0;//blocked
             }
         }
     }
     for(int i=0;i<h+2;i++)
     {
         for(int j=0;j<w+2;j++)
         {
             dp[i][j]=0;
         }
     }
     if(a[1][1]==0||a[h][w]==0)
     {
         cout<<0<<endl;
     }
     else
     {
         dp[1][1]=1;
         for(int i=1;i<=h;i++)
         {
             for(int j=1;j<=w;j++)
             {
                 if(a[i][j]&&(i>1||j>1))
                    dp[i][j]=(dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
             }
         }
     }
     cout<<dp[h][w]<<endl;
   
 }

Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
 
#define rep(i, a, b) for(lli i = a; i < (b); ++i)
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) lli((x).size())
#define wis cout<<endl<<"I already speak english, bitch"<<endl<<endl;
 
typedef long long int lli;
typedef vector<lli> vi;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef pair<ii,lli> iii;
 
#define trace(args...) { string  _s =#args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
void err(istream_iterator<string> it){}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args){
    cout <<  *it  << " : " << a << endl;
    err(++it, args...);
}

int main(){
	//vi v;
	int n,k; cin>>n>>k;
	vi v(n);
	rep(i,0,n){
		cin>>v[i];
	}
	sort(all(v));
	int cnt=0;
	for(auto x:  v){
		if(x>=k) cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3964
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
typedef long long ll;
const int MAX = 999999999;

int main(){
    ll n, h, w;
    cin >> n >> h >> w;

    ll cnt = 0;
    rep(i, n){
        ll a; ll b;
        cin >> a >> b;
        if(a >= h && b >= w) cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256