akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ld long double
#define mem(a,b) memset(a,b,sizeof(a) )
#define M 4000010
#define md 1000000007

ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}
/*inline ll add(ll a,ll b){return (a+b)%md;}
inline ll mul(ll a,ll b){return (a*b)%md;}
ll f[M],iv[M];
ll C(ll n,ll r){return mul(f[n],mul(iv[r],iv[n-r]));}
void prep_fac(){
    f[0]=1;
    rep(i,1,M)f[i]=mul(i,f[i-1]);
    iv[M-1]=power(f[M-1],md-2,md);
    for(ll i=M-2;i>=0;--i)iv[i]=mul(i+1,iv[i+1]);
}*/



int main()
{
	IOS;
	int n;
	cin>>n;
	int a[n+1]={0};
	for(int x=1;x<=100;x++)
	{
		for(int y=1;y<=100;y++)
		{
			for(int z=1;z<=100;z++)
			{
				ll ans=x*x+y*y+z*z+x*y+y*z+z*x;
				if(ans<=n)
				a[ans]++;
			}
		}
	}
	for(int i=1;i<=n;i++)
	cout<<a[i]<<endl;
}



Measured memory_bytes: 3688
s=input()
t=input()

sl=len(s)
tl=len(t)

for i in range(sl-tl+1):
  #print(i,"番目の固定の検査を開始")
  first=sl-tl-i
  flag="True"
  for j in range(tl): #固定されたTのそれぞれの文字に対して検査をする
    if s[first+j]!="?": #Tのj文字目に該当するsの文字が?でない場合、
      if s[first+j]!=t[j]:
        flag="False" #一つでも一致しない場合は外側のfor文を次のループへ。
        break
  if flag=="False":
    #print("この番目ではtはむり。")
    continue
  else: #全てのTの文字に対して、この番目でありえるならそれが答え。
    #print("この番目")
    s=list(s)
    s[first:first+tl]=t
    for j,k in enumerate(s):
      if k=="?":
        s[j]="a"
    print("".join(s))
    exit()
print("UNRESTORABLE")

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

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

  LL ans = 0;
  for (int i = 1; i < n; i ++) {
    ans += min(b, (x[i] - x[i - 1]) * a);
  }

  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
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; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int dp[3010][3010];
int f[3010][3010];

template<class T> vector<T> lcs(vector<T> a, vector<T> b) { // O(nm)
  int n = a.size();
  int m = b.size();
  REP(i,n) {
    REP(j,m) {
      if (a[i] == b[j]) {
        dp[i+1][j+1] = dp[i][j] + 1;
        f[i+1][j+1] = 0;
      } else if (dp[i+1][j] > dp[i][j+1]) {
        dp[i+1][j+1] = dp[i+1][j];
        f[i+1][j+1] = 1;
      } else {
        dp[i+1][j+1] = dp[i][j+1];
        f[i+1][j+1] = -1;
      }
    }
  }
  vector<T> res;
  for (int i=n, j=m; i>0&&j>0;) {
    if (f[i][j]>0) --j;
    else if (f[i][j]<0) --i;
    else {--i;--j;res.push_back(a[i]);}
  }
  reverse(ALL(res));
  return res;
}

int main() {
  string s, t;
  while(cin>>s>>t) {
    vector<char> c1(ALL(s));
    vector<char> c2(ALL(t));
    auto res = lcs(c1,c2);
    cout << string(res.begin(), res.end()) << endl;
  }
}


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

#define rep(i, s, n) for (int i = s; i < n; ++i)
#define rrep(i, n) for (int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
typedef long long ll;
typedef pair<int, int> P;

bool judge(vector<ll> h, ll a, ll b, ll cnt, ll n) {
    rep(i, 0, n) {
        h[i] -= b * cnt;
    }
    ll d = a - b;
    rep(i, 0, n) {
        if (h[i] < 0) return true;
        ll e = h[i] / d;
        if (h[i] % d != 0) e++;
        h[i] -= e * d;
        cnt -= e;
        if (cnt < 0) return false;
    }
    return true;
}

void func(long long N, long long A, long long B, std::vector<long long> h) {
    sort(rall(h));
    ll m_cnt = h[0] / B;
    ll ng = 0;
    ll ok = m_cnt + 1;

    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;

        if (judge(h, A, B, mid, N))
            ok = mid;
        else
            ng = mid;
    }
    cout << ok << endl;
}

int main() {
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld", &N);
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    std::vector<long long> h(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &h[i]);
    }
    func(N, A, B, std::move(h));
    return 0;
}


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

