akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(), v.end()
#define fori(i, j, k) for (int i = (j); i < (int)(k); i++)
#define forb(i, j, k) for (int i = (j); i >= (int)k; i--)
#define lchild(ind) 2 * ind + 1
#define rchild(ind) 2 * ind + 2
#define bug(val) cout << "# " << val << endl;
#define bugs(val) cout << '_' << val;
#define bugl(val) cout << "## " << val << endl;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
typedef pair<ll, pll> plp;
typedef pair<pll, int> ppi;
typedef pair<pll, ll> ppl;
typedef pair<pll, pll> ppp;
typedef vector<int> vi;
typedef vector<ll> vll;

const int maxn = 1e5 + 500;
const ll inf = 2e18, mod = 1e9 + 7;

ll n, x[maxn], dp[maxn], seg[4 * maxn], E, T, ind;

void update(ll u, ll l, ll r, ll x, ll val)
{
	if (r - l == 1)
	{
		seg[u] += val;
		return;
	}
	ll mid = (l + r) / 2;
	if (x < mid)
		update(lchild(u), l, mid, x, val);
	else
		update(rchild(u), mid, r, x, val);
	seg[u] = min(seg[lchild(u)], seg[rchild(u)]);
}

ll query(ll u, ll l, ll r, ll b, ll e)
{
	if (e <= b)
		return inf;
	if (b <= l && r <= e)
		return seg[u];
	ll mid = (l + r) / 2, tmp = inf;
	if (b < mid)
		tmp = min(tmp, query(lchild(u), l, mid, b, e));
	if (e > mid)
		tmp = min(tmp, query(rchild(u), mid, r, b, e));
	return tmp;
}

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

	cin >> n >> E >> T;
	fori (i, 1, n + 1)
		cin >> x[i];
	update(0, 0, n + 1, 0, -2 * x[1]);
	fori (i, 1, n + 1)
	{
		ind = lower_bound(x, x + n, x[i] - T / 2) - x;
		if (2 * (x[i] - x[ind]) < T)
			ind--;
		dp[i] = min(2 * x[i] + query(0, 0, n + 1, 0, ind), T + dp[ind]);
		update(0, 0, n + 1, i, dp[i] - 2 * x[i + 1]);
	}
	cout << dp[n] + E << endl;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>

const int NIL = -1;
const int MAX = 100000 + 5;

struct Node {
	int parent = NIL;
	int left = NIL;
	int right = NIL;
};

Node T[MAX];
int D[MAX];

/*
int depth(int nd) {
	int d = 0;
	while (T[nd].parent != NIL) {
		nd = T[nd].parent;
		++d;
	}

	return d;
}
*/

void set_depth(int nd, int d) {
	D[nd] = d;
	if (T[nd].right != NIL) set_depth(T[nd].right, d);
	if (T[nd].left != NIL) set_depth(T[nd].left, d + 1);
}

std::string node_type(int nd) {
	if (T[nd].parent == NIL) return "root";
	else if (T[nd].left == NIL) return "leaf";
	else return "internal node";
}

void print(int nd) {
	// std::cout << "node " << nd << ": parent = " << T[nd].parent << ", depth = " << depth(nd) << ", " << node_type(nd) << ", ";
	std::cout << "node " << nd << ": parent = " << T[nd].parent << ", depth = " << D[nd] << ", " << node_type(nd) << ", ";
	int i, c;
	std::cout << "[";
	for (i = 0, c = T[nd].left; c != NIL; ++i, c = T[c].right) {
		if (i) std::cout << ", ";
		std::cout << c;
	}
	std::cout << "]" << std::endl;
}

int main()
{
	int n;
	std::cin >> n;
	for (int j = 0; j != n; ++j) {
		int id, k;
		std::cin >> id >> k;
		int p = NIL;
		for (int i = 0; i < k; ++i) {
			int c;
			std::cin >> c;
			T[c].parent = id;
			if (!i) {
				T[id].left = c;
			} else {
				if (p != NIL) {
					T[p].right = c;
				}
			}
			p = c;
		}
	}

	int r = 0;
	for (int i = 0; i != n; ++i) {
		if (T[i].parent == NIL) {
			r = i;
		}
	}

	set_depth(r, 0);

	for (int i = 0; i != n; ++i) {
		print(i);
	}

	return 0;
}


Measured memory_bytes: 7848
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n+1) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
  
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<vector<int> > cnt(n,vector<int>(26));
	string s;
	rep(i,n){
		cin >> s;
		rep(j,s.size()){
			++cnt[i][s[j]-'a'];
		}
	}
	rep(i,26){
		int minv = INF;
		rep(j,n){
			chmin(minv,cnt[j][i]);
		}
		rep(j,minv){
			cout << char('a' + i);
		}
	}
	cout << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
