akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import static java.lang.System.*;
import java.io.*;
import java.math.*;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		long m = sc.nextLong();
		long n = sc.nextLong();
		long ans = lcm(m,n);
		out.print(ans);
		

		out.close();
	}
	
	  private static long lcm(long m, long n) {
		    return m * n / gcd(m, n);
		}
	  //最大公約数を求めるメソッド
	  private static long gcd(long m, long n) {
		    if(m < n) return gcd(n, m);
		    if(n == 0) return m;
		    return gcd(n, m % n);
		}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}

Measured memory_bytes: 21204
#include <iostream>
#include <algorithm>
using namespace std;
   int n1;
int main(){
	while (true){
		cin >> n1;
		int a[n1]; if (n1 <= 0) break;
		for (int i = 0; i < n1; i++){
			cin >> a[i];
		}
		sort(a, a + n1);
		a[0] = { 0 };
		a[n1 - 1] = { 0 };
		for (int i2 = 1; i2 < n1; i2++){
			a[0] += a[i2];
		}
		cout << a[0] / (n1 - 2) << endl;
	}
		return 0;
}
 

Measured memory_bytes: 1176
import math

N, D = map(int, input().split())

X = []
for n in range(N):
    X.append(list(map(int,input().split())))

ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        p = 0
        for d in range(D):
            p += (X[i][d] - X[j][d])**2

        z = math.sqrt(p)
        if z.is_integer():
            ans += 1

print(ans)

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

from sys import stdin
from collections import deque

UNVISITED, VISITED_IN_QUEUE, POPPED_OUT = 0, 1, 2


def generate_adj_matrix(_v_info):
    for v_detail in _v_info:
        v_from, v_to = map(int, v_detail)
        init_adj_table[v_from].append(v_to)
        init_in_deg_list[v_to] += 1
    return init_adj_table, init_in_deg_list


def topological_sort():
    for v in range(vertices):
        if not in_deg_list[v] and status[v] is UNVISITED:
            bfs(v)

    return ans


def bfs(v):
    v_queue.append(v)
    status[v] = VISITED_IN_QUEUE

    while v_queue:
        current = v_queue.popleft()

        ans.append(current)

        for v_adj in adj_table[current]:
            in_deg_list[v_adj] -= 1
            if not in_deg_list[v_adj] and status[v_adj] is UNVISITED:
                status[v_adj] = VISITED_IN_QUEUE
                v_queue.appendleft(v_adj)

        status[current] = POPPED_OUT

    return None


if __name__ == '__main__':
    _input = stdin.readlines()
    vertices, edges = map(int, _input[0].split())
    v_info = map(lambda x: x.split(), _input[1:])

    status = [UNVISITED] * vertices
    v_queue = deque()
    init_adj_table = tuple([] for _ in range(vertices))
    init_in_deg_list = [0] * vertices

    ans = []
    adj_table, in_deg_list = generate_adj_matrix(v_info)
    print(*topological_sort(), sep='\n')