int main () {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) {
        a.push_back(a[i] + 1);
        a.push_back(a[i] - 1);
    }
    vector<int> ans(110000);
    rep(i, a.size()) {
        if (a[i] >= 0) ans[a[i]]++;
    }
    int Max = 0;
    rep(i, ans.size()) Max = max(Max, ans[i]);
    cout << Max << endl;
}

Measured memory_bytes: 1896
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd
import time


def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    N= int(sys.stdin.readline())
    A = list(map(int,sys.stdin.readlines()))
    l = sorted(A)
    m1 = l[-1]
    m2 = l[-2]
    for i in range(N):
        if A[i] == m1:
            print(m2)
        else:
            print(m1)


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

const long long MAX=510000;
//階乗,逆元,逆元の階乗
long long fac[MAX],inv[MAX],finv[MAX];
//テーブルを作る前処理
void COMinit() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
//二項係数計算
long long COM(long long n,long long k){
    if (n<k) return 0;
    if (n<0||k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
int main(){
    COMinit();
    bool used[100010]={};
    int n; cin>>n;
    int a[n+1],l,r,zwei;
    rep(i,n+1){
        cin>>a[i];
        if(used[a[i]]){
            zwei=a[i],r=i;
        }
        used[a[i]]=1;
    }
    rep(i,n+1){
        if(a[i]==zwei){
            l=i; break;
        }
    }
    // cout<<l<<" "<<r<<endl;
    rep(i,n+1){
        cout<<(COM(n+1,i+1)+MOD-COM(l+n-r,i))%MOD<<endl;
    }

    return 0;
}


Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    ll X, Y;
    cin >> X >> Y;
    ll c = 0;
    while (X <= Y) {
      X *= 2;
      c++;
    }
    cout << c << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	mod := newModInt(1e9 + 7)
	N := readI()

	ans := mod.add(mod.sub(mod.pow(10, N), mod.mul(mod.pow(9, N), 2)), mod.pow(8, N))
	fmt.Println(ans)
}

// Modular arithmetic utils
type modInt struct {
	modNum int
}

func newModInt(mod int) *modInt {
	m := modInt{modNum: mod}
	return &m
}

func (m modInt) mod(a int) int {
	a %= m.modNum
	if a < 0 {
		return a + m.modNum
	}
	return a
}

func (m modInt) pow(base, exponent int) int {
	res := 1
	for exponent > 0 {
		if exponent&1 == 1 {
			res = m.mod(res * base)
		}
		base = m.mod(base * base)
		exponent >>= 1
	}
	return res
}

func (m modInt) inv(a int) int {
	return m.pow(a, m.modNum-2)
}

func (m modInt) add(a, b int) int {
	return m.mod(a + b)
}

func (m modInt) sub(a, b int) int {
	return m.mod(a - b)
}

func (m modInt) mul(a, b int) int {
	return m.mod(a * b)
}

func (m modInt) div(a, b int) int {
	return m.mul(a, m.inv(b))
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-2.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

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

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}


Measured memory_bytes: 1780
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
import sys
import heapq

INF = float('inf')


def solve(N: int, M: int, S: int, U: "List[int]", V: "List[int]", A: "List[int]", B: "List[int]", C: "List[int]", D: "List[int]"):
    MAX = max(A) * (N-1)
    S = min(S, MAX)

    G = [[] for _ in range(N)]
    for u, v, a, b in zip(U, V, A, B):
        G[u-1].append([v-1, [a, b]])
        G[v-1].append([u-1, [a, b]])

    dp = [[INF for _ in range(MAX + 1)] for _ in range(N)]
    dp[0][S] = 0

    Q = []
    heapq.heapify(Q)
    heapq.heappush(Q, [0, [0, S]])

    while len(Q) != 0:
        time, [v, s] = heapq.heappop(Q)
        if time > dp[v][s]:
            continue

        if s + C[v] <= MAX:
            ns = s + C[v]
            ntime = time + D[v]
            if dp[v][ns] > ntime:
                dp[v][ns] = ntime
                heapq.heappush(Q, [ntime, [v, ns]])

        for nv, [ns, ntime] in G[v]:
            if s < ns:
                continue
            ns = s - ns
            ntime += time
            if dp[nv][ns] > ntime:
                dp[nv][ns] = ntime
                heapq.heappush(Q, [ntime, [nv, ns]])

    ans = [min(dp[i]) for i in range(1, N)]
    return "\n".join(map(str, ans))


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    U = [int()] * (M)  # type: "List[int]"
    V = [int()] * (M)  # type: "List[int]"
    A = [int()] * (M)  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        U[i] = int(next(tokens))
        V[i] = int(next(tokens))
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    C = [int()] * (N)  # type: "List[int]"
    D = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        C[i] = int(next(tokens))
        D[i] = int(next(tokens))
    print(solve(N, M, S, U, V, A, B, C, D))


if __name__ == '__main__':
    main()


Measured memory_bytes: 111528
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	vector<int32_t> num(3);
	cin >> num[0] >> num[1] >> num[2];

	int32_t res = 0;

	while (true) {
		bool updated = false;
		int32_t _max = max(max(num[0], num[1]), num[2]);
		for (int32_t i = 0; i < 3; i++) {
			if (num[i] + 2 <= _max) {
				num[i] += 2;
				res++;
				updated = true;
			}
		}
		if (updated)
			continue;

		int32_t max_cnt = 0;
		for (int32_t i = 0; i < 3; i++) {
			if (num[i] == _max)
				max_cnt++;
		}
		if (max_cnt == 1) {
			res++;
		} else if (max_cnt == 2) {
			res += 2;
		}
		break;
	}

	cout << res << endl;

	return 0;
}

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

