akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1000000007;

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>>  var(n, vector<int>(m, 0))
#define vecb2(var, n, m)   vector<vector<bool>> var(n, vector<bool>(m, false))
#define vecll2(var, n, m)  vector<vector<ll>>   var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

int main(void) {
  string s;
  cin >> s;
  vecb isfound(26, false);
  rep(i,s.size()){
    isfound[s[i]-'a']=true;
  }
  rep(i,26){
    if(!isfound[i]){
      char x = 'a' + i;
      prt(x);
      return 0;
    }
  }
  prt("None");
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define RFOR(i,a,b) for(ll i=b-1;i>=a;i--)
#define rsort(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;
ll mod=1000000007;

deque<ll>deq;
ll q,p,d;
signed main(){
    ll n;
    cin>>n;
    rep(i,n) {
    cin>>q;
    if(q==0){
        cin>>d>>p;
        d==0?deq.push_front(p):deq.push_back(p);
    }else if(q==1){
        cin>>p;
        cout<<deq.at(p)<<endl;
    }else{
        cin>>d;
        d==0?deq.pop_front():deq.pop_back();
    }
    }
}


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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	int MAX = 0, idx = 0;
	rep(i, 0, n){
		cin >> a[i];
		if(abs(a[i]) > MAX){
			MAX = abs(a[i]);
			idx = i;
		}
	}
	vector<P> ans;
	rep(i, 0, n){
		ans.push_back({idx + 1, i + 1});
	}
	if(a[idx] >= 0){
		rep(i, 0, n - 1){
			ans.push_back({i + 1, i + 2});
		}
	}else{
		for(int i = n - 1; i >= 1; i--){
			ans.push_back({i + 1, i});
		}
	}
	cout << ans.size() << endl;
	for(int ii = 0; ii < ans.size(); ii++){
		cout << ans[ii].first << " " << ans[ii].second << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

ll f(ll N){
    if(N == 1){
        return 1;
    }
    return (2 * f(ll(N/2)) + 1);
}

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

    ll H;
    cin >> H;

    cout << f(H) << endl;


}

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

int main() {
   char c;
   cin >> c;
   if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" << endl;
   else cout << "consonant" << endl;
}

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

ll MOD = 1000000007;
ll total(ll n, ll r) {
    return ((r-n+1) * (n + r)) / 2; 
}

int main (void){
    
    int N, K;
    cin >> N >> K;
    
    ll ans = 0;
    for (int i = K; i <= N+1; i++) {
        ll min = total(0, i-1)%MOD;
        ll max = total(N-i+1, N)%MOD;
        ans += (max - min + 1)%MOD;
        if (ans < 0) ans += MOD;
    }
    
    cout << (ans)%MOD << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
    int s, w;
    cin >> s >> w;
    
    if (w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3636
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(in i=(in)(a);i<(in)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const in inf=1e9+7;
using P=pair<in,in>;
vector<in> dx={0,1,-1,0};
vector<in> dy={1,0,0,-1};
const in mod=998244353;


//a^n (mod)
in modpow(in a, in n, in mod) {
    in res = 1ll;
    while (n > 0ll) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in n,s;
    cin>>n>>s;
    vector<in> a(n);
        rep(i,n) cin>>a.at(i);
    vector<vector<in>> dp(n+1,vector<in>(s+1,0));
    dp[0][0]=1;
    rep(i,n){
        rep(j,s+1){
            if(dp[i][j]==0) continue;
            dp[i+1][j]+=dp[i][j]*2;
            dp[i+1][j] %=mod;
            if(j+a[i]>=s+1) continue;
            dp[i+1][j+a[i]]+=dp[i][j];
            dp[i+1][j+a[i]] %=mod;
        }
    }
    cout<<dp[n][s]<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 73684
#include <bits/stdc++.h>
using namespace std;
#define endl    "\n"
#define int		long long
#define mp		make_pair
#define pb		push_back
#define fi		first
#define se 		second
#define sz(x)	((int)(x).size())
#define dbg(x) cerr<<#x<<" :: "<<x<<endl;
#define dbg2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
const int INF = 1e9;
const int MOD = 1e9 + 7; 
const double pi = acos(-1);

void solve (){
	char c; cin>>c;
	if(c >= 'a') cout<<'a'<<endl;
	else cout<<'A'<<endl;
}

int32_t main(){
	ios::sync_with_stdio(false); cin.tie(0);
	solve();
	return 0;
}
//g++ -std=c++17 -Wshadow -Wall -o "%e" "%f" -g -D_GLIBCXX_DEBUG

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


using lli = long long int;
template <class T> using Vec = std::vector<T>;
template <class T> using Wec = std::vector<Vec<T>>;


int main(void){
    int n; scanf("%d", &n); lli k = 0;
    std::map<lli, lli> count; count[0]++;
    for(int i = 0; i < n; ++i){
        int a; scanf("%d", &a); k += a;
        count[k]++;
    }
    lli res = 0;
    for(std::pair<lli, lli> ele : count) res += (ele.second-1) * ele.second / 2;
    printf("%lld\n", res);

    return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,h; cin >> n >> h;
    vector<int> a(n), b(n);
    int amax = 0;
    REP(i,n) {
        cin >> a[i] >> b[i];
        chmax(amax,a[i]);
    }
    sort(ALL(b),greater<int>());
    ll ans = 0, idx = 0;
    while(h>0 && b[idx]>=amax) {
        h -= b[idx];
        ++ ans;
        ++ idx;
    }
    if(h>0) ans += h/amax + (h%amax ? 1 : 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
local unpack = table.unpack or unpack
local INF = math.floor(10^10)
local N, M, P = io.read("*n", "*n", "*n")
local edges = {}
for i=1,M do
    local a, b, c = io.read("*n", "*n", "*n")
    edges[i] = {a, b, -1 * (c - P)}
end


-- Bellman-Ford
local function bf()
    -- distance from 1
    local d = {}
    for i=1,N do
        d[i] = INF
    end
    d[1] = 0
    for i=1,N-1 do
        for j=1,M do
            local a, b, w = unpack(edges[j])
            if d[a] ~= INF then
                local new_d = d[a] + w
                if new_d < d[b] then
                    d[b] = new_d
                end
            end
        end
    end
    for i=1,N do
        for j=1,M do
            local a, b, w = unpack(edges[j])
            if d[a] ~= INF then
                if d[a] + w < d[b] or d[a] == -INF then
                    d[b] = -INF
                end
            end
        end
    end
    return d
end

local d = bf()
local negloop = d[N] == -INF
if negloop then
    print(-1)
else
    print(math.max(-d[N],0))
end

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>

int main()
{
    int n;
    std::cin >> n;
    std::vector<int> vs(n);
    for (auto i = 0; i < n; ++i)
    {
        int num;
        std::cin >> num;
        vs[i] = num;
    }
    std::cin >> n;
    std::vector<int> vt(n);
    for (auto i = 0; i < n; ++i)
    {
        int num;
        std::cin >> num;
        vt[i] = num;
    }
    std::sort(vt.begin(), vt.end());
    std::vector<int> common;
    std::set_intersection(vs.begin(), vs.end(), vt.begin(), vt.end(), std::back_inserter(common));
    std::cout << common.size() << std::endl;
    return 0;
}



Measured memory_bytes: 3312
n = int(input())

standard = {}
for i in range(n):
    s = list(input())
    s.sort()
    s = str(s)
    
    if s in standard:
        standard[s] += 1
    else:
        standard[s] = 1

ans = 0
for n in standard.values():
    ans += n * (n - 1) // 2

print(ans)

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

using namespace std;

int main() {
  long long n;
  cin >> n;
  long long cur = 1, cnt = 0, len = 0;
  while (len < n) {
    ++cnt;
    cur *= 26;
    len += cur;
  }
  len -= cur;
  n -= len + 1;
  cur = 1;
  for (int i = 0; i < cnt; i++) {
    cur *= 26;
  }
  for (int i = 0; i < cnt; i++) {
    cur /= 26;
    int c = n / cur;
    n -= n / cur * cur;
    cout << char(c + 'a');
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 3644
import collections
N=int(input())
A=[int(x) for x in input().split()]
AA=sorted(A)
c=collections.Counter(A)
third=N//3
ans="No"
if all(a==0 for a in A):
  ans="Yes"
elif len(c)==2 and N%3==0:
  if all(a==0 for a in AA[:third]):
    ans="Yes"     
elif len(c)==3 and N%3==0:
  if A.count(AA[0])==third and \
  A.count(AA[third])==third and \
  A.count(AA[2*third])==third:
    if AA[0]^AA[third]==AA[2*third] and \
    AA[third]^AA[2*third]==AA[0] and \
    AA[2*third]^AA[0]==AA[third]:
      ans="Yes"   
print(ans)


Measured memory_bytes: 14460
// Problem : A - Iroha and Haiku (ABC Edition)
// Contest : AtCoder - AtCoder Beginner Contest 042
// URL : https://atcoder.jp/contests/abc042/tasks/abc042_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
const long long int  modu=1e9+7;
#define endl '\n'
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define inp(x)  for(auto &t:x) cin>>t;
#define itr     vector<int>::iterator
#define debug(a) cout << #a << "=" << a << ' '<<endl;
#define out(x)  for(auto &t:x) cout<<t<<" "; cout<<endl;
#define ff first
#define ss second
#define pb push_back
#define initialize(a,v)  for(int i=0;i<a.size();++i) a[i]=v;
#define all(x) x.begin(),x.end()
#define mpt(mp) for(auto it=mp.begin();it!=mp.end();it++)
#define trav(x) for(int i=0;i<(int)x.size();++i)
#define mkp(a,b) make_pair(a,b)
#define sz(x)  (int)x.size()

int noofdig(int N)
{
	return floor(log10(N))+1;
}


ll f(ll a)
{

return 0;

}



void pre()
{

}



void solve()
{
	vi a(3);
	inp(a)
	int c5=count(all(a),5);
	int c7=count(all(a),7);
	
	if(c5==2 and c7==1)
	{
		cout<<"YES"<<endl;
		return;
	}
	
	cout<<"NO"<<endl;
	
	






}



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

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


Measured memory_bytes: 3572
#include <iostream>
#include <iomanip>
#include <string>
#include <unordered_map>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  string s, s_rev, s_span;
  cin >> s;
  s_rev = s;

  reverse(s_rev.begin(), s_rev.end());
  if (s == s_rev)
  {
    s_span = s.substr(0, (s.length() - 1) / 2);
    s_rev = s_span;
    reverse(s_rev.begin(), s_rev.end());
    if (s_span == s_rev)
    {
      s_span = s.substr((s.length() + 3) / 2 - 1, s.length() - ((s.length() + 3) / 2 - 1));
      s_rev = s_span;
      reverse(s_rev.begin(), s_rev.end());
      if (s_span == s_rev)
      {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
  return 0;
}


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

int main()
{
  int a,b,c;
  string ans="NO";
  cin >> a >> b >> c;
  if(a==5 && b==5 && c==7){
    ans = "YES";
  }else if(a==5 && b==7 && c==5){
    ans = "YES";
  }else if(a==7 && b==5 && c==5){
    ans = "YES";
  }
  cout<< ans <<endl;
}


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

int min(int x, int y) {
	return x < y ? x : y;
}

int main() {
	int n, m;
	int c[10][10];
	scanf("%d %d", &n, &m);
	for (int i = 0; i < 10; i++)
		for (int j = 0; j < 10; j++)
			scanf("%d", &c[i][j]);
	for (int k = 0; k < 10; k++)
		for (int i = 0; i < 10; i++)
			for (int j = 0; j < 10; j++)
				c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
	int ans = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++) {
			int x;
			scanf("%d", &x);
			if (~x)
				ans += c[x][1];
		}
	printf("%d", ans);
	return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b;
  c = a + b;
  if (c % 2 == 0) {
    cout << c / 2 << endl;
  } else {
    cout << (c + 1) / 2 << endl;
  }
}




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

int main() {
  int64_t a;
  double b;
  scanf("%lld %lf", &a, &b);
  __int128 aa = a;
  __int128 bb = round(b * 100);
  printf("%lld\n", int64_t((aa * bb) / 100));
}


Measured memory_bytes: 3860
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    string S,T;
    cin >> S >> T;
    map<char, int> A;
    map<char, int> B;
    rep(i, S.size()) A[S[i]]++;
    rep(i, T.size()) B[T[i]]++;
    if (A.size() != B.size()) {
        cout << "No" << endl;
        return 0;
    }

    map<int, int> C;
    map<int, int> D;
    for (auto x : A) {
        C[x.second]++;
    }
    for (auto x : B) {
        D[x.second]++;
    }
    for (auto x : C) {
        if (C[x.first] != D[x.first]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 776
#include<stdio.h>

int main(void){
	int i;
	int x[10000]={1};
	int y=0;

	for(i=0;i<10001;i++){
		
			scanf("%d",&x[i]);
		if(x[i]==0){
		i=10001;
		}
		y++;
		
		
}
	for(i=0;i<(y-1);i++){
		printf("Case %d: %d\n",(i+1),x[i]);
	}
	
return 0;
}




Measured memory_bytes: 2028
#include<stdio.h>
#include <sysexits.h>
#include<stdlib.h>
#include<math.h>

int main(void){
  int ans,N,i;
  long H;
  int a[100000]={};
  //printf("error");
  if(scanf("%ld %d",&H,&N)>2){
    exit(0);
  }
  for(i=0;i<N;i++){
   if(scanf("%ld",&a[i])>1){
    exit(0);
   }
  }
  ans=0;

  for(i=0;i<N;i++){
    ans+=a[i];
  }
  if(ans>=H){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <map>

int main()
{
    int N;
    std::cin >> N;
    std::map<std::string, int> points;
    for(int i=0; i<N; i++)
    {
        std::string tmp;
        std::cin >> tmp;
        points[tmp]++;
    }

    std::cout << "AC x " << points["AC"] << "\n";
    std::cout << "WA x " << points["WA"] << "\n";
    std::cout << "TLE x " << points["TLE"] << "\n";
    std::cout << "RE x " << points["RE"] << "\n";
    
    return 0;
}

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

int main() {
	int n; cin >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++) cin >> a[i];

	int q; cin >> q;

	for (int i = 0; i < q; i++) {
		int b,e;
		cin >> b >> e;
		reverse(a.begin()+b,a.begin()+e);
	}

	for (int i = 0; i < a.size(); i++) {
		if(i!=0) cout <<" ";
		cout << a[i];
	}
	cout << endl;
}
	



Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  	cin>>n;
  	vector<char>arr(n);
  	for(int i = 0; i < n; i++){
    	cin>>arr[i];
    }
  	if(n%2)cout<<"No \n";
  	else{
    	bool can = 1;
      	for(int i = 0; i < n/2; i++){
        	if(arr[i]!= arr[n/2+i]){
            	can = 0;
              	break;
            }
        }
      	if(can)cout<<"Yes \n";
      	else cout<<"No \n";
    }
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <list>
#include <map> //連想配列
#include <queue>
#include <set> //
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector> //動的配列

using namespace std;

int main() {
  int N;
  vector<int> a;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int j;
    cin >> j;
    a.push_back(j);
  }
  int flag = 1;
  for (int i = 0; i < N; i++) {
    flag = a[flag - 1];
    if (flag == 2) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 892
import math
import itertools


def main():
    N = int(input())
    P = tuple([int(s) for s in input().split()])
    Q = tuple([int(s) for s in input().split()])

    permutations = list(itertools.permutations([i for i in range(1, N+1)]))

    a = 0
    b = 0

    for i in range(len(permutations)):

        if permutations[i] == P:
            a = i

        if permutations[i] == Q:
            b = i
    print(abs(a-b))


if __name__ == '__main__':
    main()


Measured memory_bytes: 8052
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
//    String a;
    int cnt=0,ans,a,b;
    a = Integer.parseInt(sc.next());
    b = Integer.parseInt(sc.next());
    
    ans = 1;
    while(true){
	  if(ans >= b) break;    
	  ans += a-1;
      //System.out.println(ans);
      cnt++;
    }
    System.out.println(cnt);
  }
}

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

int main(void){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<long long> dp(n,INT_MAX);
    dp[0] = 0;
    for(int i = 1; i < n; i++){
        dp[i] = dp[i - 1] + abs(a[i] - a[i - 1]);
        if(i >= 2)
            dp[i] = min(dp[i],dp[i - 2] + abs(a[i] - a[i - 2]));
    }
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int D;
  cin >> D;
  vector<int> c(26);
  for (int &x : c) cin >> x;
  vector<vector<int>> s(D, vector<int>(26));
  for (auto &x : s) {
    for (int &y : x) cin >> y;
  }
  
  vector<vector<int>> last(D, vector<int>(26, -1));
  for (int d = 0; d < D; ++d) {
    if (d > 0) {
      for (int i = 0; i < 26; ++i) last.at(d).at(i) = last.at(d-1).at(i);
    }
    int max_vi = -2000000000, max_i = 0, vi;
    for (int i = 0; i < 26; ++i) {
      vi = s.at(d).at(i);
      for (int j = 0; j < 26; ++j) {
        if (j == i) continue;
        vi -= c.at(j) * (d - last.at(d).at(j));
      }
      if (vi > max_vi) {
        max_vi = vi;
        max_i = i;
      }
    }
    cout << max_i + 1 << endl;
    last.at(d).at(max_i) = d;
  }
  return 0;
}


Measured memory_bytes: 3756
n,m=map(int,input().split())

d=list()
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    d.append(i)
    if i!=m//i:
      d.append(m//i)

c=1
for i in range(len(d)):
  if m//d[i]>=n:
    c=max(d[i],c)

print(c)


Measured memory_bytes: 3060
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
#include<algorithm>
using namespace std;

typedef pair<int,int> P1;
typedef pair<P1,int> P2;

int g[1500][80];

int main(){
  int n,m;
  int k[150],x[150][10],d[150][10];

  while(scanf("%d %d",&n,&m) && (n||m)){
    vector<P1> normal[1500];
    vector<P1> skip[1500];
    vector<int> id[150];
    int num = 0;

    for(int i=0;i<n;i++){
      scanf("%d",&k[i]);
      for(int j=0;j<k[i];j++){
	scanf("%d %d",&x[i][j],&d[i][j]);
	id[i].push_back(num);
	num++;
      }
    }

    for(int i=0;i<n;i++){
      for(int j=0;j<k[i];j++){
	if(i+1<n){
	  for(int z=0;z<k[i+1];z++){
	    P1 tmp = P1( (d[i][j]+d[i+1][z])*abs(x[i][j]-x[i+1][z]),id[i+1][z]);
	    normal[id[i][j]].push_back(tmp);
	  }
	}
	if(i+2<n){
	  for(int z=0;z<k[i+2];z++){
	    P1 tmp = P1( (d[i][j]+d[i+2][z])*abs(x[i][j]-x[i+2][z]),id[i+2][z]);
	    skip[id[i][j]].push_back(tmp);
	  }
	}
      }
    }

    for(int i=0;i<num;i++)
      for(int j=0;j<=m;j++)g[i][j] = 1<<30;
 
    priority_queue<P2 ,vector<P2> ,greater<P2> > q;
    for(int i=0;i<(int)id[0].size();i++)q.push(P2(P1(0,id[0][i]),0));
    if(m>0)for(int i=0;i<(int)id[1].size();i++)q.push(P2(P1(0,id[1][i]),1));

    while(q.size()){
      P2 p = q.top();q.pop();
      int risk = p.first.first, idx = p.first.second, step = p.second;

      for(int i=0;i<(int)normal[idx].size();i++){
	int r = risk + normal[idx][i].first,to = normal[idx][i].second;
	if(g[to][step]>r){
	  g[to][step] = r;
	  q.push(P2(P1(r, to),step));
	}
      }
      if(step<m){
	for(int i=0;i<(int)skip[idx].size();i++){
	  int r = risk + skip[idx][i].first,to = skip[idx][i].second;
	  if(g[to][step+1]>r){
	    g[to][step+1] = r;
	    q.push(P2(P1(r, to),step+1));
	  }
	}
      }
    }

    int ans = 1<<30;
    for(int i=0;i<(int)id[n-1].size();i++)
      for(int j=0;j<=m;j++)
	ans = min(ans,g[id[n-1][i]][j]);

    for(int i=0;i<(int)id[n-2].size();i++)
      for(int j=0;j<m;j++)
	ans = min(ans,g[id[n-2][i]][j]);
      
    printf("%d\n",ans);
  }
}

Measured memory_bytes: 2824
def main():
    N, K, S = map(int, input().split())
    ans = [10 ** 9] * N
    cnt = 0
    if N == K:
        for i in range(K):
            ans[i] = S
        print(*ans)
        exit()
    if S == 1:
        for i in range(K):
            ans[i] = 1
        print(*ans)
        exit()
    if S == 10 ** 9:
        ans = [2] * N
    ans[0] = 1
    for i in range(1,K+1):
        if i % 2 == 1:
            ans[i] = S - 1
        else:
            ans[i] = 1

    print(*ans) 


if __name__ == "__main__":
    main()

Measured memory_bytes: 46396
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.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 FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#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 F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    CASET{
        LL A,B; R(A,B);
        if(A>B)swap(A,B);
        LL score=A*B;
        LL an=(A-1)*2;
        if(A+1<B)an++;
        if(A+2<B){
            LL v=sqrt((LD)score);
            an+=max(0LL,(v-A)*2);
            if(v*v==score)an-=2;
            else if((score-1)/v==v)an--;
        }
        W(an);
    }
    return 0;
}


Measured memory_bytes: 256
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Data.Char

toTriple :: B.ByteString -> (Int, Int, Int)
toTriple bs =
    let
        Just (a, bs') = B.readInt bs
        Just (b, bs'') = B.readInt $ B.dropWhile isSpace bs'
        Just (c, _) = B.readInt $ B.dropWhile isSpace bs''
    in
        (a, b, c)

solve :: VU.Vector ((Int, Int, Int), (Int, Int, Int)) -> String
solve vec
    | VU.null vec = "Yes"
    | dist > limit = "No"
    | even dist && even limit = solve (VU.tail vec)
    | odd dist  && odd limit = solve (VU.tail vec)
    | otherwise = "No"
    where
        ((sc,sy,sx),(gc,gy,gx)) = VU.head vec
        dist = abs (sy-gy) + abs (sx-gx)
        limit = gc - sc

main = do
    n <- readLn :: IO Int
    txys <- VU.replicateM n (toTriple <$> B.getLine)
    putStrLn $ solve (VU.zip (VU.cons (0,0,0) txys) txys)

Measured memory_bytes: 5756
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

struct C1 {
    ll a_{};
    string s_{};
    explicit C1(ll a, string s) : a_(a), s_(move(s)){}
    string resolve() {
        if (a_ >= 3200) {
            return s_;
        }
        return "red";
    }
};

int main() {
    ll a;
    string s;
    cin >> a;
    cin >> s;
    C1 c{a, move(s)};
    cout << c.resolve() << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define unq(v) v.erase(unique(v.begin(),v.end()),v.end());
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N;
ll K;
ll A[MAX];
int bsum[45];
ll dp[45][2];

ll ans;

int main() {
    cin >> N >> K;
    rep(i, N) cin >> A[i];

    rep(d, 40) {
        int cnt = 0;
        rep(i, N) {
            if ((A[i] >> d) % 2) cnt++;
        }
        bsum[d] = cnt;
    }
    
    for (int d = 39; d >= 0; --d) {
        if ((K >> d) % 2) {
            ll cnt = 0;
            for (int e = d - 1; e >= 0; --e) {
                cnt += (1ll << e) * (bsum[e] * 2 < N ? N - bsum[e] : bsum[e]);
            }
            dp[d][0] = dp[d + 1][1] + cnt + (1ll << d) * bsum[d];
            dp[d][1] = dp[d + 1][1] + (1ll << d) * (N - bsum[d]);
        }
        else {
            dp[d][1] = dp[d + 1][1] + (1ll << d) * bsum[d];
        }
    }
    rep(i, 40) chmax(ans, dp[i][0]);
    chmax(ans, dp[0][1]);
    write(ans);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MAXN=500005;
int read(){int x;scanf("%d",&x);return x;}
struct node{
	int ch[2];
	int val,id;
}t[MAXN<<2];
int tot,N,K,num;
int a[MAXN],b[MAXN];
void PU(int u){
	t[u].val=max(t[t[u].ch[0]].val,t[t[u].ch[1]].val);
	t[u].id=t[t[u].ch[0]].val==t[u].val?t[t[u].ch[0]].id:t[t[u].ch[1]].id;
}
void insert(int u,int tl,int tr,int p,int val){
	if(tl==tr){t[u].val=val,t[u].id=p;return;}
	int mid=(tl+tr)>>1;
	if(p<=mid){
		if(!t[u].ch[0]) t[u].ch[0]=++tot;
		insert(t[u].ch[0],tl,mid,p,val);
	}
	else{
		if(!t[u].ch[1]) t[u].ch[1]=++tot;
		insert(t[u].ch[1],mid+1,tr,p,val);
	}
	PU(u);
}
pair<int,int>Query(int u,int tl,int tr,int l,int r){
//	cout<<u<<" "<<tl<<" "<<tr<<" "<<t[u].val<<endl;
	if(l>r) return make_pair(0,0);
	if(!u) return make_pair(0,0);
	if(tl>=l&&tr<=r) return make_pair(t[u].val,t[u].id);
	if(tr<l||tl>r) return make_pair(0,0);
	int mid=(tl+tr)>>1;
	pair<int,int>x,y;
	x=Query(t[u].ch[0],tl,mid,l,r),y=Query(t[u].ch[1],mid+1,tr,l,r);
	return x.first>y.first?x:y;
}
int head[MAXN],du[MAXN];
priority_queue<int>Q;  
struct line{int nxt,to;}e[MAXN<<1];
int Ans[MAXN],p[MAXN],cnt;
void add(int u,int v){e[num]=(line){head[u],v};head[u]=num,num++,du[v]++;}
int main(){
	memset(head,-1,sizeof(head));
	N=read(),K=read(),tot=1;
	for(int i=1;i<=N;i++) a[i]=read(),b[a[i]]=i;
	for(int i=1;i<=N;i++){
		insert(1,1,N,b[i],i);
		int x=Query(1,1,N,b[i]-K+1,b[i]-1).second,y=Query(1,1,N,b[i]+1,b[i]+K-1).second;
	//	cout<<x<<" "<<y<<" "<<b[i]<<endl;
		if(x) add(b[i],x);if(y) add(b[i],y);
	}
	for(int i=1;i<=N;i++) if(!du[i]) Q.push(i);
	cnt=N;
	while(!Q.empty()){
		int x=Q.top();Q.pop();
		Ans[cnt--]=x;
		for(int i=head[x];~i;i=e[i].nxt){
			du[e[i].to]--;
			if(!du[e[i].to]) Q.push(e[i].to);	
		}
	}
	for(int i=1;i<=N;i++) p[Ans[i]]=i;
	for(int i=1;i<=N;i++) printf("%d\n",p[i]);
	return 0;
}

Measured memory_bytes: 40952
def main():
    mod = 998244353
    s, k = input().split()
    k, n, o, cnt, z, zero_list = int(k), len(s), s.count("1")+1, 0, 0, []
    for i in range(n):
        if s[i] == "0":
            zero_list.append(cnt)
            cnt = 0
        else:
            cnt += 1
    m = min(o, k+1)

    dp = [[0]*m for _ in [0]*o]
    dp[0][0] = 1

    for i in zero_list:
        dp2 = [[0]*m for _ in [0]*o]
        dp3 = [[0] for _ in [0]*o]
        for x in range(o):
            t = 0
            for y in range(min(m, o-x)):
                t = (t+dp[x+y][y]) % mod
                dp3[x].append(t)
        dp4 = [[0]*m for _ in [0]*o]
        for y in range(m):
            t = dp[0][y]
            for x in range(1, o):
                dp4[x-1][y] = t
                t = (t+dp[x][y]) % mod
            dp4[o-1][y] = t
        for j in range(z+i, o):
            for x in range(min(j-i+1, m)):
                dp2[j][x] = (dp2[j][x]+dp3[j-x-i][min(o, x+1)]) % mod
            for p in range(m):
                dp2[j][p] = (dp2[j][p]+dp4[j][p]-dp4[max(j-i, p-1)][p]) % mod
        z += i
        dp = dp2
    print(sum([sum(i) for i in dp]) % mod)


main()

Measured memory_bytes: 12904
#include <iostream>
#include<numeric>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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






int main() {

	int N;
	cin >> N;
	long long s = 0;
	rep(i, N) {
		rep(j, N) {
			rep(k, N) {
				s += gcd(i + 1, gcd(j + 1, k + 1));
			}
		}
	}
		cout << s << endl;
	


}


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

int main()
{
  char S[7][4] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
  char s[4] = {};

  scanf("%s", s);
  for(int i=0; i<7; i++)
  {
    if( strcmp(s,S[i]) == 0 )
     printf("%d",(7-i) );
  }

  return 0;
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//const double pi=acos(-1.0);
#define mod 1000000007
#define forn(i,k,n) for(ll i=k;i<n;i++)
#define fornr(i,k,k1) for(ll i=k;i>=k1;i--)
#define v(ll) vector<ll>
#define vl(a,n,ll,k) vector<ll> a(n,k)
#define vli(a,n) vector<ll> a(n)
#define init(a,n) vector<ll> a(n);forn(i,0,n)cin>>a[i]
#define vll(a,n,m,ll,k) vector<vector<ll>> a(n,vector<ll>(m,k))
#define mp(a,ll,ll1) map<ll,ll1> a
#define st(a,ll) set<ll> a
#define mpa make_pair
#define pr pair<ll,ll>
#define pb push_back
#define MAX 1000000
#define ed '\n'
#define fileTake ifstream cin("input.txt");ofstream cout("output.txt");
#define sortv(a) sort(a.begin(),a.end())
#define sorta(a,n) sort(a,a+n)
#define yeah "OK"
#define nil "NG"
#define All(x) x.begin(),x.end()
#define remDup(a) a.erase(unique(All(a)),a.end())
void swap(ll &x,ll &y) 
{ 
	x=x^y;
	y=x^y;
	x=x^y;
} 

template<typename T>
void print(T a){for(auto i=a.begin();i!=a.end();i++)cout<<*i<<" ";cout<<endl;}
bool isVowel(char c)
{
	if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')return true;
	return false;
}

void sync(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}

int main(){
	sync();
	ll k,a,b;
	cin>>k>>a>>b;
	ll x=ceil(a/(k+0.0))*k;
	ll y=(b/k)*k;
	if(x<=y)cout<<yeah<<endl;
	else cout<<nil<<endl;
}

Measured memory_bytes: 3652
/*
    JAI JAGANNATH!
*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<lli,lli>
#define vi              vector<lli>
#define mii             map<lli,lli>
#define pqb             priority_queue<lli>
#define pqs             priority_queue<lli,vi,greater<lli> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            lli x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update> pbds;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

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

}
void solve() {
	lli n;
	cin >> n;
	vector <lli> v(n);
	lli tot = 0;
	for (lli i = 0; i < n; i++) {
		cin >> v[i];
		tot ^= v[i];
	}
	vector <lli> ret(n);
	for (lli i = 0; i < n; i++) {
		ret[i] = v[i] ^ tot;
	}

	for (lli i  : ret) {
		cout << i << " ";
	}
	cout << endl;
}
int main()
{
	ss();
	solve();
	return 0;
}

Measured memory_bytes: 6348
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int A;
    static int B;
    static int C;
    static int D;
    static void INPUT()
    {
        A = NextInt();
        B = NextInt();
        C = NextInt();
        D = NextInt();
    }
    static void OUT()
    {
        var a = (A - 1) / D;
        var b = (C - 1) / B;

        Console.WriteLine(a >= b ? "Yes" : "No");
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
}




Measured memory_bytes: 17936
import heapq  # heapqライブラリのimport
X,Y,Z,K=map(int,input().split())
A= list(map(int,input().split()))
B= list(map(int,input().split()))
C= list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
dic={}
dic[(0,0,0)]=1
lst =[(-(A[0]+B[0]+C[0]),0,0,0)]
heapq.heapify(lst)
for r in range(K):
 a=lst[0][1]
 b=lst[0][2]
 c=lst[0][3]
 print(lst[0][0]*(-1))
 heapq.heappop(lst)
 if a<X-1 :
  if (a+1,b,c) not in dic:
   heapq.heappush(lst, (-(A[a+1]+B[b]+C[c]),a+1,b,c))
   dic[(a+1,b,c)]=1
 if b<Y-1 :
  if (a,b+1,c) not in dic:
   heapq.heappush(lst, (-(A[a]+B[b+1]+C[c]),a,b+1,c))
   dic[(a,b+1,c)]=1
 if c<Z-1 :
  if (a,b,c+1) not in dic:
   heapq.heappush(lst, (-(A[a]+B[b]+C[c+1]),a,b,c+1))
   dic[(a,b,c+1)]=1

Measured memory_bytes: 57304
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long


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

    string s; cin >> s;
    string ans;
    for(int i = 0;i < s.size();i ++){
        if(s.at(i) == '0' || s.at(i) == '1') ans += s.at(i);
        else if(ans.size()) ans.pop_back();
    }

    cout << ans << endl;
}



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

int main() {
    string S, T;
    bool flag = false;
    cin >> S;
    cin >> T;
    for(int i = 0; i < S.size(); i++){
        if (S == T)flag = true;
        S = S.substr(1) + S[0];
    }

    if (flag) cout << "Yes";
    else cout << "No";
	return 0;
    
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("Ofast")
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define reps(i, s, n) for (int i = s; i < (int)(n); ++i)
using namespace std;
using ll = long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

void solve() {
    int n, k;
    cin >> n >> k;
    V<int> B(n + 1, 0);
    rep(i, n) {
        int a;
        cin >> a;
        B[a]++;
    }
    V<int> C(0);
    for (auto &b : B) {
        if (b != 0) {
            C.push_back(b);
        }
    }
    sort(C.begin(), C.end());
    int ans = 0;
    if (C.size() <= k) {
        ans = 0;
    } else {
        ans = accumulate(C.begin(), C.begin() + C.size() - k, 0);
    }
    cout << ans << "\n";
}
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 4900
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;



struct UnionFind{
	vector<int> par,rank;
	UnionFind(int N){
		par.assign(N,0);
		rank.assign(N,0);
		for(int i=0;i<N;i++) par[i]=i;
	}
	int find(int x){
		if(par[x]==x) return x;
		return par[x]=find(par[x]);
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	void unite(int x,int y){
		x=find(x),y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y]) swap(x,y);
 
		par[y]=x;
		if(rank[x]==rank[y]) rank[x]++;
	}
};

signed main(){
    int N,m;
    cin>>N>>m;
    UnionFind uf(N);
    vector<int> p(N);
    for(int i=0;i<N;i++)cin>>p[i];
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        x--;y--;
        uf.unite(x,y);
    }

    int res=0;
    for(int i=0;i<N;i++){
        if(uf.same(i,p[i]-1))res++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main {
    public static void main(String[] argv)
    {
	Scanner sc = new Scanner(System.in);
	int a, b;
	a = Integer.parseInt(sc.next());
	b = Integer.parseInt(sc.next());
	if (a * b % 2 != 0)
	    System.out.println("Odd");
	else
	    System.out.println("Even");
    }
}


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

int main(){
  string s;
  cin>>s;
  int l=s.length();
  int m1=0;
  //if(l%2==0){
    for(int i=0;i<l/2;i++){
      if(s[i]!=s[l-i-1])
        m1+=1;
    }
  
  cout<<m1;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    ll n;
    cin >> n;
    if (n % 2 != 0) {
        cout << 0 << endl;
        return 0;
    }
    
    ll ans = 0;
    ll d = 10;

    //ans += n/d;
    ll d5 = 5;
    n /= 2;
    while(n/d5!=0) {
        ll num = n / d5;
        //if (num >= 2) ans += (num + (2-1))/2;
        ans += num;
        d5 *= 5;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
const int MAXN = 500005;
const int mod = 1e9 + 7;
#define sz(v) ((int)v.size())

int main(){
	lint n, a;
	cin >> n >> a;
	if(n == 1){
		cout << 1 << endl;
		return 0;
	}
	lint ans = n;
	for(int i=0; i<100; i++){
		for(int j=2; j<=1000069; j++){
			lint dap = 0;
			lint cur = 1;
			for(int k=0; k<i; k++){
				dap += j + a;
				cur = cur * j;
				if(cur >= n) break;
			}
			if(cur < n && j != 2){
				while(cur < n){
					dap += j - 1 + a;
					cur = cur * (j - 1);
				}
			}
			if(cur >= n) ans = min(ans, dap - a);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	for i := 1; i < 10; i++ {
		for j := 1; j < 10; j++ {
			if n == i*j {
				fmt.Println("Yes")
				return
			}
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

// eratosthenes の篩（素数かどうかの表が返る）
vector<bool> eratosthenes( int n )
{
	vector<bool> nums( n + 1, true );
	nums[0] = nums[1] = false;

	for ( int i = 0; i < nums.size(); ++i )
	{
		if ( !nums[i] )
		{
			continue;
		}

		for ( int j = 2; i * j < nums.size(); ++j )
		{
			nums[ i * j ] = false;
		}
	}

	return nums;
}

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

	VI primes;
	{
		vector<bool> isPrime( eratosthenes( 1000000 ) );
		REP( i, 0, isPrime.size() )
		{
			if ( isPrime[i] )
			{
				primes.PB( i );
			}
		}
	}

	while ( true )
	{
		int n, p;
		cin >> n >> p;

		if ( ( n & p ) == -1 )
		{
			break;
		}

		int minpos = upper_bound( ALL( primes ), n ) - primes.begin();

		VI nums;
		REP( i, 0, p )
		{
			REP( j, i, p )
			{
				nums.PB( primes[ minpos + i ] + primes[ minpos + j ] );
			}
		}
		sort( ALL( nums ) );

		cout << nums[ p - 1 ] << endl;
	}

	return 0;
}

Measured memory_bytes: 1748