akhauriyash/Code-Regression huggingface dataset:
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

void main(){
    auto s = readln();
    writeln(s.length >= 4 && s[0..4] == "YAKI" ? "Yes" : "No");

}



Measured memory_bytes: 256
def prime?(input)
  square_root = input.**(0.5).floor.to_i
  2.upto(square_root) do |divisor|
    return false if input % divisor == 0
  end
  return true
end

num = gets.chomp.to_i
prime_num = 0

num.times do
  input = gets.chomp.to_i
  prime_num += 1 if prime?(input)
end

puts prime_num

Measured memory_bytes: 9116
X, N = map(int, input().split())
P = list(map(int, input().split()))

li = []
for i in range(0, 102):
    if i not in P:
        li.append(i)

ans = -1
minimum_num = 200

for n in li:
    num = abs(n - X)
    if num < minimum_num:
        minimum_num = num
        ans = n

print(ans)


Measured memory_bytes: 9208
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            long h, n;
            ReadLong(out h, out n);
            var A = ReadIntArray();
            bool ans = A.Sum() >= h;
            Console.WriteLine(YesNo(ans));
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static string YesNo(bool condition) => condition ? "Yes" : "No";
        static string YESNO(bool condition) => condition ? "YES" : "NO";

        #endregion
    }
}

Measured memory_bytes: 19680
require 'prime'

n = gets.to_i

p = Hash.new(0)
2.upto(n) do |i|
  Prime.prime_division(i).each do |x|
    p[x[0]] += x[1] 
  end
end
ans = 1
p.each do |_, v|
  ans *= v + 1
  ans %= 1000_000_007
end
puts ans


Measured memory_bytes: 2300
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    A, B, C = map(int, input().split())
    if A >= B and A >= C:
        print(10 * A + B + C)
    elif B >= A and B >= C:
        print(10 * B + A + C)
    elif C >= B and C >= A:
        print(10 * C + A + B)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;++i)
		cin>>a[i];
	int b[n];
	b[0]=0;
	b[1]=abs(a[0]-a[1]);
	for(int i=2;i<n;++i)
	{
		b[i]=min((b[i-1]+abs(a[i]-a[i-1])),(b[i-2]+abs(a[i]-a[i-2])));
	}
	cout<<b[n-1]<<"\n";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 100010
/* ちゃんと考えて実装して問題なくACできた時嬉しいよ！！ */

class UnionFind{
    private:
        int par_[MAX_N];
        int rank_[MAX_N];
        int groups_;
    
    public:
        void init(int n){ // initializes the tree 
            for(int i=0; i<n; i++){
                par_[i] = i;
                rank_[i] = 0;
            }
            groups_ = n;
        } 
        int rootOf(int x){ // returns a root of x 
            if(par_[x] == x){
                return x;
            }
            else{
                return par_[x] = rootOf(par_[x]);
            }
        } 
        void unite(int x, int y){ // unites x and y 
            x = rootOf(x);
            y = rootOf(y);
            if(x == y) return;
            if(rank_[x] < rank_[y]){
                par_[x] = y;
                groups_--;
            }
            else{
                par_[y] = x;
                groups_--;
                if(rank_[x] == rank_[y]) rank_[x]++;
            }
        }
        bool isSameGroupe(int x, int y){ // whether x and y are united
            return par_[x] == par_[y];
        }
        int countGroups(){ // returns the number of groups
            return groups_;
        }
};

