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

#define infint 0x7fffffff //32-bit int
#define ninfint 0x80000000
#define EPS 1e-9
#define mp(A,B) make_pair(A,B)
#define sdf(n) scanf("%d",&n)
#define ssf(a) scanf(" %s ", a)
#define pdf(n) printf("%d",n)
#define pcf(c) printf("%c",c)
#define pdfn(n) printf("%d\n",n)
#define pb push_back
#define pendl() printf("\n")

#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1 << n) - 1)
#define pque priority_queue

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;

#define endl '\n'

// dp[today_act][day] = max(dp[not_act_1][day-1], dp[not_act_2][day-1]) + today_act_i
int N;
int dp[100000][3];

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

    cin >> N;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            cin >> dp[i][j];
        }
    }

    for (int i = 1; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            dp[i][j] = max(dp[i-1][(j+1)%3], dp[i-1][(j+2)%3]) + dp[i][j];
        }
    }

    cout << max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2])) << endl;

    return 0;
}


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

int main()
{
	int i, N, p[100001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(p[i]));

	int sum = 0;
	for (i = 1; i <= N; i++) {
		if (p[i] != i) continue;
		else {
			sum++;
			if (i < N && p[i+1] == i + 1) i++;
		}
	}
	
	printf("%d\n", sum);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=101000;
char s[N];
int top,st[N],ps;
vector<PII> ans;
int main() {
	scanf("%s",s);
	int n=strlen(s);
	for (int i=0;i<n;i++) {
		if (s[i]=='(') {
			st[top++]=i;
		} else if (s[i]==')') {
			if (top>0) {
				ans.pb(mp(st[top-1],i));
				--top;
			}
		} else {
			if (s[i]=='*') ps=i;
		}
	}
	int c=0;
	for (auto p:ans) if (p.fi<ps&&p.se>ps) c++;
	printf("%d\n",c);
}


Measured memory_bytes: 3352
#include<iostream>
using namespace std;
int main(){
  int n;
  while(cin >> n){
    int ans=0,math[1001000]={0};
    math[1]=1;
    for(int i=2;i<n+1;i++){
      int bell=i;
      if(math[i]==0){
	ans++;
	math[i]=1;
      }
      while(bell+i<=n){
	bell+=i;
	if(math[bell]==0){
	  math[bell]=1;
	}
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 5076
A2Z="abcdefghijklmnopqrstuvwxyz"

def affine(msg, a, b):
    s=""
    for c in msg: s+=(A2Z[(A2Z.index(c)*a+b)%26] if "a"<=c<="z" else c)
    return s

def rot(msg, a):
    a = a % 26
    L = A2Z[a:]+A2Z[:a]
    s=""
    for c in msg: s+=(L[A2Z.index(c)] if "a"<=c<="z" else c)
    return s

def checkkey(s):
    c0="t"
    for i in range(26):
        a = 0
        x = affine(s,i,0)
        c = A2Z.index(x[0])
        if c!=19:
            a = (19-c)%26
            x = rot(x,a)
        if x in['this','that']: return i,a
    return -1,-1

n = input()
while n:
    n-=1
    s = raw_input()
    for w in s.split():
        if len(w)==4:
            a,b = checkkey(w)
            if a!=-1: break
    print affine(s,a,b)

Measured memory_bytes: 4276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

ll dp[12][2][8]; // dp[i][j][bit]...i:桁数, j:未満フラグ, bit:753の使用状況

int main() {
    string s;
    cin >> s;
    int n = s.size();
    dp[0][0][0] = 1;
    for (int i = 0; i < n; i++) {
        int t = s[i] - '0';
        for (int j = 0; j < 2; j++) {
            for (int bit = 0; bit < 8; bit++) {
                for (int m = 0; m <= (j ? 7 : t); m++) {
                    if (m == 0) {
                        if (bit) continue;
                        dp[i + 1][j || m < t][bit] += dp[i][j][bit];
                    } else if (m == 3) {
                        dp[i + 1][j || m < t][bit | (1 << 0)] += dp[i][j][bit];
                    } else if (m == 5) {
                        dp[i + 1][j || m < t][bit | (1 << 1)] += dp[i][j][bit];
                    } else if (m == 7) {
                        dp[i + 1][j || m < 7][bit | (1 << 2)] += dp[i][j][bit];
                    } else continue;
                }
            }
        }
    }
    ll ans = dp[n][0][7] + dp[n][1][7];
    cout << ans << endl;
}

Measured memory_bytes: 256
REGEX = /(.AGC|A.GC|AG.C|.ACG|.GAC)/
DIVISOR = 10**9 + 7

def calc(n)
  return { "A" => 1, "C" => 1, "G" => 1, "T" => 1 } if n == 1
  res = calc(n-1)
  new_res = {}
  res.each do |k, v|
    "AGCT".each_char do |ch|
      cand = k + ch
      cand.slice!(0, 1) if cand.size > 4
      if cand.size < 4
        if cand != "AGC" && cand != "ACG" && cand != "GAC"
          new_res[cand] = 1
        end
      elsif !REGEX.match(cand)
        new_res[cand] ||= 0
        new_res[cand] += v
      end
    end
  end
  new_res
end

puts (calc gets.to_i).values.inject(&:+) % DIVISOR


Measured memory_bytes: 2300
use std::io;
fn main() {
    let (n, k): (usize, usize) = {
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        let mut it = input.split_whitespace();
        (
            it.next().unwrap().parse().unwrap(),
            it.next().unwrap().parse().unwrap(),
        )
    };
    let mut h = {
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        input
            .split_whitespace()
            .map(|x| x.parse::<i64>().unwrap())
            .collect::<Vec<i64>>()
    };
    h.sort_by(|a, b| b.cmp(a));
    if n <= k {
        println!("0");
    } else {
        println!("{}", h.iter().skip(k).sum::<i64>());
    }
}


Measured memory_bytes: 10492
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long long p[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%lld",p+i);
	for(int i=0;i<a;i++){
		p[i+1]+=p[i];
	}
	long long A=0;
	long long B=0;
	long long tmp=0;
	for(int i=0;i<a;i++){
		if(i%2==0){
			if(tmp+p[i]<=0){
				A+=1-(tmp+p[i]);
				tmp+=1-(tmp+p[i]);
			}
		}else{
			if(tmp+p[i]>=0){
				A+=1+tmp+p[i];
				tmp-=1+tmp+p[i];
			}
		}
	}
	tmp=0;
	for(int i=0;i<a;i++){
		if(i%2==1){
			if(tmp+p[i]<=0){
				B+=1-(tmp+p[i]);
				tmp+=1-(tmp+p[i]);
			}
		}else{
			if(tmp+p[i]>=0){
				B+=1+tmp+p[i];
				tmp-=1+tmp+p[i];
			}
		}
	}
	
	printf("%lld\n",min(A,B));
}

Measured memory_bytes: 896
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int divisor = 0;
		for(int i = 0 ; i <= (b-a) ; i++) {
			if(c%(a+i) == 0) {
				 divisor += 1; 
			}
		}
		System.out.println(divisor);
		 
		sc.close();
	}

}

Measured memory_bytes: 26312
class UnionFind:
    def __init__(self, n):
        self._tree = [i for i in range(n)]
        self._rank = [1] * n
    def root(self, a):
        if self._tree[a] == a:return a
        self._tree[a] = self.root(self._tree[a])
        return self._tree[a]
    def is_same_set(self, a, b):
        return self.root(a)==self.root(b)
    def unite(self, a, b):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb: return
        if self._rank[ra] < self._rank[rb]:
            self._tree[ra] = rb
        else:
            self._tree[rb] = ra
            if self._rank[ra] == self._rank[rb]:
                self._rank[ra] += 1

n,q = map(int,input().split())
uft = UnionFind(n)
for i in range(q):
    c,x,y = map(int,input().split())
    if c==0:
        uft.unite(x,y)
    else:
        print(1 if uft.is_same_set(x,y) else 0)


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

int main()
{
	int i,j,k,n,x,a[101],b[101],c[101],count;
	for(i=1;i<=100;i++)
	{
		a[i]=b[i]=c[i]=i;
	}	
	while(true)
	{
		cin>>n>>x;
		count = 0;
		if(n==0&&x==0)
			return 0;
		for(i=1;i<=n;i++)
		{
			
			for(j=i+1;j<=n;j++)
			{
				for(k=j+1;k<=n;k++)
				{
					if((a[i]+b[j]+c[k])==x)
						count++;
					if((a[i]+b[j]+c[k])>x)
						break;
				}
				if((a[i]+b[j]) > x)
					break;
			}
			if(a[i]>x)
				break;
		}
		cout<<count<<endl;		
	}
	return 0;
 } 


Measured memory_bytes: 3092
def main():
    N = int(input())
    T, A = map(int, input().split())
    H = list(map(int, input().split()))
    for i in range(N):
        H[i] = abs(A - (T- H[i] * 0.006))
    print(H.index(min(H))+1)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
def divisor(i):
    s = []
    for j in range(1, int(i ** (1 / 2)) + 1):
        if i % j == 0:
            s.append(i // j)
            s.append(j)
    return sorted(set(s))

n, p = map(int, input().split())
s = divisor(p)
s.reverse()
ans = 1
for i in s:
    c = i
    m = 0
    if not i * n > p and not i == 1:
        if i % p == 0:
            m = 1
        for _ in range(n - 1):
            if c > p:
                m = 0
                break
            else:
                m = 1
            c = c * i
    if p % c == 0 and m == 1:
        ans = i
        break
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define  endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define pb push_back
#define pi acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const int N=2e5+10;
ll a[N];
bool jud(ll x)
{
	for(ll i=2;i*i<=x;i++){
		if(x%i==0) return 0;
	}
	return 1;
}
int main()
{
	ll n,m,q,k;
	int ans=0;
	cin>>n;
	for(ll i=2;i*i<=n;i++){
		if(n%i==0){
			int f=0,num=1;
			while(n%i==0) f++,n/=i;
			while(f>=num) f-=num,num++,ans++;
		}
	}
	if(n>1) ans++;
	cout<<ans;
}


Measured memory_bytes: 3628
import math
N = int(input())
ans = 0
if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(N-90)
elif N < 10000:
    print(909)
elif N < 100000:
    print(N-9090)
elif N < 1000000:
    print(90909)

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

namespace ConsoleApp15
{
    class Class82
    {
        static void Main()
        {
            string S = Console.ReadLine();
            bool ans = false;
            int bit = 0;
            for(; bit < (1<<3); bit++)
            {
                int num = int.Parse(S[0].ToString());
                for(int i = 1; i < 4; i++)
                {
                    if ((bit & (1 << i - 1)) != 0)
                    {
                        num += int.Parse(S[i].ToString());
                    }
                    else
                    {
                        num -= int.Parse(S[i].ToString());
                    }
                }
                if (num == 7) { ans = true;break; }
            }
            if (ans)
            {
                string r = S[0].ToString();
                for(int i = 1; i < 4; i++)
                {
                    if ((bit & (1 << i - 1)) != 0)
                        r += "+";
                    else r += "-";
                    r += S[i];
                }
                Console.WriteLine($"{r}=7");
            }
        }
    }
}


Measured memory_bytes: 13140
#include <cassert>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <stack>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<LL, LL> PII;

#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); puts("");}
vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x; while (getline(ss, x, c)) v.push_back(x); return v;}
void err(vector<string>::iterator it) {}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args) {cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}

#if (( _WIN32 || __WIN32__ ) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif

#define pb push_back
#define mp make_pair
#define all(x)  (x).begin(),(x).end()
#define tr(c, it)   for(auto it=c.begin(); it!=c.end(); it++)
#define clr(a, b)   memset(a, b, sizeof(a))
#define forn(i, n)   for(int i=0; i<n; i++)

const LL INF = 0x3f3f3f3f3f3f3f3fll;
LL h, w;
int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    //freopen("out", "w", stdout);
#endif

    while(cin >> h >> w)
    {
        if(h % 3 == 0 || w % 3 == 0)
        {
            cout << 0 << endl;
            continue;
        }

        LL ans = min(h, w);
        for(LL i=1; i<h; i++)
        {
            LL s1 = i * w;

            LL v1 = w / 2;
            LL v2 = w - v1;

            LL s2 = v1 * (h - i);
            LL s3 = v2 * (h - i);

            LL maxi = max(s1, max(s2, s3));
            LL mini = min(s1, min(s2, s3));
            LL cur = maxi - mini;

            if( (maxi - mini) < ans)
            {
                ans = maxi - mini;
            }
            //debug(i, cur, ans);
        }

        for(LL i=1; i<w; i++)
        {
            LL s1 = i * h;

            LL v1 = h / 2;
            LL v2 = h - v1;

            LL s2 = v1 * (w - i);
            LL s3 = v2 * (w - i);

            LL maxi = max(s1, max(s2, s3));
            LL mini = min(s1, min(s2, s3));

            LL cur = maxi - mini;

            if( (maxi - mini) < ans)
            {
                ans = maxi - mini;
            }
            //debug(i, cur, ans);
        }

        cout << ans << endl;


    }
    return 0;
}

Measured memory_bytes: 256
/* 
    Author : Jeff Ahn
    Sun 05 Jul 2020 05:08:27 AM PDT 
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,r) for(int i = 0; i < (r); i++)
#define pb push_back
#define all(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define uint unsigned long long
#define endl '\n'

int k;
int count(int rmask, int cmask, vector<vector<char>> grid) {
  int R = grid.size(), C = grid[0].size();
  for (int i = 0; i < R; i++) {
    if (rmask & (1 << i)) {
      for (int c = 0; c < C; c++) {
        grid[i][c] = '_';
      }
    }
  }
  for (int i = 0; i < C; i++) {
    if (cmask & (1 << i)) {
      for (int r = 0; r < R; r++) {
        grid[r][i] = '_';
      }
    }
  }
  int cnt = 0;
  rep(r,R) {
    rep(c,C) {
      if (grid[r][c]=='#') cnt++;
    }
  }
  return cnt == k;
}

signed main() {
  fastio;
  int R, C;
  cin >> R >> C >> k;
  vector<vector<char>> grid(R,vector<char>(C));
  rep(r, R) {
    rep(c, C){
      cin >> grid[r][c];
    }
  }

  int res = 0;
  for (int i = 0; i < (1<<R); i++) {
    for (int j = 0; j < (1<<C); j++) {
      res += count(i,j,grid);
    }
  }
  cout << res << endl;

}


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

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  x--;
  y--;
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int d = abs(i - j);
      d = min(abs(i - x) + 1 + abs(j - y), d);
      ans[d]++;
    }
  }
  for (int i = 1; i < n; i++) {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N, A; cin >> N >> A;
    vec x(N); readvec(x);

    int maxsum = 2500;
    mat dp(N + 1, vec(maxsum + 1, 0));
    dp[0][0] = 1;

    REP(i, N){
        mat tmp = dp;
        REP(j, N){
            REP(k, maxsum + 1 - x[i]){
                if(dp[j][k]) tmp[j + 1][k + x[i]] += dp[j][k];
            }
        }
        dp = tmp;
    }

    int ans = 0;
    FOR(i, 1, N + 1) ans += dp[i][A * i];
    cout << ans << endl;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 2316
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

const bool DEBUG = 0;
const int MAXN = 3005;

int n;
ll a[MAXN];
ll dp[MAXN][MAXN];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin>>n;
	forn(i,0,n) cin>>a[i];
	
	forn(i,0,n) forn(j,i,n) dp[i][j]=-INF;
	
	for(int l=n-1;l>=0;l--) forn(r,l,n)
	{
		dp[l][r]=max(dp[l][r], a[l]+min(dp[l+2][r]-(l<r?a[l+1]:0), dp[l+1][r-1]-(l<r?a[r]:0))); //take left
		dp[l][r]=max(dp[l][r], a[r]+min(dp[l+1][r-1]-(l<r?a[l]:0), dp[l][r-2]-(l<r?a[r-1]:0))); //take right
	}
	
	cout<<dp[0][n-1]<<'\n';
	
	return 0;
}


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

int main() {
  int A,B;
  cin>>A>>B;
  for(long long i=0;i<100000000;i++){
    if(B==1){
      cout<<"0"<< endl;
      return 0;
    }
      
    if((i+1)*A-i>=B){
      cout<<i+1<< endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    long long n, a, m = 0, r = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        if (a < m + 2)
        {
            m = max(a, m);
            continue;
        }
        r += (a - 1) / (m + 1), m += m == 0;
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
#define loop(i,n) for(ll i=0;i<(ll)(n);i++)
#define change(a,b) do{ll c=a; a=b; b=c;}while(0)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        change(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
int main()
{
  ll N,M;
  ll ans=1;
  cin>>N;
  loop(i,32){
    M=i;
    loop(j,11){
      M*=i;
      if(M<=N)ans=max(M,ans);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long dp[4000][4000],n, m, maxx;
string s, s1, ans;
int main()
{
	cin >> s >> s1;
	for (int i = 0; i < s.size(); i++)
	{
		for (int j = 0; j < s1.size(); j ++)
		{
			if (s[i] == s1[j])
		
				dp[i+1][j+1] = max (dp[i][j]+1, max (dp[i+1][j], dp[i][j+1]));
			if (s[i] != s1[j])
				dp[i+1][j+1] = max (dp[i][j], max (dp[i+1][j], dp[i][j+1]));
		}
	}
//	for (int i = 1; i <= s.size(); i ++)
///	{
//		for (int j = 1; j <= s1.size(); j ++)
//			cout << dp[i][j] << " ";
			
//		cout << endl;	
//	}
//	cout << dp[s.size()][s1.size()];
	n = s.size();
	m = s1.size();
	while (true)
	{
		maxx = max (dp[n-1][m-1], max (dp[n][m-1], dp[n-1][m]));
		if (maxx == dp[n][m] - 1) {
			ans += s[n-1];
			n--; m--;
		}
			else
		if (maxx == dp[n-1][m])
			n --;
				else
			m--;	
		if (n == 0 || m == 0) break;	
	}
	for (int i = ans.size()-1; i >= 0; i --)
		cout << ans[i];
}

Measured memory_bytes: 94208
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  int x, y;
  bool operator < (const P &a )const{
    //if(x!=a.x)
    return y<a.y;
  };
};

int a,b,c,d,i,k,n,m,e,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
long long o[42][1500010];
int l[2000041];
int j[41];
long long l2[50];

long long x,y,z,mod=1000000007;
//string r;
char r[223111];

P u[1];
priority_queue<int> q;
stack<int> s;
//set<P> s;
map<int,int> p;

vector<int> v;

bool as(P a,P b)
{
  //if(a.x!=b.x)
  //return a.x<b.x;
  return a.x<b.x;
}

int g(int m)
{
  if(l[m]>=0) return l[m];
  int k=1;
  vector<int> v;
  for(int x=m;x;x/=2)
  {
    if(x%2)
    {
      v.push_back(k);
      k=1;
    }
    else k++;
  }
  if(v.size())
  //for(int i=v.size();i>=2;i--)
  {
    
    int e1=b,e2=c,e3=d;
    for(int h=0;h<v.size();h++)
    {
      if(e3>0) e3-=v[h];
      else if(e2>0) e2-=v[h];
      else if(e1>0) e1-=v[h];
    }
    if(e1==0&&e2==0&&e3==0)
    {
    /*printf("%d: ",m);
    for(int h=0;h<v.size();h++)
      printf("%d ",v[h]);
    puts("");
    printf("%d %d %d\n",e1,e2,e3);*/
    return l[m]=1;
    }
  }
  return l[m]=0;
}

