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

/**
 *
 * @author cs18097
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int p = a+b;
        int d = a-b;
        int c = a*b;
        if(p>d){
            if(c>p){
                System.out.print(c);
                return;
            }else{
                System.out.print(p);
                return;
            }
        } else {
            if(c>d){
                System.out.print(c);
                return;
            } else{
                System.out.print(d);
                return;
            }
        }
    }
    
}


Measured memory_bytes: 23380
#include <iostream>

using namespace std;
int a[200010];
int main(){
    int i,k,n;
    cin >> k >> n;
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    int mx = 0;
    for(i=0;i<n - 1;i++){
        mx = max(mx,a[i + 1] - a[i]);
    }
    mx = max(mx,a[0] + k - a[n - 1]);
    cout << k - mx << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <map>
using namespace std;
int main()
{
  int a, b;
  cin >> a >> b;
  int ans = 0;
  if(a >= 13){
    ans = b;
  } else if(a >= 6){
    ans = b / 2;
  } else{
    ans = 0;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int x = sc.NextInt();

        string answer = x < 1200 ? "ABC" : "ARC";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

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

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

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;


int main() {
	ll n, k; cin >> n >> k;
	vector<ll> a(n), b(n);
	for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];

	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		if ((k | a[i]) == k) ans += b[i];
	}

	for (int bit = 0; bit < 32; ++bit) {
		bitset<32> bk = k;
		if (!bk[bit]) continue;

		bk[bit] = 0;
		for (int i = 0; i < bit; ++i) bk[i] = 1;

		ll x = bk.to_ullong(), tmp = 0;
		for (int i = 0; i < n; ++i) {
			if ((x | a[i]) == x) tmp += b[i];
		}
		ans = max(ans, tmp);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define ff(i, n) for (int i = 1; i <= n; i++)
#define F first
#define S second
#define vpii vector<pair<int,int> >
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back   
#define PB pop_back
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;

void solve(){
    int n, m, k, ans = 0, cnt = 0, mx = LLONG_MIN;
    cin>>n>>m>>k;
    int a[n+5], b[m+5];
    f(i,n)cin>>a[i];
    f(i,m)cin>>b[i];
    ff(i,n-1)a[i] += a[i-1];
    ff(i,m-1)b[i] += b[i-1];
    int p = lower_bound(b,b+m,k) - b, q;
    if(b[p] == k)mx = (p + 1);
    else mx = p;
    //cout<<p<<" "<<mx<<" here\n";
    f(i,n){
        if(a[i] > k)break;
        cnt = 0;
        cnt += i+1;
        q = k - a[i];
        p = lower_bound(b,b+m,q) - b;
        //cout<<b[p]<<" "<<q<<" ";
        if(q > 0 && p >= 0 && p < m){
            if(b[p] == q)cnt += (p + 1);
            else cnt += p;
            //cout<<q<<" "<<p+1<<" "<<cnt<<" hi\n";
        }
        mx = max(mx,cnt);
    }
    //cout<<endl;

    cout<<max(mx,0ll);
}

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


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

void dont_work(bool works) {
    if(works) {
        cout << "Yes\n";
        exit(0);
    }
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    vector<vector<int>> grid(3, vector<int>(3));
    for (int i =0;i<3;++i) 
        for (int j = 0; j < 3; ++j) cin>>grid[i][j];
    int n;
    cin>>n;
    map<int,bool> mapa;
    for(int i=0;i<n;++i) {
        int x;
        cin>>x;
        mapa[x]=true;
    }
    bool works=true;
    for(int j=0;j<3;++j) if(!mapa[grid[0][j]]) works=false;
    dont_work(works);
    works=true;
    for(int j=0;j<3;++j) if(!mapa[grid[1][j]]) works=false;
    dont_work(works);
    works=true;
    for(int j=0;j<3;++j) if(!mapa[grid[2][j]]) works=false;
    dont_work(works);
    works=true;
    for(int j=0;j<3;++j) if(!mapa[grid[j][0]]) works=false;
    dont_work(works);
    works=true;
    for(int j=0;j<3;++j) if(!mapa[grid[j][1]]) works=false;
    dont_work(works);
    works=true;
    for(int j=0;j<3;++j) if(!mapa[grid[j][2]]) works=false;
    dont_work(works);
    
    works=true;
    for(int i=0;i<3;++i) if(!mapa[grid[i][i]]) works=false;
    dont_work(works);
    works=true;
    for(int i=0,j=2;i<3, j;++i,--j) if(!mapa[grid[i][j]]) works=false;
    dont_work(works);
    cout<<"No\n";
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete

taro _ xs [] = [0, length xs]
taro n xs ys = let key = find (>n) xs in if isNothing key then hanako 0 xs ys else let k = fromJust key in hanako k (takeWhile (<k) xs ++ dropWhile (<=k) xs) ys

hanako _ [] ys = [length ys, 0]
hanako n xs ys = let key = find (>n) ys in if isNothing key then taro 0 xs ys else let k = fromJust key in taro k xs (takeWhile (<k) ys ++ dropWhile (<=k) ys)

hands n xs = h [1..2*n] $ sort xs
  where
    h r [] = ([],r)
    h (g:gs) ta@(t:ts)
      | g==t = let (tt, hh) = h gs ts in (g:tt, hh)
      | otherwise = let (tt, hh) = h gs ta in (tt, g:hh)
main = do
    n <- getInt
    when (n/=0) $ do
        d <- replicateM n getInt
        let (t, h) = hands n d
        mapM_ print $ taro 0 t h
        main

Measured memory_bytes: 4120
#include <algorithm>
#include <vector>

long max_steps(std::vector<int> const &H) {
  using namespace std;

  long max_count = 0;
  size_t start = 0, end = 0;
  while (end + 1 < H.size()) { // 尺取法
    if (H[end] >= H[end + 1]) {
      ++end;
      continue;
    }

    if (max_count < end - start) {
      max_count = end - start;
    }
    ++end;
    start = end;
  }
  if (max_count < end - start) {
    max_count = end - start;
  }

  return max_count;
}

#include <iostream>

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

  int N;
  cin >> N;

  vector<int> H(N);
  for (auto &e : H) {
    cin >> e;
  }

  cout << max_steps(H) << "\n";
}


Measured memory_bytes: 640
#include <algorithm>
#include <cstring>
#include <cstdio>
using namespace std;

const int N = 1e5 + 10;
const int mo = 1e9 + 7;

char str[N];
int n, pw[N] = {1}, pre[N], suf[N], p[N], s[N];

int main() {
	scanf("%s", str + 1);
	n = strlen(str + 1);
	for(int i = 1; i <= n; i ++) {
		pw[i] = pw[i - 1] * 3ll % mo;
	}
	for(int i = 1; i <= n; i ++) {
		pre[i] = pre[i - 1] + (str[i] == 'A');
		p[i] = p[i - 1] + (str[i] == '?');
	}
	for(int i = n; i >= 1; i --) {
		suf[i] = suf[i + 1] + (str[i] == 'C');
		s[i] = s[i + 1] + (str[i] == '?');
	}
	int ans = 0;
	for(int i = 1; i <= n; i ++) {
		if(str[i] == 'B') {
			(ans += 1ll * pre[i - 1] * suf[i + 1] % mo * pw[p[n]] % mo) %= mo;
			if(p[i]) (ans += 1ll * p[i] % mo * suf[i + 1] % mo * pw[p[n] - 1] % mo) %= mo;
			if(s[i]) (ans += 1ll * s[i] % mo * pre[i - 1] % mo * pw[p[n] - 1] % mo) %= mo;
			if(p[i] && s[i])
				(ans += 1ll * s[i] * p[i] % mo * pw[p[n] - 2] % mo) %= mo;
		} else if(str[i] == '?') {
			(ans += 1ll * pre[i - 1] * suf[i + 1] % mo * pw[p[n] - 1] % mo) %= mo;
			if(p[i - 1]) (ans += 1ll * p[i - 1] % mo * suf[i + 1] % mo * pw[p[n] - 2] % mo) %= mo;
			if(s[i + 1]) (ans += 1ll * s[i + 1] % mo * pre[i - 1] % mo * pw[p[n] - 2] % mo) %= mo;
			if(p[i - 1] && s[i + 1])
				(ans += 1ll * s[i + 1] * p[i - 1] % mo * pw[p[n] - 3] % mo) %= mo;
		}
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n, m; cin >> n >> m;
    vi a(m); for(auto& e : a) cin >> e, e--;
    vi used(n);

    reverse(_all(a));
    for(auto& e : a){
        if(used[e]) continue;
        cout << e + 1 << endl;
        used[e] = true;
    }

    rep(i, n){
        if(used[i]) continue;
        cout << i + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 4088
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const N = nextInt()
    const h = nextIntArray()
    let prevMax = h[0]
    for (let i = 0; i < h.length - 1; i++) {
        if (h[i] - h[i + 1] > 1) {
            console.log("No")
            return
        } else if (h[i] - h[i + 1] == 1) {
            h[i]--
            if (h[i] < prevMax) {
                console.log("No")
                return
            }
            prevMax = h[i]
        }
    }
    console.log("Yes")
}
Main()


Measured memory_bytes: 40144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const ll MOD = 1000000007;
using pint = pair<ll, ll>;

int main() {
    string s, t;
    cin >> s >> t;
    ll len_s = s.size();
    ll len_t = t.size();
    bool restore = false;
    for (int i = len_s - len_t; i >= 0; i--) {
      bool replace = true;
      for (int j = 0; j < len_t; j++) {
        if (s[i + j] != '?' && s[i + j] != t[j]) {
          replace = false;
          break;
        }
      }

      if(replace){
        restore = true;
        for (int j = 0; j < len_t; j++) {
          s[i + j] = t[j];
        }
        break;
      }
    }

    if(restore){
        for(int i = 0; i < len_s; i++){
            if(s[i]=='?'){
              cout << 'a';
            }
            else{
              cout << s[i];
            }
        }
    } else {
      cout << "UNRESTORABLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
(defun hitachi-string ()
  (let* ((s (read-line))
         (hitachi "")
         (ans "No"))
    (loop repeat 5
           if (string= s (setf hitachi (concatenate 'string hitachi "hi")))
          do (setf ans "Yes"))
     ans))


(format t "~A~%" (hitachi-string))

Measured memory_bytes: 11108
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<queue>
#include<stack>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<stdlib.h>
#include<cmath>
#include<string>
#include<algorithm>
#include<iostream>
#define exp 1e-10
using namespace std;
int main(){
	int n,m;
	cin >> n >> m;
	int ans=0;
	int k=1;
	while(k<m){
		k=k+n-1;
		ans++;
	}
	cout << ans << endl;
}

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

int main() {
    int H, W, D;
    cin >> H >> W >> D;
    int N = H * W;
    using P = pair<int, int>;
    using PI = pair<int, P>;
    vector<vector<PI>> A(D);
    rep(i, 0, H) rep(j, 0, W) {
        int a; cin >> a;
        A[a % D].push_back({a, {i + 1, j + 1}});
    }
    rep(i, 0, D) sort(A[i].begin(), A[i].end());
    function<int(P, P)> calc = [&](P a, P b) {
        int y = abs(a.first - b.first);
        int x = abs(a.second - b.second);
        return y + x;
    };
    vector<vector<int>> sum(D, vector<int>(N / D + 2));
    rep(i, 0, D) {
        rep(j, 0, A[i].size() - 1) {
            sum[i][j + 1] = sum[i][j] + calc(A[i][j].second, A[i][j + 1].second);
        }
    }
    int Q; cin >> Q;
    while(Q--) {
        int l, r;
        cin >> l >> r;
        int a = (r - l) / D;
        int n = l / D;
        if(l % D == 0) n--;
        cout << sum[l % D][n + a] - sum[l % D][n] << '\n';
    }
    return 0;
}


Measured memory_bytes: 10240
import numpy as np
N, M = map(int,input().split())
bindings = np.array([list(map(int,input().split())) for i in range(M)])
if M == 0:
    bindings = np.array([[N, 0]])
bindings[:, 0] -= 1

import sys
buf = np.zeros(N, dtype=int) - 1
for s, c in bindings:
    if buf[s] > -1 and buf[s] != c:#衝突
        print("-1")
        sys.exit()
    buf[s] = c

if N == 1:#1桁ならそのまま出力
    if buf[0] == -1:
        buf[0] = 0
    print(buf[0])
    sys.exit()
if buf[0] == 0:#最上位がゼロ
    print("-1")
    sys.exit()
    
if buf[0] == -1:#最上位を1にする
    buf[0] = 1
buf[buf == -1] = 0#そのほかはゼロにする

res = "".join(list(map(str, buf)))
print(res)

Measured memory_bytes: 12512
#include <bits/stdc++.h> 
using namespace std; 
int main(){
  string S;
  cin >> S;
  int K = S.size() -1;
  
  if(S.at(K) == 's' ){
    cout << S << "es" << endl;
  }
  
  else {
    cout << S << 's' << endl;
  }
  
}

Measured memory_bytes: 3624
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

ll gcd(ll m,ll n){
  if(0==n)return m;
  return gcd(n,m%n);
}


int main(){
	CIN(n,x);
	VC1(n,a);
	ll ans = abs(a[0]-x);
	REP(i,n)
		ans=gcd(ans,abs(a[i]-x));
	COUT(ans);
}


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

long long N, mod = 1000000007;
string S, T; long long dp[1000009], r[26];

int main() {
	cin >> N >> S >> T; dp[0] = 1; r[S[0] - 'a'] = 1;
	for (int i = 1; i < S.size(); i++) {
		dp[i] = r[T[i] - 'a'];
		r[S[i] - 'a'] += dp[i];
		r[S[i] - 'a'] %= mod;
	}
	cout << dp[S.size() - 1] << endl;
	return 0;
}


Measured memory_bytes: 4080
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  vi A(0);
  vi dp1(1000001, INT_INF), dp2(1000001, INT_INF);
  for(int i = 1; i*(i+1)*(i+2)/6 < 1000000; i++){
    int x = i*(i+1)*(i+2)/6;
    A.push_back(x);
    dp1.at(x) = 1;
    if(x%2 == 1) dp2.at(x) = 1;
  }
  for(int i = 1; i <= 1000000; i++){
    for(int j = 0; j < A.size(); j++){
      if(A.at(j) >= i) break;
      chmin(dp1.at(i), dp1.at(i-A.at(j))+1);
      if(A.at(j) % 2 == 1){
        chmin(dp2.at(i), dp2.at(i-A.at(j))+1);
      }
    }
  }
  //cout << dp1.at(40) << endl << dp2.at(40) << endl;


  queue<int> result;
  while(true){
    int n;
    cin >> n;
    if(n == 0) break;
    result.push(n);
  }
  while(!result.empty()){
    int x = result.front(); result.pop();
    cout << dp1.at(x) << ' ' << dp2.at(x) << endl;
  }

}


Measured memory_bytes: 10580
n=int(input())
b=list(map(int,input().split()))

lis=[0]*n

for i in range(0,n-1):
  if i==0:
    lis[0]=b[0]
  temp=b[i]
  if lis[i]>b[i]:
    lis[i]=b[i]
  lis[i+1]=b[i]
print(sum(lis))

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

namespace CSharpSample01
{


    class Program
    {

        

        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());

            string s = Console.ReadLine();

            if (a >= 3200) Console.WriteLine(s);
            else Console.WriteLine("red");
            

        }
    }
}

Measured memory_bytes: 13140
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		
		long[] l = new long[n+1];
		l[0] = 2;
		l[1] = 1;
		
		for(int i = 2; i <= n; i++) {
			l[i] = l[i-2]+l[i-1];
		}
		System.out.println(l[l.length-1]);
		
		
	}

}


Measured memory_bytes: 22996
l,r = gets.chomp.split(" ").map(&:to_i)
lmod = l%2019
rmod = r%2019

if r-l >= 2019 || lmod >= rmod
    puts 0
else
    min = l*(l+1)
    min %= 2019
    for i in l..r-1 do
        for j in i+1..r
            pro = i*j
            pro %= 2019
            if pro < min 
                min = pro
            end
        end
    end
    puts min
end

Measured memory_bytes: 1788
import java.io.*;

class Main
{
   public static void main(String args[]) throws Exception{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   int n = Integer.parseInt(br.readLine());
   int s = n%60;
   int h = (n-s)/3600;   
   int m = (n-s-h*3600)/60;
   System.out.println(h + ":" + m + ":" + s);
}
}

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

using namespace std;

double rec(int& n, int x, int y, int z, vector<vector<vector<double>>>& dp){
    //cerr<<x<<y<<z<<endl;
    if(dp[x][y][z] > 0.5) return dp[x][y][z];
    double tot = double(x+y+z);
    if(!tot) return 0;
    
    double val = 0;
    if(x > 0) val += double(x) * rec(n,x-1,y,z,dp);
    if(y > 0) val += double(y) * rec(n,x+1,y-1,z,dp);
    if(z > 0) val += double(z) * rec(n,x,y+1,z-1,dp);

    dp[x][y][z] = (val + n)/tot;
    //cerr<<x<<y<<z<<" "<<dp[x][y][z]<<endl;
    return dp[x][y][z];
}

int main(){
    int n, x=0, y=0, z=0;
    cin>>n;
    cout<<setprecision(10);
    vector<vector<vector<double>>> dp(n+1, vector<vector<double>>(n+1, vector<double>(n+1, -1)));
    for(int i=0; i<n; i++){
        int temp;
        cin>>temp;
        if(temp == 1) x++;
        if(temp == 2) y++;
        if(temp == 3) z++;
    }
    cout<<rec(n,x,y,z,dp);
}


Measured memory_bytes: 216960
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define FFOR(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define rep(i,n) FOR(i,0,n-1)
#define int long long
#define MOD 998244353
#define MAXN  100005
#define P pair<int,int>

string a[2] = {"A",""};

signed main(){
	
	string s;cin>>s;
	
	rep(i,(1<<4))
	{
		string ans = "";
		ans += a[(i>>3)&1];
		ans += "KIH";
		ans += a[(i>>2)&1];
		ans += "B";
		ans += a[(i>>1)&1];
		ans += "R";
		ans += a[(i>>0)&1];
		
		if(ans == s)
		{
			cout << "YES" << endl;
			return 0;
		}
	}
	
	cout << "NO" << endl;
}

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

int main(){

  int x;
  cin>>x;

  int h = x / 3600;
  int m = (x / 60) % 60;
  int s = x % 60;
  cout<<h<<":"<<m<<":"<<s<<endl;

  return 0;
}



Measured memory_bytes: 3080
n=int(input())
l=list(map(int,input().split(" ")))
l.sort();
t=1000000000000000000
at=1;
f=True;
for x in l:
  at=at*x;
  if(at>t):
    f=False
    break
if(f):
  print(at)
else:
  print(-1)
   



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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	ll n, m;
	cin >> n >> m;
	if(n<m) swap(n,m);
	ll ans;
	if(m==1 && n==1) ans = 1;
	else if(m==1) ans = n-2;
	else ans = (n-2)*(m-2);
	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

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

int main() {
	int a,b,c; cin>>a>>b>>c;
  	if(a==b){
    	cout<<c;
      	return 0;
    }
  	if(b==c){
    	cout<<a;
      	return 0;
    }
  	if(a==c){
    	cout<<b;
      	return 0;
    }
  
}
  	

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

int main()
{
    int n, m;
    int i, j, k, l, key, judge = 0;
    
    cin >> n >> m;
    
    vector<string> a(n, ""), b(m, "");
    
    for(i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(j = 0; j < m; j++) {
        cin >> b[j];
    }
    
    for(i = 0; (i <= n - m) && (judge == 0); i++) {
        for(j = 0; (j <= n - m) && (judge == 0); j++) {
            
            key = 1;
            for(k = 0; (k < m) && (key == 1); k++) {
                for(l = 0; (l < m) && (key == 1); l++) {
                    
                    if(b[k][l] != a[i+k][j+l]) {
                        key = 0;
                    }
                }
            }
            if(key == 1) {
                judge = 1;
            }
        }
    }
    
    if(judge == 1) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int a,b,c,d,p,y,x,n;
	cin>>a>>b>>c>>d>>p;
	x=p*a;
	if(p>=c) y=(p-c)*d+b;
	else y=b;
	if(x>y) cout<<y<<endl;
	else cout<<x<<endl;
	
	return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

#include <map>

int main(void){
    Cin(int, n);
    Cins(int, n, a);

    multimap<int, int> m;
    m.emplace(-1, 0);
    
    For(i, n){
        auto itr = m.lower_bound(a[i]);
        itr --;
        if(itr->first != -1) m.erase(itr);
        m.emplace(a[i], 0);
    }
    Cout(m.size()-1);
}





Measured memory_bytes: 5376
inputs = gets.split
stack = []
inputs.each{|c|
	if c == '+'
		stack.push stack.pop + stack.pop
	elsif c == '-'
		stack.push -stack.pop + stack.pop
	elsif c == '*'
		stack.push stack.pop * stack.pop
	else
		stack.push c.to_i
	end
}
puts stack[0]

Measured memory_bytes: 8636
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}

int32_t main()
{
	int t=1;
	while(t--)
	{
		int n;
		cin >> n;
		int a[n];
		for(int i=0;i<n;i++)
		cin >> a[i];
		
		int mx=0;
		int cnt=0;
		for(int i=1;i<n;i++)
		{
			if(a[i]<=a[i-1])
			{
				cnt++;
			}
			else
			{
				mx=max(mx,cnt);
				cnt=0;
			}
		}
		mx=max(mx,cnt);
		
		cout << mx;
	}
}




Measured memory_bytes: 4376
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);

    int k, x;
    cin >> k >> x;
    if (500 * k >= x) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <stack>
#include <set>
#include <bitset>
#include <deque>
#pragma GCC optimize(3 , "Ofast" , "inline")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std ;
#define ios ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0)
#define x first
#define y second
#define pb push_back
#define ls rt << 1
#define rs rt << 1 | 1
typedef long long ll ;
const double esp = 1e-6 , pi = acos(-1) ;
typedef pair<int , int> PII ;
const int N = 1e6 + 10 , INF = 0x3f3f3f3f , mod = 1e9 + 7;
int fa[N] , sz[N] ;
int find(int x){
  return fa[x] == x ? x : fa[x] = find(fa[x]) ;
}
int work()
{
  int n , m ;
  cin >> n >> m ;
  for(int i = 1; i <= n ;i ++ ) fa[i] = i , sz[i] = 1 ;
  for(int i = 1; i <= m ;i ++ ) {
    int x , y ;
    cin >> x >> y ;
    int fx = find(x) , fy = find(y) ;
    if(fx != fy) {
      fa[fx] = fy ;
      sz[fy] += sz[fx] ;
    }
  }
  int ans = 0 ;
  for(int i = 1; i <= n ;i ++ ) ans = max(ans , sz[i]) ;
  cout << ans << endl ;
  return 0 ;
}
int main()
{
  //   freopen("C://Users//spnooyseed//Desktop//in.txt" , "r" , stdin) ;
  //   freopen("C://Users//spnooyseed//Desktop//out.txt" , "w" , stdout) ;

  work() ;
  return 0 ;
}
/*
*/


