akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import static java.lang.System.*;
public class Main {
    public static void main(String[]$) {
        Scanner sc = new Scanner(in);
        int sx=sc.nextInt();
        int sy=sc.nextInt();
        int tx=sc.nextInt();
        int ty=sc.nextInt();
        for (int i = 0; i <tx-sx ; i++) {
            out.print("R");
        }
        for (int i = 0; i <ty-sy ; i++) {
            out.print("U");
        }
        for (int i = 0; i <tx-sx ; i++) {
            out.print("L");
        }
        for (int i = 0; i <ty-sy ; i++) {
            out.print("D");
        }
        out.print("D");
        for (int i = 0; i <tx-sx+1 ; i++) {
            out.print("R");
        }
        for (int i = 0; i <ty-sy+1 ; i++) {
            out.print("U");
        }
        out.print("L");
        out.print("U");
        for (int i = 0; i <tx-sx+1; i++) {
            out.print("L");
        }
        for (int i = 0; i <ty-sy+1 ; i++) {
            out.print("D");
        }
        out.println("R");
    }
}

Measured memory_bytes: 24768
#include<stdio.h>
int main()
{
	int n,tempt,i=0;
	scanf("%d",&n);
	int t[n];

	for(i = 0;i < n;i++)
	{
		scanf(" %d",&tempt);
		t[tempt-1]=i+1;
	}

	for(i = 0;i < n;i++)
	{
		printf("%d\t",t[i]);
	}
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
using namespace std;
int main(void){
    int E,Y;
    
    cin >> E >> Y;
    if(E == 0){
        if(Y >= 1989){
            cout << "H" <<  Y - 1988 << endl;
        }else if(Y >= 1926){
            cout << "S" << Y - 1925 << endl;
        }else if(Y >= 1912){
            cout << "T" << Y - 1911 << endl;
        }else{
            cout << "M" << Y - 1867 << endl;
        }
    }else if(E == 1){
        cout << Y + 1867 << endl;
    }else if(E == 2){
        cout << Y + 1911 << endl;
    }else if(E == 3){
        cout << Y + 1925 << endl;
    }else{
        cout << Y + 1988 << endl;
        }
}


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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

bool* PrimeSieve(int n) {
  bool*s = new bool[n];
  for (int i = 0; i < n; ++i) s[i] = true;
  s[0] = s[1] = false;
  for (int i = 2; i < n; ++i)
    if (s[i]) for (int j = i << 1; j < n; j += i) s[j] = false;
  return s;
}

const int N = 123456 * 2 + 2;

int main() {

  auto ps = PrimeSieve(N);

  for (int n; cin >> n, n; ) {
    int cx = 0;
    range (m, n + 1, 2 * n + 1) if (ps[m]) ++cx;
    cout << cx << endl;
  }

  return 0;
}

Measured memory_bytes: 1424
a = fromEnum 'a'
z = fromEnum 'z'
f k [x] = [a+(x-a+k)`mod`(z-a+1)]
f k (x:xs) 
  | x/=a && l>=0 = a : f l xs
  | otherwise = x : f k xs
  where l = k-(z-x+1)
main = do
  s <- getLine
  k <- fmap read getLine
  putStrLn $ map toEnum $ f k $ map fromEnum s

Measured memory_bytes: 5116
#include <stdio.h>
#include <math.h>
#define sq(x) (x)*(x)
int main(void)
{
	int n,i;
	double xa,ya,ra,xb,yb,rb;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);
		if((sq(xa-xb)+sq(ya-yb))<sq(rb-ra))
		{
			if(ra>rb)
			{
				printf("2\n");
				continue;
			}
			if(rb>ra)
			{
				printf("-2\n");
				continue;
			}
		}
		if((sq(xa-xb)+sq(ya-yb))<=sq(ra+rb))
		{
			printf("1\n");
			continue;
		}
		printf("0\n");
	}
	return 0;
}

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

/*

POJ2503
AtCoder Regular Contest 068 A
AtCoder Regular Contest 068 B
51nod1307
AtCoder Regular Contest 068 C
Codeforces 760
*/

const int N=1e5+10;
int num[N];
int main()
{
    int n,x;
    scanf("%d",&n);
    memset(num,0,sizeof(num));
    for(int i=0;i<n;i++)
    {
        scanf("%d",&x);
        num[x]++;
    }
    int sum=0;
    for(int i=1;i<=100000;i++)
        if(num[i])
            sum=sum+num[i]-1;
    if(sum%2)
        sum++;
    printf("%d\n",n-sum);
    return 0;
}


Measured memory_bytes: 640
while 1:
    a, L = map(int, raw_input().split())
    if a == L == 0:
        break
    def f(a):
        num = str(a)
        num += "0"*(L - len(num))
        num = sorted(num)
        return int("".join(num[::-1])) - int("".join(num))

    # Floyd's cycle-finding algorithm
    b = c = a
    while 1:
        b = f(b); c = f(f(c))
        if b == c: break
    b = a
    j = 0
    while b != c:
        j += 1
        b = f(b); c = f(c)
    i = 0
    while 1:
        i += 1
        b = f(b)
        if b == c: break
    print j, b, i

Measured memory_bytes: 6472
n=gets.to_i
if n==0
  puts 0
  exit
end
f=true
s=""
while n!=0
  if n%2==1
    s << "1"
    if f
      n-=1
    else
      n+=1
    end
  else
    s << "0"
  end
  n/=2
  f=!f