long long f(int n,int m)
{
  if(o[n][m]>=0) return o[n][m];
  //int k=1;
  long long k=0;
  if(g(m)) return o[n][m]=l2[a+1-n]%mod;
  if(n>a) return o[n][m]=k;
  //printf("%d %d\n",n,m);
  for(int t=1;t<=10;t++)
  {
    long long x=2*m+1;
    x*=j[t-1];
    x%=e;
    k+=f(n+1,(int)x);
    //if(n==1) printf("###%d %d %d %d %d\n",n+1,(int)x,f(n+1,(int)x),e,k);
    k%=mod;
  }
  //if(k)
  //printf("%d %d %d\n",n,m,k);
  
  /*if(k)
  for(int h=0;h<v.size();h++)
    printf("#%d ",v[h]);
  if(k)
  puts("");*/
  return o[n][m]=k;
}

int main()
{
  memset(o,-1,sizeof(o));
  memset(l,-1,sizeof(l));
  scanf("%d %d %d %d",&a,&b,&c,&d);
  j[0]=1;
  for(int t=1;t<=20;t++)
    j[t]=(1<<t);
  l2[0]=1;
  for(int t=1;t<=50;t++)
    l2[t]=l2[t-1]*10%mod;
  e=j[b+c+d+1];
  //for(int t=1;t<=a;t++)
    //scanf("%d",&l[t]);
  //printf("%d %d %d\n",f(1,0),f(5,67600),o[5][67600]);//f(a+1,(1<<4)+(1<<11)+(1<<16)));
  //for(int i=1;i<=10;i++)
  //  printf("%d ",f(2,1<<(i-1)));
  printf("%lld",f(1,0));
}
//0
//15



