akhauriyash/Code-Regression huggingface dataset:
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N, A, B, C;
    cin >> N >> A >> B >> C;
    vector<ll> L;
    rep (i, N) {
        ll l;
        cin >> l;
        L.pb(l);
    }
    ll ans = linf;
    for (ll s1 = 1; s1 < (1 << N); ++s1) {
        for (ll s2 = 1; s2 < (1 << N); ++s2) {
            if ((s1 & s2) != 0) continue;
            for (ll s3 = 1; s3 < (1 << N); ++s3) {
                if ((s1 & s3) != 0 || (s2 & s3) != 0) continue;
                vector<ll> M;
                ll v1 = 0, v2 = 0, v3 = 0;
                ll n1 = -1, n2 = -1, n3 = -1;
                rep (i, N) {
                    if (s1 & (1 << i)) {
                        v1 += L[i];
                        ++n1;
                    }
                    if (s2 & (1 << i)) {
                        v2 += L[i];
                        ++n2;
                    }
                    if (s3 & (1 << i)) {
                        v3 += L[i];
                        ++n3;
                    }
                }
                M.pb(v1);
                M.pb(v2);
                M.pb(v3);
                sort(all(M));
                ll c = (n1 + n2 + n3) * 10 + abs(M[0] - C) + abs(M[1] - B) + abs(M[2] - A);
                if (c < ans) {
                    ans = c;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0L;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t h,w,k;
  cin >> h >> w >> k;
  vector<vector<int>> board(h,vector<int>(w));
  int numberingcnt = 1;
  rep(i,h){
    rep(j,w){
      char hoge;
      cin >> hoge;
      if(hoge == '#'){
        board.at(i).at(j) = numberingcnt;
        numberingcnt++;
      }
    }
  }
  /*rep(i,h){
    rep(j,w){
      cout << board.at(i).at(j);
    }
    cout << endl;
  }*/
  rep(i,h){
    rep(j,w){
      if( j-1 >=0 && board.at(i).at(j-1) != 0 && board.at(i).at(j) == 0){
        board.at(i).at(j) = board.at(i).at(j-1);
      }
    }
    invrep(j,w){
      if( j+1 <= w-1 && board.at(i).at(j+1) != 0 && board.at(i).at(j) == 0){
        board.at(i).at(j) = board.at(i).at(j+1);
      }
    }
  }
  rep(i,w){
    rep(j,h){
      if( j-1 >= 0 && board.at(j-1).at(i) != 0 && board.at(j).at(i) == 0){
        board.at(j).at(i) = board.at(j-1).at(i);
      }
    }
    invrep(j,h){
      if( j+1 <= h-1 && board.at(j+1).at(i) != 0 && board.at(j).at(i) == 0){
        board.at(j).at(i) = board.at(j+1).at(i);
      }
    }
  }
      
      
  
  rep(i,h){
    rep(j,w){
      cout << board.at(i).at(j) << " ";
    }
    cout << endl;
  }
}

Measured memory_bytes: 1152
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	ll ans = 0;

	for (int i=1; i<=N; i++) {
		if (!(i % 3 == 0 || i % 5 == 0)) ans += i;
	}

	cout << ans << endl;

	return 0;
}

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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        while (true){
            String line = br.readLine();
            String[] ln = line.split(" ");
            int H = Integer.parseInt(ln[0]);
            int W = Integer.parseInt(ln[1]);
            if (H==0 && W==0) break;
            for (int j=0; j<H; j++){    
                for (int i=0; i<W; i++){
                    sb.append("#");
                }
                sb.append("\n");
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }

}

Measured memory_bytes: 20724
import sys
x,a,b = map(int,input().split())
if x < 0 or a < 0 or b < 0 or x > 1000 or a > 1000 or b > 1000:
    sys.exit()

if abs(x-a) > abs(x-b):
    print("B")
if abs(x-a) < abs(x-b):
    print("A")
    

Measured memory_bytes: 9108
d=int(input())
c=list(map(int,input().split()))
num=[]
for i in range(d):
    num.append(list(map(int,input().split())))
ans=0
num2=[0]*26
for i in range(1,d+1):
    t=int(input())
    num2[t-1]=i
    ans+=num[i-1][t-1]
    for j in range(26):
        ans-=((i-num2[j])*c[j])
    print(ans)


Measured memory_bytes: 9264
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second

signed main(){

  int n;
  cin>>n;
  int a[n];
  int b[n];
  int c[n];
  int sum=0;

  r(i,n)cin>>a[i];
  r(i,n)cin>>b[i];
  r(i,n-1)cin>>c[i];

  r(i,n){
    sum+=b[a[i]-1];
    if(i&&a[i]==a[i-1]+1)sum+=c[a[i]-2];
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
using System;

namespace AtCoder.Problems
{
    public class ProblemC
    {
        public static void Main(string[] args)
        {
            var s = new SolveC();
            s.Solve();
        }

        public class Scanner
        {
            private string[] _s;
            private int _i;
            private readonly char[] _separators = 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(_separators, StringSplitOptions.RemoveEmptyEntries);
                if (_s.Length == 0) return Next();
                _i = 0;
                return _s[_i++];
            }

            public int NextInt() => int.Parse(Next());
            public long NextLong() => long.Parse(Next());
            public ulong NextULong() => ulong.Parse(Next());
            public double NextDouble() => double.Parse(Next());

            public int[] GetIntArray(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[] GetLongArray(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[] GetDoubleArray(int n, double add = 0)
            {
                double[] array = new double[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextDouble() + add;
                }
                return array;
            }
        }
    }

    public class SolveC
    {
        public void Solve()
        {
            var cin = new ProblemC.Scanner();
            var n = cin.NextInt();
            var y = cin.NextInt();

            var result = GetAnswer(n, y);
            Console.WriteLine(result);
        }

        public string GetAnswer(int n, int y)
        {
            for (int eiichi = 0; eiichi <= n; eiichi++)
            {
                for (int umeko = 0; umeko <= n - eiichi; umeko++)
                {
                    var shibazaburoh = n - eiichi - umeko;
                    var total = eiichi * 10000 + umeko * 5000 + shibazaburoh * 1000;
                    if (total == y)
                    {
                        return $"{eiichi} {umeko} {shibazaburoh}";
                    }
                }
            }

            return "-1 -1 -1";
        }
    }
}


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

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> C(N);
    rep(i, K) {
        int d;
        cin >> d;
        rep(j, d) {
            int a;
            cin >> a;
            a--;
            C[a]++;
        }
    }

    int ans = 0;
    rep(i, N) {
        if (C[i] == 0) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3548
n,m=map(int,input().split())
a=[]
b=[]
c=0
for i in range(n):
    a.append(input())
for j in range(m):
    b.append(input())
for m in range(len(a)):
    if a[m].find(b[0])!=-1:
        for l in range(len(b)-1):
            if m+l+2>len(a):
                break
            if a[m+l+1][(a[m].find(b[0])):(a[m].find(b[0]))+len(b[l+1]):]!=b[l+1]:
                break
            c+=1
        if c==len(b)-1:
            print("Yes")
            exit()
print("No")
            

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

int main(){
  int n,m;
  cin>>n>>m;
  
  int h[n+1];
  for(int i=0;i<n;i++){
    cin>>h[i+1];
  }
  
  int a[m],b[m];
  for(int i=0;i<m;i++){
    cin>>a[i]>>b[i];
  }
  
  int num[n+1]={0};
  for(int i=0;i<m;i++){
    if(h[a[i]]>h[b[i]]){
      num[b[i]]++;
    }
    if(h[a[i]]==h[b[i]] and a[i]!=b[i]){
      num[a[i]]++;
      num[b[i]]++;
    }
    if(h[a[i]]<h[b[i]]){
      num[a[i]]++;
    }
  }
  
  int count=0;
  for(int i=1;i<n+1;i++){
    if(num[i]==0){
      count++;
    }
  }
  cout<<count<<endl;
}


Measured memory_bytes: 5156
{-# LANGUAGE BangPatterns #-}
import Data.Char
import Data.List
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS
import qualified Data.IntSet as IntSet
import qualified Data.IntMap.Strict as IntMap
import Control.Monad

forM_IntSet :: Monad m => IntSet.IntSet -> (Int -> m ()) -> m ()
forM_IntSet set f = go set
  where
    go set = case IntSet.splitRoot set of
               [] -> return ()
               [x] -> forM_ (IntSet.toList x) f
               xs -> forM_ xs go

main = do
  [n,m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  edges <- U.replicateM m $ do
    [x,y,z] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (x-1,y-1,z)
  let graph :: IntMap.IntMap IntSet.IntSet
      graph = U.foldl' (\m (u, v, _) -> IntMap.insertWith IntSet.union u (IntSet.singleton v) $ IntMap.insertWith IntSet.union v (IntSet.singleton u) m) IntMap.empty edges
  vec <- UM.replicate n (-1)
  let find !j
        | j >= n = return Nothing
        | otherwise = do v <- UM.read vec j
                         if v == -1
                           then return (Just j)
                           else find (j+1)
  let dfs !i !value = do
        k <- UM.read vec i
        if k == -1
          then do UM.write vec i value
                  case IntMap.lookup i graph of
                    Just set -> forM_IntSet set $ \j -> dfs j value
                    Nothing -> return ()
          else return ()
  let loop !i = do
        mj <- find i
        case mj of
          Nothing -> return i
          Just j -> do
            dfs j i
            loop (i+1)
  result <- loop 0
  print result


Measured memory_bytes: 57852
#include <iostream>
#include <vector>
#include <map>
#include <queue>
using namespace std;

struct second_order {
	bool operator()( const pair<int, int> &lhs,
					 const pair<int, int> &rhs ) {
		return lhs.second > rhs.second;
	}
};

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

	vector<int> nums;
	for ( int i = 0; i < N; ++i ) {
		int num;
		cin >> num;
		nums.push_back( num );
	}

	map<int, int> cnts;
	map<int, int>::iterator iter;
	for ( int i = 0; i < N; ++i ) {
		if ( ( iter = cnts.find( nums[i] ) ) != cnts.end() ) {
			++(iter->second);
		}
		else {
			cnts.insert( make_pair( nums[i], 1 ) );
		}
	}

	priority_queue<pair<int, int>, vector<pair<int, int>>, second_order> que;
	for ( iter = cnts.begin(); iter != cnts.end(); ++iter ) {
		que.push( *iter );
	}

	int res = 0;
	while ( que.size() > K ) {
		pair<int, int> rec = que.top();
		res += rec.second;
		que.pop();
	}

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 12532
/*input
1
3
*/
 
// author - Madhav Thakker
 
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace std;
 
#define ll long long
#define ld long double
#define int ll
#define endl '\n'

typedef pair<int, int> pii; 
typedef pair<ld, ld> pdd;
 
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FileIn(file) freopen(file, "r", stdin)
#define FileOut(file) freopen(file, "w", stdout)
#define all(c) c.begin(), c.end() 
#define tr(container, it )\
for(__typeof__(container.begin()) it = container.begin(); it != container.end(); it++) 
#define present(container, element) (container.find(element) != container.end())  //map, set
#define cpresent(container, element) (find(aint(container),element) != container.end()) //vector
#define what_is(x) cout << #x << " is " << x << endl; 
#define all(c) c.begin(), c.end() 
 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
const int MOD = 1e9+7;
 
 
int fast_pow(int a, int b){
	int res = a, ret = 1;
	while(b>0){
		if(b%2)
			ret = (ret*res)%MOD;
		res = (res*res)%MOD;b/=2;
	}
	return ret;
}
 
// --
// -- 
// -- 
// std::cout << std::fixed;
// std::cout << std::setprecision(26) << f << '\n';
// str = to_string(n)
// stoi , stoll, stol
// sort(arr, arr+n, greater<int>());
// fill(prefix.begin(), prefix.end(), 0);
// 
// 
 
 
 
////
const int maxN = 3e2+7;

ld dp[maxN+5][maxN+5][maxN+5]; // 1 - win, 0 - lose
////

signed main(){
 
	fastio;
	time_t time_t1, time_t2;
	time_t1 = clock();
 
	////////////////////////////////

	int t = 1;
	// cin >> t ;

	while(t--){

		int n;
		cin >> n ;
		int cnt[5] = {0};
		int x;
		for (int i = 0; i < n; ++i){
			cin >> x;
			x--;
			cnt[x]++;
		}

		dp[0][0][0] = 0;
		
		for (int k = 0; k <= n; ++k){
			for (int j = 0; j <= n; ++j){
				for (int i = 0; i <= n; ++i){
					if(i == 0 and j == 0 and k == 0){
						continue;
					}
					dp[i][j][k] = 1;
					if(i > 0){
						dp[i][j][k] += 1.0*(i)/(n)*(dp[i-1][j][k]);
					}
					if(j > 0){
						dp[i][j][k] += 1.0*(j)/(n)*(dp[i+1][j-1][k]);
					}
					if(k > 0){
						dp[i][j][k] += 1.0*(k)/(n)*(dp[i][j+1][k-1]);
					}
					dp[i][j][k] *= 1.0*(n)/(i + j + k);
				}
			}
		}
		ld ans = dp[cnt[0]][cnt[1]][cnt[2]];
		printf("%.10Lf\n", ans);

	}
 	
	///////////////////////////////
	// 
 
	time_t2 = clock();
	// cerr << "time taken :" << time_t2 - time_t1 << endl;
 
	return 0;
}


Measured memory_bytes: 459008
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	fmt.Fscan(r, &n)
	fmt.Fscan(r, &m)

	a := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &a[i])
	}
	b := make([]string, m)
	for i := 0; i < m; i++ {
		fmt.Fscan(r, &b[i])
	}

	ans := false
	for i := 0; i < n-m+1; i++ {
		for j := 0; j < n-m+1; j++ {
			if check(i, j, a, b) {
				ans = true
				break
			}
		}
	}

	if ans {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func check(startI, startJ int, a, b []string) bool {
	result := true
	for i := 0; i < len(b); i++ {
		for j := 0; j < len(b); j++ {
			if a[i+startI][j+startJ] != b[i][j] {
				result = false
				break
			}
		}
	}
	return result
}


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

int main(){
  int a, b, ans;
  cin >> a >> b;
  ans = 0;
  ans += max(a, b);
  if(a < b) b--;
  if(a > b) a--;
  ans += max(a, b);
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String s = in.next();
		System.out.println(solve(s));
		in.close();
	}

	private static long solve(String s) {
		int n = s.length() + 1;
		long[] a = new long[n];
		s = ">".concat(s).concat("<");
		long nt = 0;
		for (int i = 0; i < n; i++)
			if (s.charAt(i) == '>' && s.charAt(i + 1) == '<') {
				nt += setR(i, s, a);
				nt += setL(i, s, a);
			}
		return nt;
	}

	private static long setL(int p, String s, long[] a) {
		long nt = 0;
		for (int i = p - 1; i >= 0; i--)
			if (s.charAt(i) == '>') {
				a[i] = a[i + 1] + 1;
				nt += a[i];
			} else {
				a[i] = Math.max(a[i + 1], a[i - 1]) + 1;
				nt += a[i];
				break;
			}
		return nt;
	}

	private static long setR(int p, String s, long[] a) {
		long nt = 0;
		for (int i = p + 1; i < a.length; i++)
			if (s.charAt(i + 1) == '<') {
				a[i] = a[i - 1] + 1;
				nt += a[i];
			} else
				break;
		return nt;
	}
}

Measured memory_bytes: 34784
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a.append(x)
b.append(y)
a.sort()
b.sort()
if a[-1]>=b[0]:
  print('War')
else:
  print('No War')

Measured memory_bytes: 3060
/*राधे कृष्णा*//*राधे कृष्णा*//*राधे कृष्णा*//*राधे कृष्णा*/
#include <iostream>
#include<string>
#include<map>
#include<queue>
#include<algorithm>
#include <cstdio> 
#include <string> 
#include <vector> 
#include<bits/stdc++.h>
#include<queue>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//#define test ll t;cin >> t;while(t--)
#define ll long long int
#define  sll stack<ll>
#define  qll queue<ll>
#define  pll pair<ll,ll>
#define  vll vector<ll>
#define  vpi vector<pair<int,int>>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define ln "\n"
#define f0(i,n) for(i=0;i<n;i++)
#define f1(i,n) for(i=1;i<n;i++)
#define fab(i,a,b) for(i=a;i<b;i++)

void solve() {
	ll n,i,j,k,s=0,su=0,sum=0;
	ll select=-1,select2=-1;
	cin >> n;
	ll a[n],b[n],c[n];
	for(i=0;i<n;i++)	cin >> a[i] >> b[i] >> c[i];
	ll dp[n][3];
	//dp[0][0]=0 , dp[0][1]=0 , dp[0][2]=0;
	for(i=0;i<n;i++){
		for(j=0;j<3;j++){
			dp[i][j]=0;
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<3;j++){
			if(i==0){
				if(j==0) dp[i][j]=a[0];
				else if(j==1) dp[i][j]=b[0];
				else if(j==2) dp[i][j]=c[0];
			}
			else{
			for(k=0;k<3;k++){
				if(j==k) continue;
				if(j==0) dp[i][j]=max(dp[i][j], dp[i-1][k]+a[i]);
				else if(j==1) dp[i][j]=max(dp[i][j], dp[i-1][k]+b[i]);
				else if(j==2) dp[i][j]=max(dp[i][j], dp[i-1][k]+c[i]);
			}}
		}
	}
	ll res = max(dp[n-1][0], dp[n-1][1]);
	res = max(res, dp[n-1][2]);
	cout << res;
}
int main(){
	fastio
	/*ll t;
	cin >> t;
	while(t--){*/
		solve();
	//}
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long N;
    cin >> N;
    vector<long long> v;
    for (long long i = 1; i * i <= N; i++)
    {
        if (N % i == 0)
        {
            v.push_back(i);
            long long b = N / i;
            v.push_back(N / i);
        }
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    long long sum = 0;
    for (auto p : v)
    {
        if (p == 1)
            continue;
        if (N % (p - 1) != 0)
        {
            if (N / p < p - 1)
            {
                sum += (p - 1);
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 384
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) {
		long i,j;
		Scanner sc = new Scanner(System.in);
		int l = parseInt(sc.next());
		int r = parseInt(sc.next());
		sc.close();
		long a;
		int l2019 = l / 2019;
		int r2019 = r / 2019;
		if(l2019!=r2019)  {
			System.out.println(0);
		} else {
			long min1 = 2000000000;
			for(i=l;i<r;i++) {
				for(j=i+1;j<=r;j++) {
					a = i*j % 2019;
					if(a < min1) {
						min1 = a;
					}
				}
			}
			System.out.println(min1);
		}
	}
}


Measured memory_bytes: 21844
#include <iostream>
#define llint long long

using namespace std;

llint n;
llint a[100005];
llint r[100005];

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	
	llint sum = 0;
	for(int i = 1; i <= n; i++){
		if(i%2) sum += a[i];
		else sum -= a[i];
	}
	sum /= 2;
	
	r[1] = sum;
	for(int i = 2; i <= n; i++) r[i] = a[i-1] - r[i-1];
	for(int i = 1; i <= n; i++) cout << r[i]*2 << " "; cout << endl;
	
	return 0;
}

Measured memory_bytes: 2816
n = gets.to_i
x=gets.split.map(&:to_i)
sum = 0
tmp = 10000000

x.min.upto(x.max) do |i|
  n.times do |j|
  sum+=(x[j]-i)**2
  end
  if tmp>= sum
    tmp=sum
  end
  sum=0
end

print(tmp)

Measured memory_bytes: 1788
#include <iostream>

using namespace std;
int main()
{
    int n,m,a[100000]={},b[100000]={},big=-1,small=999999;
    cin>>n>>m;
    for (int i=0; i<m; i++)
    {
        cin>>a[i]>>b[i];
        if (a[i]>big)
        {
            big=a[i];
        }
        if (b[i]<small)
        {
            small=b[i];
        }
    }
    if (small-big<-1)
    {
        cout<<"0";
    }
    else
    {
        cout<<small-big+1;
    }
    return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9+7, MAX = 1e9, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = 0, max_index = 0;
long long min_value = MAX, min_index = 0;
long long sum = 0;

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

int main() {
    cin >> N;
    if(N <= 999) cout << "ABC";
    else cout << "ABD";
}


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

int main() {
  int N, M; cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end(), greater<int>());
  int sum = 0;
  for (int i = 0; i < N; i++) sum += A.at(i);
  for (int i = 0; i < M; i++) {
    if (A.at(i) < sum / (4.0 * M)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    VI n{6,2,5,5,4,5,6,3,7,6};
    int N,M; cin >> N >> M;
    VI A(M); REP(i,M) cin >> A[i];
    VI dp(N+1,-INT_INF);
    dp[0] = 0;
    REP(i,N){
        REP(j,M){
            if(i+1-n[A[j]] >= 0) chmax(dp[i+1], dp[i+1-n[A[j]]] + 1);
        }
    }

    SORT(A); REVERSE(A);
    string ans = "";
    int now = N;
    RREP(i,dp[N]){
        REP(j,M){
            if(now-n[A[j]] >= 0 && dp[now] == dp[now-n[A[j]]] + 1){
                ans += A[j]+'0';
                now -= n[A[j]];
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? (-(a)) : (a))

typedef long long ll;

using namespace std;

int H, W;
char input[100 + 5][100 + 5];
int dp[100 + 5][100 + 5];
bool visit[100 + 5][100 + 5];

int get_dp(int r, int c)
{
	if (visit[r][c]) return dp[r][c];

	visit[r][c] = true;
	dp[r][c] = 2147483647;
	
	if (r - 1 >= 0)
	{
		int temp = get_dp(r - 1, c);
		if (input[r][c] == '#' && input[r - 1][c] == '.') temp++;
		dp[r][c] = min(dp[r][c], temp);
	}
	
	if (c - 1 >= 0)
	{
		int temp = get_dp(r, c - 1);
		if (input[r][c] == '#' && input[r][c - 1] == '.') temp++;
		dp[r][c] = min(dp[r][c], temp);
	}
	
	return dp[r][c];
}

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

	scanf("%d %d", &H, &W);
	for (int i = 0; i < H; ++i) scanf("%s", input[i]);
	
	if (input[0][0] == '#') dp[0][0] = 1;
	else dp[0][0] = 0;
	visit[0][0] = true;

	printf("%d\n", get_dp(H - 1, W - 1));

	return 0;
}

Measured memory_bytes: 384
open Scanf
open Printf
open Array

let max_i64,(++),i64 = Int64.(max_int,add,of_int)

let () = scanf " %d" @@ fun l ->
  let a = init l (fun _ -> scanf " %d" @@ fun v -> v) in
  let dp = make_matrix (l+1) 5 max_i64 in
  let f typ v = i64 @@
    match typ with
    | 0 | 4 -> (* zero *)
      v
    | 1 | 3 -> (* even >= 2 *)
      if v=0 then 2
      else if v mod 2 = 0 then 0 else 1
    | 2 | _ -> (* odd *)
      if v mod 2 = 1 then 0 else 1
  in
  let update i j v =
    dp.(i).(j) <- min dp.(i).(j) v
  in
  for k=0 to 4 do
    dp.(0).(k) <- 0L;
  done;
  let to_ = [|
    [0;1;2];
    [1;2;4];
    [2;3;4];
    [3;4];
    [4]
  |] in
  for i=1 to l do
    for k=0 to 4 do
      List.iter (fun j ->
        update i j @@ dp.(i-1).(k) ++ f j a.(i-1)
      ) to_.(k)
    done
  done;
  (* iter (fun b ->
    iter (printf "%2Ld ") b;
    print_newline ()
  ) dp; *)
  printf "%Ld" @@ fold_left min max_i64 dp.(l)

Measured memory_bytes: 40896
def check v
	return true if (v&v).count == 1
	return true if v[0]+1==v[1] && v[1]+1==v[2]
	return false
end

gets.to_i.times{
	an=gets.split(" ").map{|e|e.to_i}
	ac=gets.split(" ")
	count=0
	r=[]
	g=[]
	b=[]
	ac.each_with_index{|v,i|
		r=r.concat [an[i]] if v == "R"
		g=g.concat [an[i]] if v == "G"
		b=b.concat [an[i]] if v == "B"
	}
	maxRCount=0
	r.permutation{|pset|
		rCount=0
		(pset.length/3).times{|t|
			rCount += 1 if check(pset[3*t..3*t+2])
		}
		maxRCount = rCount if maxRCount < rCount
	}
	maxGCount=0
	g.permutation{|pset|
		gCount=0
		(pset.length/3).times{|t|
			gCount += 1 if check(pset[3*t..3*t+2])
		}
		maxGCount = gCount if maxGCount < gCount
	}
	maxBCount=0
	b.permutation{|pset|
		bCount=0
		(pset.length/3).times{|t|
			bCount += 1 if check(pset[3*t..3*t+2])
		}
		maxBCount = bCount if maxBCount < bCount
	}
	max = maxBCount + maxGCount + maxRCount
	p 1 if max >= 3
	p 0 if max < 3
}

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

string w;

int main() {
    cin >> w;

    map<char, int> mp;
    rep(i, w.size()) {
        mp[w[i]]++;
    }

    string ans = "Yes";
    for (auto iter = mp.begin(); iter != mp.end(); iter++) {
        // cout << iter->second << endl;
        if (iter->second % 2 == 1) {
            ans = "No";
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
an = map(int, input().split())
anlist = list(an)
count = 0
flg = 0
while flg == 0:
  for i in range(n):
    if (anlist[i])%2 == 1:
      flg = 1
    else:
      anlist[i] = anlist[i]/2
  if flg == 0:
    count = count + 1
print(count)
flg = 0
count = 0

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

using namespace std;

typedef long long ll;

string t;
ll n, k;
ll r, s, p;

ll arr[100005][3] = {};

void reset() {
	for (int i =0; i < 100005; i++)
		for(int j =0; j < 3; j++)
			arr[i][j] = -1;
}

ll calc(ll i , ll c) {
	ll score = 0;	
	if (i >= n)	return 0;		

	if (arr[i][c] != -1)	return arr[i][c];

	if (c == 0) {
		if(t[i] == 's')
			score += r;
		score += max(calc(i+k, 1), calc(i+k, 2));
	}
	else if (c == 1) {
		if (t[i] == 'p')
			score += s;
		score += max(calc(i+k, 0), calc(i+k, 2));
	}
	else if (c == 2) {
		if (t[i] == 'r')
			score += p;
			score += max(calc(i+k, 0), calc(i+k, 1));
	}

	arr[i][c] = score;

	return score;
}

int main() {
	cin >> n >> k;	
	cin >> r >> s >> p;
	cin >> t;
	ll score = 0;
	reset();
	for (int i =0; i < k; i++) {
		score += max({calc(i,0), calc(i,1), calc(i,2)});
	}
	cout << score << endl;
	return 0;
}


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

int main() {
    constexpr int64_t MOD = (int64_t)1e9 + 7;
    int64_t N;
    cin >> N;
    vector<int64_t> A(N);
    for (int64_t i = 0; i < N; i++) {
        cin >> A[i];
    }

    constexpr int64_t MAX = 61;

    vector<vector<int64_t>> d_num(61, vector<int64_t>(N + 1, 0));

    for (int64_t i = 0; i < 61; i++) {
        for (int64_t j = 0; j < N; j++) {
            d_num[i][j + 1] = d_num[i][j] + (bool)(A[j] & (1LL << i));
        }
    }

    int64_t ans = 0;
    for (int64_t i = 1; i < N; i++) {
        for (int64_t j = 0; j < MAX; j++) {
            //何回この桁が登場するかを計算
            int64_t num = d_num[j][i];

            if (A[i] & (1LL << j)) {
                //立っているなら逆の回数が採用
                num = i - num;
            }

            //2^jがnum回足される
            (ans += num % MOD * ((1LL << j) % MOD)) %= MOD;
        }
    }

    cout << ans << endl;
}

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

int main() {
  // ここにプログラムを追記
  int a, b, c, d;
  cin >> a;
  b = a/100;
  c = (a-b*100)/10;
  d = a%2;
  cout << b + c + d << endl;
}

Measured memory_bytes: 256
N = input()


def f(d, used, cur):
    num = len(used | set(cur))
    if d == 0:
        if num == 3:
            return 1
        else:
            return 0
    elif num == 3:
        return 3 ** d
    elif num == 2:
        return 3 ** d - 2 ** d
    else:
        return 3 ** d - 2 * (2 ** d) + 1


def high(N, used, ret):
    if N:
        if N[0] > "3":
            ret += f(len(N) - 1, used, "3")
        if N[0] > "5":
            ret += f(len(N) - 1, used, "5")
        if N[0] > "7":
            ret += f(len(N) - 1, used, "7")
    else:
        if len(used) == 3:
            ret += 1
        return ret
    if N[0] in "357":
        ret = high(N[1:], used | set(N[0]), ret)
    return ret


def low():
    ret = 0
    for d in range(len(N) - 1):
        ret += 3 * (3 ** d - 2 ** (d + 1) + 1)
    return ret


def main():
    print(high(N, set(), low()))
    return


main()


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


S=input()
T=input()

kaitensu=len(S)

for i in range(kaitensu):
    S=S[kaitensu-1]+S[0:kaitensu-1]
    if S==T:
        print("Yes")
        exit()
print("No")

            

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

int main() {
  int d, n;
  cin>>d>>n;
  int res=n;
  if (res==100) res++;
  for (int i=0; i<d; i++) {
    res *= 100;
  }
  cout<<res<<endl;
  return 0;
}


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

#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector< pi > 
const int N=200010;
ll a[N];
int n;
ll hh(ll mid)
{
    ll r=0;
    for(int i=1;i<=n;i++)
    {
        r+=abs(a[i]-mid-i);
    }
    return r;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    ll l=-mod,r=mod;
    while(l<r)
    {
        ll mid=(l+r)/2;
        if(l==r-1)
        {
            if(hh(r)<hh(l)) l++;
            break;
        }
        if(hh(mid)>hh(mid+1)) l=mid+1;
        else if(hh(mid)<hh(mid+1)) r=mid;
        else if(hh(mid)>hh(mid+2)) l=mid+2;
        else r=mid;
    }
    //cout<<l<<"\n";
    cout<<hh(l);
    return 0;
}

Measured memory_bytes: 1792
n,m,c = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
codes = []
n.times do |i|
  codes << gets.split.map(&:to_i)
end

cnt = 0
codes.each do |a|
  sum = 0
  m.times do |i|
    temp = a[i] * b[i]
    sum += temp
  end
  if sum + c > 0
    cnt += 1
  end
end

p cnt


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(50)

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long
#define double long double

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

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

  int N; cin >> N;
  vector<INTP> vec(N);
  REP(i, N){
    int a, b; cin >> a >> b;
    vec[i].first = a+b; vec[i].second = a-b;
  }
  sort(ALL(vec));
  int right = -VERYBIG, ans = 0;
  REP(i, N){
    if(vec[i].second >= right){
      right = vec[i].first; ans++;
    }
  }
  cout << ans << endl;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll nCrmod(ll n,ll r){ll x=1,y=1; rep(i,r){x=x*(n-i)%mod; y=y*(i+1)%mod;} return x*powmod(y,mod-2)%mod;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

map<long long,long long> prime_factor(long long n) {
    map<long long,long long> ret;
    for(long long i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

int main()
{
	ll n;
	cin >> n;
	map<ll,ll> m=prime_factor(n);
	cout << n << ":";
	for(auto&& e:m){
		rep(i,e.second) cout << " " << e.first;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;

using namespace std;

const long long MOD = 1000000007;

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

	int n;
	string s;
	cin >> n >> s;

	int num[10][11][11] = {0};

	rep(i, n) {
		int p = s[i] - '0';

		rep(j, 10) {
			if (num[j][10][10] != 0) {
				rep(k, 10) {
					if (num[j][k][10] != 0) {
						num[j][k][p] = 1;
					}
					else if(k == p){
						num[j][k][10] = 1;
					}
				}
			}
			else if (j == p) {
				num[j][10][10] = 1;
			}
		}
	}

	int sum = 0;
	rep(i, 10) {
		rep(j, 10) {
			rep(k, 10) {
				sum += num[i][j][k];
			}
		}
	}

	cout << sum << "\n";

	return 0;
}


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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 100500;

ll sum;
int n, a[N];

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;
	
	cin >> n;

	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		sum += a[i];
	}

	ll val = n * (n + 1ll) / 2;

	if (sum % val) {
		cout << "NO";
		return 0;
	}

	ll cnt = sum / val;

	for (int i = 1; i <= n; i++) {
		ll diff = a[i % n + 1] - a[i];
		if (cnt < diff || (cnt - diff) % n) {
			cout << "NO";
			return 0;
		}
	}

	cout << "YES";
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 640
#define rep(i,n) REP(i,0,n)
#define REP(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;


int main(void) {
   int N,A,B;
   cin>>N>>A>>B;
   cout<<min(N*A,B)<<endl;


   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U & u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U & u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll L, R;
	cin >> L >> R;
	if (R - L >= 2019) {
		cout << 0 << endl;
		return 0;
	}
	vvi V(2020);
	REP(i, 2020) {
		REP(j, 2020) {
			V[i].push_back( (i * j) % 2019);
		}
	}
	vi A;
	for (int i = L; i <= R; i++) {
		A.push_back(i % 2019);
	}
	so(A);
	int ans = 2018;
	REP(i, SZ(A)) {
		REP(j, i) {
			chmin(ans,( A[i] * A[j]) % 2019);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 16512
n, m = map(int, input().split())
lst = []
for i in range(m):
    lst.append(int(input()))
safe = [True] * (n+2)
for a in lst:
    safe[a+1] = False #壊れた床をリスト化

mod = 10**9 + 7
dp = [0] * (n+2)
dp[1] = 1
for i in range(2, n+2):
    if safe[i] == True:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
    else:
        dp[i] = 0
print(dp[n+1])

Measured memory_bytes: 8616
#define _CRT_NO_SECURE_WARNINGS
#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <string>
#include <iomanip>
#include <set>
#include <random>
#include <queue>
#include <map>
#include <ctime>
#include <sstream>
#include <cstdlib>
using namespace std;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using namespace std; int INF = 1e6; typedef long long ll; typedef double d; typedef unsigned long long ull;

void solve() {
	int s, w;
	cin >> s >> w;
	if (s > w) {
		cout << "safe" << endl;
		return;
	}
	cout << "unsafe" << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("solver.txt", "r", stdin);
	solve();
	return 0;
}

Measured memory_bytes: 3020
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if ((A % 2 != 0 || B % 2 != 0 || C % 2 != 0)) {
    printf("0\n");
    return 0;
  }
  if (A == B and B == C) {
    printf("-1\n");
    return 0;
  }

  int cnt = 0;
  while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
    int _A = A;
    int _B = B;
    int _C = C;
    A = _B / 2 + _C / 2;
    B = _A / 2 + _C / 2;
    C = _A / 2 + _B / 2;
    ++cnt;
  }
  printf("%d\n", cnt);
}

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

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

int main(){
    int n,ans=0;
    cin>>n;
    for(int i=1;i*i<=n;i++){
        ans=i*i;
    }
    cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>

const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

int main(){
    ll N;
    cin>>N;
    cout<<N*(N-1)/2<<endl;
}

Measured memory_bytes: 384