akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
inline ll lin() { ll x; scanf("%lld",&x); return x;}
inline char chin() { char x; scanf("%c",&x); return x;}
inline string stin() { string x; cin >> x; return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
char itoa(int n) { return n + '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;}

void insertionSort(vi &a, int n) {
  for (int i = 1; i < n; ++i) {
    int v = a[i];
    int j = i - 1;
    while (j >= 0 && a[j] > v) {
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = v;
    showv(a);
  }
}

int main () {
  int n = in();
  vi a; rep(i,n) a.pb(in());
  showv(a);
  insertionSort(a,n);
  return 0;
}


Measured memory_bytes: 3252
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

void solve()
{
    IN(h);
    ll c = 0;
    while (h > 0)
    {
        h /= 2;
        ++c;
    }
    cout << pow(2, c)-1 << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 384
n=int(input())
a=list(map(int,input().split()))
x,m=0,0
for i in range(n):
    m+=abs(x-a[i])
    x=a[i]
m+=abs(x)
for i in range(n):
    ans=m
    if i==0: ans+=abs(a[i+1])-abs(a[i+1]-a[i])-abs(a[i])
    elif i==n-1:
        ans+=abs(a[i-1])-abs(a[i])-abs(a[i]-a[i-1])
    else:
        ans+=abs(a[i+1]-a[i-1])-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])
    print(ans)

Measured memory_bytes: 14048
import java.util.*;
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 d = sc.nextInt();
      
      	while(true){
        	c -= b;
          	if(c <= 0){
            	System.out.println("Yes");
              	break;
            }
            a -= d;
            if(a <= 0){
            	System.out.println("No");
              	break;
            }                     
        }
    }
}

Measured memory_bytes: 35604
import Data.Array
main = do
    [h,w] <- map read . words <$> getLine
    grid <- array ((1,1),(h,w)) . zip [(i,j)|i <- [1..h], j <- [1..w]] . concat . lines <$> getContents
    let ans = array ((1,1),(h,w)) [((i,j), f grid i j)| i <- [1..h], j <- [1..w]]
             where f :: Array (Int,Int) Char -> Int -> Int -> Int
                   f g 1 1 = if g ! (1,1) == '#' then 1 else 0
                   f g i j = min di dj
                        where cij = g ! (i,j)
                              ci1j = if i >= 2 then g ! (i-1,j) else cij
                              cij1 = if j >= 2 then g ! (i,j-1) else cij
                              di1j = if i >= 2 then ans ! (i-1,j) else 200
                              dij1 = if j >= 2 then ans ! (i,j-1) else 200
                              di = if ci1j == '.' && cij == '#' then di1j + 1 else di1j
                              dj = if cij1 == '.' && cij == '#' then dij1 + 1 else dij1
    print $ ans ! (h,w)

Measured memory_bytes: 2684
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;


int main()
{
    
    int H,W;
    cin >> H >> W;
    vector<string> S(H);
    for(int i=0;i<H;i++) cin >> S[i];
    
    vector<vector<int>> hlight(H), vlight(H);
    
    for(int i=0;i<H;i++)
    {
        vlight[i].assign(W, 1);
        
        hlight[i].assign(W, 1);
        hlight[i][0] = ( S[i][0] == '.' );
        for(int j=1;j<W;j++)
        {
            if(S[i][j] == '.') hlight[i][j] = hlight[i][j - 1] + 1;
            else hlight[i][j] = 0;
        }
        for(int j=W-1;j>=1;j--)
        {
            if(S[i][j] != '#' && S[i][j - 1] != '#')
            {
                hlight[i][j -1] = hlight[i][j];
            }
        }
    }
    
    for(int j=0;j<W;j++)
    {
        vlight[0][j] = ( S[0][j] == '.' );
        for(int i=1;i<H;i++)
        {
            if(S[i][j] == '.') vlight[i][j] = vlight[i - 1][j] + 1;
            else vlight[i][j] = 0;
        }
        for(int i=H-1;i>=1;i--)
        {
            if(S[i][j] != '#' && S[i - 1][j] != '#')
            {
                vlight[i - 1][j] = vlight[i][j];
            }
        }
    }
    
    int maxrange = 0;
    
    for(int i=0;i<H;i++)
    {
        for(int j=0;j<W;j++)
        {
            if(S[i][j] != '#')
            {
                maxrange = max(maxrange, hlight[i][j] + vlight[i][j] - 1);
            }
        }
    }
    cout << maxrange << endl;
    
    return 0;
}