Measured memory_bytes: 500224
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

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

    ll x = 0;
    for(int i = 0; i < N; i++){
        if(i & 1) x -= A[i];
        else x += A[i];
    }
    x /= 2;

    vector<int> vec(N);
    vec[0] = 2*x;
    for(int i = 0; i < N-1; i++){
        vec[i+1] = (A[i] - vec[i]/2) * 2;
    }

    for(int i = 0; i < N; i++){
        cout << vec[i] << (i==N-1 ? '\n': ' ');
    }

    return 0;
}

Measured memory_bytes: 2048
#include <iostream>

using namespace std;

#define MIN(a,b) ((a)<(b)?(a):(b))

int main()
{
    int pastamin=2001;
    int drinkmin=2001;
    int temp;
    for(int i=0; i<3; ++i) {
        cin >> temp;
        pastamin=MIN(pastamin,temp);
    }
    for(int i=0; i<2; ++i) {
        cin >> temp;
        drinkmin=MIN(drinkmin,temp);
    }
    cout << pastamin+drinkmin-50 << endl;
    return 0;
}

Measured memory_bytes: 3088
#include <iostream>

using namespace std;

int main()
{
    int row,s;
    cin>>s;
    string arr[s];
    cin>>row;
    for (int i=0;i<s;i++){
        cin>>arr[i];

    }
    for(int j=0; j<s ;j++){
      cout<<arr[j]<<endl;
      cout<<arr[j]<<endl;
      }                

    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
ans=0

l = {}
r = {}
for i in range(1,n+1):
    if i-a[i-1] in l:
        l[i-a[i-1]]+=1
    else:
        l[i-a[i-1]]=1

    
    
    if i+a[i-1] in r:
        r[i+a[i-1]]+=1
    else:
        r[i+a[i-1]]=1
    

for i in l:
    if i in r:
        ans += l[i]*r[i]
    


print(ans)





Measured memory_bytes: 138852
#include <bits/stdc++.h>
#include <string>
#define MAX 100007
#define scn1(a) scanf("%d", &a);
#define scn2(a, b) scanf("%d %d", &a, &b);
#define scn3(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define lscn1(a) scanf("%lli", &a);
#define lscn2(a, b) scanf("%lli %lli", &a, &b);
#define lscn3(a, b, c) scanf("%lli %lli %lli", &a, &b, &c);
#define prnt(a) printf("%d\n", a);
#define for0(a, n) for(int i=a;i<n;i++)
#define forn(a, n) for(int i=a;i<=n;i++)
typedef unsigned long long int ll;
using namespace std;


int main()
{
//	#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//	#endif
	int tt=1;
//	scn1(tt);
	while(tt--)
    {
        int a, b, c;
        scn3(a, b, c);
        if(a+b+c >= 22) cout << "bust\n";
        else cout << "win\n";
    }
    return 0;
}



Measured memory_bytes: 384
n = int(input())
s = input()
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''
for i in range(len(s)):
    num = alp.index(s[i])
    num = (num + n)
    if num >= 26:
        num -= 26
    ans += alp[num]
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

string S;

int main(){
    cin >> S;
    bool flag = false;
    rep(i,sz(S)) rep(j,sz(S)) if(i <= j){
        string T = S.substr(0,i) + S.substr(j+1);
        if(T == "keyence") flag = true;
    }
    if(S == "keyence") flag = true;
    if(flag) cout << "YES" << '\n';
    else cout << "NO" << '\n';

}

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

typedef long long ll;
typedef pair<int, int> ii;

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

  if (p == "ABC")
    cout << "ARC" << endl;
  else
    cout << "ABC" << endl;

  return 0;
}


