akhauriyash/Code-Regression huggingface dataset:
def f(A):
    dct = {}
    B = []
    i = 0
    for a in A:
        try:
            B.append(dct[a])
        except:
            dct[a] = i
            B.append(dct[a])
            i += 1
    return B


S = f(list(input()))
T = f(list(input()))
if S == T:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 8340
s=input().split(" ")
xi=int(s[0])
k=int(s[1])

bi=[float(2**i) for i in range(18)]
j=0
_sum=float(0)

for i in range(1,xi+1):
  j=0
  while k>float(i)*float(bi[j]):
    j+=1
  _sum+=(float(1.0)/float(bi[j]))

print((float(1.0)/float(xi))*float(_sum))


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

//def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

vector<ll> runrun_numbers;
void dfs(ll digit, ll curr, ll tail) {
    if (curr > 3234566667) return;

    runrun_numbers.push_back(curr);
    if (tail == 0) {
        dfs(digit - 1, curr * 10 + tail, tail);
        dfs(digit - 1, curr * 10 + tail + 1, tail + 1);
    } else if (tail == 9) {
        dfs(digit - 1, curr * 10 + tail - 1, tail - 1);
        dfs(digit - 1, curr * 10 + tail, tail);
    } else {
        dfs(digit - 1, curr * 10 + tail - 1, tail - 1);
        dfs(digit - 1, curr * 10 + tail, tail);
        dfs(digit - 1, curr * 10 + tail + 1, tail + 1);
    }
}

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

    ll k;
    cin >> k;

    repeat(i, 1, 10) dfs(10, i, i);
    // debug(runrun_numbers.size());
    sort(all(runrun_numbers));
    out(runrun_numbers[k - 1]);
    return 0;
}


Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception{
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();

		for(int i=0; i<s.length(); i++){
			String a = s.substring(i, i+1);
			int n = 1;
			int an = 1;
			for(int j=i+1; j<s.length(); j++){
				if((s.substring(j, j+1)).equals(a)){
					an++;
					n++;
					if(an > n/2){
						System.out.println(i+1 + " " + (j+1));
						return ;
					}
				}else{
					n++;
					if(n % 2 == 0){
						if(an < n/2) break;
					}else{
						if(an <= n/2) break;
					}
					
				}
			}
			
		}
		System.out.println("-1 -1");
		sc.close();
		return;
	}
}


Measured memory_bytes: 28040
# sys.stdin.readline()
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
ans_1 = max(a)
check_2 = ans_1 / 2
a.sort()
ans_box = [0]*n
for i in range(n):
    ans_box[i] = abs(a[i]-check_2)
ans_2 = a[ans_box.index(min(ans_box))]
print(ans_1,ans_2)


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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

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

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  string s;
  cin >> s;

  string ans = "";
  for (int i = 0; i < s.length(); i += 2) ans += s[i];

  cout << ans << "\n";

  return 0;
}

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

int main(){
  int a;
  int b[11] = {0};
  for(int i = 0; i < 4; i++){
    cin >> a;
    b[a] += 1;
  }
  
  if( b[1] == 1 && b[4] == 1 && b[7] == 1 && b[9] == 1){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char s[100005][16];
int asc(const void* a, const void* b)
{
	return strcmp(s[*(int*)a], s[*(int*)b]);
}
int main()
{
	long long int n;
	scanf("%lld", &n);
	long long int i, j;
	for (i = 0; i < n; i++)
		scanf("%s", s[i]);
	char c;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < 9; j++)
		{
			if (s[i][j] > s[i][j + 1])
			{
				c = s[i][j];
				s[i][j] = s[i][j + 1];
				s[i][j + 1] = c;
				if (j > 0)
					j -= 2;
			}
		}
	}
	int a[100005];
	for (i = 0; i < n; i++)
		a[i] = i;
	qsort(a, n, sizeof(int), asc);
	long long int ans = 0;
	long long int min, mid, max;
	for (i = 0; i < n - 1; i++)
	{
		min = i + 1;
		max = n - 1;
		if (strcmp(s[a[i]], s[a[min]]) != 0)
			continue;
		if (strcmp(s[a[i]], s[a[max]]) == 0)
			ans += max - i;
		else
		{
			while (max - min > 1)
			{
				mid = (max + min) / 2;
				if (strcmp(s[a[i]], s[a[mid]]) == 0)
					min = mid;
				else
					max = mid;
			}
			ans += min - i;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 2556
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            long le = long.Parse(Console.ReadLine());
            long baseMoney = 100;
            int year = 0;
            while (baseMoney < le)
            {
                baseMoney = (long)(baseMoney * 1.01);
                year++;
            }
            Console.WriteLine(year.ToString());
        }
    }
}

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

