akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool chmax(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF 1000000007 //4000000000000000037
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

  int H,W;
  cin>>H>>W;

  const int MAXN=10; // 変える // warshall_floyd
  int dist[MAXN][MAXN];
  rep(i,MAXN){
    rep(j,MAXN){
      dist[i][j]=INF;
    }
    dist[i][i]=0;
  }

  rep(i,10){
    rep(j,10){
      int cc;
      cin>>cc;
      dist[i][j]=cc;
    }
  }

  rep(k,MAXN) rep(i,MAXN) rep(j,MAXN) dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
  //warshall_floyd end

  ll ans=0;
  rep(i,H*W){
    int x; cin>>x;
    if(x==-1) continue;
    ans+=dist[x][1];
  }

  cout<< ans<<"\n";

}

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


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> n;
	//vector<ll>	aa(n);
	m = INFL;
	for(i=0;i<5;i++) {
		cin >> a;
		m = min(m,a);
	}
	ans = (n + m - 1) / m + 4;
	//vector<ll>	dp(n+1,INFL);
	//vector<vector<ll>>	dp2(x , vector<ll>(y,INFL));

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


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

int n, tmp, ans;
vector<int> a;
set<int> s;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		a.push_back(tmp);
		if (i % 2 == 0)
			s.insert(tmp);
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < n; i += 2)
		if (s.find(a[i]) == s.end())
			ans++;
	cout << ans;
}

Measured memory_bytes: 2936
N, K = map(int,input().split())

if K%2 == 0:
  KK = K/2
  a = int(N/K)
  b = int((N+KK)/K)
  print(a**3+b**3)
else:
  KK = 0
  a = int(N/K)
  print(a**3)

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

using namespace std;