Measured memory_bytes: 3620
def li(s):
    lis = [[] for i in range(2**(len(s)-1))]
    bi = []
    if len(s) == 1:
        return [[int(s)]]
    for i in range(2**(len(s)-1)):
        bi.append(bin(i)[2:])
        while len(bi[i]) != len(s)-1:
            bi[i] = "0"+bi[i]

    for i in range(len(bi)):
        v = 0
        for j in range(len(bi[i])):
            if bi[i][j] == "1":
                lis[i].append(int(s[v:j+1]))
                v = j+1
            if j == len(bi[i])-1:
                lis[i].append(int(s[v:]))
    return lis

s = input()
ans = 0
lis = li(s)

for i in lis:
    for j in i:
        ans += j
print(ans)

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int h,w;
    cin >> h >> w;
    string bomb[50];
    REP(i,h){
        cin >> bomb[i];
    }
    const int dx[8] = {1,0,-1,0,1,-1,-1,1};
    const int dy[8] = {0,1,0,-1,1,1,-1,-1};


    REP(i,h){
        REP(j,w){
            if(bomb[i][j]=='#')continue;
            int num = 0;
            for(int d=0;d<8;d++){
                const int ni = i + dy[d];
                const int nj = j + dx[d];
                //場外アウト
                if(ni<0||h<=ni)continue;
                if(nj<0||w<=nj)continue;
                //移動先が'#'
                if(bomb[ni][nj]=='#')num++;
            }
            bomb[i][j] = char(num + '0');
        }
    }
    REP(i,h){
        cout << bomb[i] << endl;
    }
    return 0;
}    

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int main(){
	
	long long int X, Y;
	cin >> X >> Y;
	
	int ans = 0;
	
	for(int i = 0; i < 10000; i++){
		ans++;
		Y /= 2;
		if(X > Y){
			break;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] pasta = new int[3];
		int[] juice = new int[2];
		for(int i=0;i<3;i++){
			pasta[i] = sc.nextInt();
		}
		for(int i=0;i<2;i++){
			juice[i] = sc.nextInt();
		}
		int bestpasta = pasta[0];
		int bestjuice = juice[0];
		for(int i=1;i<3;i++){
			if(bestpasta > pasta[i]){
				bestpasta = pasta[i];
			}
		}
		for(int i=1;i<2;i++){
			if(bestjuice > juice[i]){
				bestjuice = juice[i];
			}
		}
		System.out.println(bestpasta + bestjuice - 50);	
	}
}	