end
puts s.reverse


Measured memory_bytes: 14224
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout<< #x" " << x << endl;
long long n;
string s;
long long call(long long pos,long long sum,long long prev)
{
    if(pos==n)
    return sum+prev;

    long long in = s[pos]-'0';
    in+=prev*10;
    long long c1=call(pos+1,sum,in);

    if(pos!=n-1)
     c1+=call(pos+1,sum+in,0);
    return c1;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> s;
    n=s.size();
    long long x=call(0,0,0);
    cout<< x<<endl;
    return 0;
}


Measured memory_bytes: 256
if __name__ == "__main__":
    k, n = map(int, input().split())
    k = int(k)
    n = int(n)
    a = list(map(int, input().split()))
    ans = float('inf')

    for start in range(n):
        tmp = 0
        if start == 0:
            tmp = a[-1] - a[start]
        else:
            tmp = k - (a[start] - a[start - 1])
        if ans > tmp:
            ans = tmp

    print(ans)

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

using namespace std;


void minimization()
{
  int n, k;
  cin >> n >> k;

  cout << ceil((float)(n - 1) / (float)(k - 1)) << "\n";
}


void linear_approximation()
{
  int n;
  cin >> n;
  vector<int> b(n);
  for (int i = 0; i < n; ++i)
  {
    int a;
    cin >> a;
    b[i] = a - (i + 1);
  }

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

  int mid = b[n / 2];
  long long int ans = 0;
  for (int i = 0; i < n; ++i) ans += abs(mid - b[i]);
  cout << ans << "\n";

}


void modulo_summation()
{
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    ans += a - 1;
  }

  cout << ans << "\n";
}


//skip
void all_green()
{
  int d, g;
  cin >> d >> g;
  vector<int> p(d);
  vector<int> c(d);
  for (int i = 0; i < d; ++i) cin >> p[i] >> c[i];


}


void base_2_number()
{
  int n;
  cin >> n;

  string s = "";
  if (n == 0) s = '0' + s;
  while (n != 0)
  {
    if (n % 2 != 0)
    {
      --n; //-２進数の整合性
      s = '1' + s;
    }
    else
    {
      s = '0' + s;
    }
    n /= -2;
  }

  cout << s << "\n";
}


void to_infinity()
{
  string s;
  long long int k;
  cin >> s >> k;

  char digit = '1';
  for (int i = 0; i < k; ++i)
  {
    if (s[i] != '1')
    {
      digit = s[i];
      break;
    }
  }
  cout << digit << "\n";
}


void candles()
{
  int n, k;
  cin >> n >> k;
  vector<long long int> x(n);
  for (int i = 0; i < n; ++i) cin >> x[i];

  long long int ans = 100000000000000000;
  for (int i = 0; i < n - k + 1; ++i)
  {
    long long int tmp = abs(x[i + k - 1] - x[i])+ min(abs(x[i]), abs(x[i + k - 1]));
    ans = min(ans, tmp);
  }

  cout << ans << "\n";
}


void triangular_relationship()
{
  int n, k;
  cin >> n >> k;

  if (k % 2 != 0)
  {
    long long int a = n / k;
    cout << a * a * a << "\n";
  }
  else
  {
    long long int a = n / k;
    long long int b = 2 * n / k;
    cout << a * a * a + (b - a) * (b - a) * (b - a) << "\n";
  }
}


