akhauriyash/Code-Regression huggingface dataset:
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
using namespace std;
 //int localmax=0;
 int count=0;
 void merge(int arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;
 
   
    int L[n1], R[n2];
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];
 
    
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }
 
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}
void mergeSort(int arr[], int l, int r)
{
    if (l < r)
    {
         
        int m = l+(r-l)/2;
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);
 
        merge(arr, l, m, r);
    }
}
 int main(){
    int n; cin>>n; int arr[n]; 
    for (int i = 0; i < n; ++i)
    {
        cin>>arr[i];

    }
    int newno=3*n;
    int allarr[newno];
    for (int i = 0; i <  n; ++i)
    {
      allarr[i]=arr[i]-1;
    }
    for (int i = n; i <  2*n; ++i)
    {
      allarr[i]=arr[i-n];
    }
     for (int i = 2*n; i <  newno; ++i)
    {
      allarr[i]=arr[i-2*n]+1;
    }
     
  
     mergeSort(allarr, 0,newno-1 );
    
   int maxcount=0;
   for (int i = 0; i < newno; ++i)
   {    
       if( i!=newno-1 && allarr[i+1]==allarr[i]){count++ ;   if(maxcount<count){maxcount=count;}}
       else if(i!=newno-1 && allarr[i+1]!=allarr[i]){count=0;}
       else if(i==newno-1) {cout<<maxcount+1;}
      
   }
  
  return 0;
 }

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef vector<string> vs;
typedef pair<ll, ll> pll;

const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;

#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = ll(b)-1; i >= (a); i--)

#define sz(c) ll((c).size())
#define all(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define xx first
#define yy second
#define has(c, i) ((c).find(i) != (c).end())
#define DBG(X) ({ if(0) cerr << "DBGDO: " << (#X) << " = " << (X) << endl; })

ll ggt(ll a, ll b){

	if(b == 0) return a;

	return ggt(b, a % b);
}

vector<vector<pll>> p(100005);

vl shortest(100005);

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(nullptr);

	ll N;
	cin >> N;

	FOR(i, 0, N-1){
		ll a, b, c;
		cin >> a >> b >> c;
		p[a].pb({b, c});
		p[b].pb({a, c});
	}

	ll Q, K;
	cin >> Q >> K;

	priority_queue<pll> q;
	set<ll> visit;
	q.push({0, K});

	while(!q.empty()){
		DBG(q.size());
		pll act = q.top(); q.pop();
		if(visit.count(act.yy)) continue;
		visit.insert(act.yy);
		shortest[act.yy] = -act.xx;
		for(auto& a : p[act.yy]){
			q.push({act.xx - a.yy, a.xx});
		}
	}

	FOR(i, 0, Q){
		ll x, y;
		cin >> x >> y;

		cout << shortest[x] + shortest[y] << endl;
	}

	return 0;
}

Measured memory_bytes: 16128
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,l=0,ans=0;
	cin>>a;b=a;
	while(b){
		b/=10;l++;
	}
	if(l%2==1){
		for(int i=1;i<=l;i+=2)
			ans+=pow(10,i)-pow(10,i-1);
		ans+=a+1-pow(10,l);
	}
	else {
		for(int i=1;i<=l;i+=2)
			ans+=pow(10,i)-pow(10,i-1);
	}
	printf("%d",ans);
}

Measured memory_bytes: 512
n,y=map(int,input().split())
if n*10000<y:
    print("-1 -1 -1")
    exit()