int main(void){
    int n,m;
    cin >> n >> m;

    UnionFind tree;
    tree.init(n);

    
    for(int i=0; i<m; i++){
        int x,y,z;
        cin >> x >> y >> z;
        tree.unite(x-1, y-1);
    }

    cout << tree.countGroups();

    return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define step(i,s,n,c) for(int i=(s);i<(n);i+=(c))
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define each(i,vec) for(auto i:vec)
#define cinv(n,vec) VL vec(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define eb emplace_back
#define m_p make_pair
#define m_t make_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (signed)(a.size())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define callp(a) for(auto [k,v]:a)cout<<k<<":"<<v<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define ENDL cout<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define PQ priority_queue
#define cont const auto
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const signed INF = (1LL<<30);
const long long MOD = (1e9+7);
const long long LINF = (1LL<<60);
const long long LMAX = LLONG_MAX;
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  
  int n,m,k;
  cin>>n>>m>>k;
  rep(i,n+1){
    rep(j,m+1){
      //int res=n*i+m*j-i*j*2;
      //cout<<i<<" "<<j<<" "<<res<<endl;
      int res=i*(m-j)+j*(n-i);
      if(res==k){
        Yes;
        return 0;
      }
    }
  }
  No;
  
  return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
const int N=2e5+5;
ll read(){
	ll x=0,w=1;
	char ch=0;
	while (ch<'0' || ch>'9'){
		  if (ch=='-') w=-1;
		  ch=getchar();
	}
	while (ch<='9' && ch>='0'){
		  x=(x<<1)+(x<<3)+ch-'0';
		  ch=getchar();
	}
	return x*w;
}
ll n;
ll s[N],a[N],s1,s2,ans=1e18;
ll find(ll l,ll r,ll x){
	while (l<r){
		ll mid=(l+r+1)>>1;
		if (s[mid]<=x) l=mid;
		else r=mid-1;
	}
	return l;
}
ll Abs(ll x){
	return max(x,-x);
}	
int main() {
	n=read();
	for (int i=1;i<=n;i++)
		s[i]=s[i-1]+read();
	for (ll i=2;i<n-1;i++){
		s1=find(0,i,s[i]>>1);
		s2=find(i+1,n,s[i]+((s[n]-s[i])>>1));
		ll x,y;
		if (Abs(s[i]-(s[s1]<<1))<Abs(s[i]-(s[s1+1]<<1))) x=s1; 
		else x=s1+1;	
		if (Abs(s[n]-(s[s2]<<1)+s[i])<Abs(s[n]-(s[s2+1]<<1)+s[i])) y=s2; 
		else y=s2+1;
		ans=min(max(max(s[x],s[i]-s[x]),max(s[y]-s[i],s[n]-s[y]))-min(min(s[x],s[i]-s[x]),min(s[y]-s[i],s[n]-s[y])),ans);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int D,i,j,sum,ans = 0;scanf("%d",&D);
  int c[26],s[D][26],t,l[26] = {},output[D];
  fill(l,l+26,-1);
  for(i=0;i<26;i++) scanf("%d",&c[i]);
  for(i=0;i<D;i++){
    for(j=0;j<26;j++) scanf("%d",&s[i][j]);
  }
  for(i=0;i<D;i++){
    scanf("%d",&t);t--;
    for(j=0;j<26;j++){
      if(j==t) ans += s[i][j];
      else ans -= (i-l[j])*c[j];
    }
    l[t] = i;
    output[i] = t;//0-indexed
  }
  int M,d,q,old,difo,difn,Plus,Minus;scanf("%d",&M);
  for(i=0;i<M;i++){
    scanf("%d%d",&d,&q);d--;q--;
    if(output[d] == q){
      printf("%d\n",ans);continue;
    }
    old = output[d];
    difo = difn = 1;Plus = Minus = 0;
    for(j=d-1;j>=0 && output[j]!=q;j--) difn++;
    for(j=d-1;j>=0 && output[j]!=old;j--) difo++;
    ans += s[d][q];ans -= s[d][old];
    for(j=d;j<D && output[j]!=q;j++) Plus += difn;
    for(j=d;j<D && (j==d || output[j]!=old);j++) Minus += difo;
    ans += c[q]*Plus;ans -= c[old]*Minus;
    printf("%d\n",ans); 
    output[d] = q;
  }
}

Measured memory_bytes: 3856
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int N;
    string S;
    
    cin >> N >> S;


    vector<int> cnt(3);
    for (auto & x : S) {
        if (x == 'R')
            x = 0;
        else if (x == 'G')
            x = 1;
        else if (x == 'B')
            x = 2;
        cnt[x]++;
    }

    int64 res = 0;

    vector<int> pref(3);

    for (int i = 0; i < N; i++) {
        vector<int> bef, aft;

        for (int c = 0; c < 3; c++) {
            if (c != S[i]) {
                bef.push_back(pref[c]);
                aft.push_back(cnt[c] - pref[c]);
            }
        }

        int pos = bef[0] * aft[1] + bef[1] * aft[0];

        for (int l = 1; i - l >= 0 && i + l < N; l++) {
            if (S[i - l] != S[i] && S[i] != S[i + l] && S[i - l] != S[i + l]) {
                pos--;
            }
        }

        res += pos;

        //cerr << i << " " << pos << "\n";

        pref[S[i]]++;
    }

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 3660
function main(arg) {
	arg = arg.trim();
	var day = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];
  	var out = day.indexOf(arg);
  	out = 7- out;
  console.log(out)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 9420
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>

int main(int argc, void **argv)
{
	int x[5];
	int i, mi;
	int min=10;
	int sum=0;

	for (i = 0; i < 5; i++)
	{
		scanf("%d", &x[i]);
	}

	for (i = 0; i < 5; i++)
	{
		int m = x[i] % 10;
		if( m != 0 && m < min )
		{
			min = m;
			mi = i;
		}
	}
	
	for (i = 0; i < 5; i++)
	{
		if( mi == i )
		{
			sum += x[i];
		}
		else
		{
			sum += ((x[i] + 9) / 10) * 10;
		}
	}

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

	return 0;
}

Measured memory_bytes: 128
import sys
sum_ = 0;
i = 2;
a, b = map(int, input().split())
if a % b == 0:
  print(-1)
  sys.exit()
while i < 1000000000000000000:
    if a * i % b != 0:
        print(a * i)
        sys.exit()
    i += 1


Measured memory_bytes: 2940
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Policy;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var k = int.Parse(spl[1]);
        var ary = ToIntArray(input.ReadLine(), n);

        Array.Sort(ary);

        long sum = 0;
        for(int i=0; i<k; i++) {
            sum += ary[i];
        }

        return sum;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        if(n == 0) return ret;
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 27812
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <fstream>

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
#include <functional>
#include <stack>
#include <numeric>
#include <cassert>

using namespace std;

class atC {
public:
    void solve(istream& in, ostream& out) {
        int N, T;
        in >> N >> T;
        vector<int> t(N);
        for (int i = 0; i < N; ++i) {
            in >> t[i];
        }
        
        int run_till = -1, res = 0;
        for (int i = 0; i < N; ++i) {
            if (t[i] > run_till) {
                res += T;
                run_till = t[i] + T;
            } else {
                res += T - (run_till - t[i]);
                run_till = t[i] + T;
            }
        }
        out << res << "\n";
    }
};


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

	atC solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1024
nx = list(map(int,input().split()))
l = list(map(int,input().split()))

count = 0
Di = 0
for i in range(nx[0]+1):

    if i != 0:
        Di += l[i-1]
    
    if Di > nx[1]:
        break
    
    count += 1
        
print(count)

Measured memory_bytes: 3060
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")

#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;

#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

inline void setin(string s) {
	freopen(s.c_str(), "r", stdin);
}

inline void setout(string s) {
	freopen(s.c_str(), "w", stdout);
}

template <typename T> inline T range(T l, T r) {
	return uniform_int_distribution <T>(l, r)(rng);
}

template <typename T> void Min(T &a, T b) {
    a = min(a, b);
}
 
template <typename T> void Max(T &a, T b) {
    a = max(a, b);
}

const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 1e5 + 15;
const int L = 21;
int n, a[N], b[N], l, q;
int p[N], up[L][N], d[N];

deque <int> cur;

vector <int> g[N];

inline void precalc() {
	for(int i = 1; i <= n; ++i) {
		while(!cur.empty() && a[cur.front()] + l < a[i])
			cur.pop_front();
		if(!cur.empty())
			p[i] = cur.front();
		if(p[i])
			g[p[i]].pb(i);
		cur.pb(i);
	}
}

void dfs(int v, int p) {
	up[0][v] = p;
	for(int i = 1; i < L; ++i)
		up[i][v] = up[i-1][up[i-1][v]];
	for(int to : g[v])
		if(to != p) {
			d[to] = d[v] + 1;
			dfs(to, v);
		}
}

inline int get(int v, int x) {
	for(int i = L - 1; i >= 0; --i)
		if(up[i][v] > x)
			v = up[i][v];
	return v;
}

main() {
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	// setin("input.txt");
	cin >> n;
	for(int i = 1; i <= n; ++i)
		cin >> a[i];
	cin >> l;
	precalc();
	dfs(1, 1);
	// for(int i = 1; i <= n; ++i)
	// 	cout << d[i] << ' ';
	// cout << endl;

	cin >> q;
	while(q--){ 
		int a, b;
		cin >> a >> b;
		if(a > b)
			swap(a, b);
		int v = get(b, a);
		cout << d[b] - d[v] + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 20352
import java.util.Scanner;

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

		for (int i = 0; i < n; i++) {
			ans += sc.nextInt() - 1;
		}

		System.out.println(ans);

		sc.close();
	}
}

Measured memory_bytes: 25576
#!/usr/bin/env python3
import sys

def solve(W: int, H: int, N: int, x: "List[int]", y: "List[int]", a: "List[int]"):
    cnt = 0
    for y_ in range(H):
        for x_ in range(W):
            for i in range(N):
                if a[i] == 1 and x_ < x[i] or a[i] == 2 and x_ >= x[i] or a[i] == 3 and y_ < y[i] or a[i] == 4 and y_ >= y[i]:
                    break
            else:
                cnt += 1
    return cnt

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    H = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    a = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        a[i] = int(next(tokens))
    print(solve(W, H, N, x, y, a))

if __name__ == '__main__':
    main()


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

using namespace std;
using ll = long long;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

#include <iostream>

int main()
{
    string S;
    cin >> S;

    if (S == "ABC") { cout << "ARC" << endl; }
    else { cout << "ABC" << endl; }
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <climits>
#include <math.h>
#include <cstring>
using namespace std;
//using ll = long long;
//using P =pair<int, int>;

int main(){
  string title;

  string title1 = "ABC";
  string title2 = "ARC";

  cin >> title;

//  cout << title << endl;
  if(title==title1) {cout << title2<<endl;}
  else{cout << title1 << endl;}
}


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

// vector<int> makeshell(int);
vector<int> shell(vector<int>, vector<int>, int &);
vector<int> insertion(vector<int>, int, int &);

int main(int argc, char const *argv[])
{
    int cnt = 0;

    int n = 0;
    cin >> n;

    vector<int> g;
    int gap = 1;
    for (int i = 0; i < n; i++)
    {
        if (gap >= n)
        {
            break;
        }
        g.push_back(gap);
        gap = 3 * gap + 1;
    }
    reverse(g.begin(), g.end());

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

    if (n == 1)
    {
        cout << 1 << endl;
        cout << 0 << endl;
        cout << 0 << endl;
        cout << a[0] << endl;
        return 0;
    }

    cout << g.size() << endl;
    for (int i = 0; i < (int) g.size() - 1; i++)
    {
        cout << g[i] << " ";
    }
    cout << g[g.size() - 1] << endl;

    a = shell(a, g, cnt);
    cout << cnt << endl;

    for (int i = 0; i < (int) a.size(); i++)
    {
        cout << a[i] << endl;
    }

    // if (cnt <= ceil(pow(n, 1.5)))
    // {
    //     cout << "OK" << endl;
    // }
    // else
    // {
    //     cout << "NG" << endl;
    // }

    return 0;
}

// vector<int> makeshell(int n) {
//     vector<int> g;
//     int j = 1;
//     while(j < n) {
//         g.push_back(j);
//         j = 3 * j + 1;
//     }
//     return g;
// }

vector<int> shell(vector<int> a, vector<int> g, int &cnt)
{
    cnt = 0;
    for (int i = 0; i < (int) g.size(); i++)
    {
        a = insertion(a, g[i], cnt);
    }

    return a;
}

vector<int> insertion(vector<int> a, int g, int &cnt)
{
    for (int i = g; i < (int) a.size(); i++)
    {
        // i 番目 から (i % g) 番目までのg 個飛ばし多重スワップ
        int v = a[i];
        int j = i - g;
        while (j >= 0 && a[j] > v)
        {
            a[j + g] = a[j];
            j = j - g;
            cnt++;
        }
        a[j + g] = v;
    }

    return a;
}


Measured memory_bytes: 14460
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
#mod = 10**9 + 7
#mod = 9982443453
mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
x = I()
t = 0
while (t*(t+1))/2 < x:
    t += 1
print(t)


Measured memory_bytes: 10432
// luogu-judger-enable-o2
#include<bits/stdc++.h>
#pragma GCC optimize(3)
namespace ZDY{
    #define res register
    #define ri res int
    #define ll long long
    #define db double
    #define sht short
    #define il inline
    #define MB template <class T>
    #define Fur(i,x,y) for(ri i=x;i<=y;i++)
    #define fur(i,x,y) for(i=x;i<=y;i++)
    #define Fdr(i,x,y) for(ri i=x;i>=y;i--)
    #define clr(x,y) memset(x,y,sizeof(x))
    #define cpy(x,y) memcpy(x,y,sizeof(x))
    #define fl(i,x) for(ri i=head[x],to;to=e[i].to,i;i=e[i].nxt)
    #define inf 2122219134
    #define fin(s) freopen(s".in","r",stdin)
    #define fout(s) freopen(s".out","w",stdin)
    #define l2(n) (ceil(log2(n)))
    MB il T ABS(T x){return x>0?x:-x;}
    MB il T MAX(T x,T y){return x>y?x:y;}
    MB il T MIN(T x,T y){return x<y?x:y;}
    MB il T GCD(T x,T y){return y?GCD(y,x%y):x;}
}using namespace ZDY;using namespace std;
#define N 200010
char c[N];
bool t[N],a[N];
int n;
ll ans=0;
il void mgs(bool *a,int l,int r){
    if(l==r)return;
    int m=(l+r)>>1,i=l,j=m+1,d=l;
    mgs(a,l,m);mgs(a,m+1,r);
    while(i<=m&&j<=r)
        if(a[i]<=a[j])t[d++]=a[i++];
        else t[d++]=a[j++],ans+=m-i+1;
    while(i<=m)t[d++]=a[i++];
    while(j<=r)t[d++]=a[j++];
    Fur(i,l,r)a[i]=t[i];
}
int main(){
    scanf("%s",c+1);
    n=strlen(c+1);
    Fur(i,1,n)a[i]=(c[i]=='B');
    mgs(a,1,n);
    printf("%lld\n",ans);
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,m,c,a,i,j,k,ans=0;
  cin>>n>>m>>c;
  vector<int> b(m);
  for(j=0;j<m;j++) cin>>b.at(j);
  for(i=0;i<n;i++){
    k=c;
    for(j=0;j<m;j++){
      cin>>a;
      k+=a*b.at(j);
    }
    if(k>0) ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3568
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  string s;
  cin >> s;
  int ret = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == '1')
      ret++;
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>

int main(){
  int N;
  scanf("%d", &N);
  int Acount=0;
  int Bcount=0;
  int ABcount=0;
  int originalcount = 0;
  for (int i=0; i<N; i++){
    std::string S;
    std::cin >> S;
    char next='A';
    int index=0;
    while(index<S.length()){
      if (S[index]==next){
        if (next=='B'){
          originalcount++;
          next='A';
        } else if (next=='A'){
          next='B';
        }
      } else if (S[index]=='A'){
        next='B';
      } else {
        next='A';
      }
      index++;
    }

    if (S[0]=='B' && S[S.length()-1]=='A'){
      ABcount++;
    }
    if (S[0]=='B'){
      Bcount++;
    }
    if (S[S.length()-1]=='A'){
      Acount++;
    }
  }
  //printf("original=%d\n", originalcount);
  if (ABcount==Acount && ABcount==Bcount){
    printf("%d\n", originalcount+std::max(0, ABcount-1));
  } else {
    printf("%d\n", originalcount+std::min(Acount, Bcount));
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int m1, d1, m2, d2;
  cin >> m1 >> d1;
  cin >> m2 >> d2;
  if(m1 == m2)
    cout << "0" << endl;
  else
    cout << "1" << endl;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    priority_queue <long long> a;
    // vector <long long> a(n);
    for (int tsumugi = 0; tsumugi < n; tsumugi++){
        int tmp;
        cin >> tmp;
        a.push(tmp);
    }

    //最大の金額のものに割引券を使用するのが最適
    //上記の処理をm回繰り返せばよい

    for (int miki = 0; miki < m; miki++){
        int tmp = a.top();
        tmp /= 2;
        a.pop();
        a.push(tmp);
    }

    // int dist = 0;
    // sort(a.begin(), a.end(), greater<long long>());
    // // cout << a[0] << endl;;
    // vector <long long>::iterator iter = a.begin();
    // *iter /= 2;
    // // cout << *iter << endl;
    // for (int haruka = 1; haruka < m; haruka++){
    //     iter = max_element(a.begin(), (a.begin() + dist + 2));
    //     // cout << *iter << endl;
    //     *iter /= 2;
    //     int tmp = distance(a.begin(), iter);
    //     dist = max(tmp, dist);
    //     if (dist == n - 1){
    //         dist = n - 2;
    //     }
    // }

    // for (int kaori = 0; kaori < n; kaori++){
    //     cout << "All a:" << endl;
    //     cout << a[kaori] << endl;
    //     cout << "Over" << endl;
    // }

    long long ans = 0;
    while (!a.empty()){
        ans += a.top();
        a.pop();
    }

    // long long ans = accumulate(a.begin(), a.end(), 0LL);
    
    // long long ans = 0;
    // for (int konomi = 0; konomi < n; konomi++){
    //     ans += a[konomi];
    // }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
int main()
  {
int n,ar[200000];
    cin>>n;
     long x=0;
    for(int i=0;i<n;i++){cin>>ar[i];x^=ar[i];}
    for(int i=0;i<n;i++){
     ar[i]^=x;}
    for(int i=0;i<n;i++)cout<<ar[i]<<" ";
    return 0;}
   

Measured memory_bytes: 4380
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <stack>
using namespace std;
const int maxn=2e5+5;
typedef long long ll;
const ll mod=998244353;
int r[maxn],g[maxn],d[maxn],nr,ng,nb;
int n;
string s;
vector<int> a,b,c;
int main(){
	cin>>n;
	cin>>s;
	for (int i=1;i<=n*3;i++){
		if (s[i-1]=='R') r[++nr]=i;
		if (s[i-1]=='G') g[++ng]=i;
		if (s[i-1]=='B') d[++nb]=i;
	}
	ll ans=1;
	a.push_back(0);
	b.push_back(0);
	c.push_back(0);
	for (int i=1;i<=n;i++){
		int mi=min(r[i],min(g[i],d[i])),mx=max(r[i],max(g[i],d[i]));
		a.push_back(mi);
		b.push_back(r[i]+g[i]+d[i]-mi-mx);
		c.push_back(mx);
	}
	int p=1;
	for (int i=1;i<=n;i++){
		while(p+1<=n&&a[p+1]<b[i]) p++;
		ans=ans*(p-i+1)%mod;
	}
	p=1;
	for (int i=1;i<=n;i++){
		while(p+1<=n&&b[p+1]<c[i]) p++;
		ans=ans*(p-i+1)%mod;
	}
	for (int i=1;i<=n;i++){
		ans=ans*i%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3452
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int main(void) {

	int n, h, w, a[1000], b[1000],num=0;

	cin >> n >> h >> w;

	for (int k = 0; k < n; k++) {

		cin >> a[k] >> b[k];

		num += min(a[k] / h, b[k] / w);

	}

	cout << num << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64

// dpっぽい
// 20 4
// 3 7 8 4

// 20本のマッチを作るために
// 20-a[i]本のマッチで作れればおk
// 

// dp[i] := i本マッチの使った時の最大値
// 大きいほうから使ったほうが良い

string dp[10101];
int cost[10] = {10101010101,2,5,5,4,5,6,3,7,6};

signed main() {
  int n,m;cin>>n>>m;
  vector<int> a(m);
  for(int i=0;i<m;++i) {
    cin>>a[i];
  }

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

  auto check = [&](string p, string q){
                 if(p.size()==q.size()){
                   return p>q;
                 }
                 return p.size() > q.size();
               };
  
  fill_n(dp,10101,"0");
  dp[0] = "";
  for(int i=0;i<=n;++i){
    for(int j=0;j<m;++j){
      if(i-cost[a[j]]>=0){
        if(dp[i-cost[a[j]]]=="0") continue;
        string tmp = to_string(a[j]) + dp[i-cost[a[j]]];
        if(check(tmp, dp[i])) {
          dp[i] = tmp;
        }
      }
    }
  }

  string ans = dp[n];
  sort(ans.begin(),ans.end());
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 32896
#include <iostream>
#include <algorithm>

int main()
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  
  int64_t a,b,c,d;
  std::cin>>a>>b>>c>>d;
  
  int64_t result=std::max({a*c,a*d,b*c,b*d});
  
  std::cout<<result<<std::endl;
  
  return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define ld double
#define P pair<ll,ll>
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x*f;
}
int n,a[200005];
ll s[200005],ans=1e18;
int print(int x){
	printf("%d\n",x);
	return x;
}
P search(int L,int R){
	int mid,l=L,r=R;
	while(l<r){
		mid=l+r>>1;
		if(s[R]-s[mid]*2+s[L-1]>0)l=mid+1;
		else r=mid-1;
	}
	ll res=1e18,a,b;
	for(int i=l-1;i<=l+1;++i){
		if(i==0||i==n)continue;
		if(abs(s[R]-s[i]*2+s[L-1])<res)res=abs(s[R]-s[i]*2+s[L-1]),a=s[R]-s[i],b=s[i]-s[L-1];
	}
	return make_pair(a,b);
}
int main(){
	n=read();
	for(int i=1;i<=n;++i)a[i]=read();
	for(int i=1;i<=n;++i)s[i]=s[i-1]+a[i];
	for(int i=2;i<n;++i){
		P l=search(1,i),r=search(i+1,n);
		ll Min=min(min(l.first,l.second),min(r.first,r.second)),
		   Max=max(max(l.first,l.second),max(r.first,r.second));
		ans=min(Max-Min,ans);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 2688
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

const LL inf = 112345678901234567;

LL get_max(std::vector<LL>v)
{
	LL res = 0;
	rep(i, v.size()) res = std::max(res, v[i]);
	return res;
}

LL get_min(std::vector<LL>v)
{
	LL res = inf;
	rep(i, v.size()) res = std::min(res, v[i]);
	return res;
}

int main()
{
	LL N;
	in >> N;
	std::vector<LL>a(N);
	rep(i, N) in >> a[i];

	LL ans = 0;
	while (true)
	{
		std::sort(a.begin(), a.end());
		if (a[N - 1] <= N - 1) break;
		if (a[N - 1] - a[0] <= N * N)
		{
			LL add = std::max<LL>(a[N - 1] - N * N, 0);
			ans += add * N;
			rep(i, N) a[i] -= add;
			do
			{
				rep(j, N - 1) ++a[j];
				a[N - 1] -= N;
				++ans;
				std::sort(a.begin(), a.end());
			} while (a[N - 1] > N - 1);
			break;
		}

		LL left = 0, right = inf;
		while (right - left > 1)
		{
			LL mid = (right + left) / 2;
			auto a_ = a;
			rep(i, N - 1) a[i] += mid;
			a[N - 1] -= N * mid;
			if (a[N - 1] < a[0] || get_max(a) <= N - 1) right = mid;
			else left = mid;
			a = a_;
		}
		rep(i, N - 1) a[i] += right;
		a[N - 1] -= N * right;
		ans += right;
	}
	out << ans << std::endl;
}


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

int main(){
 int M, D, res = 0;
 cin >> M >> D; 
 for(int m = 1; m <= M; m++){
  for(int d = 1; d <= D; d++){
   if(d % 10 >= 2 && d / 10 >= 2 && (d % 10) * (d / 10) == m)
     res++;
  }
 }
 cout << res << '\n';
}

Measured memory_bytes: 256
import itertools

N = int(input())

P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

A = [i+1 for i in range(N)]

mp = {}

for x in itertools.permutations(A):
    mp[x] = len(mp)

print(abs(mp[P]-mp[Q]))

Measured memory_bytes: 10472
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 1 << 17

using namespace std;

const int mod = 1000000007;

int n, m;
int a[20], f[20][N], fac[N], ifac[N];

void init(int);
int quick_pow(int, int);
int C(int, int);

int main(){
	cin >> n >> m; init(1 << n);
	for(int i = 1; i <= m; ++i)
		cin >> a[i];
	reverse(a + 1, a + 1 + m);
	f[0][0] = 1; int all = 1 << n;
	for(int i = 1; i <= m; ++i)
		for(int s = 0; s < all; ++s){
			f[i][s] = f[i - 1][s]; int sum = 0;
			for(int j = 0; j < n; ++j)
				sum += ((s >> j) & 1) * (1 << j);
			if(sum > all - a[i] + 1) continue;
			for(int j = 0; j < n; ++j){
				if(!((s >> j) & 1)) continue;
				int tmp = sum - (1 << j);
				if(tmp > all - a[i] + 1) continue;
				(f[i][s] += 1ll * f[i - 1][s ^ (1 << j)] * C(all - a[i] - tmp, (1 << j) - 1) % mod * fac[1 << j] % mod) %= mod;
			}
		}
	int ans = 0;
	for(int s = 0; s < (1 << n); ++s){
		int cnt = 0, sum = 0;
		for(int j = 0; j < n; ++j){
			cnt += ((s >> j) & 1);
			if(!((s >> j) & 1)) sum += 1 << j;
		}
		int tmp = 1ll * f[m][s] * fac[sum] % mod;
		if(cnt & 1) (ans += mod - tmp) %= mod;
		else (ans += tmp) %= mod;
	}
	cout << 1ll * ans * (1 << n) % mod << endl;
	return 0;
}

int quick_pow(int x, int y){
	int sum = 1;
	for(; y; y >>= 1, x = 1ll * x * x % mod)
		if(y & 1) sum = 1ll * sum * x % mod;
	return sum;
}

int C(int x, int y){
	return 1ll * fac[x] * ifac[y] % mod * ifac[x - y] % mod;
}

void init(int n){
	fac[0] = 1;
	for(int i = 1; i <= n; ++i)
		fac[i] = 1ll * fac[i - 1] * i % mod;
	ifac[n] = quick_pow(fac[n], mod - 2);
	for(int i = n; i; --i)
		ifac[i - 1] = 1ll * ifac[i] * i % mod;
	return ;
}

Measured memory_bytes: 9344
while 1:
    *C, = map(int, input().split())
    if C == [0]:
        break
    s = 0
    C.sort(reverse=1)
    one = 0
    for c in C:
        if c == 1:
            s += 1
            one += 1
        elif c > 10:
            s += 10
        else:
            s += c
    while one and s + 10 <= 21:
        s += 10
        one -= 1
    if s > 21:
        s = 0
    print(s)

Measured memory_bytes: 7640
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
using namespace std;
#define Rep(i,n) for(int i = 0; i < n; ++i)
#define For(i, s, e) for(int i = s; i <= e; ++i)
int N, M;
int P[100001];
int X[100001];
int Y[100001];
int C[100001];

int main()
{
	scanf("%d %d", &N, &M);
	For(i, 1, N) {
		scanf("%d", &P[i]);
		C[i] = i;
	}
	For(i, 1, M)
		cin >> X[i] >> Y[i];

	For(i, 1, M) {
		int a = X[i];
		int b = Y[i];
		while (a != C[a]) a = C[a];
		while (b != C[b]) b = C[b];
		if (a < b) C[b] = a;
		if (a > b) C[a] = b;
	}
	int k = 0;
	for (int i = N; i > 0; --i) {
		int a = i;
		int b = P[i];
		while (a != C[a]) a = C[a];
		while (b != C[b]) b = C[b];
		if (a == b)
			++k;
	}
	printf("%d", k);
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.io.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int ans = 0;
        for(int i=0; i<S.length(); i++){
            if(S.charAt(i) !=T.charAt(i)) ans++;
        }
        
        System.out.println(ans);
        
    }
}


Measured memory_bytes: 41096
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

const ll MOD = 1e9 + 7;

int main() {
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  VI as(N, 0);
  REP(i,0,N) {
    int a;
    cin >> a;
    as[a]++;
  }
  bool pos = true;
  if(N % 2 == 0) {
    for(int i=1; i<N; i+=2) {
      if(as[i] != 2) {
        pos = false;
        break;
      }
    }
  } else {
    if(as[0] != 1) {
      pos = false;
    } else {
      for(int i=2; i<N; i+=2) {
        if(as[i] != 2) {
          pos = false;
          break;
        }
      }
    }
  }
  if(!pos) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 1;
  if(N % 2 == 0) {
    for(int i=1; i<N; i+=2) {
      ans = (ans * 2) % MOD;
    }
  } else {
    for(int i=2; i<N; i+=2) {
      ans = (ans * 2) % MOD;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(0,n,2):
  b.append(a[i]^a[i+1])
bs = 0
for i in range(len(b)):
  bs ^= b[i]

ans = []
for i in range(n//2):
  bt = bs^b[i]
  ans.append(a[i*2+1]^bt)
  ans.append(a[i*2]^bt)
print(*ans)    

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

int main(){
    long long n,m;cin>>n>>m;
    vector<long long> broken(m);for (int i=0;i<m;i++){cin>>broken[i];}
    if (m >= 2){
        for (int i=1;i<m;i++){
            if (broken[i] == broken[i-1] + 1){
                cout << 0 << endl;
                return 0;
            }
        }
    }
    vector<long long> patterns(n+1);
    if (n==1){
        cout << 1 << endl;
        return 0;
    }

    patterns[0] = 1;
    if (find(broken.begin(), broken.end(), 1) == broken.end()){
        patterns[1] = 1;
    } else {
        patterns[1] = 0;
    }
    for (long long i=2;i<=n;i++){
        if (find(broken.begin(), broken.end(), i) == broken.end()){
            patterns[i] = ((patterns[i-2] % 1000000007) + (patterns[i-1] % 1000000007)) % 1000000007;
        } else {
            patterns[i] = 0;
        }
    }
    cout << patterns[n] << endl;
    return 0;

}

Measured memory_bytes: 1408
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

minutes = 0
items = [A, B, C, D, E]
rems = [item % 10 for item in items if item % 10 != 0]
cnt = len(rems)


for item in items:
    minutes += (item//10)*10
 
if cnt > 0:
    minutes += (cnt-1)*10
    minutes += min(rems)

print(minutes)

Measured memory_bytes: 3064
import bisect

N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

ans = 0
for i in range(N):
    upper = bisect.bisect_left(A, B[i])
    downer = bisect.bisect_right(C, B[i])
    ans += upper*(len(C)-downer)
print(ans)

Measured memory_bytes: 23092
# coding: utf-8

n = int(input())

i = 1
while n > 0:
    if n == 4 or n == 2 or n == 1:
        break
    i += 1
    if n % 2 == 0:
        n = n / 2
    else:
        n = n*3+1

print(i+3)

Measured memory_bytes: 2940
N = int(input())
next = []
for i in range(N):
  next.append(int(input()) - 1)
now = 0
count = 0
judge = False
for i in range(N):
  now = next[now]
  count += 1
  if now == 1: 
    judge = True
    print(count)
    break
if not judge:
  print(-1)

Measured memory_bytes: 12936
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	//n := r.nextInt()
	r.Scan(true)
	a := r.nextStringArray().toInts()

	s := func(src []int) (vs int) {
		vs = 0
		for i := range src {
			vs += src[i]
		}
		return
	}(a)

	minInt := func(a int, vs ...int) int {
		for i := range vs {
			v := &vs[i]
			if a > *v {
				a = *v
			}
		}
		return a
	}
	ans := s
	w := 0
	for _, v := range a {
		w += v
		ans = minInt(ans, abs(w-(s-w)))
	}
	fmt.Fprintln(stdout, ans)
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main() {
    LL N, ans = 0;
    cin >> N;
    if (N == 1) {
        cout << 0 << endl;
        return 0;
    }else if (N <= 3) {
        cout << 1 << endl;
        return 0;
    }

    LL tmp = N;

    for(LL i=2; i*i <= N; i++) {
        if (N % i == 0) {
            LL cnt = 0;
            LL next = 1;

            while(tmp % i == 0) {
                tmp /= i;
                cnt++;
                if(cnt == next) {
                    ans++;
                    next++;
                    cnt = 0;
                }
            }
        }
    }

    cout << ans + (100000 < tmp) << endl;
}


Measured memory_bytes: 3592
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define sz(x) (int)(x).size();
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
#define x first
#define y second
int32_t main()
{
	int n=in();int m=in();int d,b;
	vector<pair<int,int>>a;
	for(int i=0;i<n;i++)
	{
		d=in();a.push_back({d,1});
	}
	for(int i=0;i<m;i++)
	{
		d=in();b=in();a.push_back({b,d});
	}
	sort(all(a));
	reverse(all(a));
	int cnt=0,ans=0,c;
	for(auto i:a)
	{
		b=i.y;c=i.x;
		cnt+=b;ans+=c*b;
		if(cnt>n){ans-=c*(cnt-n);break;}
	}
	cout<<ans;
	
}

Measured memory_bytes: 7448