int main()
{
  //minimization();
  //linear_approximation();
  //modulo_summation();
  //all_green();
  //base_2_number();
  //to_infinity();
  //candles();
  triangular_relationship();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD = 1000000007;
int dx[] = {1,0,-1,0};
int dy[] = {0,-1,0,1};

int main(){
    ll N,T;
    cin >> N >> T;
    vector<ll> lst(N);
    for(int i=0;i<N;i++) cin >> lst[i];
    ll ans = T;
    for(int i=0;i<N-1;i++){
        ans += min(T,lst[i+1]-lst[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include<stdio.h>
#define N 100
int main()
{
  int a[N],i,j,n,b,c=0,d=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);

  for(i=0;i<n;i++){
    b=a[i];
    for(j=i+1;j<n;j++){
      if(b>a[j]){
	b=a[j];
	c=j;
      }
    }
    if(a[i]!=b){
    a[c]=a[i];
    a[i]=b;
    d++;
    }
  }
  for(i=0;i<n-1;i++)
    printf("%d ",a[i]);
  printf("%d\n%d\n",a[n-1],d);
  return 0;
}
  
    
	



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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    cout << (a == 'H' ? b : (b == 'H') ? 'D' : 'H') << endl;
    return 0;
}


Measured memory_bytes: 3524
#include<bits/stdc++.h>
using namespace std;
#define N 1111116
#define mod 1000000007
#define next nxt

int n,x[N],y[N],z[N],next[N],p[N],h[N],q[N],f[N],g[N],s[N],cnt,cmt,cir;
long long fac[N],inv[N],ans;
vector<int> v[N];

long long C(int x,int y){
	return fac[x]*inv[y]%mod*inv[x-y]%mod;
}

void travel(int x,int pre){
	h[x]=true;q[++cnt]=x;
	for (int t=p[x];t;cmt++,t=next[t])
		if (!h[y[t]]) travel(y[t],t);
		else if (t/2!=pre/2) cir=t;
}

void build(int x){
	for (int t=p[x];t;t=next[t])
		if (y[t]!=g[x]){
			if (y[t]<g[x]) v[x].push_back(y[t]),f[y[t]]=true;
			if (t/2!=cir/2) g[y[t]]=x,build(y[t]);
		}
}

long long solve(int x){
	s[x]=0;long long ans=1;
	for (int i=0;i<(int)v[x].size();i++){
		ans=ans*solve(v[x][i])%mod;
		s[x]+=s[v[x][i]];
		ans=ans*C(s[x],s[v[x][i]])%mod;
	}
	s[x]++;return ans;
}

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-')  f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	n=read();
	for (int i=1;i<=2*n;i++){
		x[2*i]=y[2*i+1]=read();
		y[2*i]=x[2*i+1]=n+read();
		z[2*i]=z[2*i+1]=x[2*i]+y[2*i];
		next[2*i]=p[x[2*i]];p[x[2*i]]=2*i;
		next[2*i+1]=p[x[2*i+1]];p[x[2*i+1]]=2*i+1;
	}
	fac[0]=fac[1]=inv[0]=inv[1]=1;
	for (int i=2;i<N;i++) fac[i]=fac[i-1]*i%mod;
	for (int i=2;i<N;i++) inv[i]=-(mod/i)*inv[mod%i]%mod;
	for (int i=2;i<N;i++) inv[i]=inv[i-1]*inv[i]%mod;
	ans=fac[2*n];
	for (int i=1;i<=2*n;i++)
		if (!h[i]){
			cnt=cmt=0;travel(i,0);
			if (cmt!=cnt*2) {printf("0\n");return 0;}
			
			v[0].clear();
			for (int i=1;i<=cnt;i++)
				v[q[i]].clear(),g[q[i]]=0,f[q[i]]=false;
			g[x[cir]]=y[cir];build(x[cir]);
			for (int i=1;i<=cnt;i++)
				if (!f[q[i]]) v[0].push_back(q[i]);
			long long tmp=solve(0);
			
			v[0].clear();
			for (int i=1;i<=cnt;i++)
				v[q[i]].clear(),g[q[i]]=0,f[q[i]]=false;
			g[y[cir]]=x[cir];build(y[cir]);
			for (int i=1;i<=cnt;i++)
				if (!f[q[i]]) v[0].push_back(q[i]);
			tmp+=solve(0);
			
			ans=ans*tmp%mod*inv[cnt]%mod;
		}
	printf("%lld\n",(ans+mod)%mod);
	return 0;
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    ll x;
    cin>>x;
    int a,b;
    for(a=-1000;a<=1000;a++)
    {
        for(b=-1000;b<=1000;b++)
        {
            ll t1=power(a,5ll);
            ll t2=power(b,5ll);
            if((t1-t2)==x)
            {
                cout<<a<<" "<<b<<'\n';
                return 0;
            }
        }
    }

}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!


Measured memory_bytes: 3652
L=input()
n=len(L)
mod=10**9+7
dp1=[0]*(n+1)
dp2=[0]*(n+1)

dp1[0]=1

for i in range(n):
    if L[i]=='1':
        dp1[i+1]=2*dp1[i]
        dp2[i+1]=dp1[i]+dp2[i]*3
    else:
        dp1[i+1]=dp1[i]
        dp2[i+1]=dp2[i]*3
    dp1[i+1]%=mod
    dp2[i+1]%=mod
print((dp1[-1]+dp2[-1])%mod)

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

template <ll ModVal>
struct ModInt {
  ll x;

  ModInt(ll _x = 0) : x((_x % ModVal + ModVal) % ModVal) {
  }

  ModInt operator-() const {
    return ModInt(-x);
  }
  ModInt& operator+=(const ModInt a) {
    x += a.x;
    if (x >= ModVal)
      x -= ModVal;
    return *this;
  }
  ModInt& operator-=(const ModInt a) {
    x = x + ModVal - a.x;
    if (x >= ModVal)
      x -= ModVal;
    return *this;
  }
  ModInt& operator*=(const ModInt a) {
    x *= a.x;
    x %= ModVal;
    return *this;
  }

  ll ext_gcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
      x = 1;
      y = 0;
      return a;
    }
    ll tmp = a / b;
    ll d = ext_gcd(b, a - b * tmp, y, x);
    y -= tmp * x;
    return d;
  }

  // 逆元
  ModInt inv() {
    ll u, v;
    ext_gcd(x, ModVal, u, v);
    return ModInt(u);
  }

  ModInt inv(const ModInt a) {
    ll u, v;
    ext_gcd(a.x, ModVal, u, v);
    return ModInt(u);
  }

  ModInt& operator/=(const ModInt a) {
    return (*this) *= inv(a);
  }

  ModInt operator+(const ModInt a) const {
    ModInt retval(*this);
    return retval += a;
  }
  ModInt operator-(const ModInt a) const {
    ModInt retval(*this);
    return retval -= a;
  }
  ModInt operator*(const ModInt a) const {
    ModInt retval(*this);
    return retval *= a;
  }
  ModInt operator/(const ModInt a) const {
    ModInt retval(*this);
    return retval /= a;
  }

  ModInt pow(ll n) {
    ModInt ans(1);
    while (n) {
      if (n & 1)
        ans = ans * x;
      *this = (*this) * (*this);
      n = n >> 1;
    }
    return ans;
  }

  constexpr const ll& value() {
    return this->x;
  }
};