int main() {
  int k, a, b;
  cin >> k >> a >> b;
  if (a % k == 0 || b % k == 0 || a / k != b / k) {
    cout << "OK";
  } else {
    cout << "NG";
  }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define F first
#define S second
#define all(v) (v).begin(), (v).end()
#define sz(v) (v).size()
#define pb push_back
#define mp make_pair
#define mt make_tuple

int main(){
	Fio;
	int t=1;
	//cin >> t;
	while(t--) {
		ll n;
		cin >> n;
		vector<ll> a(n);
		ll zor = 0;
		for(int i=0; i<n; ++i)
			cin >> a[i], zor^=a[i];

		for(int i=0; i<n; ++i)
			cout << (zor^a[i]) << " ";
	}

	return 0;
}

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

using namespace std;

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

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-9;

int dx[2][8] = {
	{ 0,1,2,3,0,1,2,3 },
	{ 0,1,0,1,0,1,0,1 }
};

int dy[2][8] = {
	{ 0,0,0,0,1,1,1,1 },
	{ 0,0,1,1,2,2,3,3 }
};

int main() {
	int w, h;
	while (cin >> w >> h, w || h) {
		int sx, sy, gx, gy;
		scanf("%d %d %d %d", &sx, &sy, &gx, &gy);
		sx--; sy--; gx--; gy--;
		
		int maps[100][100];
		memset(maps, -1, sizeof(maps));
		
		int n; cin >> n;
		
		REP(i, n) {
			int c, d, x, y;
			scanf("%d %d %d %d", &c, &d, &x, &y);
			x--; y--;
			
			REP(j, 8) {
				int xx = x + dx[d][j], yy = y + dy[d][j];
				maps[yy][xx] = c - 1;
			}
		}
		
		int num = maps[sy][sx];
		bool done[100][100] = {};
		
		queue<pii> que;
		if (num != -1) que.push(pii(sy, sx));
		done[sy][sx] = true;
		
		while (!que.empty()) {
			pii now = que.front(); que.pop();
			int x = now.se, y = now.fi;
			
			int ddx[4] = {1,0,-1,0}, ddy[4] = {0,1,0,-1};
			REP(i, 4) {
				int xx = x + ddx[i], yy = y + ddy[i];
				if (!(xx >= 0 && xx < w && yy >= 0 && yy < h)) continue;
				if (maps[yy][xx] != num || done[yy][xx]) continue;
				done[yy][xx] = true;
				que.push(pii(yy, xx));
			}
		}
		
		if (done[gy][gx] && num != -1) puts("OK");
		else puts("NG");
	}
	return 0;
}

Measured memory_bytes: 3160
<?php
  $n = trim(fgets(STDIN));
  $v = explode(" ",trim(fgets(STDIN)));
  $c = explode(" ",trim(fgets(STDIN)));
  $total = 0;
  for($i=0; $i<$n; $i++){
    $m = $v[$i] - $c[$i];
    if($m >= 0){
      $total += $m;
    }
  }
  echo $total."\n";

Measured memory_bytes: 4728
#include <bits/stdc++.h>
#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;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main(){
    ll u, v;
    cin>>N>>u>>v;
    --u; --v;
    mat G(N, vec(0));
    rep(i, N-1){
        cin>>A>>B;
        --A; --B;
        G[A].push_back(B);
        G[B].push_back(A);
    }
    vec dt(N,INF), da(N,INF), used(N,0);
    dt[u] = da[v] = 0;
    queue<P> que;
    que.emplace(u, 0);
    while(!que.empty()){
        P p = que.front();
        que.pop();
        ll now = p.fi, d = p.se;
        used[now] = 1;
        for(ll to : G[now]){
            if(used[to] == 0){
                dt[to] = d + 1;
                que.emplace(to, d + 1);
            }
        }
    }
    rep(i,N) used[i] = 0;
    que.emplace(v, 0);
    while(!que.empty()){
        P p = que.front();
        que.pop();
        ll now = p.fi, d = p.se;
        used[now] = 1;
        for(ll to : G[now]){
            if(used[to] == 0){
                da[to] = d + 1;
                que.emplace(to, d + 1);
            }
        }
    }
    ll ans = 0;
    rep(i,N) if(dt[i] < da[i]) ans = max(ans, da[i] - 1);
    cout<<ans<<endl;
}