int main()
{
    int N;
    string S;
    int dp[500005] = {};
    int pos = -1;
    cin >> N >> S;
    
    for(int i = 2; i < N; i++) {
        dp[i + 1] = dp[i];
        if(S.substr(i - 2, 3) == "101") {
            pos = i - 3;
            for(int j = i - 2; j >= 0 && S[j] != '0'; j--) {
                dp[i + 1] = max(dp[i + 1], dp[j] + i - j - 1);
            }
        }
        if(S[i] == '0') pos = -1;
        if(~pos) dp[i + 1] = max(dp[i + 1], dp[pos + 1] + i - pos - 2);
    }

    cout << dp[N] << endl;
    return (0);
}


Measured memory_bytes: 2820
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, ans = 0, pos = 0;
    cin >> n;
    ll a[n], i;
    for(i = 0; i < n; i++) {
    	cin >> a[i];
    }
    sort(a, a + n);
    reverse(a, a + n);
    for(i = 1; i < n; i++) {
    	if(i % 2 == 0) {
    		pos++;
    	}
    	ans += a[pos];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 5168
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
//const int MOD = 1e9 + 7;
const int MOD = 998244353;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int N;
	cin >> N;
	vector<P>x(N);
	rep(i, N)cin >> x[i].first >> x[i].second;
	map<P, int>m;
	rep(i, N) {
		rep(j, N) {
			if (i == j)continue;
			m[{x[i].first - x[j].first, x[i].second - x[j].second}]++;
		}
	}
	int mx = 0;
	for (auto i : m) {
		mx = max(mx, i.second);
	}
	cout << N - mx << endl;
}

Measured memory_bytes: 384
#pragma GCC optimize("O3")

#include<bits/stdc++.h>
#define sp " "
#define endl "\n"
#define MAX 10e9
#define MAXN 100001
#define inf_int 2e9
#define inf_ll 2e18
#define e 1e-9
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpl vector<pair<ll,ll>>
#define vpc vector<pair<char,char>>
#define adj_list vector<vl>
#define umap unordered_map<ll, ll>
#define pll pair<ll,pair<ll, ll>>
#define clr(x) memset(x,0,sizeof(x))
#define set(x,k) memset(x,k,sizeof(x))
#define cy cout << "YES" << endl
#define  cn cout << "NO" << endl
#define google cout << "Case #" << ++it << ": " << ans << endl;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef long long int ll;

ll it = 0, ans = 0;