Measured memory_bytes: 14520
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();

    string ans = "~";
    for(int i=0; i<=n-m; ++i){
        bool ok = true;
        string s2 = s;
        for(int j=0; j<m; ++j){
            if(s[i+j] != '?' && s[i+j] != t[j])
                ok = false;
            s2[i+j] = t[j];
        }
        if(ok){
            replace(s2.begin(), s2.end(), '?', 'a');
            ans = min(ans, s2);
        }
    }

    if(ans == "~")
        cout << "UNRESTORABLE" << endl;
    else
        cout << ans << endl;

    return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  ll ans=LINF;
  reps(i,1000000){
    if(n%i==0){
      chmin(ans,n/i+i-2);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
 
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
 
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
 
using namespace std;
/**************************************************************************/
int main()
{
	fastIO;
	int n,i,j,k;
	cin>>n;
	j = n / 4 + 10;
	fo(i,j)
	{
		k = n - (i * 4);
		if(k<0)break;
		if(k%7==0)
		{
			cout<<"Yes";
			return(0);
		}
	}
	cout<<"No";
	return(0);
}
/*************************************************************************/ 

Measured memory_bytes: 384
#include <stdio.h>
#define N 1000

int main(void)
{
	int i , n;
	scanf("%d",&n);
	double a[n];
	
	for(i = 0; i < n; i++)
	{
		scanf("%lf",&a[i]);
	}
	double b[n+1];
	for(i = 0; i <= n; i++)
	{
		scanf("%lf",&b[i]);
	}
	double c[n+1][n+1];
	double d[n+1];
	c[0][0]=b[0];
	d[0]=a[0]+b[0];
	
	for(i = 1; i <= n; i++)
	{
		c[i][i] = b[i];
		c[i-1][i] = a[i-1]+(b[i-1]+b[i])*2;
		d[i] = d[i-1]+a[i]+b[i];
	}
	int j , k;
	double s , t;
	for(i = 1;i < n; i++)
	{
		for(j = 0; j < n-i; j++)
		{
			s = c[j][j] + c[j+1][i+j+1];
			for(k = j; k <i+j; k++)
			{
				t = c[j][k+1]+c[k+2][i+j+1];
				if(s>t) s = t;
			}
			c[j][i+j+1] = s + d[i+j] - d[j-1] + b[i+j+1];
		}
	}
	printf("%lf\n",c[0][n]);
	return 0;
}


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

int main(){
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if(e - a > k) cout << ":(" << endl;
	else cout << "Yay!" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


main() {
	char s[60];
	char t[60];
	int n,m;
	int check=0;
	scanf("%s%s", s, t);
	n = strlen(s);
	m = strlen(t);
	for (int i = n - m; i >= 0; i--) {
		for (int j = 0; j < m; j++) {
			if (s[i + j] != t[j] && s[i + j] != '?') {
				break;
			}
			if(j==m-1){check = 1;}
		}
		if (check == 1) {
			for (int j = 0; j < m; j++) {
				s[i + j] = t[j];
				
			}
			for (int j = 0; j < n; j++) {
				if (s[j] =='?') {
					s[j] = 'a';
				}
			}
          goto fin;
		}
	}
  printf("UNRESTORABLE");
  return 0;
  fin:
	printf("%s", s);
	return 0;
}

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

namespace CSharpSample01
{


	class Program
	{
		static void Main(string[] args)
		{
			// スペース区切りの整数の入力
			var inputNum = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

			long A = inputNum[0];
			long B = inputNum[1];

			var flag = false;
			var answer = -1;

			for(int i = 1; i <= 1000;i++)
			{
				var testA = i * 0.08;
				var testB = i * 0.1;

				if ((int)testA == A && (int)testB == B )
				{
					answer = i;
					flag = true;
					break;
				}
			}

			if(flag)
			{
				Console.WriteLine(answer);
			}
			else
			{
				Console.WriteLine(-1);
			}
		}
	}
}

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

int main()

{
	ios::sync_with_stdio(false);
	int n,k;
	double ans=0.0;
	cin>>n>>k;
	for (int i=1;i<=n;i++){
		double tmp=1.0/n;
		int sc=i;
		while (sc<k){
			sc*=2;
			tmp/=2;
		}
		ans+=tmp;
	}

	printf("%.12f\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
/* -- template -- */
string dp[10001];//マッチ棒i本作ったときに作れる最大の数字

string chmax(string a, string b) {
    if(a[0] < a[a.size() - 1]) {
        for(int i = a.size() - 1;i > 0; --i) {
            swap(a[i], a[i - 1]);
        }
    }
    if(b[0] < b[b.size() - 1]) {
        for(int i = b.size() - 1;i > 0; --i) {
            swap(b[i], b[i - 1]);
        }
    }
    if(a.size() > b.size())return a;
    if(b.size() > a.size())return b;

    for(int i = 0; i < a.size(); ++i) {
        if(a[i] > b[i])return a;
        if(b[i] > a[i])return b;
    }
    return a;
}

const string MINUSINF = "-";

const int match[9] = {2,5,5,4,5,6,3,7,6};
int main(){
    int N, M; cin >> N >> M;
    char A[M];rep(i, M) cin >> A[i];
    rep(i, N + 1)dp[i] = MINUSINF;
    dp[0] = "";
    for(int i = 1; i <= N; ++i) {
        rep(j, M) {
            if(i >= match[A[j] - '1'] && dp[i - match[A[j] - '1']] != MINUSINF) {
                dp[i] = chmax(dp[i], dp[i - match[A[j] - '1']] + A[j]);
            }
        }
    }
    cout << dp[N] << endl;
}


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

using namespace std;

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

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
           
#define rep(i, n) for (int i = 0; i < n; ++i)

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

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
    int n;
    while (scanf("%d", &n), n)
    {
	n /= 4;
	int res = 0;
	rep (i, n)
	{
	    int t;
	    scanf("%d", &t);
	    res += t;
	}
	printf("%d\n", res);
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <set>
using namespace std;
typedef long long ll;


int main(void){
    char s[4];
    cin >> s;
    
    bool ok = true;
    for (int i = 0; i < 3; i++) {
        if (s[i] == s[i + 1]) ok = false;
    }
    if (ok) cout << "Good" << endl;
    else cout << "Bad" << endl;
}


Measured memory_bytes: 256
#include <cstdio>

int main()
{
	int n;
	while (scanf("%d\n", &n) != EOF) {
		if (n == 0)
			break;
		char change[256];
		bool changed[256];
		for (int i = 0; i < 256; ++i) {
			change[i] = i;
			changed[i] = false;
		}

		for (int i = 0; i < n; ++i) {
			char a, b;
			scanf("%c %c\n", &a, &b);
			if (!changed[a]) {
				change[a] = b;
				changed[a] = true;
			}
		}

		int m;
		scanf("%d\n", &m);
		for (int i = 0; i < m; ++i) {
			char c;
			scanf("%c\n", &c);
			printf("%c", change[c]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;



int main()
{	
	int ans=0;
	string s;
	cin>>s;
	if(s.length()==1)cout<<0<<endl;
	else
	{
		for(int i=0;i<s.length()-1;i++)
		{
			if(s[i]!=s[i+1])ans++;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

int N;
int ans = 0;
map<int, int> a_map;
int next(int before, vector<int> &a) {
  int next_index = a[before - 1];
  a_map[next_index]++;
  ans++;

  if (next_index == 2) {
    return ans;
  }
  if (a_map[next_index] != 1) {
    return -1;
  }
  next(next_index,a);
}

int main(int argc, char const *argv[]) {
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  int temp = 0;
  temp = next(1, a);
  cout << temp << endl;
  return 0;
}


Measured memory_bytes: 9984
from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]
num = set(A)
count = Counter(A)
dp = [True] * (10**6 + 1)

for a in num:
    for n in range(a+a, 10**6+1, a):
        dp[n] = False

ans = 0
for a in num:
    if count[a] == 1 and dp[a] == True:
        ans += 1

print(ans)

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

int main(){
    int n;
    cin >> n;
    ve<int> x(n), y(n),pe(n);
    rep(i,n){
        cin >> x[i] >> y[i];
        pe[i] = i;
    }
    double ans = 0;
    do{
        rep(i,n-1){
            double m = pow((x[pe[i]]-x[pe[i+1]]),2)+pow(y[pe[i]]-y[pe[i+1]],2);
            ans += sqrt(m);
        }
    }while(next_permutation(pe.begin(), pe.end()));
    int a = 1;
    rep(i,n)a *= i+1;
    ans /= (double)a;
    printf("%.20f\n", ans);
    return 0;
}

Measured memory_bytes: 256
/*{{{*/
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
using namespace std;
typedef pair<int, int> PP;
typedef long long LL;
#define pb push_back
#define fr first
#define sc second
#define bitcnt __builtin_popcount
#define all(x) x.begin(), x.end()
inline LL ri() {LL x; scanf("%lld", &x); return x;}
#define rep2(i, n, ...) for (int i = 0; i < (n); i ++) 
#define rep3(i, a, b, ...) for (int i = (a); i < (b); i ++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define drep2(i, n, ...) for (int i = (n) - 1; i >= 0; i --)
#define drep3(i, a, b) for (int i = (a) - 1; i >= (b); i --)
#define drep(...) GET_MACRO(__VA_ARGS__, drep3, drep2)(__VA_ARGS__)
template<typename T>inline bool smax(T&a, T b){if(a<b){a=b;return true;}return false;} 
template<typename T>inline bool smin(T&a, T b){if(a>b){a=b;return true;}return false;} 
/*}}}*/


vector<int> s[1000];
void solve(int n) {
  cout << "Yes" << endl;
  int x = 1;
  for (int i = 0; i < n; i ++) {
    for (int j = 0; j < i; j ++) {
      s[i].push_back(x);
      s[j].push_back(x);
      x ++;
    }
  }
  cout << n << endl;
  for (int i = 0; i < n; i ++) {
    cout << s[i].size() << ' ';
    for (auto k : s[i]) {
      cout << k << ' ';
    }
    cout << endl;
  }
}

int main() {

  int n;

  cin >> n;

  for (int i = 0; i < 1000; i ++) {
    if (i * (i - 1) == 2 * n) {
      solve(i);
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 2304
N, M = map(int, input().split())
sc = []
for i in range(M):
    s,c = map(int, input().split())
    sc.append([s,c])

ans = 0
sc_dic = {}
min_s = N+1
for i in sc:
    min_s = min(min_s, i[0])
    if i[0] in sc_dic:
        if i[1] != sc_dic[i[0]]:
            ans = -1
            break
        break
    else:
        ans += 10**(N-i[0])*i[1]
        sc_dic[i[0]] = i[1]

if ans != -1:
        
    if min_s == N+1:
        if N == 1:
            ans = 0
        else:
            ans = 10**(N-1)
        sc_dic[1]=1

    if 1 not in sc_dic:
        ans += 10**(N-1)
        sc_dic[1] = 1
        min_s = 1

    if sc_dic[1] == 0 and N!=1:
        ans = -1

print(ans)

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


namespace AtCoder
{
    class Program
    {

        const int BiggestMod = 1000000007;

        static void Main()
        {

            var arg = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int lengthShort = arg[0], lengthLong = arg[1];
            int hour = arg[2], minite = arg[3];

            var radShort = (((double)hour * 30.0) + ((double)minite / 2.0)) * Math.PI / 180.0;
            var radLong = (((double)minite * 6.0)) * Math.PI / 180.0;

            var cos = Math.Cos(Math.Abs(radShort - radLong));
            var result = Math.Sqrt((double)(lengthShort * lengthShort) + (lengthLong * lengthLong) - (double)(2 * lengthShort * lengthLong) * cos);

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 28692
s = input()
result = "Yes"
if s.find('N') > -1 :
  if s.find('S') == -1:
    result = "No"
if s.find('S') > -1 :
  if s.find('N') == -1:
    result = "No"
if s.find('W') > -1 :
  if s.find('E') == -1:
    result = "No"
if s.find('E') > -1 :
  if s.find('W') == -1:
    result = "No"
print(result)

Measured memory_bytes: 3064
s = input()

if s[0] != s[1] and s[1] != s[2] and s[0] != s[2]:
  print('Yes')
else:
  print('No')
#1文字目と2文字目　2文字目と3文字目　1文字目と3文字目
# 全て異なればOK?
# aaa bbb acc X
# abc bca cba O

Measured memory_bytes: 8968
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define uniq(x) ((x).erase(unique(all(x)),(x).end()))
#define sz(x) ((int)(x).size())

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

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

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


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

  int ans=0;
  for(int i=1;i<=N;i+=2){
    int cnt=0;
    REP(j,1,i+1) if(i%j==0)  cnt++;
    if(cnt==8)  ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3660
using System;
class Program
 {
        static void Main(string[] args)
        {
        
    　　int a,b;
            string[] S = Console.ReadLine().Split(' '); //標準入力
            a = int.Parse(S[0]); //標準入力
            b = int.Parse(S[1]); //標準入力
          if((b-1)%(a-1) == 0 ){
            Console.WriteLine((b-1)/(a-1));
          }else{
            Console.WriteLine((b-1)/(a-1)+1);
          }
        }
 }

Measured memory_bytes: 13140
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

long[100][8] DP;

long P = 1_000_000_007;

void main()
{

    foreach (ref h; DP) foreach (ref e; h) e = -1;

    auto hwk = readln.split.to!(int[]);
    auto H = hwk[0];
    auto W = hwk[1];
    auto K = hwk[2];

    long[] BS;
    BS.length = W;
    foreach (s; 0..2^^(W-1)) {
        bool prev, ok = true;
        foreach (i; 0..W-1) {
            auto c = (s & (1<<i)) > 0;
            if (prev && c) {
                ok = false;
                break;
            }
            prev = c;
        }
        if (!ok) continue;
        ++BS[0];
        foreach (i; 0..W-1) {
            if (s & (1<<i)) ++BS[i+1];
        }
    }

    long solve(int w, int h) {
        if (h == H) return w == K-1 ? 1 : 0;
        if (DP[w][h] != -1) return DP[w][h];

        auto r = solve(w, h+1) * (BS[0] - (w > 0 ? BS[w] : 0) - (w < W-1 ? BS[w+1] : 0));
        if (w > 0) r += solve(w-1, h+1) * BS[w];
        if (w < W-1) r += solve(w+1, h+1) * BS[w+1];
        return DP[w][h] = r % P;
    }

    writeln(solve(0, 0));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16000000")
using namespace std;

const int Maxn = 100005;

int n, A, B;
vector <int> neigh[Maxn];
int distA[Maxn], distB[Maxn];
int parA[Maxn], parB[Maxn];
int best;

void Traverse(int v, int p, int lvl, int dist[], int par[])
{
    dist[v] = lvl; par[v] = p;
    for (int i = 0; i < neigh[v].size(); i++) {
        int u = neigh[v][i];
        if (u == p) continue;
        Traverse(u, v, lvl + 1, dist, par);
    }
}

void Solve(int v)
{
    best = max(best, distB[v] - 1);
    for (int i = 0; i < neigh[v].size(); i++) {
        int u = neigh[v][i];
        if (parB[v] == u) continue;
        Solve(u);
    }
}

int main()
{
    scanf("%d %d %d", &n, &A, &B);
    for (int i = 0; i < n - 1; i++) {
        int a, b; scanf("%d %d", &a, &b);
        neigh[a].push_back(b);
        neigh[b].push_back(a);
    }
    Traverse(A, 0, 0, distA, parA);
    Traverse(B, 0, 0, distB, parB);
    int r = A;
    while (parB[r] && distA[parB[r]] < distB[parB[r]])
        r = parB[r];
    Solve(r);
    printf("%d\n", best);
    return 0;
}


Measured memory_bytes: 13696
s = input()
k = int(input())
n = len(s)

substring = []

for i in range(min(n, k)):
    for j in range(n-i):
        substring.append(s[j:j+i+1])
        #print(s[j:j+i+1], j, j+i+1)

substring = list(set(substring))
substring.sort()
#print(substring)

print(substring[k-1])


Measured memory_bytes: 5068
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int> a, b, c;
int n;
int binary_search(vector<int> &a, int b)
{
    int lb = 0, ub = a.size() + 1;
    int mid = 0;
    while (ub - lb > 1)
    {
        mid = (lb + ub) / 2;
        if (b >= a[mid])
        {
            lb = mid;
        }
        else
        {
            ub = mid;
        }
    }
    return (a[lb] <= b ? lb < n - 1 ? lb + 1 : n : lb);
}
int binary(vector<int> &a, int b)
{
    int lb = 0, ub = a.size();
    while (ub - lb > 1)
    {
        int mid = (lb + ub) / 2;
        if (b < a[mid])
            lb = mid;
        else
        {
            ub = mid;
        }
    }
    return ub;
}
signed main()
{
    cin >> n;
    int sum = 0;
   
    for (int i = 0; i < n; i++)
    {
        int d;
        cin >> d;
        a.push_back(d);
    }
    for (int i = 0; i < n; i++)
    {
        int d;
        cin >> d;
        b.push_back(d);
    }
    for (int i = 0; i < n; i++)
    {
        int d;
        cin >> d;
        c.push_back(d);
    }
    if(n == 1){
        cout << (a[0] < b[0] && b[0] < c[0] ? 1 : 0) << endl;
        return 0;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    vector<int> con;
    vector<int> sums(n + 1, 0);
    for (int i = 0; i < n; i++)
    {
        con.push_back(n - binary_search(c, b[i]));
    }
    sort(con.begin(), con.end());
    for (int i = 0; i < n; i++)
    {
        sums[i + 1] = sums[i] + con[i];
    }
    vector<int> f;
    for (int i = 0; i < n; i++)
    {
        f.push_back(binary_search(b, a[i]));
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans += sums[n - f[i]];
    }
    cout << ans << endl;
}


Measured memory_bytes: 5748
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(" ", $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int)$this->next();
    }

    public function nextDouble()
    {
        return (double)$this->next();
    }
}

class out
{
    public static function printIn($str = "")
    {
        echo $str . PHP_EOL;
    }
}

$sc = new Scanner;

$N = $sc->nextInt();
$num = [];

for ($i = 0; $i < $N * 3; $i++) {
    $num[] = $sc->nextInt();
}

rsort($num);
$res = [];
for ($i = 0; $i < $N * 3; $i += 2) {
    $res[] = $num[$i + 1];
    if (count($res) == $N) {
        break;
    }
}

echo array_sum($res);

Measured memory_bytes: 45596
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String A = sc.next();
    String B = sc.next();
    if (A.length() > B.length()) {
      System.out.println("GREATER");
    } else if (A.length() < B.length()) {
      System.out.println("LESS");
    } else {
      if (A.compareTo(B) > 0) {
        System.out.println("GREATER");
      } else if (A.compareTo(B) < 0) {
        System.out.println("LESS");
      } else {
        System.out.println("EQUAL");
      }
    }
  }
}

Measured memory_bytes: 23764
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    cin >> S >> T;
    ll ans = 0;
    REP(i, 0, S.size()) {
        if (S[i] != T[i]) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3804
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,Q = map(int,readline().split())
S = 'x' + readline().rstrip().decode('utf-8') + 'x'
query = read().decode('utf-8').split()

# ここに居れば左右に落ちない、ぎりぎり
L = 1; R = N
for T,D in zip(query[-2::-2],query[-1::-2]):
    if D == 'L':
        if S[L] == T:
            L += 1
        if S[R+1] == T:
            R += 1
    else:
        if S[R] == T:
            R -= 1
        if S[L-1] == T:
            L -= 1
    if L > R:
        break

x = R-L+1
if x <= 0:
    x = 0
print(x)

Measured memory_bytes: 10864
# include <iostream>
# include <string>
# include <set>
# include <queue>

using namespace std;

int ds[4][2] = { {-1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

int h, w, cnt, ans;
string tb[1111];
queue < pair < int, int > > q1, q2;

bool check( int x, int y )
{
	if( x < 0 )
		return 0;
	if( x >= h ) 
		return 0;
	if( y < 0 )
		return 0;
	if( y >= w )
		return 0;
	return 1;
}

void fill( int x, int y )
{
	for ( auto d: ds ){
		int xx = ( x + d[0] );
		int yy = ( y + d[1] );
		if( check( xx, yy ) && tb[xx][yy] == '.' ){
			cnt --;
			tb[xx][yy] = '#';
			q2.push( make_pair( xx, yy ) );
		}
	} 
}

int main()
{
	cin >> h >> w;
	for ( int i = 0; i < h; i ++ ){
		cin >> tb[i];
		for ( int j = 0; j < w; j ++ ){
			if( tb[i][j] == '#' )
				q1.push( { i, j } );
			else
				cnt ++;
		}
	}
	
	while( cnt ){
		
		while( q1.empty() == false ){
			pair < int, int > ps = q1.front();
			q1.pop();
			fill( ps.first, ps.second );
		}
		ans ++;
		swap( q1, q2 );
		
		while( q2.empty() == false )
			q2.pop();
	}
	cout << ans;
	
}


Measured memory_bytes: 9488
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
signed main() {
    int a, b;
    cin >> a >> b;
    if (a > b) 
        swap(a, b);
    if ((b - a) % 2 == 1) {
        cout << "IMPOSSIBLE\n";
    } else {
        cout << a + (b - a) / 2 << "\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli A,B=0,C=0,D=0,F=0;
  vector<int>P(26,0);
  string S;
  cin >> S;
  A=S.size();
  rep(i,A){
    P[S[i]-97]++;
  }
  rep(i,26){
    if(P[i]%2!=0){
      Out("No");
      C=1;
      break;
    }
  }
  if(C==0)Out("Yes");
}

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

using namespace std;
int a, b, c, k;

int main()
{
    cin >> a >> b >> c >> k;
    
    int x = max(a, max(b, c));
    
    int answer = a + b + c - x + x * pow(2, k);
    
    cout << answer << endl;
}

Measured memory_bytes: 256
a=[[0]*10,[0]*100,[0]*1000]
n=int(input())
s=input()
for i in s:
  d=int(i)
  for j in range(100):
    if a[1][j]:
      a[2][10*j+d]=1
  for j in range(10):
    if a[0][j]:
      a[1][10*j+d]=1
  a[0][d]=1
print(sum(a[2]))

Measured memory_bytes: 3064
from heapq import heappush, heappop
N = int(input())
S = []
for i in range(N):
    l, r = map(int, input().split())
    S.append((l, r))
S.sort()

if all(l <= 0 <= r for l, r in S):
    print(0)
    exit(0)

que = []
P = []
Q = [l for l, r in S]
Q.reverse()
ans = 0
a = b = 0
p = 0
for i in range(N+1):
    if i < N:
        l, r = S[i]
    while que and que[0] <= l:
        P.append(heappop(que))
    cnt = min(len(P), len(Q))
    while p < cnt:
        a += P[p]
        b += Q[p]
        p += 1
    ans = max(ans, abs(a-b)*2)
    if len(P) < len(Q):
        b2 = b + Q[cnt]
        ans = max(ans, abs(a-b2)*2)
    elif len(P) > len(Q):
        a2 = a + P[cnt]
        ans = max(ans, abs(a2-b)*2)
    heappush(que, r)
    if cnt == len(Q) > 0:
        a -= P[cnt-1]
        b -= Q[cnt-1]
    if i < N:
        Q.pop()
print(ans)


Measured memory_bytes: 102616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);


int main(){
	ll N,M;
	cin >> N >> M;
	vector<ll> s(M);
	vector<char> c(M);

	string ans="";
	FOR(i,0,N)ans=ans+'x';
	//cout << ans << endl;
	FOR(i,0,M){
		cin>>s[i]>>c[i];
		if(ans[s[i]-1]==c[i] || ans[s[i]-1]=='x'){
			ans[s[i]-1] = c[i];
		}else{
			cout << -1 << endl;
			return 0;
		}
	}

	if((N==1 && ans[0]=='x') || (N==1 && ans[0]=='0')){
		cout << 0 << endl;
		return 0;
	}

	if(ans[0]=='x')ans[0]= '1';
	if(ans[0]=='0'){
		cout << -1 << endl;
		return 0;
	}
	FOR(i,1,N){
		if(ans[i]=='x')ans[i]='0';
	}
	cout << ans << endl;
}



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

int main(void){
    int n, k;
    string s;
    cin >> n >> k >> s;

    s[k - 1] = tolower(s[k - 1]);

    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(3*n);
	rep(i,3*n) cin >> a.at(i);
	sort(a.begin(),a.end());
	ll ans=0;
	int j=3*n-2;
	rep(i,n){
		ans+=a.at(j);
		j-=2;
	}
	cout << ans << endl;
}

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

namespace _0005
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = "";
            while ((s = Console.ReadLine()) != null)
            {
                long a = 0;
                long b = 0;
                long[] ab = new long[2];
                List<long> answer = new List<long>();
                ab = s.Split(' ').Select(long.Parse).ToArray();
                //Array.Sort(ab);
                a = ab[0];
                b = ab[1];
                //最大公約数を求める
                answer.Add(EuclideanAlgorithm(a, b));
                //最小公倍数を求める
                answer.Add(a * b / answer[0]);
                Console.WriteLine("{0} {1}", answer[0], answer[1]);
            }
        }
        static long EuclideanAlgorithm(long a, long b)
        {
            while (a % b != 0)//ユークリッドの互除法
            {
                long c = b;
                b = a % b;
                a = c;
            }
            return b;
        }
    }
}



Measured memory_bytes: 16352
#include <bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
using namespace std;
typedef long long ll ;
typedef pair<int,int> pii ;

const int mx = 104 ;
const int inf= 1<<28 ;

vector <pii> adj[mx] ;
int par[mx] ;
int d[mx] ;
set <pii> s ;
bool mark[mx][mx] ;

void dij(int v){
    s.erase(s.begin()) ;
    for(auto x : adj[v] ){
        if(d[x.ff] > d[v] + x.ss ){
            s.erase({d[x.ff] , x.ff}) ;
            d[x.ff] = d[v] + x.ss ;
            s.insert({d[x.ff] , x.ff}) ;
            par[x.ff] = v ;
        }
    }
    if(s.size() == 0){
        return ;
    }
    dij(s.begin()->ss) ;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0) ;
    cout.tie(0) ;
    int n,m ;
    cin >> n >> m ;
    for(int i =1 ; i<= m ; i++){
        int u,v,c ;
        cin >> u >> v >> c ;
        adj[v].pb({u, c}) ;
        adj[u].pb({v, c}) ;
        mark[u][v] = 1 ;
        mark[v][u] = 1 ;
    }
    for(int i=1 ; i<= n ; i++ ){
        for(int j=1 ; j <= n ; j++){
            d[j] = inf ;
        }
        d[i] = 0 ;
        s.insert({0 , i}) ;
        dij(i) ;
        for(int w =1 ; w <= n ; w++){
            if(w != i){
                mark[par[w]][w] =0 ;
                mark[w][par[w]] =0 ;
            }
        }
    }
    int jav=0 ;
    for(int i =1 ; i<= n ; i++){
        for(int j =1 ; j<= n ; j++){
            if(mark[i][j]){
                jav++;
            }
        }
    }
    cout << jav/2 ;


    return 0;
}


Measured memory_bytes: 3628
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	int ans = 0;
	int tmp;
	map<char, int> m;
	string s;
	cin >>s;
	REP(i, s.size()) m[s[i]]++;
	bool ch = false;
	REP(i, 26){
		if(m['a'+i] == 0){
			cout << (char)('a'+i) << endl;
			ch = true;
			break;
		}
	}
	if(!ch) cout << "None" << endl;
}

Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
const int mod = 1000000007;
int n, m, a, dp[100005];
bool steps[100005];

int main() {
    cin >> n >> m;
    for (int i=0; i<m; i++) {
        cin >> a;
        steps[a] = 1;
    }
    if (!steps[0]) dp[0] = 1;
    if (!steps[1]) dp[1] = 1;
    for (int i=2; i<=n; i++) {
        if (steps[i]) continue;
        dp[i] = (dp[i-1]+dp[i-2])%mod;
    }
    cout << dp[n];
}

Measured memory_bytes: 768
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n, t;
  cin >> n >> t;
  VI d(n);
  REP(i, n) cin >> d[i];

  sort(ALL(d));
  int ret = 1;
  REP(i, n) {
    int a = i-(lower_bound(ALL(d), d[i]-t)-d.begin())+1;
    (ret *= a) %= MOD;
  }
  cout << ret << endl;

  return 0;
}



Measured memory_bytes: 3596
//check check check
#include<iostream>
#include<vector>
#include<algorithm>
#include<fstream>
#include<queue>
#include<cstring>
#include<map>
#include<iomanip>

#define ll long long
#define pb(x) push_back(x)

using namespace std;

typedef pair<int,int> ii;

const int NMAX = 1e5+5;


int main()
{
    ll N,i,j;

    cin>>N;

    cout<<N*(N-1)/2;


}


Measured memory_bytes: 256
n,k = map(int,input().split())
v =  list(map(int,input().split()))

ans = 0
for i in range(1,n+1):
    vt =  v[i:][::-1] + v[:i]
    # print(vt)

    for j in range(0, min(n,k)+1):
        tmp = sorted(vt[:j])
        tmp_n = sum(tmp)
        for l in range(min(k-j, j)):
            if(tmp[l] < 0):
                tmp_n -= tmp[l]
        ans = max(ans, tmp_n)

print(ans)

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

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var N = Console.ReadLine();
            if (N.Last() == '3')
                Console.WriteLine("bon");
            else if (N.Last() == '0' || N.Last() == '1' || N.Last() == '6' || N.Last() == '8')
                Console.WriteLine("pon");
            else
                Console.WriteLine("hon");
        }
    }
}


Measured memory_bytes: 26200
n,m=map(int,input().split())
l=[]
r=[]
for i in range(m):
    L,R=map(int,input().split())
    l.append(L)
    r.append(R)

if min(r)-max(l)+1 >= 0:
    print(min(r)-max(l)+1)
else:
    print(0)


Measured memory_bytes: 11008
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
    int a,c,b;
    // string s,ss;
    cin>>a>>b;
    if(a==b)
        cout<<"Draw"<<endl;
    else if(a==1)
        cout<<"Alice"<<endl;
    else if(b==1)
        cout<<"Bob"<<endl;

    else if(a>b)
        cout<<"Alice"<<endl;
    else
        cout<<"Bob"<<endl;
}








Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <climits>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

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

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
struct Edge {
    int to, cost;
    Edge(int to, int cost): to(to), cost(cost) {}
};

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<Edge>> AdjList;
AdjList graph;

const int INF = 100000000;

LL N, M;

bool sieve[200010];
int main() {
    //cout << fixed << setprecision(15);
    vector<int> prime;
    REP(i, 200010) sieve[i] = true;
    sieve[0] = sieve[1] = false;
    for(int i=2; i*i<200010; ++i){
        if(sieve[i]){

            for(int j=2; j*i<200010; ++j){
                sieve[j*i] = false;
            }
        }
    }

    for(int i=0; i<200010; ++i) if(sieve[i]) prime.push_back(i);
    int N, P;
    while(cin >> N >> P){
        if(N==-1 && P == -1) break;

        int idx = 0;
        while(prime[idx] <= N){ idx++; }

        vector<int> v;

        for(int i=idx; i<idx+100; ++i){
            for(int j=i; j<idx+100; ++j){
                v.push_back(prime[i] + prime[j]);
            }
        }
        sort(all(v));


        cout << v[P-1] << endl;


    }
    return 0;
}


Measured memory_bytes: 3468