akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  ll a,b; cin>>a>>b;
  ll xa=0, xb=0;
  for (ll i=a-(a%4); i<a; i++) {
    xa = xa^i;
  }
  for (ll i=b-(b%4); i<=b; i++) {
    xb = xb^i;
  }
  cout << (xa^xb) << endl;
}

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


Measured memory_bytes: 256
n , m = map(int,input().split())
u = 1000000007
p = {i for i in range(n)}
y = [0 for i in range(n)]
q = {int(input()) - 1 for i in range(m)}
f = list(p - q)
for i in f:
    if i == 0:
        y[0] = 1
    elif i == 1:
        y[1] = y[0] + 1
    else:
        y[i] = (y[i-1] + y[i-2])%u

print(y[n-1])

Measured memory_bytes: 20968
#!/usr/bin/env python3

import sys

DEBUG = False


class SegmentTree:

    # Use 1-based index internally
    def __init__(self, n, merge_func, fillval=sys.maxsize):
        self.n = 1
        while self.n < n:
            self.n *= 2
        self.nodes = [fillval] * (self.n * 2 - 1 + 1)  # +1 for 1-based index
        self.merge_func = merge_func
        self.fillval = fillval
    
    def update(self, idx, val):
        idx += 1  # for 1-based index

        nodes = self.nodes
        mergef = self.merge_func

        idx += self.n - 1
        nodes[idx] = val
        while idx > 1: # > 1 for 1-based index
            idx >>= 1  # parent(idx) = idx >> 1 for 1-based index segment tree
            nodes[idx] = mergef(nodes[idx << 1], nodes[(idx << 1) + 1]) # child(idx) = idx << 1 and idx << 1 + 1
    
    def query(self, l, r):
        l += 1; r += 1  # for 1-based index

        l += self.n - 1
        r += self.n - 1
        acc = self.fillval
        while l < r:
            if l & 1:
                acc = self.merge_func(acc, self.nodes[l])
                l += 1
            if r & 1:
                acc = self.merge_func(acc, self.nodes[r - 1])
                r -= 1
            l >>= 1
            r >>= 1
        return acc

def read(t = str):
    return t(sys.stdin.readline().rstrip())

def read_list(t = str, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]

def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    read()
    s = read()

    a_ord = ord("a")
    bit_offsets = {chr(c_ord): c_ord - a_ord for c_ord in range(ord("a"), ord("z") + 1)}

    apps = SegmentTree(len(s), lambda x, y: x | y, 0)
    i = 0
    for c in s:
        apps.update(i, 1 << bit_offsets[c])
        i += 1

    nr_q = read(int)
    for i in range(0, nr_q):
        q = read_list()
        if q[0] == "1":
            _, i, c = q  # i_q in the question starts from 1, not 0
            apps.update(int(i) - 1, 1 << bit_offsets[c])
        else:
            _, l, r = q  # l_q and r_q in the question start from 1, not 0
            print(bin(apps.query(int(l) - 1, int(r) - 1 + 1)).count("1"))  # query in the question includes both edges


if __name__ == "__main__":
    main()

Measured memory_bytes: 69704
#include <stdio.h>
int main()
{
	int n,m,s=0,x;
	scanf("%d",&n);
	x=n;
	while(n>0)
	{
		m=n%10;
		s+=m;
		n/=10;	
	}
	if(x%s==0)
	printf("Yes\n");
	else
	printf("No\n");
}

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