Measured memory_bytes: 8960
#include <bits/stdc++.h>
#define N 100020
#define ll long long
using namespace std;
inline ll read(){
  ll x=0,f=1;char ch=getchar();
  while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
  while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
  return f?x:-x;
}
map<ll, int> cnt, vis;
ll a[N], cub[N];
const ll MAX_CUB = 2154;
bool mark[MAX_CUB + 20];
int prime[MAX_CUB + 20], tot;
void filter_prime(int size) {
  for (int i = 2; i <= size; ++ i) {
    if (!mark[i]) prime[++ tot] = i;
    for (int j = 1; j <= size && prime[j] * i <= size; ++ j) {
      mark[prime[j] * i] = 1;
      if (i % prime[j] == 0) {
        break;
      }
    }
  }
}
bool isSquare(ll x) {
  ll k = sqrt(x);
  return k * k == x;
}
ll calc(ll x) {
  ll rev = 1;
  for (int i = 1; i <= tot; ++ i) {
    int c = 0;
    while (x % prime[i] == 0) {
      x /= prime[i];
      ++ c;
    }
    if (c) {
      for (; c < 3; ++ c) {
        rev *= prime[i];
      }
    }
  }
  // 此时 x 要么是质数，要么是平方数
  if (isSquare(x)) {
    rev *= sqrt(x);
  } else {
    rev *= x * x;
  }
  return rev;
}
int main(int argc, char const *argv[]) {
  // freopen("../../temp/test.in", "r", stdin);
  filter_prime(MAX_CUB);
  int n = read();
  for (int i = 2; i <= MAX_CUB; ++ i) {
    cub[i] = (ll) i * i * i;
  }
  for (int i = 1; i <= n; ++ i) {
    a[i] = read();
    for (int j = 2; j <= MAX_CUB; ++ j) {
      while (a[i] % cub[j] == 0) {
        a[i] /= cub[j];
      }
    }
    ++ cnt[a[i]];
  }
  cnt[1] = min(cnt[1], 1);
  int ans = 0;
  for (int i = 1; i <= n; ++ i) {
    if (vis[a[i]]) {
      continue;
    }
    vis[a[i]] = 1;
    ll rev = calc(a[i]);
    vis[rev] = 1;
    ans += max(cnt[a[i]], cnt[rev]);
  }
  printf("%d\n", ans);
  return 0;
}
/*

首先发现将每个数的立方因子筛去对答案不会有影响。

于是对每个数使其质因子的指数都 mod 3

可以发现能与每个数相乘是立方数的数只有 1 个，这里定义其为该数的补数。

对于每个数和它的补数，将出现次数较多的计入答案。

只需要考虑如何计算补数即可。

*/

Measured memory_bytes: 26112
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        string[] cin = Console.ReadLine().Split();
        int a = int.Parse(cin[0]);
        int b = int.Parse(cin[1]);
        int c = int.Parse(cin[2]);
        if (a < c && c < b) Console.WriteLine("Yes");
        else if (b < c && c < a) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
static const int MAX= 100001;
int N,color[MAX],id=1;
vector<int> G[MAX];

void dfs(int n,int c)
{
	stack<int> s;
	s.push(n);
	color[n]=c;
	while(!s.empty())
	{
		int u=s.top(); s.pop();
		for(int i=0;i<G[u].size();i++)
		{
			int v=G[u][i];
			if(color[v]!=-1) continue;
			color[v]=c;
			s.push(v);
		}
	}
}

void assignColor()
{
	for(int i=0;i<N;i++) color[i]=-1;
	for(int i=0;i<N;i++)
	{
		if(color[i]==-1) dfs(i,id++);
	}
}
int main()
{
	int m,s,t,q;
	cin>>N>>m;
	for(int i=0;i<m;i++)
	{
		cin>>s>>t;
		G[s].push_back(t);
		G[t].push_back(s);
	}
	assignColor();
	
	cin>>q;
	for(int i=0;i<q;i++)
	{
		cin>>s>>t;
		if(color[s]==color[t]) cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
	return 0;
}


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

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

  ll t1, a1, b1, t2, a2, b2;
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;

  a1 *= t1;
  a2 *= t2;
  b1 *= t1;
  b2 *= t2;
  a2 += a1;
  b2 += b1;
  if (a2 == b2) {
    cout << "infinity" << endl;
    return 0;
  }

  if (a2 < b2) {
    swap(a1, b1);
    swap(a2, b2);
  }

  ll d = a2 - b2;
  ll c = b1 - a1;
  ll ans = 0;
  if (c > 0) {
    ans = (c - 1) / d + 1;
    ans *= 2;
    ans--;
    if (c % d == 0) ans++;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
import sys

def main(lines):
  n, r = map(int,lines[0].split())

  if n >= 10:
    print(r)
  else:
    print(r + 100*(10-n))
  return
    
if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append(l.rstrip('\r\n'))
    main(lines)


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0060
{
	class Program
	{
		static void Main(string[] args)
		{
			var	s	= "";
			while( (s = Console.ReadLine()) != null ) {
				var	hand	= Array.ConvertAll( s.Split(), ss => int.Parse( ss ) );
				
				var	card	= new bool[ 11 ];
				foreach( var h in hand ) {
					card[ h ]	= true;
				}
				
				int	left	= 20 - hand[ 0 ] - hand[ 1 ];
				int	ok_cnt	= 0;
				for( int i = 1; i <= 10; i++ ) {
					if( card[ i ] == false ) {
						if( i <= left ) {
							ok_cnt++;
						}
					}
				}
			
				if( ((float)ok_cnt / 7.0f) >= 0.5f ) {
					Console.WriteLine( "YES" );
				} else {
					Console.WriteLine( "NO" );
				}
			}
		}
	}
}

Measured memory_bytes: 5284
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long

const int MAX = 100001;

int n;
int a[MAX], b[MAX];

signed main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  int imos[MAX + 2];
  fill(imos, imos + MAX + 2, 0);
  imos[0]++;
  for (int i = 0; i < n; i++) {
    imos[a[i]]++;
    imos[b[i] + 1]--;
  }

  /*
  for (int i = 1; i <= 10; i++) {
    cout << imos[i] << " ";
  }
  cout << endl;
  */
  for (int i = 1; i < MAX + 2; i++) {
    imos[i] += imos[i - 1];
  }
  for (int i = n + 1; i >= 2; i--) {
    if (imos[i] >= i) {
      cout << i - 1 << endl;
      /*
  for (int i = 1; i <= 10; i++) {
    cout << imos[i] << " ";
  }
  cout << endl;
  */
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}



Measured memory_bytes: 5440
S=list(input())
T=list(input())
slist=[None]*26
flag=True
for i in range(len(S)):
    if slist[ord(S[i])-97] == None and T[i] not in slist:
        slist[ord(S[i])-97] = T[i]
    elif slist[ord(S[i])-97] != T[i]:
        flag = False
        break
    else:
        slist[ord(S[i])-97] = T[i]


if flag:
    print("Yes")
else:
    print("No")
    



Measured memory_bytes: 6704
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = a.length-1; i >= 0; i--) {
            System.out.print(a[i]);
            if(i!=0){
                System.out.printf(" ");
            }
        }
        System.out.println();
    }
}


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