Measured memory_bytes: 4740
///same with abc068d
#include <stdio.h>
long long k,arr[50];
void step()
{
	long long mmin = 55555555555555555,pos=51;
	for (int i = 0; i < 50; i++) if (--arr[i] < mmin) {	mmin = arr[i]; pos = i;}
	arr[pos] += 51;
}
int main()
{
	scanf("%lld", &k);
	for (int i = 0; i < 50; i++) arr[i] = i;
	for (int i = 0; i < 50; i++) arr[i] += k / 50;
	for (long long j = 0; j < k % 50; j++) step();
	printf("50\n");
	for (int i = 0; i < 50; i++) printf("%lld ",arr[i]);
	puts("");
	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;


public class Main {
	public static void main(String[] args) throws IOException{
		
		BufferedReader buf= new BufferedReader(new InputStreamReader(System.in));
		int a=0;
		int b=0;
		int[] data=new int[200];
		String str1=null;
		String str2;
		
		
		int count=0;
		while((str1=buf.readLine())!=null){
			
			 a=Integer.parseInt(str1.split(" ")[0]);
			 b=Integer.parseInt(str1.split(" ")[1]);
			 str2=Integer.toString(a+b);
			 data[count]=str2.length();
			 count++;
			 
			
		}
		buf.close();
		for(int i=0;i<count;i++){
			System.out.println(data[i]);
		}
	}
}

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

using namespace std;

int main(){
	int N;
	cin>>N;
    vector <int>a(N);
    for(int i=0 ; i<N ; i++){
		cin>>a[i];
    }
	
	int max=0;
	int min=a[0];
	for(int i=0 ; i<N ; i++){
		if(max<a[i])max=a[i];
		if(min>a[i])min=a[i];
	}
	cout<<max-min<<"\n";
	
	return 0;
}


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

void solve() 
{
    ll n,k;cin>>n>>k;
    ll a[n];REP(i,n)cin>>a[i];
    REP(i,n-k)cout<<(a[i]<a[i+k]?"Yes":"No")<<endl;
}

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

Measured memory_bytes: 5216
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
# sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


# show_flg = True
show_flg = False


def main():
    H, W = MI()
    N = I()
    a = LI()
    v = []

    for i in range(len(a)):
        for j in range(a[i]):
            v.append(i+1)

    graph = [[0] * W for i in range(H)]

    for i in range(len(v)):
        x = i % W
        y = i // W
        if y % 2 == 0:
            graph[y][x] = v[i]
        else:
            graph[y][W-x-1] = v[i]

    for i in range(H):
        print(*graph[i])


if __name__ == '__main__':
    main()


Measured memory_bytes: 43244
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << endl;
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int64_t, int >prime_factor(int64_t n){map< int64_t, int > ret;for(int64_t i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

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

    int n; cin >> n;
    int a[100]; a[0]=1; FOR(i,1,100)a[i]=a[i-1]*2%MOD;
    int ans = 0;
    int cnt[100][2]={0};
    while(n--){
        int x; cin >> x;
        REP(i,70){
            int bit = x%2;
            ans += cnt[i][bit^1]*a[i]%MOD;
            ans %= MOD;
            cnt[i][bit]++;
            x /= 2;
        }
    }
    cout << ans << endl;

    return 0;
}

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

#define long long long int
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(6);
    string s;
    cin >> s;
    int ans = 0;
    int cnt = 0;
    unordered_set<char> uset;
    uset.insert('A');
    uset.insert('C');
    uset.insert('G');
    uset.insert('T');
    for (int i = 0; i < s.size(); ++i) {
        int j = i;
        while (j < s.size() && uset.count(s[j])){
            j++;
            cnt++;
        }
        ans = max(cnt,ans);
        cnt = 0;
    }
    cout << max(ans,cnt);
    return 0;
}

Measured memory_bytes: 256
/*Author: Qaseem Hasan alias Mikepayne14(Codeforces,SPOJ) 
                           qaseem_hasan_ (HackerEarth,Codechef,HackerRank)
*/
 
 
//---------------------------------------------------------
//#pragma GCC optimize "trapv"
 
#include<bits/stdc++.h>
using namespace std;
//---------------------------------------------------------
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; } //x=min,y=item
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
 