class Program {
    const int mod = 1000000007;

    static void Main() {
#if USE_IDE
        var exStdIn = new System.IO.StreamReader("./../../TestStdin.txt");
        Console.SetIn(exStdIn);
#endif
        var args = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        var N = args[0];
        var M = args[1];
        var cakes = new List<Cake>();
        for (int i = 0; i < N; i++) {
            var a = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            cakes.Add(new Cake() {x = a[0], y = a[1], z = a[2]});
        }

        var sums = new long[8][];
        for (int i = 0; i < 8; i++) {
            sums[i] = new long[N];
        }

        for (int i = 0; i < N; i++) {
            sums[0][i] = cakes[i].x + cakes[i].y + cakes[i].z;
            sums[1][i] = cakes[i].x + cakes[i].y - cakes[i].z;
            sums[2][i] = cakes[i].x - cakes[i].y + cakes[i].z;
            sums[3][i] = cakes[i].x - cakes[i].y - cakes[i].z;
            sums[4][i] = -cakes[i].x + cakes[i].y + cakes[i].z;
            sums[5][i] = -cakes[i].x + cakes[i].y - cakes[i].z;
            sums[6][i] = -cakes[i].x - cakes[i].y + cakes[i].z;
            sums[7][i] = -cakes[i].x - cakes[i].y - cakes[i].z;
        }

        for (int i = 0; i < 8; i++) {
            Array.Sort(sums[i]);
            Array.Reverse(sums[i]);
        }

        var anss = new long[8];
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < M; j++) {
                anss[i] += sums[i][j];
            }
        }

        Console.WriteLine(anss.Max());
    }

    class Cake {
        public long x;
        public long y;
        public long z;
    }
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

int main(){
    int N;
    cin >> N;
    for(int i = N; true; i++){
        if(i % 111 == 0){
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,k;
    cin>>n>>k;
    if(n%k==0)
        cout<<"0"<<endl;
    else
        cout<<"1"<<endl;

    return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	LL n, m;
	cin >> n >> m;
	
	if (n > m / 2) {
		cout << m / 2 << endl;
	} else {
		cout << n + (m - 2 * n) / 4 << endl;
	}
	return 0;
}

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

using namespace std;

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

	int n;
	cin >> n;
	int ans = 0, last = 0;
	for (int i = 0; i < n - 1; ++i) {
		int b;
		cin >> b;
		if (i == 0) {
			ans += b;
		}
		else {
			ans += min(last, b);
		}
		last = b;
	}
	cout << ans + last;


	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int n, A[2000];
 
int exhaustiveSearch(int i, int j){
  int more;
  /*?????????*/
  if(j == 0){
    return 1;
  }
  /*????????????*/
  else if(i >= n){
    return 0;
  }
  /*???????????????*/
  else{
    more  = exhaustiveSearch(i + 1, j) || exhaustiveSearch(i + 1, j - A[i]);
  }
  return more;
}
 
int main(){
  int i, q, Mi;
   
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &A[i]);
  }
  scanf("%d", &q);
  for(i = 0; i < q; i++){
    scanf("%d", &Mi);
    if(exhaustiveSearch(0, Mi)){
      printf("yes\n");
    }
    else printf("no\n");
  }
   
  return 0;
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) x.begin(),x.end()
#define DEBUG

