akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define sz(x) (int)(x.size())
#define lt(x) (int)(x.length())
#define MOD 1000000007 
#define mx 15

int n, m, a, b, c;
int cost[mx + 100][mx + 100], dep[(1 << mx) + 100][mx + 3];
int sum[mx + 3][(1 << mx) + 100];
vector<int> ve[(1 << mx) + 100];


int dp(int mask, int tadi){
	// cout << mask << ' ' << tadi << ' ';
	if(tadi == n - 1 && mask == (1 << n) - 1)
		return 0;
	int &ret = dep[mask][tadi];
	if(ret != -1)
		return ret;
	ret = 1e9;
	for(int i = 0; i < n; i++){
		if(mask & (1 << i) || cost[tadi][i] == 0)
			continue;
		if(mask == 9 && tadi == 3){
			// debug(i);
			// debug(sum[i][mask ^ (1 << tadi)]);
		}
		ret = min(ret, dp(mask | (1 << i), i) + sum[i][mask ^ (1 << tadi)]);
	}
	int inv = 1 << n;
	inv -= mask + 1;
	int idx = -1;
	for(int i = inv; i > 0; i = (i - 1) & inv){
		idx += 1;
		ret = min(ret, dp(mask | i, tadi) + ve[mask][idx] - sum[tadi][i]);
		if(mask == 9 && tadi == 3){
			// debug(i);
			// debug(ve[mask][idx]);
		}
	}
	// debug(ret);
	return ret;
}



int main(){
	cin >> n >> m;
	for(int i = 1; i <= m; i++){
		cin >> a >> b >> c;
		a -= 1;
		b -= 1;
		cost[a][b] = cost[b][a] = c;
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < 1 << n; j++){
			for(int k = 0; k < n; k++){
				if(j & (1 << k))
					sum[i][j] += cost[i][k];
			}
		}
	}
	// debug(n);
	for(int i = 0; i < 1 << n; i++){
		int inv = 1 << n;
		inv -= i + 1;
		int idx = -1;
		for(int j = inv; j > 0; j = (j - 1) & inv){
			idx += 1;
			int tot = 0;
			for(int k = 0; k < n; k++){
				if(j & (1 << k))
					tot += sum[k][i];
				
			}
			ve[i].pb(tot);
		}
	}
	// debug(n);
	reset(dep, -1);
	cout << dp(1, 0) << endl;
}

Measured memory_bytes: 62272
#include<iostream>
#include<string>
#include<map>
#define int long long int

using namespace std;

signed main(){

    int i;
    string s;
    cin >> s;

    string a = "", b = "";
    
    int n = s.size();
    for(i = 0; i < n; i++){
        if(i % 2 == 0){
            a = "1" + a;
            b = "0" + b;
        }else{
            a = "0" + a;
            b = "1" + b;
        }
    }

    int countA = 0, countB = 0;

    for(i = 0; i < n; i++){
        if(s[i] != a[i]){
            countA++;
        }
        if(s[i] != b[i]){
            countB++;
        }
    }

    if(countA >= countB){
        cout << countB << endl;
        return 0;
    }else{
        cout << countA << endl;
        return 0;
    }

}



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

int main() {
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  
  if (N <= K) {
    cout << N * X << endl;
  } else {
    cout << K * X + (N-K) * Y << endl;
  }
}

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

int main() {
  const int64_t mod = 998244353;
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  vector<vector<int64_t>> dp(n + 1, vector<int64_t>(s + 1));
  for (int i = 0; i < n; i++) {
    dp.at(i).at(0)++;
    for (int j = 0; j <= s; j++) {
      (dp.at(i + 1).at(j) += dp.at(i).at(j)) %= mod;
      if (j + a.at(i) <= s) (dp.at(i + 1).at(j + a.at(i)) += dp.at(i).at(j)) %= mod;
    }
  }
  int64_t ans = 0;
  for (int i = 0; i <= n; i++) {
    (ans += dp.at(i).at(s)) %= mod;
  }
  cout << ans << endl;
}


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

#define int long long
#define MOD 1000000007

vector<int> graph[100010];

int color[100010];

int n, k;

void dfs(int idx, int oya){
    int cnt = (idx == oya ? 1 : 2);
    for(int i = 0;i < graph[idx].size();i++){
        if(graph[idx][i] != oya){
            color[graph[idx][i]] = max(0ll, k-cnt);
            dfs(graph[idx][i], idx);
            cnt++;
        }
    }

    return;
}

