akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vvchar vector<vector<char>>
#define vchar vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

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

    int n; cin >> n;
    vint a(n);
    rep(i,n)cin>>a[i];

    map<int,int> even,odd;
    for(int i=0; i<n; i+=2) even[a[i]]++;
    for(int i=1; i<n; i+=2) odd[a[i]]++;

    P me1,me2,mo1,mo2;
    for(auto e:even){
        if(me1.S<e.S){
            me1.S=e.S;
            me1.F=e.F;
        }
    }
    for(auto e:even){
        if(me2.S<e.S && e.F!=me1.F){
            me2.S=e.S;
            me2.F=e.F;
        }
    }
    for(auto o:odd){
        if(mo1.S<o.S){
            mo1.S=o.S;
            mo1.F=o.F;
        }
    }
    for(auto o:odd){
        if(mo2.S<o.S && o.F!=mo1.F){
            mo2.S=o.S;
            mo2.F=o.F;
        }
    }

    if(me1.F!=mo1.F){
        cout<<n-me1.S-mo1.S<<endl;
    }else{
        cout<<min(n-me1.S-mo2.S,n-mo1.S-me2.S)<<endl;
    }

}

Measured memory_bytes: 10092
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>

#define ll long long
ll X, Y;
int length = 0;

using namespace std;