int main()
{
    int X, hapiness = 0; cin >> X;

    hapiness += (1000 * (int)(X/500));

    X -= (int)(X/500) * 500;

    hapiness += 5 * (int)(X/5);

    cout << hapiness << endl;

    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	n := readInt()
	s := readString()

	a := make([]int, n)
	for i, v := range s {
		switch v {
		case 'R':
			a[i] = 0
		case 'G':
			a[i] = 1
		case 'B':
			a[i] = 2
		}
	}
	count := make([]int, 3)
	for i := 0; i < n; i++ {
		count[a[i]]++
	}
	ans := 1
	for _, v := range count {
		ans *= v
	}

	for j := 1; j < n; j++ {
		for i := 0; i < j; i++ {
			k := j + j - i
			if k < n {
				if a[i] == a[j] {
					continue
				}
				if a[j] == a[k] {
					continue
				}
				if a[i] == a[k] {
					continue
				}
				ans--
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1800
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define INS(x) string (s); cin >> s
#define INL(x) ll (x); cin >> x
#define VINT(a,n) vector<int> a(n)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()

int main () {
  IN(n);
  IN(k);
  cout<<(k==1?0:n-k);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
   using namespace std;
    
   #define INIT() ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   #define Rep(i,n) for (int i = 0; i < (n); ++i)
   #define For(i,s,t) for (int i = (s); i <= (t); ++i)
   #define rFor(i,t,s) for (int i = (t); i >= (s); --i)
   #define ForLL(i, s, t) for (LL i = LL(s); i <= LL(t); ++i)
   #define rForLL(i, t, s) for (LL i = LL(t); i >= LL(s); --i)
  #define foreach(i,c) for (__typeof(c.begin()) i = c.begin(); i != c.end(); ++i)
  #define rforeach(i,c) for (__typeof(c.rbegin()) i = c.rbegin(); i != c.rend(); ++i)
   
  #define pr(x) cout << #x << " = " << x << "  "
  #define prln(x) cout << #x << " = " << x << endl
   
  #define LOWBIT(x) ((x)&(-x))
   
  #define ALL(x) x.begin(),x.end()
  #define INS(x) inserter(x,x.begin())
   
  #define ms0(a) memset(a,0,sizeof(a))
  #define msI(a) memset(a,inf,sizeof(a))
  #define msM(a) memset(a,-1,sizeof(a))
  
  #define MP make_pair
  #define PB push_back
  #define ft first
  #define sd second
   
  template<typename T1, typename T2>
  istream &operator>>(istream &in, pair<T1, T2> &p) {
      in >> p.first >> p.second;
      return in;
  }
   
  template<typename T>
  istream &operator>>(istream &in, vector<T> &v) {
      for (auto &x: v)
          in >> x;
      return in;
  }
   
  template<typename T1, typename T2>
  ostream &operator<<(ostream &out, const std::pair<T1, T2> &p) {
      out << "[" << p.first << ", " << p.second << "]" << "\n";
      return out;
  }
  
  inline int gc(){
      static const int BUF = 1e7;
      static char buf[BUF], *bg = buf + BUF, *ed = bg;
      
      if(bg == ed) fread(bg = buf, 1, BUF, stdin);
      return *bg++;
  } 
  
  inline int ri(){
      int x = 0, f = 1, c = gc();
      for(; c<48||c>57; f = c=='-'?-1:f, c=gc());
      for(; c>47&&c<58; x = x*10 + c - 48, c=gc());
      return x*f;
  }
   
  typedef long long LL;
  typedef unsigned long long uLL;
  typedef pair< double, double > PDD;
  typedef pair< int, int > PII;
  typedef pair< string, int > PSI;
  typedef set< int > SI;
  typedef vector< int > VI;
  typedef map< int, int > MII;
  typedef pair< LL, LL > PLL;
  typedef vector< LL > VL;
  typedef vector< VL > VVL;
  const double EPS = 1e-10;
  const LL inf = 0x7fffffff;
  const LL infLL = 0x7fffffffffffffffLL;
  const LL mod = 1e9 + 7;
  const int maxN = 3e5 + 7;
  const LL ONE = 1;
  const LL evenBits = 0xaaaaaaaaaaaaaaaa;
  const LL oddBits = 0x5555555555555555;
  
  LL N, M, K;
  
 int main(){
     INIT(); 
     cin >> M >> K;
     N = (1 << M) - 1;
 
     if(K > N) cout << -1 << endl;
     else if(M == 1) {
         if(K == 1) cout << -1 << endl;
         else cout << "0 0 1 1" << endl;
     }
     else {
         For(i, 0, N) if(i != K) cout << i << " ";
         cout << K << " ";
         rFor(i, N, 0) if(i != K) cout << i << " ";
         cout << K << " ";
         cout << endl;
     }
     return 0;
 }

Measured memory_bytes: 1792
import java.util.Scanner;

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

		long cnt = 0;
		for(long i = k+1; i <= n; i++) {
			if(n % i != 0) {
				cnt += (n / i) * (i - k) + Math.max(0, (n % i) - k + 1);
			} else {
				cnt += (n / i) * (i - k);
			}
		}
		if(k == 0) {
			cnt = n * n;
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 23252
s = input()
#print(s)
s1 =set(list(s[0:len(s):2]))
s2 =set(list(s[1:len(s):2]))
ki = set(['R','U','D'])
gu = set(['L','U','D'])

#print(s1,s2)
if ki.issuperset(s1) and gu.issuperset(s2):
  print('Yes')
else:
  print('No')
  
  

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
typedef long long ll;
int n;
ll sum, a[300000], res = 11000000000, s;
int main(void){
    // Your code here!
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    for (int i = 0; i < n - 1; i++) {
        s += a[i];
        res = min(res, abs(sum - s * 2));
    }
    cout << res << endl;
}


Measured memory_bytes: 1792
import std.stdio, std.string, std.conv, std.algorithm, std.math;
void main() {
	for (;;) {
		auto n = readln.chomp.to!real;
		if (n == 0) break;
		auto d = readln.split.to!(real[]);
		"%.8f".writefln(sqrt(d.map!(a => (a - d.reduce!"a + b"/n).pow(2)).sum / n));
	}
}

Measured memory_bytes: 2564
#include  <bits/stdc++.h>
using namespace std;
#define    error(args...){string _s=#args;replace(_s.begin(), _s.end(), ',', ' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);err(_it,args);}
void err  (istream_iterator<string> it) {}
template  <typename T, typename... Args>
void err  (istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a <<" ; ";
    err(++it, args...);
    cout << endl;
}
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
/*Let's start.............*/
#define   ll                long long
#define   pb                push_back
#define   ff                first
#define   ss                second
#define   srt(v)            sort(v.begin(),v.end())
#define   inf               2000000000000000000
#define   mxn               40000
#define   MOD               1000000007
#define   pi                acos(-1)
#define X first
#define Y second

int main()
{
   double keep;
   cin >> keep;
   ll cnt = 0;
   double n = 100.0;
   while(n < keep){
    cnt++;
    n += (n*0.01);
    ll peek = n;
    n = peek;
   }
   cout << cnt << endl;
}

/*-------------------------------------------------------------------------------------------------------------------------------------------------------
".....but the truth is that you can increase it slightly."
Day 35.
*/


Measured memory_bytes: 3716
#include <iostream>




int main(){
    long long  N,D;
    int ans=0;
    std::cin >> N >> D;
    long long X[N],Y[N];
    long long D2 = D*D;
    // std::cout << D2 <<std::endl;
    for (int i=0;i<N;i++){
        std::cin >> X[i] >> Y[i];
    }
    // std::cout << "D2:" << D2 << std::endl;
    for (int i=0;i<N;i++){
        long distance =(X[i]*X[i]) + (Y[i]*Y[i]);
        // std::cout << i <<" :distance :" << distance <<std::endl;

        bool hantei=(distance <= D2);
        if (distance <= D2){
            ans++;
            // std::cout <<"distance<=D2" << hantei <<std::endl;
        }
    }
            

    std::cout << ans << std::endl;



    

    return 0;


}


// int main(){
//     int N,D,ans=0;
//     std::cin >> N >> D;
//     long long X[N],Y[N];
//     long long D2 = D*D;
//     // std::cout << D2 <<std::endl;
//     for (int i=0;i<N;i++){
//         std::cin >> X[i] >> Y[i];
//     }
//     std::cout << "D2:" << D2 << std::endl;
//     for (int i=0;i<N;i++){
//         long distance =(X[i]*X[i]) + (Y[i]*Y[i]);
//         std::cout << i <<" :distance :" << distance <<std::endl;

//         bool hantei=(distance <= D2);
//         if (distance <= D2){
//             ans++;
//             std::cout <<"distance<=D2" << hantei <<std::endl;
//         }
//     }
            

//     std::cout << ans << std::endl;



    

//     return 0;


// }


Measured memory_bytes: 6736
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    sort(ALL(l));
    int ans = 0;
    rep(i, n) rep(j, i + 1, n)
    {
        int low = (upper_bound(ALL(l), l[j] - l[i]) - l.begin());
        for (int k = max(low, (int)i + 1); l[k] < l[i] + l[j] && k < j; k++)
        {
            if (i < k && k < j)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int n,k,ans,p;
int map[12][6]={
	{4,2,0,9,7},
	{1,10,8,6,4},
	{9,7,5,3,1},
	{6,4,2,0,9},
	{3,1,10,8,6},
	{0,9,7,5,3},
	{8,6,4,2,0},
	{5,3,1,10,8},
	{2,0,9,7,5},
	{10,8,6,4,2},
	{7,5,3,1,10}};
int main()
{
	scanf("%d%d",&n,&k);n-=2;
	p=n%11;n/=11;
	ans=n*5;
	for(int i=0;i<p;i++)
	 for(int j=0;j<5;j++)
	  if(map[i][j]==k)ans++;
	printf("%d\n",ans);
	return 0;
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 5050;

int k, q;
vector<ll> _d;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cin>>k>>q;
  _d.resize(k);
  for (int i=0; i<k; i++) {
    cin>>_d[i];
  }

  while (q--) {
    ll n, first, mod;
    cin>>n>>first>>mod;
    --n;
    vector<ll> d = _d;
    vector<ll> z(k);
    for (ll& x: d) x %= mod;
    
    for (int i=0; i<k; i++) {
      z[i] = (d[i]==0);
      if (i) z[i] += z[i-1];
    }
    
    for (int i=1; i<k; i++) d[i] += d[i-1];
    first %= mod;
    ll iters = n / k;

    ll zeros = iters*z[k-1] + (n%k>0 ? z[n%k - 1] : 0);
    ll around = first + iters*d[k-1] + (n%k>0 ? d[n%k - 1] : 0);

    ll res = n - zeros - around/mod;
    cout<<res<<"\n";    
  }
  

  return 0;
}
// don't forget to read in the input :^)


Measured memory_bytes: 384
import sys, math, itertools, bisect, copy, re, heapq
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle

# from functools import reduce
# from math import ceil, floor, log10, log2, factorial
# from pprint import pprint


INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** -7
sys.setrecursionlimit(1000000)

# N = int(input())
# N,M = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
# DP = [[0] * 100 for _ in range(100)]
# DP = defaultdict(lambda: float('inf'))

K = int(input())

MAX = 10 ** 16


def f(i, j):
    P = K % 50
    Q = i // 50
    if j < P:
        ret = 49 + 50 - P + 1 + Q
    else:
        ret = 49 - P + Q
    return ret


A = []
for j in range(50):
    A.append(f(K, j))

# print(A)
print(50)
print(" ".join([str(x) for x in A]))

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

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0; i<n; i++)
        cin>>a[i];
    sort(a.begin(),a.end());
    /*vector<long long int> b(n);
    b[0]=a[0];
    for(int i=1; i<n; i++)
        b[i] = b[i-1]+a[i];*/
    unsigned long long int c = 0;
    for(int i=0; i<n; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            for(int k=j+1; k<n; k++)
            {
                if(a[k]<a[i]+a[j] && a[i]<a[k]+a[j] && a[j]<a[i]+a[k] && a[i]!=a[j] && a[i]!=a[k] && a[k]!=a[j] )
                    c++;
            }    
        }
    }
    cout<<c;
}   

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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    ll ans = 0;
    vector<bool> prime(10000001, true);
    vector<ll> fact(10000001, 1);
    prime[0] = false;
    prime[1] = false;
    for (ll i = 2; i * i < 10000001; i++) {
        if (!prime[i]) continue;
        for (ll j = i * 2; j < 10000001; j += i) prime[j] = false;
    }
    for (ll i = 2; i < 10000001; i++) {
        if (!prime[i]) continue;
        ll x = i, k = 0;
        while (x < 10000001) {
            k++;
            for (ll j = x; j < 10000001; j += x) {
                fact[j] = fact[j] / k * (k + 1);
            }
            x *= i;
        }
    }
    for (ll i = 1; i <= N; i++) {
        ans += i * fact[i];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 82704
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<cstring>
#include<string>
#include<ctime>


using namespace std;

using ll = long long int;
using lln = long long unsigned;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const double PI = acos(-1.0);
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define all(v) v.begin(), v.end()
const long MOD = pow(10, 9) + 7;

char alfa[] = { 'A','B' ,'C','D' ,'E' ,'F' ,'G' ,'H' ,'I' ,'J' ,'K' ,'L' ,'M' ,'N' ,'O' ,'P' ,'Q' ,'R' ,'S' ,'T' ,'U' ,'V' ,'W' ,'X' ,'Y','Z' };

inline void finish() {
	cout << -1 << endl;
	exit(0);
}

unsigned GetDigit(double num) {
	return log10(num) + 1;
}

ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

class Mod {
public:
	static inline ll Add(ll a, ll b) {
		return (a + b) % MOD;
	}

	static inline ll Sub(ll a, ll b) {
		ll ans = (a - b) % MOD;
		return (ans < 0) ? (ans + MOD) : ans;
	}

	static inline ll Mul(ll a, ll b) {
		return (a * b) % MOD;
	}

	static inline ll Div(ll a, ll b) {
		return (a % MOD) * modinv(b, MOD) % MOD;
	}
};



template <typename T>
inline void debug(vector<T> v) {
	cout << "[";
	for (ll i = 0; i < v.size() - 1; ++i) {
		cout << v[i] << ", ";
	}
	cout << v[v.size() - 1] << "]" << endl;
}

void Main();
inline void DebugMain() {
	while (true) {
		Main();
	}
}

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

	bool debug = false;
	if (debug) {
		cout << "\x1b[41m" << "Debug Mode " << endl;
	}
	(debug) ? DebugMain() : Main();
	return 0;
}

int parmitation(ll N) {
	ll ans = 1;
	for (ll i = 1; i <= N; i++) {
		ans *= i;
	}

	return ans;
}

int SemiCommonMultiple(ll A, ll ANum, ll B, ll BNum, ll diff, ll max) {
	ll calc;
	calc = diff + B * BNum - A * ANum;

	if (diff + B * BNum > max) {
		return 0;
	}
	else {
		if (calc < 0) {
			SemiCommonMultiple(A, ANum, B, ++BNum, diff, max);
		}
		else if (calc > 0) {
			SemiCommonMultiple(A, ++ANum, B, BNum, diff, max);
		}
		else {
			return A * (ANum + 0.5);
		}
	}
}

inline void Main() {
	ll X, Y, N, M, K;
	vector<bool> A;
	vector<ll> B;
	ll M1 = 1, D1 = 0, M2 = 1, D2 = 0;
	ll ans, temp;
	ll sum = 0, WAcount = 0,ACcount =0, a = 0;
	double avg = 0.0;
	string S;
	string T;
	string Ans = "";
	bool b[8];
	bool flag = false;


	cin >> N >> M;

	A.resize(N);
	B.resize(N);

	for (ll i = 0; i < M; i++) {
		cin >> X >> S;
		if (S == "WA") {
			if (!A[X-1]) {
				B[X-1]++;
			}
		}
		else {
			if (!A[X - 1]) {
				A[X - 1] = true;
				WAcount += B[X - 1];
				ACcount++;
			}
		}
	}
	

	cout << ACcount << " " << WAcount;
}



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

lint ccc(int c0, int c1, int c2, int c3)
{
    lint t0 = ((c0 * 1000LL + c1) * 1000LL + c2) * 1000LL + c3;
    lint t1 = ((c1 * 1000LL + c2) * 1000LL + c3) * 1000LL + c0;
    lint t2 = ((c2 * 1000LL + c3) * 1000LL + c0) * 1000LL + c1;
    lint t3 = ((c3 * 1000LL + c0) * 1000LL + c1) * 1000LL + c2;
    return min(min(t0, t1), min(t2, t3));
}

int N;
vector<lint> cc, ccs;
vector<vector<int> > c;

int main()
{
    cin >> N;
    c.resize(N);
    cc.resize(N);
    for (int i = 0; i < N; i++)
    {
        int c0, c1, c2, c3;
        cin >> c0 >> c1 >> c2 >> c3;
        c[i] = vector<int>{c0, c1, c2, c3};
        cc[i] = ccc(c0, c1, c2, c3);
    }
    ccs = cc;
    sort(ccs.begin(), ccs.end());

    lint ans = 0;
    for (int i = 0; i<N; i++)
    {
        for (int j = 0; j < i; j++)
        {
            for (int r = 0; r < 4; r++)
            {
                lint cc0 = cc[i];
                lint cc1 = cc[j];
                lint cc2 = ccc(c[i][r], c[j][1], c[j][0], c[i][(1+r)%4]);
                lint cc3 = ccc(c[i][(1+r)%4], c[j][0], c[j][3], c[i][(2+r)%4]);
                lint cc4 = ccc(c[i][(2+r)%4], c[j][3], c[j][2], c[i][(3+r)%4]);
                lint cc5 = ccc(c[i][(3+r)%4], c[j][2], c[j][1], c[i][r]);

                map<lint, int> mc;
                mc[cc2]++;
                mc[cc3]++;
                mc[cc4]++;
                mc[cc5]++;
                lint ans_tmp = 1;
                for (auto v : mc)
                {
                    int n = upper_bound(ccs.begin(), ccs.end(), v.first) - lower_bound(ccs.begin(), ccs.end(), v.first);
                    if (v.first == cc0) n--;
                    if (v.first == cc1) n--;
                    if (n < 1) ans_tmp = 0;
                    for (int k = 0; k < v.second; k++)
                    {
                        ans_tmp *= n;
                        n--;
                    }
                }
                vector<lint> cct{cc2, cc3, cc4, cc5};
                for (auto v : cct)
                {
                    if (!(v % 1001001001LL)) ans_tmp *= 4;
                    else if (!(v % 1000001LL)) ans_tmp *= 2;
                }
                ans += ans_tmp;
            }
        }
    }
    cout << ans / 3 << endl;
}


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

using namespace std;

typedef long long ll;

int main(){
	int n; ll x; cin >> n >> x;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll ans = 0;
	for (int i = 1; i < n; i++) {
		ll t = min(a[i], max(a[i - 1] + a[i] - x, 0ll));
		a[i] -= t; ans += t;
	}
	for (int i = n - 2; i >= 0; i--) {
		ll t = min(a[i], max(a[i + 1] + a[i] - x, 0ll));
		a[i] -= t; ans += t;
	}
	cout << ans << '\n';
}


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

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

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

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

    ll N;
    cin >> N;

    ll M = N*(N-1)/2;
    M -= N/2;
    cout << M << endl;
    if(N%2 == 0){
    	for(int i=1;i<=N;i++){
    		for(int j=1;j<=N;j++){
    			if(i < j){
    				if(i+j != N+1){
    					cout << i << " " << j << endl;
    				}
    			} 
    		}
    	}
    }else{
    	for(int i=1;i<=N;i++){
    		for(int j=1;j<=N;j++){
    			if(i < j){
    				if(i+j != N){
    					cout << i << " " << j << endl;
    				}
    			} 
    		}
    	}
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int N = sc.nextInt();
            String s = sc.next();
            String a = s.substring(0, N/2);
            String b = s.substring(N/2, N);
            if(a.equals(b)){
              System.out.println("Yes");
            } else {
              System.out.println("No");
            }
            }
}


Measured memory_bytes: 21716
import heapq
n,k=map(int,input().split())
td=[[0]*2 for _ in range(n)]
for i in range(n):
    t,d=map(int,input().split())
    td[i][0],td[i][1]=d,t
td.sort(reverse=True)
di=set()
sa=[]
heapq.heapify(sa)
ans=0
for d,t in td[:k]:
    if t in di:
        heapq.heappush(sa, d)
    else:
        di.add(t)
    ans+=d

s=[-10**18]*(k+1)
cnt=len(di)
s[cnt]=ans
for d,t in td[k:]:
    if t in di:
        continue
    else:
        if sa:
            x=heapq.heappop(sa)
            ans+=d-x
            di.add(t)
            cnt+=1
            s[cnt]=ans

for i in range(k+1):
    s[i]+=i*i

print(max(s))

Measured memory_bytes: 25788
#include <bits/stdc++.h>
#define reg register
#define ll long long
#define ull unsigned long long
using namespace std;
const int MAXN = 1010;
const int MAXM = 50;
int X[MAXN], Y[MAXN], len[MAXM];
int n;
char s[MAXM];
void work() {
  scanf("%d", &n);
  for(reg int i = 1; i <= n; ++i) scanf("%d%d", &X[i], &Y[i]);
  int tmp = abs(X[1] + Y[1]) % 2;
  for(reg int i = 1; i <= n; ++i) {
    if(abs(X[i] + Y[i]) % 2 != tmp) {
      puts("-1");
      return;
    }
  }
  printf("%d\n", 32 - tmp);
  int tot = 0;
  len[++tot] = 1;
  printf("1");
  if(tmp) {
    for(reg int i = 1; i <= 30; ++i) printf(" %d", len[++tot] = (1 << i));
    puts("");
  } else {
    for(reg int i = 0; i <= 30; ++i) printf(" %d", len[++tot] = (1 << i));
    puts("");
  }
  for(reg int i = 1; i <= n; ++i) {
    ll nowx = 0, nowy = 0;
    for(reg int j = tot; j >= 1; j--) {
      ll nxtx = X[i] - nowx, nxty = Y[i] - nowy;
      if(abs(nxtx) > abs(nxty)) {
        if(nxtx > 0) nowx += len[j], s[j] = 'R';
        else nowx -= len[j], s[j] = 'L';
      } else {
        if(nxty > 0) nowy += len[j], s[j] = 'U';
        else nowy -= len[j], s[j] = 'D';
      }
    }
    printf("%s\n", s + 1);
  }
}
signed main() {
  int _ = 1;
  // scanf("%d", &_);
  while(_--) {
    work();
  }
  return 0;
}


Measured memory_bytes: 3808
from decimal import Decimal
import math
for _ in range(int(input())):
    x1,y1,x2,y2,x3,y3=list(map(Decimal,input().split()))
    a=x1-x3
    b=y2-y3
    c=x2-x3
    d=y1-y3
    e=y1-y2
    f=x1+x3
    g=x2+x3
    X=(b*d*e+a*b*f-c*d*g)/2/(a*b-c*d)
    try:
        Y=-(a/d)*(X-f/2)+(y1+y3)/2
    except:
        Y=-(c/b)*(X-g/2)+(y2+y3)/2
    R=math.sqrt((x1-X)**2+(y1-Y)**2)
    print(" ".join(["{:.3f}".format(i) for i in [X,Y,R]]))


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

int main() {
    int A,B,C,D,E,F;
    cin>>A>>B>>C>>D>>E>>F;
    int w=-1,s=-1;
    for(int i=0;i<=30;i++) {
        for(int j=0;j<=30;j++) {
            for(int k=0;k<=100;k++) {
                for(int l=0;l<=100;l++) {
                    int water=100*(A*i+B*j);
                    int sugar=C*k+D*l;
                    if(water==0||water+sugar>F||water*E<100*sugar) break;
                    if(w==-1||s*(water+sugar)<sugar*(w+s)) {
                        w=water;
                        s=sugar;
                    }
                }
            }
        }
    }
    cout<<w+s<<" "<<s<<endl;
}

Measured memory_bytes: 256
s=list(input())
ans=""
cnt=0
if s[0]=="0":
  for i in range(len(s)):
    if i%2==0:
      ans+="0"
    else:
      ans+="1"
else:
  for i in range(len(s)):
    if i%2==0:
      ans+="1"
    else:
      ans+="0"
for i in range(len(s)):
  if s[i]!=ans[i]:
    cnt+=1
print(cnt)

Measured memory_bytes: 3956
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        String result = s;
        while (result.contains("B")) {
            result = result.replaceAll("[01]B", "");
            result = result.replaceAll("^B", "");
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 23636
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < ( int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

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

	if ((n - 1) % (k - 1) == 0) {
		cout << (n - 1) / (k - 1) << endl;
	}
	else {
		cout << (n - 1) / (k - 1) +1<< endl;
	}

}

Measured memory_bytes: 256
#!/usr/bin/env python3


def main():
    t_HP, t_AT, a_HP, a_AT = map(int, input().split())

    while True:
        a_HP -= t_AT
        if a_HP <= 0:
            print('Yes')
            return
        t_HP -= a_AT
        if t_HP <= 0:
            print('No')
            return


if __name__ == "__main__":
    main()


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

const int INF = 1001001001;

int a[12][12];

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    rep(i,n) {
        cin >> c[i];
    rep(j,m) cin>> a[i][j];
    }

    int ans = INF;
    rep(s,1<<n) {
        int cost = 0;
        vector<int> d(m);
        rep(i,n) {
            if (s>>i&1) {
                cost += c[i];
            rep(j,m) d[j] += a[i][j];
            }
        }
        bool ok = true;
        rep(j,m) if (d[j] < x) ok = false;
        if (ok) ans = min(ans, cost);
    }
    if (ans == INF) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define EPS (1e-7)
using namespace std;

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

  double A=0;
  for(int i=0;i<t;i++){
    int n,m;
    cin>>n>>m;
    double v[101],r[101],p=0,a=0;
    for(int j=0;j<m;j++)cin>>v[j]>>r[j],p+=r[j];
    p=1-p;
    while(p>EPS){
      for(int j=0;j<m;j++) r[j]+=p*r[j];
      p*=p;
    }
    for(int j=0;j<m;j++) a+=v[j]*r[j];
    A=max(A,a);
  }

  int n,m;
  cin>>n>>m;
  double v[101],r[101],p=0,B=0;
  for(int i=0;i<m;i++) cin>>v[i]>>r[i],p+=r[i];
  p=1-p;
  while(p>EPS){
    for(int i=0;i<m;i++) r[i]+=p*r[i];
    p*=p;
  }
  for(int i=0;i<m;i++) B+=v[i]*r[i];
  if(A>B+EPS) cout <<"YES"<<endl;
  else cout <<"NO"<<endl;
  return 0;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int b1 = 0, b2 = 0, b4 = 0;
            foreach (var x in a)
            {
                var count = 0;
                var tmp = x;
                while (tmp % 2 == 0 && count < 2)
                {
                    count++;
                    tmp /= 2;
                }

                if (count == 0) b1++;
                else if (count == 1) b2++;
                else b4++;
            }

            if (b2 == 0)
            {
                if (b1 <= b4 + 1)
                    Console.WriteLine("Yes");
                else
                    Console.WriteLine("No");
            }
            else
            {
                if (b1 <= b4)
                    Console.WriteLine("Yes");
                else
                    Console.WriteLine("No");
            }

        }
    }
}


Measured memory_bytes: 19680
//header{{{
#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 all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
constexpr int MOD = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}

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

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

    int n;
    cin >> n;
    vector<vector<pii> > g(n+1);

    rep(i,n-1){
        int a,b,c;
        cin >> a >> b >> c;
        g[a].emplace_back(b,c);
        g[b].emplace_back(a,c);
    }

    int q,k;
    cin >> q >> k;

    vector<int> min_cost(n+1,LINF);
    min_cost[k] = 0;
    min_heap<pii> pq;
    pq.emplace(0,k);

    while(!pq.empty()){
        int now,cost;
        tie(cost,now) = pq.top();
        pq.pop();
        if(min_cost[now] < cost) continue;
        rep(i,g[now].size()){
            int next,ncost;
            tie(next,ncost) = g[now][i];
            if(chmin(min_cost[next],min_cost[now] + ncost)){
                pq.emplace(ncost,next);
            }
        }
    }

    rep(i,q){
        int x,y;
        cin >> x >> y;

        cout << min_cost[x] + min_cost[y] << '\n';

    }

    return 0;
}