int main(){
  string s;
  cin >> s;
  int size,cnt;
  size = s.size();
  cnt = 0;
  REP(i,size/2){
    if (s[i] == s[size-i-1]) continue;
    else cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <functional>
#include <chrono>
#include <cstring>
#include <limits.h>

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<lint> vl;
typedef pair<lint,lint> pll;

#define mpr make_pair


int main()
{
    ios_base::sync_with_stdio(0);    cin.tie(NULL);    cout.tie(NULL);

    lint n; cin>>n;
    vl a(n);

    map<lint, lint> cnt;
    for (lint i=0; i<n; ++i){
        cin>>a[i];
        cnt[a[i] - i]++;
    }

    lint ans = 0;
    for (int i=0; i<n; ++i){
        ans += cnt[-i - a[i]];
    }
    cout<<ans;



}


Measured memory_bytes: 27436
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define fillarray(array, value, begin, end) fill((array) + (begin), (array) + (end) + 1, value)
#define fillvector(v, value) fill((v).begin(), (v).end(), value)
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
#define vecfirst (*vec.begin())
#define veclast (*vec.rbegin())
#define vecall(v) (v).begin(), (v).end()
#define vecupsort(v) (sort((v).begin(), (v).end()))
#define vecdownsort(v, type) (sort(vecall(v), greater<type>()))
#define veccmpsort(v, cmp) (sort(vecall(v), cmp))
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
ll a, b, c, d;

inline void solve()
{
    cin >> a >> b >> c >> d;
    ll ans = max(a * c, max(a * c, max(b * d, max(a * d, b * c))));
    if ((a <= 0 && 0 <= b) || (c <= 0 && 0 <= d))
        ans = max(0ll, ans);
    cout << ans;
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    // scanf("%d", &Test);
    while (Test--)
        solve();
    TIME__END = clock();
    program_end();
    return 0;
}

Measured memory_bytes: 3616
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))
//#define sz(x) (int)(x.size())
#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e17;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N=1000005;
int find(int x)
{
    if(x==0)
        return 0;
    return (1+2*find((int)x/2));
}
void solve()
{
    int h;
    cin>>h;
    cout<<find(h)<<endl;
}
int32_t main()
{
   
    IOS;
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}




Measured memory_bytes: 256
n = int(input())
d = {}

for _ in range(n):
  s = input()
  d[s] = d.get(s, 0) + 1 

n = max(d.values())
max_k_list = [kv[0] for kv in d.items() if kv[1] == n]

for i in sorted(max_k_list):
  print(i)


Measured memory_bytes: 32988
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n,m = i2()
ans = [0]*n
for i in range(m):
	a,b = i2()
	ans[a-1] += 1
	ans[b-1] += 1 
	
for i in range(n):
	print(ans[i])



Measured memory_bytes: 9072
# -*- coding: utf-8 -*-
import math


def is_sosu(n):

    if n == 2:
        return True

    if n < 2 or n % 2 == 0:
        return False

    for i in range(3, int(math.sqrt(n)) + 1, 2):
        if n % i == 0:
            return False

    return True


def similar_to_2017(n):
    if is_sosu(n) and is_sosu((n + 1) / 2):
        return True

    return False


def main():
    q = int(input())
    in_target = [tuple(map(int, input().split())) for i in range(q)]

    similar_to_2017s = {}
    for i in range(1, 100001, 2):
        if similar_to_2017(i):
            similar_to_2017s[i] = 1 + similar_to_2017s.get(i - 2, 0)
        else:
            similar_to_2017s[i] = similar_to_2017s.get(i - 2, 0)

    for target in in_target:
        cnt = similar_to_2017s.get(target[1], 0) - similar_to_2017s.get(target[0] - 2, 0)

        print(cnt)


if __name__ == '__main__':
    main()




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

