akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

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

template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
    in >> p.first >> p.second;
    return in;
}

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
    for (T &x : v)
        in >> x;
    return in;
}

template <class T>
ostream& operator << (ostream& out, const vector<vector<T>> &v)
{
    for (const vector<T> &x : v)
        out << x << '\n';
    return out;
}

template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
    for (const T &x : v)
        out << x << ' ';
    return out;
}

long long gcd (long long a, long long b)
{
    if (b > a)
        swap(a, b);
    return (b ? gcd(b, a % b) : a);
}

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,b,a) for (int i = (b); i > (a); i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 1000000007;

signed main()
{
    ios::sync_with_stdio(false);
    #ifdef ONLINE_JUDGE
    cin.tie(nullptr);
    cerr.setstate(ios::failbit);
    #endif

    string s, t;
    cin >> s >> t;
    int ans = INT_MAX;
    rep(i,0,s.size()+1-t.size())
    {
        int cnt = 0;
        rep(j,0,t.size())
            cnt += (s[i+j] != t[j]);
        ans = min(ans, cnt);
    }
    cout << ans;
}


Measured memory_bytes: 3656
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

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

  ll n;
  std::cin>>n;

  std::vector<ll> a(n);
  rep(i,0,n)std::cin>>a[i];

  ll sum=std::accumulate(all(a),0);
  ll min=MOD;
  rep(i,0,n)chmin(min,a[i]);

  if(n%2){
    if(sum%2)std::cout<<"First\n";
    else std::cout<<"Second\n";
  }else{
    if((sum%2==0)&&(min%2==0))std::cout<<"Second\n";
    else std::cout<<"First\n";
  }

  return 0;
}



Measured memory_bytes: 4388
import numpy as np
N,K = map(int,input().split())
import math
A = list(map(int,input().split()))
flag = 0
if 0 in A:
    flag = 1
A.sort()

plus = list(filter(lambda x:x>0, A))[::-1]
plus = list(map(lambda x:np.longdouble(math.log(x,10000000)),plus))
from itertools import accumulate
acc_plu = [0] +  list(accumulate(plus))
minu = filter(lambda x:x<0, A)
minu = list(map(lambda x:np.longdouble(math.log(-x,10000000)),minu))
acc_min = [0] +  list(accumulate(minu))


if K % 2 == 0 : num = K // 2 + 1
else: num = (K + 1) // 2 
cand = []
x = K
y = 0
MOD = 10**9 +7
for i in range(num):
    try:
        cand.append((acc_plu[x] +  acc_min[y],x ,y ))
    except: pass
    x -= 2 
    y += 2

ans = 1
if cand == []:
    if flag:
        print(0)
        exit()
    cnt = 0
    #マイナス確定
    abss = sorted(list(map(lambda x :abs(x),A)))
    for x in abss:
        if cnt == K:break
        ans *= x
        ans %= MOD
        cnt += 1
    ans *= -1
    ans %= MOD
    print(ans)
else:
    cand = sorted(cand)[::-1]
    plus = list(filter(lambda x:x>0, A))[::-1]
    minu = list(filter(lambda x:x<0, A))
    c = cand[0]
    ans = 1
    for i in range(c[1]):
        ans *= plus[i]
        ans %= MOD
    for i in range(c[2]):
        ans *= minu[i]
        ans %= MOD
    print(ans)



Measured memory_bytes: 58020
class Dice
  @north = 5
  @south = 2
  @east = 3
  @west = 4
  @top = 1
  @bottom = 6

  def initialize(input_t, input_s, input_e, input_w, input_n, input_b)
    @north = input_n
    @south = input_s
    @east = input_e
    @west = input_w
    @top = input_t
    @bottom = input_b
  end

  def set(north, south, east, west, top, bottom)
    10000.times do
      output =  self.move(["N", "S", "E", "W"].sample)
      # p "output = #{output}, dice = [#{north}, #{south}, #{east}, #{west}, #{top}, #{bottom}]"
      if output[0] == north && output[1] == south && output[2] == east && output[3] == west && output[4] == top && output[5] == bottom
        return true
        break
      end
    end
    return false
    #@top = top, @south = front???????????????????????¶??????move??????
    #???????????°?????????false?????§????????´??????true?????????
  end

  def move(order_array)
    length = order_array.length
    for i in 0..(length-1)
      if order_array[i] == "N"
        move_north
      elsif order_array[i] == "S"
        move_south
      elsif order_array[i] == "E"
        move_east
      else
        move_west
      end
    end
    output = [@north, @south, @east, @west, @top, @bottom]
    return output
  end

  def move_north
    tmp = []
    tmp.push(@north)
    tmp.push(@south)
    tmp.push(@top)
    tmp.push(@bottom)
    @bottom = tmp[0]
    @top = tmp[1]
    @north = tmp[2]
    @south = tmp[3]
  end

  def move_south
    tmp = []
    tmp.push(@north)
    tmp.push(@south)
    tmp.push(@top)
    tmp.push(@bottom)
    @top = tmp[0]
    @bottom = tmp[1]
    @south = tmp[2]
    @north = tmp[3]

  end

  def move_east
    tmp = []
    tmp.push(@east)
    tmp.push(@west)
    tmp.push(@top)
    tmp.push(@bottom)
    @bottom = tmp[0]
    @top = tmp[1]
    @east = tmp[2]
    @west = tmp[3]
  end

  def move_west
    tmp = []
    tmp.push(@east)
    tmp.push(@west)
    tmp.push(@top)
    tmp.push(@bottom)
    @top = tmp[0]
    @west = tmp[2]
    @bottom = tmp[1]
    @east = tmp[3]
  end

