akhauriyash/Code-Regression huggingface dataset:
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int n) { return n & 1; }
constexpr bool even(const int n) { return ~n & 1; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

main {
  int n;
  cin >> n;
  for (int x = 1; x <= n; x *= 2) {
    if ((n + 1) % x == 0 && odd((n + 1) / x)) {
      cout << x << endl;
      return 0;
    }
  }
  cout << n + 1 << endl;
}

Measured memory_bytes: 3112
s = input()
k = int(input())

substring = {}

for i in range(len(s)):
    for j in range(i+1, i+1+k):
        # print('i={}, j={} s[{}:{}]={}'.format(i,j,i,j,s[i:j]))
        substring[s[i:j]] = True


words = [item[0] for item in substring.items()]
sorted_words = sorted(words)

print(sorted_words[k-1])


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

const int INF = 2e9;

int main(){
    int n,m;
    cin >> n >> m;
    int a = abs(n-m);
    bool ok = false;
    if(a < 2) ok = true;
    ll mod = 1e9 + 7;
    ll ans;
    if(ok){
        if(n == m) ans = 2;
        else ans = 1;
        rep(i,n){
            ans *= (i+1);
            ans %= mod;
        }
        rep(i,m){
            ans *= (i+1);
            ans %= mod;
        }
        cout << ans << endl;
    }
    else cout << 0 << endl;
}

Measured memory_bytes: 256
n=int(input())
a=[int(i) for i in input().split()]
ans=[1000,0]
for i in range(1,n):
    if a[i-1]<a[i]:
        ans[0]+=ans[1]*a[i-1]
        ans[1]=0
        ans[1]=ans[0]//a[i-1]
        ans[0]=ans[0]%a[i-1]
    else:
        ans[0]+=ans[1]*a[i-1]
        ans[1]=0
print(ans[0]+ans[1]*a[-1])


Measured memory_bytes: 61820
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Linq;
using System.Text;
using static System.Math;

class MainClass
{

    public static void Main(string[] args)
    {
        var _ = LnInts();
        var N = _[0];
        var K = _[1];
        var sunuke = new int[N];
        for(int i = 0; i < K; i++)
        {
            var d = LnInt();
            var As = LnInts();
            for(int n = 0; n < d; n++)
            {
                sunuke[As[n]-1]++;
            }
        }
        var result=0;
        foreach(var i in sunuke)
        {
            result += i > 0 ? 0 : 1;
        }
        print(result);
    } 



    public static void print(object obj) { Console.WriteLine(obj); }
    public static long Gcd(long a, long b) { if (a > b) { var r = a % b; if (r == 0) return b; else return Gcd(b, r); } else { var r = b % a; if (r == 0) return a; else return Gcd(a, r); } }
    public static int Gcd(int a, int b) { if (a > b) { var r = a % b; if (r == 0) return b; else return Gcd(b, r); } else { var r = b % a; if (r == 0) return a; else return Gcd(a, r); } }
    public static int[] LnInts() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var ins = new int[vs.Length]; for (int i = 0; i < vs.Length; i++) ins[i] = int.Parse(vs[i]); return ins; }
    public static int LnInt() { var vs = Console.ReadLine().Trim(); return int.Parse(vs); }
    public static long[] LnLngs() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var ins = new long[vs.Length]; for (int i = 0; i < vs.Length; i++) ins[i] = long.Parse(vs[i]); return ins; }
    public static long LnLng() { var vs = Console.ReadLine().Trim(); return long.Parse(vs); }
    public static string[] LnStrs() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); return vs; }
    public static string LnStr() { var vs = Console.ReadLine().Trim(); return vs; }
public static List<T[]> AllPermutation<T>(params T[] array) where T : IComparable{var a = new List<T>(array).ToArray();var res = new List<T[]>();res.Add(new List<T>(a).ToArray());var n = a.Length;var next = true;while (next){next = false;int i;for (i = n - 2; i >= 0; i--){if (a[i].CompareTo(a[i + 1]) < 0) break;}if (i < 0) break;var j = n;do{j--;} while (a[i].CompareTo(a[j]) > 0);if (a[i].CompareTo(a[j]) < 0){var tmp = a[i];a[i] = a[j];a[j] = tmp;Array.Reverse(a, i + 1, n - i - 1);res.Add(new List<T>(a).ToArray());next = true;}}return res;}}




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

int main(){
    int a,b;
    cin >> a >> b;

    if(a < b){
    cout << "a < b" << endl;
    } else if (a > b){
    cout << "a > b" << endl;
    } else {
    cout << "a == b" << endl;
    }

    return 0;
}