Measured memory_bytes: 17164
object Main extends App {
    val in = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))
    val days = List(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
    val days2 = List(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
    for (Array(y1, m1, d1, y2, m2, d2) <- in if y1 != -1) {
        val tmp = (y1 to y2).flatMap(y =>
            if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) days2
            else days
        )
        println(tmp.drop(m1-1).dropRight(13-m2).sum - d1 + d2)
    }
}

Measured memory_bytes: 47852
import sys
fin = sys.stdin.readline


S = fin()[:-1]
T = fin()[:-1]

correspondence = dict()
for char_s, char_t in zip(S, T):
    if char_s not in correspondence:
        correspondence[char_s] = char_t
    else:
        if char_t != correspondence[char_s]:
            print("No")
            exit(0)
if len(set(correspondence.values())) < len(correspondence):
    print("No")
else:
    print("Yes")



Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
#include<cstring>
#include<stack>
#include<cstdlib>
#include<cmath>
using namespace std;

int main()
{
	long long n, p;
	vector<long long> v;
	cin >> n >> p;

	if (n == 1) {
		cout << p << endl;
		return 0;
	}

	while (p % 2 == 0) {
		v.push_back(2);
		p /= 2;
	}
	for (long long i = 3; p!=1 && i*i <= p; i+=2) {
		if (p % i == 0) {
			v.push_back(i);
			p /= i;
			i-=2;
			continue;
		}
	}
	if (p != 1)
		v.push_back(p);
	int cnt = 0, num = -1, ans = 1;
	for (long long i = 0; i < v.size(); i++) {
		if (v[i] == num)
			cnt++;
		else
			cnt = 1;

		if (cnt == n) {
			ans *= v[i];
			cnt = 0;
		}
		num = v[i];
	}
	cout << ans << endl;
}

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