end

n = gets.chomp.to_i
dice_numbers = gets.chomp.split.map(&:to_i)
input_t = dice_numbers[0]
input_s = dice_numbers[1]
input_e = dice_numbers[2]
input_w = dice_numbers[3]
input_n = dice_numbers[4]
input_b = dice_numbers[5]
answers = []
(n-1).times do
  other_dice_numbers = gets.chomp.split.map(&:to_i)
  dice2 = Dice.new(other_dice_numbers[0], other_dice_numbers[1],other_dice_numbers[2],other_dice_numbers[3],other_dice_numbers[4],other_dice_numbers[5])
  dice2_result = dice2.set(input_n, input_s, input_e, input_w, input_t, input_b)
  if dice2_result == true
    answers.push("Same")
  else
    answers.push("NotSame")
  end
end
if answers.include?("Same") == true
  puts "No"
else
  puts "Yes"
end

Measured memory_bytes: 9056
N=int(input())
s=input()
B=[0]*N
W=[0]*N

if s[0]=="#": W[0]=1
else: B[0]=1

for i in range(1,N):
    if s[i]=="#":
        B[i]=min(B[i-1],W[i-1])
        W[i]=W[i-1]+1
    else:
        B[i]=min(B[i-1],W[i-1])+1
        W[i]=W[i-1]
        
print(min(B[N-1],W[N-1]))

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

using namespace std;

#define int long long

