akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        long N = sc.nextLong();
        int ans = 0;
        List<Pair> array = Factor(N);
        for(Pair pair: array){
            int exponent = pair.exponent;
            int b = 1;
            while(b <= exponent){
                exponent -= b;
                b++;
                ++ans;
            }
        }
        out.println(ans);

        out.flush();

    }

    static List<Pair> Factor(long x){
        List<Pair> res = new ArrayList<>();
        for(long i=2; i*i <= x; i++){
            int exponent = 0;
            while(x%i == 0){
                x /= i;
                exponent++;
            }
            if(exponent != 0) res.add(new Pair(i, exponent));
        }
        if(x != 1) res.add(new Pair(x, 1));
        return res;
    }


    static class Pair{
        private long base;
        private int exponent;

        public Pair(long base, int exponent){
            this.base = base;
            this.exponent = exponent;
        }

        @Override
        public String toString() {
            return this.base + " : " + this.exponent;
        }
    }




    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

Measured memory_bytes: 32904
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    int H,W;
    cin >> H >> W;
    char A[H][W];
    REP(i,H){
        REP(j,W){
            cin >> A[i][j];
        }
    }
    int di[] = {0,1};
    int dj[] = {1,0};
    queue<pair<int,int>> que;
    if('#' == A[0][0]){
        A[0][0] = '.';
        que.push({0,0});
    }
    while(!que.empty()){
        auto p = que.front();
        que.pop();
        int i = p.first;
        int j = p.second;
        REP(dir,2){
            int ni = i + di[dir];
            int nj = j + dj[dir];
            if(ni >= H || nj >= W)continue;
            if('.' == A[ni][nj])continue;
            A[ni][nj] = '.';
            que.push({ni,nj});
            break;
        }
    }
    string ans = "Possible";
    REP(i,H){
        REP(j,W){
            if('#' == A[i][j]){
                ans = "Impossible";
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<string>
//#include<queue>
//#include<cmath>
//#include<algorithm>
#define debug1 cout<<"?"<<endl;
#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=2e6+9;
const double pi=acos(-1);
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
ll fac[maxn],inv[maxn];
ll kpow(ll a,ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)ans=(ans*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}
void init()
{
    fac[0]=1;
    for(int i=1;i<maxn;i++)
    {
        fac[i]=fac[i-1]*i%mod;
    }
}
ll Cc(ll x, ll y)
{
    return fac[x]*kpow(fac[y]*fac[x-y]%mod,mod-2)%mod;
}
int main()
{
	ll r1,r2,c1,c2;
	init();
	scanf("%lld%lld%lld%lld",&r1,&c1,&r2,&c2);
	ll ans=0;
	for(ll i=r1;i<=r2;i++)
	ans=(ans+Cc(i+c2+1,i+1)-Cc(i+c1,i+1)+mod)%mod;
	printf("%lld\n",ans);	
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> n;
    if (n < 1000) MSG("ABC")
    else MSG("ABD")
}


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

if N == 0:
    P = []
else:
    P = list(map(int,input().split()))

def serch(X,N,P):
    dif = []
    
    for i in range(N):
        dif.append(abs(P[i]-X))
    
    dif.sort()
    
    difcount = {}
    for i in dif:
        if i in difcount:
            difcount[i] += 1
        else:
            difcount[i] = 1

    for i in range(1,101):
        if i not in difcount:
            return X-i
        
        if difcount[i] == 1:
            if X - i in P:
                return X+i
            else:
                return X-i
                
if X not in P:
    print(X)
else:
    print(serch(X,N,P))

Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back

char s[100005];
deque < char > dq;
int rev = 0,n;

int main(){
	
	scanf("%s",&s);
	n = strlen(s);
	for ( int i = 0; i < n; i++ ) dq.push_back(s[i]);
	rev = 0;
	
	scanf("%d",&n);
	while (n--){
		int T,F;
		scanf("%d",&T);
		if ( T == 1 ){
			rev ^= 1;
		} else {
			scanf("%d%s",&F,&s);
			if ( F == 1 ){
				if ( !rev ) dq.push_front(s[0]);
				else dq.push_back(s[0]);
			} else {
				if ( rev ) dq.push_front(s[0]);
				else dq.push_back(s[0]);
			}
		}
	}
	
	while ( !dq.empty() ){
		char c;
		
		if ( rev ){
			c = dq.back();
			dq.pop_back();
		} else {
			c = dq.front();
			dq.pop_front();
		}
		printf("%c",c);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 896
using System;

public class Program
{
    private int N, T;
    private Pair[] AB;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        T = sc.NextInt();
        AB = new Pair[N];
        for (int i = 0; i < N; i++)
        {
            AB[i] = new Pair(sc.NextInt(), sc.NextInt());
        }


        Array.Sort(AB, (a, b) => a.A.CompareTo(b.A));

        var dp = new int[T];
        for (int i = 0; i < T; i++)
        {
            dp[i] = -1;
        }

        dp[0] = 0;
        int ans = 0;
        for (int i = 0; i < N; i++)
        {
            for (int j = T - 1; j >= 0; j--)
            {
                if (dp[j] == -1) continue;
                ans = Math.Max(ans, dp[j] + AB[i].B);
                if (j + AB[i].A < T)
                {
                    dp[j + AB[i].A] = Math.Max(dp[j + AB[i].A], dp[j] + AB[i].B);
                }
            }
        }
        
        Console.WriteLine(ans);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

struct Pair
{
    public int A, B;

    public Pair(int a, int b)
    {
        A = a;
        B = b;
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 13376
#include <iostream>

using namespace std;

int a[100][100];
int b[100];

int
main(int argc, const char *argv[])
{
    int n, m;
    cin >> n >> m;
    for (int i = 0; i != n; ++i) {
        for (int j = 0; j != m; ++j) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i != m; ++i) cin >> b[i];

    for (int i = 0; i != n; ++i) {
        long long p = 0;
        for (int j = 0; j != m; ++j) {
            p += a[i][j] * b[j];
        }
        cout << p << endl;
    }

    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const ll MOD = (ll)(1e9 + 7);

const int MAX_N = 112345;
ll dp[MAX_N][4];

int main2() {
  CLR(dp, 0);
  dp[0][0] = 1;

  string s; cin >> s;
  int N = (int)s.size();

  REP(i, N) {
    if (s[i] == 'A') {
      (dp[i+1][1] += dp[i][0]) %= MOD;
      REP(k, 4) (dp[i+1][k] += dp[i][k]) %= MOD;
    }
    if (s[i] == 'B') {
      (dp[i+1][2] += dp[i][1]) %= MOD;
      REP(k, 4) (dp[i+1][k] += dp[i][k]) %= MOD;
    }
    if (s[i] == 'C') {
      (dp[i+1][3] += dp[i][2]) %= MOD;
      REP(k, 4) (dp[i+1][k] += dp[i][k]) %= MOD;
    }
    if (s[i] == '?') {
      (dp[i+1][1] += dp[i][0]) %= MOD;
      (dp[i+1][2] += dp[i][1]) %= MOD;
      (dp[i+1][3] += dp[i][2]) %= MOD;
      REP(k, 4) (dp[i+1][k] += 3 * dp[i][k]) %= MOD;
    }
  }
  cout << dp[N][3] << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 4352
N, M = map(int, input().split())

v = []

for i in range(M):
    line = map(int, input().split())
    v.append([x - 1 for x in line])

conn = []
for _ in range(N):
    conn.append([False] * N)

visited = [False] * N

for start, end in v:
    conn[start][end] = conn[end][start] = True

def dfs(now, depth):
    if visited[now]:
        return 0
    if depth == N - 1:
        return 1

    visited[now] = True
    ret = 0

    for i in range(N):
        if conn[now][i]:
            ret += dfs(i, depth + 1)
    
    visited[now] = False

    return ret

print(dfs(0,0))

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using std::vector;

template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

//////////////////////////////////////

//////////////////////////////////////

int main() {
    
    int N;
    cin >> N;
    
    for (int i = 1; i < 10; i++) {
        if (N % i == 0) {
            if (N / i <= 9) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mkp make_pair
#define llu unsigned long long int
#define ll long long
#define ld long double
#define foi(a, n) for (int i = a; i < n; i++)
#define foj(a, n) for (int j = a; j < n; j++)
#define foin(a, n) for (int i = n; i >= a; i--)
#define fojn(a, n) for (int j = n; j >= a; j--)
#define isp2(x) x && (!(x & (x - 1)))
#define ee 1000000007
#define fio                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL)
#define cases                                                                  \
  long long t;                                                                 \
  cin >> t;                                                                    \
  while (t--)

using namespace std;

int main() {
  ll n;
  n = 3;
  ll a[n];
  for (ll i = 0; i < n; ++i)
    cin >> a[i];
  sort(a, a + n);
  cout << a[0] + a[1] << endl;
  return 0;
}


Measured memory_bytes: 3560
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n < 105) {
            System.out.println(0);
        }else if (n >= 105 && n < 135) {
            System.out.println(1);
        }else if (n >= 135 && n < 165) {
            System.out.println(2);
        }else if (n >= 165 && n < 189) {
            System.out.println(3);
        }else if (n >= 189 && n < 195) {
            System.out.println(4);
        }else if (n >= 195) {
            System.out.println(5);
        }
    }
}

Measured memory_bytes: 21844
#include<cstdio>
#include<string>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
#include<queue>
#define For(i,j,k) for(ll i=j;i<=k;++i)
#define Dow(i,j,k) for(ll i=k;i>=j;--i)
#define ll long long
#define inf 1e17
using namespace std;
inline ll read()
{
	ll t=0,f=1;char c=getchar();
	while(c<'0'||c>'9')	{if(c=='-')	f=-1;c=getchar();}
	while(c<='9'&&c>='0')	t=t*10LL+c-48LL,c=getchar();
	return t*f;
}
int n,m,vis[201],poi[2001],nxt[2001],head[2001],ans,cnt;
inline void add(int x,int y){poi[++cnt]=y;nxt[cnt]=head[x];head[x]=cnt;}
inline void dfs(int x,int no)
{
	vis[x]=1;
	for(int i=head[x];i;i=nxt[i])
	{
		if(i==no||i==no+1)	continue;
		if(vis[poi[i]])	continue;
		dfs(poi[i],no);	
	}
}
inline bool solve(int x)
{
	For(i,1,n)	vis[i]=0;
	dfs(1,x);
	For(i,1,n)	if(!vis[i])	return 1;
	return 0;
}
int x,y;
int main()
{
	n=read();m=read();
	For(i,1,m)	x=read(),y=read(),add(x,y),add(y,x);
	For(i,1,m)	ans+=(int)solve(i*2-1);
	cout<<ans<<endl;
}

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

int main() {
  int X,Y;
  cin>>X>>Y;
  if((4*X-Y)%2==0 && (4*X-Y)>=0 && (Y-2*X)%2==0 && (Y-2*X)>=0) cout<<"Yes";
  else cout<<"No";
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
/*
  RMQ and RUQ
  区間の最小値を得る(RMQ)
  区間の値を変更する(RUQ)
 */

class RMQ{
public : 
  typedef long long ll;
  ll INF = 1LL<<55;
  struct data{
    bool type; //0 - empty   , 1 - update
    ll value;
  };
  ll n,n_;
  vector<ll> dat;
  vector<data> td;
  int toMax; //0 -> RangeMin 1->RangeMax;
  
  RMQ(){n=-1;}
  RMQ(int n_,int toMax = 0):n_(n_),toMax(toMax){
    n=1;
    while(n<n_)n*=2;
    td.resize(2*n-1,(data){0,0});
    dat.resize(2*n-1,INF);
  }
  
  //[a,b)の値をxに変更　update(a,b,x)
  ll update(int a,int b,ll x,bool flg=true,int k=0,int l=0,int r=-1){
    if(r == -1) {
      r = n;
      assert(a <= b), assert(a <= n_ && b <= n_), assert(a >= 0 && b >= 0);
      if(toMax) x *= -1;
    }
    
    if(r<=a||b<=l)return flg? dat[k]:INF;
    if(a<=l&&r<=b){
      if(flg==true){
        td[k]=(data){1,x};
        dat[k]=x;
      }
      return dat[k];
    }
    
    if(td[k].type){
      td[k].type=0;
      dat[k*2+1] = dat[k*2+2] = td[k].value;
      td[k*2+1] = td[k*2+2] = (data){1,td[k].value};
    }
    
    ll vl=update(a,b,x,flg,k*2+1,l,(l+r)/2);
    ll vr=update(a,b,x,flg,k*2+2,(l+r)/2,r);
    if(flg==true)dat[k]=min(vl,vr);
    return min(vl,vr);
  }
  
  //[a,b)の最小値を得る　find(a,b);
  ll find(int a,int b){return (toMax? -1:1) * update(a,b,0,false);};
};


int main(){
  int q,n;
  cin>>n>>q;
  RMQ T(n);

  for(int i=0;i<n;i++) T.update(0,n,(1LL<<31)-1);
  while(q--){
    int cmd,s,t,x;
    scanf("%d%d%d",&cmd,&s,&t);
    if(cmd==0)cin>>x,T.update(s,t+1,x);
    else cout <<T.find(s,t+1)<<endl;
  }
  return 0;
}



Measured memory_bytes: 8908
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>

using namespace std;

int n,x[100010],tc=0,tk=0;

int tp(int a){
    return (a+1)/2;
}


int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&x[i]);
        if(x[i]==i+1)tc++;
        else{
            if(tc)tk+=tp(tc);
            tc=0;
        }
    }
    tk+=tp(tc);
    printf("%d\n",tk);
    
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>
#include <sstream>
#include <bitset>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
//static const long double pi = 3.1415926535897932;

using namespace std;
using ll = long long int;
using ull = unsigned long long;

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ll combination(ll n, ll r) { // nCr の計算
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

int pop(long bits) {
	bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
	bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
	bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
	bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
	return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int f(ll n) {
	int ans = 0;
	while(true) {
		n = n % pop(n);
		ans++;
		if (n == 0) {
			if (ans > 1) {
				return ans - 1;
			} else {
				return ans;
			}
		}
	}
}

int main() {
	int n, r;
	cin >> n >> r;
	if (n < 10) {
		int diff = 100 * (10 - n);
		cout << (r + diff) << endl;
	} else {
		cout << r << endl;
	}
	return 0;
}

Measured memory_bytes: 3200
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
int n,d,ans;
string s;
signed main(){
	cin>>s;
	if(s=="RRR")ans=3;
	else if(s=="SRR"||s=="RRS")ans=2;
	else if(s=="SSS")ans=0;
	else ans=1;
	cout<<ans<<endl;
}

Measured memory_bytes: 3600
a, b, k = map(int, input().split())

res = []
for i in range(a, min(b + 1, a + k)):
    res.append(i)


for i in range(max(a, b - k + 1), b + 1):
    if i not in res:
        res.append(i)

res = sorted(res)
for i in res:
    print(i)


Measured memory_bytes: 3060
#include <stdio.h>
#include <math.h>

int main(void)
{
	int n;
	int x[1000], y[1000];
    double p2, p3;
    double a1, a2, a3,max=0;

	scanf("%d", &n);

	int i, j;

	for (i = 0; i < n; i++)
	{
		scanf("%d", &x[i]);
	}
	for (j = 0; j < n; j++)
	{
		scanf("%d", &y[j]);
	}

    for (i = 0; i < n; i++)
    {
        a1 = a1 + fabs(x[i] - y[i]);
        p2 = p2 + ((x[i] - y[i]) * (x[i] - y[i]));
        p3 = p3 + fabs((x[i] - y[i]) * (x[i] - y[i]) * (x[i] - y[i]));
    }

    a2 = sqrt(p2);
    a3 = cbrt(p3);

    for (i = 0; i < n; i++)
    {
        if (max < fabs(x[i] - y[i]))
        {
            max = fabs(x[i] - y[i]);
        }
    }

    printf("%f\n %f\n %f\n %f\n", a1, a2, a3, max);

    return 0;
}


Measured memory_bytes: 2104
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	vector<int> A(3);
	cin >> A[0] >> A[1] >> A[2];
  	sort(A.begin(), A.end());

    cout << A[2] - A[0] << "\n";

	return 0;
}


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

#define fa(x,v) for(auto x:v)
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define spc " "
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(s) (ll)int(s.length())
#define sz(v) (ll)int(v.size())
#define MOD 1000000007

void Fast_IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef rsd511
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    #endif
    #ifndef rsd511
    #define trace(...) {}
    #define cotra(...) {}
    #endif
} 

// Code Here

int main()
{
    Fast_IO();
    ll n; cin >> n;
    cout << 1-n;
    return 0;
}

Measured memory_bytes: 3648
/*raghav0307 - Raghav Gupta*/

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

#define ff first
#define ss second
#define pb push_back
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

typedef long long ll;

int main(){
	fast_io();
	int n;	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++)	cin >> a[i];
	int maxGcd = 1;
	int pgcd[n];
	pgcd[0] = a[0];
	for(int i = 1; i < n; i++)
		pgcd[i] = __gcd(a[i], pgcd[i-1]);
	int sgcd[n];
	sgcd[n-1] = a[n-1];
	for(int i = n-2; i >= 0; i--)
		sgcd[i] = __gcd(a[i], sgcd[i+1]);

	// for(int i = 0; i < n; i++){
	// 	cout << pgcd[i] << "\n";
	// }

	// for(int i = 0; i < n; i++){
	// 	cout << sgcd[i] << "\n";
	// }

	for(int i = 1; i < n-1; i++)
		maxGcd = max(maxGcd, __gcd(pgcd[i-1], sgcd[i+1]));
	maxGcd = max(maxGcd, max(sgcd[1], pgcd[n-2]));
	cout << maxGcd;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long LL;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

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

    string ans = "";
    REP(i,(int)s.size()){
        if(s[i]=='B'){
            if((int)ans.size()!=0){
                ans.erase((int)ans.size()-1);
            }
        }else{
            ans += s[i];
        }
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 3616
N, A, B = map(int, input().split())

judge = False

turn = 0
while not judge:
    if turn == 0:
        if A - B == 1:
            print("Borys")
            exit()
        else:
            A += 1
            turn = 1
    else:
        if A - B == 1:
            print("Alice")
            exit()
        else:
            B -= 1
            turn = 0



Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
 
const int N = 3e5 + 9, mod = 1e9 + 7;
 
template <int32_t MOD>
struct modint {
    int32_t value;
    modint() = default;
    modint(int32_t value_) : value(value_) {}
    inline modint<MOD> operator + (modint<MOD> other) const { int32_t c = this->value + other.value; return modint<MOD>(c >= MOD ? c - MOD : c); }
    inline modint<MOD> operator - (modint<MOD> other) const { int32_t c = this->value - other.value; return modint<MOD>(c <    0 ? c + MOD : c); }
    inline modint<MOD> operator * (modint<MOD> other) const { int32_t c = (int64_t)this->value * other.value % MOD; return modint<MOD>(c < 0 ? c + MOD : c); }
    inline modint<MOD> & operator += (modint<MOD> other) { this->value += other.value; if (this->value >= MOD) this->value -= MOD; return *this; }
    inline modint<MOD> & operator -= (modint<MOD> other) { this->value -= other.value; if (this->value <    0) this->value += MOD; return *this; }
    inline modint<MOD> & operator *= (modint<MOD> other) { this->value = (int64_t)this->value * other.value % MOD; if (this->value < 0) this->value += MOD; return *this; }
    inline modint<MOD> operator - () const { return modint<MOD>(this->value ? MOD - this->value : 0); }
    modint<MOD> pow(uint64_t k) const {
        modint<MOD> x = *this, y = 1;
        for (; k; k >>= 1) {
            if (k & 1) y *= x;
            x *= x;
        }
        return y;
    }
    modint<MOD> inv() const { return pow(MOD - 2); }  // MOD must be a prime
    inline modint<MOD> operator /  (modint<MOD> other) const { return *this *  other.inv(); }
    inline modint<MOD> operator /= (modint<MOD> other)       { return *this *= other.inv(); }
    inline bool operator == (modint<MOD> other) const { return value == other.value; }
    inline bool operator != (modint<MOD> other) const { return value != other.value; }
    inline bool operator < (modint<MOD> other) const { return value < other.value; }
    inline bool operator > (modint<MOD> other) const { return value > other.value; }
};
template <int32_t MOD> modint<MOD> operator * (int64_t value, modint<MOD> n) { return modint<MOD>(value) * n; }
template <int32_t MOD> modint<MOD> operator * (int32_t value, modint<MOD> n) { return modint<MOD>(value % MOD) * n; }
template <int32_t MOD> ostream & operator << (ostream & out, modint<MOD> n) { return out << n.value; }
 
using mint = modint<mod>;
 
mint ans[N];
int32_t main() {
    int n, k; cin >> n >> k;
    mint res = 0;
    for(int i = k; i >= 1; i--) {
    	ans[i] = mint(k / i).pow(n);
    	for(int j = i + i; j < N; j += i) ans[i] -= ans[j];
    	res += ans[i] * i;
    }
    cout << res << '\n';
    return 0;
}

Measured memory_bytes: 4012
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;

#define ll long long
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define vt vector
#define vll vt<ll>
#define pll pair<ll,ll>
#define vpll vt<pll>
#define vvll vt<vll>
#define all(v) v.begin(),v.end()
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffo(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl "\n"
#define pqmx priority_queue<ll>
#define pqmn priority_queue<ll,vll,greater<ll>>
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define go_t int testcases; cin>>testcases; ffo(caseno,1,testcases)

#define ctime auto start = high_resolution_clock::now()
#define etime auto stop = high_resolution_clock::now()
#define ptime auto z1z = duration_cast<microseconds>(stop-start); cout<<"Time elapsed : "<<z1z.count()<<" microseconds\n"

#define dbg1(x)             cout <<#x<<": "<<x<<'\n';
#define dbg2(x, y)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<'\n';
#define dbg3(x, y, z)       cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<'\n';
#define dbg4(a, b, c, d)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<'\n';
#define dbg5(a, b, c, d, e) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<'\n';

const ll mod = 1e9 + 7;
const ll N = 1e6 + 6;
const ll maxN = 1e5 + 5;
const ll MAX_SIZE = 2e6 + 6;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;

ll powerM(ll x, ll y, ll M = mod) { // default argument
	ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;
}

ll power(ll x, ll y) {
	ll v = 1; while (y > 0) {if (y & 1)v = v * x; y = y >> 1; x = x * x;} return v;
}


ll n;
ll cache[maxN][2];
vector<ll> g[maxN];

ll dfs(ll k, ll par, ll col) // col is 1 => black // col is 0 => white
{
	ll &ans = cache[k][col];
	if (ans != -1)
		return ans;
	ans = 1;
	for (auto &it : g[k])
	{
		if (it == par)
			continue;
		if (!col)
			ans *= (dfs(it, k, 0) + dfs(it, k, 1));
		else
			ans *= dfs(it, k, 0);
		ans %= mod;
	}
	return ans;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("in1.txt", "r", stdin);
	freopen("out1.txt", "w", stdout);
#endif
	FIO
	memset(cache, -1, sizeof(cache));
	cin >> n;
	for (ll i = 1; i <= n - 1; i++)
	{
		ll u, v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	// 1 means black, 0 means white
	ll ans = dfs(1, 1, 0) + dfs(1, 1, 1);
	ans %= mod;
	cout << ans;
	return 0;
}


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

int main(){
    int N;
    cin >> N;
    int A[N];
    for (auto& a : A) cin >> a;
    int cnt = 0;
    for (int i = 0; i < N - 1; i++) {
        int minj = i;
        for (int j = i + 1; j < N; j++) {
            if (A[j] < A[minj]) minj = j;
        }
        if (i != minj) {
            swap(A[i], A[minj]);
            cnt++;
        }
    }
    for (int i = 0; i < N; i++) {
        cout << A[i] << (i < N - 1 ? " " : "\n");
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3100
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] ints = new int[n];
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i ++){
            ints[i] = scanner.nextInt();
            if (map.containsKey(ints[i]))
                map.put(ints[i], map.get(ints[i])+ 1);
            else
                map.put(ints[i], 1);
        }
        long sum = 0;
        for (Map.Entry<Integer, Integer> entry : map.entrySet()){

            sum += (long)entry.getValue()*(entry.getValue()-1)/2;
        }
        for (int i = 0; i < n; i ++)
            System.out.println(sum - map.get(ints[i]) + 1);
    }
}


Measured memory_bytes: 109556
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
  
  int p1,p2,p3,j1,j2,P;
  
  cin >> p1 >> p2 >> p3 >> j1 >> j2;

  if( p1 >= p2 && p2 >= p3 ) P = p3; 
  else if( p1 >= p3 && p3 >= p2 ) P = p2; 
  else if( p2 >= p1 && p1 >= p3 ) P = p3; 
  else if( p2 >= p3 && p3 >= p1 ) P = p1;
  else if( p3 >= p1 && p1 >= p2 ) P = p2;
  else if( p3 >= p2 && p2 >= p1 ) P = p1;


  int J = min(j1,j2);

  cout << P + J - 50 << endl;

  return 0;
}

Measured memory_bytes: 1164
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int N, K;
  ll A[SIZE];

  cin >> N >> K;

  for (int i=0; i<N; i++) {
    cin >> A[i+1];
    A[i+1] += A[i];
    A[i+1] %= K;
  }

  map<int,int> counter = {};
  ll ans = 0;

  for (int i=0; i<=N; i++) {
    if (i - K >= 0) counter[A[i-K]]--;

    debug(A[i]);
    A[i] = (A[i] + K - i % K) % K;
    debug(A[i]);
    ans += counter[A[i]];
    counter[A[i]]++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 13184
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;

ll calc(vl sa[], vl sb[], int n, ll a, ll d) {
    if ((n - 1) % d == 0 && (n - 1 - a) / d * 2 * d >= n - 1) {
        return 0;
    }
    return sb[d][(n-1-a)/d] + sa[d][(n-1-a)/d];
}

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

    vl sa[n];
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < n; j += i) {
            sa[i].push_back(j == 0 ? 0 : sa[i][j/i-1] + s[j]);
        }
    }

    vl sb[n];
    for (int i = 1; i < n; i++) {
        for (int j = n - 1; j >= 0; j -= i) {
            sb[i].push_back(j == n - 1 ? 0 : sb[i][(n-1-j)/i-1] + s[j]);
        }
    }

    ll ans = 0;
    for (int a = 1; a < n; a++) {
        for (int d = 1; d * d <= n - 1 - a; d++) {
            if ((n - 1 - a) % d == 0) {
                if (d < a) {
                    ans = max(ans, calc(sa, sb, n, a, d));
                }
                if ((n - 1 - a) / d < a) {
                    ans = max(ans, calc(sa, sb, n, a, (n - 1 - a) / d));
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 33012
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
	ll n, k; cin >> n >> k;
	ll mini, maxi, res;
	mini = maxi = res = 0;
	REP(i, k - 1) {
		mini += i;
		maxi += n - i;
	}
	for (ll i = k - 1; i < n + 1; i++) {
		mini += i;
		maxi += n - i;
		res += maxi - mini + 1;
		res %= MOD;
	}
	cout << res << '\n';
	return 0;
}


Measured memory_bytes: 3632
import java.io.*;
import java.util.*;
public class Main{
	public static void main(String args[]) throws Exception{
		Scanner cin= new Scanner(System.in);
		final int n= cin.nextInt();
		int[] A    =new int[n];
		int[] DPlen=new int[n+1]; //DPlen[i]:長さi+1の増加部分列のうち末尾が最小の要素
		int intMAX= (int)Math.pow(10d,9d)+1;
		
		A[0]= cin.nextInt();
		DPlen[0]= A[0];
		
		int k;
		for(k=1;k<n+1;k++){
			DPlen[k]= intMAX;
		}
		
		int i;
		for(i=1;i<n;i++){
			A[i]= cin.nextInt();
			int index = Arrays.binarySearch(DPlen, A[i]);
			if( index<0 ){
				index= ~index;
				DPlen[index]= A[i];
			}
		}
		
		int ans= Arrays.binarySearch(DPlen, (int)Math.pow(10d,9d));
		if( ans<0 ){
			ans=~ans;
		}
		else{
			ans++;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 64264
// 最大正方形
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cassert>

#include<vector>
#include<queue>
#include<set>

using namespace std;

const int INF = -1;
const int INV = 0;
const int MAX_H_W = 1400;

// タイルの状態
const int WHITE = 0;
const int BLACK = 1;

// タイル１枚の時の最小正方形
const int MIN_SQUARE = 1;

// タイルの状態を格納する配列
int tile[MAX_H_W][MAX_H_W];

// H : タイルの縦の長さ
// W : タイルの横の長さ
int H, W;

int MaximumSquare(void);

int main(void)
{

	cin >> H >> W;;

	for(int i = 0; i < H; i++)
	{
		for(int j = 0; j < W; j++)
		{
			// タイルの状態を格納
			cin >> tile[i][j];
		}
	}

	printf("%d\n", MaximumSquare());

	return 0;
}

// 最大正方形の問題を解く関数
int MaximumSquare(void)
{
	// 1辺の最大値を格納する変数
	int maxSquareSide = 0;

	// 作成可能な最大正方形の１辺の長さを格納する配列
	int side[MAX_H_W][MAX_H_W];

	// 初期値の代入
	// ( タイルの 1 列目 と 1 行目の状態は最初に調査しておく )
	for(int i = 0; i < W; i++)
	{
		if( tile[0][i] == WHITE )
		{
			// 綺麗なタイル
			side[0][i] = MIN_SQUARE;
			// 最小正方形が１つは出来る
			maxSquareSide = MIN_SQUARE;
		}
		else
		{
			// きたないタイル
			side[0][i] = INV;
		}
	}

	for(int i = 0; i < H; i++)
	{
		if( tile[i][0] == WHITE )
		{
			// 綺麗なタイル
			side[i][0] = MIN_SQUARE;
			// 最小正方形が１つは出来る
			maxSquareSide = MIN_SQUARE;
		}
		else
		{
			// きたないタイル
			side[i][0] = INV;
		}
	}

	int m1, m2;

	for(int i = 1; i < H; i++)
	{
		for(int j = 1; j < W; j++)
		{
			if( tile[i][j] == BLACK )
			{
				// 自分自身が汚いタイルの時は, 正方形は出来ない
				side[i][j] = INV;
				continue;
			}

			if( side[i - 1][j - 1] > MIN_SQUARE && side[i - 1][j] > MIN_SQUARE && side[i][j - 1] > MIN_SQUARE )
			{
				// 自分の位置の左上, 上, 左の要素の中で, 最小の正方形を作る辺を検索する
				// ( 自分の周りの３マス共に正方形が出来ている時 )
				m1 = min(side[i - 1][j - 1], side[i - 1][j]);
				m2 = min(side[i][j - 1], m1);

				// 既に出来ている正方形の辺の長さに＋１する
				side[i][j] = m2 + 1;
			}
			else if( side[i - 1][j - 1] >= MIN_SQUARE && side[i - 1][j] >= MIN_SQUARE && side[i][j - 1] >= MIN_SQUARE )
			{
				// 長さ２の正方形が出来る
				// ( 自分の周りのどこかに正方形が出来ている時 )
				side[i][j] = 2;
			}
			else
			{
				// 周りが汚いタイルに囲まれている時
				// ( 要素１つの正方形となる )
				side[i][j] = MIN_SQUARE;
			}

			if( maxSquareSide < side[i][j] )
			{
				// 最大正方形の１辺の格納
				maxSquareSide = side[i][j];
			}
		}
	}

	// 正方形の面積を返す
	return ( maxSquareSide * maxSquareSide );
}



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

#define FOR(i, l, r) for(ll i = l; i < r; i++)
#define rep(i, N) FOR(i, 0, N)

#define MOD 1000000007
#define INF 1000000000

using ll = long long int;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

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

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

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


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

struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int>> ;
using GraphEdge = vector<vector<int>> ;

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
int main(){
    int A,B;cin >> A >> B;
    if(B%A==0)cout << A+B << endl;
    else cout << B-A << endl;
    return 0;
}

Measured memory_bytes: 3572
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
typedef    complex<ld>   P;
#define    X   real()
#define    Y   imag()
ld restant(P p){return abs(p);}
//polar(x,y) mag=l,arg=y
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pair<ll,ll> >   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pair<int,int> >   vpi;
typedef    vector<pair<double,double> >   vpd;
typedef    pair<double,double>   pd;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define all(x) x.be(),x.en()
#define    eps   1e-9
const    ld   PI=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return((a-b+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}


int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{


string s;
cin>>s;
char a=s[0];
char b=s[1],c=s[2],d=s[3];

int p=10*(int(a)-48)+(int(b)-48);
int q=10*(int(c)-48)+(int(d)-48);

if(p>0&&p<=12&&q>0&&q<=12)
cout<<"AMBIGUOUS";
else if((p==0||p>12)&&(q>0&&q<=12))
cout<<"YYMM";
else if((p>0&&p<=12)&&(q==0||q>12))
cout<<"MMYY";
else
cout<<"NA";





}return 0;}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
 
  int n,i,j,min,flag=1,sum=0;
  char c1[36];
  int  c2[36];
  char babble1[36];
  int  babble2[36];
  char esc1;
  int  esc2;
 
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf(" %c%d",&c1[i],&c2[i]);
 
  for(i=0;i<n;i++){
    babble1[i]=c1[i];
    babble2[i]=c2[i];
  }
 
  if(n==1){
    printf("%c%d\nStable\n",c1[0],c2[0]);
    printf("%c%d\nStable\n",c1[0],c2[0]);
  }
 
  if(n!=1){
    //start babble
 
    while(flag){
      flag=0;
 
      for(j=n-1;j>=1;j--){
    if(babble2[j] < babble2[j-1]){
      esc1=babble1[j-1];
      esc2=babble2[j-1];
      babble1[j-1]=babble1[j];
      babble2[j-1]=babble2[j];
      babble1[j]=esc1;
      babble2[j]=esc2;
 
      flag=1;
    }
      }
    }   
    for(i=0;i<n;i++){
      printf("%c%d",babble1[i],babble2[i]);
      if(i==n-1) break;
      printf(" ");
    }
 
    printf("\nStable\n");  //end babble
 
    //start select
 
    for(i=0;i<n-1;i++){
      min=i;
      for(j=i+1;j<n;j++){
    if(c2[j]<c2[min]){
      min=j;
    }
      }
      if(i==min) continue;
      esc1=c1[i];
      esc2=c2[i];
      c1[i]=c1[min];
      c2[i]=c2[min];
      c1[min]=esc1;
      c2[min]=esc2;
    }
    for(i=0;i<n;i++){
      printf("%c%d",c1[i],c2[i]);
      if( !((c1[i]==babble1[i]) && (c2[i]==babble2[i]))) sum++;
      if(i==n-1) break;
      printf(" ");
    }
 
    if(sum==0) printf("\nStable\n");
    else       printf("\nNot stable\n");
 
    //end select
  }
  return 0;
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    int a[5];
    int ans = 0;
    int m = 10;
    rep(i,5){
        cin >> a[i];
        //30分なら30で31なら40になる
        ans+=(a[i]+9)/10*10;
        int x=10;
        if(a[i]%10!=0){
            x = a[i]%10;
        }
        m = min(m,x);
    }
    cout << ans+m-10 << endl;
}

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

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

int main(){
  int N,X;
  cin >> N >> X;
  int x[N];
  rep(i,N) cin >> x[i];
  int d[N];
  rep(i,N) d[i]=abs(X-x[i]);
  int ans=d[0];
  rep(i,N-1) ans=gcd(ans,d[i+1]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<limits>
#include<algorithm>
#include<numeric>
#include<utility>

int main(){
    std::string S;

    int cnt=0;
    std::cin >> S;
    for(auto s:S){
        if(s=='x') cnt++;
    }
    std::cout << (cnt>=8?"NO":"YES") << std::endl;

    return 0;
}

Measured memory_bytes: 256