int main()
{
	int a1, a2, a3;
	cin >> a1 >> a2 >> a3;

	if(a1+a2+a3 >= 22) cout << "bust" << endl;
	else cout << "win" << endl;
	return 0;
}



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

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

    int penalty_count = 0;
    int correct_count = 0;

    vector<int> wa_count(N+1, 0);

    map<long long, string> m;
    long long p;      // 1 <= p <= 10e5
    string s;   // "AC" or "WA"

    for (int i=0; i<M; ++i) {
        cin >> p >> s;

        if (m.count(p)) {
            if (m[p] == "WA") {
                if (s == "WA") {
                    penalty_count++;
                    wa_count[p]++;
                }
                else if (s == "AC") {
                    correct_count++;
                    m[p] = s;
                }
            }
        } else {
            if (s == "WA") {
                penalty_count++;
                wa_count[p]++;
            } else if (s == "AC") {
                correct_count++;
            }
            m[p] = s;
        }
    }

    // 一回もACが出なかった問題のpenalty_countを減らす
    for(int i=0; i<wa_count.size(); i++) {
        if (wa_count[i] > 0) {
            if (m[i] == "WA") {
                penalty_count -= wa_count[i];
            }
        }
    }

    cout << correct_count << " " << penalty_count << endl;
    return 0;
}

Measured memory_bytes: 11520
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	t=1;
	
	//cin >> t;
	while(t--)
	{
		int n;
		int T;
		cin >> n >> T ;
		int i;
		set<int> a;
		
		for(i=0;i<n;i++)
		{
			int c,t;
			cin >> c >> t;
			if(t<=T)
			{
				
				a.insert(c);
			}
		}
		if(a.size()==0)
		{
			cout << "TLE";
		}
		else
		{
			set<int>::iterator it;
			it = a.begin();
			cout << *it;
			
		}
		
	}
	return 0;
	
}

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

using namespace std;


int main() {

    int n;

    cin >> n;

    for (int i = 0; i < 3; i++) {
        if (n % 10 == 7) {
            cout << "Yes";
            return 0;
        } else {
            n = n/10;
        }
    }

    cout << "No";

    return 0;
}


Measured memory_bytes: 3592
# 解説AC
# https://drken1215.hatenablog.com/entry/2019/04/14/222900
n, k = map(int, input().split())
S = list(input())

if "0" not in S:
    print(n)
    exit()

# 1の個数、0の個数、1の個数、、、
cnt = []

# 先頭が0なら1が0個とみなす
if S[0] == "0":
    cnt.append(0)

# 個数勘定
i = 0
while i < n:
    j = i
    while j < n and S[i] == S[j]:
        j += 1
    cnt.append(j-i)
    i = j

# 最後尾が0なら1が0個とみなす
if S[-1] == "0":
    cnt.append(0)

# cnt の累積和
cumCnt = [0]
for c in cnt:
    cumCnt.append(cumCnt[-1] + c)

# print(cnt)
# print(cumCnt)

lenCnt = len(cnt)
lenCumCnt = len(cumCnt)
ans = 0

for left in range(0, lenCumCnt, 2):
    right = min(left + 2*k+1, lenCumCnt-1)
    ans = max(ans, cumCnt[right] - cumCnt[left])
print(ans)

Measured memory_bytes: 14224
n = int(input())
s = input()
ans = s.count('R')*s.count('G')*s.count('B')
for i in range(n-2):
  for j in range(i+1,n-1):
    if 2*j - i > n-1:
      break
    if s[i] != s[j] and s[j] !=  s[2*j-i] and s[2*j-i] != s[i]:
      ans -=1
print(ans)


Measured memory_bytes: 9188
i=int(input())
a=int(i/15)
sum=(a-1)*a*15*8/2+60*a
for j in range(i%15):
    if j%5!=0 and j%3!=0:
        sum+=(j+a*15)
if i%5!=0 and i%3!=0:
    sum+=i
print(int(sum))

Measured memory_bytes: 9192
A, B = map(int, input().split())