int dp[21][50001];

int main(void){

	int n, m;
	cin >> n >> m;

	int c[21];
	for (int i = 1; i <= m; i++) cin >> c[i];

	for (int i = 0; i <= m; i++){
		
		dp[i][0] = 0;
		for (int j = 1; j <= n; j++){

			if (i == 0) dp[i][j] = 100000;
			else{
				if (j < c[i]) dp[i][j] = dp[i - 1][j];
				else dp[i][j] = min(dp[i - 1][j], min(dp[i - 1][j - c[i]] + 1, dp[i][j - c[i]] + 1));
			}
		}
	}

	cout << dp[m][n] << endl;
	return 0;
}

Measured memory_bytes: 5264
#include <bits/stdc++.h>
#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++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SC second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll cnt = 0;
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;}


int main()
{
  int n, q ;
  cin >> n >> q ;
  string s ;
  cin >> s ;
  vector<int> vec(n+1,0) ;
  int cnt = 0 ;
  int c ;
  
  REP(i,n){
    if(s.substr(i,2)=="AC"){
      cnt++ ;
    }
    vec.at(i+1) = cnt ;
  }
  
  
  REP(i,q){
    int a, b ;
    cin >> a >> b ;
    cout << vec.at(b-1)-vec.at(a-1) <<endl ;
  }

    

  return 0 ;
}




