akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second

using ll = long long;
using v_int = std::vector<int>;
using v2_int = std::vector<v_int>;
using v_ll = std::vector<ll>;
using v2_ll = std::vector<v_ll>;
using v_string = std::vector<std::string>;
using v_bool = std::vector<bool>;
using v2_bool = std::vector<v_bool>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using mii = std::map<int, int>;
using mll = std::map<ll, ll>;

const double PI = 3.1415926535897932;
const int INF = (int)1e9;
const ll LINF = (ll)1e18;
const ll MOD = 1000000007;
const int dr[4] = {1, 0, -1, 0};
const int dc[4] = {0, 1, 0, -1};

using namespace std; 

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p)
{
    return o << "{" << p.first << "," << p.second << "}";
}

template<typename T, typename U, typename V> inline
ostream& operator<<(ostream &o, tuple<T,U,V> &p)
{
    return o << "{" << get<0>(p) << "," << get<1>(p) << "," << get<2>(p) << "}";
}

template<typename T> inline
istream& operator>>(istream &is, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) {
        is >> v[i]; 
    }
    return is;
}

template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) { 
        os << v[i];
        if(i != len-1) { os << ","; } 
    } 
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }

template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    int a;
    cin >> a;

    int ans = 0;
    int b = a; 

    irep(i, 3) {
        ans += b;
        b *= a;
    }
    
    cout << ans << endl; 
    return 0;
}

/*atcoder*/


Measured memory_bytes: 3620
n = int(input())
p = list(map(int,input().split()))    
a = [0]*n
b = 0  

for i in range(n):
    a[i] = p[i]-sorted(p)[i]
    if a[i] != 0:
        b += 1

if sum(a) == 0 and (b == 2 or b == 0):
    print('YES')
else:
    print('NO')

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

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

	ll n;
	cin >> n;
	vector<ll> v(n);
	for(ll i=0; i<n; i++){
		cin >> v[i];
		v[i] -= (i+1);
	}
	sort(v.begin(), v.end());
	ll minima = v[n/2]; ll ans = 0;
	for(auto x:v){
		ans += abs(x-minima);
	}
	cout << ans;
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i, m, n) for(int i = (int)m; i < (int)n; i++)
typedef /*unsigned*/ long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;


/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int h, w, a ,b; cin >> h >> w >> a >> b;

    rep(i,h){
        rep(j,w){
            if(i<b && j>=a) cout << 0;
            else if(i>=b && j<a) cout << 0;
            else cout << 1;
            if(j == w-1) cout << '\n';
        }
    }
}