for i in range((y//10000),-1,-1):   
    y-=i*10000
    if (n-i)*5000<y:
        continue
    for j in range((y//5000),-1,-1):
        y-=j*5000        
        if 1000*(n-i-j)==y:
            print(str(i)+' '+str(j)+' '+str(n-i-j))
            exit()
        y+=j*5000
    y+=i*10000
print("-1 -1 -1")

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] x=new int[100001];
		for(int i=0;i<n;i++){
			x[sc.nextInt()]++;
		}
		int sum=0,num=0;
		for(int i=0;i<x.length;i++){
			if(x[i]>=3 && x[i]%2!=0){
				x[i]=1;
			}else if(x[i]>=3 && x[i]%2==0)
				x[i]=2;
			if(x[i]==2)
				num++;
			if(x[i]>0)
				sum++;
		}
		if(num%2!=0)
			sum--;
		System.out.print(sum);
	}
}


Measured memory_bytes: 50728
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,t; cin >> n >> t ;
  vi ans;
  rep(i,n){
    int c,ti; cin >> c >> ti ;
    if(ti<=t) ans.pb(c);
  }
  sort(ALL(ans));
  if(ans.size()==0) cout << "TLE" << endl;
  else cout << ans[0] << endl;
  return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
p = list(map(int,input().split()))
def maxexp(p,K):
    s = 0 
    for i in range(0,K):
        s = s + p[i]
        t = s
    for j in range(0,len(p)-K):
        s = s - p[j] + p[j+K]
        t = max(s,t)
    return (t+K)/2
print(maxexp(p,K))


Measured memory_bytes: 25060
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;

int main() {
	int r, g, b, n;
	int ans = 0;
	cin >> r >> g >> b >> n;
	for (int i = 0; i < n / r + 1; i++) {
		for (int j = 0; j < n / g + 1; j++) {
			if (r * i + g * j <= n) {
				if ((n - (r * i + g * j)) % b == 0) {
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import Foundation
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let n = Int(readLine()!)!
let ai = readInts().sorted { $0 > $1 }
var alice = 0
var bob = 0
stride(from: 0, to: n, by: 2).forEach { alice += ai[$0] }
stride(from: 1, to: n, by: 2).forEach { bob += ai[$0] }
print(alice - bob)

Measured memory_bytes: 13716
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
	int N, M;
	cin >> N >> M;
	int k;
	vector< vector<int> > s(M);
	rep(i, M) {
		cin >> k;
		s[i].resize(k);
		rep(j, k) {
			cin >> s[i][j];
			s[i][j]--;
		}
	}
	vector<int> p(M);
	rep(i, M) cin >> p[i];

	int cnt;
	int ans = 0;
	bool flag;
	rep(enc, (1 << N)) {
		flag = true;
		rep(i, M) {
			cnt = 0;
			rep(j, s[i].size()) {
				//cout << (enc & (1 << s[i][j])) << endl;
				if (enc & (1 << s[i][j])) cnt++;
			}
			//cout << cnt << endl;
			if (cnt % 2 != p[i]) flag = false;
		}
		if (flag) ans++;
	}
	cout << ans << endl;




	return 0;
}



Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    V<ll> left, right, right_m;
    string S;
    cin >> S;
    for(ll i = 0; i < S.size(); i++) {
        char c = S[i];
        if(c == 'L') {
            left.push_back(i);
        } else {
            right.push_back(i);
            right_m.push_back(-i);
        }
    }

    reverse(ALL(right_m));

    V<ll> ans(S.size(), 0);
    for(ll i = 0; i < S.size(); i++) {
        if(S[i] == 'R') {
            auto ite = upper_bound(ALL(left), i);
            auto idx = *ite;
            ll dist = idx - i;
            ans[(dist & 1 ? idx - 1 : idx)]++;
        } else {
            auto ite = upper_bound(ALL(right_m), -i);
            auto idx = -(*ite);
            ll dist = idx - i;
            ans[(dist & 1 ? idx + 1 : idx)]++;
        }
    }

    for(ll i = 0; i < S.size(); i++) cout << ans[i] << " \n"[i + 1 == S.size()];
    return 0;
}


Measured memory_bytes: 3132
<?php
class ATCoder {
    var $S;
    function __construct() {
        fscanf(STDIN, "%s", $this->S);        
    }
    function __invoke() {
        preg_match_all("/[ATGC]+/", $this->S, $reg);
        $reg[0][] = '';
        $ans = max(array_map(function($x) {return strlen($x);} , $reg[0]));
        return $ans;
    }    
}
$ATCoder = new ATCoder();
echo $ATCoder();


Measured memory_bytes: 4604
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const [n, k] = input[0].split(" ").map((x: string): number => +x);
const v = input[1].split(" ").map((x: string): number => +x);

const rsw = new Array(n + 1);
rsw[0] = 0;
for (let i = 0; i < n; i++) {
  rsw[i + 1] = rsw[i] + v[i];
}
const sum = (from: number, until: number) => {
  if (from < 0) from = 0;
  if (from > rsw.length) from = rsw.length - 1;
  if (until < 0) until = 0;
  if (until > rsw.length) until = rsw.length - 1;
  return rsw[until] - rsw[from];
}
const left = (x: number) => sum(0, x);
const right = (x: number) => sum(n - x, n);

let result = 0;

for (let l = 0; l <= k; l++) {
  for (let r = 0; l + r <= k && l + r <= n; r++) {
    // k-l-rが宝石を捨てられる回数
    // ただしl+r個より多くは捨てられない
    const p = Math.min(l + r, k - l - r);
    const js = [];
    // 左からl個
    js.push(...v.slice(0, l));
    // 右からr個
    js.push(...v.slice(n - r));
    // 持っている宝石を価値でソート
    js.sort((a, b) => a - b);

    let drop = 0;
    for (let i = 0; i < p; i++) {
      // 負の価値の宝石がなくなったら取り出さない
      if (js[i] >= 0) break;
      drop += js[i];
    }
    const score = left(l) + right(r) - drop;
    if (result < score) result = score;
  }
}
console.log(result);


Measured memory_bytes: 9508
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = np.int64(input())
    #print(N)
    #ans = np.int64((1 + (N - 1)) / 2 * (N - 1))
    ans = (1 + (N - 1)) * (N - 1) // 2
    print(int(ans))
if __name__ == '__main__':
    main()


Measured memory_bytes: 12420
#include <iostream>
#include <algorithm>
#include <map>
const int maxN = 2e5 + 10;
using namespace std;

int n, k;
int a[maxN];
map<long long, long long> cnt;

int main()
{
	cin >> n >> k;
	cnt[0] = 1;

	long long ans = 0;
	for (long long i = 1; i <= n; ++i)
    {
        long long x;
        cin >> x;
		a[i] = (a[i - 1] + x - 1) % k;
		if (i >= k)
            cnt[a[i-k]]--;
		ans += cnt[a[i]]++;
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 13568
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def solve(f):
    s = f.read_str()
    n = len(s)
    if n % 2 == 0:
        if s[n/2-1] != s[n/2]: return n/2
        c = s[n/2]
        ans = n/2
        for i in xrange(n/2-1, -1, -1):
            if s[i] != c or s[n-i-1] != c: break
            ans += 1
        return ans
    else:
        c = s[n/2]
        ans = n/2 + 1
        for i in xrange(n/2-1, -1, -1):
            if s[i] != c or s[n-i-1] != c: break
            ans += 1
        return ans


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


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

#define pb push_back
#define fi first
#define se second
#define eb emplace_back

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
const int N = 2000007, inf = 0x3f3f3f3f;

const int M = 1e9 + 7;

ll fat[N];
ll fast_pow(ll a, ll b) {
	ll ans = 1;

	while(b) {
		if(b&1) ans = a * ans % M;
		b >>= 1;
		a = a * a % M;
	}
	return ans;
}

ll nchoosek(ll n, ll k) {
	ll den = fat[n - k] * fat[k] % M;
	return fat[n] * fast_pow(den, M - 2) % M;
}

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

	fat[0] = 1;
	for(int i = 1; i < N; ++i) fat[i] = fat[i-1] * i % M;

	int k; cin >> k;
	string s; cin >> s;
	int n = s.size();

	ll sum = 0;
	for(int x = 0; x <= k; ++x) {
		sum += (fast_pow(25, k - x) * fast_pow(26, x) % M) * nchoosek(n + k - x - 1, n - 1) % M;
		if(sum >= M) sum -= M;
	}
	cout << sum << endl;
}

Measured memory_bytes: 19852
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n; 
	vector<int> a(n);
	vector<int> b(n); b[0] = 0;
	for( int i = 0; i < n; ++i ){
		int p; cin >> p;
		a[p-1] = i+1;
	}
	for( int i = 0; i < n-1; ++i ){
		a[i+1] += a[i];
		b[i+1] = -a[i];
	}
	int p = abs( *( min_element( b.begin(), b.end() ) ) - 1 );
	for( auto &k : a ){
		cout << k << " ";
	} cout << endl;
	for( auto &k : b ){
		cout << k+p << " ";
	} cout << endl;
	return 0;
}

Measured memory_bytes: 768
N = int(input())
H = [int(_) for _ in input().split()]

for i in range(N-1):
    if H[i] >= H[i+1] and (i==0 or H[i] != H[i-1]):
        H[i] -= 1

for i in range(N-1):
    if H[i] > H[i+1]:
        print("No")
        exit(0)
print("Yes")


Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<int> a(n);rep(i,n)cin>>a[i];
    a.push_back(-1);
    int ans = 0, p = -1, l = 0;
    for(int i=0; i<=n; i++){
        if(p==a[i]){
            l++;
        }
        else{
            p=a[i];
            ans += l/2;
            l = 1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

ll ans;
int N;
vi P;
string pre;
vector<string> S;
vector<pair<string, pii>> vec;
stack <int> st;

void solve(){
    rep(i, N){
        pii tmp = make_pair(P[i], i+1);
        vec.push_back(make_pair(S[i], tmp));
    }

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

    pre = vec[0].first;

    rep(i, vec.size()){
        // cout << pre << endl;
        if( pre == vec[i].first) {
            st.push(vec[i].second.second);
        } else {
            while(!st.empty()){
                int num = st.top();
                cout << num << endl;
                st.pop();
            }
            pre = vec[i].first;
            st.push(vec[i].second.second);
        }

        // cout << vec[i].first << vec[i].second.first << endl;
    }

    while(!st.empty()){
        int num = st.top();
        cout << num << endl;
        st.pop();
    }
}

int main(){
    cin >> N;
    S.resize(N);
    P.resize(N);

    rep(i, N){
        cin >> S[i] >> P[i];
    }

    solve();
}


Measured memory_bytes: 256
X = int(input())
happiness = 0
while X > 0:
    if X >= 500:
        temp = int(X / 500)
        X = X - (500 * temp)
        happiness = 1000 * temp
    else:
        temp = int(X / 5)
        X = X - (500 * temp)
        happiness = happiness + (5 * temp)
        break
print(happiness)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import sys


def main():
    N = int( sys.stdin.readline() )
    A_list = list(map(int, sys.stdin.readline().split()))
    
    cum_sum = 0
    A_cum_sum = []

    for i in range(len(A_list)):
        cum_sum += A_list[i]
        A_cum_sum.append(cum_sum)


    mod = 10**9 + 7
    S = 0

    for i in range(len(A_list)):
        S += A_list[i] * ( A_cum_sum[-1] - A_cum_sum[i] )
        S %= mod
    
    print(S)


if __name__ == "__main__":
    main()


Measured memory_bytes: 31368
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> p(n);
    int i,j;
    for(i=0;i<n;i++)
    cin>>p[i];
    sort(p.begin(),p.end());
    int ans = 0;
    for(i=0;i<k;i++)
    ans = ans+p[i];
    cout<<ans;
}

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

int main(){
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  int ans = 0;
  if(a > k){
    cout << k << '\n';
  }else{
    ans = a;
    k = k - a;
    if(k <= b){
      cout << ans << '\n';
    }else{
      k = k - b;
      if(k <= c){
        ans = ans - k;
        cout << ans << '\n';
      }else{
        ans = ans - c;
        cout << ans << '\n';
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

typedef long long ll;
const ll INF = 1e18;

int main(int argc, char* argv[])
{
  ll N, K;
  ll x;
  std::cin >> N >> K;
  std::vector< ll > va(N, +INF);
  std::vector< ll > vb(N, +INF);

  ll cnta = 0;
  ll cntb = 0;
  for (ll i = 0; i < N; i++) {
    std::cin >> x;
    if (x == 0) {
      K--;
      continue;
    }
    if (x > 0) {
      va[cnta] = x;
      cnta++;
    } else {
      vb[cntb] = -x;
      cntb++;
    }
  }
  std::sort(va.begin(), va.end());
  std::sort(vb.begin(), vb.end());

  ll ans = INF;
  for (ll i = 0; i < K; i++) {
    {
      ll db = K - i - 2 < 0 ? 0 : vb[K - i - 2];
      ll distance = va[i] + db + (db > 0 ? va[i] : 0);
      //std::cout << "A: " << i  << " " << K - i - 1 << std::endl;
      //std::cout << "A: " << va[i] << " " << db << " " << distance << std::endl;
      ans = std::min(ans, distance);
    }
    {
      ll da = K - i - 2 < 0 ? 0 : va[K - i - 2];
      ll distance = vb[i] + da + (da > 0 ? vb[i] : 0);
      //std::cout << "B: " << da << " " << vb[i] << " " << distance << std::endl;
      ans = std::min(ans, distance);
    }
  }

  if (K == 0) {
    ans = 0;
  }
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

using namespace std;

//void b_search(bool &flag, vector<int> a, int n, int m, int sum, int i){
//	if (sum == m) flag = true;
//	if (i == n || sum == m) return;
//	if (sum + a[i] <= m) b_search(flag, a, n, m, sum + a[i], i + 1);
//	b_search(flag, a, n, m, sum, i + 1);
//	
//}
//
//void solve(){
//	bool flag;
//	int n, q, mi;
//	cin >> n;
//	vector<int> A(n);
//	for (int i = 0; i < n; i++) cin >> A[i];
//	sort(A.begin(), A.end());
//	cin >> q;
//	for (int i = 0; i < q; i++){
//		cin >> mi;
//		flag = false;
//		b_search(flag, A, n, mi, 0, 0);
//		if (flag) cout << "yes" << endl;
//		else cout << "no" << endl;
//	}
//}

void solve(){
	bool flag;
	int n, q, ai, mi, max = 0;
	bool dp[2000];
	fill(dp, dp + 2000, false);
	dp[0] = true;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> ai;
		for (int j = max; j >= 0; j--){
			if (dp[j]) dp[j + ai] = true;
		}
		max += ai;
	}
	cin >> q;
	for (int i = 0; i < q; i++){
		cin >> mi;
		if (dp[mi]) cout << "yes" << endl;
		else cout << "no" << endl;
	}
}

signed main(){
	solve();
}

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

#define int long long int

string n;

int dp[101][2][4];

int f(string n, int i, bool smaller, int k) {
  	if(i == n.size())
      	return k == 0;
  	if(k < 0)
    	return 0;
  	if(dp[i][smaller][k] != -1)
    	return dp[i][smaller][k];
  	int val = n[i] - '0';
  	int ans = 0;
	for(int j = 0; j <= (smaller ? 9 : val); j++) {
      bool status = smaller | (j < val);
      if(j == 0)
      	ans += f(n, i + 1, status, k);
      else
        ans += f(n, i + 1, status, k - 1);
    }
    return dp[i][smaller][k] = ans;
}

signed main() {
  int k;
  cin >> n >> k;
  memset(dp, -1, sizeof dp);
  int ans = 0;
  for(int i = 0; i < n[0] - '0'; i++) {
    if(i == 0)
    	ans += f(n, 1, true, k);
    else
      	ans += f(n, 1, true, k - 1);
  }
  ans += f(n, 1, false, k - 1);
  cout << ans << endl;
}

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

#define win_p 3
#define draw_p 1

using namespace std;

int main(){
	int n;
	cin >> n;
	
	int taro_point = 0;
	int hanako_point = 0;
	
	for(int i = 0; i < n; i++){
		char *s1, *s2;
		s1 = (char*)calloc(100, sizeof(char));
		s2 = (char*)calloc(100, sizeof(char));
		//scanf("%s %s", s1, s2);
		cin >> s1 >> s2;
		bool draw = true;
		while(*s1 != '\0' || *s2 != '\0'){
			if(*s1 > *s2){
				taro_point += 3;
				draw = false;
				break;
			}
			else if(*s1 < *s2){
				hanako_point += 3;
				draw = false;
				break;
			}
			else{
				s1++;
				s2++;
			}
		}
		if(draw) {
			taro_point++;
			hanako_point++;
		}
	}
	
	cout << taro_point << " " << hanako_point << endl;
	
}





Measured memory_bytes: 3296
#include <iostream> 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define MAX 1000001
ll prime[MAX];
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define gcd __gcd
ll rec(vector<vector<ll> >& dp,vector<ll>& arr,int n,int i,int k,int w)
{
  ll ans=0;
  if(i>=n)
    return 0;

  if(dp[i][k]!=-1)
    return dp[i][k];


  if(k!=0)
  ans=max(rec(dp,arr,n,i+1,w,w),arr[i]+rec(dp,arr,n,i+1,k-1,w));
  else
  ans=max(rec(dp,arr,n,i+1,k,w),rec(dp,arr,n,i+1,w,w));

  return dp[i][k]=ans;

}

//ll t[400008];
// void build(vector<ll>& a, int v, int tl, int tr) {
//     if (tl == tr) {
//         t[v] = a[tl];
//     } else {
//         int tm = (tl + tr) / 2;
//         build(a, v*2, tl, tm);
//         build(a, v*2+1, tm+1, tr);
//         t[v] = max(t[v*2] ,t[v*2+1]);
//     }
// }

// ll maxi(int v, int tl, int tr, int l, int r) {
//     if (l > r) 
//         return 0;
//     if (l == tl && r == tr) {
//         return t[v];
//     }
//     int tm = (tl + tr) / 2;
//     return max(maxi(v*2, tl, tm, l, min(r, tm)) ,maxi(v*2+1, tm+1, tr, max(l, tm+1), r));
// }



// void update(int v, int tl, int tr, int pos, ll new_val) {
//     if (tl == tr) {
//         t[v] = new_val;
//     } else {
//         int tm = (tl + tr) / 2;
//         if (pos <= tm)
//             update(v*2, tl, tm, pos, new_val);
//         else
//             update(v*2+1, tm+1, tr, pos, new_val);
//         t[v] = max(t[v*2] ,t[v*2+1]);
//     }
// }


struct hash_pair {
   template <class T1, class T2>
   size_t operator()(const pair<T1, T2>& p) const{
      auto hash1 = hash<T1>{}(p.first);
      auto hash2 = hash<T2>{}(p.second);
      return hash1 ^ hash2;
   }
};

ll rec(ll a[],ll first,ll last,int n)
{
  if(first>last)
    return 0;

  ll temp=1000000000;
  ll ind=0;
  for(ll i=first;i<=last;i++)
   {
    if(temp>a[i])
    {
      temp=a[i];
      ind=i;
    }
   }
   for(ll i=first;i<=last;i++)
    a[i]-=temp;


return min(last-first+1,(rec(a,first,ind-1,n)+rec(a,ind+1,last,n)+temp));

}
int temp[1000002]={0};

void sieve()
{
  temp[1]=1;
  for(int i=2;i<1000002;i++)
  {
    if(temp[i]==0)
    { temp[i]=i;
      for(int j=i*2;j<1000002;j+=i)
      { 
        if(temp[j]==0)
        temp[j]=i;
      }
    }
  }

}


int main() { 
int n;
cin>>n;
int a[n];

int k;
sieve();

unordered_map<int,int> over;
int flag=0,dum;

for(int i=0;i<n;i++)
{  
   cin>>a[i];
  
  dum=a[i];
  unordered_map<int,int> h;
  while(dum>1)
  {
    if(over[temp[dum]]!=0 && h[temp[dum]]!=1 )
      flag=1;

    h[temp[dum]]=1;
    over[temp[dum]]=1;

    dum=dum/temp[dum];
  }


}

if(flag)
  k=0;
else
  k=2;


int j;
if(k==0)
{  for(int i=0;i<n;i++)
  {
    if(i==0)
      j=a[i];
    else
      j=gcd(j,a[i]);
    
  }
  if(j==1)
    k=0;
  else
    k=1;

}

switch(k)
{
  case 2:cout<<"pairwise coprime";
  break;
  case 0:cout<<"setwise coprime";
  break;
  case 1:cout<<"not coprime";
}


return 0;
}


Measured memory_bytes: 14276
#include<bits/stdc++.h>
using namespace std;
int n,m;
int main(){
	scanf("%d",&n);
	for (int i=1;i<=9;i++)
		for (int j=1;j<=9;j++)
			if (i*j==n){
				puts("Yes");
				return 0;
			}
	puts("No");		
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;


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


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pii pair<int,int>
#define pf push_front
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%lld",&t)
#define p(t) printf("%lld\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<pair<int,pii>,vector<pair<int,pii> >,greater<pair<int,pii> > >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define spitr set<pii>:: iterator
#define mitr map<string,int>:: iterator

int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl


int32_t main() 
{ 
    fast;
    int n,k;cin>>n>>k;
    int cnt=0;
    while(n)
    {
        cnt++;
        n/=k;
    }

    cout<<cnt;
} 

Measured memory_bytes: 256
import sys
 
 
class UnionFind:
    def __init__(self, n):
        self.table = [-1] * n
 
    def _root(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self._root(self.table[x])
            return self.table[x]
 
    def find(self, x, y):
        return self._root(x) == self._root(y)
 
    def union(self, x, y):
        r1 = self._root(x)
        r2 = self._root(y)
        if r1 == r2:
            return
        d1 = self.table[r1]
        d2 = self.table[r2]
        if d1 <= d2:
            self.table[r2] = r1
            if d1 == d2:
                self.table[r1] -= 1
        else:
            self.table[r1] = r2
 
 
n, m = map(int, input().split())
uft = UnionFind(n)
for line in sys.stdin:
    x, y, z = map(int, line.split())
    x -= 1
    y -= 1
    uft.union(x, y)
 
ans = 0
for v in uft.table:
    if v < 0:
        ans += 1
print(ans)

Measured memory_bytes: 5304
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>

using namespace std;

typedef long long ll;

#ifdef iq
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

int main() {
#ifdef iq
  freopen("a.in", "r", stdin);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  while (s.size() >= 2 && s[(int) s.size() - 2] == 'h' && s.back() == 'i') s.pop_back(), s.pop_back();
  if (s.empty()) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


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

H=[]

for _ in range(N):
    H.append(int(input()))

H.sort()

ans = 1e10

for i in range(N-K+1):
    dif = H[i+K-1]-H[i]
    if dif<ans:
        ans=dif

print(ans)


Measured memory_bytes: 7384
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int N;
	scanf("%d",&N);

	int table[N];
	for(int i = 0; i < N; i++)scanf("%d",&table[i]);

	for(int i = 0; i < N-1; i++){
		for(int k = i+1; k < N; k++){
			if(abs(table[i]-table[k])%(N-1) == 0){
				printf("%d %d\n",table[i],table[k]);
				return 0;
			}
		}
	}

	return 0;
}



Measured memory_bytes: 3220
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

#include <cstdlib>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::print(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

int N;
int X[15], Y[15], P[15];

const llong INF = 1e18;

inline int nearest_dist(int k, int V[], int pos) {
   int dist = 2000000001;
   /*
   int j = lower_bound(V, V+k, pos) - V;
   if (j < k)
      dist = min(dist, V[j]-pos);
   if (j > 0)
      dist = min(dist, pos-V[j-1]);
   */
   
   for (int i = 0; i < k; ++i) {
      int d = abs(pos - V[i]);
      if (dist > d)
         dist = d;
   }
   
   return dist;
}

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   cin >> N;
   REP(i, N)
      cin >> X[i] >> Y[i] >> P[i];

   /*
   srand(123);
   for (int i = N-1; i > 0; --i) {
      int j = rand() % (i+1);
      if (i != j) {
         swap(X[i], X[j]);
         swap(Y[i], Y[j]);
         swap(P[i], P[j]);
      }
   }
   */

   int P3 = 1;
   for (int n = 1; n <= N; ++n)
      P3 *= 3;

   llong ans[16];
   FOR(k, 0, N)
      ans[k] = INF;

   int Vx[16], Vy[16];

   REP(mask, P3) {
      int kx = 1, ky = 1;
      Vx[0] = 0, Vy[0] = 0;
      int sel_mask = 0;
      for (int m = mask, i = 0; i < N; ++i) {
         switch (m % 3) {
            case 1:
               Vx[kx++] = X[i];
               sel_mask |= 1<<i;
               break;
            case 2:
               Vy[ky++] = Y[i];
               sel_mask |= 1<<i;
               break;
         }
         m /= 3;
      }

   // sort(Vx, Vx+kx);
   // sort(Vy, Vy+ky);

      int k = (kx-1) + (ky-1);
      llong cost = 0;
      REP(i, N) {
         if (sel_mask & (1<<i)) continue;
         int distx = nearest_dist(kx, Vx, X[i]);
         int disty = nearest_dist(ky, Vy, Y[i]);
         cost += min(distx, disty) * 1LL * P[i];
         if (ans[k] <= cost)
            break;
      }
      if (ans[k] > cost) {
         ans[k] = cost;
         FOR(kk, k, N) {
            if (ans[kk] <= ans[k])
               break;
            ans[kk] = ans[k];
         }
      }
   }

   FOR(k, 0, N)
      cout << ans[k] << '\n';

   return 0;
}


Measured memory_bytes: 3592
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#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 <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long

_int64 a[400][400];
_int64 aa[400][400];
int p[400];

int main()
{
  int i,j,n,tmp,x,y,k,b1;
  _int64 ans;
  vector<pair<_int64,pair<int,int> > > e;
  scanf("%d",&n);
  for (i=0;i<n;i++)
  {
    for (j=0;j<n;j++)
      scanf("%lld",&a[i][j]);
  }
  for (i=0;i<n;i++)
    for (j=0;j<n;j++)
      if (a[i][j]!=a[j][i])
      {
        printf("-1\n");
        return 0;
      }
  memcpy(aa,a,sizeof(aa));
  for (k=0;k<n;k++)
    for (i=0;i<n;i++)
      for (j=0;j<n;j++)
        if (a[i][k]+a[k][j]<a[i][j]) a[i][j]=a[i][k]+a[k][j];
  for (i=0;i<n;i++)
    for (j=0;j<n;j++)
      if (a[i][j]!=aa[i][j])
      {
        //cout<<i<<" "<<j<<endl;
        printf("-1\n");
        return 0;
      }
  /*
  e.clear();
  for (i=0;i<n;i++)
    for (j=i+1;j<n;j++)
      e.push_back(make_pair(a[i][j],make_pair(i,j)));
  sort(e.begin(),e.end());
  for (i=0;i<n;i++)
    p[i]=i;
  */
  ans=0;
  /*
  for (i=0;i<e.size();i++)
  {
    x=e[i].second.first;
    y=e[i].second.second;
    if (p[x]!=p[y])
    {
      ans+=e[i].first;
      tmp=p[y];
      for (j=0;j<n;j++)
        if (p[j]==tmp) p[j]=p[x];
    }
  }
  */
  for (i=0;i<n;i++)
    for (j=i+1;j<n;j++)
    {
      b1=1;
      for (k=0;k<n;k++)
        if ((k!=i)&&(k!=j))
        {
          if (a[i][k]+a[k][j]==a[i][j]) b1=0;
        }
      if (b1==1) ans+=a[i][j];
    }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 2432
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

#define add(x)(x=(x+t)%MOD)
ll L,R;
int f(int keta){
	//n桁目まで見て[L≦x][y≦R]
	ll dp[70][2][2]={};
	ll m=1LL<<(keta-1);
	ll M=(1LL<<keta)-1;
	if(M<L||R<m)return 0;
	ll l=max(L,m);
	ll r=min(R,M);
	
	
	dp[keta][0][0]=1;
	for(int n=keta;n>=1;n--){
		rep(i,0,2)rep(k,0,2){
		ll t=dp[n][i][k];
		//L x1 y1 R
		if(k||bit(r,n-1))add(dp[n-1][i|!bit(l,n-1)][k]);
		//L x0 y1 R
		if((i||!bit(l,n-1))&&(k||bit(r,n-1)))add(dp[n-1][i][k]);
		//L x0 y0 R
		if(i||!bit(l,n-1))add(dp[n-1][i][k|bit(r,n-1)]);
		}		
	}
	ll ans=0;
	rep(i,0,2)rep(k,0,2)ans=(ans+dp[0][i][k])%MOD;
	return ans;
}

int main(){
	scanf("%lld%lld",&L,&R);
	ll ans=0;
	rep(i,1,64)ans=(ans+f(i))%MOD;
	printf("%lld",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}










int main() {

	int h,a;
  cin >> h >> a;
  int cnt = 0;
  while(h>0){
    h-=a;
    cnt++;
  }
  cout << cnt << endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include<stdio.h>
#include<cstdio>
#include<cstring>
#include<string>
#include<math.h>

using namespace std;






int i, n, goukei,suretu[600000];
int main() {
	cin >> n;
	for (i = 0; i < n-1; i++) {
		cin >>suretu[i];		
	}
	goukei = suretu[0];
	goukei = goukei + suretu[n - 2];
	for (i = 1; i < n-1; i++) {
		if (suretu[i] > suretu[i - 1]) {
			goukei = goukei + suretu[i - 1];
		}
		else {
			goukei = goukei + suretu[i];
		}
	}
	if (n == 1) {
		cin >> goukei;
	}
	printf("%d\n",goukei);

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

  bool dp[101];
  fill(dp,dp+101,false);
  dp[4] = true;
  dp[7] = true;
  for(int i=8;i<=100;i++){
    if(dp[i-4] || dp[i-7]) dp[i] = true;
  }

  if(dp[N]) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100)

N, M = map(int,input().split())
admat = [[0] * N for _ in range(N)]
edges = []
for _ in range(M):
    a, b = map(int,input().split())
    a -= 1; b -= 1
    admat[a][b] = 1
    admat[b][a] = 1
    edges.append((a, b))

def dfs(v):
    visited[v] = 1
    for nv, bit in enumerate(admat[v]):
        if bit == 0:
            continue
        if not visited[nv]:
            dfs(nv)

ans = 0

for a, b in edges:
    visited = [0] * N
    admat[a][b] = 0
    admat[b][a] = 0
    dfs(0)
    if all(visited):
        pass
    else:
        ans += 1
    admat[a][b] = 1
    admat[b][a] = 1

print(ans)

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

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

    double ans = 0;
    for (int i = 1; i <= n; i++) {
        double now = i;
        int cnt = 0;
        while (now < k) {
            now *= 2;
            cnt++;
        }
        ans += 1 / pow(2.0, cnt);
    }

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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define reps(i,n) for(int i=1;i<=(int)n;i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
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 A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

vector<pair<long long, long long>> prime_factorize(long long N) {
    vector<pair<long long, long long>> res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(){
    string s; cin >> s;
    bool flag = true;
    if(SZ(s) % 2 != 0) flag = false;
    for(int i=0;i<SZ(s);i+=2){
        if(!(s[i] == 'h' && s[i+1] == 'i')) flag = false;
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
import java.awt.Point;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n;
		byte a[][] = new byte[5000][5000];
		Point p[];
		int sum;
		int max;

		n = sc.nextInt();
		while (n != 0) {
			p = new Point[n];
			sum = 0;
			max = 0;

			for (int i = 0; i < n; i++) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				a[x][y] = 1;
				p[i] = new Point(x, y);
			}

			for (int i = 0; i < n - 1; i++) {
				for (int j = i + 1; j < n; j++) {
					int x = p[j].x - p[i].x;
					int y = p[j].y - p[i].y;
					if (0 <= p[i].x - y && p[i].x - y < 5000 && 0 <= p[i].y + x && p[i].y + x < 5000 && a[p[i].x - y][p[i].y + x] == 1) {
						if (0 <= p[j].x - y && p[j].x - y < 5000 && 0 <= p[j].y + x && p[j].y + x < 5000 && a[p[j].x - y][p[j].y + x] == 1) {
							sum = x * x + y * y;
							if (max < sum) {
								max = sum;
							}
						}
					}
					if (0 <= p[i].x + y && p[i].x + y < 5000 && 0 <= p[i].y - x && p[i].y - x < 5000 && a[p[i].x + y][p[i].y - x] == 1) {
						if (0 <= p[j].x + y && p[j].x + y < 5000 && 0 <= p[j].y - x && p[j].y - x < 5000 && a[p[j].x + y][p[j].y - x] == 1) {
							sum = x * x + y * y;
							if (max < sum) {
								max = sum;
							}
						}
					}
				}
			}
			
			System.out.println(max);
			for (int i = 0; i < n; i++) {
				a[p[i].x][p[i].y] = 0;
			}
			n = sc.nextInt();
		}
	}
}

Measured memory_bytes: 38000
r1,c1,r2,c2=map(int,input().split())
mod=10**9+7
f=[1]
for i in range(2*10**6+7):f+=[f[-1]*(i+1)%mod]
ans=0
for i in range(c1,c2+1):
  d=((r2+1)*f[i+r2+1]%mod)*f[r1]
  d%=mod
  d=(d+(mod-((r1*f[r2+1]%mod)*f[i+r1])%mod))%mod
  d*=pow((((i+1)*f[i]%mod)*f[r1]%mod)*f[r2+1]%mod,mod-2,mod)
  d%=mod
  ans+=d
  ans%=mod
print(ans)

Measured memory_bytes: 117476
#include <bits/stdc++.h>
using namespace std;
int n;
int arr[100005][3];

int dp[100005][4];

int solve(int i, int prev){
	if(i == n) return 0;
	if(dp[i][prev] != -1) return dp[i][prev];

	dp[i][prev] = -1e7;
	int a = 0, b = 0, c = 0;
	if(prev != 0)
		a = solve(i+1, 0) + arr[i][0];
	if(prev != 1)
		b = solve(i+1, 1) + arr[i][1];
	if(prev != 2)
		c = solve(i+1, 2) + arr[i][2];

	dp[i][prev] = max(a, max(b, c));
	return dp[i][prev];
}

int main(){
	cin>>n;
	for (int i = 0; i < n; ++i)
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2];

	memset(dp, -1, sizeof dp);
	cout<<solve(0, 3)<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    string s;
    cin >> s;
    int n = s.size();
    rep(i,n)
        cout << "x";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans, sum = 0;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sum += abs(a[0]);
  for (int i = 0; i < n - 1; i++) {
    b[i] = abs(a[i] - a[i + 1]);
    sum += b[i];
  }
  sum += abs(a[n - 1]);
  //cout << "--------"<<sum << endl;
  int tmp;
  for (int i = 0; i < n; i++) {
    tmp = sum;
    if(i==0){
      tmp -= abs(a[0]);
      tmp -= abs(a[0] - a[1]);
      tmp += abs(a[1]);
    }else if(i<n-1){
      tmp -= abs(a[i] - a[i + 1]);
      tmp -= abs(a[i] - a[i - 1]);
      tmp += abs(a[i - 1] - a[i + 1]);
    }else{
      tmp -= abs(a[n - 1]);
      tmp -= abs(a[n - 1] - a[n - 2]);
      tmp += abs(a[n - 2]);
    }
    cout << tmp << endl;
  }
  return 0;
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
int n, m, a[100010];
int par[100010];
int pn(int u) { return u == par[u] ? u : (par[u] = pn(par[u])); }
void us(int a, int b) {
	a = pn(a), b = pn(b);
	par[b] = a;
}
int main() {
	scanf("%d%d", &n, &m);
	for(int i=1; i<=n; i++) scanf("%d", a+i), par[i] = i;
	for(int i=1; i<=m; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		us(u, v);
	}
	int res = 0;
	for(int i=1; i<=n; i++)
		if(pn(i) == pn(a[i])) res++;
	printf("%d", res);
	return 0;
}

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

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

    }

Measured memory_bytes: 256