akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <limits>
#include <random>
#include <chrono>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename T>
void debug(T var, string label){
    cout << label << " = " << var << '\n';
}
typedef long long ll;

ll f(ll cnt, ll x){
    return cnt * x;
}
void solve(ll a, ll b, ll x){
    ll left = 0, right = (b - a + 1 + x - 1) / x;
    a = (a + x - 1) / x;
    a *= x;
    ll ans = 0;
    /* debug(a, "a"); */
    while(left <= right){
        ll mid = left + (right - left) / 2;
        if(a + f(mid, x) <= b){
            left = mid + 1;
            ans = mid;
        }
        else {
            right = mid - 1;
        }
    }
    /* debug(ans, "ans"); */
    /* debug(x, "x"); */
    if(a + ans * x <= b)++ans;
    cout << ans << '\n';

}
int main(int argv, char **argc){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
    ll a, b, x;
    while(cin >> a >> b >> x){
        solve(a, b, x);
        break;
    }
}

Measured memory_bytes: 256
import math

a,b,h,m = map(int,input().split())

m_ang = m*math.pi/30
h_ang = (h*30+m/2)*math.pi/180
ang = m_ang - h_ang
c = math.sqrt(a*a+b*b-2*a*b*math.cos(ang))

print(c)

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

/////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// ここからコピペ /////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////

/////////////////////////
// Range Minimum Query //
/////////////////////////

class RangeMinimumQuery {
private:
	std::vector<long long> container_;
	void constructorHelper(const unsigned int array_size)
	{
		unsigned int length{1};
		while (length < array_size)
			length <<= 1;
		container_.resize(2 * length, (1ll << 31) - 1);
	}
	long long getHelper(const int index, const int node_l, const int node_r, const int query_l, const int query_r) const
	{
		if (query_r <= node_l || node_r <= query_l) return (1ll << 31) - 1;
		if (query_l <= node_l && node_r <= query_r) return container_[index];
		const int node_m{(node_l + node_r) >> 1};
		return std::min(getHelper(2 * index, node_l, node_m, query_l, query_r), getHelper(2 * index + 1, node_m, node_r, query_l, query_r));
	}

public:
	RangeMinimumQuery(const unsigned int array_size) { constructorHelper(array_size); }
	RangeMinimumQuery(const std::vector<long long> &array)
	{
		constructorHelper(array.size());
		std::copy(array.begin(), array.end(), container_.begin() + array.size());
		for (auto i{(container_.size() >> 1) - 1}; i > 0; i--)
			container_[i] = std::min(container_[2 * i], container_[2 * i + 1]);
	}
	// indexは0-indexed
	void update(const int index, const int assigned)
	{
		auto update_place{(container_.size() >> 1) + index};
		container_[update_place] = assigned;
		while (update_place > 1)
		{
			update_place >>= 1;
			container_[update_place] = std::min(container_[2 * update_place], container_[2 * update_place + 1]);
		}
	}
	// left,rightは0-indexed、[left, right)の半開区間
	long long get(const int left, const int right) const
	{
		return getHelper(1, 0, container_.size() >> 1, left, right);
	}
};

/////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// ここまでコピペ /////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A
int main()
{
	int n, q;
	scanf("%d%d", &n, &q);
	RangeMinimumQuery rmq(n);
	for (int i{}; i < q; i++)
	{
		int com, x, y;
		scanf("%d%d%d", &com, &x, &y);
		if (!com) rmq.update(x, y);
		else printf("%lld\n", rmq.get(x, y + 1));
	}
	return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b)
        OP("YES");
    else
        OP("NO");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

struct DATA{
  int id, t, ac, pn;
  DATA(){}
};

bool comp(const DATA& a, const DATA& b){
  if(a.ac != b.ac) return a.ac > b.ac;
  if(a.pn != b.pn) return a.pn < b.pn;
  return a.id < b.id;
}

int main(){
  int n;
  while(1){
    cin >> n;
    if(!n) break;
    map<int, int> team;
    vector<int> ans;
    vector<DATA> data(n,DATA());
    for(int i=0; i<n; ++i){
      cin >> data[i].id >> data[i].t >> data[i].ac >> data[i].pn;
      team.insert(make_pair(data[i].t, 0));
    }
    sort(data.begin(), data.end(), comp);
    for(int i=0; i<data.size() && ans.size()<26; ++i){
      if(ans.size() < 10){
	if(team[data[i].t] < 3){
	  ans.push_back(data[i].id);
	  ++team[data[i].t];
	}
      }else if(ans.size() < 20){
	if(team[data[i].t] < 2){
	  ans.push_back(data[i].id);
	  ++team[data[i].t];
	}
      }else{
	if(team[data[i].t] < 1){
	  ans.push_back(data[i].id);
	  ++team[data[i].t];
	}
      }
    }
    for(int i=0; i<ans.size(); ++i) cout << ans[i] << endl;
  }
  return 0;
}

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