void solve() {
    int n, r;
    cin >> n >> r;
    if (n >= 10) cout << r;
    else cout << r + 100 * (10 - n);
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
namespace AtCoder {
    class MainClass {
        public static void Main(string[] args) { new MainClass().solve(); }

        Scanner cin = new Scanner();

        int N, K;
        int[] A;
        void solve() {

            N = cin.nextInt();
            K = cin.nextInt();
            A = new int[N];

            for (int i = 0; i < N; i++)
                A[i] = cin.nextInt();

            Mathf mat = new Mathf();

            int G = mat.GCD(A);

            bool isPossible = K <= A.Max() && K % G == 0;

            Console.WriteLine(isPossible ? "POSSIBLE" : "IMPOSSIBLE");

        }
        class Scanner {
            string[] nextBuffer; int BufferCnt; char[] cs = new char[] { ' ' };
            public Scanner() { nextBuffer = new string[0]; BufferCnt = 0; }
            public string next() {
                if (BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                BufferCnt = 0;
                return nextBuffer[BufferCnt++];
            }
            public int nextInt() { return int.Parse(next()); }
            public long nextLong() { return long.Parse(next()); }
            public double nextDouble() { return double.Parse(next()); }
        }

        class Mathf {
            private int mod = 1000000007;//10^9+7
            public int Mod { get; set; }
            public Mathf() { }
            public Mathf(int mod) { this.mod = mod; }
            public long Pow(long a, long b) {
                if (b == 0) return 1;
                if (b % 2 == 1) return (a % mod * Pow(a % mod, b - 1) % mod) % mod;
                else return Pow(a * a % mod, b / 2) % mod;
            }
            public long Fact(long n) { return n != 0 ? (n % mod * (Fact(n - 1) % mod) % mod) : 1; }
            public long C(long n, long r) {
                if (r == 0 || n == r) return 1;
                else return (Fact(n) % mod * Pow((Fact(n - r) % mod * Fact(r) % mod) % mod, mod - 2) % mod) % mod;
            }
            public int GCD(int a, int b) {if (a < b) Swap(ref a, ref b);return b == 0 ? a : GCD(b, a % b);}
            public int GCD(int[] array) {return array.Aggregate((v, next) => GCD(v, next));}
            public void Swap<T>(ref T a, ref T b) { T tmp = a; a = b; b = tmp; }
        }
    }
}

Measured memory_bytes: 20832
# 「約数の個数」でググると素因数ひとつひとつに対して+1したものをかけあわせた数らしい
# あらかじめ10^3までの素数を抽出しておき、素因数を全探索、答えを更新していく
# 10^3までの素数列挙にはエラトステネスを使う

primes = []
numbers = [False for _ in range(10 ** 3 + 1)]

for i in range(2, 10 ** 3 + 1):
    if numbers[i] == False:
        primes.append(i)
        for j in range(i, 10 ** 3 + 1, i):
            numbers[j] = True

n = int(input())
ans = 1
MOD = 10 ** 9 + 7
d = {}

for i in range(2, n + 1):
    tmp = i
    for p in primes:
        while tmp % p == 0 and tmp != 0:
            d[p] = 1 if p not in d else d[p] + 1
            tmp //= p

for _, v in d.items():
    ans *= v + 1
    ans %= MOD

print(ans)


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

int main(){
  int n;
  cin >>n;
  vector<int> a(60010, 0);
  for(int i=1; i<=100; i++){
    for(int j=1; j<=100; j++){
      for(int k=1; k<=100; k++){
        int val = i*i + j*j + k*k + i*j + j*k + k*i;
        a[val] +=1;
      }
    }
  }
  for(int i=1; i<=n; i++){
    cout << a[i] << endl;
  }
  return 0;
}

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

vector<int> A;

int partition (int p, int r) {
  int x = A[r];
  int i = p - 1;
  for (int j = p; j < r; j++) {
    if (A[j] <= x) {
      i++;
      swap(A[i], A[j]);
    }
  }
  swap(A[i+1], A[r]);
  return i + 1;
}

int main() {

  int n;
  cin >> n;

  A.resize(n);

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

  int k = partition(0, n - 1);

  for (int i = 0; i < n; i++) {
    if (i ==k) {
      cout << "[";
    }
    cout << A[i];
    if (i == k) {
      cout << "]";
    }
    if (i != n - 1) {
      cout << " ";
    }
  }
  cout<<endl;

  return 0;

}


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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

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

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

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

vector<pair<ll, int>> prime_div(ll n){
  vector<pair<ll, int>> res;
  for (ll i=2; i*i <= n;i++){
    if (n%i == 0){
      int a = 0;
      while(n%i == 0){
        n /= i;
        a++;
      }
      pair<ll, int> tmp;
      tmp.first = i;
      tmp.second = a;
      res.push_back(tmp);
    }
  }
  if (n != 1){
    pair<ll, int> now;
    now.first = n;
    now.second = 1;
    res.push_back(now);}
  return res;
}


// printf("%.10f\n" , ans);
int main(void){
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  REP(ki, k){
  vector<int> b(n+1, 0);
    REP(i, n){
      int left = max(0, i-a[i]);
      int right = min(n, i+a[i]+1);
      b[left]++; b[right]--;
    }
    REP(i, n) b[i+1] += b[i];
    b.pop_back();
    if (a==b) break;
    a = b;
  }
  REP(i, n) cout << a[i] << ' ';
  return 0;
}



Measured memory_bytes: 4416
from bisect import bisect_left as bl
from bisect import bisect_right as br

def makeItems(lst, size):
    length = len(lst)
    ret = [[] for _ in range(size + 2)]
    ret[0] = [0]
    for a in lst:
        for b in range(size, -1, -1):
            add = [a + c for c in ret[b]]
            ret[b + 1].extend(add)
    return ret


def main():
    n, k, l, r = map(int, input().split())
    aList = list(map(int, input().split()))
    aLeft = aList[:n // 2]
    aRight = aList[n // 2:]
    leftItems = makeItems(aLeft, k)
    rightItems = makeItems(aRight, k)
    
    for lst in rightItems:
        lst.sort()
    
    ans = 0
    for i, lst in enumerate(leftItems):
        if i > k:continue
        for item in lst:
            minLimit = l - item
            maxLimit = r - item
            left = bl(rightItems[k - i], minLimit)
            right = br(rightItems[k - i], maxLimit)
            ans += right - left
    
    print(ans)

main()


Measured memory_bytes: 108648
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){ 
    string s;
    cin>>s;
    int ans=100000000;
    rep(i,0,s.size()-2){
        ans=min(ans,abs(753-((s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0'))));
        //cout<<ans<<" "<<s[i]<<s[i+1]<<s[i+2]<<" "<<(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0')<<endl;
    }
    cout<<ans<<endl;
}


/*
abcde


*/


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

int main() {
    int x;
    cin >> x;
    if (400 <= x && x < 600)
        cout << 8 << endl;
    else if (x < 800)
        cout << 7 << endl;
    else if (x < 1000)
        cout << 6 << endl;
    else if (x < 1200)
        cout << 5 << endl;
    else if (x < 1400)
        cout << 4 << endl;
    else if (x < 1600)
        cout << 3 << endl;
    else if (x < 1800)
        cout << 2 << endl;
    else if (x < 2000)
        cout << 1 << endl;
    return 0;
}

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

int main()
{
   int A,B;
   scanf("%d%d",&A,&B);
   if(A==1)
   {
       if(B==2)
       {
          printf("3");
       }
       else
       {
           printf("2");
       }

   }
   else
   {
       if(B==1)
       {
           if(A==2)
           {
               printf("3");
           }
           else
           {
               printf("2");
           }
       }
       else
       {
           printf("1");
       }
   }

    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();

        String tmp = new StringBuilder(n).reverse().toString();
        sc.close();

        if (n.equals(tmp)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
 
int main(){
        long long  int n;
         cin>>n;
         long long int i,s=0,j;
         for(i=1;i<=n;i++)
         {
                  for(j=i;j<=n;j=j+i)
                {  s=s+j;
                  
                }
         }
cout<<s<<endl;
}

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

int main()
{
    long long n;
    long long c;
    cin >> n >> c;
    int i,j,p;
    long long dd[c][c];
    long long cc[n][n];
    for(i=0;i<c;i++){
        for(j=0;j<c;j++){
            scanf("%lld",&dd[i][j]);
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            scanf("%lld",&cc[i][j]);
        }
    }   
    long iwakan[3][c];
    for(int amari=0;amari<3;amari++){
        for(p=0;p<c;p++){
            iwakan[amari][p]=0;
            for(i=0;i<n;i+=1){
                for(j=((666-i-amari)%3);j<n;j+=3){
                    iwakan[amari][p] += dd[cc[i][j]-1][p];
//                    printf("a%d%d%d%d\n",amari,i,j,dd[cc[i][j]-1][p]);
                }
//                printf("b");
            }
        }
    }
    long answer = 999999999;
    long iwasum;
    for(int x=0;x<c;x++){
        for(int y=0;y<c;y++){
            for(int z=0;z<c;z++){
                if((x-y)*(y-z)*(z-x) == 0){
                    continue;
                }
                iwasum = iwakan[0][x]+iwakan[1][y]+iwakan[2][z];
//                printf("%d%d%d %d%d%d\n",x,y,z,iwakan[0][x],iwakan[1][y],iwakan[2][z]);
                if (iwasum < answer){
                    answer = iwasum;
                }
            }
        }
    }
    printf("%ld\n",answer);

    /*
    for(i=0;i<3;i++){
        for(j=0;j<c;j++){
            printf("%lld",iwakan[i][j]);
        }
        printf("\n");
    }

    
    for(i=0;i<c;i++){
        for(j=0;j<c;j++){
            printf("%lld",dd[i][j]);
        }
        printf("\n");
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            printf("%lld",cc[i][j]);
        }
        printf("\n");
    }
    */
}

Measured memory_bytes: 2176
def gcd(a, b):
    if a==0 or b==0: return max(a, b)
    if a<b: a, b = b, a
    while b: a, b = b, a%b
    return a

n, *a = map(int, open(0).read().split())

l, r = [0]*(n+2), [0]*(n+2)
for i in range(n): l[i+1] = gcd(l[i], a[i])
for i in range(n+1, 1, -1): r[i-1] = gcd(r[i], a[i-2])

ans = 1
for i in range(n):
    ans = max(ans, gcd(l[i], r[i+2]))
print(ans)



Measured memory_bytes: 14476
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

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

int main(){
    ll a, b;
    cin >> a >> b;
    cout << (a*b)/gcd(a, b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    map<int,int> a;
    map<int,int> b;
    rep(i, n) {
        int v;
        cin >> v;
        if(i%2) a[v]++;
        else b[v]++;
    }
    int af = 0;
    int as = 0;
    int ai = 0;
    for(auto x : a) {
        if(x.second >= af) {
            as = af;
            af = x.second;
            ai = x.first;
        }
        else if(x.second >= as) {
            as = x.second;
        }
    }
    int bf = 0;
    int bs = 0;
    int bi = 0;
    for(auto x : b) {
        if(x.second >= bf) {
            bs = bf;
            bf = x.second;
            bi = x.first;
        }
        else if(x.second >= bs) {
            bs = x.second;
        }
    }
    if(ai == bi) {
        int ans = min(n - (af + bs),n - (as + bf));
        cout << ans << endl;
    }
    else cout << n - af - bf << endl;
    return 0;
}


Measured memory_bytes: 8292
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<unordered_map>
#include<bits/stdc++.h>
#define ll long long 
#define dd double
using namespace std;
const ll MOD = 1e9 + 7; 
 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout<<fixed<<setprecision(12);
  double n,k;
  cin>>n>>k;
  int i;
  double ans;
  double s=0;
  for(i=1;i<=n;i++){
  double j=i;
  double p=2;
  ans=1;
  while(j<k){
  	j=j*2;
  	ans=ans*1/p;	
  }
  
  ans=ans*1/n;
  s=s+ans;
   
 }

  cout<<s<<endl;
  
  return 0;
}

Measured memory_bytes: 3804
#include <stdio.h>

int main()
{
	unsigned long a, b, c;
	unsigned long temp;
	int count;

	scanf("%d", &count);
	while (count > 0)
	{
		fflush(stdin);
		scanf("%lu %lu %lu", &a, &b, &c);
		if (a > b) {temp = a; a = b; b = temp;}
		if (a > c) {temp = a; a = c; c = temp;}
		if (b > c) {temp = b; b = c; c = temp;}
		if (a * a + b * b == c * c)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		count--;
	}

	return 0;
}

Measured memory_bytes: 588
#define ll long long
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
ll z = 1000000007 ;
ll inf = 100000000000000000 ;
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll power(ll a ,ll b){if(b == 0) return 1 ; ll c = power(a , b/2) ; if(b%2 == 0) return ((c*c)%z) ; else return ((((c*c)%z)*a)%z) ;}
ll inverse(ll a ,ll n){return power(a , n-2) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;


void solve()
{
	ll arr[32] = {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} ;
	ll n ;
	cin >> n ;
	n-- ;
	cout << arr[n] << endl ;
	return ;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	ll t ;
	//cin >> t ;
	t = 1 ;
	while(t--)
	{
		solve() ;
	}
	return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
flag = False
for x in range(N, -1, -1):
    for y in range(N - x, -1, -1):
        z = N - x - y
        if 10000 * x + 5000 * y + 1000 * z == Y:
            print(x, y, z)
            bool = True
            exit()

if not flag:
    print(-1, -1, -1)


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

using namespace std;

#define MAXN 200010
typedef long long LL;

int n, a[MAXN];
LL sum, res, ans = -1;



int main( int argc , char * argv[] ){
//	freopen( "input.txt" , "r" , stdin );
//	freopen( "output.txt" , "w" , stdout );
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i){
        scanf("%d", a + i);
        sum += a[i];
	}
	for(int i = 1; i < n; ++i){
        res += a[i];
        if(ans == -1) ans = abs(sum - 2 * res);
        else ans = min(ans, abs(sum - 2 * res));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<climits>
using namespace std;

static const int MAX = 100;
static const long long INFTY = (1LL<<32);

int n;
long long d[MAX][MAX];

void floyd(){
    for(int k=0; k<n; k++){
        for(int i=0; i<n; i++){
            if(d[i][k] == INFTY) continue;
            for(int j=0; j<n; j++){
                if(d[k][j] == INFTY) continue;
                d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
            }
        }
    }
}

int main(){
    int e, u, v, c;
    cin >> n >> e;
    
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            d[i][j] = ( (i==j) ? 0 : INFTY);
        }
    }
    
    for(int i=0; i<e; i++){
        cin >> u >> v >> c;
        d[u][v] = c;
    }
    
    floyd();
    
    bool negative = false;
    for(int i=0; i<n; i++) if(d[i][i]<0) negative = true;
    
    if(negative){
        cout << "NEGATIVE CYCLE" << endl;
    } else {
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                if(j) cout << " ";
                if(d[i][j] == INFTY) cout << "INF";
                else cout << d[i][j];
            }
            cout << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3144
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
const ll MOD = 1e9+7;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int random_int(int l,int r){return uniform_int_distribution<int>(l,r)(rng);}
ll fast_power(ll x, ll p){
    ll res = 1;
    while(p > 0){
        if(p & 1){
            res = (res * x);
        }
        p = p >> 1;
        x = (x*x);
    }
    return res;
}
int n,w;
int a[105];
int v[105];
ll dp[100005];

int main() {
    IO;
    cin >> n >> w;
    for (int i = 0; i < 100005; i++)
            dp[i] = LLONG_MAX - 5e15;
    for (int i = 0; i < n; i++)
        cin >> a[i] >> v[i];
    dp[0] = 0;
    int totalval = 100000;
    for (int i = 0; i < n; i++) {
        for (int j = totalval; j >= v[i]; j--) {
            dp[j] = min(dp[j], dp[j - v[i]] + a[i]);
        }
    }

    for (int i = totalval; i >= 0; i--) {
        if (dp[i] <= w) {
            cout << i;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
program main
implicit none
integer :: a( 5 ), t( 5 ), m, i, j

do i = 1, 5
read(*,*) a(i)
if( mod(a(i), 10 ) == 0 ) then
   t( i ) = a( i )
else
   t( i ) = (a( i ) /10+1 )* 10
end if
end do
m = 644
do i = 1, 5
if( sum( t ) - t(i) + a(i) < m ) then
   m = sum( t ) -t(i) + a(i)
end if
end do
write(*,'(i0)') m




end program main


Measured memory_bytes: 256
# N  =int(input())
# a = list(map(int,input().split()))
# ans = (10**9)
# for av in range(min(a),max(a)+1):
#     Sum = 0
#     for i in range(N):
#         Sum += (a[i]-av)**2
#     if Sum < ans:
#         ans = Sum
# print(ans)

N  =int(input())
a = list(map(int,input().split()))
b = list(set(a))
ans = (10**9)
for av in range(min(a),max(a)+1):
    Sum = 0
    for i in range(N):
        Sum += a[i]**2-2*a[i]*av+av**2
    if Sum < ans:
        ans = Sum
print(ans)

Measured memory_bytes: 3060
n = int(input())

for i in range(1,n+1):
    now = i*(i+1)//2
    if n-now <= 0:
        break

ans = []
for j in range(i,0,-1):
    if n < j:
        if n != 0:
            ans.append(n)
        break
    ans.append(j)
    n -= j
    
for r in ans:
    print(r)

Measured memory_bytes: 74192
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;


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

    vector<int> vec_x(n);
    vector<int> vec_y(n);

    rep(i,n){
        cin >> vec_x.at(i) >> vec_y.at(i);
    }

    /*
    rep(i,n){
        cout << "x = " << vec_x.at(i) << endl;
        cout << "y = " << vec_y.at(i) << endl;
    }
    */

    int kaijou = 1;
    rep(i,n){
        kaijou = kaijou * (i+1);
    }

    //cout << "kaijou = " << kaijou << endl;

    int count = 0;
    for(int i = 0; i < n - 1; i ++){
        for(int j = i + 1; j < n; j ++){
            count++;
        }
    }

    int tmp = kaijou * (n-1) / count;

    double ans = 0;
    double ans2 = 0;
    double ans3 = 0;
    for(int i = 0; i < n - 1; i ++){
        for(int j = i + 1; j < n; j ++){
            double xxx = (vec_x.at(i) - vec_x.at(j)) * (vec_x.at(i) - vec_x.at(j));
            double yyy = (vec_y.at(i) - vec_y.at(j)) * (vec_y.at(i) - vec_y.at(j));
            double zzz = (vec_x.at(i) - vec_x.at(j)) * (vec_x.at(i) - vec_x.at(j)) + (vec_y.at(i) - vec_y.at(j)) * (vec_y.at(i) - vec_y.at(j));
            ans += sqrt(xxx+yyy) * tmp;
            //ans2+= sqrt(zzz) * tmp;
            //ans3+= sqrt((vec_x.at(i) - vec_x.at(j)) * (vec_x.at(i) - vec_x.at(j)) + (vec_y.at(i) - vec_y.at(j)) * (vec_y.at(i) - vec_y.at(j))) * tmp;
            
            //ans += sqrt((vec_x.at(i) - vec_x.at(j) * vec_x.at(i) - vec_x.at(j)) + (vec_y.at(i) - vec_y.at(j) * vec_y.at(i) - vec_y.at(j)));
        }
    }

    /*
    cout << "count = " << count <<endl;
    cout << "tmp = " << tmp <<endl;
    cout << "kaijou / 2 = " << kaijou / 2 <<endl;
    cout << ans << endl;
    */
    //printf("%f\n", ans / kaijou);
    //printf("%f\n", ans2 / kaijou);
    //printf("%f\n", ans3 / kaijou);
    cout<<std::setprecision(20)<<ans/kaijou<<endl;
    //cout<<std::setprecision(20)<<ans2/kaijou<<endl;
    //cout<<std::setprecision(20)<<ans3/kaijou<<endl;





}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

ll ca[1111111]={};
ll cb[1111111]={};

int main(){
  ll n,m,p=1e9+7;
  cin>>n>>m;

  ll f=0;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    ca[a]++;
    if(ca[a]==2)f=1;
  }
  for(int i=0;i<m;i++){
    ll b;
    cin>>b;
    cb[b]++;
    if(cb[b]==2)f=1;
  }
  
  ll nm=n*m;
  if(ca[nm]==0||ca[nm]==0||f){
    cout<<0<<endl;
    return 0;
  }

  ll cr=0,cc=0;
  ll ans=1;
  ll c0=0;
  for(int i=nm;i>0;i--){
    //    cout<<ans<<" "<<cr<<" "<<cc<<endl;
    if(ca[i]&&cb[i]){
	 cc++;
	 cr++;
	 c0++;
	 continue;
    }
    if(ca[i]){
	 ans*=cc;
	 ans%=p;
	 cr++;
	 c0++;
	 continue;
    }
    if(cb[i]){
	 ans*=cr;
	 ans%=p;
	 cc++;
	 c0++;
	 continue;
    }
    ans*=(cr*cc-c0);
    ans%=p;
    c0++;
    continue;
  }

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


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

int main() {
  int r;
  cin >> r;
  cout << r*r << endl;
  return 0;
}

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

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;
using std::sort;

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

    if(a>x || (x-a)>b){
        cout << "NO" << endl;
    }
    else{
        cout << "YES" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#define MAXN (200000 + 5)
#define LL long long
#define ULL unsigned long long
#define pii pair<int, int>
int n, a[MAXN];
LL ans;
using namespace std;
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    	scanf("%d", &a[i]);
    if (a[1])
    {
    	puts("-1");
    	return 0;
    }
    for (int i = 1; i <= n; i++)
    {
    	if (a[i] > a[i - 1] + 1)
    	{
    		puts("-1");
    		return 0;
    	}
    }
    for (int i = 1; i <= n; i++)
    {
    	if (a[i] == a[i - 1] + 1)
    		++ans;
    	else if (a[i] <= a[i - 1] && a[i])
    		ans += a[i];
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
    int n=0;
    char buf[200010];
    char d[200010];

   
    fgets(buf , sizeof(buf), stdin);
    fgets(d,sizeof(d),stdin);

   for(int i=0; i<strlen(buf); i++){
       
       if (buf[i]!=d[i]){
           d[i]=buf[i];
           n++;
       }

   }

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

    return 0;
}

Measured memory_bytes: 2004
from collections import Counter, deque
# from copy import copy, deepcopy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    A=list(map(int,input().split()))
    AA=Counter(A)
    maxval=0
    for i in AA.keys():
        maxval=max(AA[i-1]+AA[i]+AA[i+1],maxval)

    print(maxval)



resolve()

Measured memory_bytes: 56364
def calccombi(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

x, y = map(int,input().split())
if (x+y)%3!=0 or 2*y<x or 2*x<y:
    print(0)
else:
    MOD = 1_000_000_007
    n = (2*y-x)//3
    m = (2*x-y)//3
    fac = [0]*(n+m+1)
    finv = [0]*(n+m+1)
    inv = [0]*(n+m+1)
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2,n+m+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
    print(calccombi(n+m,n))

Measured memory_bytes: 88052
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

map<string, int> weight;
string s;
int p;

int num()
{
	int res = 0;
	while (p < s.size() && isdigit(s[p]))
	{
		res *= 10;
		res += s[p] - '0';
		p++;
	}
	return res;
}

int atom()
{
	assert(isupper(s[p]));
	string t = "";
	t += s[p];
	p++;
	if (islower(s[p]))
	{
		t += s[p];
		p++;
	}
	if (weight.count(t) == 0) throw 1;
	int w = weight[t];
	if (isdigit(s[p])) w *= num();
	return w;
}

int mol()
{
	int res = 0;

	while (p < s.size())
	{
		if (s[p] == '(')
		{
			p++;
			int tmp = mol();
			assert(s[p] == ')');
			p++;
			assert(isdigit(s[p]));
			tmp *= num();
			res += tmp;
		}
		else if (s[p] == ')')
		{
			return res;
		}
		else res += atom();
	}

	return res;
}

string solve()
{
	p = 0;
	try
	{
		int res;
		res = mol();
		return to_string(res);
	}
	catch(int aaa)
	{
		return "UNKNOWN";
	}
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	while (cin >> s)
	{
		if (s == "END_OF_FIRST_PART") break;
		int a; cin >> a;
		weight[s] = a;
	}
	while (cin >> s && s != "0")
	{
		cout << solve() << endl;
	}
	return 0;
}


Measured memory_bytes: 3264
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(int i=l;i<r;i++)
#define LINF (ll)1e18
#define INF (int)1e9
struct aaa{aaa(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(10);};}aaaaaaa;
inline void in() {}
template <class Head, class... Tail>
inline void in(Head&& head,Tail&&... tail){
    cin>>head;
    in(move(tail)...);
}
template <class T>
inline void out(T t) {
    cout<<t<<'\n';
}
template <class Head, class... Tail>
inline void out(Head head,Tail... tail){
    cout<<head<<' ';
    out(move(tail)...);
}

int main(){
    int n,m;
    in(n,m);
    vector<pair<int, int> >bridge(m);
    rep(i,0,m)in(bridge[i].first,bridge[i].second);
    sort(bridge.begin(), bridge.end(),greater<pair<int, int>>());
    int last=INF,cnt=0;
    rep(i,0,m){
        if(last>=bridge[i].second){
            last=bridge[i].first;
            cnt++;
        }
    }
    out(cnt);
}



















Measured memory_bytes: 1024
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define loop(i, a, b) for (int i = a; i < b; i++)
#define loopr(i, a, b) for (int i = a; i >= b; i--)
#define loops(i, a, b, step) for (int i = a; i < b; i += step)
#define looprs(i, a, b, step) for (int i = a; i >= b; i -= step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie();                        \
    cout.tie();
#define FILE_READ_IN freopen("input.txt", "r", stdin);
#define FILE_READ_OUT freopen("output.txt", "w", stdout);
#define all(a) a.begin(), a.end()
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);

void solve()
{
    ll n, sum = 0, two = 1;
    cin >> n;
    for (int i = 0; i <= log(n) / log(2); i++)
    {
        sum += two;
        two = two * 2;
    }
    cout << sum << "\n";
}

int main()
{
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

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

int main() {
    int n,m,c,res,ans=0;
    cin>>n>>m>>c;
    vector<int> b(m);
    vector<vector<int>> a(n,vector<int>(m));
    rep(i,m) cin>>b[i];
    rep(i,n) {
        rep(j,m) cin>>a[i][j];
    }
    rep(i,n) {
        res=0;
        rep(j,m) {
            res+=a[i][j]*b[j];
        }
        res+=c;
        if (res>0) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;

int main(){
    int N;
    cin >> N;
    
    int cnt = 0;
    rep(i,10){
        if(i > 0){
            if(N % i == 0 && N / i <= 9){
                cout << "Yes" << endl;
                cnt++;
                break;
            }
        }
    }
    if(cnt == 0) cout << "No" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if(a<=b*c){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
}

Measured memory_bytes: 3608
#include <stdio.h>

int main(){
  int h,w;
  int i,j;

  while(1){
    scanf("%d %d",&h,&w);
    if(h==0 && w==0) break;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
        printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string str;
    cin >> str;
    str.pop_back();

    bool f;
    while (str.length() > 1)
    {
        if (str.length() % 2 == 0)
        {
            f = false;
            for (int i = 0; i < str.length() / 2; i++)
            {
                if (str[i] != str[str.length() / 2 + i])
                {
                    f = true;
                    break;
                }
            }
            if (!f)
            {
                cout << str.length() << endl;
                return 0;
            }
        }
        str.pop_back();
    }

    cout << "1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
struct Process{
    string name;
    int time;
};
int main(){
    int n,q,time;
    cin>>n>>q;
    string name;
    queue<Process> rt;
    Process p;
    while(cin>>name>>time){
         p.name = name;
         p.time = time;
         rt.push(p);
    }
    time = 0;
    while(!rt.empty()){
        p = rt.front();
        rt.pop();
        if(p.time<=q){
            time+=p.time;
            cout<<p.name<<" "<<time<<endl;
        }
        else{
            time+=q;
            p.time = p.time-q;
            rt.push(p);
        }
    }
}


Measured memory_bytes: 6308
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  int a[n];
  bool back[n+1];
  fill(back,back+n+1,false);
  bool pas[n+1];
  fill(pas,pas+n+1,false);
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]==n)pas[n]=true;
    else{
      if(pas[a[i]+1]==false){
        back[a[i]]=true;
      }
      pas[a[i]]=true;
    }
  }
  int ans=1;
  int sum=1;
  for(int i=1;i<=n;i++){
    if(back[i])sum++;
    else{
      ans=max(ans,sum);
      sum=1;
    }
  }
  cout<<n-ans<<endl;
}
  

Measured memory_bytes: 1408
from collections import deque
n,m,k = map(int, input().split())
a = [list(map(lambda x:int(x)-1, input().split())) for i in range(m)]
c = [list(map(lambda x:int(x)-1, input().split())) for i in range(k)]

mp=[set() for _ in range(n)]
bl=[set() for _ in range(n)]

for af, bf in a:
    mp[af].add(bf)
    mp[bf].add(af)

for cf,df in c:
    bl[cf].add(df)
    bl[df].add(cf)

sz=[0]*n
for i in range(n):
    if sz[i]>0:
        continue

    d=deque()
    reach={i}
    d.append(i)
    while d:
        s=d.pop()
        for g in mp[s]:
            if g in reach:
                continue
            else:
                reach.add(g)
                d.append(g)

    for j in reach:
        sz[j]=len(reach)

    for k in reach:
        for j in bl[k]:
            if j in reach:
                sz[k]-=1

for i in range(n):
    sz[i]-=len(mp[i])+1

print(*sz)


    

Measured memory_bytes: 133632