Measured memory_bytes: 35712
#include<cstring>
#include<set>
#include<cstdio>
using namespace std;

int par[1010], h[1010];

inline void init(int n){
  for(int i=0;i<n;i++){
    par[i] = i;
    h[i] = 0;
  }
}

inline int find(int x){
  if(par[x] == x)return x;
  return par[x] = find(par[x]);
}

inline bool same(int a,int b){
  return find(a) == find(b);
}

inline void unite(int a, int b){
  a = find(a); b = find(b);
  if(same(a,b))return;

  if(h[a] < h[b])par[a] = b;
  else{
    par[b] = a;
    if(h[a] == h[b])h[a]++;
  }
}

const int N = 1001;

int main(){
  int v,d,f[1010];
  f[0] = f[1] = 1;
  for(int i=0;i<N;i++)f[i+2] = (f[i] + f[i+1]) % N;

  while(scanf("%d%d",&v,&d)!=EOF){
    init(v);
    for(int i=0;i<v;i++){
      for(int j=i+1;j<v;j++){
	int tmp = f[i+2]-f[j+2];
	if(tmp<0)tmp *= -1;
	if(tmp < d)unite(i,j);
      }
    }

    bool use[1010] = {};
    int ans = 0;
    for(int i=0;i<v;i++){
      if(!use[find(i)]){
	ans++;
	use[par[i]] = true;
      }
    }

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

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

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

//{{{
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
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) {}
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...);}
// clang-format on
//}}}

const int N = 1e5 + 10;
int T;
int n;

struct I
{
    LL w, s, v;
} item[1010];

bool cmp(const I& a, const I& b) { return a.s + a.w < b.s + b.w; }