Measured memory_bytes: 1280
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int n = Integer.parseInt(scanner.nextLine());
		int flag = 0;

		if(n % 4 == 0|| n % 7 == 0) {
			flag++;
		}else {
			int a = n;
			int b = n;
			while(a > 3) {
				a -= 4;
				if(a % 7 == 0) {
					flag ++;
					break;
				}
			}
			while(b > 3) {
				b -= 7;
				if(b % 4 == 0) {
					flag ++;
					break;
				}
			}
		}

		if(flag == 0) {
		System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 22864
// SeeAlso: https://atcoder.jp/contests/abc121/tasks/abc121_a

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

int W, H;
int w, h;
int main() {
    cin >> W >> H;
    cin >> w >> h;

    int ans;
    ans = W * H - h * W - w * H + w * h;

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    multiset<P> x[2], y[2];
    rep(i,n){
        int a, b;
        cin >> a >> b;
        y[0].insert(P(b, -a)), y[1].insert(P(-a, b));
    }
    ll res[2] = {};
    rep(i,2){
        x[0] = y[0], x[1] = y[1];
        int flag = i;
        int nw = 0;
        rep(j,n){
            P p = *x[flag].begin(), q;
            if(flag){
                q = P(-p.fi, p.se);
            }else{
                q = P(-p.se, p.fi);
            }
            if(q.se < nw){
                res[i] += nw-q.se;
                nw = q.se;
            }else if(q.fi > nw){
                res[i] += q.fi-nw;
                nw = q.fi;
            }
            x[flag].erase(x[flag].begin());
            flag ^= 1;
            x[flag].erase(x[flag].find(P(p.se, p.fi)));
        }
        res[i] += abs(nw);
    }
    cout << max(res[0], res[1]) << "\n";
    return 0;
}


Measured memory_bytes: 20736
#include<stdio.h>

int solve(int n, int d);

int main() {
	int n, d;
	
	//入力
	scanf("%d%d", &n, &d);

	int ans = solve(n, d);

	printf("%d\n", ans);
	return 0;
}

int solve(int n, int d) {

	if (n <= 0) return 0;

	else return solve(n - (2 * d + 1), d) + 1;
}

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

int main() {
	int n;
	cin >> n;
	if (n == 0) cout << 1;
	else if (n == 1) cout << 1;
	else {
		vector<int> fib{ 1, 1, 2 };
		for (int i = 2; i < n; ++i) {
			for (int i = 0; i < 2; ++i) fib[i] = fib[i + 1];
			fib[2] = fib[0] + fib[1];
		}
		cout << fib[2];
	}
	cout << endl;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,i,b,d=0,count=0;
    double x;
    cin>>a>>b;
    long long int c[a];
    for(i=0;i<a;i++)
    {
        cin>>c[i];
        d=d+c[i];
    }
    x=d*(1/(double)(4*b));
    for(i=0;i<a;i++)
    {
        if(c[i]>=x)
            count++;
    }
    if(count>=b)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


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

int order(int x) {
  return (x + 9) / 10 * 10;
}
int wait(int x) {
  return order(x) - x;
}
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int sum = order(a) + order(b) + order(c) + order(d) + order(e);
  sum -= max({wait(a), wait(b), wait(c), wait(d), wait(e)});
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int m, n, a[10], a_2[10], ID[100001];
int dp[100001][10];
int table[] = { 0, 2, 4, 6, 8, 1, 3, 5, 7, 9};

int rec( int now, int sum ){
  if(now == n + 1) return sum % 10 == 0;
  if(~dp[now][sum % 10]) return dp[now][sum % 10];

  int ret = 0;
  if(~ID[now]){
    ret += rec( now + 1, sum + ID[now]);
  }else{
    for(int i = 0 ; i < m ; i++ ){
      ret += rec( now + 1, sum + (now & 1 ? a[i] : a_2[i]));
    }
  }
  return dp[now][sum % 10] = ret;
}

int main(){
  fill_n( *dp, 100001 * 10, -1);
  cin >> n;
  for(int i = n ; i ; i-- ){
    char c;
    cin >> c;
    if(c == '*') ID[i] = -1;
    else ID[i] = i % 2 ? c - '0' : table[c - '0'];
  }
  cin >> m;
  for(int i = 0 ; i < m ; i++ ){
    cin >> a[i];
    a_2[i] = table[a[i]];
  }
  cout << rec( 1, 0) << endl;
}

Measured memory_bytes: 13264
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;

int n,u,v,m;
int sum[100010];

int main()
{
	memset(sum,0,sizeof(sum));
	scanf("%d%d",&n,&m);
	for(int i = 1;i <= m;i++) {
		scanf("%d%d",&u,&v);
		sum[u-1]++; sum[v-1]++;
	}
	bool f = true;
	for(int i = 0;i < n;i++)
		if(sum[i]&1) {f = false; break;}
	if(f) puts("YES"); else puts("NO");
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int H, W;
    cin >> H >> W;
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    sx--, sy--, tx--, ty--;
    string S[H];
    rep(i, H) cin >> S[i];
    int d[H][W];
    fill(d[0], d[H], inf);
    int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
    deque<pii> que;
    que.emplace_back(sx, sy);
    d[sx][sy] = 0;
    while(!que.empty()){
        int i, j;
        tie(i, j) = que.front(); que.pop_front();
        rep(k, 4){
            int ni = i+dx[k], nj = j+dy[k];
            if(ni < 0 || ni >= H || nj < 0 || nj >= W) continue;
            if(S[ni][nj] == '#') continue;
            if(chmin(d[ni][nj], d[i][j])) que.emplace_front(ni, nj);
        }
        rep2(x, -2, 2){
            rep2(y, -2, 2){
                int ni = i+x, nj = j+y;
                if(ni < 0 || ni >= H || nj < 0 || nj >= W) continue;
                if(S[ni][nj] == '#') continue;
                if(chmin(d[ni][nj], d[i][j]+1)) que.emplace_back(ni, nj);
            }
        }
    }
    cout << (d[tx][ty] == inf? -1 : d[tx][ty]) << endl;
}

Measured memory_bytes: 9436
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++)

int main() {
    ll N;
    cin >> N;
    ll ans = 0;
    map<ll, ll> prime;
    ll n = sqrt(N)+1;
    //Nを素因数分解
    if (N == 1) {
        cout << 0 << endl;
        return 0;
    }
    ll a = 2;
    while(N >= a*a) {
        ll count = 0;
        while (N%a == 0) {
            count++;
            N /= a;
        }
        prime[a] = count;
        a++;
    }
    if (N != 1) {
        prime[N] = 1;
    }
    for (auto p : prime) {
        ll time = p.second;
        ans += (sqrt(1+8*time)-1)/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 66124
// ABC 145-C
// 2019.11.16 bal4u

#include <stdio.h>
#include <math.h>

typedef long long ll;

int x[10], y[10];
double a[10][10];
char f[10];
double ans;
int k, N;

double dis(int dx, int dy) {
	return sqrt((double)(dx*dx + dy*dy));
}

void rec(int id, int p, double s) {
	int i;
	if (id == N-1) {
		k++;
		ans += s;
		return;
	}
	for (i = 0; i < N; i++) {
		if (f[i]) continue;
		f[i] = 1;
		rec(id+1, i, s+a[p][i]);
		f[i] = 0;
	}
}
		
int main()
{
	int i, j;
	
	scanf("%d", &N);
	for (i = 0; i < N; ++i) scanf("%d%d", x+i, y+i);
	for (i = 0; i < N; ++i) for (j = i+1; j < N; ++j) {
		a[i][j] = a[j][i] = dis(x[i]-x[j], y[i]-y[j]);
	}

	for (i = 0; i < N; ++i) {
		f[i] = 1;
		rec(0, i, 0);
		f[i] = 0;
	}
	printf("%.12lf\n", ans/k);
	return 0;
}


Measured memory_bytes: 128
import sys
import math
from functools import reduce


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


def main():
    n, x = nm()
    X = nl()
    X.append(x)
    X = sorted(X)
    D = [X[i + 1] - X[i] for i in range(len(X) - 1)]
    ans = gcd_list(D)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 20228
#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)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int add[3] = {3,5,7};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi v;
    REP(i, 3) v.push_back(add[i]);
    int i = 0;
    while(true) {
        int a = v[i] * 10;
        int b = a + 3;
        if(b > n) break;
        v.push_back(b);
        b = a + 5;
        if(b > n) break;
        v.push_back(b);
        b = a + 7;
        if(b > n) break;
        v.push_back(b);
        ++i;
    }
    int ans = 0;
    REP(i, v.size()) {
        int a = v[i];
        int checkbit = 0;
        while(a >= 3) {
            if(a % 10 == 3) checkbit |= (1 << 0);
            if(a % 10 == 5) checkbit |= (1 << 1);
            if(a % 10 == 7) checkbit |= (1 << 2);
            a /= 10;
        }
        if(checkbit == 7) ans++;
    }
    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 640
n = int(input())
s = input()
s = "0" + s
ans = s.count("R") * s.count("G") * s.count("B")

for i in range(1,n):
    for j in range(i + 1, n + 1):
        if 2 * j - i <= n:
            if s[i] != s[j] and s[i] != s[2*j -i] and s[j] != s[2*j -i]:
                ans -= 1
print(ans)

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

char number[][16] = {
	"* = ****", "* =* ***", "* =** **", "* =*** *", "* =**** ",
	" *= ****", " *=* ***", " *=** **", " *=*** *", " *=**** ", };

int main() {
	int n;
	bool flag = false;
	while(cin >> n) {
		char board[16][16] = {0};
		/* init */
		for(int i = 0; i < 5; i++) {
			for(int j = 0; j < 8; j++) {
				board[j][4 - i] = number[n % 10][j];
			}
			n /= 10;
		}

		if(flag)
			cout << endl;
		for(int i = 0; i < 8; i++)
			printf("%s\n", board[i]);
		flag = true;
	}

	return 0;
}

Measured memory_bytes: 1148
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
       char arr[100000],arr2[100000];
       scanf("%s%s",arr,arr2);
       int n = strlen(arr);
       int flag = 0;
       int u = strlen(arr2);
       for(int i =0;i<n;i++)
           if(arr[i]!=arr2[i])
               flag = 1;
          if(flag==0 && u== n+1)
              printf("Yes");
          else
              printf("No");



    return 0;
}

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

A = input().rstrip('\n')

N = A.count("N")
S = A.count("S")
W = A.count("W")
E = A.count("E")

if (N == 0 or S == 0) and N + S != 0:
    print("No")
    exit()
if (W == 0 or E == 0) and W + E != 0:
    print("No")
    exit()
print("Yes")


Measured memory_bytes: 8984
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

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

  cout<<((n>=2*k-1)? "YES":"NO")<<endl;
  
  return 0;
}

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

public class Main {
	public static long MCD_Euclides(long long1, long ab){
	    while(ab != 0){
	         long t = ab;
	         ab = long1 % ab;
	         long1 = t;
	    }
	    return long1;
	}
	public static void main(String[] args) {
		FastScanner br = new FastScanner();
		ArrayList<Long> caca2 = new ArrayList<Long>();
		PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
		int n1 = br.ni();
		int n2 = br.ni();
		for(int i=1;i<=n1;i++) {
			int cont = 0;
			int n = i;
			while(n<n2){
				cont++;
				n*=2;
			}
			caca2.add((long) (Math.pow(2, cont)*n1));
		}
		int arr = 1;
		long ab = caca2.get(0);
		for(int i=1;i<n1;i++) {
			if(caca2.get(i)==3)continue;
			if(ab>=caca2.get(i)) arr+=ab/caca2.get(i);
			else arr+=caca2.get(i)/ab;
		}
		System.out.println((double)arr/(double)ab);
		pw.close();
	}
}

class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	public FastScanner(String s) {
		try {
			br = new BufferedReader(new FileReader(s));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	public FastScanner() {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	ArrayList<Integer>[] ng(int n, int e) {
		ArrayList<Integer>[] adj = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			adj[i] = new ArrayList<Integer>();
		}
		for (int i = 0; i < e; i++) {
			int a = ni() - 1;
			int b = ni() - 1;
			adj[a].add(b);
			adj[b].add(a);
		}
		return adj;
	}

	Integer[] nIa(int n) {
		Integer[] arr = new Integer[n];
		for (int i = 0; i < n; i++) {
			arr[i] = ni();
		}
		return arr;
	}

	int[] nia(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = ni();
		}
		return arr;
	}

	Long[] nLa(int n) {
		Long[] arr = new Long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nl();
		}
		return arr;
	}

	long[] nla(int n) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nl();
		}
		return arr;
	}

	String[] nsa(int n) {
		String[] arr = new String[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nt();
		}
		return arr;
	}

	String nt() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int ni() {
		return Integer.parseInt(nt());
	}

	long nl() {
		return Long.parseLong(nt());
	}

	double nd() {
		return Double.parseDouble(nt());
	}

}