signed main(){
    cin >> n >> k;

    int a, b;
    for(int i = 0;i < n-1;i++){
        cin >> a >> b;
        a--;
        b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    dfs(0, 0);

    int ans = k;
    for(int i = 1;i < n;i++){
        ans = (ans * color[i]) % MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>
#include <string.h>
int main(void){
  int i,k;
  char s[20]="\n";
  char a[]="ACL";
  scanf("%d",&k);
  for(i=0;i<k;i++){
    strcat(s,a);
  }
  printf("%s",s);
  return 0;
}

Measured memory_bytes: 1732
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }

int main() {
	int a, b, k;
	cin >> a >> b >> k;
	REP(i, k) {
		if (i % 2 == 0) {
			a /= 2;
			b += a;
		}
		else {
			b /= 2;
			a += b;
		}
		

	}
	cout << a << " " << b << endl;
	return 0;
}



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

int main()
{
	int N[2];
	int count5,count7; 

	count5=0;
	count7=0;

	for(int i=0 ; i<3 ; i++ ){
		
		cin >> N[i];

		if(N[i]==5){

			count5++;

		}else if(N[i]==7){

			count7++; 

		}

	}

	if(count5==2 && count7==1){
		cout << "YES";
	}else{
		cout << "NO";
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{    priority_queue<long long int> q; 
	int  n,m;
    cin>>n>>m;
    long long int i, a[n];
    for(i=0;i<n;i++)
    { cin>>a[i]; q.push(a[i]);}
    long long int ans=0;
    while(m--)
    {
        long long int x=q.top();
    //cout<<x<<endl;
        q.pop();
        x=x/2;
        q.push(x);
        
    }
 
   while(!q.empty())
    {
        long long int x=q.top();
        //cout<<x<<endl;
        q.pop();
        ans+=x;}
    cout<<ans<<endl;
 
    
}
 


Measured memory_bytes: 5096
from math import sqrt, radians, cos
a, b, h, m = map(int, input().split())
acc = (0.5 * m + h*30) - 6 * m
if acc > 180:
	acc = 360 - acc
ans = sqrt(a**2 + b**2 - 2*a*b*cos(radians(acc)))
print(ans)

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

const int mod =1000000007;
 
using namespace std;
 
int N, M, A, B;
 
long long f[300005];
 
long  long power(long long a,long long b)
{
    if(b==0)
        return 1;
    if(b==1)
        return a;
    long long temp=power(a,b/2);
    temp=(temp*temp)%mod;
    if(b&1)
        temp=(temp*a)%mod;
    return temp %mod;
}
 
void init(){
   f[0] = 1ll;
   for(int n = 1; n <= 300000; ++n){
      f[n] = (f[n - 1] * n) % mod;
   }
}
 
long long get(int x, int y){
   x -= 1;
   y -= 1;
   long long p = f[x + y];
   long long q = power(f[x], mod - 2);
   long long r = power(f[y], mod - 2);
   p = p * q;
   p %= mod;
   p = p * r;
   p %= mod;
   return p;
}
 
int main(){
   cin >> N >> M >> A >> B;   
   long long res = 0ll;
   init();
   for(int n = 1; n <= N - A; ++n){
      res += (get(n, B) * get(N - n + 1, M - B)) % mod;
      res %= mod;
   }
   cout << res << endl;
   return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;
            public class Main{
              public static void main(String[] args){
                Scanner stdIn = new Scanner(System.in);
                int a = stdIn.nextInt();
                int b = stdIn.nextInt();
                int c = a*b;
                if((a<1)||(a>9)||(b<1)||(b>9)){
                  System.out.println("-1");
                }else{
                  System.out.println(c);
                }
              }
            }

Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W = sc.nextInt();
        int[] w = new int[N + 1];
        long[] v = new long[N + 1];
        for (int i = 1; i <= N; i++) {
            w[i] = sc.nextInt();
            v[i] = sc.nextInt();
        }
        long[][] dp = new long[N + 1][100001];
        for (int i = 1; i <= N; i++) {
            for (int j = 0; j <= 100000; j++) {
                if (j < w[i]) {
                    dp[i][j] = dp[i - 1][j];
                } else {
                    dp[i][j] = Math.max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
                }
            }
        }
        System.out.println(dp[N][W]);
    }

}


Measured memory_bytes: 139124
#include <bits/stdc++.h>
#define speed                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define oprecision                                                             \
  cout.precision(30);                                                          \
  cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
ss s;
ii main() {
  speed;
  oprecision;
  /*#ifndef ONLINE_JUDGE
    freopen("outd.txt", "rt", stdin);
  #endif*/
  // code
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if ((i + 1) % 2 == 1) {
      if (s[i] != 'R' && s[i] != 'U' && s[i] != 'D') {
        cout << "No";
        return 0;
      }
    }
    if ((i + 1) % 2 == 0) {
      if (s[i] != 'L' && s[i] != 'U' && s[i] != 'D') {
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes";
  // endl
#ifndef ONLINE_JUDGE
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

int main() {
    using namespace std;

    int K, N;
    cin >> N >> K;

    int l[50] = {0,};
    for (int i=0; i<N; i++) {
        cin >> l[i];
    }

    std::sort(l, l + 50, std::greater<>());
    
    int m = 0;
    for (int i=0; i<K; i++) {
         m += l[i];
    }

    cout << m << endl;

    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (a, b) =  readLine()!!.split(" ").map(String::toInt)
    var x = 1
    var count = 0
    val inc = a - 1
    while (true) {
        if (x >= b) {
            println(count)
            return
        }
        count += 1
        x += inc
    }
}

Measured memory_bytes: 37824
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF=1<<29;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll r,d,x,tmp;
	cin>>r>>d>>x;
	tmp=x;
	for(int i=0;i<10;i++){
		cout<<r*tmp-d<<endl;
		tmp=r*tmp-d;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define for(i,a,b) for(int i=a;i<b;i++)
#define all(a) a.begin(),a.end()
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//sort 降順
//reverse 逆順
 
int main() {
  ll a,b;
  ci(a>>b);
  co(max({a+b,a-b,a*b}));
}

Measured memory_bytes: 256
n = int(input())
s = input()
mi = 0
t = 0
for i in s:
    if i == '(':
        t+=1;
    else:
        t-=1;
        mi = min(mi,t)
if mi<0:
    print('('*-mi,end='')
    print(s+')'*(t-mi))
else:
    print(s+')'*t)


Measured memory_bytes: 3188
package main

import (
	"fmt"
)

func main() {
	var N, K int
	fmt.Scanf("%d %d", &N, &K)

	n := make([]bool, N)
	for i := 0; i < K; i++ {
		var d int
		fmt.Scanf("%d", &d)

		for j := 0; j < d; j++ {
			var a int
			fmt.Scan(&a)
			n[a-1] = true
		}
	}
	counter := 0
	for _, v := range n {
		if v == false {
			counter++
		}
	}

	fmt.Println(counter)
}


Measured memory_bytes: 2524
#include <stdio.h>

int main(){
	int i,j,num[10],ten;
	long long int n;
	while(scanf("%lld",&n) != EOF){
		ten = 1;
		for(i = 9;i >= 0;i--) {
			num[i] = n / ten % 10;
			ten *= 10;
		}
		for(i = 0;i < 9;i++){
			for(j = 0;j < 9 - i;j++) num[j] = (num[j] + num[j + 1]) % 10;
		}
		printf("%d\n",num[0]);
	}
	return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

const uint64_t R = 1'000'000'007L;
vector<int> adj[100'000];
bool visited[100'000];

uint64_t dpow(uint64_t x, uint64_t y)
{
    if (y == 0)
    {
        return 1;
    }
    if (y % 2 == 0)
    {
        return dpow(x * x % R, y / 2);
    }
    else
    {
        return x * dpow(x, y - 1) % R;
    }
}

uint64_t inv(uint64_t x)
{
    return dpow(x, R - 2);
}

uint64_t comb(uint64_t n, uint64_t k)
{
    uint64_t a = 1, b = 1;
    for (uint64_t i = 0; i < k; i++)
    {
        a *= (n - i);
        a %= R;
        b *= i + 1;
        b %= R;
    }
    return a * inv(b) % R;
}

uint64_t perm(uint64_t n, uint64_t k)
{
    uint64_t r = 1;
    for (uint64_t i = 0; i < k; i++)
    {
        r *= (n - i);
        r %= R;
    }
    return r;
}

uint64_t solve(int node, uint64_t k)
{
    uint64_t prod = 1;
    uint64_t childNum = 0;
    uint64_t parNum = 1;
    visited[node] = true;
    for (const int &ch : adj[node])
    {
        if (!visited[ch])
        {
            prod *= solve(ch, k);
            prod %= R;
            childNum++;
        }
        else
        {
            parNum++;
        }
    }
    return prod * perm(k - parNum, childNum) % R;
}

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

    for (int i = 0; i < n - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    for (int i = 0; i < n; i++)
    {
        visited[i] = false;
    }
    uint64_t result = solve(0, k) * k % R;
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 10496
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
using namespace std;

long long N, A[100009]; bool OK = false;

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		if (A[i] % 2 == 1) OK = true;
	}
	if (OK == true) cout << "first" << endl;
	else cout << "second" << endl;
	return 0;
}

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

int main(){
    int n=0,k=0;
    cin >> n >> k;
    map<int,bool>m;
    int x;
    for(int i=0;i<k;i++){
        cin >> x;
        m[x]=true;
    }
    int N = n;
    while(1){
        string str = to_string(N);
        bool flag = false;
        for(char ch:str){
            int x = ch - '0';
            if(m[x]==true){
                flag = true;
            }
        }
        if(flag==false){
            break;
        }
        N++;
    }
    cout << N << endl;

}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long
#define ui unsigned int
#define ull unsigned long long
using namespace std;
const int N = 1e5+7;
queue<int> q;
vector<int> vec[N], a[N], b[N];
ll dis1[N], dis2[N], ans[N];
int vis1[N], vis2[N];
void spfa1(int s)
{
    q.push(s);
    memset(dis1, 0x3f, sizeof(dis1));
    vis1[s] = 1, dis1[s] = 0;
    while(!q.empty())
    {
        int u = q.front();
        for(int i = 0; i < vec[u].size(); i++)
        {
            int v = vec[u][i];
            if(dis1[v]>dis1[u]+a[u][i])
            {
                dis1[v] = dis1[u]+a[u][i];
                if(!vis1[v])
                {
                    q.push(v);
                    vis1[v] = 1;
                }
            }
        }
        q.pop();
        vis1[u] = 0;
    }
    return;
}
void spfa2(int s)
{
    q.push(s);
    memset(dis2, 0x3f, sizeof(dis2));
    vis2[s] = 1, dis2[s] = 0;
    while(!q.empty())
    {
        int u = q.front();
        for(int i = 0; i < vec[u].size(); i++)
        {
            int v = vec[u][i];
            if(dis2[v]>dis2[u]+b[u][i])
            {
                dis2[v] = dis2[u]+b[u][i];
                if(!vis2[v])
                {
                    q.push(v);
                    vis2[v] = 1;
                }
            }
        }
        q.pop();
        vis2[u] = 0;
    }
    return;
}
int main()
{
    ll beg = 1e15;
    int n, m, s, t;
    scanf("%d%d%d%d", &n, &m, &s, &t);
    for(int i = 1; i <= m; i++)
    {
        int u, v, w1, w2;
        scanf("%d%d%d%d", &u, &v, &w1, &w2);
        a[u].push_back(w1);
        a[v].push_back(w1);
        b[u].push_back(w2);
        b[v].push_back(w2);
        vec[u].push_back(v);
        vec[v].push_back(u);
    }
    spfa1(s);
    spfa2(t);
    ll cnt = 0;
    for(int i = n; i >= 1; i--)
    {
        cnt = max(cnt, beg-dis1[i]-dis2[i]);
        ans[i] = cnt;
    }
    for(int i = 1; i <= n; i++)
    {
        printf("%lld\n", ans[i]);
    }
	return 0;
}


Measured memory_bytes: 21504
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var A = cin.ReadInt;
            var B = cin.ReadInt;
            var C = cin.ReadInt;
            if(C>=A && C <= B)
            {
                WriteLine("Yes");
            }
            else
            {
                WriteLine("No");
            }
        }



        public long C(int X, int Y)
        {

            if (Y == 0 || Y == X)
            {
                return 1;
            }
            if (X < Y)
            {
                return 0;
            }
            var Pascal = new long[X + 1, X + 1];
            for (int i = 0; i <= X; i++)
            {
                Pascal[i, 0] = 1L;
                Pascal[i, i] = 1L;
            }
            for (int i = 2; i <= X; i++)
            {
                for (int j = 1; j < i; j++)
                {
                    Pascal[i, j] = Pascal[i - 1, j] + Pascal[i - 1, j - 1];
                }
            }
            return Pascal[X, Y];
        }

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


Measured memory_bytes: 11348
//OPTIMIZATONS
#pragma GCC optimize("02")
//CODE
#include<bits/stdc++.h>
#define int long long
#define float double
#define endl "\n"
#define debug cout<<"Good uptill here"<<endl<<flush;
#define deb(x) cout<<#x<<":"<<x<<endl<<flush;

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	//CODE FOR SPECIFIED INPUT AND OUTPUT
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	const int mod = 1e9+7;
	int n,k;
	cin>>n>>k;
	n++;
	int ans = 0;
	for(int i=k;i<=n;i++){
		int maxi = n*(n+1)/2;
		maxi -= (n-i)*(n-i+1)/2;
		maxi += mod;
		maxi %= mod;
		int mini = i*(i+1)/2;
		mini %= mod;
		ans += (maxi-mini+1);
		ans += mod;
		ans %= mod;
		//deb(maxi); deb(mini); deb(maxi-mini); deb(ans);
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3656
#encoding:utf-8 No.0045 2014.10.5
sum = 0
average = 0.0
count = 0.0

while gets
  count += 1.0
  price,quantity = $_.chomp.split(/,/).map{|item| item = item.to_i}
  sum += price * quantity
  average += quantity.to_f
end

puts sum
puts (average/count).round

Measured memory_bytes: 6112
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li n, k;
    cin >> n >> k;
    li r, s, p;
    cin >> r >> s >> p;
    string t;
    cin >> t;

    string pat = "spr";
    li scs[3] = {r, s, p};

    vector<string> subs(k);
    for (int i = 0; i < n; ++i) {
        subs[i % k].push_back(t[i]);
    }

    li ans = 0;

    for (int i = 0; i < k; ++i) {
        string tt = subs[i];
        li nn = tt.size();
        vector<vector<li>> dp(nn + 1, vector<li>(3, -1e9));
        for (int j = 0; j < 3; ++j) {
            dp[0][j] = 0;
        }
        for (int j = 0; j < nn; ++j) {
            for (int h = 0; h < 3; ++h) {
                li submax = -1e9;
                for (int l = 0; l < 3; ++l) {
                    if (l != h) {
                        submax = max(submax, dp[j][l]);
                    }
                }
                li score;
                if (tt[j] == pat[h]) {
                    score = scs[h];
                } else {
                    score = 0;
                }
                dp[j + 1][h] = submax + score;
            }
        }
        ans += max({dp[nn][0], dp[nn][1], dp[nn][2]});
    }

    cout << ans << endl;

    return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;

const int MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<long long> a(N);
    vector<long long> sum(N + 1);
    rep(i, N) cin >> a[i], sum[i + 1] = sum[i] + a[i];

    long long res = 1LL << 60;
    for (int i = 0; i <= N; i++) {
        int low = 0;
        int high = i;
        while (high - low > 1) {
            int mid = (low + high) / 2;
            if (sum[mid] > sum[i] - sum[mid]) high = mid;
            else low = mid;
        }
        long long P = sum[low], Q = sum[i] - sum[low];
        long long P2 = sum[high], Q2 = sum[i] - sum[high];
        long long left_min = min(P, Q), left_max = max(P, Q);
        if (abs(P2 - Q2) < abs(P - Q)) left_min = min(P2, Q2), left_max = max(P2, Q2);

        low = i, high = N;
        while (high - low > 1) {
            int mid = (low + high) / 2;
            if (sum[mid] - sum[i] >= sum[N] - sum[mid]) high = mid;
            else low = mid;
        }
        long long R = sum[low] - sum[i], S = sum[N] - sum[low];
        long long R2 = sum[high] - sum[i], S2 = sum[N] - sum[high];
        long long right_min = min(R, S), right_max = max(R, S);
        if (abs(R2 - S2) < abs(R - S)) right_min = min(R2, S2), right_max = max(R2, S2);

        long long tmp = max(left_max, right_max) - min(left_min, right_min);
        res = min(res, tmp);
    }

    cout << res << endl;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int h, w, cnt = 0;
  cin >> h >> w;

  vector<vector<char>> s(h, vector<char>(w));
  for (auto &r : s) {
    for (auto &c : r) {
      cin >> c;
      cnt += c == '#';
    }
  }

  vector<vector<int>> costs(h, vector<int>(w, -1));
  queue<array<int, 3>> q;
  q.push({0, 0, 0});
  while (!q.empty()) {
    auto [i, j, cost] = q.front();
    q.pop();
    if (i >= 0 && i < h && j >= 0 && j < w && costs[i][j] < 0 &&
        s[i][j] != '#') {
      costs[i][j] = cost;
      q.push({i - 1, j, cost + 1});
      q.push({i + 1, j, cost + 1});
      q.push({i, j - 1, cost + 1});
      q.push({i, j + 1, cost + 1});
    }
  }

  int cost = costs[h - 1][w - 1];
  if (cost < 0) {
    cout << -1 << '\n';
  } else {
    cout << h * w - (cost + 1) - cnt << '\n';
  }

  return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long int ll;
 
int main()
{
 int N,T;
 scanf("%d %d",&N,&T);
 int ans=1000000;
 for(int i=0;i<N;i++)
 {
	int c,t;
	scanf("%d %d",&c,&t);
	if(t<=T){ans=min(ans,c);}
}
 if(ans==1000000){printf("TLE");}
 else{printf("%d",ans);}
} 

Measured memory_bytes: 3732
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //int first = Integer.parseInt(scan.next());
        //int second = Integer.parseInt(scan.next());
        //int third = Integer.parseInt(scan.next());
        //long input = scan.nextLong();
        String s = scan.next();
//        String second = scan.next();
        //for (int i = 1; i <=input; i++) {
        //}
        if(s.equals("SAT"))
            System.out.println("1");
        if(s.equals("SUN"))
            System.out.println("7");
        if(s.equals("MON"))
            System.out.println("6");
        if(s.equals("TUE"))
            System.out.println("5");
        if(s.equals("WED"))
            System.out.println("4");
        if(s.equals("THU"))
            System.out.println("3");
        if(s.equals("FRI"))
            System.out.println("2");
    }    

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for(int i = (a); i<(b); ++i)
#define rep(i, n) for (int i=0; i<(n); ++i)
#define out(x) cout << x << endl

int main() {
    int A;
    cin >> A;
    FOR(i, 1, 10){
        FOR(j, 1, 10){
            if(A==i*j){
                out("Yes");
                return 0;
            }
        }
    }
    out("No");
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

struct edge {
    int to, cost;
};

int n;
int m;
vector<vector<edge>> g;
vector<int> d;

//ダイクストラ法
void dijkstra(int s) {
    for (int i = 0; i < n; ++i) {
        d[i] = INF;
    }

    //最小値を取り出す優先度付きキュー
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que;

    d[s] = 0;
    que.push(make_pair(0, s)); //距離を最初にして、優先度付きキューで最小値を出せるようにする

    while (!que.empty()) {
        pair<int, int> p = que.top(); que.pop();
        int v = p.second;

        //記録してある最短距離よりも取り出した要素に入っている距離情報が大きい場合は打ち切り
        if (d[v] < p.first) continue;

        for (int i = 0; i < (int)g[v].size(); ++i) {
            edge e = g[v][i];

            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(make_pair(d[e.to], e.to));
            }
        }
    }
}

int main() {

    cin >> n >> m;

    g.resize(n);
    d.resize(n);

    for (int i = 0; i < m; ++i) {
        int a, b; cin >> a >> b;
        --a; --b;

        g[a].push_back(edge({b, 1}));
        g[b].push_back(edge({a, 1}));
    }

    dijkstra(0);

    for (int i = 0; i < n; ++i) {
        if (d[i] == INF) {
            puts("No");
            return 0;
        }
    }

    cout << "Yes" << endl;

    vector<int> t(n, 0);
    for (int i = 1; i < n; ++i) {
        t[d[i]] = i;
    }

    for (int i = 1; i < n; ++i) {
        cout << t[d[i] - 1] + 1 << endl;
    }
}

Measured memory_bytes: 13288
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define mod 1000000007
using namespace std;

int main(){

    string s;
    long long k,ans=0,st=1,en=1,n;
    int flg;
    cin >> s >> k;

    flg = 0;
    n = sz(s);
    if(s[0]==s[n-1]){
        rep(i,0,n-1){
            if(s[i]==s[i+1]){
                ++st;
            }
            else{
                break;
            }
        }
        drep(i,n-1,0){
            if(s[i]==s[i-1]){
                ++en;
            }
            else{
                break;
            }
        }
        if(st == n){
            cout << n*k/2 << endl;
            return 0;
        }
        rep(i,st,n-en-1){
            if(s[i] == s[i+1]){
                ans += k;
                s[i+1] = '1';
            }
        }
        ans += ((st+en)/2) * (k-1) + st/2 + en/2;
    }else{
        rep(i,0,n-1){
            if(s[i] == s[i+1]){
                ans += k;
                s[i+1] = '1';
            }
        }   
    }

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vp;
typedef vector<T> vt;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//---------------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
//--------------------------------------------------------------

void Main(){
  int n;
  cin>>n;
  vi p(n),m(n);
  cin>>p;
  m[0] = p[0];
  rep(i,n-1){
    m[i+1] = min(m[i],p[i+1]);
  }
  int ans=0;
  rep(i,n){
    ans+= (p[i]<=m[i]);
  }
  //cout<<p<<endl;
  //cout<<m<<endl;
  cout<<ans<<endl;
} int main(int argc,char** argv)
{fastio; myio; Main();}


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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int* buildFail(const vi &s){
	int n = s.size();
	int *p = new int[n];
	p[0] = 0;
	for (int i = 1; i < n; ++i){
		p[i] = p[i - 1];
		while (p[i] > 0 && s[p[i]] != s[i]) p[i] = p[p[i] - 1];
		if (s[p[i]] == s[i]) p[i]++;
	}
	return p;
}

int main(){
	int n; cin >> n;
	vi s(n);
	rep(i, n) cin >> s[i];
	int *f = buildFail(s);
	int p = __gcd(n, n - f[n - 1]);
	//cout << n / p << endl;
	
	for(int t = 1; t <= n; t++) if(n % t == 0){
		
		bool ok = 1;
		rep(i, t) for(int j = i; j < n; j += t) if(s[j] != s[i]){
			ok = 0;
			break;
		}
		if(ok){
			cout << n / t << endl;
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 4416
#include<bits/stdc++.h>
using namespace std;
char arr[5];
int main()
{
    while(cin>>arr){
        int num=0;
        for(int i=1;i<4;i++){
            if(arr[i]==arr[i-1])num++;
            else if(num<2)num=0;
        }
        if(num>=2) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


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


class BIT
{
public:
	vector<ll> bit;
	int n;

	BIT(ll n):
		bit(vector<ll>(n+1)), n(n) {}

	ll sum(ll a) {
		ll ret = 0;
		for (int x = a; x > 0; x -= (x & -x))
		{
			ret += bit[x];
		}
		return ret;
	}

	void add(int a, ll w) {
		for (int x = a; x <= n; x += (x & -x))
		{
			bit[x] += w;
		}
		return;
	}

};



int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> b(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> b[i];
		b[i] -= k;
	}
	vector<pair<ll, int> > p(n+1);
	for (int i = 0; i < n; ++i)
	{
		p[i+1].first = p[i].first + b[i];
		p[i+1].second = i+1;
	}
	sort(p.begin(), p.end());
	vector<ll> a(n+1);
	for (int i = 0; i < n+1; ++i)
	{
		a[p[i].second] = i+1;
	}
	
	BIT bit(n);
	/*
	for (int i = 0; i < n+1; ++i)
	{
		cout << bit[i] << " ";
	}
	cout << endl;
	*/
	
	ll ans = 0;
	for (int i = 0; i < n+1; ++i)
	{
		ans += bit.sum(a[i]-1);
		bit.add(a[i], 1);
	}
	cout << ans << endl;

	return 0;
}

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

int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int five=0,seven=0;
  for (int i=0; i<3; i++) {
    int ABC;
    cin>>ABC;
    if (ABC==5) {
      five++;
    }
    if (ABC==7) {
      seven++;
    }
  }
  cout<<(five==2&&seven==1?"YES":"NO")<<endl;
  return 0;
}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, r[200000], Max = -1000000000, Min;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> r[i];
  }
  Min = r[0];
  for (int i = 1; i < n; i++) {
    Max = max(r[i] - Min, Max);
    Min = min(r[i], Min);
  }
  cout << Max << '\n';
  return 0;
}



Measured memory_bytes: 3892
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const int MOD = 1e9+7;
//}}}

int main(){
  int a, b;
  cin >> a >> b;
  int ans = 0;
  rep(i, a, b + 1){
    string s0 = to_string(i);
    string s = to_string(i);
    reverse(s.begin(), s.end());
    if(s0 == s) ans++;
  }
  cout << ans << endl;
  return 0;
}


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


int main(){
long long int a;
  cin >>a;
  long long int b[100010],c;
  
  for(int i=0;i<a;i++)
    cin >>b[i];
 
  c = 0;
  for(int i=0;i<a-1;i++){
    
    
    if(b[i]>b[i+1]+1 || b[i+1] < c ){
      
      cout << "No" << endl;
      return 0;
    }
    
    else if(b[i]==b[i+1]+1){
      b[i]--;
      
      c = max(c,b[i]);
    }
    
    
    
      
  }
  
  cout << "Yes" << endl;
}
      


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
	int d,n;cin>>d>>n;
	int q = n;
	for(int i=1;i<=d;i++){
		q*=100;
	}
	cout<<q+((n==100)*(q/100));
}


Measured memory_bytes: 256
/**
 *     author: qodjf
 *     created: 04.28.2020 00:54:41
 */
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

string to_string(string s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif

#define mst(x, a) memset(x, a, sizeof(x))

using ll = long long;
using P = pair<int, int>;
using T = tuple<ll, int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr ll LLINF = 0x3f3f3f3f3f3f3f3f;
constexpr ll MOD = 1e9 + 7;

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

struct edge {
  int to, cost, t;
  edge(int _to, int _cost, int _time) : to(_to), cost(_cost), t(_time) {}
};

int N, M, S;
int maxCoinsNeeded;
vector<vector<edge>> g;
ll dis[50][10010];

void solve() {
  mst(dis, INF);
  S = min(S, maxCoinsNeeded);
  dis[0][S] = 0;
  priority_queue<T, vector<T>, greater<T>> que;
  que.emplace(0, 0, S);
  while (!que.empty()) {
    auto p = que.top();
    que.pop();
    ll spendT = get<0>(p);
    int pos = get<1>(p), coin = get<2>(p);
    if (spendT > dis[pos][coin]) continue;
    for (const edge &e : g[pos]) {
      int v = e.to;
      int nCoin = min(coin - e.cost, maxCoinsNeeded);
      ll nT = spendT + e.t;
      if (nCoin >= 0 && nT < dis[v][nCoin]) {
        dis[v][nCoin] = nT;
        que.emplace(nT, v, nCoin);
      }
    }
  }

  for (int i = 1; i < N; i++) {
    cout << *min_element(dis[i], dis[i] + maxCoinsNeeded + 1) << endl;
  }
}

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

  cin >> N >> M >> S;
  g.resize(N);
  maxCoinsNeeded = 0;
  for (int i = 0; i < M; i++) {
    int u, v, a, b;
    cin >> u >> v >> a >> b;
    u--, v--;
    g[u].emplace_back(v, a, b);
    g[v].emplace_back(u, a, b);
    maxCoinsNeeded += 2 * a;
  }
  for (int i = 0; i < N; i++) {
    int c, d;
    cin >> c >> d;
    g[i].emplace_back(i, -c, d);
  }
  solve();
}


Measured memory_bytes: 10760
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        int number_of_friends = input.nextInt();
        int required_height = input.nextInt();
        int allowed_people = 0;

        for (int i=0; i<number_of_friends; i++) {
            int height_of_each = input.nextInt();
            if (height_of_each >= required_height)
                allowed_people += 1;
        }

        System.out.println(allowed_people);

    }
}


Measured memory_bytes: 50220
T = input()
F = T[:2]
S = T[2:]

def m(x):
    f = int(x[0])
    s = int(x[1])
    if f == 0:
        if 1 <= s <= 9:
            return True
        else:
            return False
    elif f == 1:
        if 0 <= s <= 2:
            return True
        else:
            return False
    else:
        return False

if m(F) and m(S):
    print("AMBIGUOUS")
elif m(F) and not m(S):
    print("MMYY")
elif not m(F) and m(S):
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 3064
#include<iostream>
#include<sstream>
#include<string>
#include<cstdlib>
using namespace std;

string llitos(long long a){
  stringstream ss;
  ss << a;
  return ss.str();
}

long long pos(long long a){
  a--;
  long long res = 4*(a/3 + a/5),k = 1;
  long long n3,p3,n5,p5,n15,p15;
  for(int i=1;k<=a;i++){
    p3 = (k-1)/3; p5 = (k-1)/5; p15 = (k-1)/15;
    if(k*10<=a){
      n3 = (k*10-1)/3; n5 = (k*10-1)/5; n15 = (k*10-1)/15;
      res += i*(k*9-n3+p3-n5+p5+n15-p15);
    }else{
      n3 = a/3; n5 = a/5; n15 = a/15;
      res += i*(a-k+1-n3+p3-n5+p5+n15-p15);
    }
    k*=10;
  }
  return res+1;
}
      
int main(){
  long long s;
  cin >> s;

  long long l = 1, r = 1LL<<60;
  while(r-l>1){
    long long mid = (l+r)/2;
    if(pos(mid)+1<=s)l = mid;
    else r = mid;
  }
  long long tmp = pos(l);
  string ans = "";
  while(ans.size()<=40){
    if(!(l%3) && !(l%5))ans += "FizzBuzz";
    else if(!(l%3))ans += "Fizz";
    else if(!(l%5))ans += "Buzz";
    else ans += llitos(l);
    l++;
  }
  cout << ans.substr(s-tmp,20) << endl;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll arr[100001];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n;
	cin>>n;
	
	for(ll i=0;i<n;i++)
	{
	    cin>>arr[i];
	}
	
	ll dp[n]={0};
	
	dp[1]=abs(arr[1]-arr[0]);
	
	for(ll i=2;i<n;i++)
	{
	    dp[i]=min(dp[i-2]+abs(arr[i]-arr[i-2]) , dp[i-1] +abs(arr[i]-arr[i-1]));
	}
	
	cout<<dp[n-1]<<"\n";
	
}


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define DUP(x, y) (((x) + (y) - 1) / (y))
#define YES puts("YES")
#define NO puts("NO")
#define Yes puts("Yes")
#define No puts("No")
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end())

using ll = std::int64_t;
using vint = std::vector<int>;
using vll = std::vector<ll>;
using vstr = std::vector<std::string>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    vint v(3);
    rep(i, 3)cin >> v[i];

    sort(ALL(v));

    cout << v[0] + v[2] * 10 + v[1] << endl;

}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a[4];
	cin>>a[1]>>a[2]>>a[3];
	if(a[1]==a[2]&&a[2]!=a[3])
	{
		cout<<"Yes"<<endl;
	}
	else if(a[1]==a[3]&&a[1]!=a[2])
	{
		cout<<"Yes"<<endl;
	}
	else if(a[2]==a[3]&&a[2]!=a[1])
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
#define map map<string,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
const double PI=acos(-1);
 
using namespace std;

int main( ) {
    ll N,K;
    cin>>N>>K;
    vec A(N);
    rep(i,0,N) {
        cin>>A[i];
    }
    ll a=100000000000000000;
    rep(i,0,N-K+1) {
        ll c=min(abs(A[i])+abs(A[i+K-1]-A[i]),abs(A[i+K-1])+abs(A[i+K-1]-A[i]));
        a=min(a,c);     
    }
    cout<<a<<endl;
    }

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int n,p[10000],d[10001],d1,d2;
	int i,max;
	
	while(1)
	{
		scanf("%d",&n);
		if(n==0)
		{
			break;
		}
		
		d[0]=0;
		max=0;
		for(i=1;i<n+1;i++)
		{
			scanf("%d %d %d",&p[i],&d1,&d2);
			d[i]=d1+d2;
			if(d[i]>d[max])
			{
				max=i;
			}
		}
		printf("%d %d\n",p[max],d[max]);
	}
	
	return 0;
}

Measured memory_bytes: 676
/*
与えられた数列を逆順に出力するプログラムを作成して下さい。
 */

#include <stdio.h>

int main(void)
{
    int n, a[100], i, length = 0;

    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    length = i - 1;

    for (i = length; i >= 0; i--)
    {
        printf("%d", a[i]);
        if (i != 0)
            printf(" ");
        else
            printf("\n");
    }
    return (0);
}


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

int main()
{
    int K, N, len = 0;
    cin >> K >> N;
    int A[N];
    vector<int> B(N);

    for(int i = 0; i < N; i++){
        cin >> A[i];
        if (i != 0)
        {
            B[i-1] = A[i] - A[i-1];
        }
        
    }

    B[N-1] = K - A[N-1] + A[0];

    vector<int>::iterator iter = max_element(B.begin(), B.end());
    size_t index = distance(B.begin(), iter);
    for (int i = 0; i < N; i++)
    {
        if (i != index)
        {
            len += B[i];
        }
        
    }

    cout << len << endl;

    return 0;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    string s;
    cin >> s;
    if (s[0] == 'Y') {
        if (s[1] == 'A') {
            if (s[2] == 'K') {
                if (s[3] == 'I') {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n, m, max;
	int a[1001];

	while(1){
		scanf("%d %d", &n, &m);
		if(n == 0 && m == 0) break;
		for(int i=0; i<n; i++){
			scanf("%d", &a[i]);
		}

		max = -1;
		for(int i=0; i<n-1; i++){
			for(int j=i+1; j<n; j++){
				if(max < a[i]+a[j] && a[i]+a[j] <= m){
					max = a[i]+a[j];
				}
			}
		}
		if(max == -1) printf("NONE\n");
		else printf("%d\n", max);
	}//endwhile

}


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

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

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

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

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



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  string s,t; cin>>s>>t;
  ll n=s.size();
  ll ans=0;
  rep(i,n){
    if(s[i]!=t[i]) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3840