int main() {
	int n,i,j;
	char ch;
    while(cin >> ch){
        //cout << ch;
        n += ch-'0';
        n = n % 9;
    }
    if(n % 9 == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MX=1e3+7;
const int Md=1e9+7;
int n,m,K;
LL fac[MX],inv[MX];
LL ans=1;

void init()
{
  int n=1e3;
  fac[0]=fac[1]=inv[0]=inv[1]=1;
  for(int i=2; i<=n; i++)
	{
    fac[i]=fac[i-1]*i%Md;
    inv[i]=(Md-Md/i)*inv[Md%i]%Md;
  }
  for(int i=2; i<=n; i++) inv[i]=inv[i]*inv[i-1]%Md;
}

LL qpow(LL a, LL n)
{
  LL ret=1;
  while(n)
	{
    if(n&1) ret=ret*a%Md;
    a=a*a%Md; n>>=1;
  }
  return ret;
}

int gcd(int x,int y)
{
	return y?gcd(y,x%y):x;
}

LL polya(int m)
{
  LL ret=0;
  for(int i = 1; i <= m; i++)
	{
    ret+=qpow(K,gcd(i,m)); ret%=Md;
  }
  return (ret*qpow(m,Md-2))%Md;
}

LL C(int n, int m)
{
  if(n<m) return 0;
  return fac[n]*inv[m]%Md*inv[n-m]%Md;
}

struct edge
{
  int v; bool vis;
  edge *nxt,*rev;
}*con[MX],*stc[MX];
int dfn[MX],low[MX],tim,top;
bool vis[MX];

void add(int u, int v)
{
  edge *p=new edge;
  p->v=v; p->vis=0; p->nxt=con[u]; con[u]=p;
}
void get_rev(int u, int v)
{
  con[u]->rev=con[v]; con[v]->rev=con[u];
}

void tarjan(int u)
{
  dfn[u]=low[u]=++tim;
  for(edge *p = con[u]; p; p = p->nxt)
	{
    if(p->vis || p->rev->vis) continue;
    stc[++top]=p;
    p->vis=p->rev->vis=1;
    if(!dfn[p->v])
		{
      tarjan(p->v);
      low[u]=min(low[u],low[p->v]);
      if(low[p->v]>=dfn[u]) 
			{
        bool cir=1;//判断一个环的点双联通分量与多重环的点双联通分量
        int cnt=0;
        for(int i=top; stc[i+1]!=p; --i,++cnt)
          if (vis[stc[i]->v]) cir=0;
          else vis[stc[i]->v]=1;
        for(; stc[top+1]!=p; --top) vis[stc[top]->v]=0;
        if(cir) ans=(ans*polya(cnt))%Md;
        else ans=(ans*C(cnt+K-1,K-1))%Md;
        ans%=Md;
      }
    }
    else low[u]=min(low[u],dfn[p->v]);
  }
}

int main()
{
  init();
  scanf("%d%d%d",&n,&m,&K);
  for(int i = 1,u,v; i <= m; i++)
	{
    scanf("%d%d",&u,&v);
    add(u,v); add(v,u); get_rev(u,v);
  }
  for(int i=1; i<=n; i++)
    if(!dfn[i]) tarjan(i);
  printf("%lld\n",ans);
  return 0;
}


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

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int K=nextInt();
		int S=nextInt();

		long ans = 0;
		for(int x=0;x<=K;x++){
			for(int y=0;y<=K;y++){
				int z=S-x-y;
				if(0<=z&&z<=K){
					ans++;
				}
			}
		}
		System.out.println(ans);

	}

	public static long[] disassemblyAlph(String s) {
		long[] alph = new long['z' - 'a' + 1];
		Arrays.fill(alph, 0);
		for (int i = 0; i < s.length(); i++) {
			alph[s.charAt(i) - 'a']++;
		}
		return alph;
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "No" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll K,T; cin>>K>>T;
    vector<ll> A(T);
    rep(i,T) cin>>A[i];
    ll ma=*max_element(ALL(A));
    vector<bool> cake(K+1,0);
    ll ct=0;
    rep(i,K){
        if(cake[i]==0 or K-i==ma-ct) cake[i+1]=1,++ct;
    }
    ll ans=0;
    rep(i,K-1){
        if(cake[i+1] and cake[i+2]) ++ans;
    }
    cout<< ans <<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

MOD = 10**9 + 7


def cmb(n, k, fac, ifac):
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % MOD


def make_table(n):
    fac = [1, 1]
    ifac = [1, 1]
    inverse = [0, 1]

    for i in range(2, n+1):
        fac.append((fac[-1] * i) % MOD)
        inverse.append((-inverse[MOD % i] * (MOD//i)) % MOD)
        ifac.append((ifac[-1] * inverse[-1]) % MOD)
    return fac, ifac


def main():
    X, Y = map(int, input().split())

    if X > Y:
        X, Y = Y, X
    dist = X + Y

    if dist % 3 != 0:
        print(0)
        exit()

    total = int((X+Y) / 3)
    n = X - total

    if Y > 2 * X:
        print(0)
    else:
        fac, ifac = make_table(total)
        ans = cmb(total, n, fac, ifac)
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 82220
#include<bits/stdc++.h>
#define LL long long
using namespace std;
int main()
{
    string s;
    cin >> s;
    string ss = s;
    reverse(s.begin(), s.end());
    if(s == ss) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


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

template <int MOD_>
struct modnum {
	static constexpr int MOD = MOD_;
	static_assert(MOD_ > 0, "MOD must be positive");
 
private:
	using ll = long long;
 
	int v;
 
	static int minv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
	}
 
public:
 
	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream& operator << (std::ostream& out, const modnum& n) { return out << int(n); }
	friend std::istream& operator >> (std::istream& in, modnum& n) { ll v_; in >> v_; n = modnum(v_); return in; }
 
	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }
 
	modnum inv() const {
		modnum res;
		res.v = minv(v, MOD);
		return res;
	}
	modnum neg() const {
		modnum res;
		res.v = v ? MOD-v : 0;
		return res;
	}
 
	modnum operator- () const {
		return neg();
	}
	modnum operator+ () const {
		return modnum(*this);
	}
 
	modnum& operator ++ () {
		v ++;
		if (v == MOD) v = 0;
		return *this;
	}
	modnum& operator -- () {
		if (v == 0) v = MOD;
		v --;
		return *this;
	}
	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	modnum& operator /= (const modnum& o) {
		return *this *= o.inv();
	}
 
	friend modnum operator ++ (modnum& a, int) { modnum r = a; ++a; return r; }
	friend modnum operator -- (modnum& a, int) { modnum r = a; --a; return r; }
	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
};
using num = modnum<int(1e9) + 7>;

num powmod(num a, long long b) {
	num r = 1;
	while (b) {
		if (b & 1) {
			r *= a;
		}
		a *= a;
		b /= 2;
	}
	return r;
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, K; cin >> N >> K;
	vector<int> divs;
	for (int d = 1; d * d <= N; d++) {
		if (N % d == 0) {
			divs.push_back(d);
			if (d * d < N) {
				divs.push_back(N / d);
			}
		}
	}
	sort(divs.begin(), divs.end());

	unordered_map<int, num> dp;
	for (int d : divs) {
		num s = powmod(K, (d + 1) / 2);
		for (int u : divs) {
			if (d % u == 0) {
				s -= dp[u];
			}
		}
		dp[d] = s;
	}

	num ans = 0;
	for (int d : divs) {
		if (d % 2 == 0) {
			ans += dp[d] * (d / 2);
		} else {
			ans += dp[d] * d;
		}
	}
	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
    string s , t;
    int count = 0;
    cin >> s; 
    cin >> t;
    for(int i=0;i<s.size();i++){
        if(s[i] != t[i])count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3916
N, W = map(int, input().split())
wt, val = [], []
for i in range(N):
	w,v = map(int, input().split())
	wt.append(w)
	val.append(v)

K = [[0 for x in range(W+1)] for y in range(N+1)]

for i in range(N+1):
	for w in range(W+1):
		if i == 0 or w == 0:
			K[i][w] = 0
		elif wt[i-1] <= w:
#			print("ayo")
			K[i][w] = max(val[i-1]+K[i-1][w-wt[i-1]], K[i-1][w])
		else:
			K[i][w] = K[i-1][w]
print(K[N][W])


Measured memory_bytes: 173576
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int ans[1000]={0},qqq=0,www=0; 
	cin>>s;
	for(int i=0;i<4;i++)
	{
	    ans[s[i]]++;    	
	} 
	for(int i=0;i<1000;i++)
	{
	    if(ans[i]==2)
		{
		    qqq++;	
		}
		if(ans[i]>0)
		{
		    www++;
		}	
	}
	if(qqq==2&&www==2)
	{
		cout<<"Yes";
		return 0;
	}
	cout<<"No";
	return 0; 
}

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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    ll K,N;
    cin >> K >> N;

    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    ll most = 0;
    ll point = 0;
    rep(i,N-1)
    {
        if(most < abs(A[i]-A[i+1]))
        {
            most = abs(A[i]-A[i+1]);
            point = i;
        }
    }

    ll ans = 0;
    if( most < abs(K-A[N-1])+A[0] )
    {
        ans += abs(A[0]-A[N-1]);
    }
    else
    {
        ans += A[point];
        ans += (K-A[point+1]);
    }

    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e15;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define P pair<ll, ll>

struct Edge {
  ll t, a, b;
};

vector<Edge> G[100100];
vector<ll> da(100100, INF), db(100100, INF);

void dijkstra(int s) {
  da[s] = 0;
  priority_queue<P, vector<P>, greater<P>> pq;
  pq.push({0, s});
  while (!pq.empty()) {
    P p = pq.top();
    pq.pop();
    for (Edge e: G[p.second]) {
      if (chmin(da[e.t], da[p.second] + e.a)) {
        pq.push({e.a, e.t});
      }
    }
  }
}

void dijkstra2(int s) {
  db[s] = 0;
  priority_queue<P, vector<P>, greater<P>> pq;
  pq.push({0, s});
  while (!pq.empty()) {
    P p = pq.top();
    pq.pop();
    for (Edge e: G[p.second]) {
      if (chmin(db[e.t], db[p.second] + e.b)) {
        pq.push({e.b, e.t});
      }
    }
  }
}

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

  ll n, m, s, t;
  cin >> n >> m >> s >> t;
  s--, t--;
  rep(i, m) {
    ll u, v, a, b;
    cin >> u >> v >> a >> b;
    u--, v--;
    G[u].push_back({v, a, b});
    G[v].push_back({u, a, b});
  }

  dijkstra(s);
  dijkstra2(t);
  vector<ll> ans(n);
  ll res = INF;
  repr(i, n - 1) {
    chmin(res, da[i] + db[i]);
    ans[i] = res;
  }
  rep(i, n) cout << INF - ans[i] << '\n';




  

  
  return 0;
}

Measured memory_bytes: 19068
# 入力
n, m = gets.split.map(&:to_i)
a = []
a = gets.split.map(&:to_i)

# aを降順ソート
a.sort!.reverse!
sum = a.inject(:+)
lim = (sum.to_f / (4*m).to_f)
cnt = 0
n.times do |i|
  if a[i] >= lim
    cnt = cnt + 1
  end
end
puts (cnt>=m) ? "Yes" : "No"

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

int main(void){
  string S;
  int ans = 0;
  int N; cin >> N >> S;
  string abc("ABC");
  for(int i = 0; i < S.size(); i++){
    bool flg = true;
    for(int j = 0; j < 3; j++){
      int k = i + j;
      if(k >= S.size()){
        flg = false;
        break;
      }
      if(S[k] != abc[j]){
        flg = false;
        break;
      }
    }
    if(flg){
      ans++;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(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 main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, n;
    cin >> h >> w >> n;
    vector<int> a(n);
    rep (i, n) cin >> a[i];
    int board[h][w];
    rep (i, h) {
        rep (j, w) board[i][j] = 0;
    }
    int t = 1;
    rep (i, h) {
        if (i % 2) {
            for (int j = w - 1; j >= 0; --j) {
                board[i][j] = t;
                a[t - 1]--;
                if (a[t - 1] == 0) t++;
            }
        } else {
            rep (j, w) {
                board[i][j] = t;
                a[t - 1]--;
                if (a[t - 1] == 0) t++;
            }
        }
    }

    rep (i, h) {
        rep (j, w) {
            if (j < w - 1) cout << board[i][j] << " ";
            else cout << board[i][j] << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 384
#include <cstdio>

int ns[5001];

int max(int a,int b){return a>b?a:b;}

int main(){
  int n;
  while(scanf("%d",&n),n){
    for(int i=1; i<=n; i++)
      scanf("%d",&ns[i]);
    for(int i=2; i<=n; i++)
      ns[i]+=ns[i-1];

    int ans=-100001;
    for(int i=0; i<=n; i++)
      for(int j=0; j<i; j++)
	ans=max(ans,ns[i]-ns[j]);

    printf("%d\n",ans);
  }
}

Measured memory_bytes: 1040
n, a, b = map(int, input().split())

if n == 1:
    if a == b:
        print(1)
    else:
        print(0)
    exit()

if n == 2:
    if a > b:
        print(0)
    else:
        print(1)
    exit()

if a > b:
    print(0)
    exit()

ans = (n - 2) * (b - a) + 1
print(ans)


Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)


int main() {
  int s, w;
  cin >> s >> w;
  if(w >= s) cout << "unsafe" << ln;
  else cout << "safe" << ln;
}

Measured memory_bytes: 3632
N = int(input())
S = list(str(input()))

if N%2 != 0:
    print('No')
else:
    for i in range(len(S)//2):
        if (S[i] == S[i+len(S)//2]) == False:
            print('No')
            break
        else:
            if i == (len(S)//2) -1:
                print('Yes')

Measured memory_bytes: 3060
/* attention to overflow */
#include <bits/stdc++.h>

#define dump(x) cerr<< #x << " = " << x <<endl
#define ALL(container) (container).begin(),(container).end()

using namespace std;
const int INF = 1 << 25;
void io() { cin.tie(0); ios::sync_with_stdio(false);}
template <class S,class T> ostream& operator<<(ostream& os, const pair <S,T> &s){return os<<'('<<s.first<<','<<s.second<<')';}
/*printf("%.9Lf\n",cf);*/
const int MOD = 1000000007;
const double EPS=1e-8;

int dp[200010];
struct ed{int u,v,t,c;};
vector <ed> eds(200010);
struct edge{int no,u,tc;};
vector <edge> Graph[100010];

int N,M,S,G;

int memo(int q){
	if(dp[q]!=-1) return dp[q];

	int uofq=eds[q].u;
	int tofq=eds[q].t;

	if(uofq==S) return dp[q]=tofq;

	int tmp=INF;
	for(int i=0;i<Graph[uofq].size();i++){
		int no=Graph[uofq][i].no;
		int tc=Graph[uofq][i].tc;
		//if(tc>tofq) continue;
		if(tc>tofq) break;
		tmp=min(tmp,(tofq-tc)+memo(no));
	}
	return dp[q]=tmp;
}

int main() {
	//io();
	cin>>N>>M>>S>>G;
	S--,G--;
	fill_n(dp,M+10,-1);
	for(int i=0;i<M;i++){
		int u,v,t,c;
		cin>>u>>v>>t>>c;
		u--,v--;
		Graph[v].push_back({i,u,t+c});

		//eds.push_back({u,v,t,c});
		eds[i]={u,v,t,c};
	}

	for(int i=0;i<N;i++){
		sort(Graph[i].begin(),Graph[i].end(),[](const edge &a, const edge &b){return a.tc<b.tc;});
	}

	int ans=INF;
	for(int i=0;i<M;i++){
		if(eds[i].v==G) ans=min(ans,memo(i));
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 13072
using System;
using System.Collections.Generic;
using System.Linq;

public class Pg
{
    static void Main()
    {
        var rd = new Reader();
        int n;
        var ans = new List<double>();
        while ((n = int.Parse(Console.ReadLine())) != 0)
        {
            var lst = rd.Read(n).OrderBy(x=>x).ToList();
            lst.Remove(lst.FirstOrDefault());
            lst.Remove(lst.LastOrDefault());
            ans.Add(Math.Truncate(lst.Average()));
        }
        Console.WriteLine(string.Join("\n", ans));
    }
}
class Reader
{
    internal IEnumerable<int> Read(int n)
    {
        while (n-- > 0)
        {
            yield return int.Parse(Console.ReadLine());
        }
    }
}



Measured memory_bytes: 18296
#include<stdio.h>
char m[91];N,x,y;B(p){m[p]-49||(m[p]--,B(p+1)||B(p+2)||B(p+3),B(p-1)||B(p-2)||B(p-3),B(p+9)||B(p+18)||B(p+27),B(p-9)||B(p-18)||B(p-27));return m[p]-48;}main(n){for(scanf("%d",&n);n--;printf("Data %d:%s",++N,m+9))fread(m+8,1,74,stdin),scanf("%d%d",&x,&y),B(y*9+x);exit(0);}

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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> vec(4,vector<int>(13));

  for(int i = 0; i < N; i++){
    char c;
    int  m;
    cin >> c >> m;
    
    if(c=='S') vec.at(0).at(m-1)=1;
    else if(c=='H') vec.at(1).at(m-1)=1;
    else if(c=='C') vec.at(2).at(m-1)=1;
    else vec.at(3).at(m-1)=1;
   }
  
  for(int i=0; i<4;i++){
    for(int j=0; j<13;j++){
      string ans;
      if(i==0) ans="S";
      else if(i==1) ans="H";
      else if(i==2) ans="C";
      else ans = "D";
      
      if(vec.at(i).at(j)==0) cout << ans << " "<< j+1 << endl;
    }
  } 
}


Measured memory_bytes: 3216
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define NUM_MAX 100
#define K_MAX 100000
#define BUF_SIZE (K_MAX*7+50)

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}
//
// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
#ifdef BUF_SIZE
    char line[BUF_SIZE];
    char *tmpbuf = line;
    int i;
    if(!fgets(line, BUF_SIZE, stdin)) return -1;
    for(i = 0; i < size; i++) {
        char *tmp = strtok(tmpbuf, " ");
        arr[i] = strtol(tmp, NULL, 10);
        tmpbuf = NULL;
    }
#else
#error
#endif
    return 0;
}

enum {
    TARO_LOSE,
    TARO_WIN,
};

int main(void) {
    int arr[NUM_MAX];
    int num, k;
    get_int2(&num, &k);
    static char dp[K_MAX+1];
    fget_array(arr, num); // min(arr)=arr[0];
    int i, j;
    // initialization
    for(i = 0; i < arr[0]; i++) {
        dp[i] = TARO_LOSE;
    }
    for(i = arr[0]; i <= k; i++) {
        int flag = 1;
        for(j = 0; j < num; j++) {
            if(i-arr[j]>=0) flag &= dp[i-arr[j]];
        }
        dp[i] = !flag;
    }
#ifdef DEBUG
    for(i = 0; i <= k; i++) {
        printf("%d ", dp[i]);
    }
    putchar('\n');
#endif
    printf("%s\n", dp[k] ? "First" : "Second");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
bool a[300001];
using namespace std;
int main(){
  int b,w,x,p=0,i;
  cin>>w>>b;
  for(i=0;i<w;i++){
    scanf("%d",&x);
    p=max(p,x);
    a[x]++;
  }
  while(b--){
    for(scanf("%d",&x),i=1;i<x;i++)
      for(int j=x-i;j<=p;j+=x)
        if(a[j])goto L;
    L:printf("%d\n",x-i);
  }
}

Measured memory_bytes: 3356
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}

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

    ll n,k;
    cin>>n>>k;
    ll ans = n - (ll)(n/k)*k;
    chmin(ans,k-ans);
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
public class Aprob {
    public static void Main() {
        string[] readSome = new string[2];
        readSome = Console.ReadLine().Split(' ');
        long H = long.Parse(readSome[0]);
        long W = long.Parse(readSome[1]);
        string[] C = new string[H];
        for (int i = 0; i < H; i++) {
            C[i]= Console.ReadLine();
        }
        for (int i = 0; i < 2 * H; i++) {
            Console.WriteLine(C[i/2]);
        }
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  	int N;
  	cin >> N;
  	for(int i=1;i<=9;i++){
  		if(N%i==0 && N/i<=9){
  			cout << "Yes" <<endl;
  			return 0;
  		}
  	}
  	cout << "No" <<endl;
    
  	return 0;
}









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

int main(void){
    ll n;
    cin >> n;
    vector<string> v;
    string word;
    string next;
    cin >> word;
    v.push_back(word);
    bool flag = true;
    for(int i=1;i<n;i++){
        cin >> next;
        if(word[word.length()-1]!=next[0]){
            flag = false;
            break;
        }else{
            for(int j=0;j<v.size();j++){
                if(next == v[j]){
                    flag = false;
                    break;
                }
            }
        }
        v.push_back(next);
        word = next;
    }
    if(flag == true){
        cout << "Yes"<<endl;
    }else{
        cout << "No"<<endl;
    }
    return 0;
}

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


#define fi first
#define se second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define el '\n'

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int N = 110;

int n;

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

    cin >> n;
    int ans = 0;
    for (int i=1;i<=n;i++){
        int a;
        cin >> a;
        if ((i & 1) && (a & 1)){
            ans++;
        }
    }
    cout << ans << el;

    return 0;
}

Measured memory_bytes: 3556
#include<bits/stdc++.h>
#include<vector>
using namespace std;
//using ll = long long;
//#define long long int ll;
const int limit = 100010;
struct edge{
	int to;
	long long cost;
};
vector<edge> tree[limit];
long long depth[limit];
void dfs(int v, int p, long long d) {
	depth[v] = d;
	for (auto &e:tree[v]) {
		if (e.to == p) continue;
		dfs(e.to, v, d + e.cost);
	}
}

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

	for (int i = 0; i < n - 1; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		tree[a].push_back({b, c});
		tree[b].push_back({a, c});
	}

	int q, k;
	cin >> q >> k;
	k--;

	dfs(k, -1, 0);
	for (int i = 0; i < q; ++i) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		cout << depth[x] + depth[y] << endl;
	}

	return 0;
}


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


int main(){
  int n, x, t;
  scanf("%d %d %d", &n, &x, &t);
  
  int res = (n/x)*t;
  
  if (n%x == 0)
    printf("%d\n", res);
  else
    printf("%d\n", res +t);
  

  return 0;
}

Measured memory_bytes: 1708
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0

for a in range(A+1):
    S1 = a*500
    if S1 > X:
        break
    for b in range(B+1):
        S2 = S1 + b*100
        if S2 > X:
            break
        for c in range(C+1):
            S3 = S2 + c*50
            if S3 > X:
                break

            if S3 == X:
                cnt += 1

print(cnt)

Measured memory_bytes: 3064
#define loop(i, s, e) for(ll i = s;i < e;i++)

#include <iostream>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>
#include <map>
#include <cmath>

using namespace std;

typedef long long signed ll;

#define INF

typedef struct {
    int xv, yv;
} vect;

int main() {
    int q, x[2], y[2];
    vect v[2];
    cin >> q;
    loop(i, 0, q) {
        loop(j, 0, 2) {
            cin >> x[0] >> y[0] >> x[1] >> y[1];
            v[j].xv = x[0] - x[1];
            v[j].yv = y[0] - y[1];
        }
        if(v[0].xv * v[1].yv - v[0].yv * v[1].xv == 0) cout << 2 << endl;
        else if(v[0].xv * v[1].xv + v[0].yv * v[1].yv == 0) cout << 1 << endl;
        else cout << 0 << endl;
    }
}




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

int main() {
	string S;
	cin >> S;
	int num0 = (S[0] - '0') * 10 + (S[1] - '0');
	int num1 = (S[2] - '0') * 10 + (S[3] - '0');
	bool case0 = false;
	bool case1 = false;
	if (num0>0 && num0 <= 12){
		case0 = true; 
	}
	if (num1 >0 &&num1 <= 12) {
		case1 = true;
	}
	if (case0 && case1) {
		cout << "AMBIGUOUS"<<endl;
	}
	else if (case0) {
		cout << "MMYY"<<endl;
	}
	else if (case1) {
		cout << "YYMM"<<endl;
	}
	else {
		cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define ll long long
#define umap unordered_map
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;

ll mod(ll x, ll y){if(x>=0||x%y==0) return x%y;return y+x%y;} //mod including minus
ll dv0(ll x, ll y){if(x>=0||x%y==0)return x/y;return x/y-1;} //rnd down
ll dv1(ll x, ll y){if(x%y==0) return dv0(x,y);return dv0(x,y)+1;} //rnd up
ll M=1e9+7;
int quick_pow(int x,int p){
    int a=1,po=x;
    while(p){
        if(p&1)  a=1ll*a*po%M;
        po=1ll*po*po%M;p>>=1;
    }
    return a;
}
int cnt=0;
int ans=0;
vector<int> A;
vector<int>B;
void count(int N, int M, int Q, vector<int> a, vector<int> b, vector<int> c, vector<int> d, vector<int> A){
    if(A.size()==N){
        cnt=0;
        rep(i, Q){
            if(A.at(b.at(i)-1)-A.at(a.at(i)-1)==c.at(i)){
                cnt+=d.at(i);
            }
            
        }
        ans=max(ans, cnt);
    }else if(A.size()==0){
        for(int j=1;j<=M;j++){
            B=A;
            B.push_back(j);
            count(N, M, Q,a, b, c, d, B);
        }
    }
    else{
        for(int j=A.at(A.size()-1);j<=M;j++){
            B=A;
            B.push_back(j);
            count(N, M, Q,a, b, c, d, B);
        }
    }
}

//Start from Here
int main(){
    int N, M, Q;
    cin>>N>>M>>Q;
    vector<int> a, b, c, d;
    rep(i, Q){
        int x, y, z, w;
        cin>>x>>y>>z>>w;
        a.push_back(x);
        b.push_back(y);
        c.push_back(z);
        d.push_back(w);
    }
    count(N, M, Q,a, b, c, d, A);
    cout<<ans<<endl;
}

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

int N;
//引数:(今の文字列, 今までの文字列の中で辞書順でmaxの文字)
void dfs(string s, char mx){
    if(s.size() == N){
        cout << s << endl;
        return;
    }
    //(今までに使ってる文字種+1)種類の文字を使える
    for(char c = 'a'; c <= mx+1; c++){
        string t = s;
        t += c;
        dfs(t, max(mx, c));
    }
}

int main() {
    cin >> N;
    dfs("", 'a'-1);
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  int n, l;
  cin >> n >> l;

  int sum = 0;
  re(i, n) sum += l + i;
  int m = INF;
  re(i, n) {
    m = min(m, abs(l+i));
  }
  re(i, n) {
    if(m == l + i) sum -= m;
    else if(m == -(l + i)) sum += m;
    else continue;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
//<editor-fold desc="I/O Templates">
private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readLong() = readLn().toLong()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map(String::toInt)
private fun readLongs() = readStrings().map(String::toLong)
//</editor-fold>

fun main() {
    val n = readInt()
    println(10 - n / 200)
}

Measured memory_bytes: 34164
#!/usr/bin/env python3
import sys
import heapq
INF = float("inf")


def solve(N: int, M: int, A: "List[int]"):
    h = []
    tot = 0
    for a in A:
        heapq.heappush(h, (-a, 0))
        tot += a
    # print(tot)
    for i in range(M):
        p, kaisu = heapq.heappop(h)
        tot -= -p
        p = -p // 2
        tot += p
        heapq.heappush(h, (-p, kaisu+1))
        # print(tot)
    print(tot)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 25724
r, c = map(int, input().split())   #r, cを読み込む
l = [[0 for i in range(c + 1)] for i in range(r + 1)]
#0 for i in range(n)   n個の要素を0で初期化
for i in range(r) :
  l[i] = list(map(int, input().split()))   #行ごとに読み込み
    
for i in range(r) :
  s = sum(l[i])   #行ごとの和を求める
  l[i].append(s)   #sをi行目の最後に追加
    
for j in range(c) :   #列ごとの和を求める 横に1つずつ動く
  s = 0
  for i in range(r) :   #1行ずつ進む
    s += l[i][j]
  l[r][j] = s   #0行目から始まってる→r(r+1)行目にc列目の和
    
l[r][c] = sum(l[r])   #l[r][c] = l[r]の和
  
for i in range(r + 1) :   #range→(r+1)回
  for j in range(c + 1) :
    if(j == c) :
      print(l[i][j])
    else :
      print(str(l[i][j]) + " ", end = "")


Measured memory_bytes: 6220
li,ri=gets.chomp.split(" ").map(&:to_i)
l= li%2019
r= ri%2019
ls=li/2019
rs=ri/2019
if ls < rs
  puts 0
elsif l > r
  puts 0
elsif l==r or l == 0 or r == 0
  puts 0
else
  data = (l..r).to_a.combination(2).map do |ij|
    i=ij[0]     
    j=ij[1]
    i*j % 2019
  end
  puts data.min
end

Measured memory_bytes: 18300
n = int(input())
ans = None
cnt_max = -1
for i in range(n, 0, -1):
    now = i
    cnt = 0
    while now % 2 == 0 and now != 0:
        cnt += 1
        now /= 2
    if cnt > cnt_max:
        ans = i
        cnt_max = cnt
print(ans)
    

Measured memory_bytes: 2940
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N, A[1 << 20];
int S[1 << 20];
vector<int> G[1 << 20];

void init() {
	for (int i = 1; i <= 1000000; i++) {
		for (int j = i; j <= 1000000; j += i) G[j].push_back(i);
	}
}

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

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	init();

	// Pairwise かどうか
	bool flag1 = false;
	vector<int> vec;
	for (int i = 1; i <= N; i++) {
		if (A[i] >= 2) vec.push_back(A[i]);
	}
	sort(vec.begin(), vec.end());
	for (int i = 0; i < (int)vec.size() - 1; i++) {
		if (vec[i] == vec[i + 1]) flag1 = true;
	}
	if (flag1 == false) {
		for (int i = 0; i < vec.size(); i++) {
			for (int j : G[vec[i]]) S[j] += 1;
		}
		for (int j = 2; j <= 1000000; j++) {
			if (S[j] >= 2) flag1 = true;
		}
	}
	if (flag1 == false) {
		cout << "pairwise coprime" << endl;
		return 0;
	}

	// Setwise かどうか
	int r = A[1];
	for (int i = 2; i <= N; i++) r = gcd(r, A[i]);
	if (r == 1) cout << "setwise coprime" << endl;
	else cout << "not coprime" << endl;
	return 0;
}

Measured memory_bytes: 130328
#include<cstdio>
#include<algorithm>
#include<cstring>
typedef long long LL;
const int mod=1e9+7;
using namespace std;
int n;
LL ans=1;
char a[55],b[55];
int read()
{
	int ans=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+c-48;c=getchar();}
	return ans*f;
} 
int main()
{
	scanf("%d",&n);
	scanf("%s %s",a+1,b+1);
	if(n<3){
		if(n==1)printf("3");
		else if(n==2)printf("6");
		return 0; 
	}
	for(int i=1;i<=n;i++){
		if(a[i]==b[i]){
			if(i==1)ans*=3;
			else if(a[i-1]==b[i-1])ans=ans*2%mod;			
		}
		else {
			if(i==1)ans*=6;
			else if(a[i-1]==b[i-1])ans=ans*2%mod;			
				else ans=(ans*3)%mod;
			i++;
		}
	}
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  string s;
  cin >> s;
  if(s=="ARC"){
    cout << "ABC" << endl;
  }else{
    cout << "ARC" << endl;
  }
  return 0;
}

Measured memory_bytes: 3624
#%%
n = int(input())
p = [0] * n
for i in range(n):
    p[i] = int(input())

check = [0] * (n+1)
sor = [0] * (n+1)

for i in range(n):
    if check[p[i]-1] == 1:
        sor[p[i]] = 1
    check[p[i]] = 1

#print(sor)

count = 0
tmp = 0
for i in range(n+1):
    if sor[i] == 1:
        tmp += 1
    else:
        count = max(count, tmp)
        tmp = 0
count = max(count, tmp)

print(n - count - 1)

    

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

void Main()
{
    long n, k;
    cin >> n >> k;
    long a = k;
    for (int i = 1; i < 40; i++)
    {
        if(n / a == 0){
            cout << i << endl;
            return;
        }
        a *= k;
    }
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  ll x, y;
  cin >> x >> y;
  if(abs(x-y) <= 1) cout << "Brown" << endl;
  else cout << "Alice" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
typedef long long ll;

char cakemap[302][302];
int ansmap[302][302];

void paint(int row, int col, int num){

    pair<int, int> colarea = {col, col};
    pair<int, int> rowarea = {row, row};
    while(1){
        if (cakemap[row][colarea.first - 1] != '.') break;
        colarea.first--;
    }
    while(1){
        if (cakemap[row][colarea.second + 1] != '.') break;
        colarea.second++;
    }
    while(1){
        int brsign = 0;
        for (int i = colarea.first; i <= colarea.second; i++)
        {
            if (cakemap[rowarea.first - 1][i] != '.'){
                brsign = 1;
                break;
            }
        }
        if (brsign == 1) break;
        rowarea.first--;
    }
    while(1){
        int brsign = 0;
        for (int i = colarea.first; i <= colarea.second; i++)
        {
            if (cakemap[rowarea.second + 1][i] != '.'){
                brsign = 1;
                break;
            }
        }
        if (brsign == 1) break;
        rowarea.second++;
    }

    //printf("row[%d:%d], col[%d:%d]\n", rowarea.first, rowarea.second, colarea.first, colarea.second);
    for (int i = rowarea.first; i <= rowarea.second; i++)
    {
        for (int j = colarea.first; j <= colarea.second; j++)
        {
            cakemap[i][j] = 'X';
            ansmap[i][j] = num;
        }
    }
}


int main()
{
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<int>> line(h);

    rep(i, 302)rep(j,302){
        cakemap[i][j] = '#';
    }


    rep(i, h)rep(j, w){
        char tmp; cin >> tmp;
        if(tmp != '.') line[i].push_back(j);
        cakemap[i + 1][j + 1] = tmp;
    }

    
    int num = 1;
    rep(i, h){
        rep(j, w){
            if (cakemap[i + 1][j + 1] == '#'){
                paint(i+1, j+1, num);
                num++;
            }
        }
    }

    rep(i, h){
        rep(j, w){
            printf("%d ",ansmap[i+1][j+1]);
        }
        printf("\n");
    }
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

int main(void){
	int n, *v, v1[100001], v2[100001], max1, max2, max3, max4, i1, i2, count1=1, count2=1;
	scanf("%d", &n);
	v = (int *)malloc(sizeof(int)*n);
	for (int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
	}
	for (int i = 0; i <= 100000; ++i){
		v1[i] = 0;
		v2[i] = 0;
	}

	for (int i = 0; i < n/2; ++i){
		v1[v[2*i]] += 1;
		v2[v[2*i+1]] += 1;
	}

	max1 = v1[1];
	max2 = v2[1];
	i1 = 1;
	i2 = 1;
	for (int i = 2; i <= 100000; ++i){
		if (max1 == v1[i]) {
			count1 +=1;
		}else if (max1 < v1[i]) {
			max1 = v1[i];
			i1 = i;
			count1 = 1;
		}
		if (max2 == v2[i]) {
			count2 +=1;
		}else if (max2 < v2[i]) {
			max2 = v2[i];
			i2 = i;
			count2 = 1;
		}
	}

	if ((i1!=i2) || (count1>1) || (count2>1)) {
		printf("%d\n", n-max1-max2);
	} else {
		v1[i1] = 0;
		v2[i2] = 0;
		max3 = v1[1];
		max4 = v2[1];

		i1 = 1;
		i2 = 1;
		for (int i = 2; i <= 100000; ++i){
			if (max3 < v1[i]) {
				max3 = v1[i];
				i1 = i;
			}
			if (max4 < v2[i]) {
				max4 = v2[i];
				i2 = i;
			}
		}
		if (max1+max4 >= max2+max3) {
			printf("%d\n", n-max1-max4);
		}else{
			printf("%d\n", n-max3-max2);
		}
	}
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=50;
const int SZ=50;
const int MOD=1e9+7;

int add(int a, int b)
{
	int res = a + b;
	if(res >= MOD)
		return res - MOD;
	return res;
}

int mult(int a, int b)
{
	long long res = a;
	res *= b;
	if(res >= MOD)
		return res % MOD;
	return res;
}

struct matrix
{
	int arr[SZ][SZ];

	void reset()
	{
		memset(arr, 0, sizeof(arr));
	}

	void makeiden()
	{
		reset();
		for(int i=0;i<SZ;i++)
		{
			arr[i][i] = 1;
		}
	}

	matrix operator + (const matrix &o) const 
	{
		matrix res;
		for(int i=0;i<SZ;i++)
		{
			for(int j=0;j<SZ;j++)
			{
				res.arr[i][j] = add(arr[i][j], o.arr[i][j]);
			}
		}
		return res;
	}

	matrix operator * (const matrix &o) const 
	{
		matrix res;
		for(int i=0;i<SZ;i++)
		{
			for(int j=0;j<SZ;j++)
			{
				res.arr[i][j] = 0;
				for(int k=0;k<SZ;k++)
				{
					res.arr[i][j] = add(res.arr[i][j] , mult(arr[i][k] , o.arr[k][j]));
				}
			}
		}
		return res;
	}
};

matrix power(matrix a, int b)
{
	matrix res;
	res.makeiden();
	while(b)
	{
		if(b & 1)
		{
			res = res * a;
		}
		a = a * a;
		b >>= 1;
	}
	return res;
}

int n, k, ways=0;
int a[N][N], res[N], res2[N];

int32_t main()
{
	IOS;
	cin>>n>>k;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			cin>>a[i][j];
	matrix ans;
	int prev=1;
	for(int i=0;i<n;i++)
		res[i]=1;
	ans.makeiden();
	matrix mat;
	for(int i=0;i<SZ;i++)
	{
		for(int j=0;j<SZ;j++)
		{
			mat.arr[i][j]=a[i][j];
		}
	}
	matrix expo=power(mat, k);
	ans=ans * expo;
	for(int i=0;i<SZ;i++)
	{
		res2[i]=0;
		for(int j=0;j<SZ;j++)
			res2[i]=add(res2[i], mult(expo.arr[i][j], res[j]));
	}
	for(int i=0;i<SZ;i++)
		res[i]=res2[i];
	for(int i=0;i<n;i++)
		ways+=res[i];
	ways%=MOD;
	cout<<ways;
	return 0;
}

Measured memory_bytes: 384