template <ll ModVal>
ostream& operator<<(ostream& os, const ModInt<ModVal>& a) {
  os << a.x;
  return os;
}

using mint = ModInt<mod>;

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

  ll n, k;
  cin >> n >> k;

  vll a(n);
  rep(i, n) {
    cin >> a[i];
  }

  vector<mint> dp(k + 1);
  dp[0] = 1;

  for (auto mx : a) {
    vector<mint> sum(k + 1);
    sum[0] = dp[0];
    REP(i, k + 1) {
      sum[i] = sum[i - 1] + dp[i];
    }
    rep(i, k + 1) {
      if (i - 1 >= 0) {
        dp[i] += sum[i - 1];
      }
      if (i - 1 - mx >= 0) {
        dp[i] -= sum[i - 1 - mx];
      }
    }
  }

  cout << dp[k] << endl;

  return 0;
}


Measured memory_bytes: 1792
function main(input){
    let lines = input.split("\n");
    let sLength = parseInt(lines[0]);
    let s = lines[1].split(" ");
    let tLength = parseInt(lines[2]);
    let t = lines[3].split(" ");
    let count = 0;
    
    for(let i=0;i<tLength;i++){
        s[sLength] = t[i];
        let j =0;
        while(s[j]!==t[i]){
            j++;
        }
        if(j!==sLength) count++;

        
    }
    console.log(count);
    
    
    
    
}



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


Measured memory_bytes: 17012
#include <iostream>
using namespace std;
int main() {
	int A,B,cnt=0;
	cin >> A >> B;

	for (int i = A;i <= B;i++) {
		if ((i / 10000 == i % 10) && (i % 10000 / 1000) == (i % 100 / 10))
			cnt++;
	}

	cout << cnt << endl;

	return 0;
}

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

void solve(){
  int a, b; cin >> a >> b;
  string s; cin >> s;
  int i;
  for(i = 0; i <= a + b; i++){
    if(i == a){
      if(s[i] != '-') break;
    }
    else if(s[i] == '-') break;
  }
  if(i == a + b + 1) cout << "Yes\n";
  else cout << "No\n";
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int n;
bool sosu(ll x){
    for(ll i=2;i<=sqrt(x);i++){
        if(x%i==0){
            return 0;
        }
    }
        return 1;
}
int main(){
    ll x;
    cin>>x;
    ll count=0;
    while(1){
        if(sosu(x+count)==1){
            cout<<x+count<<endl;
            return 0;
        }
        count++;
    }
        return 0;
}




Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    string s;
    cin >> s;
    int cnt = 0;
    for(int i = 0; i < 4; i++){
        if(s[i] == '+') cnt++;
        else if(s[i] == '-') cnt--;
    }
    cout << cnt << endl;
    return 0;
}

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

int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
int a,b,c;
cin>>a>>b>>c;
if(a*a==b*b+c*c)
cout<<"YES\n";
else if(b*b==a*a+c*c)
cout<<"YES\n";
else if(c*c==a*a+b*b)
cout<<"YES\n";
else cout<<"NO\n";
}
return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
using namespace std;

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&a!=c||a==c&&a!=b||c==b&&a!=c){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

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

int N;
long long A,B;
int h[100000];

bool pos(int t)
{
	long long tot = 0;
	for(int i=0;i<N;i++)
	{
		if(h[i] > B*t)
			tot += (h[i]-B*t+A-1-B)/(A-B);
	}
	return tot <= t;
}

int main()
{
	cin >> N >> A >> B;
	for(int i=0;i<N;i++)
		cin >> h[i];
	int low = 1;
	int high = 1000000000;
	while(low != high)
	{
		int mid = (low+high)/2;
		if(pos(mid)) high = mid;
		else low = mid+1;
	}
	cout << low << '\n';
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
#define reps(i,n) for(ll i=1;i<=(n);++i)
using ll = long long;
using str = string;
constexpr long long INF = (1LL<<60);
constexpr long long MOD = (1e9+7);
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);}
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;}

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

  ll n;
  cin>>n;
  vector<ll> a(n);
  cin>>a;

  bool zero=false;
  rep(i,n)if(a[i]==0)zero=true;
  bool three=false;
  map<ll,ll> mp;
  rep(i,n)mp[a[i]]++;
  rep(i,n)if(mp[a[i]]>=3)three=true;
  if(zero || three){
    cout<<(0)<<endl;
    return 0;
  }
  if(n==1){
    cout<<min(a[0],24-a[0])<<endl;
    return 0;
  }
  
  sort(a.begin(),a.end());
  set<ll> s={0,24};
  rep(i,n){
    if(i&1)s.insert(a[i]);
    else s.insert(24-a[i]);
  }
  auto itr=s.begin();
  ll ans=INF;
  while(*itr!=24){
    auto next=itr;
    next++;
    chmin(ans,*next-*itr);
    itr++;
  }
  cout<<(ans)<<endl;


}


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

using namespace std;

typedef long long int lli;

// ####################
//  Calc nCr
// ####################
const lli MAX = 1000000;
const lli MOD = 1000000007;