Measured memory_bytes: 24276
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <tuple>
#include <forward_list>
using namespace std;

bool comp0(tuple<int, int, int, string> lh, tuple<int, int, int, string> rh) {
	return get<0>(lh) < get<0>(rh);
}

bool comp2(tuple<int, int, int, string> lh, tuple<int, int, int, string> rh) {
	return get<2>(lh) < get<2>(rh);
}

int main() {
	int N, M, dummy;
	dummy = scanf("%d %d", &N, &M);

	vector<tuple<int, int, int, string>> vt;

	int tmp1, tmp2;
	for (int i = 0; i < M; i++) {
		dummy = scanf("%d %d", &tmp1, &tmp2);
		vt.push_back(make_tuple(i, tmp1, tmp2, ""));
	}

	sort(vt.begin(), vt.end(), comp2);

	auto itr = vt.begin();
	map<int, int> m;
	for (auto end = vt.end(); itr != end; itr++) {
		int ken = get<1>(*itr);
		m[ken]++;
		char ss[16];
		sprintf(ss, "%06d%06d", ken, m[ken]);
		get<3>(*itr) = ss;
	}

	sort(vt.begin(), vt.end(), comp0);

	itr = vt.begin();
	for (auto end = vt.end(); itr != end; itr++) {
		printf("%s\n", get<3>(*itr).c_str());
	}

	return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif


void Main() {
    // ループを回り始めるとややこしすぎるので，移動回数を3で割った余りに注目してノードを3つもつ
    ll N, M; cin >> N >> M;
    Graph g(3 * N, vector<ll>());

    rep(i, M){
        ll u, v; cin >> u >> v; u--; v--;
        g[3 * u].push_back(3 * v + 1);
        g[3 * u + 1].push_back(3 * v + 2);
        g[3 * u + 2].push_back(3 * v);
    }
    ll S, T; cin >> S >> T; S--; T--;
    // ll ans = search(g, 3 * S, 3 * T, 0);
    // ans = (ans == INF) ? -1 : ans / 3;
    // cout << ans << endl;

    vector<ll> depth(3 * N, INF);
    queue<ll> q;
    q.push(3 * S);
    depth.at(3 * S) = 0;

    while (q.size() > 0){
        ll cur = q.front();
        q.pop();
        for (auto next: g[cur]){
            if (depth.at(next) == INF){
                depth.at(next) = depth.at(cur) + 1;
                q.push(next);
            }
        }
    }

    if (depth.at(3 * T) == INF){
        cout << -1 << endl;
    } else {
        cout << depth.at(3 * T) / 3 << endl;
    }
}


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 19072
#include <bits/stdc++.h>
//#include <algorithm>
//#include <stdio.h>
//#include <math.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};

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

ll mypow(ll x,ll n,ll m) {	//xのn乗をmで割った余り
	if(n==0) return 1;
	if(n%2==0) return mypow(x*x%m,n/2,m);
	else return x*mypow(x,n-1,m)%m;
}

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

int m;

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

	cin>>m;
	cout<<24+(24-m)<<endl;

	return 0;
}


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

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for (int i=a; i<b; i++)
#define M00(i, a) for (int i=0; i<a; i++)
#define MOOd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define M00d(i,a) for (int i = (a)-1; i >= 0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _<< " _ " <<

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;
typedef complex<ld> cd;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() { FAST
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	int n;
	cin >> n;
	vector<pll> arr(n);
	M00(i, n) {
		ll x, y;
		cin >> x >> y;
		arr[i] = mp(x,y);
	}
	ll ans = 0;
	ll lo = 2e9, hi = 0;
	M00(i, n) {
		lo = min(lo, arr[i].f + arr[i].s);
		hi = max(hi, arr[i].f + arr[i].s);
	}
	ans = max(ans, hi - lo);
	lo = 2e9, hi = -1e9;
	M00(i, n) {
		lo = min(lo, arr[i].f - arr[i].s);
		hi = max(hi, arr[i].f - arr[i].s);
	}
	ans = max(ans, hi - lo);
	cout << ans << endl;
}