x1 = -(-25*A//2)
x2 = 25*(A+1)//2
x3 = 10*B
x4 = 10*(B+1)
#print(x1, x2, x3, x4)

if x1 <= x3 and x3 < x2:
  print(x3)
elif x3 <= x1 and x1 < x4:
  print(x1)
else:
  print(-1)
  

Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")

#define fi first
#define se second

const int N = 100100;

using namespace std;

namespace Dinic {

	using F = int;
	const F INF = 1e9+1e8;

	const int N = 220000;
	const int M = N * 2;

	int fst[N], nxt[M], to[M];
	F cap[M];
	int dis[N], q[N], ptr[N];
	int E;

	void init() {
		memset(fst, -1, sizeof fst);
		E = 0;
	}
	inline void add_edge(int u, int v, F c) {
		to[E] = v, cap[E] = c, nxt[E] = fst[u], fst[u] = E++;
		to[E] = u, cap[E] = 0, nxt[E] = fst[v], fst[v] = E++;
	}
	inline bool bfs(int S, int T, int n) {
		memset(dis, -1, sizeof(int) * n);
		int h = 0, t = 0;
		dis[S] = 0, q[t++] = S;
		while (h < t) {
			int u = q[h++];
			for (int e = fst[u]; ~e; e = nxt[e]) if (cap[e] > 0 && dis[to[e]] == -1) {
				dis[to[e]] = dis[u] + 1, q[t++] = to[e];
				if (to[e] == T) return 1;
			}
		}
		return (dis[T] != -1);
	}
	F dfs(int u, int T, F f) {
		if (u == T) return f;
		for (int &e = ptr[u]; ~e; e = nxt[e]) if (cap[e] > 0 && dis[to[e]] > dis[u]) {
			F ret = dfs(to[e], T, min(f, cap[e]));
			if (ret > 0) {
				cap[e] -= ret, cap[e ^ 1] += ret;
				return ret;
			}
		}
		return 0;
	}
	F max_flow(int S, int T, int n) {
		F ret = 0;
		while (bfs(S, T, n)) {
			memcpy(ptr, fst, sizeof(int) * n);
			for (F cur; (cur = dfs(S, T, INF)) > 0; ret += cur);
		}
		return ret;
	}
};

int n;
int p[N];
int q[N];
int A[N];
int B[N];

int main()
{
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        ios_base::sync_with_stdio(0);

        cin >> n;
        for(int i = 0; i < n; i++){
                cin >> p[i];
        }
        for(int i = 0; i < n; i++){
                cin >> q[i];
        }
        int G = 0;
        for(int i = 0; i < n; i++){
                if(A[i] == 0){
                        G += 1;
                        A[i] = G;
                        int j = p[i];
                        while(j != i){
                                A[j] = G;
                                j = p[j];
                        }
                }
                if(B[i] == 0){
                        G += 1;
                        B[i] = G;
                        int j = q[i];
                        while(j != i){
                                B[j] = G;
                                j = q[j];
                        }
                }
        }
        G += 1;
        Dinic::init();

        int res = n;
        for(int i = 0; i < n; i++){
                if(p[i] == i && q[i] == i){
                        res -= 1;
                } else if(p[i] == i){
                        Dinic::add_edge(B[i], G, 1);
                } else if(q[i] == i){
                        Dinic::add_edge(0, A[i], 1);
                } else{
                        Dinic::add_edge(B[i], A[i], 1);
                        if(p[i] == q[i]){
                                Dinic::add_edge(A[i], B[i], 1);
                        }
                }
        }
        res -= Dinic::max_flow(0, G, G + 1);

        cout << res << '\n';
}


Measured memory_bytes: 11648
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static ArrayList<Integer> pf = new ArrayList<Integer>();
	public static void main(String[] args) {
		primeFactorize( sc.nextInt() );
	}

	private static void primeFactorize(int nextInt) {
		int n = nextInt;
		int p = 2;

		while(n > 1 ) {

			for( p = 2; p <= Math.sqrt(n); p++) {
					if ( n % p == 0 ) {
						n /= p;
						pf.add(p);
						break;
					}
			}

			if (p * p > n) {
				pf.add(n);
				break;
			}
		}

		System.out.printf("%d:", nextInt);

			for (int i : pf) {
				System.out.printf(" %d", i);
			}
			System.out.println();
	}

}


Measured memory_bytes: 26488
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n;
  cin >> n;
  unordered_map<string, ll> key;
  ll ans = 0;
  for(ll i = 0; i < n; i++) {
  	string x;
  	cin >> x;
    sort(all(x)) ;
    key[x]++;
    ans+= key[x]-1;
  }
  cout << ans << endl;
  return 0;
} //good night.

Measured memory_bytes: 10696
#include <iostream>
#include <array>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>

using namespace std;

vector<array<int, 3> > points;
vector<array<int, 3> > res;

int f(int day, int act) {
  if (day == 0) {
    return points[0][act];
  }

  if (res[day][act] == -1) {
    int max_prev = 0;
    for (int i = 0; i < 3; i++) {
      if (i == act) {
        continue;
      }
      max_prev = max(max_prev, f(day - 1, i));
    }
    res[day][act] = max_prev + points[day][act];
  }

  return res[day][act];
}

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

  for (int i = 0; i < n; i++) {
    array<int, 3> line;
    cin >> line[0] >> line[1] >> line[2];
    points.push_back(line);
    res.push_back({-1, -1, -1});
  }

  int val = 0;
  for (int i = 0; i < 3; i++) {
    val = max(val, f(n - 1, i));
  }

  cout << val << endl;

  return 0;
}