int main()
{
  vector<vector<int>> a(3, vector<int>(3, 0));
  rep(i, 3)
  {
    rep(j, 3)
    {
      cin >> a.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  vector<int> b(N);
  rep(i, N) cin >> b.at(i);

  rep(i, 3)
  {
    rep(j, 3)
    {
      rep(k, N)
      {
        if (a.at(i).at(j) == b.at(k))
        {
          a.at(i).at(j) = 0;
        }
      }
    }
  }

  if (a.at(0).at(0) == 0 && a.at(0).at(1) == 0 && a.at(0).at(2) == 0)
  {
    cout << "Yes" << endl;
  }
  else if (a.at(1).at(0) == 0 && a.at(1).at(1) == 0 && a.at(1).at(2) == 0)
  {
    cout << "Yes" << endl;
  }
  else if (a.at(2).at(0) == 0 && a.at(2).at(1) == 0 && a.at(2).at(2) == 0)
  {
    cout << "Yes" << endl;
  }

  else if (a.at(0).at(0) == 0 && a.at(1).at(0) == 0 && a.at(2).at(0) == 0)
  {
    cout << "Yes" << endl;
  }
  else if (a.at(0).at(1) == 0 && a.at(1).at(1) == 0 && a.at(2).at(1) == 0)
  {
    cout << "Yes" << endl;
  }
  else if (a.at(0).at(2) == 0 && a.at(1).at(2) == 0 && a.at(2).at(2) == 0)
  {
    cout << "Yes" << endl;
  }

  else if (a.at(0).at(0) == 0 && a.at(1).at(1) == 0 && a.at(2).at(2) == 0)
  {
    cout << "Yes" << endl;
  }
  else if (a.at(0).at(2) == 0 && a.at(1).at(1) == 0 && a.at(2).at(0) == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;

int main() {
    int N;
    cin >> N;
    int A[N], B[N];
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        B[i] = A[i] - (i + 1);
    }

    sort(B, B + N);

    const int b = (N % 2 == 0)?B[N / 2 - 1]:B[(N + 1) / 2 - 1];

    long long sum = 0;
    for (int i = 0; i < N; ++i) sum += abs(B[i] - b);

    cout << sum << endl;

    return 0;
}

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

bool c[5000+2][5000+2];

bool t(int x,int y){
	if(x<0)return false;
	if(x>5000)return false;
	if(y<0)return false;
	if(y>5000)return false;
	return c[x][y];
}

int main(){
	vector<pair<int,int>> vp;
	while(1){
		int n,ans=0;
		pair<int,int> p[3002];
		scanf("%d",&n);
		if(n==0)break;
		int ss=vp.size();
		for(int i=0;i<ss;i++)c[vp[i].first][vp[i].second]=false;
		vp.clear();
		for(int i=0;i<n;i++){
			scanf("%d%d",&p[i].first,&p[i].second);
			c[p[i].first][p[i].second]=true;
			vp.push_back(p[i]);
		}
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				if(t(p[i].first+p[i].second-p[j].second,p[i].second+p[j].first-p[i].first)&&t(p[j].first+p[i].second-p[j].second,p[j].second+p[j].first-p[i].first))ans=max(ans,(p[i].first-p[j].first)*(p[i].first-p[j].first)+(p[i].second-p[j].second)*(p[i].second-p[j].second));
				//if(t(p[i].first-p[i].second+p[j].second,p[i].second-p[j].first+p[i].first)&&t(p[j].first-p[i].second+p[j].second,p[j].second-p[j].first+p[i].first))ans=max(ans,(p[i].first-p[j].first)*(p[i].first-p[j].first)+(p[i].second-p[j].second)*(p[i].second-p[j].second));
			}
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 25072
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;
 
#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  f              first                 
#define  s              second
#define  endl           "\n"
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;            
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  unordered_map<ll,ll>  um;
typedef  vector<pll>           vpll;
 
const ll   N     =  3e5+5;
const ll   mod   =  1e9+7;
const ll   INF   =  1e18;
const int  INFi  =  0x7f7f7f7f;

ll test = 1, n , ans[N], p2[N];
string x;

void calc(ll f, ll mod){
	p2[0] = 1;
	for(int i = 1; i <= n; i++) p2[i] = (2*p2[i-1])%mod;
	ll res = 0;
	for(int i = 0; i < n; i++){
		if(x[i] == '1') res = (res+p2[i])%mod;
	}
	for(int i = 0; i < n; i++){
		if(x[i] == f+'0'){
			ll res1, ct = 1;
			if(f == 0) res1 = (res+p2[i])%mod;
			else res1 = (res-p2[i]+mod)%mod;
			while(res1){
				res1 = res1%(__builtin_popcount(res1));
				ct++;
			}
			ans[i] = ct;
		}
	}
}

void solve(){
	cin>>n>>x;
	reverse(x.begin(), x.end());
	ll ct = 0;
	for(int i = 0; i < n; i++) ct += x[i]-'0';
	if(ct+1) calc(0,ct+1);
	if(ct-1) calc(1,ct-1);
	for(int i = n-1; i >= 0; i--) deb1(ans[i])
}

int main(){
	fastio;
	//cin>>test;
	for(int i = 1; i <= test; i++){
		solve();
	}
}

Measured memory_bytes: 6908
#include<bits/stdc++.h>
using namespace std;
void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  cout << endl;
}
int main()
{
  int n;
  cin>>n;
  call(n);
}



Measured memory_bytes: 3128
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
const int maxn=2e3+5;
typedef long long ll;
const int mod=1e9+7;

int main()
{
  ll dp[maxn][maxn],sum[maxn][maxn];
  int n,m;
  int s[maxn],t[maxn];
	cin >> n >> m;
	for(int i=1;i<=n;i++)
	{
		cin >> s[i];
	}
	for(int i=1;i<=m;i++)
	{
		cin >> t[i];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(s[i]==t[j]) dp[i][j]=sum[i-1][j-1]+1;
			else dp[i][j]=0;
      dp[i][j] %= mod;
			sum[i][j] = sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+dp[i][j];
			sum[i][j] %= mod;
		}
	}
	sum[n][m]++;
  sum[n][m] %=mod;
  sum[n][m] += 2ll*mod;
  sum[n][m] %=mod;
	cout << sum[n][m] << endl;
  return 0;
}


Measured memory_bytes: 31616
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	aa := make([]int, n)
	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	q := getNextInt(scanner)
	for i := 0; i < q; i++ {
		k := getNextInt(scanner)
		fmt.Fprintln(writer, fmt.Sprintf("%d %d", lower(k, aa), lower(k+1, aa)))
	}
}

func lower(k int, aa []int) int {
	l := -1
	r := len(aa)
	for l+1 < r {
		m := (l + r) >> 1
		if aa[m] < k {
			l = m
			continue
		}
		r = m
	}
	return r
}



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

#define mod 998244353

// F_mod 上でのべき乗, 蟻本p115
ll modPow(ll x, ll n) {
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

// Fermat の小定理を用いた F_mod 上での逆元計算x^(mod-2)
ll Inverse(ll x){
    return modPow(x, mod - 2);
}

// iの階乗 = fact[i], main内の階乗計算をする必要がある
#define MAX_FACT 300001
ll fact[MAX_FACT];

ll nCk(int n, int k){
    //　n_C_kの計算, 蟻本p.263
    ll ans = fact[n] * Inverse(fact[k] * fact[n-k] % mod);
    ans %= mod;
    return ans;
}

int main() {
    ll N, A, B, K;
    cin >> N >> A >> B >> K;

    // 階乗計算
    fact[0]=1;
    for(int i = 1; i < MAX_FACT; ++i) {
        fact[i] = fact[i-1] * i % mod;
    }

    ll ans = 0;
    // A点加点するブロックの数
    for (int i = 0; i <= N; ++i) {
        ll rem = K - A * i;
        if(rem < 0) break;
        if(rem % B != 0 || rem / B > N) continue;
        ll k = rem / B;
        ans += nCk(N, i) * nCk(N, k);
        ans %= mod;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            long A = in.nextLong();
            long B = in.nextLong();
            long K = in.nextLong();

            if (A >= K) {
                A -= K;
                K = 0;
            } else {
                K -= A;
                A = 0;
            }

            if (B >= K) {
                B -= K;
                K = 0;
            } else {
                K -= B;
                B = 0;
            }

            System.out.println(A + " " + B);
        }
    }
}

Measured memory_bytes: 27108
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int a, b, s=0;
    scanf("%d%d", &a, &b);
    if(a>=b)
    {
        s=s+a;
        a--;
        if(a>=b)
        {
            s=s+a;
        }
        else
        {
            s=s+b;
        }
    }
    else
    {
        s=s+b;
        b--;
        if(b>=a)
        {
            s=s+b;
        }
        else
        {
            s=s+a;
        }
    }

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


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

int main(){
    string S;
    int K;
    cin>>K;
    cin>>S;
    if(S.size()<=K){
        cout<<S<<endl;
    }
    else{
        for(int i=0;i<K;i++){
            cout<<S[i];
        }
        cout<<"..."<<endl;
    }
}

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

int main(){
    int check[108] = {};
    check[0] = 1;
    for(int i = 0;i<101;i++){
        if (check[i]==1){
            check[i+4] = 1;
            check[i+7] = 1;
        }
    }
    int n;
    cin >> n;
    if (check[n]==1){
        cout << "Yes" << "\n";
    }else{
        cout << "No" << "\n";
    }

}

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

int main() {
    int64_t X;
    cin >> X;

    int64_t curr_money = 100;
    for (int64_t i = 1; ; i++) {
        curr_money *= 1.01;
        if (curr_money >= X) {
            cout << i << endl;
            return 0;
        }
    }
}

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

int main()
{
  int r;
  double pi = acos(-1);
  cin >> r;
  cout << fixed << setprecision(6) << 2 * pi * r << endl;

  return 0;
}


Measured memory_bytes: 3760
package main

import (
	"fmt"
)

func calcMin(weightList []int, n int) int {
	min := 100001
	for i := 1; i < n; i++ {
		var rightSum, leftSum int
		for _, v := range weightList[:i] {
			rightSum = rightSum + v
		}
		for _, v := range weightList[i:] {
			leftSum = leftSum + v
		}

		value := rightSum - leftSum
		if value < 0 {
			value = -value
		}

		if value < min {
			min = value
		}
	}
	return min
}

func main() {
	var n int
	fmt.Scanf("%d", &n)

	var weightList []int
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scanf("%d", &tmp)
		weightList = append(weightList, tmp)
	}

	fmt.Println(calcMin(weightList, n))
}