Measured memory_bytes: 3088
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
pll a[200010];
ll s11[200010],s12[200010],s21[200010],s22[200010];
int n;
int main()
{
#ifdef DEBUG
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
#endif
	scanf("%d",&n);
	int i;
	for(i=1;i<=n;i++)
	{
		scanf("%lld%lld",&a[i].first,&a[i].second);
		if(a[i].first<a[i].second)
			swap(a[i].first,a[i].second);
	}
	sort(a+1,a+n+1);
	s11[0]=s21[n+1]=0x7fffffffffffffff;
	s12[0]=s22[n+1]=0;
	for(i=1;i<=n;i++)
	{
		s11[i]=min(s11[i-1],a[i].second);
		s12[i]=max(s12[i-1],a[i].second);
	}
	for(i=n;i>=1;i--)
	{
		s21[i]=min(s21[i+1],a[i].second);
		s22[i]=max(s22[i+1],a[i].second);
	}
	ll ans=(a[n].first-a[1].first)*(s12[n]-s11[n]);
	for(i=1;i<n;i++)
	{
		ll x1=max(a[i].first,s22[i+1]);
		ll x2=min(a[1].first,s21[i+1]);
		ll y1=max(a[n].first,s12[i]);
		ll y2=min(a[i+1].first,s11[i]);
		ans=min(ans,(x1-x2)*(y1-y2));
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 9472
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<57;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,1,1,1,0},DY[8]={1,0,-1,-1,-1,0,1,1};

string s,t;

int main(){
	cin>>s>>t;
	int S=s.size(),T=t.size();
	for(int i=0;i<S+T;i++){
		if(i%2==0) cout<<s[i/2];
		else cout<<t[i/2];
	}
	cout<<endl;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int,x)

parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    W, H, x, y = readline() |> split |> parseMap
    println(W*H/2)
    if x == W/2 && y == H/2
        println(1)
    else
        println(0)
    end
end

main()

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

int main(){

  int n;
  int dp[1111][1111];

  cin >> n;
  while(n--){
    string str1, str2;
    cin >> str1 >> str2;

    memset(dp,0,sizeof(dp));

    for(int i = 1; i <= str1.size(); i++){
      for(int j = 1; j <= str2.size(); j++){
        if(str1[i-1] == str2[j-1]){
          dp[i][j] = dp[i-1][j-1] + 1;
        }else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
      }
    }
    cout << dp[str1.size()][str2.size()] << endl;

  }
}

Measured memory_bytes: 6036
# Aizu Problem ITP_1_2_B: Range
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

a, b, c = [int(_) for _ in input().split()]
print("Yes" if a < b < c else "No")

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

#define TASK ""
#define openfile ({freopen(TASK".inp", "r", stdin); freopen(TASK".out", "w", stdout);})

int n;
char s[10];

int main() {
	//openfile;
	scanf("%s", s);
	n = strlen(s);
	for (int i = 0; i < n / 2; i++)
		if (s[i] != s[n - i - 1]) { return cout << "No", 0; }
	cout << "Yes";
	return 0;
}

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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


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

  lint ans=1000;
  for(lint i=1;i<n;i++) {
    if(a[i] <= a[i-1]) { continue; }
    ans += (ans/a[i-1])*(a[i]-a[i-1]);
  }

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


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

LL modinv(LL a) {
    LL b = MOD, u = 1, v = 0;
    while (b) {
        LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

VVI s;

int check(int a, int b, int c, int d){
    int r=0;
    FOR(i,a,b){
        FOR(j,c,d){
            r += s[i][j];
        }
    }
    return r;


}

void Main()
{
    int h,w,z;cin>>h>>w>>z;

    s.resize(h);
    REP(i,h){
        s[i].resize(w);
        REP(j,w){
            char tmp;cin>>tmp;
            s[i][j] = tmp-'0';
        }
    }

    int result = INF;

    REP(bit,1<<(h-1)){
        int cuts=0;
        VVI t;
        t.push_back(s[0]);
        int tt = 0;
        FOR(i,1,h){
            if(bit & (1<<(i-1))){
                REP(j,w){
                   t[tt][j] += s[i][j];
                }
            }
            else{
                t.push_back(s[i]);
                tt++;
                cuts++;
            }
        }
        int s_t = tt+1;
        VI now(s_t);
        
        REP(j,w){
            int m_t=0;

            REP(i,s_t){
                now[i] += t[i][j]; 
                m_t = max(m_t,now[i]);
            }

            if(m_t > z){
                cuts++;
                REP(i,s_t){
                    now[i]=t[i][j];
                    if(now[i] > z){
                        cuts = INF;
                    }
                }
            }

        }


        result = min(result,cuts);

    }

    cout<<result<<endl;








	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

#ifdef __WIN32
#define LLFORMAT "I64"
#else
#define LLFORMAT "ll"
#endif

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	int A, B, C;
	cin >> A >> B >> C;
	if(A + B >= C - 1) {
		cout << B + C << endl;
		return 0;
	}
	cout << B + (A + B + 1) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int N, L;
    cin >> N >> L;
    vector<int> as(N);
    long long sum = 0;
    for(int i = 0; i < N; i++) {
        as[i] = L + i;
        sum += as[i];
    }
    if(as[0] * as[N - 1] <= 0){
        cout << sum << endl;
        return 0;
    }
    if(as[N - 1] < 0){
        cout << sum - as[N - 1] << endl;
        return 0;
    }
    cout << sum - as[0] << endl;
}

Measured memory_bytes: 3592
MAX = 100000+1
prices = [100, 101, 102, 103, 104, 105]

result = [ 0 for x in range(MAX)]
result[100] = 1
result[101] = 1
result[102] = 1
result[103] = 1
result[104] = 1
result[105] = 1

x = int(input())
for v in range(100, x+1):
    for p in prices:
        if result[v] or result[v-p]:
            result[v] = 1
            break
print(result[x])


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

const int N = 1009;
char s[N], t[N];
int ans;

int solve(int l, int r) {
	int res = 0;
	for (int i = l, j = 1; i <= r; ++ i, ++ j) 
		if (s[i] != t[j]) ++ res;
	return res;
}

int main() {
	ans = 1e9;
	scanf("%s%s", s + 1, t + 1);
	int n = strlen(s + 1), m = strlen(t + 1);
	for (int i = 1; i <= n; ++ i) {
		if (i + m - 1 > n) break;
		ans = min(ans, solve(i, i + m - 1));
	}
	printf("%d\n", ans);
	return 0;
}

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

#define lp( i, L, U ) for(int i=(int)L ; i<=(int)U ; i++ )
#define rlp( i, U, L ) for(int i=(int)U ; i>=(int)L ; i-- )
#define SQR(x) ((x)*(x))
#define nl "\n"
#define pb push_back
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define Max3(a,b,c)           max(a,max(b,c))
#define Min3(a,b,c)           min(a,min(b,c))
#define pb push_back
#define mkp make_pair

#define INF INT_MAX


#define READ(filename)  freopen(filename, "r", stdin);
#define WRITE(filename)  freopen(filename, "w", stdout);

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<vector<int> > vvc;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef map<string, string> mss;
typedef map<string, char> msc;

int main()
{
    int n; cin >> n;
    ll ans = 0;
    for(int i=1; i<=n; ++i)
        if(!(i%3)||!(i%5)) continue;
    else ans += i;

        cout << ans << nl;
    return 0;
}



Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  rep(i,h){
    cin>>s[i];
  }
  vector<vector<int> > ti(h+1,vector<int>(w+1,0));
  queue<tuple<int,int,int> >  que;
  int count=0;
  rep(i,h){
    rep(j,w){
      if(s[i][j]=='#'){
        count++;
      }
    }
  }
  int ny,nx,nti;
  que.emplace(0,0,0);
  while(!que.empty()){
    tie(ny,nx,nti)=que.front(); que.pop();
    if(ny<0 || ny>=h || nx<0 || nx>=w){
      continue;
    }
    if(ti[ny][nx]!=0){
      continue;
    }
    if(s[ny][nx]=='#'){
      continue;
    }
    ti[ny][nx]=nti;
    rep(i,4){
      que.emplace(ny+dy[i],nx+dx[i],nti+1);
    }
  }
  if(ti[h-1][w-1]==0){
    cout<<-1<<'\n';
  }
  else{
    cout<<h*w-ti[h-1][w-1]-count-1<<'\n';
  }
  return(0);
}


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

int main(){
  int h, w;
  while(cin >> h >> w && h != 0 || w != 0){
    string s[h];
    for (int i = 0; i < h; i++){
      for (int j = 0; j < w; j++){
        if ((i + j) % 2 == 0) cout << "#";
        else cout << ".";
      }
      cout << endl;
    }
    //for (int i = 0; i < h; i++) cout << s[i] << endl;
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3096
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;

int main(){
    string s;

    cin >> s;

    int cnt =0;
    rep(i,3){
        if(s[i] == 'o') cnt++;
    }
    int ans = 700 + 100* cnt;
    cout << ans << endl;

    return 0;
}

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

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

    for (int i = -200; i < 200; i++)
    {
        for (int j = -200; j < 200; j++)
        {
            if (pow(i, 5) - pow(j, 5) == x)
            {
                cout << i << " " << j << endl;
                exit(0);
            }
        }
    }
}

Measured memory_bytes: 3992
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
using lli = long long int;

lli dp(int N, lli X) {
    static vector<lli> h(1, 1);
    static vector<lli> p(1, 1);

    if (N == 0) {
        if (X >= h.back())
            return p.back();
        h.pop_back();
        p.pop_back();
        lli ans = 0;
        while (!h.empty()) {
            X--;
            if (h.back() > X) {
                h.pop_back();
                p.pop_back();
                continue;
            }
            X -= h.back();
            ans += p.back();
            if (X == 0)
                return ans;
            X--;
            ans++;
            if (h.back() > X) {
                h.pop_back();
                p.pop_back();
                continue;
            }
            X -= h.back();
            ans += p.back();
            return ans;
        }
        return ans;
    }
    h.push_back(h.back() * 2 + 3);
    p.push_back(p.back() * 2 + 1);

    return dp(N - 1, X);
}

int main() {
    int N;
    lli X;
    cin >> N >> X;

    cout << dp(N, X) << endl;

    return 0;
}

Measured memory_bytes: 256
# AOJ 0586: Palindrome
# Python3 2018.6.30 bal4u

def palindrome(k, c):
	a = 10*k + c;
	while k:
		a = 10*a + (k % 10)
		k //= 10
	return a

def isPrime(p):
	if (p & 1) == 0: return False
	for i in range(3, 1+int(p**0.5), 2):
		if (p % i) == 0: return False
	return True

n, c = map(int, input().split())
if c < 0: print('9'*(2*n) if n > 1 else '11')
else:
	k = int('9'*n)+1
	while True:
		k -= 1
		x = palindrome(k, c)
		if isPrime(x):
			print(x)
			break


Measured memory_bytes: 5640
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

void solve() {
  string S;
  cin >> S;
  ll a = 0;
  ll b = 0;
  for (char c: S) if (c == 'A') a++; else b++;
  if (a > 0 and b > 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 256
program main
implicit none
integer :: i,j,n,k,d,ans = 0
integer,allocatable :: a(:),sn(:)

read(*,*)n,k
allocate(a(n),sn(n))
sn = 0
a = 0

do i = 1,k
read(*,*)d
read(*,*)a(1:d)
do j = 1,d
if (sn(a(j)) == 0) ans = ans + 1
sn(a(j)) = 1
end do
end do

write(*,*) n - ans

end program main

Measured memory_bytes: 2776
'use strict'

const divisorCount = (num) => {
    let buffer = []
    for(let i = 1; i <= num; i++){
        if(num % i === 0){
            buffer.push(i)
        }
    }
    return buffer.length    
}

const main = (input) => {
    const N = parseInt(input)

    let count = 0
    for(let i = 1; i <= N; i++){
        if(i % 2 === 0) continue
        if(divisorCount(i) === 8) count++
    }
    console.log(count)
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

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

#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define eb emplace_back
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)
#define mmst(v) memset(v, 0, sizeof(v))

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

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;
const long long kMod = 1000000007;

const long long kMAX = 1000000000;

using namespace std;
using ll = long long;

inline int readInt() {
  char c = getchar();
  while(!isdigit(c) && c != '-') c = getchar();
  int sigma = 1;
  if (c == '-') {
    sigma = -1;
    c = getchar();
  }
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * sigma;
}

template <class T>
void PrintVector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void PrintVector(const vector<T> & v, int n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}

int main(int argc, char const *argv[]) {
  int n, h;
  int a_max = 0;
  int ans = 0;
  vector<int> a, b;
  cin >> n >> h;
  rep(i, 1, n) {
    int a0, b0;
    cin >> a0 >> b0;
    a.pb(a0);
    b.pb(b0);
    chmax(a_max, a0);
  }
  sort(b.begin(), b.end(), greater<int>());
  int h0 = 0;
  for (const auto & b0: b) {
    if (b0 > a_max) {
      h0 += b0;
      ++ans;
      if (h0 >= h) break;
    }
  }
  if (h0 < h) {
    ans += (h - h0 + a_max - 1) / a_max;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1276
package main

import (
	"bufio"
	"fmt"
	"os"
	"unicode"
)

func main() {
	x := readRune()

	if unicode.IsUpper(x[0]) {
		fmt.Println("A")
	} else {
		fmt.Println("a")
	}

}

var (
	scanner *bufio.Scanner
)

func init() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
}

func readRune() []rune {
	var t string

	if scanner.Scan() {
		t = scanner.Text()
	}

	return []rune(t)
}


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

wa = 0
ac = 0
tle = 0
re = 0

for i in range(n):
  x = input()
  if x == "RE": re+=1
  if x == "TLE": tle+=1
  if x == "AC": ac+=1
  if x == "WA": wa+=1

print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))

Measured memory_bytes: 9208
N,M = map(int,input().split())
m_list = sorted(list(map(int,input().split())))
max_n = m_list[-1] - m_list[0]
distance = []
for i in range(M-1):
    distance.append(m_list[i+1]-m_list[i])
distance.sort(reverse=True)
print(max_n - sum(distance[:N-1]))

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

int main(void){
  char S[3], T[3];
  int cnt = 0;
  cin >> S >> T;
  for(int i = 0; i < 3; i++){
    if(S[i] == T[i])
      cnt++;
  }
  cout << cnt << "\n";
  return 0;
}
  


Measured memory_bytes: 3624
h,n=map(int,input().split())
lis=[list(map(int,input().split())) for i in range(n)]

dp=[float('inf') for i in range(h+10**4+1)] # dp[i]は、総ダメージiの時の最小コスト
dp[0]=0

for i in range(1,h+10**4+1):
    for j in range(n): # 技ループ
        if i>=lis[j][0]:
            dp[i]=min(dp[i],dp[i-lis[j][0]]+lis[j][1])
#        else:
#            dp[i]=dp[i]
print(min(dp[h:]))

Measured memory_bytes: 44692
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
long N, M=1000, K=0; cin >> N; long A[N];
REP(i, N){ cin >> A[i]; }
REP(i, N-1){ 
  if(A[i]<=A[i+1]){ K+=(M/A[i]); M=M%A[i]; }
  if(A[i]>A[i+1]){ M+=A[i]*K;  K=0; }
}
M+=K*A[N-1];
cout << M << "\n";
}

Measured memory_bytes: 3536
/*----------------by syr----------------*/
/*
  -----  -----  -----
  |   |  |---|    _/
  |   |  | \_    /
  -----  |   \  -----

  |---\  \   /  |\  /|
  |   |   \_/   | \/ |
  |   |   / \   |    |
  |---/  /   \  |    |
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i,x,y) for(int i=(x);i<(y);++i)
#define REP(i,x,y) for(int i=(x);i<=(y);++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef pair<int,int> pii;

const int INF=1e9+7;
const int maxn=3e3+5;
const int maxh=2e5+5;

inline int add(int a,int b){return (a+b)-((a+b>=INF)?(INF):(0));}
inline int mul(int a,int b){return 1ll*a*b%INF;}
inline void uadd(int &a,int b){a=((a+b>=INF)?(a+b-INF):(a+b));return;}
inline void umul(int &a,int b){a=1ll*a*b%INF;return;}

int w,h,n;
int dp[maxn],fac[maxh],ifac[maxh];
pii a[maxn];

inline int qpow(int x,int y){
	int ret=1;
	for(;y;y>>=1){
		if(y&1) umul(ret,x);
		umul(x,x);
	}
	return ret;
}

inline void preCalc(){
	fac[0]=1;
	FOR(i,1,maxh) fac[i]=mul(fac[i-1],i);
	ifac[maxh-1]=qpow(fac[maxh-1],INF-2);
	for(int i=maxh-2;i>=0;--i) ifac[i]=mul(ifac[i+1],add(i,1));
	return;
}

inline int C(int n,int m){
	if(n<m) return 0;
	return mul(fac[n],mul(ifac[m],ifac[n-m]));
}

int main(){
	scanf("%d%d%d",&h,&w,&n);
	preCalc();
	FOR(i,0,n){
		scanf("%d%d",&a[i].fst,&a[i].snd);
		--a[i].fst;--a[i].snd;
	}
	a[n++]=MP(h-1,w-1);
	sort(a,a+n);
	FOR(i,0,n){
		uadd(dp[i],C(a[i].fst+a[i].snd,a[i].fst));
		FOR(j,0,i){
			int dx=a[i].fst-a[j].fst,dy=a[i].snd-a[j].snd;
			if(dx<0||dy<0) continue;
			uadd(dp[i],INF-mul(dp[j],C(dx+dy,dx)));
		}
	}
	printf("%d\n",dp[n-1]);
	return 0;
}


Measured memory_bytes: 1792
local n, m = io.read("*n", "*n")
local edge = {}
local cnt = {}
local len = {}
for i = 1, n do
  edge[i] = {}
  cnt[i] = 0
  len[i] = 0
end
for i = 1, m do
  local x, y = io.read("*n", "*n")
  table.insert(edge[x], y)
  cnt[y] = cnt[y] + 1
end
local tasks = {}
for i = 1, n do
  if cnt[i] == 0 then
    table.insert(tasks, i)
  end
end
local mma = math.max
while 0 < #tasks do
  local src = tasks[#tasks]
  table.remove(tasks)
  for i = 1, #edge[src] do
    local dst = edge[src][i]
    len[dst] = mma(len[dst], len[src] + 1)
    cnt[dst] = cnt[dst] - 1
    if cnt[dst] == 0 then
      table.insert(tasks, dst)
    end
  end
end
local ret = 0
for i = 1, n do
  ret = mma(ret, len[i])
end
print(ret)


Measured memory_bytes: 16376
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,cnt=0,ans;
  string s;
  cin >> n >> s;
  for(int i=0; i<s.length(); i++) {
    if(s[i]=='E') {
      cnt++;
    }
  }
  ans=cnt;
  for(int i=0; i<s.length(); i++) {
    if(s[i]=='E') {
      cnt--;
      ans=min(ans,cnt);
    }
    else {
      cnt++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 900
#include<stdio.h>
#include<string.h>
int x[100005],y[100005],c[100005];
int save[10005]={0};
int main(void){
	int n,k,max=0,sum=0;
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;i++){
		char color;
		scanf("%d %d %c",&x[i],&y[i],&color);
		x[i] = x[i] % (2*k);
		y[i] = y[i] % (2*k);
		//白色为1 黑色为0 
		if(color == 'W') c[i] = 1;
		else c[i] = 0;
	}
	for(int i=0;i<=k;i++){
		sum = 0;
		memset(save,0,10005);
		for(int j=1;j<=n;j++){
			int p,q;
			if( i<=x[j] && x[j]<i+k) p=1;
			else p=0;
			if(y[j]>=0 && y[j]<k) q=1;
			else q=0;
			//位运算
			if(p^q == c[j]){
				sum++;
				save[y[j]]++;
			} else{
				save[y[j]]--;
			}
		}
		for(int j=0;j<=k;j++){
			if(sum>max) max=sum;
			if(n-sum>max) max = n-sum;
			if(j!=k) sum = sum - save[j] - save[j+k];
		}
	}
	printf("%d",max);
}

Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int len[n];
    for(int i=0;i<n;i++){
        cin>>len[i];
    }
    
    for(int i=n-1;i>0;i--){
        cout<<len[i]<<" ";
    }
    cout<<len[0]<<endl;
    return 0;
    }
    


Measured memory_bytes: 3080
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

using namespace std;
using ll = long long;

int main(){
    string s;
    cin>>s;
    string ans;
    for(int i=0;i<s.length();i+=2){
        ans += s[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
using ll = long long;

int main() {
	string S,T;
	cin >> S >> T;
	bool match = false;
	if (S.size() != T.size()) {
		cout << "No" << endl;
	} else {
		for (ll i=0; i<S.size(); ++i) {
			match = true;
			ll offset = i;
			for (ll j=0;j<S.size(); ++j) {
				ll k = (offset + j) % S.size();
				match = match && (S[k] == T[j]);
				if (match == false) break; 
			}
			if (match) break;
		}
	}
	cout << (match ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  char s[200000];
  fgets(s, sizeof(s), stdin);
  for (int i=0; s[i] != '\n'; i++) {
    if (i%2 == 0) {
      printf("%c", s[i]);
    }
  }
      printf("\n");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#define max(a,b) ((a>b)? a:b)
using namespace std;
int main()
{
  int N,M;
  cin>>N;
  vector<pair<int,int>> vec;
  for(int i=0;i<N;i++){
    int a,b;
    cin>>a>>b;
    vec.push_back(make_pair(a,b));
  }
  sort(vec.begin(),vec.end());
  vector<pair<int,int>> diff;
  for(int i=0;i<vec.size();i++){
    for(int j=i+1;j<vec.size();j++){
      int first=vec[i].first-vec[j].first;  
      int second=vec[i].second-vec[j].second;
      
      diff.push_back(make_pair(first,second));
    }
  }
  
  /*
  cout<<"diff"<<endl;
  for(int i=0;i<diff.size();i++){
    cout<<diff[i].first<<" "<<diff[i].second<<endl;
  }
  cout<<endl;
  */
  
  int ans=0;
  for(int i=0;i<diff.size();i++){
    int cnt=count(diff.begin(),diff.end(),diff[i]);
    ans=max(ans,cnt);
  }
  cout<<N-ans;
  
}

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

int main(){
  int ab, bc, ca;
  cin >> ab >> bc >> ca;

  int area;
  if( ab >= bc && ab >= ca ){
    area = bc * ca / 2;
  }else if( bc >= ab && bc >= ca ){
    area = ab * ca / 2;
  }else{
    area = ab * bc / 2;
  }
  cout << area;

  return 0;
}


Measured memory_bytes: 256
/*
  Vivek Rathi
  CSE 3rd Year
  MNNIT
  THUMB RULE - THINK FOR DP FIRST AND THEN GREEDY!!!
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define sz(x)	(ll)x.size()
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
#define flush fflush(stdout);
#define endl '\n'
//unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
//shuffle (foo.begin(), foo.end(), std::default_random_engine(seed));
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}
//-------------------------------Template--Above-----------------------------------------------

int main()
{
	boost
	ll n;
	cin>>n;
	ll a[n],pre[n];
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
	pre[n-1]=0;
	for(ll i=n-2;i>=0;i--)
	{
		pre[i]=(a[i+1]+pre[i+1])%M;
	}
	ll sum=0;
	for(ll i=0;i<n;i++)
	{
		sum=(sum+pre[i]*a[i])%M;
	}
	cout<<sum<<endl;
	return 0;
}

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

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		
		int n = Integer.parseInt(reader.readLine());
		
		for(int i = 1; i <= n; i++){
			if(String.valueOf(i).indexOf("3") != -1 ||
			   i % 3 == 0){
				System.out.print(" " + i);
			}
		}
		System.out.println();
		
		reader.close();
	}
}

Measured memory_bytes: 28048
loop do
  x = gets.chomp.to_f
  h = gets.chomp.to_f
  break if x == 0 && h == 0
  answer =  x ** 2 + Math.sqrt((x / 2) ** 2 + h ** 2) * x / 2 * 4
  puts sprintf('%.6f', answer)
end

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

int main() {
    int n;
    scanf("%d",&n);
    vector<vector<int>> v(15,vector<int>(15));
    rep(i,15) {
        rep(j,15) {
            v[i][j] = -1;
        }
    }
    rep(i,n) {
        int a;
        scanf("%d",&a);
        rep(j,a) {
            int x,y;
            scanf("%d%d",&x,&y);
            x--;
            v[i][x] = y;
        }
    }
    int ans = 0;
    for(int i = 0; i < (1 << n); i++) {
        vector<int> d(n,0);
        rep(j,n) {
            if((i >> j) & 1) {
                d[j] = 1;
            }
        }
        bool ok = true;
        rep(j,n) {
            if(d[j] == 1) {
                rep(k,n) {
                    if(v[j][k] == -1) {
                        continue;
                    }
                    if(v[j][k] != d[k]) {
                        ok = false;
                    }
                }
            }
        }
        if(ok) {
            ans = max(ans,__builtin_popcount(i));
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long int
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define F first
#define S second
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));

const ll mod = 1000000007;
const ll AM = 2e5 + 5;

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

ll knapSack(ll W, ll wt[], ll val[], ll n)
{
  ll i, w;
  ll K[n + 1][W + 1];

  // Build table K[][] in bottom up manner
  for (i = 0; i <= n; i++)
  {
    for (w = 0; w <= W; w++)
    {
      if (i == 0 || w == 0)
        K[i][w] = 0;
      else if (wt[i - 1] <= w)
        K[i][w] = MAX(
            val[i - 1] + K[i - 1][w - wt[i - 1]],
            K[i - 1][w]);
      else
        K[i][w] = K[i - 1][w];
    }
  }
  return K[n][W];
}

int main()
{
  Boost;
  ll n;
  ll W;
  cin >> n >> W;
  ll val[n];
  ll wt[n];
  fo(i, 0, n)
  {
    cin >> wt[i] >> val[i];
  }
  cout << knapSack(W, wt, val, n)
       << endl;
}

Measured memory_bytes: 82372
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,a,b,i;
	scanf("%d",&x);
	scanf("%d",&a);
	scanf("%d",&b);
	x-=a;
	a=b;
	for(i=0;;i++)
	{
		if(b>x)
		{
			break;
		}
		b+=a;
	}
	printf("%d",x-(b-a));
	return 0;
} 

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

using namespace std;

int main(){
  string s;
  cin >> s;
  
  for(int i = 0;i < s.size()-1;i++){
    if(s[i] == 'S' && s[i+1] == 'T'){
      s.erase(s.begin()+i);
      s.erase(s.begin()+i);
      //cout << s << endl;
      if(i >= 1){
	i = i - 2;
      }
      else{
	i--;
      }
      if(s.size() == 0){
	break;
      }
    }
  }
  cout << s.size() << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) ((a)<<(b))
#define Rshift(a,b) ((a)>>(b))
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define sz(a) int(a.size())
#define mset(x) memset(x, 0, sizeof(x))
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;


int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll n;
    cin >> n;
    vector<ll> in(n);
    int i;
    rep(i, n) cin >> in[i];
    ll ans(0);
    rep(i, n) ans ^= in[i];
    rep(i, n) {
        cout << (ans ^ in[i]) << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 4772
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>

/*
 *変数
 */
int a;
std::string str;

/*
 *関数
 */
int ctoi(char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

/*
 *解 
 */
void solve(){
  str[a-1]=str[a-1]+ 0x20;
  std::cout<<str;
}

/*
 *入力 
 */
int main(){
       std::cin.tie(0);
       std::ios::sync_with_stdio(false);
       std::cin>>a>>a>>str;
       solve();
       return 0;
}

Measured memory_bytes: 256
void main() {
	auto ip = readAs!(int[]), A = ip[0], B = ip[1], K = ip[2];
	int[] res;
	int i = A;
	while(i <= B && i <= A + K - 1) {
		res ~= i;
		i++;
	}
	i = B;
	while(i >= A && i >= B - K + 1) {
		res ~= i;
		i--;
	}
	res.sort().uniq.each!writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

using namespace std;

int main(){
	
	int n;
	cin >> n;
	
	int a=0;
	
	for(int i=0;i<n;i++){
		
		string h;
		cin >> h;
		
		if(a<0) continue;
		
		if(h=="A") a++;
		else a--;
		
	}
	
	if(a==0) cout << "YES" << endl;
	else cout << "NO" << endl;
	
	return 0;
}


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

class Combination
{
    vector<long long> fact;
    vector<long long> factinv;
    long long MOD = 1e9 + 7;
    long long modpow(long long a, long long n)
    {
        if (n == 0)
            return 1;
        if (n % 2 == 0)
        {
            long long t = modpow(a, n / 2);
            return t * t % MOD;
        }
        return a * modpow(a, n - 1) % MOD;
    }

    long long modinv(long long a)
    {
        // mod is prime
        return modpow(a, MOD - 2);
    }

public:
    Combination(int n) : fact(n), factinv(n)
    {
        fact[0] = 1;
        for (int i = 1; i < n; i++)
        {
            fact[i] = fact[i - 1] * i % MOD;
        }
        factinv[n - 1] = modinv(fact[n - 1]);
        for (int i = n - 2; i >= 0; i--)
        {
            factinv[i] = factinv[i + 1] * (i + 1) % MOD;
        }
    }

    long long ncr(long long n, long long r)
    {
        if (r < 0 || r > n)
            return 0;
        return fact[n] * factinv[r] % MOD * factinv[n - r] % MOD;
    }

    long long npr(long long n, long long r)
    {
        if (r < 0 || r > n)
            return 0;
        return fact[n] * factinv[n - r] % MOD;
    }

    long long nhr(long long n, long long r)
    {
        if (n == 0 && r == 0)
            return 1;
        return ncr(n + r - 1, r);
    }
};

int main()
{
    int n;
    cin >> n;
    Combination comb(n + 10);
    map<int, vector<int>> m;
    int id = 0;
    rep(i, n + 1)
    {
        int x;
        cin >> x;
        m[x].push_back(i + 1);
        if (m[x].size() == 2)
        {
            id = x;
        }
    }
    long long int mod = 1e9 + 7;
    for (int i = 1; i <= n + 1; i++)
    {
        cout << (comb.ncr(n + 1, i) + mod - comb.ncr(m[id][0] + n - m[id][1], i - 1)) % mod << endl;
    }
}


Measured memory_bytes: 13696
#include<algorithm>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<iostream>
#include<istream>
#include<map>
#include<math.h>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
using namespace std;
int n,a[100],b[100],ans;
int main(){
	cin>>n;
	for (int i=0;i<n;i++) cin>>a[i];
	for (int i=0;i<n;i++) cin>>b[i];
	for (int i=0;i<n;i++) if (a[i]>b[i]) ans+=a[i]-b[i];
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)

lli data[400][400];
lli flag[400][400];

int main(){

	lli h,w;
	cin>>h>>w;
	REP(i,0,h)REP(j,0,w){
		char tmp;
		cin>>tmp;
		if(tmp=='.')data[i][j]=0;
		else data[i][j] = 1;
	}

	REP(i,0,h)REP(j,0,w)flag[i][j]=0;

	lli ans=0;
	REP(i,0,h)REP(j,0,w){
		if(data[i][j]==1 && flag[i][j]==0){
			queue<lli> qi,qj;
			qj.push(j);
			qi.push(i);
			flag[i][j]=1;

			lli wCnt=0;
			lli bCnt=0;

			while(qi.size()){
				lli topI = qi.front();
				lli topJ = qj.front();
				qi.pop();
				qj.pop();
				
				if(data[topI][topJ]==1)bCnt++;
				else wCnt++;

				lli di[4]={-1,0,1,0};
				lli dj[4]={0,1,0,-1};

				REP(k,0,4){
					lli nextI = topI+di[k];
					lli nextJ = topJ+dj[k];
					if(nextI<0 || h<=nextI || nextJ<0 || w<=nextJ)continue;

					if(flag[nextI][nextJ]==0 && data[topI][topJ] != data[nextI][nextJ]){
						flag[nextI][nextJ]=1;
						qi.push(nextI);
						qj.push(nextJ);
					}
				}
			}
			ans += (wCnt*bCnt);
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
 
int main(){
  int K,X;
  cin>>K>>X;
  
  if(X-K<-1000000){
    for(int i=-1000000;i<X;i++){
      cout<<i<<" ";
    }
    for(int i=X;i<X+K;i++){
      cout<<i<<" ";
    }
  }
  else if(X+K>1000000){
    for(int i=X-K+1;i<K;i++){
      cout<<i<<" ";
    }
    for(int i=X;i<=1000000;i++){
      cout<<i<<" ";
    }
  }
  else{
    for(int i=X-K+1;i<X+K;i++){
      cout<<i<<" ";
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    cout << (s < t ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
n,m = map(int,raw_input().split())

arr = []

for i in range(n):
	arr.append(i)

def root(i):
	t = i
	while arr[t] != t:
		t = arr[t]

	return t

for i in range(m):
	query,x,y = map(int,raw_input().split())

	if query == 0:
		if root(y) == root(x):
			next 
		else :
			arr[root(y)] = root(x)

	else :
		print 1 if root(x) == root(y) else 0


Measured memory_bytes: 7996
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sidha(i,a,b) for(int i=a;i<b;i++)
#define vi vector<int> 
#define pb push_back
#define st string
#define pairi pair<int,int>

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
		string s;cin>>s;
		int x=0;
		sidha(i,0,s.size()){
			x+=(s[i]-'0');
		}
		if(x%9==0){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
}

Measured memory_bytes: 3728
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

d,t,s = readInts()

if d<=t*s:
	print("Yes")
else:
	print("No")

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

const int MOD = (int)1e9 + 7;
int N, M;
vector<int> F;

void input_init(void) {
	cin >> N >> M;
	F.resize(N + 1, -1);
	for (int i = 0; i < M; ++i) {
		int a;
		cin >> a;
		F[a] = 0;
	}
	F[0] = 1;
	if (F[1] != 0)
		F[1] = 1;
}

void solve(void) {
	for (int i = 2; i <= N; ++i) {
		if (F[i] == 0)
			continue;
		F[i] = (F[i - 1] + F[i - 2]) % MOD;
	}
}

int main(void) {
	input_init();
	solve();

	int ans = F[N];
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 768
import sys
import copy
import  math
import bisect
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
aaa = na()
s = aaa[0]
a = sum(aaa) - s
ans = abs(a - s)
for i in range(1, n-1):
    s += aaa[i]
    a -= aaa[i]
    ans = min(ans, abs(a - s))
print(ans)

Measured memory_bytes: 24308