template<typename ForwardIterator,typename T>
T first_val(ForwardIterator first,ForwardIterator last,T value)
{
    auto it = std::lower_bound(first,last,value);
    return (it!=last)?(it - first) : -1;
}
 
template<typename ForwardIterator,typename T>
T last_val(ForwardIterator first,ForwardIterator last,T value)
{
    auto it = std::upper_bound(first,last,value);
    return ((it!=last)?(it - first) : -1) - 1;
}
//--------------------------------------------------------
#define acc accumulate
#define eb emplace_back
#define ll long long int
#define lld long long double
#define mii map <int,int>
#define vi vector <int>
#define vll vector <ll>
#define vvi vector <vi>
#define pii pair <int,int>
#define vpii vector <pii>
#define seti set <int>
#define F first
#define S second
#define fil(v,x) fill(all(v),x)
#define filcon(v,x) iota(all(v),x)
#define rep(n) for(int i=0;i<n;++i)
#define repr(n) for(int i=n-1;i>=0;--i)
#define erase(v,e) v.erase(std::remove(v.begin(), v.end(), e), v.end())
#define sqr(x) ((x)*(x))
#define MEM(a, b) memset(a, b, sizeof(a))
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define inrange(i,a,b) ((i>=min(a,b)) && (i<=max(a,b))) 
#define FLSH fflush(stdout)
// #define min_all(a,b,c,d,...) min({a,b,c,d,...})
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define make_unique(v) sort(all(v)); v.erase(unique(all(v)), v.end());
#define INF (int)1e9
#define EPS 1e-8
#define MOD 1e9 + 7
#define tr(x) cout<<#x<<" = { "<<x<<" }\n";
#define khatam '\n'
#define PI acos(-1);
 