int main()
{
  string s;
  cin>>s;
  if(s.length()==6 && (s[2]==s[3]) && (s[4]==s[5])){
  	cout<<"Yes"<<endl;
  }else{
  	cout<<"No"<<endl;
  }

return 0;
}



Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
#define rep(i,n) for(ll i=0;i<(n);i++)
int main() {
	ll n, m, x, a;
	ll f[1010] = {};
	cin >> n >> m >> x;
	for (int i = 0; i < m; i++) {
		cin >> a;
		f[a] = 1;
	}
	ll cnta =0, cntb = 0;
	for (int i = x; i <= n; i++)cnta += f[i];
	for (int i = x; i >= 0; i--)cntb += f[i];
	cout << min(cnta, cntb) << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
ss = [input() for _ in range(N)]

contained = sum([s.count('AB') for s in ss])
B_hoge = sum([1 for s in ss if s[0]=='B'])
hoge_A = sum([1 for s in ss if s[-1]=='A'])
B_hoge_A = sum([1 for s in ss if s[0]=='B' and s[-1]=='A'])

B_hoge -= B_hoge_A
hoge_A -= B_hoge_A

ans = contained
if B_hoge_A==0:
    ans += min(B_hoge, hoge_A)
elif B_hoge + hoge_A > 0:
    ans += B_hoge_A + min(B_hoge, hoge_A)
else:
    ans += B_hoge_A -1
print(ans)


Measured memory_bytes: 45656
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        

fast();
//ll t;cin>>t;while(t--)
{
  ll n,k,mn=INT_MAX;
  cin>>n>>k;
  ll a[n];
  for(int i=0;i<n;i++)
    {
      cin>>a[i];
    } 
    s()
    //for(auto t:a)cerr<<t<<" ";
    //cerr<<endl; 
  for(int i=0;i<n-k+1;i++)
  {
      ll temp=a[i+k-1]-a[i];
      //cout<<temp<<" ";
      mn=min(temp,mn);
  }
  //cout<<endl;
  cout<<mn<<endl;
}
return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

string s;

int main() {
	cin >> s;
	cout << s.at(0) << s.length() - 2 << s.back() << endl ;
	return 0;
}

Measured memory_bytes: 256
import math

N = int(input())
# A = [int(x) for x in input().split()]


C = [1]
for i in range(math.ceil(math.log(N,9)) + 3):
    if i !=0 :
        C.append(9 ** i)
for i in range(math.ceil(math.log(N,6)) + 3):
    if i != 0:
        C.append(6 ** i)


INF = 10**10
dp = [INF] * (N+1)
dp[0] = 0

for i in range(1,N+1):
    for c in C:
        if i - c >= 0:
            dp[i] = min(dp[i], dp[i - c] + 1)

print(dp[N])



Measured memory_bytes: 3828
let () = Scanf.scanf "%d" @@ fun n ->
  let hs = Array.init n @@ fun _ -> Scanf.scanf " %d" Fun.id in
  let ans = snd @@ Array.fold_left (fun (m, acc) h -> max m h, acc + if h >= m then 1 else 0) (min_int, 0) hs in
  Printf.printf "%d\n" ans 

Measured memory_bytes: 3856
#include<stdio.h>
#define X 100000001
long long a[X];
int main(){
	int n,k,i,j,s=0,max=0;
	while(scanf("%d%d",&n,&k),n!=0 && k!=0){
		for(i=0;i<n;i++)scanf("%d",&a[i]);
		for(i=0;i<n-k+1;i++){
			s=0;
			for(j=i;j<k+i;j++)s+=a[j];
			if(max<s || max==0)max=s;
		}
		printf("%d\n",max);
	}
	return 0;
}



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

using namespace std;
//typedef long long ll;
typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;


int main() {
    vector<int> candies(3);
    rep(i, 3) cin >> candies[i];

    sort(candies.begin(), candies.end());
    if (candies[0] + candies[1] == candies[2]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char line[100];
  int a, b;
  fgets(line, sizeof(line), stdin);
  sscanf(line, "%d %d", &a, &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: 2044
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
char s[SIZE];
int dp[5001][5001];
void ADD(int &x,int v){
    if(v>=MOD)v-=MOD;
    x+=v;
    if(x>=MOD)x-=MOD;
}
LL mypow(LL x,LL y){
    x%=MOD;
    LL res=1%MOD;
    while(y){
        if(y&1)res=res*x%MOD;
        y>>=1;
        x=x*x%MOD;
    }
    return res;
}
int main(){
    DRI(N);
    RS(s);
    int len=LEN(s);
    dp[0][0]=1;
    REP(i,N){
        REP(j,N){
            if(!dp[i][j])continue;
            if(j)ADD(dp[i+1][j-1],dp[i][j]*(1+(j<=len)));
            else ADD(dp[i+1][j],dp[i][j]);
            if(j<len)ADD(dp[i+1][j+1],dp[i][j]);
            else ADD(dp[i+1][j+1],dp[i][j]*2);
        }
    }
    printf("%d\n",dp[N][len]);
    return 0;
}


Measured memory_bytes: 67072
#include<bits/stdc++.h>
using namespace std;
pair<int,long long> q[100000];
int main(){
    int a;
    long long b;
    cin>>a>>b;
    for(int i=0;i<a;i++){
        int c,d;
        cin>>c>>d;
        q[i].first = c;
        q[i].second = d;
    }
    sort(q,q+a);
    for(int i=0;i<a;i++){
        b-=q[i].second;
        if(b<=0) {cout<<q[i].first<<endl; return 0;}
    }

}




Measured memory_bytes: 1792
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  for(int i = 0;i < n;i++)cin >> a[i];

  sort(a.begin(),a.end());

  vector<ll> b;
  vector<ll> c;

  ll lea1;
  ll lea2;
  for(int i = 0;i < n;i++){
    if(n - b.size() == 1){
      lea1 = i % 2 == 0 ? a[n-1-i/2] : a[i/2];
      break;
    }
    if(i % 2 == 0)b.push_back(a[n-1-i/2]);
    else b.push_back(a[i/2]);
  }

  for(int i = 0;i < n;i++){
    if(n - c.size() == 1){
      lea2 = i % 2 == 0 ? a[i/2] : a[n-1-i/2];
      break;
    }
    if(i % 2 == 0)c.push_back(a[i/2]);
    else c.push_back(a[n-1-i/2]);
  }
  
  ll ans1 = max(abs(lea1-b[0]),abs(lea1-b[n-2]));
  for(int i = 0;i < b.size()-1;i++){
    ans1 += abs(b[i]-b[i+1]);
  }

  ll ans2 = max(abs(lea2-c[0]),abs(lea2-c[n-2]));
  for(int i = 0;i < c.size()-1;i++){
    ans2 += abs(c[i]-c[i+1]);
  }

  cout << max(ans1,ans2) << endl;
}

Measured memory_bytes: 3316
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
	int a[5];
	
	for(int i=0; i<5; ++i)
		scanf("%d", &a[i]);
	sort(a, a+5, greater<int>());
	
	for(int i=0; i<5; ++i){
		printf("%d",a[i]);
		if(i<4) printf(" ");
	}
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 1212
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		//?????°??????
		int vertical = sc.nextInt(); //???????????¬??°
		String[][] cross = new String[sc.nextInt()][2]; //?¨?????????¬??°
		String[] ans = new String[vertical];

		//?¨???????????´°???????????????
		for(int count = 0; count < cross.length; count++) { //?¨?????????°????????°?????????
			cross[count] = sc.next().split(",");
		}

		//???????????????
		for(int count = 0; count < vertical; count++) { //???????????¬??°??¶?????°?????????
			String dog = Integer.toString(count + 1);

			for(int con = 0; con < cross.length; con++) { //?¨?????????¬??°??¶?????°?????????
				if(dog.equals(cross[con][0])) { //?¨?????????????????????¨???????????£???????????¨???
					//??\????????????
					dog = cross[con][1];
				} else if(dog.equals(cross[con][1])) { //?¨?????????????????????¨???????????£???????????¨???
					//??\????????????
					dog = cross[con][0];
				}
			}

			int num = Integer.parseInt(dog) - 1;
			ans[num] = Integer.toString(count + 1);
		}

		//??¨?????????
		for(int count = 0; count < ans.length; count++) {
			System.out.println(ans[count]);
		}
	}
}

Measured memory_bytes: 25864
#include <cstdio>
const int N = 21;
int n, m, f[1 << N][N];
int main(){
    scanf("%d%d", &n, &m);
    for(int i = 0;i <= n;++ i)
        for(int j = 0, x;j < (1 << i);++ j){
            for(x = getchar();x != '0' && x != '1';x = getchar());
            f[(1 << i) | j][i] = (x == '1');
        }
    for(int i = n;~i;-- i)
        for(int j = 0;j < (1 << i);++ j)
            for(int k = i;~k;-- k) if(f[(1 << i) | j][k]){
                int t = f[(1 << i) | j][k], S = j >> k, T = j & ((1 << k) - 1);
                if(k) f[(1 << i - k) | S][0] += t;
                if(T){
                    int u = k - 1;
                    while(!((T >> u) & 1)) -- u;
                    f[(1 << i - k + u + 1) | (S << u + 1) | (1 << u) | (T & ((1 << u) - 1))][u] += t;
                }
                if((~T) & ((1 << k) - 1)){
                    int u = k - 1;
                    while((T >> u) & 1) -- u;
                    f[(1 << i - k + 1 + u) | (S << u + 1) | (T & ((1 << u) - 1))][u] += t;
                }
            }
    for(int i = n;~i;-- i)
        for(int j = 0;j < (1 << i);++ j) if(f[(1 << i) | j][0] >= m){
            for(int k = i - 1;~k;-- k) putchar('0' + ((j >> k) & 1));
            return 0;
        }
}

Measured memory_bytes: 172288
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
const ll MOD=100000007;
#define rep(i,a,b) for(ll i=a;i<b;i++)
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}
int main(){
    ll n,k;
    cin>>n>>k;
    cout<<n-k+1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int h,w,k;
int dp[101][8];
int main(){
  cin >> h >> w >> k;
  for(int i=0;i<101;i++) for(int j=0;j<8;j++) dp[i][j] = 0;

  dp[0][0] = 1;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      for(int k=0;k<(1<<w-1);k++){
        bool ok = true;
        for(int l=0;l<w-2;l++){
          if( (k & (1<<l)) && (k & (1<<l+1)) ){
            ok = false;
          }
        }
        if(ok){
          if(j <= w-2 && (1<<j)&k ){
            dp[i+1][j+1] += dp[i][j];
            dp[i+1][j+1] %= mod;
          }
          else if(j >= 1 && (1<<j-1)&k ){
            dp[i+1][j-1] += dp[i][j];
            dp[i+1][j-1] %= mod;
          }
          else{
            dp[i+1][j] += dp[i][j];
            dp[i+1][j] %= mod;
          }

        }
      }
    }
  }
  cout << dp[h][k-1] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using itn = int;