lli fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void NCRinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
lli NCR(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// ####################
//  Calc nCr END
// ####################

int main() {
    int n, m;
    vector<int> beki;

    cin >> n >> m;

    int div = 2, cont = 0, M = m;
    while (M != 1 && div*div <= m) {
        if (M%div == 0) {
            cont++;
            M /= div;
        }
        else {
            if (cont > 0) beki.push_back(cont);
            cont = 0;
            div++;
        }
    }
    beki.push_back(cont);
    if (M != 1) beki.push_back(1);

    long long int ans = 1;
    NCRinit();
    for (auto e : beki) {
        ans *= NCR(e+n-1, e);
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
  char a, b;
  in2(a, b);
  ll h = 0;
  if(a == '9')
    h++;
  if(b == '9')
    h++;
  if(h)
    out("Yes");
  else
    out("No");
  memi;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int ans = 0;
        for(int i=1; i<n-1; i++){
            int cnt = 0;
            for(char c = 'a'; c<='z'; c++){
                if(s.substring(0,i).contains(String.valueOf(c)) && s.substring(i).contains(String.valueOf(c))){
                    cnt++;
                }
            }
            ans = Math.max(ans,cnt);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define mod 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);


int main()
{
	// cout<<INT_MAX;
	fast
	ll n;
	cin>>n;
	ll h=0;
	ll p=n/500;
	h+=p*1000;
	n-=(p*500);
	p=n/5;
	h+=(p*5);
	n-=p;
	cout<<h;
}

Measured memory_bytes: 256
/*
    ThunderClap and Flash.
    Raunaq Singh
*/
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod)*(b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

ll a[110][110];
ll dp[110][110][3];

ll findAns(ll i, ll j, ll prevCol, ll n, ll m){
    if(i==(n-1) && j==(m-1)){
        if(prevCol==1){
            return 0;
        }else{
            return a[i][j];
        }
    }
    if(i==n || j==m){
        return inf;
    }
    if(dp[i][j][prevCol]!=-1){
        return dp[i][j][prevCol];
    }
    ll ret=inf;
    if(prevCol==1){
        ret=min(findAns(i+1,j,a[i][j],n,m),findAns(i,j+1,a[i][j],n,m));
    }else{
        ret=min(findAns(i+1,j,a[i][j],n,m)+(a[i][j]!=prevCol),findAns(i,j+1,a[i][j],n,m)+(a[i][j]!=prevCol));
    }
    return dp[i][j][prevCol]=ret;
}

void Flash(){
    ll n,m;
    cin>>n>>m;
    char c;
    for(ll i=0;i<n;i++){
        for(ll j=0;j<m;j++){
            cin>>c;
            if(c=='.'){
                a[i][j]=0;
            }else{
                a[i][j]=1;
            }
        }
    }
    memset(dp,-1,sizeof(dp));
    ll ans=min(findAns(0,0,0,n,m),findAns(0,0,1,n,m)+1);
    cout<<ans<<"\n";
}

int main(int argc, char const *argv[]){
    ThunderClap;
    ll t=1;
    //cin>>t;
    for(ll i=1;i<=t;i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}

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

int main(void) {
  int N, K;
  cin >> N >> K;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  for (int i = K; i < N; i++) {
    if (A[i - K] < A[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 4800
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s1[3]={};
    scanf("%s",s1);
    int i,n=strlen(s1);

    if(s1[0]=='A'&&s1[1]=='B'&&s1[2]=='C')
    {
        printf("ARC");
    }
    else if(s1[0]=='A'&&s1[1]=='R'&&s1[2]=='C')
    {
        printf("ABC");
    }
}

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

template<class T, class Func = function<T(T,T)>>
class CumulativeSum{
public:
    vector<T>sum;
    T e;
    CumulativeSum(const vector<T>v,T e,const Func& f = [](T a, T b){return a + b;}) : sum(v.size()),e(e){
        copy(v.begin(),v.end(),sum.begin());
        T past = 0;
        for(auto & itr : sum){
            itr = f(itr,past);
            past = itr;
        }
    }
    //[l,r)
    auto query(int l, int r, const Func& f = [](T a,T b){return a - b;}){
        if(r > 0) return f(sum[r - 1],(l == 0 ? e : sum[l - 1]));
        else return e;
        
    }
    auto begin(){
        return sum.begin();
    }
    auto end(){
        return sum.end();
    }
    auto& operator[] (int idx){
        return sum[idx];
    }
};
int main(){
    long long N,M,K;
    cin >> N >> M >> K;
    vector<long long>a(N),b(M);
    for(auto& e : a) cin >> e;
    for(auto& e : b) cin >> e;
    auto asum = CumulativeSum<long long>(a,0LL);
    auto bsum = CumulativeSum<long long>(b,0LL);
    long long ans = 0;
    for(long long i = 0; i <= N; ++i){
        long long tmp  = asum.query(0,i);
        if(tmp > K) continue;
        ans = max(ans,i);
        long long dif = K - tmp;
        auto itr = upper_bound(bsum.sum.begin(), bsum.sum.end(),dif);
        if(itr == bsum.sum.begin()) continue;
        itr = prev(itr);
        ans = max(ans, i + distance(bsum.sum.begin(),itr) + 1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 10924
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		int n = sc.nextInt();
		Integer[] l = new Integer[n];
		int ans1 =x;
		int ans2 =x;
		for(int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
		}
		
			if(Arrays.asList(l).contains(x)) {
				ans1--;
				ans2++;
			}
			
		while(true) {
			if(Arrays.asList(l).contains(ans1)) {
				ans1--;
			} else {
				break;
			}
		}
			
		while(true) {
			if(Arrays.asList(l).contains(ans2)) {
				ans2++;
			} else {
				break;
			}
		}
			
			
		
		int a1 = Math.abs(x-ans1);
		int a2 = Math.abs(x-ans2);
		
		if(a1 == a2) {
			System.out.println(ans1);
		} else if(a1 > a2) {
			System.out.println(ans2);
		} else {
			System.out.println(ans1);
		}

		//String s = sc.next();
		//long n = sc.nextLong();
		//double n = sc.nextDouble();
		
		//for(int i = 0; i < ; i++)

		//System.out.println("Yes");
		//System.out.println("No");
		

	}
}


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

int main(void){
    int A, B;
    while(true){
        cin >> A >> B;
        if (A == 0 && B == 0) break;
        if (A > B) cout << B << " " << A << endl;
        else cout << A << " " << B << endl;
    }
    
    return 0;
}



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

int T;
int n;
int ti[101];
int d[101];
int dp[101][31];
int finD;

const int INF=1000000000;
int main(){
	while(cin>>T&&T){
		for(int i=0;i<T;i++)cin>>ti[i];
		cin>>n;
		memset(dp,-1,sizeof(dp));
		memset(d,-1,sizeof(d));
		finD=0;
		for(int i=0;i<n;i++){
			int da,m;
			cin>>da>>m;
			finD=max(finD,da);
			if(d[da]==-1)d[da]=m;
			else d[da]=min(d[da],m);
		}
		for(int i=0;i<31;i++)dp[finD+1][i]=0;
		for(int i=finD;i>=0;i--){
			for(int j=0;j<T;j++){
				dp[i][j]=INF;
				dp[i][j]=min(dp[i][j],dp[i+1][1%T]+1);
				if(d[i]==-1||d[i]>=ti[j])dp[i][j]=min(dp[i][j],dp[i+1][(j+1)%T]);
			}
		}
		int res=dp[1][0];
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long int ll;
int prime(ll n)
{
    for (int i = 2; (ll)i * i <= n; i++)
    {
        if (n % i == 0)
            return 0;
    }
    return 1;
}
int main()
{
    ll n;
    cin >> n;
    if (prime(n))
    {
        cout << n - 1 << endl;
    }
    else
    {
        ll a, b;
        ll temp = sqrt(n);
        for (ll i = temp; i >= 1; i--)
        {
            if (n % i == 0)
            {
                a = i;
                b = n / i;
                break;
            }
        }
        cout << a + b - 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int>e[1000001];
int a[1000001];
int in[1000001];
char s[1000001];
signed main() 
{
	cin>>s+1;
	int n=strlen(s+1)+1;
	for(int i=1;i<n;i++)
		if(s[i]=='<')
			e[i].push_back(i+1),in[i+1]++;
		else 
			e[i+1].push_back(i),in[i]++;
	queue<int>q;
	for(int i=1;i<=n;i++)
	{
		if(in[i]==0)
			q.push(i);
	}
	long long ans=0;
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		ans+=a[u];
		for(int i=0;i<e[u].size();i++)
		{
			int to=e[u][i];
			a[to]=a[u]+1;
			in[to]--;
			if(in[to]==0)
				q.push(to);
		}
	}
	printf("%lld",ans);
	return 0;
}

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


int main() {
	long long int D, N;
	long long int ans = 0;
	cin >> D >> N;
	if (D == 0) {
		if (N != 100) {
			ans = N;
		}
		else ans = 101;
	}
	else if (D == 1) {
		if (N != 100) {
			ans = 100 * N;
		}
		else ans = 10100;
	}
	else if (D == 2) {
		if (N != 100) {
			ans = 10000 * N;
		}
		else ans = 1010000;
	}
	cout << ans << endl;

	return 0;
}


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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

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

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }
// }}} End

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

  VAR(int, N);

  vector<int> L(N), R(N);
  vector<int> a(N);
  rep(i, N) {
    IN(a[i]);
    if (!i) L[i] = a[i];
    else L[i] = __gcd(L[i-1], a[i]);
  }

  for (int i = N - 1; i >= 0; --i) {
    if (i == N - 1) R[i] = a[i];
    else R[i] = __gcd(R[i+1], a[i]);
  }

  int maxv = 0;
  rep(i, N) {
    if (!i) chmax(maxv, R[i+1]);
    else if (i == N - 1) chmax(maxv, L[i-1]);
    else chmax(maxv, __gcd(L[i-1], R[i+1]));
  }

  OUTL(maxv);

  return 0;
}


Measured memory_bytes: 1408
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int MAxn = 2e5 + 5;
const int MA_N = 5e3 + 5;

int vis[MAxn] = {0};

bool cmp(int a, int b){
	return a > b;
}

int main(){
	int n;
	while(cin >> n){
		int cnt = 0, x, a[MAxn] = {0};
		for (int i = 1; i <= n; i++){
			cin >> x;
			a[x]++;
			a[x-1]++;
			a[x+1]++;
		}
		sort(a, a+MAxn, cmp);
		cout << a[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
template <class Q>
void clearQueue(Q & q) {
    q = Q();
}
void solve(){
	int n;cin>>n;
	vector<int>h(n);
	for(int i=0;i<n;i++) cin>>h[i];
	int dp[n];
//	memset(dp,0,sizeof(dp));
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
	}
//	for(int i=0;i<n;i++) cout<<dp[i]<<" ";
	cout<<dp[n-1];
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL); 
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 4760
#include <bits/stdc++.h>
using namespace std;
int main () {
  int A, B, C;
  cin >> A >> B >> C;
  int flag = 0;
  for(int i = 0; i < 100; i++) {
    if (A * (i + 1) % B == C) flag = 1;
  }
  if(flag == 1)cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())

s = [0 for i in range(N+2)]
mod = 10**9+7
#s[i]:i個選んだ時の総和
for k in range(N+2):
    a = (k-1)*k/2
    b = (N+N-k+1)*k/2
    s[k] = b-a+1

#ss[i+1]:i個までの個数の総和
ss = [0 for i in range(N+2)]
for i in range(N+1):
    ss[i+1] = ss[i] + s[i] 

ans = int(ss[N+1]-ss[K]) % mod  
print(ans+1)

Measured memory_bytes: 24632
#include<stdio.h>
int main(){
        int a,h,m,s;
        scanf("%d", &a);
        h = a/3600 ;
        m = (a-3600*h)/60 ;
        s = a-(3600*h+60*m) ; 
        printf("%d:",h);
        printf("%d:",m);
        printf("%d\n",s);
        return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
int main()
{
    ll n,k;
    cin>>n>>k;
    if(n%k==0)
    {
        cout<<"0"<<endl;
    }
    else
    {
        cout<<min((n%k),(k-(n%k)))<<endl;
    }
return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
read = sys.stdin.read


N = int(readline())
graph = [[] for _ in range(N + 1)]

for i in readlines():
    u, v, w = map(int, i.split())
    graph[u].append((v, w))
    graph[v].append((u, w))

stack = [1]
parent = [0] * (N + 1)
color = [0] * (N + 1)

while stack:
    here = stack.pop()
    for x, w in graph[here]:
        if x == parent[here]:
            continue
        parent[x] = here
        color[x] = color[here] ^ (w % 2)
        stack.append(x)

for i in color[1:]:
    print(i)

Measured memory_bytes: 44992
#include <iostream>

using namespace std;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  while ( true )
  {
    bool  init = true;
    int   D;

    if ( !( cin >> D ) )  break ;

    for ( int mask = 1; mask <= 0x200; mask <<= 1 )
    {
      if ( D & mask )
      {
        if ( !init )
        {
          cout << " ";
        }
        cout << mask;
        init = false;
      }
    }
    cout << endl;
  }

  return ( 0 );
}

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

int main(){
  int N,M,count=0;
  cin >> N >> M;
  vector<int> A(M),B(M);
  for(int i=0;i<M;i++){
    cin >> A.at(i) >> B.at(i);
  }
  vector<int> num(N,1);
  vector<bool> C(N,false);
  C.at(0)=true;
  for(int i=0;i<M;i++){
    num.at(A.at(i)-1)--;
    num.at(B.at(i)-1)++;
    if(C.at(A.at(i)-1)){
      C.at(B.at(i)-1)=true;
    }
    if(num.at(A.at(i)-1)==0){
      C.at(A.at(i)-1)=false;
    }
  }
  for(int i=0;i<N;i++){
    if(C.at(i)){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 4492
class BIT():

    __slots__ = ["func", "e", "n", "data"]

    def __init__(self, length_or_list, func, e):
        self.func = func
        self.e = e
        if isinstance(length_or_list, int):
            self.n = length_or_list + 1
            self.data = [self.e] * self.n
        else:
            self.n = len(length_or_list) + 1
            self.data = [self.e] + length_or_list
            for i in range(1, self.n):
                if i + (i & -i) < self.n:
                    self.data[i + (i & -i)] = self.func(self.data[i + (i & -i)], self.data[i])        

    def point_append(self, index, delta):
        index += 1
        while index < self.n:
            self.data[index] = self.func(self.data[index], delta)
            index += index & -index
        
    def prefix_folded(self, end):
        res = 0
        while end > 0:
            res = self.func(res, self.data[end])
            end -= end & -end
        return res

def main():
    import sys
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read
    N, Q = map(int, input().split())
    seg = BIT(list(map(int, input().split())), lambda a, b: a + b, 0)
    for _ in range(Q):
        a, b, c = map(int, input().split())
        if a:
            print(seg.prefix_folded(c) - seg.prefix_folded(b))
        else:
            seg.point_append(b, c)

if __name__ == "__main__":
    main()

Measured memory_bytes: 125540
#include<iostream>
 
using namespace std;
 
int main(){
  long long a, b, x;
  cin >> a >> b >> x;
  long long a_min=a, b_max=b, ans;
 
  if(a==b){
    if(a_min%x!=0){
      printf("0\n");
    }else{
      printf("1\n");
    }
  }else{
    while(a_min%x!=0){
      long long t = a_min % x;
      a_min += (x - t);
    }
    while(b_max%x!=0){
      long long t = b_max % x;
      b_max -= t;
    }
    if(a_min==b_max){
      if(a_min%x!=0){
        printf("0\n");
      }else{
        printf("1\n");
      }
    }else if(a_min > b_max){
      printf("0\n");
    }else{
      ans = (b_max - a_min - 1 )/ x;
      printf("%llu\n", ans + 2);
    }    
  }
}


Measured memory_bytes: 3756
a, b = map(int,input().split())
if a <= 0 and b >= 0:
    print('Zero')
else:
    if a < 0:
        if (min(b+1, 0)-a)%2==0:
            print('Positive')
        else:
            print('Negative')

    else:
        print('Positive')

Measured memory_bytes: 38512
import java.util.*;class Main{public static void main(String[]z){int x=0,y=0,a,b,l;for(Scanner s=new Scanner(System.in);s.hasNext();){z=s.next().split(",");if((a=new Integer(z[0]))*a+(b=new Integer(z[1]))*b==(l=new Integer(z[2]))*l)++x;else if(a==b)++y;}System.out.println(x+"\n"+y);}}

Measured memory_bytes: 12000
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int,int>;

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n)cin >> a[i];
    vector<int> tmp_sum(n, 0);
    for (int j = 0; j < min(k, 100); j++){
        if(j != 0)
        tmp_sum.assign(n, 0);
        for (int i = 0; i < n; i++) {
            int l = max(0, i - a[i]);
            int r = min(n - 1, i + a[i]);
            tmp_sum[l]++;
            if (r + 1 < n)
                tmp_sum[r + 1]--;
        }
        for (int i = 1; i < n; i++)
            tmp_sum[i] += tmp_sum[i - 1];
        for(int i = 0; i < n; i++)
            a[i] = tmp_sum[i];
    }
    for (int i = 0; i < n; i++)
        cout << (a[i] >= n ? n : a[i]) << (i == n - 1 ? "\n" : " ");
}


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

namespace ABC043A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            int s;
            int i;

            n = int.Parse(Console.ReadLine());

            s = 0;

            for (i = 1; i <= n; i++)
                s = s + i;

            Console.WriteLine(s);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define F first
#define S second
#define int long long
#define lint long long
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define SET(x, val) memset(x, val, sizeof(x))
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 3e3 + 5, MOD1 = 1e9 + 7, MOD2 = 998244353;
const lint INF = 1e18;

int a, b, c, d, dp[N][N];
signed main()
{
    cin >> a >> b >> c >> d;
    dp[a][b] = 1;
    for(int i = a; i <= c; i++)
    {
        for(int j = b; j <= d; j++)
        {
            if(i==a && j==b) continue;
            dp[i][j] = (dp[i-1][j]*j + dp[i][j-1]*i)%MOD2;
            dp[i][j] = (dp[i][j] - (dp[i-1][j-1]*(i-1)*(j-1))%MOD2 + MOD2)%MOD2;
        }
    }
    cout << dp[c][d];
}

Measured memory_bytes: 73836
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here


        Scanner scan = new Scanner(System.in);
        BigDecimal N= scan.nextBigDecimal();
        BigDecimal M= scan.nextBigDecimal();
        BigDecimal b3 = N.multiply(M);
BigDecimal p = b3.setScale(0, BigDecimal.ROUND_DOWN);;
        System.out.println(p);
 


    }
}


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

int main(){
  int d,n;cin>>d>>n;
  if(n==100){
    if(d==1)cout<<100*(n+1)<<endl;
    else if(d==2)cout<<10000*(n+1)<<endl;
    else if(d==0)cout<<n+1<<endl;    
  }
  else{
    if(d==1)cout<<100*n<<endl;
    else if(d==2)cout<<10000*n<<endl;
    else if(d==0)cout<<n<<endl;
  }
  return 0;
}


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

const ll mod = 1000000007;

int main() {
  ll N, K;
  cin >> N >> K;
  ll ans = 0;
  
  for (int k = K; k <= N + 1; k++) ans += (k * (N - k + 1) + 1) % mod;

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


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

int main(){
		int n;
		string s,t;
		cin >> n >> s >> t;
		for(int i = n; i>=1;i--){
			//cout << s.substr(n-i,i) << " " << t.substr(0,i) << endl;
			if(s.substr(n-i,i) == t.substr(0,i)){
				{cout << i+2*(n-i); return 0;}
			}
		}
		cout << 2*n;
}


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

using namespace std;

int main(void){
    int x, n;
    cin >> x >> n;
    if (n == 0){
        cout << x << endl;
        return 0;
    }
    
    vector<int> p(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    
    sort(p.begin(),p.end());
    
    if (x < p[0] || p[n-1] < x){
        cout << x << endl;
        return 0;
    }
    
    int dist = 100000;
    int ans = 100000;
    
    for (int i = p[0]-1; i <= p[n-1] + 1; i++){
        bool isOK = true;
        for (int j = 0; j < n; j++){
            if (i == p[j]) isOK = false;
        }
        
        if (isOK){
            if (abs(x - i) < dist){
                dist = abs(x-i);
                ans = i;
            }
            
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<int> vei;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
	//cout.precision(10);
	cin.tie(0);
	ios::sync_with_stdio(false);

    string a,b; cin >> a >> b;
    string c = a + b;
    int num = stoi(c);
    for(int i = 1; i * i <= num; i++){
        if (i * i == num){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()
#define MOD 1000000007

int main() {
    map<int, int> m;
    m[4]=1, m[6]=1, m[9]=1, m[11]=1;
    m[2]=2;
    int a, b;
    scanf("%d %d", &a, &b);
    if (m[a]==m[b]) printf("Yes\n");
    else printf("No\n");
}


Measured memory_bytes: 256