Measured memory_bytes: 11120
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var nq = Input.ar;
        var seg = new Seg(nq[0]);
        var res = new List<long>();
        while (nq[1]-- > 0)
        {
            var qu = Input.ar;
            if (qu[0] == 0)
                seg.Update(qu[1], qu[2]);
            else res.Add(seg.query(qu[1], qu[2] + 1));
        }
        WriteLine(string.Join("\n", res));
    }
    class Seg
    {
        private List<long> item;
        private int _num;
        public int Parent(int index)
            => (index + 1) / 2 - 1;
        public int Left(int index)
            => 2 * index + 1;
        public int Right(int index)
            => 2 * (index + 1);
        public Seg(int num)
        {
            var inf = (1L << 31) - 1;
            _num = 1;
            while (_num < num)
                _num *= 2;
            item = new List<long>(2 * _num - 1);
            for (var i = 0; i < 2 * _num - 1; i++)
                item.Add(inf);
        }
        public void Update(int index,int value)
        {
            var ii = _num + index - 1;
            item[ii] = value;
            while (Parent(ii) >= 0)
            {
                ii = Parent(ii);
                item[ii] = Min(item[Left(ii)], item[Right(ii)]);
            }
        }
        public long query(int left, int right)
            => query(left, right, 0, 0, _num);
        private long query(int left,int right,int k,int l,int r)
        {
            if (r <= left || right <= l) return (1L << 31) - 1;
            if (left <= l && r <= right) return item[k];
            else
                return Min(query(left, right, Left(k), l, (l + r) / 2), query(left, right, Right(k), (l + r) / 2, r));
        }
    }
}
public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 23704
import sys
import os
import math
import bisect
import collections
import itertools

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def f(A, B, x):
    return math.floor(A * x / B) - A * math.floor(x / B)


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    S = [collections.Counter(iss()) for _ in range(N)]

    values = {}
    for s in S:
        for k, v in s.items():
            values[k] = min(l[k] for l in S if k in s)

    ret = []
    for k, v in values.items():
        ret += [k] * v

    print("".join(sorted(ret)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3500
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

long f(int x, int y, int z)
{
  const auto a = x + y + z;
  return a * a - (x * y + y * z + z * x);
}

std::vector<long> solve(int n)
{
  std::vector<long> result(n);
  const int max = std::sqrt(n) + 1;
  for (int i = 1; i <= max; ++i) {
    for (int j = 1; j <= max; ++j) {
      for (int k = 1; k <= max; ++k) {
        const auto v = f(i, j, k);
        if (v > n) break;
        ++result.at(v - 1);
      }
    }
  }
  return result;
}

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

  std::cout << std::setprecision(20);
  const auto values = solve(n);
  for (auto v : values) {
    std::cout << v << std::endl;
  }
}


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

int main(){
  string S; cin >> S;
  int N=S.size();
  
  // 2019 = 3 * 673(prime)
  // 673の倍数判定で組をためる
  int cur=0;
  int d=1;
  vector<vector<int>> q(673,vector<int>());
  q[0].push_back(N);
  for(int i=N-1; i>=0; i--){
    cur=(cur+d*(S[i]-'0'))%673;
    q[cur].push_back(i);
    d=(d*10)%673;
  }
  
  // 3の倍数判定をためた組に行う
  int th[200010];
  th[N]=th[N+1]=0;
  for(int i=N-1; i>=0; i--){
    th[i]=th[i+1]+(S[i]-'0');
  }
  
  long long count=0;
  for(int i=0; i<673; i++){
    for(int j=0; j<(int)q[i].size(); j++){
      for(int k=j+1; k<(int)q[i].size(); k++){
        if((th[q[i][k]]-th[q[i][j]])%3==0) count++;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 5808
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll k,x; cin >> k >> x;
  FOR(i,x-k+1,x+k){
      cout << i << " " ;
  }
  cout << endl;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#define ll long long
using namespace std;



int main(){
  ll P,Q,R;
  ll keiro1,keiro_ans;
  cin>>P>>Q>>R;
  keiro1=max(P,Q);
  keiro1=max(keiro1,R);
  keiro_ans=P+Q+R-keiro1;
  cout<<keiro_ans<<endl;
  

  return 0;
}

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

namespace _0268
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = RInt();
            for (int i = 0; i < n; i++)
            {
                Solve();
            }
        }

        private static void Solve()
        {
            string s = RSt();
            int value = Convert.ToInt32(s, 16);

            bool IsNegativeNum = value < 0;
            int integralPart = (value >> 7) & 0xffffff;
            decimal decimalPart = (value & 0x7f) / (decimal)Math.Pow(2, 7);

            decimal res = integralPart + decimalPart;
            Console.WriteLine("{0}{1}", IsNegativeNum ? "-" : "", res.ToString("0.0######"));
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 20284
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
// 1,000,000,000,000,001
int main(void)
{
  ll n, mo;
  int exp = 1;
  char i;
  ll exmax = 26;
  ll max[12] = {0};
  ll mdif[12] = {1};
  //char c[27];// c[1] = 97,,,,c[26] = 122
  scanf("%lld", &n);
  while (1)
  {

    max[exp] = max[exp - 1] + mdif[exp - 1] * 26;
    mdif[exp] = mdif[exp - 1] * 26;
    //printf("%lld %lld\n", max[exp], mdif[exp]);
    if (n <= max[exp] || (exp == 11))
      break;
    exp++;
  } // ともに1 ~ 有効
  //max[exp-1] ~ max[exp]までに答えがある。その間にはmdif[exp]個の要素がある
  //また現れる文字の数はexp個
  while (exp > 1)
  {
    for (i = 1; i <= 26; i++)
    {
      if ((max[exp - 1] + mdif[exp - 1] * i) >= n)
        break;
    }
    //printf("%d   ", i);
    printf("%c", i + 96);
    n -= i * mdif[exp - 1];
    /*    mo = (long double)n / mdif[exp - 1] + 0.5;
    if (mo == 0)
    {
      printf("z\n");
    }
    else
    {
      printf("%lld\n", mo);
      //printf("%c", (char)mo + 96);
    }
    //printf("%lld   ", mo);
    n -= mo * mdif[exp - 1];
    printf("%lld %lld\n", n, mdif[exp - 1]);*/
    exp--;
  }
  //printf("\n%lld\n", n);
  if (n == 0)
  {
    printf("z\n");
  }
  else
  {
    //printf("%lld\n", n);
    printf("%c\n", (char)n + 96);
  }
  //
  return 0;
}


Measured memory_bytes: 1736
# include <stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  int q = n;
  int f_n = 0;
  for (int i = 0; i < 9; i++){
    f_n += q % 10;
    q /= 10;
    if(!q){
      break;
    }
  }
  if (!(n % f_n)){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int i;
bool a;
 
int main() {
  string str;
  i=2;
  a=false;
  cin>>str;
  if(str.at(0)=='h'&& str.at(1)=='i'&&str.size()%2==0){
    a = true;
    while(i<str.size()){
      if(str.at(i)==str.at(i-2)){
        a = true;
      } else {
        a=false;
      }
      i++;
    }
  }
  if(a==true){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };



int roman_to_n(const string& s)
{
	static const int num[] = { 1, 5, 10, 50, 100, 500, 1000 };
	static const char* roman = "IVXLCDM";

	vector<int> digits(s.size());
	for (int i = 0; i < s.size(); ++i)
		digits[i] = num[strchr(roman, s[i]) - roman];

	int res = accumulate(digits.begin(), digits.end(), 0);
	for (int i = 0; i < digits.size() - 1; ++i)
		if (digits[i] < digits[i + 1])
			res -= 2 * digits[i];
	return res;
}
string to_roman(int n)
{
	static const char* roman[][10] = {
		{ "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX" }, 
		{ "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC" },
		{ "", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM" },
		{ "", "M", "MM", "MMM", "MMMM", "MMMMM" },
	};

	stringstream res;
	for (int i = 3, j = 1000; i >= 0; --i, j /= 10)
		res << roman[i][(n / j) % 10];
	return res.str();
}
int main()
{
	string s;
	while (cin >> s)
		cout << roman_to_n(s) << endl;
}

Measured memory_bytes: 0
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = [0] * (K * K)
for itra, a in enumerate(A):
  if itra >= K:
    break
  for itrb, b in enumerate(B):
    AB[itra * K + itrb] = (a + b)
    if itrb >= K - 1:
      break
    
AB.sort(reverse=True)    
    
ABC = [0] * (K * K)
for itrab, ab in enumerate(AB):
  if itrab >= K:
    break
  for itrc, c in enumerate(C):
    ABC[itrab * K + itrc] = (ab + c)
    if itrc >= K - 1:
      break
    
ABC.sort(reverse=True)
for itr, i in enumerate(ABC):
  print(i)
  if itr >= K - 1:
    break


Measured memory_bytes: 207212
#include <stdio.h>

int main(){
    int n;
    int i;
    int a[100];

    scanf("%d",&n);

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

    for(i = n-1; i >= 0; i--){
        printf("%d",a[i]);
        if(i != 0){
            printf(" ");
        }else{
            printf("\n");
        }
    }

    return 0;
}


Measured memory_bytes: 2048
N,M,X = map(int,input().split())
l = [[]]
for i in range(N):
  l.append(list(map(int,input().split())))

cnt = float("inf")
for i in range(2**N):
  bs = "0" + format(i,"0{}b".format(N))
  ansl = [0 for _ in range(M+1)]
  for j in range(1,N+1):
    if bs[j] == "1":
      for k in range(M+1):
        ansl[k] += l[j][k]
  #判定
  for j in range(1,M+1):
    if ansl[j] < X:
      break
    if j == M:
      cnt = min(cnt,ansl[0])
if cnt == float("inf"):
  cnt = -1      
print(cnt)        

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

const char lf = '\n';

namespace ae86
{
	const int bufl = 1<<15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 303;

int n,m,mo;
lint f[_][_][_]={0};

int main()
{
	ios::sync_with_stdio(0),cout.tie(nullptr);
	
	n=ty(),m=ty(),mo=ty();
	f[0][1][0]=1;
	for(int i=0;i<=n;i++)
		for(int j=1;j<=m;j++)
			for(int k=i;k>=0;k--)
			{
				if(k)f[i][j][k-1]=(f[i][j][k-1]+f[i][j][k])%mo;
				else f[i][j+1][i]=(f[i][j+1][i]+f[i][j][k])%mo;
				f[i+1][j][k]=(f[i+1][j][k]+f[i][j][k]*(k+1)%mo)%mo;
			}
	cout<<f[n][m][0]<<lf;
	
	return 0;
}


Measured memory_bytes: 217344