template<class T>
using vec = vector<T>;

#define FOR(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()


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

  int a,b;
  b = s%100;
  a = s/100;
  string ans;

  if(a >= 1 && a <= 12){
    if(b >= 1 && b <= 12){
      ans = "AMBIGUOUS";
    }else{
      ans = "MMYY";
    }
  }else if(b >= 1 && b <= 12){
    ans = "YYMM";
  }else{
    ans = "NA";
  }

  cout <<ans <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, c, s, t;
  in3(a, b, c);
  s = max(a, b);
  t = max(s, c);
  s = 3 * t - a - b - c;
  if(s % 2 == 0)
    t = s / 2;
  else
    t = s / 2 + 2ll;
  out(t);
  memi;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        long a = sc.nextLong();
        long b = sc.nextLong();
        long k = sc.nextLong();
        //        for (long i = 0; i < k; i++) {
        //            if (a >= 1) {
        //                a--;
        //            } else if (b >= 1) {
        //                b--;
        //            } else {
        //                break;
        //            }
        //        }
        if (a <= k) {
            b = a + b - k;
            a = 0;

        } else {
            a = a - k;
        }

        if (b < 0) {
            b = 0;
        }

        System.out.println(a + " " + b);

    }

}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <bitset>
#include <fstream>
using namespace std;
typedef long long ll;