Measured memory_bytes: 512
import sys
input = sys.stdin.readline
N, H = map(int, input().split())

A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    

max_a = max(A)

B = [b for b in B if b > max_a]
B = sorted(B, reverse=True)

ans = 0
for b in B:
    H -= b
    ans += 1
    if H <= 0:
        break

if H > 0:
    ans += int((H+max_a-0.1)//max_a)

print(ans)
    


Measured memory_bytes: 56668
import sys

f_i = sys.stdin

n, q = map(int, f_i.readline().split())

class DisjointSets:
    def __init__(self, size):
        # negative values are roots(representatives of each tree)
        # positive values represent the parent element
        self.table = [-1 for _ in range(size)]

    def _find(self, x):
        if self.table[x] < 0:
            return x
        else:
            # compression of the path
            self.table[x] = self._find(self.table[x])
            return self.table[x]

    def uniteSets(self, x, y):
        s1 = self._find(x)
        s2 = self._find(y)
        if s1 != s2:
            if self.table[s1] < self.table[s2]: # the smaller has more elements
                self.table[s1] += self.table[s2]
                self.table[s2] = s1
            else:
                self.table[s2] += self.table[s1]
                self.table[s1] = s2

    def isSameSet(self, x, y):
        if self._find(x) == self._find(y):
            print(1)
        else:
            print(0)

S = DisjointSets(n)

for l in f_i:
    com, x, y = map(int, l.split())
    if com == 0:
        S.uniteSets(x, y)
    else:
        S.isSameSet(x, y)

Measured memory_bytes: 8624
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;

int main() {
    string N;
    cin>>N;
    int A=0;

    for(int i=0;i<N.size();i++){
        if(N[i]=='9'){
            A+=9;
        }
        else if(N[i]=='8'){
            A+=8;
        }
         else if(N[i]=='7'){
            A+=7;
        }
         else if(N[i]=='6'){
            A+=6;
        } 
        else if(N[i]=='5'){
            A+=5;
        }
        else if(N[i]=='4'){
            A+=4;
        }
        else if(N[i]=='3'){
            A+=3;
        }
        else if(N[i]=='2'){
            A+=2;
        }
        else if(N[i]=='1'){
            A+=1;
        }
        else if(N[i]=='0'){
            A+=0;
        }
    }
    if(A%9==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3740
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>
using namespace std;

class CMaximumVolume {
 public:
  void solveOne(int caseNumber, std::istream &in, std::ostream &out) {
    int L;
    in >> L;
    double side = L / 3.0;

    double ans = side * side * side;
    out << setprecision(12) << fixed << ans << endl;

  }
  void solve(std::istream &in, std::ostream &out) {
    int nt = 1;
    for (int i = 0; i < nt; ++i)
      solveOne(i + 1, in, out);
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  CMaximumVolume solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	// freopen("settling.in", "r", stdin);
	// freopen("settling.out", "w", stdout);

	int n, k;
	cin >> n >> k;

	vector<int> cnt(n + 1);
	for(int i = 0; i < k; i++){
		int sz;
		cin >> sz;
		while(sz--){
			int x;
			cin >> x;
			cnt[x]++;
		}
	}

	int ans = 0;
	for(int i = 1; i <= n; i++)
		ans += (cnt[i] == 0);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3580
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int i=1;
		while(true){
        	String x=br.readLine();
        	if(x.equals("0")) break;
        	sb.append("Case "+i+": "+x+"\n");
        	if(i%3000==0){
        		System.out.print(sb.toString());
        		sb.setLength(0);
        	}
    		i++;
        }
		System.out.print(sb.toString());
	}
}

Measured memory_bytes: 24972
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;
	public static final long HUGE_NUM = 99999999999999999L;
	public static final double EPS = 0.000000001;

	public static final int SIZE = 21;

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {

			String input_str = br.readLine();

			int offset;

			for(int i = 0; i < input_str.length(); i++){

				offset = input_str.charAt(i)-'A';
				System.out.printf("%c",'A'+((offset-3+26)%26));
			}
			System.out.println();

		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
    }
}


class UTIL{

    //String→intへ変換
    public static int getNUM(String tmp_str){

        return Integer.parseInt(tmp_str);
    }

    //文字が半角数字か判定する関数
    public static boolean isNumber(String tmp_str){

        if(tmp_str == null || tmp_str.length() == 0){

            return false;
        }

        Pattern pattern = Pattern.compile("\\A[0-9]+\\z");
        Matcher matcher = pattern.matcher(tmp_str);
        return matcher.matches();
    }
}


Measured memory_bytes: 27580
#include <iostream>

using namespace std;

int a, d, n;
bool prime[1000005];

int main(void)
{
  prime[1] = true;
  for(int i = 2; i <= 1000000; i++){
    if(prime[i]) continue;
    for(int j = 2*i; j <= 1000000; j+=i){
      prime[j] = true;
    }
  }

  while(1){
    cin >> a >> d >> n;
    if(a == 0 && d == 0 && n == 0) break;

    for(int x = a; ; x += d){
      if(!prime[x]) n--;
      if(n == 0){
        cout << x << endl;
        break;
      }
    }
  }

  return 0;
}



Measured memory_bytes: 3936
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 100005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}



    
void test_case() {

    
  
    int n , m;

    cin>>n>>m;

    int cnt = 0;
    rep(i,m) {
        int x;
        cin>>x;

        cnt+= x;
    }

    if(n-cnt>=0) {
        cout<<n-cnt<<endl;
    } else {
        cout<<-1<<endl;
    }




    

}


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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


    int t = 1;
    // cin >> t;
    while (t--)
    {
        test_case();
    }
}