Measured memory_bytes: 6368
#include"iostream"
using namespace std;

int main()
{
	char A, B, C, D;
	cin >> A >> B >> C >> D;
	int a = A - '0';
	int b = B - '0';
	int c = C - '0';
	int d = D - '0';
	if (a + b + c + d == 7) { cout << A << "+" << B << "+" << C << "+" << D << "=7" << endl; }
	else if (a + b + c - d == 7) { cout << A << "+" << B << "+" << C << "-" << D << "=7" << endl; }
	else if (a + b - c + d == 7) { cout << A << "+" << B << "-" << C << "+" << D << "=7" << endl; }
	else if (a + b - c - d == 7) { cout << A << "+" << B << "-" << C << "-" << D << "=7" << endl; }
	else if (a - b + c + d == 7) { cout << A << "-" << B << "+" << C << "+" << D << "=7" << endl; }
	else if (a - b + c - d == 7) { cout << A << "-" << B << "+" << C << "-" << D << "=7" << endl; }
	else if (a - b - c + d == 7) { cout << A << "-" << B << "-" << C << "+" << D << "=7" << endl; }
	else if (a - b - c - d == 7) { cout << A << "-" << B << "-" << C << "-" << D << "=7" << endl; }
}

Measured memory_bytes: 256
import math
n = int(input())
sq_n = int(math.sqrt(n))
s_lis = []
e_lis = []
for i in range(1, sq_n + 1):
    if n % i == 0:
        s_lis.append(i)
        e_lis.append(n // i)
min_len = n + 1 - 2
for s, e in zip(s_lis, e_lis):
    min_len = min(min_len, s + e - 2)
print(min_len)

Measured memory_bytes: 3292
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ll long long
#define inf 1<<30
#define il inline 
#define in1(a) read(a)
#define in2(a,b) in1(a),in1(b)
#define in3(a,b,c) in2(a,b),in1(c)
#define in4(a,b,c,d) in2(a,b),in2(c,d)
il void readl(ll &x){
    x=0;ll f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    x*=f;
}
il void read(int &x){
    x=0;int f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    x*=f;
}
using namespace std;
/*===================Header Template=====================*/
#define N 205
int f[N];
int main(){
	int n,i,j,ans=0;
	in1(n);
	for(i=1;i<=n;i++){
		for(j=1;j<=n/i;j++){
			f[i*j]++;
		}
	}
	for(i=1;i<=n;i++){
		if(i%2&&f[i]==8) ans++;
	}
	printf("%d",ans);
	return 0; 
}

Measured memory_bytes: 128
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let k: usize = sc.read();
    println!("{}", n - k + 1);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

#define pb push_back

#define int ll
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;

template<typename T, typename U>
ostream& operator<<(ostream& o, const pair<T,U>& p) {
  return o << "(" << p.first << "," << p.second << ")";
}

template<typename T>
ostream& operator<<(ostream& o, const vector<T>& v) {
  o << "[";
  for (const T& x : v)
    o << x << ",";
  return o << "]";
}

const int INF = 1e18;

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

  string t;
  cin >> t;
  if (t == "ABC")
    cout << "ARC\n";
  else {
    assert(t == "ARC");
    cout << "ABC\n";
  }
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		sc.close();
		String subs = s.substring(1, s.length()-1);
		subs = String.valueOf(subs.length());
		StringBuilder sb = new StringBuilder();
		char[] ch = s.toCharArray();
		sb.append(ch[0]);
		sb.append(subs);
		sb.append(ch[ch.length-1]);
		System.out.println(sb.toString());
	}
}