int main()
{
	bitset<31> students;
	for(int i = 0; i < 28; i++){
		int buf;
		cin>>buf;
		students.set(buf);
	}
	for(int i = 1; i <= 30; i++) if(!students[i]) cout<<i<<endl;
}

Measured memory_bytes: 0
N = int(input())
A = list(map(int, input().split()))

is_denied = False
for ai in A:
  if ai % 2 == 0 and (ai % 3 != 0 and ai % 5 != 0):
    is_denied = True
    break

if is_denied:
  print("DENIED")
else:
  print("APPROVED")

Measured memory_bytes: 38384
// B - Varied
#include <bits/stdc++.h>
using namespace std;

int main(){
	string s; cin>>s;
	vector<int> c(26);
	for(int i=0; i<s.size(); ++i){
		if(c[s[i]-'a'] == 0) c[s[i]-'a']++;
		else{
			puts("no");
			return 0;
		}
	}
	puts("yes");
}

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

int main() {
    string s;
    cin >> s;
    int count;
    for (int i=0;i<s.length();i++){
      if (s[i] == 'o') count += 1;
    }
    //cout << count << endl;
    if (count + 15 - s.length() >= 8) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main () {
  int n,i,count=0;
  string s, s1, s2;
  cin >> s;
  cin >> n;
  for(i=0;i<n;i++)
    {
      cin >> s1;
      s2 = s1 + s1;
      if(s2.find(s)!= std::string::npos) count++;
    }
  printf("%d\n",count);
}

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

long long N, M, a[100009][3], maxn = -(1LL << 60);

int main() {
	cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < 3; j++) cin >> a[i][j];
	}
	for (int i = 0; i < 8; i++) {
		vector<long long>vec;
		for (int j = 1; j <= N; j++) {
			long long S = 0;
			for (int k = 0; k < 3; k++) { if ((i / (1 << k)) % 2 == 0) S += a[j][k]; else S -= a[j][k]; }
			vec.push_back(S);
		}
		sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end());
		long long ans = 0;
		for (int j = 0; j < M; j++) ans += vec[j];
		maxn = max(maxn, ans);
	}
	cout << maxn << endl;
	return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