Measured memory_bytes: 3640
S = int(input())
K = int(input())
f = 0
ans = 10

list = [i for i in str(S)]
 
for i in range(K):
    if int(list[i]) > 1:
        ans = min(ans,int(list[i]))
        f = 1
        break

if f == 0:
    print(1)
else:
    print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
long long int modpow(long long int a, long long int n, long long int p)
{
	long long int res = 1;
	while (n > 0)
	{
		if (n % 2 > 0)
			res = res * a % p;
		a = a * a % p;
		n /= 2;
	}
	return res;
}
int main()
{
	long long int a, b, c, d;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
	long long int p = 998244353;
	long long int dp[2][3003];
	long long int i, j;
	for (i = 0; i < c; i++)
		dp[0][i] = 0;
	dp[0][a - 1] = modpow(b, (c - a), p);
	long long int s;
	for (i = b; i < d; i++)
	{
		s = 0;
		for (j = a - 1; j < c; j++)
		{
			dp[1][j] = (dp[0][j] * (j + 1) % p + s) % p * modpow(modpow(i, c - j - 1, p), p - 2, p) % p * modpow(i + 1, c - j - 1, p) % p;
			s = (s + dp[0][j]) % p;
		}
		for (j = a - 1; j < c; j++)
			dp[0][j] = dp[1][j];
	}
	long long int ans = 0;
	for (i = a - 1; i < c; i++)
		ans = (ans + dp[0][i]) % p;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1756
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    map <string,int>m;
    m["SUN"]=7;
    m["MON"]=6;
    m["TUE"]=5;
    m["WED"]=4;
    m["THU"]=3;
    m["FRI"]=2;
    m["SAT"]=1;
    string s;
    cin >> s;
    cout << m[s] << endl;
    
    return 0;
}

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