Measured memory_bytes: 1408
class FenwickTree():
    def __init__(self, n):
        self.n = n
        self.data = [0] * n

    def build(self, arr):
        #assert len(arr) <= n
        for i, a in enumerate(arr):
            self.data[i] = a
        for i in range(1, self.n + 1):
            if i + (i & -i) <= self.n:
                self.data[i + (i & -i) - 1] += self.data[i - 1]

    def add(self, p, x):
        #assert 0 <= p < self.n
        p += 1
        while p <= self.n:
            self.data[p - 1] += x
            p += p & -p

    def sum(self, r):
        s = 0
        while r:
            s += self.data[r - 1]
            r -= r & -r
        return s

    def range_sum(self, l, r):
        #assert 0 <= l <= r <= self.n
        return self.sum(r) - self.sum(l)

import sys
input = sys.stdin.buffer.readline

N, Q = map(int, input().split())
A = tuple(map(int, input().split()))

ft = FenwickTree(N)
ft.build(A)
res = []

for _ in range(Q):
    q, x, y = map(int, input().split())
    if q:
        res.append(str(ft.range_sum(x, y)))
    else:
        ft.add(x, y)

print('\n'.join(res))

Measured memory_bytes: 166896
N = int(input())
A = list(map(int, input().split(' ')))
ans = 0
gap = 0
for i in range(1,N):
  if ( A[i-1] + gap ) > A[i]:
    gap = ( A[i-1] + gap ) - A[i]
  else:
    gap = 0
  ans += gap
    
print(ans)

Measured memory_bytes: 32368
#include <stdio.h>
using namespace std;
void insertionSort(int[],int);
void callarr(int[],int);
int main()
{   
    int N;
    int arr[110];
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&arr[i]);
    }
    insertionSort(arr,N);
    return 0;
}
void insertionSort(int arr[],int N)
{   
    callarr(arr,N);
    for(int i=1;i<N;i++){
        int v=arr[i];
        int j=i-1;
        while(j>=0&&arr[j]>v){
            arr[j+1]=arr[j];
            j--;
        }
        arr[j+1]=v;
        callarr(arr,N);
    }
}
void callarr(int arr[],int N){
    for(int k=0;k<N-1;k++) printf("%d ",arr[k]);
        printf("%d\n",arr[N-1]);

}


Measured memory_bytes: 2740
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	cout << n-k+1 << endl;
	return 0;
}


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


int  main (){
	int N; cin >> N;
	set <int> s;
	for (int i = 0; i < N; i++) {
		int m; cin >> m;
		s.insert(m);
	}
	cout << s.size() << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import bisect
input = sys.stdin.readline

def main():
    n=int(input())
    a=[0 for _ in range(n)]
    for i in range(n):
        a[i]=int(input())
    M=max(a)
    cnt=0
    ans=0
    S=0
    for i in range(n):
        if(a[i]!=M and a[i]>S):
            S=a[i]
        elif(a[i]==M):
            cnt+=1
    
    for i in range(n):
        if(a[i]!=M or cnt>1):
            ans=M
        else:
            ans=S
        print(ans)        
main()



Measured memory_bytes: 12528
//解説参考

#include<iostream>
#include<string>
using namespace std;

int main() {
	int h, w;
	cin >> h >> w;

	string s[50];
	for (int i = 0; i < h; i++) cin >> s[i];


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

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') continue;


			int num = 0;
			for (int d = 0; d < 8; d++) {
				const int di = i + dy[d];
				const int dj = j + dx[d];

				if (di < 0 || h <= di) continue;
				if (dj < 0 || w <= dj) continue;
				if (s[di][dj] == '#') num++;
			}

			s[i][j] = char('0' + num);
		}
	}

	for (int i = 0; i < h; i++) cout << s[i] << endl;

	return 0;
}

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

int main() {
  // ここにプログラムを追記
  int a, b;
  cin >> a;
  b = a % 2; 
  b += a / 2 % 2;
  b += a / 2 / 2 % 2;
  cout << b << endl;
}

Measured memory_bytes: 3592
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
pD=[]
mD=[]
for i in range(N):
  d=A[i]-B[i]
  if d>=0:
    pD.append(d)
  else:
    d*=(-1)
    mD.append(d)