#include <cctype>
#include <iterator>
////////////////////////////////////////////////
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
std::vector<int> sieve(int n) {
  std::vector<int> res(n);
  std::iota(res.begin(), res.end(), 0);
  for (int i = 2; i * i < n; ++i) {
    if (res[i] < i) continue;
    for (int j = i * i; j < n; j += i)
      if (res[j] == j) res[j] = i;
  }
  return res;
}
ll fac(int n, const std::vector<int>& min_factor) {
  // min_factor は sieve() で得られたものとする
  map<int, int> res;
  while (n > 1) {
    res[min_factor[n]]++;
    n /= min_factor[n];
    // 割った後の値についても素因数を知っているので順次求まる
  }
  ll r = 1LL;
  REPvec(itr, res) { r *= (itr->second + 1LL); }
  return r;
}
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n;
  cin >> n;
  int a = 1e7 + 1;
  vector<int> s = sieve(a);
  // REP(i, 12) cout << s[i] << endl;
  ll ans = 0;
  REP(i, n + 1LL) {
    if (i == 0) continue;
    ans += (ll)i * fac(i, s);
  }
  cout << ans << endl;
}


Measured memory_bytes: 42256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}


//↑template↑


int main() {




	int a, b;
	cin >> a >> b;
	cout << max({ a + b,a - b,a * b }) << endl;











}

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