Measured memory_bytes: 22740
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n;i>s;i--)
#define repe_r(i,s,n)for(ll i=n;i>=s;i--)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = (ll)1 << 62;

int main() {
	string s; cin >> s;
	string t = "KIHBR";

	if (s.size() > 9) {
		cout << "NO" << endl;
		return 0;
	}

	ll j = 0;

	for (int i = 0; i < s.size();) {
		if (s[i] == 'K') {
			if (t[j] == 'K' && (s[i + 1] == 'I' && s[i + 2] == 'H')) {
				i += 3;
				j += 3;
			}
			else {
				cout << "NO" << endl;
				return 0;
			}
		}
		else if (s[i] == t[j]) {
			j++;
			i++;
		}
		else if (s[i] == 'A') {
			if (s[i + 1] == 'A') {
				cout << "NO" << endl;
				return 0;
			}
			i++;
		}
		else {
			cout << "NO" << endl;
			return 0;
		}
	}
	if (j != 5) {
		cout << "NO" << endl;
		return 0;
	}

	cout << "YES" << endl;
	return 0;
}

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

int main(int argc, const char * argv[]) {
    
    char W[11],T[101];
    int count=0,i;
    
    scanf("%s",W);
    
    while(1){
        scanf("%s",T);
        if(strcmp("END_OF_TEXT",T) == 0)break;
        for(i=0; i<101; i++){
            if('A'<=T[i] && T[i]<='Z'){
                T[i] = T[i]+ 32;  //大文字アルファベット + 32 = 小文字アルファベット
            }
        }
        if(strcmp(W, T) == 0)count++;
    }
    printf("%d\n",count);
    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;



typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
 
 
//defines
typedef long long ll;
typedef long double ld;

ll a,b,c,n,m,k,t=1;

void solve()
{
 cin>>n>>m;
 k=__gcd(n,m);
 c=1;
 if(k%2==0)
 {
     c++;
     while(k%2==0)k/=2;
 }
 for(ll i=3;i*i<=k;i++)
 {
     if(k%i==0)
     {
         c++;
         while(k%i==0)k/=i;
     }
 }
 if(k>1)c++;
 cout<<c;
 if(t>0)cout<<"\n";
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  //cin>>t;
    while(t--)
    {
        solve();
    }
  //cout<<sum;
        
    return 0;
}

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

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;



int main(){
  lll ii,jj,kk;
  lll n,min,mod;
  vector<lll> a,b;

  cin >> n;
  a.resize(n);

  for(ii=0;ii<n;ii++){
    cin >> a[ii];
  }

  while(true){
    b.clear();
    sort(a.begin(),a.end());
    min = a[0];
    //cout << min << endl;
    b.push_back(a[0]);

    for(ii=1;ii<a.size();ii++){
      mod =  a[ii] % min;
      if(mod == 0  ){
      }
      else{
        //cout << "push_back" << a[ii] << endl;
        b.push_back(mod);
      }
    }

    if(b.size() == 1){
      break;
    }
    else{
      a = b;
    }

      
  }

  cout << a[0];
  return 0;
}


Measured memory_bytes: 2168
#include <iostream>
#include <cstdint>
#include <string>

int main() {
  std::int_fast64_t sx, sy, tx, ty;
  std::cin >> sx >> sy >> tx >> ty;
  std::cout << std::string(ty - sy, 'U') << std::string(tx - sx + 1, 'R') << std::string(ty - sy + 1, 'D') << std::string(tx - sx + 1, 'L') << 'U';
  std::cout << std::string(tx - sx, 'R') << std::string(ty - sy + 1, 'U') << std::string(tx - sx + 1, 'L') << std::string(ty - sy + 1, 'D') << 'R';
  std::cout << std::endl;
  return 0;
}

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

int main()
{
	int a, b, c;
	int k;
	int n;

	scanf("%d%d%d", &a, &b, &c);
	n = 0;
	for (k = a; k <= b; k++) {
		if (c % k == 0) n++;
	}
	printf("%d\n", n);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std; 
typedef long long ll;
#pragma GCC optimize("O3")
#define pb push_back
int32_t main()  {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h1, m1 , h2, m2, k ;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int time = (h2-h1)*60 + (m2-m1);
    cout << max(time - k,0) ;
}


Measured memory_bytes: 3648
from collections import Counter
n = int(input())
stri = []
for _ in range(n):
    stri.append(input())

count = Counter(stri)
max_val = max(count.values())
sortedcount = sorted(count.items(), key=lambda x:x[0])
for s, cnt in sortedcount:
    if cnt == max_val:
        print(s)

Measured memory_bytes: 48408
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		String ans = "";
		for(int i = 0; i < n; i++) {
			ans += "ACL";
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 38604
def calc_range_num(h,height,max_height,ans):#各階層にいくつ区間があるか
    for i in range(len(h)):
        if h[i]>height:
            if i+1<len(h) and h[i]>h[i+1] and h[i+1] <=height:
            #基本的には、高さが下がったところでインクリメント
                #print(i,h[i],ans+1,height)
                ans+=1
            elif i==len(h)-1:
                #print(i,h[i],ans+1,height)
                ans+=1
    height+=1
    if height>=max_height:
        return ans
    else:
        ans = calc_range_num(h,height,max_height,ans)
    return ans
N = int(input())
h = list(map(int, input().split()))
max_height=max(h)
ans=0
print(calc_range_num(h,0,max_height,ans))

Measured memory_bytes: 39664
def roll_N(self):
    self[0],self[1],self[4],self[5] = self[1],self[5],self[0],self[4]
def roll_W(self):
	self[0],self[2],self[3],self[5] = self[2],self[5],self[0],self[3]
dice = [int(e) for e in input().split()]
times = int(input())
for i in range(times):
    upper,front = map(int,input().split())
    rolleddice = list(dice)
    if front == rolleddice[2] or front == rolleddice[3]:
        roll_W(rolleddice)
    while front != rolleddice[1]:
        roll_N(rolleddice)
    while upper != rolleddice[0]:
        roll_W(rolleddice)
    print(rolleddice[2])


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	ll n;
	vector<ll> v;
	ll flag = true;
	ll ans = 0;

	cin >> n;

	REP(i, n) {
		ll a;
		cin >> a;
		v.push_back(a);
	}

	REP(i, 50) {
		REP(j, n) {
			if (v[j] % 2 == 1) {
				flag = false;
				break;
			}
			else {
				v[j] = v[j] / 2;
			}
		}
		if (flag) {
			ans++;
		}
		else {
			break;
		}
	}

	cout << ans << endl;
}

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

struct node{
  int key;
  struct node *p,*r,*l;
};
struct node *rt;
void insert(int);
void in(struct node *);
void pre(struct node *);
int main(){
  int m,i,x;
  char c[7];
  
  scanf("%d",&m);
  i=0;
  while(i<m){
    scanf("%s",c);
    if(c[0]=='i'){
       scanf("%d",&x);
       insert(x);
    }
    else if(c[0]=='p'){
      in(rt);
      printf("\n");
      pre(rt);
      printf("\n");
    }
    i++;
  }
  return 0;
}

void insert(int k){
  struct node *y=NULL, *x=rt,*z;
  
  z=(struct node *)malloc(sizeof(struct node));
  z->key=k; z->l=NULL; z->r=NULL;
  while(x!=NULL){
    y=x;
    if(z->key < x->key)x=x->l;
    else x=x->r;
  }
    z->p=y;
    
    if(y==NULL)rt=z;
    else {
      if(z->key < y->key) y->l=z;
      else y->r=z;
    }
    
  }

void in(struct node *p){
 
  if(p==NULL) return 0;
   in(p->l);
   printf(" %d",p->key);
   in(p->r);
}

void pre(struct node *p){
 
  if(p==NULL) return 0;
  printf(" %d",p->key);
  pre(p->l);
  pre(p->r);
}





Measured memory_bytes: 25140
def dfs(i,a,d,f,t):
    if d[i-1]:
        return t
    d[i-1] = t
    t += 1
    for j in a[i-1]:
        t = dfs(j,a,d,f,t)
    f[i-1] = t
    t += 1
    return t
 
if __name__ == "__main__":
    n = int(input())
    a = []
    for i in range(n):
        a.append(list(map(int,input().split()))[2:])
    d = [0]*n
    f = [0]*n
    t = 1
    for i in range(n):
        if d[i] == 0:
            t = dfs(i+1,a,d,f,t)
    for i in range(n):
        print(i+1,d[i],f[i])


Measured memory_bytes: 5660
(function main(){
  let lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n");
  let [n, k] = lines.shift().split(' ').map(Number);
  let w = lines.map(Number);

  const canAllStack = (p) => {
    let cnt = 0;
    let sum = 0;
    for (let i = 0; i < k; i++) {
      sum = 0;
      while (sum + w[cnt] <= p) {
        sum += w[cnt++]
        if (cnt === n) return n;
      }
    }
    return cnt;
  };

  let p = Math.floor(w.reduce((a, b) => a + b) / k - 1);
  while (canAllStack(++p) !== n);
  console.log(p);
})();



Measured memory_bytes: 32292
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int X, Y;
  cin >> X >> Y;
  REP(t, 0, X + 1) {
    int k = X - t;
    if (t * 2 + k * 4 == Y){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/*
(max X - min X) * nCk
max(X) * nCk - min(X)*nCk
max(X)=xとなる集合の数がいくつあるか
x以下の数のうちK個を使った集合の選び方

min(X)=xとなる集合の数
x以上の数のうちK個使った集合の選び方
*/
int main()
{
    // 前処理
    COMinit();

    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());

    ll ans = 0;

    // maxについて
    for (int i = k - 1; i < n; i++) {
        ans = (ans + COM(i, k - 1) * a[i] % MOD) % MOD;
    }
    // minについて
    for (int i = n - k; i >= 0; i--) {
        ans = (ans - COM(n - i - 1, k - 1) * a[i] % MOD) % MOD;
    }

    cout << ans << endl;
}


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

int main(void){
  int n,y,i,j;
  cin >> n >> y;
  for(i=0;i<n+1;i++){
    for(j=0;j<n-i+1;j++){
      if(10000*i+5000*j+1000*(n-i-j)==y){
        cout << i << " " << j << " " << n-i-j <<endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
const int P=25;
vec prime={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
vec cnt;
int ans;
void dfs(int k,int sum)
{
	if(k>=P)return;
	if(sum>75)return;
	if(75%sum!=0)return;
	if(sum==75)
	{
		ans++;
		return;
	}
//	cout<<k<<" "<<sum<<endl;
	For(i,0,cnt[k])
	{
		dfs(k+1,sum*(i+1));
	}
}
int main()
{
	cnt.resize(P);
	int n;
	cin>>n;
	For(i,1,n)
	{
		rep(j,0,P)
		{
			int x=i;
			while(x%prime[j]==0)
			{
				cnt[j]++;
				x/=prime[j];
			}
		}
	}
	dfs(0,1);
	cout<<ans<<endl;
	return 0;
}



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

    return 0;
}


Measured memory_bytes: 3580
use proconio::input;

fn main() {
    input!{
        n: i64
    };
    let mut res = n * (n+1) * (n+2) / 6;
    for _ in 1..n {
        input! {
            a: i64,
            b: i64
        };
        res -= std::cmp::min(a, b) * (n - std::cmp::max(a, b) + 1);
    }
    println!("{}", res);
}


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

int h,w,n,x[2]={1,0},y[2]={0,1};
char F[31][31],G[31][31];
vector<pair<int,int> > V;

void cp()
{
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++)G[i][j]=F[i][j];
  }
}

bool Chack()
{
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(G[i][j]!='.')return false;
    }
  }
  return true;
}

void Change()
{
  while(1){
    for(int j=0;j<w;j++){
      for(int i=h-2;i>=0;i--){
	if(G[i][j]!='.'){
	  for(int k=i;k<h-1;k++){
	    if(G[k+1][j]!='.')break;
	    swap(G[k][j],G[k+1][j]);
	  }
	}
      }
    }
	V.clear();
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){

	if(G[i][j]!='.'){
	  for(int k=0;k<2;k++){
	    int count=1;
	    
	    for(int dis=1;;dis++){
	      int a=i+dis*x[k],b=j+dis*y[k];
	      if(a<0 || b<0 || a>=h || b>=w)break;
	      if(G[a][b]!=G[i][j])break;
	      if(G[a][b]=='.')break;
	      count++;
	    }
	    for(int dis=1;;dis++){
	      int a=i-(dis*x[k]),b=j-(dis*y[k]);
	      if(a<0 || b<0 || a>=h || b>=w)break;
	      if(G[a][b]!=G[i][j])break;
	      if(G[a][b]=='.')break;
	      count++;
	    }	
	    if(count>=n){
	      V.push_back(make_pair(i,j));
	      for(int dis=1;;dis++){
		int a=i+dis*x[k],b=j+dis*y[k];
		if(a<0 || b<0 || a>=h || b>=w)break;
		if(G[a][b]!=G[i][j])break;
		if(G[a][b]=='.')break;
		V.push_back(make_pair(a,b));
	      }
	      for(int dis=1;;dis++){
		int a=i-(dis*x[k]),b=j-(dis*y[k]);
		if(a<0 || b<0 || a>=h || b>=w)break;
		if(G[a][b]!=G[i][j])break;
		if(G[a][b]=='.')break;
		V.push_back(make_pair(a,b));
	      }
	    }
	  }
	}
      }
    }
    if(V.empty())break;
    for(int i=0;i<V.size();i++)G[V[i].first][V[i].second]='.';
  }
}
int main()
{
  cin>>h>>w>>n;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++)cin>>F[i][j];
  }
  bool flag=false;
  for(int i=0;i<h;i++){
    for(int j=1;j<w;j++){
      cp();
      swap(G[i][j-1],G[i][j]);
      Change();
      /*   cout<<i<<" "<<j<<endl;
      for(int k=0;k<h;k++){
	for(int l=0;l<w;l++)cout<<G[k][l]<" ";
	cout<<endl;
	}*/
      if(Chack()){
	cout<<"YES"<<endl;
	flag=true;
	break;
      }
      if(i==h-1 && j==w-1)cout<<"NO"<<endl;;
    }
    if(flag)break;
  }
  return 0;
}

Measured memory_bytes: 1248
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll A, B, C;
vector<ll> vec;

//解法
void solve() {

	if (A + B >= C) {
		cout << B + C;
		return;
	}
	else {
		cout << B+A+B+1;
		return;
	}


	return;
}

int main() {
	//入力

	cin >> A >> B >> C;


	solve();
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
n,k = (int(i) for i in input().split())
x = [[4,2,0,9,7]]+[[0 for i in range(5)] for i in range(10)]
for i in range(1,11):
	for j in range(5):
		x[i][j] = (x[i-1][j]+8)%11
ans,m = ((n-2)//11)*5,(n-2)%11
for i in range(m): ans+=x[i].count(k)
print(ans)

Measured memory_bytes: 3064