//--------------------------------------------------------
 
//int ar[40001][40001];
 
//ll ar[10001];
 
//--------------------------------------------------------
/*bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.F < j.F;
}*/
 
void solve()
{
    ll n;
    cin >> n;
    ll sum = n/500;
    ll happy = sum * 1000;
    ll res = (n - sum*500)/5;
    happy += res*5;
    cout << happy << khatam;
}
 
int main()
{
    FAST_IO;
/*    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
//--------------------------------------------------------
solve();
}

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


int main() {
  int k,a,b;
  cin>>k>>a>>b;
  if(a%k>b%k || a%k==0 || b%k==0 || b-a>=k) {
    cout<<"OK";
  }else {
    cout<<"NG";
  }
  return 0;
}

Measured memory_bytes: 3620
use proconio::input;

fn main() {
    input! {
        x: usize,
    }

    let quotient = x / 11;
    let remainder = x % 11;

    let mut ans = quotient * 2;

    if remainder > 0 && remainder <= 6 {
        ans += 1;
    } else if remainder > 6 {
        ans += 2;
    }

    println!("{}", ans);
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,mod=1000000007,f[100009],xr[100009],pas,jm[100009],k[100009],kj[100009],fct[100009];
long long xar(long long q, long long w){
	if(w==0) return 1;
	long long as=xar(q,w/2);
	if(w%2==0) return (as*as)%mod; else return (q*((as*as)%mod))%mod;
}
long long dv(long long q, long long w){
	return q*xar(w,mod-2)%mod;
}
long long C(long long q, long long w){
	long long zz=(fct[w]*fct[q-w])%mod;
	return dv(fct[q],zz);
}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	for(i=1; i<=a; i++) cin>>f[i];
  sort(f+1,f+a+1);
  if(b==1){
    cout<<0;
    return 0;
  }
/*	xr[0]=1;
	for(i=1; i<=a; i++){
		xr[i]=xr[i-1]*2;
		xr[i]%=mod;
	}
	for(i=1; i<=a; i++){
		jm[i]=jm[i-1]+xr[i];
		jm[i]%=mod;
	}*/
	fct[0]=1;
	for(i=1; i<=a; i++){
		fct[i]=fct[i-1]*i;
		fct[i]%=mod;
	}
	for(i=0; i<=a; i++){
		if(i<b-1){
			k[i]=0;
			continue;
		}
		k[i]=C(i,b-1);
//      cout<<i<<" f "<<k[i]<<endl;
	}
	for(i=1; i<=a; i++){
	if(i>=b){	
      pas+=(k[i-1]/*-kj[i-b]*/)*f[i];
//      pas=pas+mod;
      if(pas<0&&pas%mod!=0) pas=pas%mod+mod;
		pas%=mod;
    }
      if(a-i>=b-1){
		pas-=(k[a-i]/*-kj[a-i-b]*/)*f[i];
//        pas=pas+mod;
        if(pas<0&&pas%mod!=0) pas=pas%mod+mod;
		pas%=mod;
      }
	}
	cout<<pas;
	return 0;
}