int main()
{
    cin >> X >> Y;

    while (X <= Y) {
        X *= 2;
        length++;
    }

    cout << length << endl;

    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#endif

#define ITER(c)         __typeof__((c).begin())
#define FOREACH(it, c)  for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)        __typeof__((c).rbegin())
#define RFOREACH(it, c) for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define REVREP(i, n)    for (int i = ((n)-1); i >= 0; --i)
#define FIND(c, n)      std::find((c).begin(), (c).end(), (n));
#define BSEARCH(c, n)   std::binary_search((c).begin(), (c).end(), (n))
#define LLPOW(p1,p2)    ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)      (sizeof(A)/sizeof((A)[0]))
#define MIN(p1,p2)      (((p1)<(p2))?(p1):(p2))
#define MAX(p1,p2)      (((p1)>(p2))?(p1):(p2))
#define CIN_NO_SYNC     do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)       fgets((p), sizeof(p), stdin)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n' || *_q == '\r') *_q = 0; } while(0)

typedef long long ll;
typedef unsigned long long ull;

#ifdef _DEBUG
#define pf printf
#define pr(n) do { cout << #n " = " << (n) << endl; } while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#endif

#define X real()
#define Y imag()
typedef double D;
typedef complex<D> P;
#define EPS (1e-9)

bool intersection_rectangle(P a1, P a2, P b1, P b2){
    if(a1.X > b2.X || a1.Y > b2.Y || a2.X < b1.X || a2.Y < b1.Y) return false;
    return true;
}

int main(){
    double xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2;
    while(cin >> xa1 >> ya1 >> xa2 >> ya2 >> xb1 >> yb1 >> xb2 >> yb2){
        if(intersection_rectangle(P(xa1,ya1), P(xa2,ya2), P(xb1,yb1), P(xb2,yb2))){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

using namespace std;

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

int main() {
  int h, w;
  cin >> h >> w;
  
  vector<vector<char> > s(h + 2, vector<char>(w + 2, '.'));

  rep(i, h) {
    rep(j, w) {
      cin >> s[i][j];
    }
  }

  rep(i, h) {
    rep(j, w) {
      if (s[i + 1][j + 1] == '#') {
        if (
            s[i][j + 1] == '.' &&
            s[i + 2][j + 1] == '.' &&
            s[i + 1][j] == '.' &&
            s[i + 1][j + 2] == '.') {

          cout << "No" << endl;
          exit(0);
        }
      }
    }
  }

  cout << "Yes" << endl;
}

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

int main(){
    int n,m,a[10],s,c;
    map<int ,int>q;
    cin>>n>>m;
    int flag=1;
    memset(a,-1,sizeof(a));
    while(m--){
        cin>>s>>c;
        if(q[s]==0){
            q[s]=c;
            a[s]=c;
        }
        else{
            if(q[s]!=c) flag=0;
        }
    }
    if(a[1]==0 && n>1) flag=0;
    if(flag==0) puts("-1");
    else{
        if(n>1){
            for(int i=1;i<=n;i++){
                if(a[i]==-1 && i==1) cout<<1;
                else if(a[i]==-1 && i>1) cout<<0;
                else cout<<a[i];
            }
        }
        else{
            if(a[1]==-1) cout<<0;
            else cout<<a[1];
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int a = s.charAt(0) - '0';

        sc.close();

        for (int bit = 0; bit < (1 << 3); bit++) {
            int sum = a;
            String ans = "";
            for (int i = 0; i < 3; i++) {
                if ((bit & (1 << i)) != 0) {
                    sum += s.charAt(i + 1) - '0';
                    ans = ans + "+";
                } else {
                    sum -= s.charAt(i + 1) - '0';
                    ans = ans + "-";
                }
            }
            if (sum == 7) {
                for (int i = 0; i < 3; i++) {
                    System.out.print(s.charAt(i));
                    System.out.print(ans.charAt(i));
                }
                System.out.print(s.charAt(3));
                System.out.println("=7");
                return;
            }
        }
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

string str[3];

int memo[3][3][2222];

bool ok(int x, int y, int diff){
    if(diff >= str[x].size())return true;
    int &ans = memo[x][y][diff];
    if(ans != 0){
        return ans - 1;
    }
    for(int i = 0;i < str[y].size() && diff+i < str[x].size();i++){
        if(str[y][i] == '?')continue;
        if(str[x][diff+i] == '?')continue;
        if(str[y][i] != str[x][diff+i]){
            ans = 1;
            return false;
        }
    }
    ans = 2;
    return true;
}

int solve(int a, int b, int c){
    int ans = 1111111;
    for(int bs = 0;bs <= str[a].size();bs++){
        for(int cs = bs;cs <= max(bs + str[b].size(), str[a].size());cs++){
            if(ok(a, b, bs) && ok(a, c, cs) && ok(b, c, cs - bs)){
                int len = str[a].size();
                len = max(len, bs + (int)str[b].size());
                len = max(len, cs + (int)str[c].size());
                ans = min(ans, len);
            }
        }
    }
    return ans;
}

int main(){
    cin >>  str[0] >> str[1] >> str[2];
    int ans = solve(0, 1, 2);
    ans = min(ans, solve(0, 2, 1));
    ans = min(ans, solve(1, 0, 2));
    ans = min(ans, solve(1, 2, 0));
    ans = min(ans, solve(2, 0, 1));
    ans = min(ans, solve(2, 1, 0));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int m, d;
	cin >> m >> d;
	int cnt = 0;
	for (int j = 1; j <= m; j++) {
		for (int i = 2; i <= d; i++) {
			int d1 = i % 10, d10 = i / 10;
			if (d1 >= 2 && d10 >= 2 && d1 * d10 == j) {
				cnt++;
			}
		}
	}
	cout << cnt << endl;
	return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

int X, Y, A, B, C;
vector<int> P, Q, R;

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

    cin >> X >> Y >> A >> B >> C;
    P.resize(A);
    REP(i, A) { cin >> P[i]; }
    Q.resize(B);
    REP(i, B) { cin >> Q[i]; }
    R.resize(C);
    REP(i, C) { cin >> R[i]; }

    vector<int> eat;
    SORT(P);
    reverse(P.begin(), P.end());
    REP(i, X) {
        eat.push_back(P[i]);
    }
    SORT(Q);
    reverse(Q.begin(), Q.end());
    REP(i, Y) {
        eat.push_back(Q[i]);
    }

    SORT(eat);
    SORT(R);
    int ans = 0;
    REP(i, eat.size()) {
        if(R.size() > 0 && eat[i] < R[R.size()-1]) {
            ans += R[R.size()-1];
            R.pop_back();
        }
        else {
            ans += eat[i];
        }
    }
    printf("%lld\n", ans);

    return 0;
}



Measured memory_bytes: 4852
<?php
fscanf(STDIN, '%d', $num);
$ans = 0;
for ($i=1; $i <= $num ; $i++) { 
    for ($j=1; $j <= $num ; $j++) {
        $ij = gmp_gcd($i, $j); 
        for ($k=1; $k <= $num ; $k++) { 
            if ($k === 1) {
                $ans++;
                continue;
            }
            $ans+=gmp_gcd($ij, $k); 
        }
    }
}
echo $ans; 

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

int main()
{
    int n;
    long long a[50], k{};
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%lld", a + i);
    bool updated{true};
    while (updated)
    {
        updated = false;
        for (int i = 0; i < n; i++)
        {
            if (a[i] < n) continue;
            updated = true;
            long long decrease = a[i] / n;
            k += decrease;
            a[i] %= n;
            for (int j = 0; j < n; j++)
                if (j != i)
                    a[j] += decrease;
        }
    }
    printf("%lld\n", k);

    return 0;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n, m;
  cin >> n >> m;

  vector<pair<int, int>> vab(m);
  for (auto &p : vab) {
    cin >> p.first >> p.second;
  }

  sort(vab.begin(), vab.end());

  int l = vab[0].first, r = vab[0].second, ans = 0;
  for (int i = 1; i < m; ++i) {
    l = max(l, vab[i].first);
    r = min(r, vab[i].second);

    if (r - l < 1) {
      ans++;
      l = vab[i].first;
      r = vab[i].second;
    }

    if (i == m - 1) {
      ans++;
    }
  }

  cout << max(1, ans) << '\n';
  return 0;
}

Measured memory_bytes: 1024
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n = int(input())
s = input()

prev = s[0]
ans = 1
for c in s[1:]:
    if c != prev:
        ans += 1
        prev = c

print(ans)

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int a, b, c; cin >> a >> b >> c;
    if((a == b && b != c) || (a == c && a != b) || (b == c && a != b)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <typeinfo>
#include <climits>
using namespace std;
#define INIT cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)

int main()
{
    INIT;

    int n, y;
    cin >> n >> y;

    int f = 0;
    bool b = false;
    REP(i, (y / 10000) + 1){
        REP(j, (y / 5000) + 1){
            int hoge = n - i - j;
            if(i + j + hoge == n){
                if(i * 10000 + j * 5000 + hoge * 1000 == y){
                    if(i >= 0 and j >= 0 and hoge >= 0){
                        f = 1;
                        b = true;
                        cout << i << " " << j << " " << n - i - j << endl;
                    }
                }
                if(b) break;
            }
            if(b) break;
        }
        if(b) break;
    }
    if(f == 0){
        cout << -1 << " " << -1 << " " << -1 << endl;
    }


    return 0;
}

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

int main(){
    int m,d;
    cin>>m>>d;
    int c=0;
    for(int i=2; i<=9; i++){
        for(int j=2; j<=9; j++){
            if(i*j<=m && (10*i + j)<=d){
                ++c;
            } else {
                break;
            }
        }
    }
    cout<<c<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main (){
  string s, t;
  cin >> s >> t;
  string s2, t2;
  
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  
  if(s<t)cout << "Yes" << endl;
  else cout << "No"<< endl;
}
  

Measured memory_bytes: 256
import java.util.Arrays;
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 = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        Arrays.sort(A);
        System.out.println(A[A.length - 1] - A[0]);
    }
}

Measured memory_bytes: 21844
s = input()
x = len(s)
a = s.count('a')
b = s.count('b')
c = s.count('c')

if x % 3 == 0:
  if a == b == c:
    print('YES')
  else:
    print('NO')
elif x % 3 == 1:
  if a == b + 1 == c + 1 or b == a + 1 == c + 1 or c == a + 1 == b + 1:
    print('YES')
  else:
    print('NO')
else:
  if a == b == c + 1 or b == c == a + 1 or c == a == b + 1:
    print('YES')
  else:
    print('NO')

Measured memory_bytes: 9136
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

mod = 10**9+7
def comb(n, k):
    c = 1
    for i in range(k):
        c *= n - i
        c %= mod
    d = 1
    for i in range(1, k + 1):
        d *= i
        d %= mod
    return (c * pow(d, mod - 2, mod)) % mod


x,y = map(int, input().split())

if (x + y) % 3 != 0:
    print(0)
    exit()

n = (x + y) // 3
x -= n
y -= n
if x < 0 or y < 0:
    print(0)
    exit()

print(comb(x + y, x))


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


void solve(long long N, std::vector<long long> X){
    long long result = -1;
    for (int i = 0; i < 100; i++) {
        long long sum = 0;
        for (int j = 0; j < N; j++) {
            int a = (i - X[j]);
            sum += a * a;
        }
        result = (result == -1) ? sum : min(result, sum);
    }
    cout << result << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> X(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
    }
    solve(N, std::move(X));
    return 0;
}


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

int main() {
    int t;
    cin>>t;
   string st;
   cin>>st;
   int l=st.size();
   //cout<<l;
   if(l<=t) cout<<st<<endl;
   else{

       cout<<st.substr(0,t)+"..."<<endl;
   }

}


Measured memory_bytes: 3600
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
int n;
string s;
int q;
vector<pair<char,char>>query;
int main(){
    cin >> n >> q;
    cin >> s;
    query.resize(q);
    rep(i,q)cin >> query[i].first >> query[i].second;
    int ok = -1;
    int ng = n;
    while(ng-ok>1){
        int mid = (ok+ng)/2;
        int now = mid;
        for(int i = 0; i < q; i++){
            if(s[now] == query[i].first){
                if(query[i].second == 'L')now--;
                else now++;
            }
            if(now == -1 or now == n)break;
        }
        if(now == -1){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    int ok2 = n;
    int ng2 = -1;
    while(ng2-ok2<-1){
        int mid = (ok2+ng2)/2;
        int now = mid;
        for(int i = 0; i < q; i++){
            if(s[now] == query[i].first){
                if(query[i].second == 'L')now--;
                else now++;
            }
            if(now == -1 or now == n)break;
        }
        if(now == n){
            ok2 = mid;
        }else{
            ng2 = mid;
        }
    }
    int ans = n;
    rep(i,n)if(i<=ok or i >= ok2)ans--;
    cout << ans << endl;
}

Measured memory_bytes: 900
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define bit(n,m)((n>>m)&1)

char s[200010];
ll a[10000][30];//後ろの方
ll b[10000][30];//前の方
int main(){
	scanf("%s",s);
	ll n=strlen(s);
	
	ll c=0,ss=0;
	for(int i=n-1;i>=0;i--){
		int t=s[i]-'a';
		if(!bit(ss,t)){
			ss|=1<<t;
			a[c][t]=i+1;
		}
		b[c][t]=i+1;
		if(ss==((1<<26)-1)){
			c++;
			ss=0;
		}
	}

	ll p=0;
	for(;c>=0;c--){
		rep(i,0,26)if(a[c][i]<=p){
			putchar(i+'a');
			if(c)p=b[c-1][i];
			break;
		}
	}
	puts("");
	return 0;
}

Measured memory_bytes: 4224
#pragma region Macros
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

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 T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

const ll MOD = 1000000007;

ll s(ll n, ll k, vector<vector<ll>> &dp) {
  if (dp[n][k] != -1) {
    return dp[n][k];
  }
  if (k == 1 or n == k) {
    return 1LL;
  }
  ll ret = (s(n - 1, k - 1, dp) + (k * s(n - 1, k, dp) % MOD)) % MOD;
  dp[n][k] = ret;
  return ret;
}

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

  ll n, k;
  cin >> n >> k;
  if (n < k) {
    cout << 0 << endl;
    return 0;
  }
  vector<vector<ll>> dp(1001, vector<ll>(1001, -1));
  cout << s(n, k, dp) << endl;

  return 0;
}


Measured memory_bytes: 10804
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,a[100005];
ll ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) 
	{
		scanf("%d",&a[i]);
		if(!a[i]) continue;
		if(a[i-1]) a[i-1]--,a[i]--,ans++;
		ans+=a[i]/2,a[i]-=a[i]/2*2;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 640
#import<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL i,j,k,m,n,q,x,a[1000005];
string s;
main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>s;
	if(s.size()&1)cout<<"No";
	else
	{
		for(;i<s.size();i+=2)
		{
			if(s[i]^104||s[i+1]^105)return cout<<"No",0;
		}
		cout<<"Yes";
	}
	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(){
  ll n,m; cin >> n >> m;
  vector<ll> c(m);
  for(ll i = 0;i < m;i++)cin >> c[i];
  sort(c.begin(),c.end());

  ll dp[50001];
  dp[0] = 0;

  for(ll i = 1;i <= 50000;i++){
    dp[i] = 100000;
    for(ll j = 0;j < m;j++){
      if(i - c[j] >= 0){
        dp[i] = min(dp[i],dp[i-c[j]]+1);
      }
    }
  }

  cout << dp[n] << endl;
}



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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if((a < c && c < b) ||
				(b < c && c < a) )
			System.out.println("Yes");
		else
			System.out.println("No");
		
	}
}

class Scanner {
	private static final int SPACE = (int)' ';
	private static final int LINE_END_0 = 13;
	private static final int LINE_END_1 = 10;
	private static final int BEFORE = -1;
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public String next(){
		StringBuilder sb = new StringBuilder();
		
		int length = BEFORE;
		readLoop: while(true) {
			try {
				int value = br.read();
				switch(value) {
				case LINE_END_1:
					if(length == BEFORE)
						break;
					
					if((int)sb.charAt(length) == LINE_END_0)
						sb.deleteCharAt(length);
				case SPACE:
					break readLoop;
				}
				sb.append((char)value);
				length++;

			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
	
	public String[] nextArray(int length) {
		String[] array = new String[length];
		for(int i = 0; i < length; i++)
			array[i] = next();
		return array;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public double[] nextDoubleArray(int length) {
		double[] array = new double[length];
		for(int i = 0; i < length; i++)
			array[i] = nextDouble();
		return array;
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public int[] nextIntArray(int length) {
		int[] array = new int[length];
		for(int i = 0; i < length; i++)
			array[i] = nextInt();
		return array;
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public long[] nextLongArray(int length) {
		long[] array = new long[length];
		for(int i = 0; i < length; i++)
			array[i] = nextLong();
		return array;
	}
	
	public boolean ready() {
		try {
			return br.ready();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
}


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

int main(){
    int x,y;
    rep(i,3000){
        cin >> x >> y;
        if(x == 0 && y == 0) break;
        if(x > y) swap(x,y);
        cout << x << " " << y << endl;
    }
}



Measured memory_bytes: 3000
let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let rec doit () =
    match List.map int_of_string (split_on_char ' ' (read_line ())) with
    | [a; b] -> Printf.printf "%d\n" (a + b); doit ()
    | _ -> () in
  try doit () with _ -> ()

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

using namespace std;

int n, m;
vector<vector<int>> edge;

int dp[8][1 << 8];

int dfs(int now, int bits) {
	bits |= (1 << now);
	if (bits == (1 << n) - 1) {
		return 1;
	}
	if (~dp[now][bits]) return dp[now][bits];
	int res = 0;
	for (auto&& i : edge[now]) {
		if (bits & (1 << i)) {
			continue;
		}
		res += dfs(i, bits);
	}
	return dp[now][bits] = res;
}

int main() {
	cin >> n >> m;
	edge.resize(n);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		edge[a - 1].push_back(b - 1);
		edge[b - 1].push_back(a - 1);
	}
	memset(dp, -1, sizeof dp);
	cout << dfs(0, 0) << "\n";
}

Measured memory_bytes: 256
n = int(input())
dat_a = list(map(int, input().split()))
dat_a.sort()
a = 0
b = 0
while True:
    if len(dat_a) ==0:
        break
    a += dat_a.pop()

    if len(dat_a) ==0:
        break
    b += dat_a.pop()
print(a-b)

Measured memory_bytes: 38496
import math
import functools


class SegmentTree:
    def __init__(self, a: list, default: int, op):
        real_size = len(a)
        self.elem_size = 1 << int(math.ceil(math.log2(real_size)))  # honto ha int() iranai
        self.tree_size = 2 * self.elem_size + 1
        self.tree = [default] * (self.elem_size - 1) + a + [default] * (self.elem_size - real_size)
        self.operation = op

    def get_range_index(self, x, y, k=0, l_end=0, r_end=None):
        if r_end is None:
            r_end = self.elem_size

        if l_end == x and y == r_end-1:
            return [k]
        elif not l_end <= x <= y < r_end:
            return []

        mid = (l_end + r_end) // 2
        left_y = y if y < mid-1 else mid-1
        right_x = x if x > mid else mid

        left = self.get_range_index(x, left_y, 2*k+1, l_end, mid)
        right = self.get_range_index(right_x, y, 2*k+2, mid, r_end)
        return left + right

    def get_value(self, x, y):
        tree = self.tree
        index_list = self.get_range_index(x, y)
        op = self.operation
        return functools.reduce(op, (tree[n] for n in index_list))

    def update_tree(self, k: int):
        op = self.operation
        tree = self.tree

        while k > 0:
            k = (k-1) // 2
            left, right = tree[2*k+1], tree[2*k+2]
            tree[k] = op(left, right)

    def set_value(self, i: int, value: int, op: str):
        k = self.elem_size - 1 + i
        if op == "=":
            self.tree[k] = value
        elif op == "+":
            self.tree[k] += value
        self.update_tree(k)


n, q = map(int, input().split())
rsq = SegmentTree([0]*n, 0, lambda x, y: x+y)
ans = []
for _ in [0]*q:
    c, x, y = map(int, input().split())
    if c == 0:
        rsq.set_value(x-1, y, "+")
    else:
        ans.append(rsq.get_value(x-1, y-1))
print("\n".join([str(n) for n in ans]))

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

int L[2000][2000],R[2000][2000];
int D[2000][2000],U[2000][2000];

int main(){
    int h,w;
    cin>>h>>w;
    string s[h];
    for(int i=0;i<h;i++){
        cin>>s[i];
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s[i][j]=='#'){
                U[i][j]=L[i][j]=0;
                continue;
            }
            if(i==0){
                U[i][j]=1;
            }else{
                U[i][j]=U[i-1][j]+1;
            }
            if(j==0){
                L[i][j]=1;
            }else{
                L[i][j]=L[i][j-1]+1;
            }
        }
    }
    for(int i=h-1;i>=0;i--){
        for(int j=w-1;j>=0;j--){
            if(s[i][j]=='#'){
                D[i][j]=R[i][j]=0;
                continue;
            }
            if(i==h-1){
                D[i][j]=1;
            }else{
                D[i][j]=D[i+1][j]+1;
            }
            if(j==w-1){
                R[i][j]=1;
            }else{
                R[i][j]=R[i][j+1]+1;
            }
        }
    }
    int ans=-INF;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            ans=max(ans,L[i][j]+R[i][j]+D[i][j]+U[i][j]-3);
        }
    }
    cout<<ans<<endl;
}


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if ( a != b && b != c && a != c ) cout << 3 <<endl;
  else if ( a == b && b == c ) cout << 1 << endl;
  else cout << 2 << endl;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#ifdef ONLINE_JUDGE
  #define debug(x)
  #define debug2(x,y)
  #define debug3(x,y,z)
  #define assert(e) if(!(e)){stod("");}
#else
  #define debug(x) std::cerr<<#x<<": "<<x<<"\n"
  #define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
  #define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"
#endif

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void yes_no(bool x) {
  if (x) {
    print("Yes");
  } else {
    print("No");
  }
  exit(0);
}

void solve() {
  ll d, t, s;
  scan(d, t, s);
  yes_no(d <= t * s);
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 3164
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>

constexpr long long int MOD = 1000000007L;
int main() {
	int n, k; std::cin >> n >> k;
	std::vector<long long int> factorial(n + 1, 1);
	std::vector<long long int> inv(n + 1, 1);
	std::vector<long long int> inverse_factorial(n + 1, 1);
	for (auto i = 2; i < factorial.size(); ++i) {
		factorial[i] = i * factorial[i - 1] % MOD;
		inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
		inverse_factorial[i] = inv[i] * inverse_factorial[i - 1] % MOD;
	}
	for (auto i = 1; i <= k; ++i) {
		if (n - k + 1 < i) {
			std::cout << "0\n";
		}
		else {
			auto red = factorial[n - k + 1] * inverse_factorial[n - k + 1 - i] % MOD * inverse_factorial[i] % MOD;
			auto blue = factorial[k - 1] * inverse_factorial[k - i] % MOD * inverse_factorial[i - 1] % MOD;
			std::cout << red * blue % MOD << "\n";
		}
	}
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def main():
    N, K = [int(x) for x in input().split()]
    h = []
    for _ in range(N):
        h.append(int(input()))

    ans = float("inf")
    h.sort()
    for i in range(N - K + 1):
        ans = min(ans, h[i + K - 1] - h[i])

    print(ans)



if __name__ == '__main__':
    main()



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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll a, b, c;
string ret;

void input() {
  IN(a);
  IN(b);
  IN(c);
}

void solve() {
  if(a == b && b == c) {
    ret = "Yes";
  }else{
    ret = "No";
  }
}

int main(void){
  input();
  solve();
  PRINT(ret);
}


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

int main() {
    int h,a,n,sum=0;
    
    cin>>h>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        sum+=a;
    }
    
    if(sum>=h) cout<<"Yes";
    else cout<<"No";
    

    
    
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define F first 
#define S second
typedef long long ll ;
const ll N = 150000 ; 
ll n , a[N] , f[N] , mod = 1e9+7 , ans ;
ll poww ( ll x , ll y ){
	x %= mod ;
	if ( y == 0 ) return 1 ;
	if ( y == 1 ) return x ; 
	ll k = poww ( x , y / 2 ) ;
	if ( y % 2 )
		return ( ( k * k ) % mod * x ) % mod ; 
	return ( k * k ) % mod ;  
}
int main ()
{
	for ( ll i = 1 ; i <= 100011 ; i ++ )
		f[i] = ( f[i-1] + poww ( i , mod - 2 ) ) % mod ;
	cin >> n ;
	for ( ll i = 1 ; i <= n ; i ++ ){
		cin >> a[i] ; 
		ans = ( ans + ( ( ( f[i] * a[i] ) % mod + ( f[n-i+1] * a[i] ) % mod ) - a[i] + mod ) % mod ) % mod ; 
	}
	for ( ll i = 2 ; i <= n ; i ++ )
		ans = ( ans * i ) % mod ; 
	cout << ans ;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define itc ll t;cin>>t;while(t--)
#define otc ll t=1;while(t--)
#define PI 3.141592653589793238
//ang=(PI*ang)/180.0 in radian
#define Max(a,b,c) max(a,max(b,c));
#define all(v) v.begin(),v.end()
#define ll long long int
#define ld long double
#define pb push_back
#define eb emplace_back
#define gcd(a,b) __gcd(a,b)
#define fi first
#define se second
int dx[4] = {0, -1, 0, 1};
int dy[4] = {1, 0, -1, 0};
int main()
{
	ll n;
	cin >> n;
	ll ar[n];
	ll check[1000005];
	memset(check, 0, sizeof(check));
	for (ll i = 0; i < n; i++)
	{	cin >> ar[i];
		check[ar[i]]++;
	}
	sort(ar, ar + n);
	ll ans = 0;
	ll final[n];
	memset(final, 0, sizeof(final));
	for (ll i = 0; i < n; i++)
	{
		ll e = ar[i];
		for (ll j = 1; j <= sqrt(e); j++)
		{
			if (e % j == 0)
			{
				ll p = j;
				ll q = e / j;
				if (p != e && check[p] >= 1)
					final[i] = 1;
				
				if (q != e && check[q] >= 1)
					final[i] = 1;
			}
		}
		if(check[e]>=2)
		final[i]=1;
	}
	for (int i = 0; i < n; i++)
	{
		if (!final[i])
			ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 14588
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner in = new Scanner(System.in);

		double r = in.nextDouble();

		//System.out.println((r*r*Math.PI) + " " + (2*r*Math.PI));
		System.out.printf("%f %f\n",(r*r*Math.PI),(2*r*Math.PI));

		//System.out.printf("%.10f %.10f\n",r*r*Math.PI,(2*r)*Math.PI)

	}

}



Measured memory_bytes: 28288
n=int(input())
s=[]
ac,wa,tle,re=0,0,0,0
for i in range(n):
    s.append(input())
    if s[-1]=="AC":
        ac+=1
    elif s[-1]=="TLE":
        tle+=1
    elif s[-1]=="WA":
        wa+=1
    else:
        re+=1
print("AC x {}".format(ac))
print("WA x {}".format(wa))
print("TLE x {}".format(tle))
print("RE x {}".format(re))

Measured memory_bytes: 16328
fun main(args: Array<String>) {
    val n = readInputLine().toInt()
    val s = readInputLine().toMutableList()
    
    var ans = 1L
    
    for (c in 'a'..'z') {
        ans *= (s.count { it == c } + 1L).toLong()
        ans %= 1000000007L
    }
    
    println((ans + 1000000007L - 1L) % 1000000007L)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 34480
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for(int i = 0; i < N; i++)
        {
            arr[i] = sc.nextInt();
        }
        int res = maximumProfit(arr);
        System.out.println(res);
    }
    public static int maximumProfit(int[] arr) {
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;

        for(int i = 1; i < arr.length; i++)
        {
            min = Math.min(min, arr[i-1]);
            max = Math.max(max, arr[i]-min);
        }
        return max;
    }
}



Measured memory_bytes: 70856
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

typedef long long ll;

ll n, mx = -1, mi;
vector<ll> ve[200005];

void dfs(ll p, ll q, ll r)
{
    if(r > mx) mx = r, mi = p;
    for(ll i = 0; i < ve[p].size(); i++)
    {
        if(ve[p][i] == q) continue;
        dfs(ve[p][i], p, r + 1);
    }
}

int main()
{
    scanf("%lld", &n);
    for(ll i = 1; i < n; i++)
    {
        ll t1, t2;
        scanf("%lld%lld", &t1, &t2);
        ve[t1].push_back(t2);
        ve[t2].push_back(t1);
    }
    dfs(1, 0, 0);
    dfs(mi, 0, 0);
    if(mx % 3 == 1) printf("Second\n");
    else printf("First\n");
    return 0;
}


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

ll N;

int rec(string S, ll N){
  if (stol(S) > N) return 0;

  bool check_7 = false;
  bool check_5 = false;
  bool check_3 = false;
  rep(i, S.size()){
    if (S[i]=='7') check_7 = true;
    else if (S[i]=='5') check_5 = true;
    else if (S[i]=='3') check_3 = true;
  }

  int res;
  if (check_7 && check_5 && check_3) res = 1;
  else res = 0;

  res += rec(S + "7", N);
  res += rec(S + "5", N);
  res += rec(S + "3", N);

  return res;
}

int main(){
  cin >> N;
  cout << rec("0", N) << endl;
}


Measured memory_bytes: 3492
#include<stdio.h>

int N,data[100];

void input(){
  scanf("%d",&N);
  int i;
  for(i = 0; i < N; i++) scanf("%d",&data[i]);
}

void print(){
  int i;
  for(i = 0; i < N; i++){
    if(i) printf(" ");
    printf("%d",data[i]);
  }
  printf("\n");
}

void insertion_sort(){
  print();
  int i,j;
  for(j = 1; j < N; j++){
    int key = data[j];
    i = j-1;
    while(i >= 0 && data[i] > key){
      data[i+1] = data[i];
      i--;
    }
    data[i+1] = key;
    print();
  }
}

int main(){
  input();
  insertion_sort();
  return 0;
}

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

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;

void solve() {
	int n;
	cin >> n;

	cout << (n >= 30 ? "Yes" : "No") << endl;
}

// you should probably see down .. believe me it would help
int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
//	cin >> t_c;
	while (t_c--)
		solve();
}

// COME ON DUDE .... GIVING UP NOT GONNA HELP
// JUST GET YOUR ASS TO WORK ALREADY ..
// AND FOR FUCKING SAKE ... DONT PANIC !!


Measured memory_bytes: 3648
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
long long a[100000];
long long gcd(long long a,long long b)
{
	return b?gcd(b,a%b):a;
}

int cmp(const long long &a,const long long &b)
{
	if (a%2==0 && b%2==1) return 1;
	else if (a%2==1 && b%2==0) return 0;
	else return a<b;
}
int main()
{
	int N,n;
	while(1)
	{
		long long x,y,z,tmp,r1,r2,d2,m,p,q,yh;
		scanf("%d",&n);
		if (n==0) break;
		N=(n+1)*n/2;
		for (int i=1;i<=N;i++) scanf("%lld",a+i);

		sort(a+1,a+N+1,cmp);
		x=a[n+1]; y=a[1];	z=a[2];

		tmp=gcd(y,z);	r1=y/tmp;	r2=z/tmp;
		d2=x/r1/r2;

		p=1;q=2147483647;
		while (p<=q)
		{
			m=(p+q)>>1;
			if (m*m==d2) break;
			else if (m*m<d2) p=m+1;
			else q=m-1;
		}
		tmp/=m;
		yh=tmp;

		p=1;q=d2;
		while (p<=q)
		{
			m=(p+q)>>1;
			if (m*m==d2) break;
			else if (m*m<d2) p=m+1;
			else q=m-1;
		}
		tmp/=m;

		printf("%lld\n",(yh!=0)*yh);
		for (int i=1;i<=n;i++)
			{
				if (i<n) printf("%lld ",a[i]/yh);
				else printf("%lld\n",a[i]/yh);
			}
	}
	return 0;
}

Measured memory_bytes: 0
H,W=map(int,input().split())
N=10
c=[[int(i) for i in input().split()] for i in range(N)]
A=[[int(i) for i in input().split()] for i in range(H)]
for k in range(N):
    for i in range(N):
        for j in range(N):
            if c[i][k]+c[k][j]<c[i][j]:
                c[i][j]=c[i][k]+c[k][j]
ans=0
for i in range(H):
    for j in range(W):
        if A[i][j]==-1:
            continue
        ans+=c[A[i][j]][1]
print(ans)


Measured memory_bytes: 3444
# TLE
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1

def main():
    h, w, d = map(int, input().split())
    atoij = [[] for _ in range(h * w)]
    for i in range(h):
        for j, a in enumerate(map(int, input().split())):
            a -= 1
            atoij[a] = [i, j]
    # print(atoij)
    q = int(input())
    ans=[0]*q
    mx = [0] * d
    mn = [100000] * d
    qq = [[] for _ in range(d)]
    for qi in range(q):
        l, r = map(int1, input().split())
        md = l % d
        if l < mn[md]: mn[md] = l
        if r > mx[md]: mx[md] = r
        qq[md].append([qi, l, r])
    for md in range(d):
        if not qq[md]: continue
        a = mn[md]
        ed = mx[md]
        s = 0
        dist = {}
        i0, j0 = atoij[a]
        while a <= ed:
            i1, j1 = atoij[a]
            s += abs(i0 - i1) + abs(j0 - j1)
            dist[a] = s
            i0, j0 = i1, j1
            a += d
        for qi, l, r in qq[md]:
            ans[qi]=dist[r]-dist[l]
    for x in ans:
        print(x)

main()


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

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

typedef long long ll;

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

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

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

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

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

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

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

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

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

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

ll n;
vector<vpll> to;
vll ans;

void dfs(ll cur, ll pre, ll color){
	ans[cur]=color;
	for(auto&& e:to[cur]){
		if(e.first==pre) continue;
		dfs(e.first,cur,color^(e.second&1));
	}
}

int main()
{
	cin >> n;
	to.resize(n);
	ans.resize(n);
	rep(i,n-1){
		ll u,v,w;
		cin >> u >> v >> w;
		u--;
		v--;
		to[u].pb(m_p(v,w));
		to[v].pb(m_p(u,w));
	}
	dfs(0,0,0);
	for(auto&& e:ans) cout << e << endl;
	return 0;
}


Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,W;
    cin>>N>>W;
    vector<int> v(N+1),w(N+1);
    v.at(0)=0;
    w.at(0)=0;
    for(int i=1;i<N+1;i++){
        cin>>v.at(i)>>w.at(i);
    }

    vector<vector<int>> dp(N+1,vector<int>(W+1,-1));
    for(int i=0;i<N+1;i++){
        dp.at(i).at(0)=0;
    }
    for(int j=0;j<W+1;j++){
        dp.at(0).at(j)=0;
    }
    for(int i=1;i<N+1;i++){
        for(int j=1;j<W+1;j++){
            if(j-w[i]>=0) dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
            else dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[N][W]<<endl;
}


Measured memory_bytes: 6760