Measured memory_bytes: 9132
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;
using P = pair<int,int>;

void bfs(int i, const vector<vector<int>>& g, map<int,int>& d) {
    queue<P> q;
    q.emplace(i,0);
    vector<int> cnt(g.size(), -1);

    int64 res = 0;
    while(!q.empty()) {
        int u,c;
        tie(u,c) = q.front(); q.pop();
        if (cnt[u] >= 0) continue;
        cnt[u] = c;
        d[c]++;
        for (auto v : g[u]) q.emplace(v, (c+1));
    }
}

int main() {
    int64 n,x,y;
    cin >> n >> x >> y;

    vector<vector<int>> g(n+1);
    for (int i=1; i<n; i++) {
        g[i].push_back(i+1);
        g[i+1].push_back(i);
    }
    g[y].push_back(x);
    g[x].push_back(y);

    vector<map<int,int>> d(n+1);
    for (int i=1; i<=n; i++) {
        bfs(i, g, d[i]);
    }

//    for (int i=1; i<=n; i++) {
//        cout << i << "  => ";
//        for (int j=0; j<=n; j++) {
//            cout << d[i][j] << " ";
//        }cout << endl;
//    }

    cout << n << endl;
    for (int i=2; i<n; i++) {
        int ans = 0;
        for (int j=1; j<=n; j++) ans += d[j][i];
        cout << ans / 2 << endl;
    }
}

Measured memory_bytes: 189440
# -*- coding: utf-8 -*-
import numpy as np
# 整数の入力
n, k = map(int, input().split())
numlist = np.arange(1,n+1)
j = 0
if k == 1:
    print(n)
else:
    for i in range(0,n-1):
        a = numlist[i:i+k]
        if a[k-1] == n:
            j += 1
            break
        else:
            j += 1
            pass
    print(j)

Measured memory_bytes: 18736
#include <stdio.h>
#include <math.h>

void sort( int*a, int*b, int*c )
{
	if( *a > *b && *a > *c )
	{
		return;
	}
	else if( *b > *c && *b > *a )
	{
		int tmp = *b;
		*b = *a;
		*a = tmp;
	}
	else
	{
		int tmp = *c;
		*c = *a;
		*a = tmp;
	}
}

int main( void )
{
	int a;
	int b;
	int c;
	int n;
	int i;
	
	scanf( "%d", &n );
	for( i = 0; i < n; i++ )
	{
		scanf( "%d%d%d", &a, &b, &c );
		sort( &a, &b, &c );
		
		if( a * a == b * b + c * c  )
		{
			printf( "YES\n" );
		}
		else
		{
			printf( "NO\n" );
		}
	}
	
	return (0);
}

Measured memory_bytes: 580
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int A[n];
    int B[n];
    int C[n -1];
    for (int i = 0; i < n ; i++){
        cin >> A[i];
    }
    for (int i = 0; i < n ; i++){
        cin >> B[i];
    }
    for (int i = 0; i < n-1 ; i++){
        cin >> C[i];
    }
    long long int res = 0;
    for (int i = 0; i < n ;i ++){
        if (i == 0){
            res += B[A[i]-1];
        }else {
             res += B[A[i]-1];
             if (A[i] - A[i-1] == 1){
                res += C[A[i-1]-1];
             }
        }
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a;
		for(int i=0;i<n;i++) {
			a = sc.nextInt();
			if(a%2 != 0) {
				continue;
			}
			if(a%3!=0 && a%5!=0) {
				System.out.println("DENIED");
				return;
			}
		}
		System.out.println("APPROVED");
	}

}