Measured memory_bytes: 4224
#include<stdio.h>
int main(void)
{
	int n, a[20], V[50], C[50], adv=0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &V[i]);
	for (int i = 0; i < n; i++)
		scanf("%d", &C[i]);
	for (int i = 0; i < n; i++) {
		if (V[i] - C[i] > 0)
			adv += V[i] - C[i];
	}

	printf("%d", adv);

	return 0;

}

Measured memory_bytes: 128
n = gets.to_i

top = {}
n.times do
  name = gets.strip

  next unless ["M", "A", "R", "C", "H"].include?(name[0])
  
  top[name[0]] ||= 0
  top[name[0]] += 1
end

k = top.keys.size
if k < 3
  puts 0
  exit 0
end

ans = 0
top.keys.combination(3).each do |(a, b, c)|
  ans += top[a] * top[b] * top[c]
end

puts ans


Measured memory_bytes: 1788
# coding: utf-8
# Your code here!

import sys
readline = sys.stdin.readline
read = sys.stdin.read


#n, *a = [int(i) for i in read().split()]

n = input()
k = int(input())
k += 1
l = len(n)

dp = [[0]*k for _ in range(2)]
dp[0][0] = 1

for c in n:
    ndp = [[0]*k for _ in range(2)]
    ni = int(c)
    for is_less in range(2):
        for num in range(k):
            for d in range(10 if is_less else ni+1):
                if d == 0:
                    ndp[is_less or d < ni][num] += dp[is_less][num]
                elif num < k-1:
                    ndp[is_less or d < ni][num+1] += dp[is_less][num]

    dp = ndp


#print(dp)
print(sum(i[-1] for i in dp))        
        
        
        
        
        
        
        
        
        

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

int main() {
    //変数宣言
    string S;
    int d_value = 700;
    cin >> S;

    int counter = 0;
    if (S[0] == 'o') counter += 100;
    if (S[1] == 'o') counter += 100;
    if (S[2] == 'o') counter += 100;
    
    if (counter == 0) cout << d_value << endl;
    else cout << d_value + counter << endl;

}

Measured memory_bytes: 768