ll spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (auto i=2; i<MAXN; i++)
  		spf[i] = i;
  	for (auto i=4; i<MAXN; i+=2)
        spf[i] = 2;
    for (auto i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (auto j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
	return;
}

vl getFactorization(ll x)
{
    vl ret;
    while (x != 1)
    {
        ret.push_back(spf[x]);
        x = x / spf[x];
    }
    return ret;
}


void check()
{
	ll d,t,s;
    cin >> d >> t >> s;
    if(d <= t*s) cout << "Yes" << endl;
    else cout << "No" << endl;
    return ;
}

int32_t main()
{
    fastio;
    ll t = 1;
    // cin >> t;
    while(t--)
        check();
    return 0;
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

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>
void print1(T begin, T end) {
	while (begin != end) {
		cerr << (*begin) << " ";
		*begin++;
	}
	cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			cerr << " " << Array[i][j];
		}
		cerr << endl;
	}
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	std::cerr << head << " ";
	print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

signed main() {
	vec<int> a(3);
	rep (i, 3) {
		cin >> a[i];
	}
	sort(all(a));

	cout << a[0] + a[1] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

string s;
int ans[100005];

// functions
void input(){
	cin >> s;
	return;
}

void solve(){
	int cnt=1, po;
	char cur='R';
	for(int i=1; i<s.size(); i++){
		if(s[i]!=cur){
			if(s[i]=='L'){
				ans[i]+=cnt/2;
				ans[i-1]+=cnt-(cnt/2);
				po=i;
			}
			else{
				ans[po-1]+=cnt/2;
				ans[po]+=cnt-(cnt/2);
			}
			cur=s[i];
			cnt=1;
		}
		else{
			cnt++;
		}
	}
	ans[po-1]+=cnt/2;
	ans[po]+=cnt-(cnt/2);
	return;
}

void output(){
	for(int i=0; i<s.size(); i++){
		cout << ans[i] << " ";
	}
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
//#ifdef sheeep
//	freopen("forces.inp", "r", stdin);
//	freopen("forces.out", "w", stdout);
//#endif
	ios_base::sync_with_stdio(false);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
//	}
	return 0;
}
// Author: NamSPro



Measured memory_bytes: 1488
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
const int maxn=200000+10;
struct dong{
    int id,v;
    friend bool operator <(dong a,dong b){
    	return a.v<b.v;
	}
} a[maxn*2];
int v[maxn*2];
int i,j,k,l,r,t,n,m,mx,mi,num;
ll ans;
int main(){
    scanf("%d",&n);
    fo(i,1,n){
		scanf("%d%d",&a[i].v,&a[i+n].v);
		if (a[i].v>a[i+n].v) swap(a[i].v,a[i+n].v);
	}
    fo(i,1,2*n) a[i].id=i,v[i]=a[i].v;
    mx=mi=v[1];
    fo(i,1,n){
        mx=max(mx,v[i+n]);
        mi=min(mi,v[i]);
    }
    l=v[1];r=v[1+n];
    fo(i,1,n){
        l=max(l,v[i]);
        r=min(r,v[i+n]);
    }
    ans=(ll)(l-mi)*(mx-r);
    sort(a+1,a+2*n+1);
    num=l;
    fo(i,1,2*n){
        if (a[i].id>n) break;
        num=max(num,v[a[i].id+n]);
        ans=min(ans,(ll)(mx-mi)*(num-a[i+1].v));
    }
    printf("%lld",ans);
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int sum = 0;
        if (a + b < 2 * c) {
            sum = (a * x) + (b * y);
        } else {
            if (x < y) {
                // xは全て買い終える。
                sum = (2 * x * c);
                if (b < 2 * c) {
                    sum += (y - x) * b;
                } else {
                    sum += (y - x) * 2 * c;
                }
            } else {
                sum = (2 * y * c);
                if (a < 2 * c) {
                    sum += (x - y) * a;
                } else {
                    sum += (x - y) * 2 * c;
                }
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 21844
n = int(input())
s = input()
sl = list(s)
alp = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
ans = []
for i in range(len(sl)):
    num = n + alp.index(sl[i])
    if num < 26:
        ans.append(alp[num])
    else:
        ans.append(alp[num - 26])
print(''.join(ans))

Measured memory_bytes: 3188
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using edge = struct {
  int to;
  int cost;
};
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define MAXI(vec)                                                              \
  std::distance(vec.begin(), *std::max_element(vec.begin(), vec.end()))
#define MINI(vec)                                                              \
  std::distance(vec.begin(), *std::min_element(vec.begin(), vec.end()))
#define BIT(n, num) std::bitset<(n)>((num)).to_string()
#define MATMUL(a, b, c)                                                        \
  REP(i, a.size())                                                             \
  REP(j, b[0].size()) REP(k, a[0].size()) c[i][j] += a[i][k] * b[k][j];
#define CLA2(a) REP(i, a.size()) REP(j, a[0].size()) a[i][j] = 0;
#define REV(T) greater<T>()

ll pow_(ll a, ll n) {
  ll x = 1;
  while (n > 0) {
    if (n & 1)
      x = (x * a) % MOD;
    a = (a * a) % MOD;
    n >>= 1;
  }
  return x;
}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

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

ll factorial(int n) {
  ll ans = 1;
  for (int i = 2; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll P(int n, int m) {
  ll ans = 1;
  for (int i = m + 1; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll power(int n, int m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = power(n, m / 2);
    return (tmp * tmp) % MOD;
  } else {
    return (n * power(n, m - 1)) % MOD;
  }
}
ll C(int n, int m) {
  return (P(n, n - m) * power(factorial(m), MOD - 2)) % MOD;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ll N;
  vector<ll> A;
  ll max = -1, maxi = 0;
  cin >> N;
  bool kuso = true;
  REP(i, N) {
    ll po = 0;
    cin >> po;
    A.push_back(po);
    if (po % 2 != 0) {
      kuso = false;
    }
    if (max < po) {
      max = po;
      maxi = i;
    }
  }
  if (N == 1) {
    if (A[0] % 2 == 0) {
      cout << "second" << endl;
    } else {
      cout << "first" << endl;
    }
    return 0;
  }
  if (kuso)
    cout << "second" << endl;
  else
    cout << "first" << endl;
  return 0;
}


Measured memory_bytes: 1400
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val list = readLine()!!.split(" ").map { it.toInt() }
//    val list = (1..n).map { readLine()!!.toInt() }
    val ans = solve(n, list)
    print(ans)
}

fun solve(n: Int, nums: List<Int>): Int {
    val sum = nums.sum()
    val squareSum = nums.map { pow(it) }.sum()

    val p = calculateP(sum, n)
    val upperP = Math.ceil(p).toInt()
    val downerP = Math.floor(p).toInt()

    val upperMin = min(squareSum, sum, n, upperP)
    val downerMin = min(squareSum, sum, n, downerP)

    return if (upperMin < downerMin) {
        upperMin
    } else {
        downerMin
    }
}

fun calculateP(sum: Int, n: Int): Double {
    return sum.toDouble() / n.toDouble()
}

fun min(squareSum: Int, sum: Int, n: Int, p: Int): Int {
    return n * pow(p) - 2 * p * sum + squareSum
}

fun pow(num: Int): Int {
    return num * num
}



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

using namespace std;

void print(vector<long long> dp){
    cout << "----------------------" << endl;
    for(auto i: dp){
        cout << i << endl;
    }
    cout << "----------------------" << endl;
}

int main(void){
    long long mod = 1000000007;
    int n, m;
    cin >> n >> m;
    vector<long long> dp(n+100);
    dp[0] = 1;
    vector<bool> a(n+100, true);
    for(int i = 0; i < m; i++){
        int temp;
        cin >> temp;
        a[temp] = false;
    }
    for(int i = 0; i <= n; i++){
        dp[i] %= mod;
        if(a[i+1]){
            dp[i+1] += dp[i];
        }
        if(a[i+2]){
            dp[i+2] += dp[i];
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 1024
f:: [Int] -> IO()
f [0,0] = return()
f [h,w] = do
    putStrLn $ replicate w '#'
    putStr $ unlines $ replicate (h-2) $ "#" ++ replicate (w -2) '.' ++ "#" 
    putStrLn $ replicate w '#'
    putStr "\n"

main = getContents >>= mapM_ f . map (map read) . (map words) .  lines


Measured memory_bytes: 4368
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
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; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  ll n;
  vector<ll> v(5);
  cin>>n;
  ll mi = INF;
  rep(i,0,5){
    cin >> v[i];
    chmin(mi, v[i]);
  }
  cout << 4+(n+mi-1)/mi << endl;
  return 0;
}


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

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

int main() {
  int N;
  int A,B;
  int flag=0;
  cin >> N;
  cin >> A >> B;
  
  for(int i=A;i<=B;i++){
    if(i%N==0)flag=1;}
  if(flag==1)cout << "OK" << endl;
  else cout << "NG" << endl;
}

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
using namespace std;
int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
long long READ(){
    long long xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
char one(){
	char ch=getchar();
	while(ch==' '||ch=='\n')
		ch=getchar();
	return ch;
}
const int MOD=int(1e9)+7;
const int maxn=200010;
int fac[maxn],inv[maxn],invfac[maxn];
inline int mypow(int b,int p){
	int ret=1;
	while(p){
		if(p&1)
			ret=1LL*ret*b%MOD;
		p>>=1;
		b=1LL*b*b%MOD;
	}
	return ret;
}
int C(int n,int m){
	int ret=1;
    for(int i=0;i<m;i++)
		ret=1LL*ret*(n-i)%MOD*inv[m-i]%MOD;
	return ret;
}
int main(){
	//freopen("in.txt","r",stdin);

	fac[0]=inv[0]=invfac[0]=1;
	inv[0]=inv[1]=1;
	for(int i=2;i<maxn;i++)
		inv[i]=1LL*(MOD-MOD/i)*inv[MOD%i]%MOD;
	for(int i=1;i<maxn;i++){
		fac[i]=1LL*fac[i-1]*i%MOD;
		invfac[i]=1LL*invfac[i-1]*inv[i]%MOD;
	}

	int n=read(),a=read(),b=read();
	int ans=mypow(2,n);
	//printf("%d %d %d\n",ans,C(n,a),C(n,b));
	(ans-=C(n,a)+C(n,b)+1)%=MOD;
	(ans+=MOD)%=MOD;
	printf("%d\n",ans);
	return 0;
}





Measured memory_bytes: 2560
# ABC043 C

import math
n = int(input())
a = list(map(int, input().split()))

def cost(l,N):
    total = 0
    for i in l:
        total += (i-N)**2
    return total
    
ans = 100000000


for i in range(-100,101):
    check = cost(a,i)
    if check < ans:
        ans = check

print(ans)
            


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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, k, n) for (int i = k; i < n; ++i)
#define fore(i,a) for (auto &i : a)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-10;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;

    cout << max({a + b, a + a - 1, b + b - 1}) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main()
{
	int play[205][4];
	int score[205] = {0};
	int n;
	int num[3][101] = {0};
	
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++){
		scanf("%d %d %d", &play[i][0], &play[i][1], &play[i][2]);
		num[0][play[i][0]]++;
		num[1][play[i][1]]++;
		num[2][play[i][2]]++;
	}
	
	for (int i = 0; i < n; i++){
		if (num[0][play[i][0]] < 2){
			score[i] += play[i][0];
		}
		if (num[1][play[i][1]] < 2){
			score[i] += play[i][1];
		}
		if (num[2][play[i][2]] < 2){
			score[i] += play[i][2];
		}
	}
	
	for (int i = 0; i < n; i++){
		printf("%d\n", score[i]);
	}
	
	return (0);
}

Measured memory_bytes: 1028
import Text.Printf
import Control.Applicative

main = do
  ss <- (map stoi . words) <$> getLine
  let a = (ss !! 0)
      b = (ss !! 1)
  putStrLn (if a < b then "a < b"
            else if a > b then "a > b"
            else "a == b")

stoi :: String -> Int
stoi str = read str :: Int

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

#define access(i) a[i/3][i%3]
int gcd(int x, int y)
{
    if(y==0)
        return x;
    return gcd(y, x%y);
}

 long long numbers[500005];

//int a[100005];


 int main(){

  long long n,m;
  cin>>n>>m;
  int a[n];
  map<int,int>mp;

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

 for(int i=0;i<m;i++)
 {
    long long tmp,tmp1;
    cin>>tmp>>tmp1;

    tmp--; tmp1--;

    if(a[tmp] <= a[tmp1]){
        mp[tmp] = 0;
    }

    if(a[tmp1] <= a[tmp]){
        mp[tmp1] = 0;
    }

 }

 long long cnt=0;

 for(int i=0;i<n;i++){
     // cout<<mp[i]<<endl;
    if(mp[i] == 1)
        cnt++;
 }

  cout<<cnt<<endl;

 return 0;
 }


Measured memory_bytes: 8700
N = int(input())

if N < 10:
  print(N)
elif N < 100:
  print(9)
elif N < 1000:
  print(N - 90)
elif N < 10000:
  print(909)
elif N < 100000:
  print(N - 9090)
else:
  print(90909)

Measured memory_bytes: 38384
# coding: utf-8
# Your code here!
n = int(input())
a = {}
cnt = 0

while True:
    cnt += 1
    # print("{} {}", cnt, n)

    if n in a:
        print(str(cnt))
        exit()
    else:
        a[n] = 1

    if n % 2 == 0:
        n /= 2
    else:
        n = 3 * n + 1
    n = int(n)
    # print(n)


Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
const int maxn = 1e5+10;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
char c[maxn];
int main(){
	n=read();k=read();
	scanf("%s",c+1);
	int num=0,now=0,ans=0;
	for(register int i=1;i<=n;i++){
		if(c[i]==c[i-1])num++;
		else {
			now++;
			num=1;
		}
	}
	ans=n-now;
	for(register int i=1;i<=k;i++){
		if(now>=3){
			ans+=2;now-=2;
		}
		else if(now==2){ans++;now--;}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = sc.nextInt();
    int[] x = new int[n];
    for(int i = 0; i < n; i++) {
      x[i] = sc.nextInt() - a;
    }
    long[][] dp = new long[n][5001];
    dp[0][2500]++;
    dp[0][x[0] + 2500]++;
    for(int i = 1; i < n; i++) {
      for(int j = 0; j < 5001; j++) {
        dp[i][j] += dp[i - 1][j];
        if((j >= x[i]) && ((j - x[i]) < 5001)) dp[i][j] += dp[i - 1][j - x[i]];
      }
    }
    System.out.println(dp[n - 1][2500] - 1);
  }
}

Measured memory_bytes: 24020
import sys
a = int(input())
c = list(map(int, input().split()))

if 0 in c:
  print('0')
  sys.exit()

ans = c[0]
for i in range(1, a):
  ans = ans*c[i]
  if ans > 10**18:
    print('-1')
    sys.exit()
    
print(ans)
  

Measured memory_bytes: 21652
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
#define fi first
#define se second
typedef long long lli;
typedef pair<int, int> pii;
int n, a, b;

void ReadInput()
{
    cin >> n >> a >> b;
}

void Solve()
{
    cout << min(a, b) << ' ' << max(0, a + b - n) << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ReadInput();
    Solve();
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

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

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

typedef long long ll;

const ll MOD = 1e9 + 7;

class DKi {
    void dfs(int pre, int current, ll count, vector<vector<int>>& edges, vector<int>& counts, vector<ll>& countsSum) {
        count += counts[current];
        countsSum[current] = count;
        for (const int next : edges[current]) {
            if (next == pre) continue;
            dfs(current, next, count, edges, counts, countsSum);
        }
    }

public:
	void solve(std::istream& in, std::ostream& out) {
	    int N, Q;
	    in >> N >> Q;
	    vector<pair<int, int>> edge(N-1);
	    REP(i,0,N-1) in >> edge[i].first >> edge[i].second;
	    vector<int> p(Q), x(Q);
	    REP(i,0,Q) in >> p[i] >> x[i];

	    vector<int> counts(N+1);
	    vector<ll> countsSum(N+1);
	    vector<vector<int>> edges(N+1);

	    REP(i,0,N-1) {
	        edges[edge[i].first].emplace_back(edge[i].second);
	        edges[edge[i].second].emplace_back(edge[i].first);
	    }
	    REP(i,0,Q) {
	        counts[p[i]] += x[i];
	    }
	    dfs(-1, 1, 0, edges, counts, countsSum);
	    REP(i,1,N+1) {
	        out << countsSum[i] << (i == N ? "\n" : " ");
	    }
	}
};


int main() {
	DKi solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 26040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll d, n;
    cin >> d >> n;
    ll v = 1;
    rep(i, d) v *= 100;
    if (n == 100) n = 101;
    cout << (v * n) << endl;
    return 0;
}


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

class Main{
    public static void main(String[] args){
        FastScanner fs = new FastScanner();
        int k = fs.nextInt();
        String s = fs.next();
        if(s.length()<=k){
            System.out.println(s);
        }else{
            System.out.println(s.substring(0,k)+"...");
        }
    }
    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 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: 36124
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define DB double
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
void YN(int a){if(a==1)printf("Yes\n");if(a==0)printf("No\n");}
LL lpow(LL a,LL n){LL ans=pow(a,n)*10;if(ans%10<5)return ans/10;return ans/10+1;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
int scmpr(const void* a,const void* b){return strcmp(*(char**)b,*(char**)a);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}

int main(){
  LL N,i,ans=0;
  scanf("%lld",&N);
  LL A[N];
  FOR(i,0,N)scanf("%lld",&A[i]);
  qsort(A,N,sizeof(LL),lcmp);
  FOR(i,0,N-1)if(A[i]==A[i+1]){
    printf("NO");
    return 0;
  }
  printf("YES");

  //printf("%lld\n",A,B);
	return 0;
}


Measured memory_bytes: 3324
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define INF 99999999

int main(){
  int n;
  cin >> n;
  ll num=1;
  for(int i=0;i<9;i++){
    num *= 10;
  }
  num += 7;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int flag = 1;
  ll ans = 1;
  if (n % 2 == 0){
    for(int i=0;i<n;i+=2){
      if (a[i] == (i+1) && a[i+1] == (i+1)){
        ans = ans * 2 % num;
      }else{
        flag = 0;
        break;
      }
    }
  }else{
    if (a[0] != 0){
      cout << 0 << endl;
      return 0;
    }
    for(int i=1;i<n;i+=2){
      if ( a[i] == (i+1) && a[i+1] == (i+1) ){
        ans = ans * 2 % num;
      }else{
        flag = 0;
        break;
      }
    }
  }
  if (flag == 1){
    cout << ans << endl;
  }else{
    cout << 0 << endl;
  }
  return 0;
}

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

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

    int n,m;
    cin >> n >> m;

    vector<string> a(n),b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];

    bool ok;
    rep(i,n-m+1) rep(j,n-m+1){
        ok = true;
        rep(x,m) rep(y,m){
            if(b[x][y] != a[i+x][j+y]) ok = false;
        }
        if(ok){cout << "Yes" << endl; return 0;}
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  long ans = 1, a = 2, b;
  for(int i = 0; i < N - 1; i++) {
    b = ans;
    ans += a;
    a = b;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val a = sc.nextLong()
  // val b = sc.nextDouble()
  val b = sc.next()
  val bj = b.get(0).toString() + b.substring(2, b.length)

  val bi = bj.toLong()

  println(a * bi / 100)

}


Measured memory_bytes: 36444
/* 
			BURN OUT
		*/	  

#include <bits/stdc++.h>
using namespace std;
	     
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
	     
#define mp make_pair
#define pb push_back
#define ld long double
#define F first
#define S second
const ll N =(1e6);  
const ll mod = (1e9+7);
	
int main(){
	fast;	
	ll n , k;
	cin >> n >> k;
	ll arr[n];
	for(ll i = 0 ;i < n ; i ++){
		cin >> arr[i];
	}
	sort(arr ,arr + n);
	if(k >= n)
		return cout<<0 , 0;
	ll sum = 0 ;
	for(ll i = 0; i <n - k ;i++){
		sum+=arr[i];
	}
	cout<<sum;
}

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

int findofdigits(int n){
  int sum = 0;
  while(n > 0){
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
  int N;
  cin >> N;
  
  int har = findofdigits(N);
  
  if(N % har == 0){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }
  
}
  

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        int diff = S.length() - T.length();
        int min = Integer.MAX_VALUE;
        for(int i = 0;i<diff+1;i++){
            int temp = T.length();
            for(int j = 0;j<T.length();j++){
                if(S.charAt(i+j) == T.charAt(j)){
                    temp--;
                }
            }
            min = Math.min(min,temp);
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 35736
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	ll N, K;
	cin >> N >> K;
	N++;

	vector<ll> ruiSum(N + 1);
	REP(i, N) {
		ruiSum[i + 1] = ruiSum[i] + i;
	}

	vector<ll> ans(N + 1);
	REP(i, N + 1) {
		ll minVal = ruiSum[i];
		ll maxVal = ruiSum[N] - ruiSum[N - i];
		ll cnt = maxVal - minVal + 1;
		ans[i] = cnt;
		ans[i] %= MOD;
	}
	
	ll ansAll = 0;
	REPN(i, K, N + 1) {
		ansAll += ans[i];
		ansAll %= MOD;
	}
	cout << ansAll << endl;
	return 0;
}


Measured memory_bytes: 6424
import sys
import os

def file_input():
    f = open('Beginner_Contest_162/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()

    N,K=map(int, input().split())   #K以下、Nの長さ

    tmp=[0]*(K+1)
    mod=10**9+7
    out=0

    for i in range(K,0,-1):
        tmp[i]=pow(K//i,N,mod)  #iの倍数はK/i個ある。それがN個並んでいる
        for j in range(i*2,K+1,i):
            tmp[i]-=tmp[j]
        out+=tmp[i]*i

    print(out%mod)

if __name__ == '__main__':
    main()


Measured memory_bytes: 11280
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using LP = pair<int, int>;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

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 double PI=3.14159265358979323846;

int mod = 1e9+7;

int INF = 1e9+7;

int main(){
  int N;
  cin >> N;
  vector<int> H(N);
  rep(i, N) cin >> H[i];

  vector<int> COST(N+1, INF);
  COST[0] = 0;
  rep(i, N){
    if(i+1 <= N-1){
      COST[i+1] = min(COST[i+1], COST[i]+abs(H[i+1]-H[i]));
    }
    if(i+2 <= N-1){
      COST[i+2] = min(COST[i+2], COST[i]+abs(H[i+2]-H[i]));
    }
  }

  cout << COST[N-1] << endl;

  return 0;
}


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

int main(void)
{
    int s, w;
    cin >> s >> w;

    if(w >= s)
    {
        cout << "unsafe" << endl;
    }
    else
    {
        cout << "safe" << endl;
    }
    

    return 0;
}



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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MN = 100010;

int N;
ll C;
ll x[MN], v[MN];

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

	rep(i, N) {
		cin >> x[i] >> v[i];
	}

	ll ret = 0;

	vector<ll> v1, v2;
	vector<ll> m1, m2;

	ll s = 0;
	rep(i, N) {
		s += v[i];
		ret = max(ret, s - x[i]);
		v1.pb(s - x[i]);
		if (m1.size() == 0) {
			m1.pb(s - x[i]);
		} else {
			m1.pb(max(m1.back(), s - x[i]));
		}
	}

	rep(i, N) {
		x[i] = C - x[i];
	}

	s = 0;
	for (int i = N-1; i >= 0; --i) {
		s += v[i];
		ret = max(ret, s - x[i]);
		v2.pb(s - x[i]);
		if (m2.size() == 0) {
			m2.pb(s - x[i]);
		} else {
			m2.pb(max(m2.back(), s - x[i]));
		}		
	}

	rep(i, N) {
		x[i] = C - x[i];
	}

	s = 0;

	rep(i, N) {
		s += v[i];
		if (N-2-i>=0)ret = max(ret, s + m2[N-2-i] - x[i] * 2);
	}

	rep(i, N) {
		x[i] = C - x[i];
	}	

	s = 0;

	for (int i = N-1; i>=0;--i) {
		s += v[i];
		if (i>0)ret = max(ret, s + m1[i-1] - x[i] * 2);
	}

	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 5740
# coding=utf-8

N = int(input())
N_memo = N
S = 0

while True:
    if N < 10:
        S += N
        break
    else:
        S += (N % 10)
        N = N // 10

if N_memo % S == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL N=1e5+100; 
const LL MOD=1e9+7;

int n;
LL a[N];
int v[N];
 
LL fac[N],finv[N],inv[N];
 
void make()
{
	fac[0]=fac[1]=1;
	finv[0]=finv[1]=1;
	inv[1]=1;
	for(int i=2;i<100010;i++)
	{
		inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
		fac[i]=fac[i-1]* i%MOD;
		finv[i]=finv[i-1]*inv[i]%MOD;
	}
}
LL C(int x,int y)
{
	if(x<y) return 0;
	return fac[x]*(finv[y]*finv[x-y]%MOD)%MOD;
}
 
int main ()
{
	cin>>n;
    for(int i = 1; i <= n + 1; ++i){
        cin >> a[i];
        v[a[i]]++;
    }
    LL pos1,pos2;
    for(int i = 1; i <= n + 1; ++i){
        if(v[a[i]] == 2 && !pos1){
            pos1 = i;
        }
        else if(v[a[i]] == 2) {
            pos2 = i;
        }
    }
	LL ans;
	make();
	for (int i=0;i<=n;i++)
	{
		ans=C(n+1,i+1);
		ans-=C(n-pos2+pos1,i);
		if (ans<0) ans+=MOD;
		printf("%d\n",ans);	
	}
	return 0;
}


Measured memory_bytes: 4736
A, B = map(int, input().split())
S = input()
f = 0
for i in range(A):
    if S[i] == "-":
        f += 1
if S[A] != "-":
    f += 1
for i in range(A + 1, A + B + 1):
    if S[i] == "-":
        f += 1
if f > 0:
    print("No")
else:
    print("Yes")

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

#define lli long long int
#define ld long double
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

////////////////////////////////////////////////////////    By: Umang Srivastava

// lli extgcd(lli a, lli b, lli *x , lli *y)
// {
//   if(a==0)
//   {
//     *x=0;
//     *y=1;
//     return b;
//   }
//   lli x1 , y1;
//   lli gcd = extgcd(b%a , a , &x1 , &y1);
//   *x=y-(b/a)*x1;
//   *y=x1;
//   return gcd;
// }

// lli modinv(lli a, lli m)
// {
//   lli x,y;
//   lli g = extgcd(a,m,&x,&y);
//   if(g!=1)
//     return -1;
//   return (x%m+m)%m;
// }

// lli moddiv(lli a, lli b, lli m)
// {
//   a=a%m;
//   lli inv = modinv(b,m);
//   if(inv!=-1)
//     return ((a*inv + m)%m);
//   else
//     return -1;
// }

// lli binpow(lli a, lli b, lli m)
// {
//  lli res=1;
//  a=a%m;
//  while(b>0)
//  {
//    if(b & 1)
//    {
//      res = (res * a)%m;
//    }
//    b=b>>1;
//    a=(a*a)%m;
//  }
//  return res;
// }

// lli gcd(lli a, lli b)
// {
//     // if(b<a)
//     // {
//     //     lli t=a;
//     //     a=b;
//     //     b=t;
//     // }
//     if(a==0)
//         return b;
//     return gcd(b%a,a);
// }

/////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin>>s;
  if(s[s.length()-1]=='s')
  	cout<<s<<"es\n";
  else
  	cout<<s<<"s\n";
}

Measured memory_bytes: 3660
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	long long a[5],i;
	for(i=0;i<5;i++)cin>>a[i];
	for(i=1;i<5;i++)if(a[0]<a[i])swap(a[0],a[i]);
	for(i=2;i<5;i++)if(a[1]<a[i])swap(a[1],a[i]);
	for(i=3;i<5;i++)if(a[2]<a[i])swap(a[2],a[i]);
	if(a[3]<a[4])swap(a[3],a[4]);
	for(i=0;i<5;i++){
		if(i==4){
			cout<<a[i];
		}else{
			cout<<a[i]<<" ";
		}
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	nums := make([]int, n)
	for l:=0; l<n-1; l++{
		fmt.Scan(&nums[l])
	}

	count_map := make(map[int]int)

	for _, v := range nums{
		count_map[v] ++
	}

	for i := 1; i <= n; i++ {
		fmt.Println(count_map[i])
	}
}

Measured memory_bytes: 15960