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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
  int A, B;
  std::cin >> A >> B;
  std::cout << A * B << '\n';
}


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

using namespace std;

int main(void) {
    int A, B;
    cin >> A >> B;
    cout << 100 << " " << 100 << endl;
    vector< vector<int> > grad(100, vector<int>(100));
    for(int i=0; i<50; i+=2) {
        for(int j=0; j<100; j+=2) {
            if(A > 1) {
                grad[i][j] = 1;
                --A;
            }
        }
    }
    for(int i=50; i<100; i++) {
        for(int j=0; j<100; j++) {
            grad[i][j] = 1;
            if(B > 1 && i>50 && i%2 == 1 && j%2) {
                grad[i][j] = 0;
                --B;
            }
        }
    }
    for(int i=0; i<100; i++) {
        for(int j=0; j<100; j++) {
            if(grad[i][j]) {
                cout << '.';
            } else {
                cout << '#';
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

const INF: usize = 1_000_000_000;

fn main() {
    let n = read1::<String>().chars().collect::<Vec<char>>();
    let l = n.len();
    let mut dp = vec![vec![INF; l+1]; 2];
    dp[0][0] = 0;
    dp[1][0] = INF;

    for i in 0..l {
        let num = n[i] as usize - 48;
        dp[0][i+1] = std::cmp::min(dp[0][i] + num, dp[1][i] + num);
        dp[1][i+1] = std::cmp::min(dp[0][i] + 1 + 10 - num, dp[1][i] + 9 - num);
    }

    println!("{}", std::cmp::min(dp[0][l], dp[1][l]));
}

Measured memory_bytes: 25840
s=input()
import re
ans=re.findall("[A,T,G,C]+",s)#findall、なかったら[]が帰ってくる。matchのようにNoneが帰ってくるわけではない。
if ans==[]:
    print(0)
else:
    print(len(max(ans,key=len)))#このときfindallで返される行列は先頭から見つかったもの順に並べられることに注意すること。

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>
#define MOD 1000000007
using namespace std;

long mod_inv(long n) {
    long ans = 1;
    long mod = MOD - 2;
    for (; mod > 0; mod >>= 1) {
        if (mod & 1) {
            ans *= n;
            ans %= MOD;
        }
        n *= n;
        n %= MOD;
    }
    return ans;
}


long comb(int n, int k) {
    long nl = (long) n;
    nl++;
    long ans = 1;
    for (long i = 1; i <= k; i++) {
        ans *= nl - i;
        ans %= MOD;
        ans *= mod_inv(i);
        ans %= MOD;
    }
    return ans;
}

vector<long> factorize(int m) {
    vector<long> res;
    long a = 0;
    while (m % 2 == 0) {
        a++;
        m /= 2;
    }
    res.push_back(a);
    for (int i = 3; i <= m; i += 2) {
        long a = 0;
        for (; m % i == 0; m /= i) {
            a++;
        }
        res.push_back(a);
    }
    return res;
}


int main() {
    int n, m;
    cin >> n >> m;
    vector<long> v = factorize(m);
    transform(v.begin(), v.end(), v.begin(), [n](int k) {
            return comb(k + n - 1, k);
            });
    long ans = 1;
    for (long x: v) {
        ans *= x;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 262616
#include <iostream>
#include <cmath>
using namespace std;
int x,n,a[110];
int main(void)
{
    cin>>x>>n;
    for(int i=1;i<=n;i++)
    {
        int y;
        cin>>y;
        a[y]=1;
    }
    int minn=110,now=110;
    for(int i=105;i>=0;i--)
    {
        if(!a[i]&&(fabs(i-x)<minn||fabs(i-x)==minn&&i<now))
        {
            minn=fabs(i-x);
            now=i;
        }
    }
    cout<<now<<endl;
}


Measured memory_bytes: 3192
#include <iostream>

int main() {
    bool flg = true;
    int sum = 0, n, s, m = 101, ret = 0;
    std::cin >> n;

    for (int i = 0; i < n; i++) {
        std::cin >> s;
        if (s % 10 != 0) {
            flg = false;
            if (m > s) m = s;
        }
        sum += s;
    }

    if (!flg) {
        if (sum % 10 == 0) ret = sum - m;
        else ret = sum;
    }

    std::cout << ret << std::endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        long x = cin.nextLong();
        int a, b = 0;
        bool found = false;
        for (a = 0; a < 200; ++a)
        {
            for (b = -200; b < 200; ++b)
            {
                int ans = a * a * a * a * a - b * b * b * b * b;
                if (ans == x)
                {
                    found = true;
                    break;
                }
            }

            if (found) break;
        }

        WriteLine(a.ToString() + " " + b.ToString());
    }

    private double NthRoot(double x, int n)
    {
        if (x >= 0)
        {
            // 通常のn乗根
            return Math.Pow(x, 1.0 / (double)n);
        }
        else
        {
            if ((n % 2) != 0)
            {
                // 奇数乗根の場合
                return -Math.Pow(-x, 1.0 / (double)n);
            }
            else
            {
                // 偶数乗根の場合
                return double.NaN;
            }
        }
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

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

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

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

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

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

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

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


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


Measured memory_bytes: 27328
#include<bits/stdc++.h>
using namespace std;
#define int long long
void Digvijay()
{
   int ans =0;
   int n;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
       for(int j=i;j<=n;j+=i)
       {
           ans+=j;
       }
   }
   cout<<ans<<"\n";
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int _=1;
    //cin>>_;
    for(int __=0;__<_;__++)
    {
        Digvijay();
    }
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;} 


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

int N; cin >> N;
VI A(N); invec(A);
VI cnt(200001, 0);
for(i64 a:A) ++cnt[a];
i64 ans = 0;
for(i64 c: cnt) if (c>1) ans += c * (c - 1)/2;

rep(k, 0, N){
    i64 c = cnt[A[k]];
    if (c > 1) cout << ans - c * (c-1)/2 + (c-1)*(c-2)/2 << "\n"; 
    else cout << ans << "\n";
}

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 5760
fun main() {
    val (a, b, n) = readLongList()

    var x = n
    if (n >= b - 1) x = b - 1
    println(a * x / b - a * (x / b))
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

Measured memory_bytes: 36328
import math
n,d = map(int,input().split())
l = []
for i in range(n):
  l.append(list(map(int,input().split())))
count = 0
for i in range(n-1):
  for j in range(i+1,n):
    ans = 0
    for k in range(d):
      ans += (int(l[i][k])-int(l[j][k]))**2

    if float.is_integer(math.sqrt(ans)) == True:
      count += 1
print(count)


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

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

    long long tmp = 0;
    queue<long long> ans;
    for(long long i = 1; i < 10; i++){
        ans.push(i);
    }
    for(int i = 0; i < k; i++){
        long long tmp = ans.front();
        ans.pop();
        if(i == k - 1){
            cout << tmp << endl;
            return 0;
        }
        if(tmp % 10 != 0){
            ans.push(10 * tmp + tmp % 10 - 1);
        }
        ans.push(10 * tmp + tmp % 10);
        if(tmp % 10 != 9){
            ans.push(10 * tmp + tmp % 10 + 1);
        }
    }
}

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

#define MAX 100000

int partition(int [],int,int);
int x,i,p=0;

int main(){

  int A[MAX];
  int n,p=1,q;

  scanf("%d",&n);

  for( i = 1 ; i <= n ; i++ ) {
    scanf("%d",&A[i]);
  }
  
  //for( i = 1 ; i <= n ; i++ ) {
    q = partition(A,p,n);

  for( i = 1 ; i < n ; i++ ){
    if(i == q) {
      printf("[%d] ",A[i]);
      continue;
    }
    printf("%d ",A[i]);
  }

  printf("%d\n",A[i]);

  return 0;
}
  
int partition(int A[],int p,int n){
  int j,key;

  x = A[n];
  i = p-1;
  for( j = p ; j <= n-1 ; j++ ){
    if( A[j] <= x ){
      i = i+1;
      key = A[j];
      A[j] = A[i];
      A[i] = key;
    }
  }
      key = A[n];
      A[n] = A[i+1];
      A[i+1]= key;
  return i+1;
}

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

typedef long long ll;

int main () {
  int n;
  cin >> n;
  ll prev = 0;
  ll ht = 0;
  for (int i=0; i<n; i++) {
  	ll h;
    cin >> h;
    if (h < prev) {
    	ht = (ht + prev-h);
      	h = prev;
    }
    prev = h;
  }
  cout << ht << endl;
	return 0;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans = 0;
int main() {
	cin >> a >> b >> c >> d;
	if (a == c) {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
vector<map<int, int>> graph;
int main(){
    int n;
    cin >> n;
    graph.resize(n);
    vector<pair<int, int>> edges_in_order;
    for(int i = 0; i < n - 1; i++){
        int a, b;
        cin >> a >> b;
        edges_in_order.emplace_back(a - 1, b - 1);
        graph[a - 1][b - 1] = -1;
        graph[b - 1][a - 1] = -1;
    }
    int mx = 0;
    vector<vector<bool>> color;
    for(int i = 0; i < n; i++){
        color.push_back(vector<bool>(graph[i].size()));
        mx = max(mx, (int)graph[i].size());
    }
    for(int i = 0; i < n; i++){
        int least = 0;
        for(auto itr : graph[i]){
            if(itr.second != -1) continue;
            for(int j = least; j < color[i].size(); j++){
                if(color[i][j]) continue;
                least = j + 1;
                color[i][j] = true;
                graph[i][itr.first] = j;
                graph[itr.first][i] = j;
                if(j < graph[itr.first].size()) color[itr.first][j] = true;
                break;
            }
        }
    }
    cout << mx << "\n";
    for(auto itr : edges_in_order){
        cout << graph[itr.first][itr.second] + 1 << "\n";
    }
    /*for(int i = 0; i < n; i++){
        for(auto itr : graph[i]){
            cout << i + 1 << " " << itr.first + 1 << " " << itr.second + 1 << "\n";
        }
    }*/
}

Measured memory_bytes: 23144
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  long long n, m, d;
  cin >> n >> m >> d;
  double ans = 0;
  if (d == 0) {
    ans = (n - d) * (m - 1) / ((double)n * n);
  } else {
    ans = (n - d) * (m - 1) * 2 / ((double)n * n);
  }
  printf("%.9lf\n", ans);
  return 0;
}


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

int main(void){
    long long n,r[200005];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>r[i];
    }
    long long Min=r[0],ans=-9000000000;
    for(int i=1;i<n;i++){
        ans=max(ans,r[i]-Min);
        Min=min(Min,r[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4640
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(10);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
////////////////

void solve(){
  double A,B,P,Q,R;
  in(A,B,P,Q,R);
  out((P*B - Q * (B - A)) / (Q + R) + B);
}


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

int main(){
    int k,flag=0,num=0,tmp=0;
    cin >> k;
    rep(i,k){
       num = num*10 + 7;

       num %= k;
       if(num==0){
       tmp = i;
       flag=1; 
       break; 
       }

    }
    if(flag==1){
        cout << tmp + 1 << endl;

    }else{
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3572
import Data.List

solve a b n = f n
  where
    f x = floor arg1 - (a * (floor arg2))
      where
        arg1 = (toDouble a) * (toDouble x) / (toDouble b)
        arg2 = (toDouble x) / (toDouble b)

toDouble :: Int -> Double
toDouble x = fromInteger $ toInteger x

main = do
  [a,b,n] <- map read . words <$> getLine :: IO [Int]
  let n' = min (b-1) n
  putStrLn . show $ solve a b n'

-- f x = floor(Ax/B) - A*floor(x/B)
-- f (x+B) =
-- floor(A(x+B)/B) - A*floor((x+B)/B)
-- floor(Ax/B + A) - A*floor(x/B+1)
-- floor(Ax/B) + A - A*floor(x/B) - A
-- floor(Ax/B) - A*floor(x/B)


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

namespace ABC042_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ');
            var N = int.Parse(line[0]);
            var L = int.Parse(line[1]);
            var S = new List<string>();

            for (var n = 0; n < N; n++)
            {
                S.Add(Console.ReadLine());
            }

            Console.WriteLine(string.Join("", S.OrderBy(s => s)));
        }
    }
}


Measured memory_bytes: 13652
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    cout<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]<<" "<<a[6]<<a[7]<<a[8]<<a[9]<<a[10]<<a[11]<<a[12]<<" "<<a[14]<<a[15]<<a[16]<<a[17]<<a[18];
    return 0;
}

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

const int mod = 1e9 +7  ;

#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
const int N=(ll)2e5+1;
vl g[N];
vl a(N),cost(N);
vl ans;
vector<bool> vis((ll)1e5+1);
ll dfs(ll u,ll dist){
    cost[u]=a[u];
    ll ai=dist*a[u];
    for(auto x:g[u]){
            ai+=dfs(x,dist+1);
            cost[u]+=cost[x];

    }

    return ai;
}


int main(){
 ios_base::sync_with_stdio(0);
  ll n,k;
  cin >> n >> k;
  ll i;
  vl a(n);
  for(i=0;i<n;i++)  cin >> a[i];
  vl s(n*(n+1)/2);
  ll j,sum,ki=0;
  for(i=0;i<n;i++){
    sum=0;
    for(j=i;j<n;j++){
        sum+=a[j];
        s[ki++]=sum;
    }
  }
  ll b=64,co=0,ans=0;
  vector<bool>is(s.size(),true);
  for(j=40;j>=0;j--){
        co=0;
  for(i=0;i<s.size();i++){
//    cout << s[i] << " ";
    if(!is[i])  continue;
    if(s[i]&(1LL<<j))
      co++;
  }
    if(co>=k){
//        cout << (1<<j) << " ";
        ans|=(1LL<<j);
        for(i=0;i<s.size();i++){
            if(!(s[i]&(1LL<<j))){
                is[i]=false;
            }
        }
    }
  }
  cout << ans << endl;
    return 0;
}



Measured memory_bytes: 12032
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC return 0;
using namespace std;
int a, b, c;
int main() {
    DAU
    cin >> a >> b >> c;
    if ((a == b && a != c) || (a == c && b != c) || (b == c && a != c))
        cout << "Yes";
    else cout << "No";
    PLEC
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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


    ll N, K;
    cin >> N >> K;
    ll T = (N-1)*(N-2)/2;
    if(K > T){
    	cout << -1 << endl;
    }else{
    	ll M = N - 1 + T - K;
    	cout << M << endl;
    	REP(i, N-1){
    		cout << i+1 << " " << N << endl;
    	}
    	ll cnt = 0;
    	REP(i, N-1){
    		REP(j, N-1){
    			if(i<j && cnt < T-K){
    				cout << i+1 << " " << j+1 << endl;
    				cnt++;
    			}
    		}
    	}
    }
    
    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np

def ls_add(l0,l1):
	return [l0[i] + l1[i] for i in range(len(l0))]

n,m,x = [int(e) for e in input().split(" ")[:3]]

book_ls = []
for i in range(n):
	inp_ls = [int(e) for e in input().split(" ")[:m+1]]
	# c, a_ls = inp_ls[0], inp_ls[1:]
	book_ls.append(inp_ls)

book_np_ls = np.array(book_ls)
all_sum = np.sum(book_np_ls, axis = 0)
all_result = np.count_nonzero(all_sum[1:] < x)

# 高橋くんが目標を達成できない
if all_result > 0:
	print("-1")
	sys.exit()

sum_dic = {tuple([i]): book_ls[i] for i in range(n)}
for i in range(1,n):
	key_ls = [e for e in list(sum_dic) if len(e) == i]
	for e in key_ls:
		ls0 = sum_dic[e]
		max_e = e[-1]
		for ee in range(max_e+1,n):
			ls1 = sum_dic[tuple([ee])]
			temp_ls = ls_add(ls0, ls1)
			sum_dic[tuple(list(e) + [ee])] = temp_ls

min_val = all_sum[0]
for key in sum_dic:
	temp_ls = sum_dic[key]
	flag_ls = [int(e < x) for e in temp_ls[1:]]
	if sum(flag_ls) != 0: continue
	if temp_ls[0] < min_val: min_val = temp_ls[0]

print(min_val)

Measured memory_bytes: 29840
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int A,B,a,b;
  cin >> A >> B;
  if(A<B){
   a = B;
   b = A;
  }else{
    a = A;
    b = B;
  }
  long long int p = a%b;
  while(p!=0){
    a = b;
    b = p;
    p = a%b;
  }
  long long int ans = A/b*B;
  cout << ans << endl;
}    

Measured memory_bytes: 3632
# 最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)


A, B, C, D = list(map(int, input().split()))
a_c = A // C if A % C == 0 else A // C + 1
b_c = B // C

abc = b_c - a_c + 1

a_d = A // D if A % D == 0 else A // D + 1
b_d = B // D

abd = b_d - a_d + 1

a_cd = A // (lcm(C, D)) if A % (lcm(C, D)) == 0 else A // (lcm(C, D)) + 1
b_cd = B // (lcm(C, D))
abcd = b_cd - a_cd + 1
print((B - A + 1) - abc - abd + abcd)


Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<cstring>
struct Node{
	int key;
	Node *next,*prev;
};

Node *nil;

Node* listSearch(int key){
	Node *cur = nil->next;// 从头结点后面的元素开始访问
	while(cur != nil&&cur->key!=key){
		cur = cur->next;
	} 
	return cur;
}

void init(){
	nil = (Node *)malloc(sizeof(Node));
	nil->next = nil;
	nil->prev = nil;  //注意初始化之后n->prev指向它自己 
}

void printList(){
	Node *cur = nil->next;
	int isf = 0;
	while(1){
		if(cur == nil) break;
		if(isf++>0) printf(" ");
		printf("%d",cur->key);
		cur = cur->next;
	}
	printf("\n");
}

void deleteNode(Node *t){
	if(t==nil) return ;//t为头结点时不作处理
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t); 
}

void deleteFirst(){
	deleteNode(nil->next);
}

void deleteLast(){
	deleteNode(nil->prev);
}

void deleteKey(int key){
	//删除搜索到的结点
	deleteNode(listSearch(key)); 
}

void insert(int key){
	Node *x = (Node *)malloc(sizeof(Node));
	x->key = key;
	//在头结点后添加元素
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil; 
}

int main(){
	int key,n,i;
	int size = 0;  //记录链表长度 
	char com[20];
	int np = 0,nd = 0;  //分别记录插入 和删除的次数 
	scanf("%d",&n);
	init();
	//printf("%d\n",nil->prev->key);
	for(i = 0;i < n;i++)
	{
		scanf("%s%d",com,&key);
		if(com[0] == 'i'){
			insert(key);np++;size++;}
		else if( com[0] == 'd'){
			if(strlen(com)>6){
				if(com[6] =='F') deleteFirst();
				else if( com[6] == 'L')deleteLast();
			}else {
				deleteKey(key);nd++;
			}
			size--;	
		} 
	//	printf("%d\n",nil->prev->key);
		} 
	//	deleteFirst();
	//	deleteLast();
		printList();
		return 0;
	}                                                      


Measured memory_bytes: 33828
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << "\n"; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " <<to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void solve(){
  char c;
  cin>>c;
  c++;
  cout<<c<<"\n";
}
 
int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

int main(){
    int n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;

    if(c<d){
        for(int i = a-1; i < c-1; i++){
            if(s[i]=='#' && s[i+1]=='#'){
                cout << "No" << endl;
                return 0;
            }
        }
        for(int i = b-1; i < d-1; i++){
            if(s[i]=='#' && s[i+1]=='#'){
                cout << "No" << endl;
                return 0;
            }
        }
    }else{
        for(int i = a-1; i < c-1; i++){
            if(s[i]=='#' && s[i+1]=='#'){
                cout << "No" << endl;
                return 0;
            }
        }
        for(int i = b-1; i < d-1; i++){
            if(s[i]=='#' && s[i+1]=='#'){
                cout << "No" << endl;
                return 0;
            }
        }
        bool isOK = false;
        for(int i = b-2; i <= d-2; i++){
            if(i<0 || i+2>=n){continue;}
            if(s[i]=='.' && s[i+1]=='.' && s[i+2]=='.'){
                isOK = true;
            }
        }
        if(!isOK){
            cout << "No" << endl;
            return 0;

        }
    }


        cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 640
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	L = [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]
	K = int(input())
	print(L[K - 1])
	


if __name__ == '__main__':
	main()

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define forn(i,n) for(int i=0;i<n;i++)
#define fre(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%lld", &n)
#define sff(a,b) scanf("%lld %lld", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pfn(n) printf("%d\n", n)
#define pfs(n) printf("%d ", n)
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define f find
#define ub upper_bound
#define lb lower_bound
#define ld long double
#define in insert
#define bs binary_search  
#define le length()
ll max_i=1e16+7;
#define np(s) next_permutation(s.begin(),s.end())
//it gives the lexicographically next string//

int main()
{
    int t=1;
    //cin>>t;
    while(t--)
    {
       string s,t;
       cin>>s>>t;
       if(t.substr(0,s.length())==s && t.length()==s.length()+1) cout<<"Yes";
       else cout<<"No";
    }
	return 0;
}

Measured memory_bytes: 3596
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }
        public void Solve(ConsoleInput cin)
        {
            var s = cin.Read;
            if ((s[1] == s[2] && s[0] == s[3] && s[1] != s[0]) || (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) || (s[0] == s[1] && s[2] == s[3] && s[0] != s[2])) 
            {
                WriteLine("Yes");
            }
            else
            {
                WriteLine("No");
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n,a,b;
  cin >> n >> a >> b;
  vector<int> h(n);
  REP(i,n) cin >> h[i];

  sort(ALL(h));

  int ng = 0, ok = h[n-1]/b+1;
  while(abs(ok-ng) > 1) {
    ll mid = (ok+ng)/2;
    ll key = mid * b;
    auto it = upper_bound(ALL(h), key);
    ll sum = mid;

    for (int j = it-h.begin(); j < n; j++) {
      ll nh = h[j]-key;
      sum -= nh/(a-b) + (nh%(a-b) > 0);
    }

    if (0 <= sum) ok = mid;
    else ng = mid;
  }

  COUT(ok);
  return 0;
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;

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

int n,m;
string s[110],k[110];
int ans = 0;
map <string,int> mp;


int main(){
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> s[i];
  }
  cin >> m;
  for(int i=0; i<m; i++){
    cin >> k[i];
    mp[k[i]]--;
  }
  for(int i=0; i<n; i++){
    mp[s[i]]++;
    ans = max(ans,mp[s[i]]);
  }
  
  cout << ans << endl;
  return 0;
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, c;
    cin>>n>>c;
    vvl ds(c, vl(c));
    cin>>ds;
    vvl cs(n, vl(n));
    cin>>cs;

    vector<map<ll, ll>> mod(3);
    rep(i, n) rep(j, n) {
        mod[(i + j) % 3][cs[i][j] - 1]++;
    }

    vvl dif(3);
    rep(i, 3) {
        rep(j, c) {
            ll d = 0;
            for (auto v : mod[i]) {
                d += ds[v.fi][j] * v.se;
            }
            dif[i].push_back(d);
        }
    }

    ll ans = LINF;
    rep(i, c) rep(j, c) rep(k, c) {
        if (i == j || j == k || k == i) continue;

        chmin(ans, dif[0][i] + dif[1][j] + dif[2][k]);
    }
    cout<<ans<<endl;
}

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

int ABS(int a){
	return a >= 0 ? a : -a;
}

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

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int N, Z, W, i, j;
	scanf("%d%d%d", &N, &Z, &W);
	int *a = (int *)malloc(sizeof(int) * (N + 1));
	a[0] = W;
	for(i = 1; i <= N; i++){
		scanf("%d", &a[i]);
	}
	int *dp_max = (int *)malloc(sizeof(int) * (N + 1));
	int *dp_min = (int *)malloc(sizeof(int) * (N + 1));
	for(i = N - 1; i >= 0; i--){
		dp_max[i] = ABS(a[i] - a[N]);
		for(j = i + 1; j < N; j++){
			dp_max[i] = max(dp_max[i], dp_min[j]);
		}
		dp_min[i] = ABS(a[i] - a[N]);
		for(j = i + 1; j < N; j++){
			dp_min[i] = min(dp_min[i], dp_max[j]);
		}
	}
	printf("%d\n", dp_max[0]);
	return 0;
}

Measured memory_bytes: 128
void main()
{
    long n = rdElem;
    long[] a = rdRow;

    long ave1 = a.sum / n;
    long ave2 = (a.sum + n - 1) / n;

    long total1, total2;
    foreach (x; a)
    {
        total1 += (x - ave1) ^^ 2;
        total2 += (x - ave2) ^^ 2;
    }

    min(total1, total2).writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(size_t i = (j); i < (n); ++i)
constexpr ll MOD = 1000000007;

int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	vector<ll> dp(13);
	dp[0] = 1;
	rep(i, 0, s.size()) {
		vector<ll> next(13);
		rep(j, 0, 13) {
			if (s[i] == '?') {
				rep(k, 0, 10) {
					(next[(j * 10 + k) % 13] += dp[j]) %= MOD;
				}
			}
			else
				(next[(j * 10 + (s[i] - '0')) % 13] += dp[j]) %= MOD;
		}
		dp = next;
	}
	cout << dp[5] << endl;
	return 0;
}

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

int main() {
  string a;
  cin>>a;
  ll b,c;
  b=0;
  c=0;
  for(ll i=0;i<a.size();i++){
    if(a.at(i)=='0'){
      b+=1;
    }
    else{
      c+=1;
    }
  }
  cout<<min(b,c)*2<<endl;
  return 0;
}
                             
    


Measured memory_bytes: 3716
import sys
if __name__ == "__main__":
    n = int(input())
    if n % 2 == 1:
        print(0)
        sys.exit(0)

    base = 5

    ans = 0

    while True:
        tmp = n // base
        if tmp == 0:
            break

        ans += tmp // 2
        base *= 5
    print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){    
    long long int N,M,ans;
    cin>>N>>M;
    
    if(N>M){
        swap(N,M);
    }
    
    if(N==1){
        ans=M-2;
      	if(M==1){
            ans=1;
        }
    }
    
    else{
        ans=(N-2)*(M-2);
    }
    
    cout<<ans<<endl;
    
    return 0;}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#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 mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vll a(n);
    rep(i,n) cin>>a[i];
    sort(rall(a));
    ll ans=1,cnt=0;
    rep(i,n-1){
        if (a[i]==a[i+1]){
            ans*=a[i];
            cnt++;
            if (cnt==2) break;
            i++;
        }
    }
    if (cnt==2){
        cout<<ans<<endl;
    }else{
        cout<<"0\n";
    }
    return 0;
}


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

int main(){
  string S;
  char tb, tn;
  int c = 0;
  cin >> S;
  tb = S.at(0);
  
  for (int i = 1; i < S.size(); i++){
    tn = S.at(i);
    if (tn != tb){
      c += 1;
    }
    tb = tn;
  }
  cout << c << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

using fint64 = int_fast64_t;
template<fint64 MOD>
struct ModInt{
    fint64 x;
    ModInt():x(0){}
    ModInt(fint64 x):
        x(x>=0?x%MOD:(MOD-(-x)%MOD)%MOD)
        {}
    // 負号
    ModInt operator -() const{
        return ModInt(-x);
    }
    // 加算
    ModInt &operator +=(const ModInt &rhs){
        x+=rhs.x;
        if(x>=MOD) x-=MOD;
        return (*this);
    }
    ModInt operator +(const ModInt &rhs) const{
        return ModInt(*this)+=rhs;
    }
    // 減算
    ModInt &operator -=(const ModInt &rhs){
        x+=MOD-rhs.x;
        if(x>=MOD) x-=MOD;
        return (*this);
    }
    ModInt operator -(const ModInt &rhs) const{
        return ModInt(*this)-=rhs;
    }
    // 乗算
    ModInt &operator *=(const ModInt &rhs){
        x*=rhs.x;
        if(x>=MOD) x%=MOD;
        return (*this);
    }
    ModInt operator *(const ModInt &rhs) const{
        return ModInt(*this)*=rhs;
    }
    // 除算
    ModInt &operator /=(const ModInt &rhs){
        (*this)*=rhs.inverse();
        return (*this);
    }
    ModInt operator /(const ModInt &rhs) const{
        return ModInt(*this)/=rhs;
    }
    // 等号
    bool operator ==(const ModInt &rhs){
        return x==rhs.x;
    }
    bool operator !=(const ModInt &rhs){
        return x!=rhs.x;
    }
    // 累乗
    ModInt pow(fint64 n) const{
        fint64 tmp=x;
        fint64 ret=1;
        while(n>0){
            if(n&1) ret=ret*tmp%MOD;
            tmp=tmp*tmp%MOD;
            n>>=1ll;
        }
        return ModInt(ret);
    }
    // 逆元
    ModInt inverse() const{
        fint64 a=x,b=MOD,s=1,t=0;
        while(b>0){
            fint64 u=a/b;
            a-=u*b;
            s-=u*t;
            swap(a,b);
            swap(s,t);
        }
        return ModInt(s);
    }
    // 入出力
    friend istream &operator >>(istream &lhs,ModInt<MOD> &rhs){
        fint64 x; lhs>>x;
        rhs=ModInt<MOD>(x);
        return lhs;
    }
    friend ostream &operator <<(ostream &lhs,const ModInt<MOD> &rhs){
        return lhs<<rhs.x;
    }
};

using mint=ModInt<MOD>;
mint dp[100010][15];
int main() {
	string s; cin>>s;
	reverse(all(s));
	int n=s.size();
	dp[0][0]=1;
	int mul=1;
	for(int i=1;i<=n;++i){
		if(s[i-1]=='?'){
			for(int k=0;k<13;k++){
				for(int j=0;j<10;j++){
					dp[i][(k+j*mul)%13]+=dp[i-1][k];
				}
			}
		}else{
			int num=s[i-1]-'0';
			for(int j=0;j<13;j++){
				dp[i][(j+num*mul)%13]+=dp[i-1][j];
			}
		}
		mul*=10;
		mul%=13;
	}
	// for(int i=1;i<=n;i++){
	// 	for(int j=0;j<13;j++){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	cout<<dp[n][5]<<endl;
	return 0;
}

Measured memory_bytes: 12160