LL dp[1010][100010];

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
// freopen("out", "w", stdout);
#endif

    while (cin >> n)
    {
        for (int i = 1; i <= n; i++)
        {
            cin >> item[i].w >> item[i].s >> item[i].v;
        }
        sort(item + 1, item + 1 + n, cmp);

        clr(dp, -1);
        dp[0][0] = 0;

        for (int i = 0; i < n; i++)
        {
            LL w = item[i + 1].w;
            LL s = item[i + 1].s;
            LL v = item[i + 1].v;

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

            for (int j = 0; j <= 100000; j++)
            {
                if (dp[i][j] == -1) continue;
                if (j + w > 100000) continue;

                if (s >= j)
                {
                    dp[i + 1][j + w] = max(dp[i + 1][j + w], dp[i][j] + v);
                    // debug(w, s, j, i + 1, j + w, dp[i + 1][j + w]);
                }
                else
                {
                    if (dp[i][s] != -1)
                    {
                        dp[i + 1][s + w] = max(dp[i + 1][s + w], dp[i][s] + v);
                        // debug(w, s, j, i + 1, s + w, dp[i + 1][s + w]);
                    }
                }
            }
        }
        LL ans = 0;
        for (int i = 0; i <= 100000; i++)
        {
            ans = max(ans, dp[n][i]);
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 792620
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m = LI()
    if n == 1 and m == 1:
        return 1

    if n == 1:
        return m - 2
    if m == 1:
        return n - 2

    return (n-2) * (m-2)


print(main())




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

void prians(bool answer) {
  if(answer)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
string s, t;
bool ans = 1;

int main() {
  cin >> s >> t;
  for(int i = 0; i < 3; ++i)
    if(s[i] != t[2 - i]) ans = 0;
  prians(ans);
  return 0;
}

Measured memory_bytes: 256
class SparseTable():
    def __init__(self,A):
        N=len(A)
        n=N.bit_length()
        self.table=[[-1 for i in range(n)] for i in range(N)]

        for i in range(N):
            self.table[i][0]=A[i]

        for j in range(1,n):
            for i in range(0,N-2**j+1):
                f=self.table[i][j-1]
                s=self.table[i+2**(j-1)][j-1]
                self.table[i][j]=min(f,s)

    def query(self,s,t):
        b=t-s+1
        m=b.bit_length()-1
        return min(self.table[s][m],self.table[t-2**m+1][m])

class BIT():
    def __init__(self,n):
        self.BIT=[0]*(n+1)
        self.num=n

    def query(self,idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx&(-idx)
        return res_sum

    #Ai += x O(logN)
    def update(self,idx,x):
        while idx <= self.num:
            self.BIT[idx] += x
            idx += idx&(-idx)
        return

alphabetlist=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
dic={i:e for e,i in enumerate(alphabetlist)}


import sys

input=sys.stdin.readline

N=int(input())
S=[input().rstrip() for i in range(N)]
for i in range(N):
    temp=[S[i][-j-1] for j in range(len(S[i]))]
    S[i]="".join(temp)
S.sort()

def Solve(S):
    exact=[0 for i in range(N)]
    for i in range(1,N):
        id=0
        limit=min(len(S[i]),len(S[i-1]))
        while limit>id and S[i][id]==S[i-1][id]:
            id+=1
        exact[i]=id

    lastappear=[[-1 for i in range(26)] for j in range(N)]
    for i in range(N):
        for j in range(len(S[i])):
            id=dic[S[i][j]]
            lastappear[i][id]=j

    Sparse=SparseTable(exact)

    def cond(s,n,val):
        if n==N or s==-1:
            return False
        check=Sparse.query(s,n)
        return check>=val

    query=[]
    bit=[BIT(N) for i in range(26)]
    res=-N
    for i in range(N):
        L,R=i+1,i+1
        if i!=N-1 and exact[i+1]>=len(S[i])-1:
            start=i+1
            end=N
            while end-start>1:
                test=(end+start)//2
                if cond(i+1,test,len(S[i])-1):
                    start=test
                else:
                    end=test
            R=start+1
        if i!=0 and exact[i]>=len(S[i])-1:
            start=-1
            end=i
            while end-start>1:
                test=(end+start)//2
                if cond(test,i,len(S[i])-1):
                    end=test
                else:
                    start=test
            L=end
        query.append((len(S[i])-1,L,R,dic[S[i][-1]]))
        for j in range(26):
            if lastappear[i][j]!=-1:
                query.append((lastappear[i][j],N+1,i+1,j))

    query.sort(reverse=True)

    for val,l,r,id in query:
        if l==N+1:
            bit[id].update(r,1)
        else:
            res+=bit[id].query(r)-bit[id].query(l-1)
    return res

ans=0
ans+=Solve(S)
print(ans)


Measured memory_bytes: 461808
#include<bits/stdc++.h>
using namespace std;
int wa(int n){
    int sum=0;
    while (n>0)
    {
        sum+=n%10;
        n /=10;
    }
    return sum;
}
int main(){
    int N,ans;
    ans=0;
    int d[110];
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin>>d[i];
    }   
    sort(d,d+N);
    for (int i = 0; i < N-1; i++)
    {
        if (d[i]<d[i+1])
        {
            ans++;
        }
        
    }
    cout << ans+1<<endl;
    
}

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

int main() {
  int H, W;
  cin >> H >> W;
  
  vector<char> img(H * W);
  for (int i = 0; i < H * W; i++) {
    cin >> img.at(i);
  }
  
  for (int i = 0; i < W + 2; i++)
    cout << "#";
  cout << endl;
     
  
  for (int i = 0; i < H; i++) {
    cout << "#";
    for (int j = 0; j < W; j++){
        cout << img.at(i * W + j);
    }
    cout << "#" << endl;
  }
  
  for (int i = 0; i < W + 2; i++)
    cout << "#";
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main(){
    int N,M;
    cin>>N>>M;
    if(N==M)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n) {
    map<double, set<string>> v;
    while (n--) {
      string l;
      int p, a, b, c, d, e, f, s, m;
      cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
      int g = f * s * m - p;
      int t = a + b + c + (d + e) * m;
      v[1.0 * g / t].insert(l);
    }
    vector<pair<double, set<string>>> w;
    for (auto &p : v) w.emplace_back(p);
    sort(rall(w));
    for (auto &p : w) {
      for (auto &s : p.second) cout << s << endl;
    }
    cout << '#' << endl;
  }
}

Measured memory_bytes: 3036
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


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

int main(){
    vector<vector<int>> c(3,vector<int>(3));

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

    int a[3];
    int b[3];

    a[0] = 0;
    b[0] = c[0][0],b[1] = c[0][1],b[2] = c[0][2];   
    a[1] = c[1][0] - b[0];
    a[2] = c[2][0] - b[0];

    if (a[2] + b[2] == c[2][2] and a[2] + b[1] == c[2][1] and a[1] + b[2] == c[1][2] and a[1] + b[1] == c[1][1]){
        cout << "Yes" << endl;
    } 
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
H,N = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
maxAi = max(a for a,b in AB)
dp = [0]*(H+maxAi)

for i in range(1,H+maxAi):
  dp[i] = min(dp[i-a] + b for a,b in AB)
print(min(dp[H:H+maxAi]))

Measured memory_bytes: 3664
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  map<int, int> amap;
  int ans = 0;
  int tmp;
  for(int i=0;i<N;++i) {
    cin>>tmp;
    if(amap[tmp]==0) ans++;
    amap[tmp]++;
  }
  cout<<ans<<endl;
}



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

int main() {
    cin.tie(0)->sync_with_stdio(false);

	int n; cin >> n;
	vector<int> a(n + 1, 0);
	REP(i, n) cin >> a[i + 1];

	vector<int> b(n + 1, 0), res(n + 1, 0);
	int m = 0;
	for (int i = n; i > 0; i--) {
		int sum = 0;
		for (int j = i * 2; j <= n; j += i)
			sum += b[j];
		if (sum % 2 != a[i]) {
			b[i] = 1;
			res[++m] = i;
		}
	}
	cout << m << '\n';
	for (int i = 1; i <= m; i++)
		cout << res[i] << " ";
    return 0;
}

Measured memory_bytes: 5524
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>

using ll = long long;
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;

int main(){

    int n,k; cin >> n >> k;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];
    ll cnt=0, sum=0;

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

    rep(i,n-k){
        sum+=h[i];
    }


    cout << sum << endl;
     return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#define OK 128

const int INF = 1<<25;

int di(const int d[OK][OK],int n,int s,int f){
	int i,j,dist[OK],done[OK];
	for(i=1;i<=n;i++){
		dist[i]=INF;
		done[i]=0;
	}
	dist[s]=0;
	
	for(;;){
		int e=-1;
		for(i=1;i<=n;i++) if(done[i]==0 && (e==-1 || dist[i] < dist[e])) e=i;
		
		if(e==-1) break;
		
		done[e]=1;
		if(e==f) return dist[e];
		for(i=1;i<=n;i++){
			int pw=dist[e]+d[e][i];
			if(pw<dist[i]) dist[i]=pw;
		}
		//printf("dist[%d] =%d\n",e,dist[e]);
	}
	return INF;
}

int main(){
	int n,k,f,a,b,c,d,e,i,j,an,is[OK][OK];
	for(;;){
		scanf("%d%d",&n,&k);
		if(!n && !k) break;
		for(i=0;i<=n;i++) for(j=0;j<=n;j++){
			is[i][j]=INF;
			if(i==j)is[i][j]=0;
		}
		
		for(i=0;i<k;i++){
			scanf("%d",&f);
			if(f){
				scanf("%d%d%d",&c,&d,&e);
				if(is[c][d]>e){
					is[c][d]=e;
					is[d][c]=e;
				}
			}
			else{
				scanf("%d%d",&a,&b);
				an=di(is,n,a,b);
				if(an==INF)an=-1;
				printf("%d\n",an);
			}
		}
	}

}

Measured memory_bytes: 820
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner

func init() {
	sc = bufio.NewScanner(os.Stdin)
	buffsize := 1000000
	buff := make([]byte, buffsize)
	sc.Buffer(buff, buffsize)
	sc.Split(bufio.ScanWords)
}

func loadint() (result int) {
	sc.Scan()
	result, _ = strconv.Atoi(sc.Text())
	return
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func solve(n int, xs, ys []int) {
	maxd := 0
	evendCount := 0
	for i := 0; i < n; i++ {
		d := abs(xs[i]) + abs(ys[i])
		if d > maxd {
			maxd = d
		}
		if d%2 == 0 {
			evendCount++
		}
	}

	if evendCount != 0 && evendCount != n {
		fmt.Println(-1)
		return
	}

	var l int
	for l = 0; (1 << uint(l)) <= maxd; l++ {
	}

	var armlen []int

	if evendCount > 0 {
		armlen = append(armlen, 1)
	}
	for i := 0; i < l; i++ {
		armlen = append(armlen, 1<<uint(l-i-1))
	}

	fmt.Println(len(armlen))

	for i := 0; i < len(armlen); i++ {
		fmt.Print(armlen[i], " ")
	}
	fmt.Println()

	for i := 0; i < n; i++ {
		x := 0
		y := 0
		for j := 0; j < len(armlen); j++ {
			cmd := "R"
			if j == 0 && evendCount > 0 {
				cmd = "R"
				x++
			} else {
				dx := xs[i] - x
				dy := ys[i] - y
				if dx > dy {
					if dx > -dy {
						cmd = "R"
						x += armlen[j]
					} else {
						cmd = "D"
						y -= armlen[j]
					}
				} else {
					if dx > -dy {
						cmd = "U"
						y += armlen[j]
					} else {
						cmd = "L"
						x -= armlen[j]
					}
				}
			}
			fmt.Print(cmd)
		}
		fmt.Println()
	}

}

func main() {
	n := loadint()

	x := make([]int, n)
	y := make([]int, n)

	for i := 0; i < n; i++ {
		x[i] = loadint()
		y[i] = loadint()
	}

	solve(n, x, y)
}


Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

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

    double ans=0;
    double local;
    string s;

    for(int i=0;i<n;i++){
        cin >> local >> s ;
        if(s=="JPY")ans += local;
        else ans += local * 380000;

    }

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            var i = cin.nextInt();

            Console.WriteLine(n-i+1);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 11092
import itertools

K = int(input())

dp = [[0,1,1,1,1,1,1,1,1,1]]
lunlun_cnt = [9]

i = 1

while True:
    dp.append([0]*10)
    lunlun_cnt_tmp = 0

    for j in range(10):
        if j == 0:
            dp[i][j] = dp[i-1][j] + dp[i-1][j+1]
        elif j == 9:
            dp[i][j] = dp[i-1][j-1] + dp[i-1][j]
        else:
            dp[i][j] = dp[i-1][j-1] + dp[i-1][j] + dp[i-1][j+1]
        lunlun_cnt_tmp += dp[i][j]
    
    i += 1

    if lunlun_cnt[-1] + lunlun_cnt_tmp >= K:
        break
    else:
        lunlun_cnt.append(lunlun_cnt[-1] + lunlun_cnt_tmp)

if K <= 9:
    pos = K
    digit = 0
else:
    pos = K - lunlun_cnt[-1]
    digit = len(lunlun_cnt)

cnt = 0
flag = False

keta = [-1,0,1]

for i in range(9):
    for keta_shift in itertools.product(keta, repeat=digit):
        flag2 = False
        r = i+1
        for j in range(digit):
            r += keta_shift[j]
            if r < 0 or r > 9:
                flag2 = True
                break
        
        if flag2:
            continue

        cnt += 1
        if cnt == pos:
            flag = True
            break
    if flag:
        break

res = [i+1]
for i in range(digit):
    res.append(res[-1] + keta_shift[i])

print(''.join(list(map(str,res))))

Measured memory_bytes: 9332
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
////////////////////////////////////////////////
int main()
{
    string s;
    cin >> s;
    int n = s.length();
    rep(i, n)
    {
        if ((i + 1) % 2 == 0 && s[i] == 'R')
        {
            cout << "No" << endl;
            break;
        }
        if ((i + 1) % 2 == 1 && s[i] == 'L')
        {
            cout << "No" << endl;
            break;
        }
        if (i == n - 1)
            cout << "Yes" << endl;
    }
}

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

int main(){
  int K, N;
  cin >> K >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  
  int diff = A.at(0) + (K-A.at(N-1));
  for(int i = 0; i < N-1; i++){
    diff = max(diff, A.at(i+1) - A.at(i));
  }
  
  cout << K-diff << endl;
  return 0;
}

Measured memory_bytes: 1024
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n,x;
	cin>>n>>x;
	int a[n];
	vi g;
	g.pb(0);
	int prefix_sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		prefix_sum+=a[i];
		g.pb(prefix_sum);
	}
	int ans=upper_bound(g.begin(),g.end(),x)-g.begin();
	cout<<ans<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}


Measured memory_bytes: 3668
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long int MOD = 1000000007;

long long int fact(long long int k) {
	long long int sum = 1;
	for (long long int i = 2; i <= k; i++)
		sum *= i;

	return sum;
}

int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

long long int pow_mod(int a, int b) {
	long long int  ans = 1;
	for (int i = 0; i < b; i++)
		ans = (ans * a) % MOD;

	return ans;
}


int main()
{
	long long int a, b, r, x, tmp;
	string s, t;

	cin >> a >> b;
	
	x = a * b;

	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}


	cout << x / b << endl;




	return 0;
}

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

int main(){
    int n, q;
    string s;

    cin >> n >> q >> s;
    vector<int> v(n, 0);
    for(int i = 1; i < n; i++){
        if(s[i-1] == 'A' && s[i] == 'C')    v[i]++;
    }
    for(int i = 1; i < n; i++)  v[i] += v[i-1];

    int l, r;
    while(q-- > 0){
        cin >> l >> r;
        cout << v[r-1] - v[max(0, l-1)] << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define mod 1000000007
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inp_vecN for(int i=0;i<n;i++)cin>>v[i]; 
vector<int> get_Factors(ll n)
{
      vector <int> v;
      for(ll i=2; i<=sqrt(n)+1; i++)
      {
            if(n%i==0)
            {
                  v.push_back(i);
                  v.push_back(n/i);
            }
      }

      v.push_back(1);

      return v;
}
string get_bin(ll n)
{
    string s = "";
    while(n > 0)
    {
        s += ('0' + n%2);
        n /= 2;
    }
    reverse(s.begin(), s.end());
    return s;
}

ll bin_to_dec(string s)
{
    ll ans = 0;
    for(auto ch: s)
    {
        ans *= 2;
        ans += (ch - '0');
    }
    return ans;
}
void PrintVector(vector<ll> v,int n)
{

    for(int i=0;i<n;i++)
    {
        cout<<v[i]<<" ";
    }
    cout<<endl;
}
int no_of_primeFactors(int n)  
{ 
    int count=0;
    while (n % 2 == 0)  
    {  
        count++;
        n = n/2;  
    }  
   
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    { 
        while (n % i == 0)  
        {  
           count++;
            n = n/i;  
        }  
        
    }  
    if (n > 2)  
        count++;
    return count;
} 
 ll gcd(int a, int b)
{ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
} 
   
  ll lcm(int a, int b)  
{  
    return (a/gcd(a, b)*b);  
}  



ll pwr(ll base,ll expo,ll m)
{
    if(base==0) return 0LL;
    if(expo==0) return (1LL%m);
    if((expo&1)==0) {ll temp=pwr(base,expo>>1,m); return (temp*temp)%m;}
    return ((base%m)*pwr(base,expo-1,m))%m;
}

int main(int argc, char const *argv[])
{
    ios;

    ll n;
    cin>>n;
    std::vector<ll> h(n);

    std::vector<ll> v1(n);
    std::vector<ll> v2(n);


    for(int i=0;i<n;i++)
    {
      cin>>h[i];
      v1[i]=h[i]+(i+1);
      v2[i]=-h[i]+(i+1);
    }

    
   // PrintVector(v1,n);
    //PrintVector(v2,n);
    sort(v2.begin(),v2.end());
    ll ans=0;
    for(int i=0;i<v1.size();i++)
    {
      int cur=v1[i];
      bool b=binary_search(v2.begin(),v2.end(),cur);
      if(b)
      {
            auto it=lower_bound(v2.begin(),v2.end(),cur);
            auto it2=upper_bound(v2.begin(),v2.end(),cur);
            ans+=it2-it;
      }
    }


    cout<<ans;





    



    return 0;
}

Measured memory_bytes: 7956
#include <stdio.h>

int main(void)
{
    int H,W,h,w;
    scanf("%d", &H);
    scanf("%d", &W);
    scanf("%d", &h);
    scanf("%d", &w);
    printf("%d",H*W-h*W-w*H+h*w);
    return 0;
}

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

int n,m;
vector<int> p;

int main(){
  int i,j,co=0,sum=10000000;
  cin >> n;
  sum=n;
  for(i=0;i<=n;i++){
    co=0;
    j=i;
    while(j>=6){
      co+=j%6;
      j/=6;
    }
    co+=j;
    j=n-i;
    while(j>=9){
      co+=j%9;
      j/=9;
    }
    co+=j;
    if(sum>co)sum=co;
  }

  cout<<sum << endl;

  return 0;
}


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

using ll = long long;

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

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

  ll asset = 1000LL;
  ll basePrice = A[0];
  ll baseCount = asset/A[0];
  ll maxPrice = 0LL;
  for (int i = 1; i < N; i++) {
    if( basePrice < A[i]) {
      asset += (A[i] - basePrice) * baseCount;
    }
    basePrice = A[i];
    baseCount = asset/A[i];
  }
  cout << asset << endl;

  return 0;
}

Measured memory_bytes: 3632
def resolve():
    A, B = list(map(int, input().split()))
    S = str(input())
    import re
    if S[A] != '-':
        print('No')
        return
    if re.match('[0-9]+', S[:A]) and re.match('[0-9]+', S[A+1:]):
        print('Yes')
        return

    print('No')


resolve()

Measured memory_bytes: 38384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

int h, w, d, q;
int a[301][301];
int l[100001], r[100001];

struct A {
	int i;
	int j;
	int sum;
};
struct A arr[90001];
int main()
{
	cin >> h >> w >> d;
	REP(i, 0, h) REP(j, 0, w) {
		cin >> a[i][j];
		arr[a[i][j]].i = i;
		arr[a[i][j]].j = j;
	}
	cin >> q;
	REP(i, 0, q) cin >> l[i] >> r[i];

	REP(k, 1, d + 1) {
		arr[k].sum = 0;
		int cnt = k;
		while (cnt + d <= h * w) {
			arr[cnt + d].sum += (arr[cnt].sum + abs(arr[cnt].i - arr[cnt + d].i) + abs(arr[cnt].j - arr[cnt + d].j));
			cnt += d;
		}
	}

	/*
	REP(i, 1, h*w+1) {
		cout << i << ":sum=" << arr[i].sum << endl;
	}*/
	REP(i, 0, q) {
		cout << arr[r[i]].sum - arr[l[i]].sum << endl;
	}
	return 0;
}

Measured memory_bytes: 3328
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        long[] arr = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
        int k = Integer.parseInt(sc.next());
        System.out.println(arr[k - 1]);
    }
}