Measured memory_bytes: 22612
/*input
54
0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#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 REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

int ways = 1;
map<int,int> nice;
int n;

void solve(){
  	cin >> n;
  	nice[-1] = 3;
  	REP(i,n){
  		int x;cin >> x;
  		nice[x]++;
  		if(nice[x] > 3)ways = 0;
  		ways *= (nice[x-1]-nice[x]+1);
  		ways %= MOD;
  	}
  	ways %= MOD;
  	cout << ways;
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 6528
# solution
import io
from fractions import gcd

data=int(input())
array=list(map(int,input().split()))
k=[0]
l=[0]
for i in range(data-1):
    k.append(gcd(k[i],array[i]))
    l.append(gcd(l[i],array[data-i-1]))
ans=0
for i in range(data):
    ans=max(ans,gcd(k[i],l[data-i-1]))
print(ans)


Measured memory_bytes: 16120
#ifdef __LOCAL
  #define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#define fi first
#define se second
#define intmax numeric_limits<int>::max()
#define llmax numeric_limits<ll>::max()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;
const ll lnf=1ll<<60;

struct unionfind{
  vector<int> par;
  vector<int> rank;
  unionfind(int n=1){
    init(n);
  }
  void init(int n=1){
      par.resize(n); rank.resize(n);
      for(int i=0;i<n;++i) par[i]=i,rank[i]=0;
  }
  int root(int x){
    if(par[x]==x){
      return x;
    }
    else{
      int r=root(par[x]);
      return par[x]=r;
    }
  }
  bool issame(int x,int y){
    return root(x)==root(y);
  }
  bool merge(int x,int y){
    x=root(x); y=root(y);
    if(x==y) return false;
    if(rank[x]<rank[y]) swap(x,y);
    if(rank[x]==rank[y]) ++rank[x];
    par[y]=x;
    return true;
  }
};

int main(){
  int n,m; cin >> n >> m;
  unionfind uf(n);
  rep(i,m){
    itn a,b;
    cin >> a >> b;
    a--; b--;
    uf.merge(a,b);
  }
  int ans=0;
  rep(i,n){
    if(!(uf.issame(0,i))){
      uf.merge(0,i);
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3988
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    string s;
    cin >> s;
    
    string t0;
    rep(i, s.size()) {
        if (s[i] != 'x') t0.push_back(s[i]);
    }
    string t1 = t0;
    reverse(t1.begin(), t1.end());
    if (t0 != t1) {
        cout << -1 << endl;
        return 0;
    }
    vector<int> S;
    int cnt = 0;
    rep(i, s.size()) {
        if (s[i] == 'x') {
            ++cnt;
        } else {
            S.push_back(cnt);
            cnt = 0;
        }
    }
    S.push_back(cnt);
    vector<int> T = S;
    reverse(T.begin(), T.end());
    int ans = 0;
    rep(i, S.size()) ans += max(S[i], T[i]) - S[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1528
#include <stdio.h>
void swap(int *,int *);
void bubbleSort(int [],int);
 
int count=0;
 
int main(){
  int i,n,A[100];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    }
    bubbleSort(A,n);
    for(i=0;i<n;i++){
      if(i)printf(" ");
      printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",count);
    return 0;
  }
 
void swap(int *a,int *b){
  int v;
  v=*a;
  *a=*b;
  *b=v;
}
 
 
void bubbleSort(int A[],int N){
  int i,j,flag;
  int h;
  flag=1;
  i=0;
 
for(h=0;h<=N-1;h++){
    for(j=N-1;j>=i+1;j--){
      if(A[j]<A[j-1]){
        swap(&A[j],&A[j-1]);
        count++;
        flag=1;
      }
    }
  i++;
  }
 }

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

int main() {
    int n;
    cin >> n;
    if(n%10 == 2 || n%10 == 4 || n%10 == 5 || n%10 == 7 || n%10 == 9) {
        cout << "hon";
        return 0;
    }
    if(n%10 == 3) {
        cout << "bon";
        return 0;
    }
    cout << "pon";
    return 0;
}


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

	//最大公約数
	ll gcd(ll a, ll b) {
	  while (a && b) {
	    if (a >= b) a %= b;
	    else b %= a;
	  }
	  return a + b;
	}
	//最小公倍数
     ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b;}


int main(){
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll ans=0;

    ans = B - B/C - B/D - (A-1) + (A-1)/C + (A-1)/D + B/lcm(C,D) - (A-1)/lcm(C,D);

    cout << ans << endl;

}

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

using namespace std;
#define int long long
priority_queue<pair<int, int>> q;
const int maxn = 2e5 + 5;
int n, m, b[maxn], a[maxn], pre[maxn], nxt[maxn];
signed main() {
    int i, j, k, ans = 0;
    scanf("%lld", &n);
    for (i = 1; i <= n; ++i) {
        scanf("%lld", &a[i]);
    }
    for (i = 1; i <= n; ++i) {
        scanf("%lld", &b[i]);
        q.push(make_pair(b[i], i));
    }

    for (i = 1; i <= n; ++i) {
        nxt[i] = i + 1;
        pre[i] = i - 1;
    }
    pre[1] = n;
    nxt[n] = 1;
    while (!q.empty()) {
        int x = q.top().second;
        q.pop();
        if (b[x] == a[x]) continue;
        int y = pre[x], z = nxt[x];
        if (b[x] - b[y] - b[z] < a[x]) {
            puts("-1");
            return 0;
        }
        k = b[x] - a[x];
        ans += k / (b[y] + b[z]);
        b[x] = (k % (b[y] + b[z])) + a[x];
        if (a[x] != b[x]) {
            q.push(make_pair(b[x], x));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10480
# 貰うDP
H, W = map(int, input().split())
a = [input() for _ in range(H)]

m = 1000000007

dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for w in range(1, W):
    if a[0][w] != '#':
        dp[0][w] = dp[0][w - 1]

for h in range(1, H):
    if a[h][0] != '#':
        dp[h][0] = dp[h - 1][0]
    for w in range(1, W):
        if a[h][w] != '#':
            dp[h][w] = (dp[h][w - 1] + dp[h - 1][w]) % m

print(dp[H - 1][W - 1])


Measured memory_bytes: 49532
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define LINF (ll)1e17
#define INF 1e9
#define MOD 1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
}


signed main(){
	
	ll A[5] = {0},B[5] = {0},C[5] ={0};
	ll a,b,c,ans = 0,cnt = 0,memo = 0;
	string s,t;
	bool flag = false;
	
	cin >> s;
	
	if(s == "A") cout << "T" << endl;
	else if(s == "T") cout << "A" << endl;
	else if(s == "C") cout << "G" << endl;
	else cout << "C" << endl;
	
	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b;
string str;
bool tf;
int main(){
	cin>>a>>b>>str;
	for(int i=0;i<(a+b+1);i++){
		if(int(str[i])>='0'&&int(str[i])<='9')continue;
		else
			if(i!=a){
				tf=1;
				break;
			}
	}
	if(str[a]!='-')tf=1;
	if(tf==0)cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;

int main(){
  int N,K; cin>>N>>K;
  vector<int> H(N); rep(i,N)cin>>H.at(i);

  vector<ll> dp(N+1,INF);
  dp.at(0)=0;

  for(int i = 1; i <= N-1; i++){
    for(int j = i-1; j >= max(0,i-K); j--){
      dp.at(i) = min(dp.at(i),dp.at(j)+(ll)fabs(H.at(i)-H.at(j)));
    }
  }
  cout<<dp.at(N-1)<<endl;
}


Measured memory_bytes: 1408
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
		int r = in.readInt()*100; 
		int g = in.readInt() * 10; 
		int b = in.readInt(); 
		int result = r+b+g; 
		System.out.println(result % 4 == 0 ? "YES" : "NO"); 
	}
}
class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 20948
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,x;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	if(a<40){
		a=40;
	}
	if(b<40){
		b=40;
	}
	if(c<40){
		c=40;
	}
	if(d<40){
		d=40;
	}
	if(e<40){
		e=40;
	}
	x=(a+b+c+d+e)/5;
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 1812
#include<iostream>
using namespace std;
bool is_possible(int a,int b,int c,int k)
{
    if(k==0)
    {
        if(b>a && c>b)
        return true;
        return false;
    }
    bool option1 = is_possible(a,b,c,k-1);
    bool option2 = is_possible(2*a,b,c,k-1);
    bool option3 = is_possible(a,2*b,c,k-1);
    bool option4 = is_possible(a,b,2*c,k-1);
    return option1 | option2 | option3 | option4;

}
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int k;
    cin>>k;
    if(is_possible(a,b,c,k))
    cout<<"Yes\n";
    else 
    cout<<"No\n";
}

Measured memory_bytes: 3624
a,b,c=(map(int,input().split()))
if a==5:
  if b==5:
    if c==7:
      print("YES")
    else:
      print("NO")
  elif b==7:
    if c==5:
      print("YES")
    else:
      print("NO")
  else:
    print("NO")
elif a==7:
  if b==5 and c==5:
    print("YES")
  else:
    print("NO")
else:
  print("NO")  

Measured memory_bytes: 3060
#include<stdio.h>

int main(){
    int n;
    int cards[4][14] = {};
    scanf("%d", &n);
    char m;
    int num;
    for(int i=n*2; i>0; i--){
        scanf("%c", &m);
        scanf("%d", &num);
        if(m=='S')cards[0][num]=1;
        if(m=='H')cards[1][num]=1;
        if(m=='C')cards[2][num]=1;
        if(m=='D')cards[3][num]=1;
    }

    for(int x=0; x<4; x++){
        for(int y=1; y<14; y++){
            if(cards[x][y]==0){
                if(x==0)printf("S %d\n",y);
                if(x==1)printf("H %d\n",y);
                if(x==2)printf("C %d\n",y);
                if(x==3)printf("D %d\n",y);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2044
package main
import (
    "fmt"
    "bufio"
    "os"
)

var r = bufio.NewReader(os.Stdin)

func main() {
	var S int
	fmt.Fscan(r, &S)
    s := S%60
    M := S/60
    m := M%60
    h := M/60
    fmt.Printf("%v:%v:%v\n",h,m,s)
}



Measured memory_bytes: 1140