if sum(A)<sum(B):
  print(-1)
  exit()
if len(mD)==0:
  print(0)
  exit()
pD=sorted(pD)[::-1]
a=sum(mD)
import numpy
X=numpy.cumsum(pD)
x=0
for i in range(len(pD)):
  if X[i]>=a:
    x=(i+1)
    print(len(mD)+x)
    exit()

Measured memory_bytes: 32180
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 100000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;

int main() {
    LL x,y;
    scanf("%lld%lld",&x,&y);
    if(llabs(x-y)>=2)
        printf("Alice\n");
    else
        printf("Brown\n");

    return 0;
}

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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl

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

    ll n,m;
    cin >> n >> m;
    rep(i,m+1){
        if(i==0) continue;
        if(n==4) print("2 3");
        else if(i==1) print(i<<" "<<n-i);
        else if(i<=(n/2-1)/2 && !(n&1)) print(i<<" "<<n-i);
        else print(i<<" "<<n-i-1+(n&1));
    }
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  	ci(n);
  ll ans=0;
  FOR(i,0,4){
    if(n%10==2){
      ans++;
    }
    n/=10;
  }
  co(ans)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
// グリッドグラフの移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};



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

int M, D; cin >> M >> D;

int cnt = 0;
rep(m, 4, min(M, 81) + 1) {
    rep(d10, 2, 10) rep(d1, 2, 10){
        int d = d10 * 10 + d1;
        if (d <= D && m == d10 * d1) ++cnt;
    }
}

cout << cnt << "\n";

}

// 境界，出力文字列 チェック



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[100005];
int tl,tr,ans[100005];
int main()
{
	scanf("%s",s+1);
	int len=strlen(s+1);
//	while(s[i]=='R')
	//	i++,tr++;
	for(int i=1;i<=len;)
	{
		if(s[i]=='L')
		{
			ans[i]+=tr/2,ans[i-1]+=tr/2;
			if(tr%2==1)
				ans[i-1]++;
			tr=0;
			int i1=i;
			while(s[i]=='L')
			 	i++,tl++;
			ans[i1]+=tl/2,ans[i1-1]+=tl/2;
			if(tl%2==1)
				ans[i1]++;
			tl=0;
		}
		while(s[i]=='R')
			i++,tr++;
	}
	for(int i=1;i<=len;i++)
		printf("%d ",ans[i]);
}

Measured memory_bytes: 896
/**
 *   created: 01 June 2019  12:55:56
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


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

//                                        //AUTHOR: Kaushalesh Shukla

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

int main()
{
	optimizeIO();
	int tt=1;
	//cin>>tt;
	while(tt--){
		int n,m,k;
		cin>>n>>m>>k;
		vi cnt;
		rep(i,1,105){
			if(n%i==0 && m%i==0)
				cnt.push_back(i);
			
		}
		cout<<cnt[cnt.size()-k];
	}
	return 0;
}


Measured memory_bytes: 256
#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 INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
	int n, a;
	cin >> n >> a;
	cout << n * n - a << endl;
}


Measured memory_bytes: 256
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
    
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
cnt=0
ans=0
for i in range(n):
	a=list(map(int,input().split()))
	for j in range(m):
		ans+=a[j]*b[j]
	if ans+c>0:
		cnt+=1
	ans=0
	
print(cnt)

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

long long N;
//          number of person, id
vector<pair<long long, long long> > A;

int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		long long num;
		cin >> num;
		A.push_back(make_pair(num, i + 1));
	}

	sort(A.begin(), A.end());
	for(long long i = 0; i < N; i++){
		cout << A[i].second;
		if(i != N-1){
			cout << " ";
		}
	}
	cout << endl;
}

Measured memory_bytes: 2544
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define agewari(a, b) ((ll)a + ((ll)b - 1)) / b
const int MOD = 1000000007;
const long long INF = 1LL << 60;
using Graph = vector<vector<ll>>;

int main()
{
    ll h,w;
    cin>>h>>w;
    if(h==1||w==1){
        cout<<1<<endl;
    }else{
        cout<<agewari(h*w,2)<<endl;
    }
}

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

int n, m;
map<int, vector<pair<int,int>>> mp;
map<int,int> loc;


bool dfs(int p, int coord) {
  loc[p] = coord;
  for (auto y: mp[p]) {
    int dest = y.second;
    int coord_dest = coord + y.first;
    if (loc.find(dest) != loc.end() && loc[dest] != coord_dest) {
      return false;
    }
    if (loc.find(dest) != loc.end() && loc[dest] == coord_dest) {
      continue;
    }
    if (loc.find(dest) == loc.end() && !dfs(dest, coord_dest)) {
      return false;
    }
  }
  return true;
}


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

  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y, d; cin >> x >> y >> d;
    mp[x].push_back(make_pair(d,y));
    mp[y].push_back(make_pair(-d,x));
  }

  for (auto x: mp) {
    if (loc.find(x.first) == loc.end()) {
      if (!dfs(x.first, 0)) {
	cout << "No" << endl;
	return 0;
      }
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 24960