Measured memory_bytes: 22868
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

const ll MOD = 1000000007LL;
const double PI = 3.14159265358979323846;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

// for loop
#define REP(i, n) for ((i) = 0;(i) < (ll)(n);(i)++)

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

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

	ll N, K;
	cin >> N >> K;

	vector<ll> As(N);
	vector<ll> Fs(N);

	for (ll i = 0; i < N; ++i) {
		cin >> As[i];
	}
	for (ll i = 0; i < N; ++i) {
		cin >> Fs[i];
	}
	sort(As.begin(), As.end());
	sort(Fs.begin(), Fs.end(), greater<ll>());

	ll min_val = 0;
	ll max_val = 1000000000000LL;
	ll mid_val = (min_val + max_val) / 2;

	ll train_count;
	while (max_val - min_val >= 2) {
		train_count = 0;
		for (ll i = 0; i < N; ++i) {
			train_count += max(0LL, As[i] - mid_val / Fs[i]);
		}
		if (train_count > K) {
			min_val = mid_val;
		}
		else {
			max_val = mid_val;
		}
		mid_val = (min_val + max_val) / 2;
	}

	ll res;
	train_count = 0;
	for (ll i = 0; i < N; ++i) {
		train_count += max(0LL, As[i] - min_val / Fs[i]);
	}
	if (train_count > K) {
		res = max_val;
	}
	else {
		res = min_val;
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 3456
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> E;
const LL MOD = 1000000007LL;
int main() {
	LL X, Y;
	cin >> X >> Y;
	if (abs(X - Y) <= 1) {
		cout << "Brown" << endl;
	}
	else {
		cout << "Alice" << endl;
	}
}

Measured memory_bytes: 256
from collections import Counter

n=int(input())
s=input()
c=Counter(s)

ans=c['R']*c['G']*c['B']

lim=n//2
for i in range(1,n//2+1):
  for j in range(i,n-i):
    l=s[j-i]
    m=s[j]
    r=s[j+i]
    if l!=m and m!=r and r!=l:
      ans-=1

print(ans)

Measured memory_bytes: 9408
#include<iostream>
#define m(a) min(X,max(0,a))
using namespace std;

int r[200000];
int X,K,Q,T,A,s,l,k,t,x,f=-1;

int main()
{
  cin>>X>>K;
  for(;l<K;)cin>>r[l++];

  l = X;
  
  for(cin >> Q; Q--;) {
    cin >> T >> A;
    for(; k<K&T>=r[k]; ) {
      int d = f * (r[k] - t);
      x += d;
      s=m(s+d);
      l=m(l+d);
      t = r[k];
      k++;
      f *= -1;
    }
    cout << m(min(l, max(s, A + x)) + f * (T-t)) << endl;
  }

  return 0;
}

Measured memory_bytes: 1664
#include <iostream>
using namespace std;
#define MAX_N 1000001
int main(){
  int n;
  int isPrime[MAX_N];
  fill(isPrime,isPrime + MAX_N,1);

  isPrime[0] = isPrime[1] = 0;

  for(int i = 2 ; i*i < MAX_N ; i++){
    if(isPrime[i]){
      for(int j = i*2 ; j < MAX_N ; j+=i )isPrime[j] = 0;
    }
  }

  while( cin >> n,n ){
  int cnt = 0;
  for(int i = 2 ; i <= n/2 ; i++ ){
    if(isPrime[i] == 1 && isPrime[n-i] == 1){
      cnt++;
    }
  }
    cout << cnt << endl;
    }
  return 0;
}

Measured memory_bytes: 5064
#include <stdio.h>

int main(void)
{
    int number, suu, keta;
    keta = 0;

    scanf("%d%d", &number, &suu);

    while(1){
        number /= suu;
        keta++;
        if (number == 0)
        break;
    }

    printf("%d", keta);

    return 0;
}

Measured memory_bytes: 128
n, m, *a = map(int, open(0).read().split())

a.sort(reverse=True)

if n == 1:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] == 0:
      break
else:
  a.append(0)
  biggest = a[0]
  now = 0
  while m > 0:
    a[now] = a[now]//2
    m = m - 1
    biggest = a[0]
    for i in range (n-1):
      if a [i+1] >= biggest and m>0:
        a[i+1] = a[i+1]//2
        m = m -1
      else:
        a.sort(reverse = True)
        break

print(sum(a))

Measured memory_bytes: 14476
// you**can**do**anything :)  
#include <bits/stdc++.h>
#include<iostream> 
#include<algorithm> 
#include<vector> 
#define ll long long
const int maxn=5e5+10;
using namespace std;
 
int main() {
ll n;
cin>>n;
	ll sum=0 ,j=1 ,x=1;
	
	for(ll i=1 ;i<= n ;i++){
		//sum+= __gcd(i , __gcd(j ,x) );
		for( j =1 ;j<=n ; j++ ){
			//sum+=__gcd(i , __gcd(j ,x));
			for( x=1 ;  x<=n ;x++){
			sum+=__gcd(i , __gcd(j ,x));
				
			}
		}
	}
	
	
cout<<sum;

}

Measured memory_bytes: 3592
//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 1e9+7,MAX = 1e6+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p,ll mod)
{
	if(p==0) return 1;
	ll z=powN(a,p/2,mod);
	z=(z*z)%mod;
	if(p%2) z=(z*a)%mod;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX, true);
vector<int> MinDiv(MAX);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
    		MinDiv[i]=i;
        	for (j = i * i; j <= MAX; j += i)
            {
				is_prime[j] = false;
				MinDiv[j]=i;
    		}
    	}
	}
	for(int i=2;i<=MAX;i++) if(is_prime[i]) MinDiv[i]=i;
}
//////////////////Sieve////////////////////

int main()
{
	ll a,v,b,w;
	cin>>a>>v;
	cin>>b>>w;
	ll t;
	cin>>t;
	if(abs(b-a)<=t*(v-w)) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}		

Measured memory_bytes: 7028
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
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; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n ; i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n]=1;
  return res;
}
int main(){
  ll n; cin >> n;
  ll k = n;
  int cnt = 1;
  while(true){
    ll now = pow(26, cnt);
    if(k - now > 0){
        k -= now;
        cnt++;
    }else{
        break;
    }
  }
  
  string ans = "";  
  k--;
  for(int i=cnt-1 ; i>=0 ; i--){
      ll now = pow(26, i);
      ll st = k / now;
      for(char c='a' ; c<='z' ; c++){
          if(c - 'a' == st){
              ans += c;
          }
      }
      k -= now * st;
  }
  cout << ans << endl;
  return 0;
}   

Measured memory_bytes: 4108