const int maxn = 0;
int n , a[100009];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(NULL);
	cin >> n;
	for(int i=0;i<n;i++) cin >> a[i];
	int ans = 0;
	for(int i=0;i<n;i++)
	{
		if(a[i] == i + 1)
		{
			swap(a[i] , a[(i + 1) % n]);
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
def examA():
    N = SI()
    ans = 0
    for i in N:
        ans += int(i)
    if ans==1:
        ans = 10
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = 10**18

if __name__ == '__main__':
    examA()


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

int main() {
  string s;
  cin >> s;
  vector<char> a(s.size());
  for(int i=0; i<s.size(); i++) a[i] = s[i];
  
  int max = 0;
  int count = 0;
  for(int i=0; i<s.size(); i++) {
    if(a[i]=='A' || a[i] == 'T' || a[i] == 'C' || a[i] == 'G') 
      if(i != s.size()-1) count++;
      else {
        count++;
        if(max < count) max = count;
      }
    else if(max < count) {
      max = count;
      count = 0;
    } 
    else count = 0;
  }
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    ll n;cin>>n;
    ll a[n];
    ll ans[n+1];rep(i,1,n)ans[i]=0;
    rep(i,0,n-2){
        cin>>a[i];
        ans[a[i]]++;
    }
    rep(i,1,n){
        cout<<ans[i]<<endl;
    }
    
}



Measured memory_bytes: 6788
import copy
H,W,K = list(map(int, input().split()))
C = list(list(input()) for _ in range(H))
ans = 0
for i in range(2 ** H):
  tmp = copy.deepcopy(C)
  for j in range(H):
    if ((i >> j) & 1):
      pass
    else:
      tmp[j] = list("." * W)
  for k in range(2 ** W):
    tmp2 = copy.deepcopy(tmp)
    for l in range(W):
      if ((k >> l) & 1):   
        pass   
      else:
        for h in range(H):
          tmp2[h][l] = "."
    result = 0
    for m in range(H):
      result += tmp2[m].count("#")
    if result == K:
      ans += 1
print(ans)

Measured memory_bytes: 9308
import java.util.Scanner;
class Main {
	public static void main(String[] args){
		Scanner cin = new Scanner(System.in);
		double r = cin.nextDouble();
		
		System.out.printf("%.6f %.6f\n", cal_area(r), cal_cirum(r));
	}
	
	private static double cal_area(double r){
		double pi = Math.PI;
		return (r * r * pi);
	}
	
	private static double cal_cirum(double r){
		double pi = Math.PI;
		return (2 * r * pi);
	}
}

Measured memory_bytes: 28288
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  map<string, int> mp;

  int n; cin >> n;
  rep(i, n) {
    string s; cin >> s;
    if (mp.find(s) == mp.end()) {
      mp.insert(make_pair(s, 1));
    } else {
      mp[s]++;
    }
  }

  int m; cin >> m;
  rep(i, m) {
    string s; cin >> s;
    if (mp.find(s) == mp.end()) {
      mp.insert(make_pair(s, -1));
    } else {
      mp[s]--;
    }
  }

  int ans = 0;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    // debug2(it->first, it->second);
    ans = max(ans, it->second);
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


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

int main(){
	int a,b,c;
	int ans;
	bool flg;
	int cnt=0;
	
	while(cin>>a>>b){
		cnt++;flg=false;
		//-----test-----
		if(cnt==120) break;
		//--------------
		c=a+b;
		ans=1;
		while(10<=c){
			c/=10;
			ans++;
		}
		cout<<ans<<endl;
	}
	
	return 0;
}

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

int main()
{
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> c(h);
    rep(i, 0, h) cin >> c[i];
    int ans = 0;
    rep(si, 0, 1<<h) rep(sj, 0, 1<<w){
        int cnt = 0;
        rep(i, 0, h) rep(j, 0, w){
            if(si>>i&1 && sj>>j&1){
                if(c[i][j] == '#') cnt++;
            }
        }
        if(cnt == k) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;
public class Main {
	 public static void main(String[] args) {
		 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 c;
			 c=values[a];
			 values[a]=values[b];
			 values[b]=c;
			 }
		 for(int i=0;i<values.length;i++){
			 System.out.printf("%d\n",values[i]);
		 }
	 }
}

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

const int N=2e5+10;
struct edge{
	int to,next;
}e[N*2];
int n,ans,tot,first[N],a[N],m;
void add(int u,int v){
	e[++tot].next=first[u],first[u]=tot;
	e[tot].to=v;
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1,u,v;i<=m;i++){
		scanf("%d%d",&u,&v);
		add(u,v);add(v,u);
	}
	for(int k=1;k<=n;k++){
		int flag=1;
		for(int i=first[k];i;i=e[i].next){
			int u=e[i].to;
			if(a[u]>=a[k])flag=0;
		}
		ans+=flag;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 6004
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()

using namespace std;

int main(){

    int n;
    double t,a;
    cin >> n;
    cin >> t >> a;

    double near = DBL_MAX;
    int ans;


    rep(i,n){
        double h;
        cin >> h;

        if(near > abs(a - (t - 0.006 * h))){
            near = abs(a - (t - 0.006 * h));
            ans = i + 1;
        }
    }

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


Measured memory_bytes: 256
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
a, b, k = map(int, input().split())
n = gcd(a, b)
div_list = []
for i in range(1, n+1):
    if n%i == 0:
        div_list.append(i)
print(div_list[-k])

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

int main() {
    string S, T, U;
    int A, B;
    cin >> S >> T >> A >> B >> U;

    if (U == S) A--;
    else if (U == T) B--;

    cout << A << ' ' << B << endl;
    return 0;
}


Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
 
using namespace std;
 
#define int long long
//typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int gcd(int a,int b){
	while(a && b){
		if(a < b) b %= a;
		else a %= b;
	}
	return max(a,b);
}

signed main(){
	int n,k,a[100000],g,ma = 0;
	cin >> n >> k;
	for(int i = 0;i < n;i++) {
		cin >> a[i];
		if(!i) g = a[i];
		else g = gcd(g,a[i]);
		ma = max(a[i],ma);
	}
	if(ma < k || (g >= 2 && k % g)){
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	else cout << "POSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 1024
use std::io::*;
use std::io;
use std::str::FromStr;
fn read(s: &mut StdinLock) -> u32 {
    s.by_ref()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .fold(0, |a, x| (x as u8 - b'0') as u32 + a * 10)
}

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();

    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    let n = it.next().unwrap();

    let mut next = 1;
    let mut ans = next;
    while next <= n {
        ans = next;
        next *= 2;
    }
    println!("{}", ans);

}


Measured memory_bytes: 4352
//
//  sublime text 3,
//  emre yazicioglu
//

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
#define pb push_back
#define fi first
#define se second
#define INF (ll) (1e18 + 7)
#define MOD (ll) (1e9 + 7)

const int N = 5e3 + 7;
ll mn = INF, mx = -INF;
ll n, m, k, s, q, t;
ll a, b, c, d, e;
ll ans, cur, sum, cnt;
ll ar[N], p[N], dp[N][N];
string str; bool h[N];
pll pp[N]; vll v;

ll f(ll cur, ll mask) {
  if(cur == m + 1)
    return (mask == (1 << n) - 1 ? 0 : INF);
  ll &r = dp[cur][mask];
  if(~r) return r;
  r = INF;
  r = min(r, f(cur + 1, mask));
  r = min(r, f(cur + 1, mask | ar[cur]) + p[cur]);
  return r;
}

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

  // freopen("../in.txt","r",stdin);
  // freopen("../out.txt","w",stdout);

  memset(dp, -1, sizeof dp);
  cin >> n >> m;
  for(int i = 1; i <= m; i++) {
    cin >> p[i] >> a;
    for(int j = 1; j <= a; j++) {
      cin >> k;
      ar[i] |= (1 << (k - 1));
    }
  }
  ans = f(1, 0);
  if(ans >= INF)
    ans = -1;
  cout << ans;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  ll x;
  cin>>x;
  cout<<(x/500)*1000 + (x%500)/5*5<<endl;
  return 0;
}

Measured memory_bytes: 256
def solve(n,a):
    m = max(a)
    dp = [False]*(m+1)
    dup = []
    for ai in a:
        if dp[ai]:
            dup.append(ai)
        dp[ai] = True
    for ai in a:
        for i in range(2,m//ai+1):
            dp[ai*i] = False
    for ai in dup:
        dp[ai] = False
    return dp.count(True)




if __name__ == '__main__':
    n = int(input())
    a = list(map(int,input().split()))
    print(solve(n,a))

Measured memory_bytes: 109696
### main

n = gets.to_i

n.times do
  ns = []
  while ns.length < 9
    ns += gets.split.map{|s| s.hex}
  end

  cs = ns.pop
  #p [ns, cs]

  key = 0
  bmask = 1
  b = 1

  for i in (0..31)
    key0 = key
    key1 = key | b

    for k in [key0, key1]
      csk = (cs ^ k) & bmask
      sum = ns.map{|ni| ni ^ k}.inject(:+) & bmask
      if sum == csk
        key = k
        break
      end
    end

    bmask = ((bmask << 1) | 1)
    b <<= 1
  end

  puts "%x" % key
end

Measured memory_bytes: 6132
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, T;
  cin >> N >> T;
  int A[N];
  set<int> B;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    B.insert(A[i]);
  }
  map<int,int> C;
  for (int i = 0; i < N; i++) {
    C[*B.rbegin()-A[i]]++;
    B.erase(A[i]);
  }
  cout << C.rbegin()->second;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define endl "\n"
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	double n;
	cin>>n;
	double res= 2*acos(-1)*n;
	cout<<res;
}



Measured memory_bytes: 3792
#include <bits/stdc++.h>
 
#define pii pair<int, int>
#define endl "\n"
#define int long long
#define F first
#define S second
#define B begin
#define E end
#define RB rbegin
#define RE rend
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
const int INF = 1e9 + 1;
const double EPS = 1e-10;
const ll P = 1e9 + 7;
const int Q = 47;
 
using namespace std;
 
void hello()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
 
void show(vector<int>& arr)
{
    for (auto i : arr)
        cout << i << " ";
    cout << endl;
}
void show(vector<vector<int>>& arr)
{
    for (auto i : arr)
        show(i);
    cout << endl;
}


signed main()
{
    hello();
    
    int n, k;
    cin >> n >> k;
    vector <int> seq(n);
    for (int i = 0; i < n; ++i)
        cin >> seq[i];
    sort(seq.B(), seq.E());

    int v1 = 0, v2 = 0;
    for (int i = 0; i < n; ++i)
    {
        if (seq[i] < 0)
            ++v1;
        else if (seq[i] == 0)
            ++v2;
    }

    --k;
    bool flag = 0;
    if (k >= v1 * (n - v1 - v2))
    {
        k -= v1 * (n - v1 - v2);
        flag = 1;
    }
    if (k < v2 * (n - v2) + v2 * (v2 - 1) / 2 && flag)
    {
        cout << 0 << endl;
        return 0;
    }
    else if (flag)
    {
        k -= v2 * (n - v2) + v2 * (v2 - 1) / 2;
    }


    vector <int> a, b;
    for (int i = 0; i < n; ++i)
        if (seq[i] < 0)
            a.push_back(seq[i]);
        else if (seq[i] > 0)
            b.push_back(seq[i]);

    sort(a.B(), a.E());
    sort(b.B(), b.E());


    if (!flag)
    {
        int l = -1e18 - 1, r = 0;
        while (r - l > 1)
        {
            int m = (l + r) / 2;
            int cnt = 0;
            for (int i = 0; i < a.size(); ++i)
            {
                cnt += b.E() - upper_bound(b.B(), b.E(), m / a[i]);
            }
            // cout << cnt << " " << m << endl;
            if (cnt <= k)
                l = m;
            else
                r = m;
        }

        cout << l << endl;
    }
    else
    {
        reverse(a.B(), a.E());
        for (auto& i : a)
            i = -i;

        // show(a); show(b);
        int l = 0, r = 1e18 + 1;

        while (r - l > 1)
        {
            int m = (l + r) / 2;
            int cnt = 0;
            for (int i = 0; i < a.size(); ++i)
            {
                cnt += max(0ll, upper_bound(a.B(), a.E(), m / a[i]) - a.B() - i - 1);
            }
            for (int i = 0; i < b.size(); ++i)
            {
                cnt += max(0ll, upper_bound(b.B(), b.E(), m / b[i]) - b.B() - i - 1);
            }
            if (cnt <= k)
                l = m;
            else
                r = m;
        }

        cout << r << endl;

    }
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


typedef pair<int, int> p;

int main(){
  int n, m;
  scanf("%d %d", &n, &m);

  vector<vector<int> > v(n + 1);
  REP (i, n + 1) v[i].resize(n + 1, 0);

  vector<p> nodes(m);
  REP (i, m) {
    int a, b;
    scanf("%d %d", &a, &b);
    nodes[i] = make_pair(a, b);
    v[a][b] = 1;
    v[b][a] = 1;
  }

  int ans = 0;
  REP (i, m) {
    int x = nodes[i].first;
    int y = nodes[i].second;

    v[x][y] = 0;
    v[y][x] = 0;

    bool done[n + 1] = {false};
    done[0] = true;
    queue<int> q;
    q.push(1);
    done[1] = true;
    while(q.size()) {
      int now = q.front();
      q.pop();
      FOR (j, 1, n + 1) {
        if (v[now][j] == 1 && done[j] == false) {
          q.push(j);
          done[j] = true;
        }
      }
    }

    bool is_bridge = false;
    FOR (i, 1, n + 1) {
      if (!done[i]) is_bridge = true;
    }

    if (is_bridge) ans++;

    v[x][y] = 1;
    v[y][x] = 1;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
   
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
		int a = in.readInt();
		int b = in.readInt();
		int k = in.readInt();
		for(int i = a; i<= Math.min(b,a+k-1); i++) {
			System.out.println(i);
		}
		for(int i = Math.max(b-(k-1), a+k); i<= b; i++) {
			System.out.println(i);
		}
	}
}
class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 21972
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        private static long mod = 1000000007;
        static void Main(string[] args)
        {
            //var n = int.Parse(ReadLine());
            //var line = ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();
            var s = ReadLine();
            var t = ReadLine();

            var min = int.MaxValue;
            for(var i = 0; i < s.Length - t.Length + 1; i++)
            {
                var count = 0;
                for(var j = 0; j < t.Length; j++)
                {
                    if(s[i + j] != t[j])
                    {
                        count++;
                    }
                }
                min = Min(min, count);
            }

            WriteLine(min);
        }
    }
}

Measured memory_bytes: 25972