using namespace std;
#define ll long long

const int N = 1e5 + 5;
ll INF = 1e9 + 7;


int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string str;
    cin>>str;

    if(str[str.size() -1] == 's')
    {
        str.push_back('e');
    }
    str.push_back('s');
    cout<<str<<endl;
}


Measured memory_bytes: 3660
#include<cmath>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<functional>
#define INF 1e16
#define N (1000000007)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> Q;


ll a[7];
int main(void){
    for(int i=0;i<7;i++)cin>>a[i];
    ll ans=0;
    ll k = min(a[0],min(a[3],a[4]));
    ll cnt=0;
    if(a[0]%2==1)cnt++;
    if(a[3]%2==1)cnt++;
    if(a[4]%2==1)cnt++;
    ans+=a[1];
    if(k%2==0){
      if(cnt==0)ans+=a[0]+a[3]+a[4];
      if(cnt==1)ans+=a[0]+a[3]+a[4]-1;
      if(cnt==2){
        if(k!=0)ans+=a[0]+a[3]+a[4]-1;
        else ans+=a[0]+a[3]+a[4]-2;
      }
      cout<<ans<<endl;
    }
    else{
      if(cnt==3)ans+=a[0]+a[3]+a[4];
      if(cnt==2)ans+=a[0]+a[3]+a[4]-1;
      if(cnt==1)ans+=a[0]+a[3]+a[4]-1;
      cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
int main(void){
  int n;
  scanf("%d",&n);
  n--;
  int a[n];
  FOR(n)scanf("%d",&a[i]);
  int ans=a[0]+a[n-1];
  FOR(n-1)ans+=min(a[i],a[i+1]);
  PRN(ans);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
    int a;
    int b;
    int c;
    int i;
    int count = 0;
    cin >> a >> b >> c ;
    
    for( i = a ; i <= b ; i++){
        if( c % i == 0){
            count++;
            
        }
        
    }
    cout << count << endl;
    return 0;
    
}


Measured memory_bytes: 3112