akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e3+5;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin>>a>>b;
    int ans=-1;
    for(int i=1;i<=10000;i++)
    {
        double c,d;
        c=i*0.08;
        d=i*0.1;
        if(floor(c)==a&&floor(d)==b)
        {
            ans=i;
            break;
        }
    }
    cout<<ans<<'\n';






}










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

int main() {
  ll x, k, d;
  cin >> x >> k >> d;

  x = abs(x);

  if (k - x / d <= 0) {
    // k回近づいたときが最適。
    cout << x - k * d << endl;
  } else {
    // まず近づけるだけ近づく
    k -= x / d;
    x -= x / d * d;
    if (k % 2 == 1) {
      // 残り奇数回のとき、原点を飛び越える。
      cout << abs(x - d) << endl;
    } else {
      // 残り偶数回のとき、足踏みが最適。
      cout << x << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var stdin = bufio.NewScanner(os.Stdin)

func main() {
	stdin.Split(bufio.ScanWords)
	var a, b, c int64
	a = nextInt64()
	b = nextInt64()
	c = nextInt64()

	if c-a-b > 0 && 4*a*b < (c-a-b)*(c-a-b) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")

	}

}

func nextInt() int {
	stdin.Scan()
	i, err := strconv.Atoi(stdin.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextInt64() int64 {
	stdin.Scan()
	i, err := strconv.ParseInt(stdin.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextStr() string {
	stdin.Scan()
	i := stdin.Text()
	// if err != nil {
	// 	panic(err)
	// }
	return i
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
typedef long long ll;
typedef unsigned long long llu;
const double PI = 2*acos(0.0);
#define int long long
signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int l,r;
	cin>>l>>r;
	for(int i=l;i<=r;i++)
		if(i%2019==0)
			cout<<"0"<<endl,exit(0);
	int res = LONG_MAX;
	for(int i=l;i<=r;i++)
	{
		for(int j=i+1;j<=r;j++)
		{
			res = min(res,((i%2019)*(j%2019))%2019);
		}
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
   
    int a,b,c,k,sum=0;
	cin>>a>>b>>c>>k;
	
	
	if((a+b)>k)
		printf("%d",a>k?k:a);
	else
	{
		sum+=2*a+b-k;
		cout<<sum<<endl;
	}
	
		
	


}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
	int n;scanf("%d",&n);
	LL ans=1,x,inf=1e18,fl=1,fl1=1;
	for(int i=0;i<n;i++){
		scanf("%lld",&x);
		if(!x)fl1=0;
		if(fl&&(x>inf/ans||ans*x>inf))fl=0;
		ans*=x;
	}
	if(!fl1||fl)printf("%lld",ans);
	else puts("-1");
	return 0;
}

Measured memory_bytes: 3828
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(ReadLine());
            var line = ReadLine()
                .Split(' ')
                .Select(_ => int.Parse(_))
                .GroupBy(_ => _)
                .ToDictionary(_ => _.Key, __ => __.Count())
                ;
            int result = 0;
            foreach (var num in line)
            {
                int value = num.Value;
                if (line.ContainsKey(num.Key - 1))
                    value += line[num.Key - 1];
                if (line.ContainsKey(num.Key + 1))
                    value += line[num.Key + 1];
                if(result < value)
                    result = value;
            }
            WriteLine(result);
            ReadLine();
        }
    }
}


Measured memory_bytes: 30480
#include <bits/stdc++.h>
#define maxn 3002
#define mod 1000000007
using namespace std;
typedef long long LL;

int n;
char s[maxn];
int sum[maxn];
int dp[maxn][maxn];

int main() {
	scanf("%d%s",&n,s+1);
	dp[1][1] = sum[1] = 1;
	for( int i = 2 ; i <= n ; i++ ) {
		if(s[i-1] == '<')
			for( int j = 2 ; j <= i ; j++ )
				dp[i][j] = sum[j-1];
		else
			for( int j = 1 ; j < i ; j++ )
				dp[i][j] = (sum[i-1] - sum[j-1] + mod) % mod;
		for( int j = 1 ; j <= n ; j++ )
			sum[j] = ( sum[j-1] + dp[i][j] ) % mod;
	}
	printf("%d\n",sum[n]);
	return 0;
}


Measured memory_bytes: 34176
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, a, b; cin >> n >> a >> b;
    cout << min(n*a,b) << endl;
}

Measured memory_bytes: 256
// 20
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define forr(_, x, n) for (int _ = x; _ > n; _--)
#define fos(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fos(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12

void dp(vector<vector<li>> &mem, int pos, li current, li sum, li &ans, string &s) {
  if (pos == s.size()) {
    ans += sum;
    return;
  }
  current = current * 10 + s[pos] - '0';
  dp(mem, pos + 1, 0, sum + current, ans, s);
  if (pos < s.size() - 1)
    dp(mem, pos + 1, current, sum, ans, s);
}

void _main(int tc) {
  string s;
  cin >> s;
  vector<vector<li>> mem(s.size() + 1, vector<li>(2, -1));
  li ans = 0;
  dp(mem, 0, 0, 0, ans, s);
  cout << (ans) << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0); return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 256
N, X = map(int, input().split(" "))
Ls = list(map(int, input().split(" ")))

#ls = [sum(Ls[:i+1]) for i in range(N)]
D = 0
out = 0
end = False
for L in Ls:
    out += 1 
    D = D + L
    if D > X:
        end = True
        break

if end == False:
    out += 1

print(out)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
		int x=a+b;
		int cnt=0;
		while(x)
		{
			cnt++;
			x/=10;
		}
		printf("%d\n",cnt);
	}
	return 0;
}



Measured memory_bytes: 3120
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long a[3];
    scanf("%ld%ld%ld", &a[0], &a[1], &a[2]);
    sort(a+0, a+3);
    if(a[0]==5 && a[1]==5 && a[2]==7) {
        printf("YES\n");
    }
    else {
        printf("NO\n");
    }
 
    return 0;
}


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


int main(){
  int N;
  cin >> N;
  long long D[N + 1];
  D[0] = 2;
  D[1] = 1;
  for(int i = 2; i < N + 1; i++){
    D[i] = D[i - 1] + D[i - 2];
  }
  cout << D[N] << endl;
  return 0;
}

Measured memory_bytes: 3652
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static final int MOD = 998244353;

	static int mul(int a, int b) {
		int res = (int) ((long) a * b % MOD);
		return res < 0 ? res + MOD : res;
	}

	static void solve() throws Exception {
		int n = scanInt();
		String s = scanString();
		int freeColor = 0, freeCount = 0;
		int pairCounts[] = new int[3];
		int ans = 1;
		for (int i = 2; i <= n; i++) {
			ans = mul(ans, i);
		}
		for (int i = 0; i < 3 * n; i++) {
			int color = "RGB".indexOf(s.charAt(i));
			if (pairCounts[color] != 0) {
				ans = mul(ans, pairCounts[color]);
				--pairCounts[color];
			} else if (freeCount != 0 && freeColor != color) {
				ans = mul(ans, freeCount);
				--freeCount;
				++pairCounts[3 - color - freeColor];
			} else {
				freeColor = color;
				++freeCount;
			}
		}
		out.print(ans);
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 28028
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[] hights = new int[10];

		for(int i = 0 ; i < 10 ; i++){
			hights[i] = Integer.parseInt(br.readLine());
		}

		Arrays.sort(hights);

		for(int i = 9; i > 6 ; i--){
			System.out.println(hights[i]);
		}

	}

}

Measured memory_bytes: 24428
/*
 * Code be weshen zyk :'(
 */
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include "bits/stdc++.h"

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define F first
#define S second

using ll = long long;
using ii = pair<int, int>;
using db = long double;

#ifdef ONLINE_JUDGE
#define cerr if(0)cerr
#endif

template<class C> void amin(C &a4, C b4) {
	a4 = min(a4, b4);
}
template<class C> void amax(C &a4, C b4) {
	a4 = max(a4, b4);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
	os << "[";
	for (auto vv : V)
		os << vv << ",";
	return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) {
	return os << "(" << P.first << "," << P.second << ")";
}

const int N = 2e5 + 5;
int n, m;
int b[N + N];
ll a[N];
int cnt[N];
int main() {
#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#endif

	int n, k;
	cin >> n >> k;
	vector<int>dp(n + 1), h(n+1);
	for(int i = 1; i <= n; i++)
		cin >> h[i];

	for(int i = 2; i <= n; i++){
		dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
		for(int j = 1; j <= k && i -j >= 1; j++)
			dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
	}

	cout << dp[n] << '\n';


	return 0;
}


Measured memory_bytes: 1024
#include <iostream>

int main(int argc, char const *argv[])
{
	int a = 0;
	int b = 0;
	while(std::cin >> a >> b){
		int p = 10;
		int i = 1;
		while((a+b)/p != 0){
			i ++;
			p *= 10;
		}
		std::cout << i << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

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

        int a = 700;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'o') {
                a += 100;
            }
        }

        System.out.println(a);
    }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T> >;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }

    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//


    // input
    cout << fixed << setprecision(10);
    double N, M; cin >> N >> M;
    vector<double> A(N);
    double sum = 0;
    rep(i, N) cin >> A[i];
    rep(i, N){
        sum += A[i];
    }


    int cnt = 0;
    rep(i, N){
        if(A[i] >= sum * 1 / (4 * M)){
            cnt++;
        }
    }

    if(cnt >= M){
        yesno(true);
    }
    else yesno(false);
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define GAME_OVER return 0
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    char c;
    cin >> c;
    cout << char(c + 1) << endl;
    GAME_OVER;
}

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

using namespace std;

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

const int inf = 3e18;

signed main()
{
    int N;

    while (cin >> N, N) {
        vector<int> hp(N);

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

        int M;

        cin >> M;

        vector<pair<int,int>> S, A;

        rep(i, M) {
            string s;
            int mp, dmg;
            cin >> s >> mp >> s >> dmg;
            if (dmg == 0) continue;
            if (s == "Single") S.push_back(make_pair(mp, dmg));
            else A.push_back(make_pair(mp, dmg));
        }

        vector<int> dp1(100010, inf), dp2(100010, inf);
        dp1[0] = dp2[0] = 0;

        for (int i = 0; i < S.size(); ++i) {
            int mp = S[i].first, dmg = S[i].second;
            for (int j = 0; j <= 100000; ++j) {
                if (j - dmg >= 0) {
                    if (dp1[j - dmg] != inf) {
                        dp1[j] = min(dp1[j], dp1[j - dmg] + mp);
                    };
                } else {
                    dp1[j] = min(dp1[j], mp);
                }
            }
        }

        for (int i = 100001; i >= 1; --i) dp1[i - 1] = min(dp1[i - 1], dp1[i]);

        for (int i = 0; i < A.size(); ++i) {
            int mp = A[i].first, dmg = A[i].second;
            for (int j = 0; j <= 100000; ++j) {
                if (j - dmg >= 0) {
                    if (dp2[j - dmg] != inf) {
                        dp2[j] = min(dp2[j], dp2[j - dmg] + mp);
                    }
                } else {
                    dp2[j] = min(dp2[j], mp);
                }
            }
        }

        for (int i = 100001; i >= 1; --i) dp2[i - 1] = min(dp2[i - 1], dp2[i]);

        int mi = inf;

        dp1[0] = dp2[0] = 0;

        for (int a = 0; a <= 100000; ++a) {
            int sum = dp2[a];

            if (sum == inf) continue;

            for (int i = 0; i < N; ++i) {
                if (hp[i] - a >= 0) {
                    sum += dp1[hp[i] - a];
                    if (dp1[hp[i] - a] == inf) goto nxt;
                }
            }

            mi = min(mi, sum);
            nxt:;
        }

        cout << mi << endl;
    }
}

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

int main() {
 
  char c;
  cin >> c;
  
  if(c == 'a'||c == 'i'||c == 'u'||c == 'e'||c == 'o') {
   cout << "vowel" << endl; 
  }
  
  else {
   cout << "consonant" << endl; 
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  //while(1){
  int e,o,ans=0;
  cin>>e>>o;
  int even,odd;
  for(int i=e-1;i>=1;i--)
  {
    ans=ans+i;
  }
  for(int i=o-1;i>=1;i--)
  {
    ans=ans+i;
  }
  cout<<ans<<endl;
//}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    Int N, L, T; cin >> N >> L >> T; L *= 2, T *= 2;
    vector<int> X(N), W(N);
    for (int i = 0; i < N; i++) cin >> X[i] >> W[i], X[i] *= 2;
    Int idx = 0;
    for (int w : W) if (w == 2) idx += N - 2;
    idx = idx * (T / L) % N;
    T %= L;
    queue<int> Q1, Q2;
    for (int i = (idx + N - 1) % N; i != idx; (i += N - 1) %= N) {
        if (W[i] == 1) Q1.push(i);
    }
    for (int i = (idx + 1) % N; i != idx; (i += 1) %= N) {
        if (W[i] == 2) Q2.push(i);
    }
    if (W[idx] == 1) swap(Q1, Q2);
    int t = 0;
    while (!Q1.empty()) {
        int idy = Q1.front();
        Q1.pop();
        Int a = X[idx] + t * (W[idx] == 1 ? +1 : -1);
        a = ((a % L) + N) % L;
        Int b = X[idy] + t * (W[idy] == 1 ? +1 : -1);
        b = ((b % L) + N) % L;
        if (W[idx] == 1 && !(a < b)) b += L;
        if (W[idx] == 2 && !(b < a)) a += L;
        t += abs(a - b) / 2;
        if (t >= T) break;
        idx = idy;
        swap(Q1, Q2);
    }
    vector<tuple<Int, int, int>> A;
    for (int i = 0; i < N; i++) {
        Int a = X[i] + T * (W[i] == 1 ? +1 : -1);
        a %= L;
        if (a < 0) a += L;
        A.emplace_back(a, W[i], i);
    }
    sort(begin(A), end(A));
    for (int i = 0; i < N; i++) {
        if (get<2>(A[i]) == idx) {
            idx = i;
            break;
        }
    }
    for (int i = 0; i < N; i++) {
        cout << get<0>(A[(idx + i) % N]) / 2 << '\n';
    }
    return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<long long> a,b;
	for (int i = 0; i < n + 1; i++) {
		int x;
		cin >> x;
		a.push_back(x);
	}
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		b.push_back(x);
	}
	b.push_back(0);

	long long ans = 0;
	long long available = 0;
	for (int i = 0; i < n + 1; i++) {
		ans += min(a[i], b[i] + available);
		if (available > a[i]) available = b[i];
		else available = max(available + b[i] - a[i], (long long)0);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2548
#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;



int main(){
    long long h, w;
    cin >> h >> w;
    char maze[h][w];

    for(long long y = 0; y < h; y++){
        for(long long x = 0; x < w; x++){
            cin >> maze[y][x];
        }
    }

    long long distance_max = 0;
    for(long long ys = 0; ys < h; ys++){
        for(long long xs = 0; xs < w; xs++){
            for(long long yg = 0; yg < h; yg++){
                for(long long xg = 0; xg < w; xg++){
                    if(ys == yg and xs == xg){
                        continue;
                    }
                    if(maze[ys][xs] == '#' || maze[yg][xg] == '#'){
                        continue;
                    }
                    queue<pair<long long, long long> > q;
                    vector<vector<long long> > distance(h, vector<long long>(w, -1));

                    q.push(make_pair(ys, xs));
                    distance[ys][xs] = 0;

                    while(!q.empty()){
                        pair<long long, long long> top;
                        top = q.front();
                        q.pop();

                        if(top.first+1 < h and distance[top.first+1][top.second] == -1 and maze[top.first+1][top.second] == '.'){
                            distance[top.first+1][top.second] = distance[top.first][top.second] +1;
                            q.push(make_pair(top.first+1, top.second));
                        }
                        if(top.first-1 >= 0 and distance[top.first-1][top.second] == -1 and maze[top.first-1][top.second] == '.'){
                            distance[top.first-1][top.second] = distance[top.first][top.second] +1;
                            q.push(make_pair(top.first-1, top.second));
                        }
                        if(top.second+1 < w and distance[top.first][top.second+1] == -1 and maze[top.first][top.second+1] == '.'){
                            distance[top.first][top.second+1] = distance[top.first][top.second] +1;
                            q.push(make_pair(top.first, top.second+1));
                        }
                        if(top.second-1 >= 0 and distance[top.first][top.second-1] == -1 and maze[top.first][top.second-1] == '.'){
                            distance[top.first][top.second-1] = distance[top.first][top.second] +1;
                            q.push(make_pair(top.first, top.second-1));
                        }
                    }
                    distance_max = max(distance_max, distance[yg][xg]);
                    
                }
            }
        }
    }

    cout << distance_max << endl;

    return 0;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main(){
	int64_t N, K;
	cin >> N >> K;

	if(K == 0){
		cout << N*N << endl;
		return 0;
	}

	int64_t n = N - K, add, tmp, t;
	int64_t count = n*(n+1)/2;

	for(int i = K+1; i <= N; i++){
		t = N + 1 - i;
		add = (t/i) * (i - K);
		tmp = t%i - K;
		if(tmp > 0) add += tmp;
		count += add;
	}

	cout << count << endl;;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {

	int N, K; cin >> N >> K;
	vector<int> nums(26);
	for (int i = 0; i < 26; ++i)nums[i] = 0;
	for (int i = 0; i < N; ++i) {

		string st; cin >> st;
		nums[st[0] - 'A']++;
	}
	int ans = 0;
	while (1) {
		sort(nums.begin(), nums.end(), greater<int>());
		bool ok = true;
		for (int i = 0; i <K; ++i) {
			if (nums[i])nums[i]--;
			else ok = false;
		}
		if (ok)ans++;
		else break;

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

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

int main()
{
  string s;
  cin >> s;
  i64 l = 0, r = s.size() - 1;
  i64 ans = 0;
  while (0 < r - l)
  {
    if (s[l] == s[r])
    {
      l++;
      r--;
    }
    else if (s[l] == 'x')
    {
      l++;
      ans++;
    }
    else if (s[r] == 'x')
    {
      r--;
      ans++;
    }
    else
    {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef pair <int, int> pii;

const int maxn = 100001;

int n,a,q,w,e,s;

void input();
void solve();

int main(){
	input();
	solve();
	
	return 0;
}
void input(){
	cin>>n;
	for (int i=0;i<n;i++){
		cin>>a;
		if (a%4==0){
			q++;
		}
		else{
			if (a%2==0){
				w++;
			}
			else{
				e++;
			}
		}
		s++;
	}
	
}
void solve(){
	if (w>0){
		e++;
	}
	while(q>=2 and e>=2){
		q-=2;
		e-=2;
	}
	e--;
	if (e>q){
		cout<<"No";
	}
	else{
		cout<<"Yes";
	}
}

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

int main(){
  int n;
  cin >> n;
  int b[n];
  for(int i = 0;i < n-1;i++) cin >> b[i];
  int a[n+1] = {0};
  a[0] = b[0];
  a[n-1] = b[n-2];
  int sum = a[0] + a[n-1];
  for(int i = 1;i < n-1;i++){
    a[i] = min(b[i-1],b[i]);
    sum += a[i];
  }
  cout << sum << endl;
  
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
long long digits(long long n){
    long long result = 0;
    while(n > 0) {
        result++;
        n /= 10;
    }
    return result;
}
int main(){
ll n;
cin >> n;
vector<vector<ll>> num(10, vector<ll>(10, 0));
for (ll i = 1; i <= n;i++){
    ll bottom = i % 10;
    ll top = i / pow(10,digits(i)-1);
    num[top][bottom]++;
}
ll ans = 0;
for (ll i = 1; i < 10; i++) {
    for (ll j = 1; j < 10;j++){
        ans += num[i][j] * num[j][i];
    }
}
cout << ans << endl;
}

Measured memory_bytes: 4040
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(), vec.end()
#define rever(vec) reverse(all(vec));
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>
struct edge { int to, cost; };
using P = pair<int, int>;
using PP = pair<P, int>;
using D = pair<double, double>;
const int mod2 = 998244353;
const int mod = (int)1e9 + 7, inf = (int)1e16;

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

int fact[1000000];
void f_init(int n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= n; ++i) {
		fact[i] *= fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

int comb(int n, int r) {
	if (n < r) return 0;
	int ans = fact[n] * modpow(fact[n - r], mod - 2) % mod * modpow(fact[r], mod - 2);
	if (ans < 0) return ans + mod;
	return ans;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	int ans= fact[n] * modpow(fact[n - r], mod - 2) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

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

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

bool pri(int p) {
	for (int i = 2; i * i <= p; ++i) if (p % i == 0) return false;
	return p > 1;
}

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

P operator+(const P& a, const P& b) {
	return P(a.first + b.first, a.second + b.second);
}
P operator-(const P& a, const P& b) {
	return P(a.first - b.first, a.second - b.second);
}

class unionfind {
private:
	int par[200010], rankth[200010], sizeth[200020];
public:
	void init(int n) {
		rep(i, n) {
			par[i] = i;
			rankth[i] = 0;
			sizeth[i] = 1;
		}
	}
	int root(int x) {
		while (par[x] != x) {
			x = par[x] = par[par[x]];
		}
		return x;
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) return;
		if (rankth[x] < rankth[y]) {
			par[x] = y;
			sizeth[y] += sizeth[x];
		}
		else {
			par[y] = x;
			if (rankth[x] == rankth[y]) rankth[x]++;
			sizeth[x] += sizeth[y];
		}
	}
};

string s, t;
int n, m;
bool can(string a) {
	rep(i, m) {
		if (a[i] == '?') continue;
		if (a[i] != t[i]) return false;
	}
	return true;
}
signed main() {
	cin >> s >> t;
	n = s.size(), m = t.size();
	Rep(i, n - m) {
		if (can(s.substr(i, m))) {
			rep(j, i) {
				if (s[j] == '?') printf("a");
				else printf("%c", s[j]);
			}
			rep(j, m) printf("%c", t[j]);
			for (int j = i + m; j < n; j++) {
				if (s[j] == '?') printf("a");
				else printf("%c", s[j]);
			}
			cend;
			return 0;
		}
	}
	printf("UNRESTORABLE\n");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair< int, int > Pi;
typedef pair< int, Pi > Pii;

const int INF = 1 << 30;

int n;
vector< int > data[2];

string Dijkstra(){
  priority_queue< Pii, vector< Pii >, greater< Pii > > que;
  int min_cost[2][101];
  fill_n( *min_cost, 2 * 101, INF);

  //Pii(ジャンプの回数, Pi( Aビル or Bビル, 高さ))

  que.push( Pii( 0, Pi( 0, 0)));
  que.push( Pii( 0, Pi( 1, 0)));


  while(!que.empty()){
    Pii p = que.top(); que.pop();
    int cost = p.first, bill = p.second.first, height = p.second.second;
    if(height == n - 1){
      stringstream sss;
      sss << cost;
      return sss.str();
    }
    if(cost > min_cost[bill][height]) continue;

    // ジャンプする
    bool next_bill = !bill;
    int next_cost = cost + 1;
    for(int i = height; i < height + 3 && i < n; i++){
      int next_height = i;
      while(data[next_bill][next_height] == 2){
        next_height--;
      }
      if(next_cost < min_cost[next_bill][next_height]){
        que.push( Pii( next_cost, Pi( next_bill, next_height)));
        min_cost[next_bill][next_height] = next_cost;
      }
    }

    // ジャンプしないではしごがあったらのぼる
    for(int i = height; i < n && data[bill][i] == 1; i++){
      if(cost < min_cost[bill][i]){
        que.push( Pii( cost, Pi( bill, i)));
        min_cost[bill][i] = cost;
      }
    }
  }
  return "NA";
}

int main(){
  while(cin >> n, n){
    data[0].resize(n);
    data[1].resize(n);

    for(int i = 0; i < n; i++){
      cin >> data[0][i];
    }
    for(int i = 0; i < n; i++){
      cin >> data[1][i];
    }
    cout << Dijkstra() << endl;
  }
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long prime = 1000000007;
    string s;
    cin >> s;
    int n = (int) s.size();
    vector<vector<long long>> count_mod(n+1, vector<long long>(13, 0));
    count_mod[n][0] = 1;
    int multiplier = 1;
    for (int i = n-1; i >= 0; --i) {
        vector<int> digits;
        if (s[i] == '?') {
            for (int k = 0; k < 10; ++k) {
                digits.push_back((multiplier * k) % 13);
            }
        } else {
            digits.push_back(((s[i] - '0') * multiplier) % 13);
        }
        for (int k = 0; k < 13; ++k) {
            for (int digit : digits) {
                count_mod[i][k] = (count_mod[i][k] + count_mod[i+1][(k + 13 - digit) % 13]) % prime;
            }
        }
        multiplier = (multiplier * 10) % 13;
    }
    cout << count_mod[0][5] << endl;
    return 0;
}


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

typedef long long ll;
int main() {
    int n;
    ll v;
    cin >> n >> v;
    vector<ll> a(n), b(n), c(n), d(n);
    
    for (int i = 0; i < n; i ++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i ++) {
        cin >> b[i];
    }
    for (int i = 0; i < n; i ++) {
        cin >> c[i];
    }
    for (int i = 0; i < n; i ++) {
        cin >> d[i];
    }
    
    vector<ll> ab(n * n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            ab[i * n + j] = a[i] + b[j];
        }
    }
    
    sort(ab.begin(), ab.end());
    
    ll count = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            ll sum = c[i] + d[j];
            count += upper_bound(ab.begin(), ab.end(), v - sum) - 
                    lower_bound(ab.begin(), ab.end(), v - sum);
        }
    }
    
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 10748
#include <bits/stdc++.h>
using namespace std;
int GCD(int a, int b){
    int c=min(a,b), d=max(a,b);
    if(d%c==0)return c;
    return GCD(c, d%c);}

int main(){
    int n;cin>>n;
    vector<int> a(n);for(int i=0;i<n;i++)cin>>a[i];
    sort(a.begin(),a.end());
    if(a[0]==a[n-1]){cout<<a[0]<<endl;return 0;}
    if(a.size()==3){cout<<max({GCD(a[0],a[1]),GCD(a[1],a[2]),GCD(a[2],a[0])})<<endl;return 0;}
    int bef=a[0],aft=a[n-1];
    int s=0,g=n;
    while(s+1<g){
        for(int i=s;i<(g-s)/2;i++)bef=GCD(bef,a[i]);
        for(int i=(g-s)/2;i<(g-s);i++)aft=GCD(aft,a[i]);
        if(bef==aft)s=g;
        if(bef>aft){
            aft=bef;
            s=s+(g-s)/2;
        }
        if(bef<aft){
            bef=aft;
            g=s+(g-s)/2;
        }
    }
    cout<<bef<<endl;
    return 0;
}

Measured memory_bytes: 640
mod = 10**9+7
N = int(input())
A = list(map(int, input().split()))
mx = max(A)
d = {i:0 for i in range(len(str(bin(mx)))-2)}
for a in A:
  for i in range(len(str(bin(a)))-2):
    if (a>>i)&1:
      d[i] += 1

ans = 0
for k, v in d.items():
  ans += v*(N-v) * (2**k)
  ans %= mod
print(ans)

Measured memory_bytes: 122808
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    double xp0, xp1, yp0, yp1;
    int q;
    double[] xp2, yp2;
    int i;
    double s1x, s1y, s2x, s2y, s;

    xp0 = sc.nextDouble();
    yp0 = sc.nextDouble();
    xp1 = sc.nextDouble();
    yp1 = sc.nextDouble();
    q = sc.nextInt();
    xp2 = new double[q];
    yp2 = new double[q];

    s1x = xp1 - xp0;
    s1y = yp1 - yp0;

    for(i = 0;i < q;i++){
      xp2[i] = sc.nextDouble();
      yp2[i] = sc.nextDouble();
      s2x = xp2[i] - xp0;
      s2y = yp2[i] - yp0;

      s = s1x * s2y - s1y * s2x;

      if(s > 0){
        System.out.println("COUNTER_CLOCKWISE");
      }else if(s < 0){
        System.out.println("CLOCKWISE");
      }else{
        if(s1x * s2x < 0 || s1y * s2y < 0){
          System.out.println("ONLINE_BACK");
        }else{
          if(((s1x * s1x) + (s1y * s1y)) < ((s2x * s2x) + (s2y * s2y))){
            System.out.println("ONLINE_FRONT");
          }else{
            System.out.println("ON_SEGMENT");
          }
        }
      }
    }
    sc.close();


  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

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

int main(){
  long long n; cin >> n;
  long long ans = 2*(n/11);
  long long res = n - ans*11/2;
  if(0 < res && res <= 6) ans++;
  else if(res > 6) ans += 2;
  cout << ans << endl;
}


Measured memory_bytes: 256
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto di = readln.split.map!(to!int).array;
  auto si = readln.chomp;

  auto dice = new Dice(di);

  foreach (c; si)
    dice.roll(c);

  writeln(dice.top);
}

class Dice
{
  int[] di;

  this(int[] di)
  {
    this.di = di;
  }

  int top() { return di[0]; }

  void roll(char d)
  {
    auto rolled = ['N': [1, 5, 2, 3, 0, 4],
                   'E': [3, 1, 0, 5, 4, 2],
                   'S': [4, 0, 2, 3, 5, 1],
                   'W': [2, 1, 5, 0, 4, 3]];

    di = di.indexed(rolled[d]).array;
  }
}

Measured memory_bytes: 2504
#include <stdio.h>
int main()
{
	int S, a,b,c,d;
	scanf("%d", &S);
	d = S%10;
	c = (S%100 - d)/10;
	b = (S%1000 - 10*c - d)/100;
	a = (S%10000 - 100*b - 10*c -b)/1000;
	if(a==b||b==c||c==d)
		printf("Bad\n");
	else
		printf("Good\n");
	return 0;
}


Measured memory_bytes: 128
s=list(input())

s.sort()

n=len(s)

c=1
f=1
now=s[0]

for i in range(1,n):
    if now==s[i]:
        c+=1
    else:
        if c%2==1:
            f=-1
        c=1
        now=s[i]
else:
    if c%2==1:
        f=-1

if f<0:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
string s,s1;
int idz,ida;
int main() {
	cin>>s;
	for(int i=0;i<s.size();++i){
	if(s[i]=='A'){ida=i;break;}}
	for(int i=0;i<s.size();++i)
	if(s[i]=='Z')idz=i;
	for(int i=ida;i<=idz;++i)
	s1.push_back(s[i]);
	cout<<s1.size()<<endl;
	return 0;
}

Measured memory_bytes: 776
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)

// This problem is similar to probability recurrence formula

int main(){
    int N;
    cin >> N;
    long A[N], dp[2][N + 1];
    Fp(i, 0, N) cin >> A[i];
    dp[0][0] = 0;
    dp[1][0] = -1e+9;
    Fp(i, 1, N){
        dp[0][i] = max((dp[0][i - 1] + A[i - 1]), (dp[1][i - 1] - A[i - 1]));
        dp[1][i] = max((dp[0][i - 1] - A[i - 1]), (dp[1][i - 1] + A[i - 1]));
    }
    dp[0][N] = dp[0][N - 1] + A[N - 1];
    dp[1][N] = dp[1][N - 1] - A[N - 1];
    dp[0][N] > dp[1][N] ? cout << dp[0][N] << endl : cout << dp[1][N] << endl;
}

Measured memory_bytes: 2560
import queue
WHITE = 0
GRAY = 1
BLACK = 2
INFTY = 10**16
def bfs(s, V):
    color = [[WHITE for i in range(N+1)] for j in range(3)]
    d = [[INFTY for i in range(N+1)] for j in range(3)]
    d[0][s] = 0
    q = queue.Queue()
    q.put((0, s))
    
    while not q.empty():
        dv, u = q.get()
        color[dv%3][u] = BLACK

        for v in V[u]:
            if color[(dv+1)%3][v] != BLACK and d[(dv+1)%3][v] == INFTY:
                d[(dv+1)%3][v] = d[dv%3][u] + 1
                q.put((d[(dv+1)%3][v], v))

    return d

N, M = map(int, input().split())
graph = [[] for i in range(N+1)]
for i in range(M):
    u, v = map(int, input().split())
    graph[u].append(v)
S, T = map(int, input().split())
d = bfs(S, graph)
if d[0][T] == INFTY:
    print(-1)
else:
    print(d[0][T]//3)


Measured memory_bytes: 77212
n = int(input())
a = list(sorted(list(map(int,input().split()))))
b = list(sorted(list(map(int,input().split()))))
c = list(sorted(list(map(int,input().split()))))
 
def bs_left(ls,target):
    low, high = 0, len(ls)
    while low < high:
        mid = (low+high) // 2
        if ls[mid] < target:
            low = mid + 1
        else:
            high = mid
    return low
 
def bs_right(ls,target):
    low, high = 0, len(ls)
    while low < high:
        mid = (low+high) // 2
        if target < ls[mid]:
            high = mid
        else:
            low = mid + 1
    return low
 
ans = 0
for i in b:
    ans += (bs_left(a,i)*(n-bs_right(c,i)))
 
print(ans)

Measured memory_bytes: 23456
#include <cstdio>
#include <iostream>
using namespace std;
int prime[1000005];
bool is_prime[1000005];
int seve(int n)
{
    int p=0;
    for(int i=0;i<=n;i++)
        is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    for(int i=2;i<=n;i++)
    {
        if(is_prime[i])
        {
            prime[p++]=i;
            for(int j=2*i;j<=n;j+=i)
                is_prime[j]=false;
        }
    }
    return p;
}
int main(void)
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        printf("%d\n",seve(n));
    }
    return 0;
}


Measured memory_bytes: 4432
#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++)
using ll = long long;
using vec = vector<ll>;
using vec2 = vector<vector<ll>>;
ll inf = pow(2, 62);

int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int i = 0;
    while (a >= b)
    {
        b = b * 2;
        i++;
    }
    int j = 0;
    while (b >= c)
    {
        c = c * 2;
        j++;
    }
    if (i + j <= k)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a,b,k;
	cin>>a>>b>>k;
	vector<int> ans;
	for(int i=1; i<=100; ++i){
		if( a % i == 0 and b % i == 0){
			ans.push_back(i);
		}
	}
	k--;
	cout<<ans[ans.size()-k-1]<<endl;
	return 0;
}


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

void input(vector<vector<char> > &arr,int n,int m)
{
	for(int i=0;i<n;i++)
	{
		vector<char> temp;
		for(int j=0;j<m;j++)
		{
			char x;
			cin>>x;
			temp.push_back(x);
		}
		arr.push_back(temp);
		temp.clear();
	}
}
int main()
{
	int n,m;
	cin>>n>>m;
	vector<vector<char> >arr;
	input(arr,n,m);
	vector<vector<long long int> >dp(n,vector<long long int>(m,0));
	bool flag=true;
	for(int i=1;i<n;i++)
	{
		if(arr[i][0]=='.' && flag){
		   dp[i][0]=1;
		   }
		   else
		   {
		   	flag=false;
		   }
		
	}	  
	flag=true; 
	for(int i=1;i<m;i++)
	{
		if(arr[0][i]=='.' && flag)
		   dp[0][i]=1;
		else
		  flag=false;
	}
	for(int i=1;i<n;i++)
	{
		for(int j=1;j<m;j++)
		{
			if(arr[i][j]=='.')
			{
				dp[i][j]=(dp[i-1][j]+dp[i][j-1])%M;
			}
		}
	}
//	for(int i=0;i<n;i++){
//	   for(int j=0;j<m;j++)
//	      cout<<dp[i][j]<<" ";
//	    cout<<"\n";
//	}
	cout<<dp[n-1][m-1]<<"\n";
}


Measured memory_bytes: 9088
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int K = in.nextInt();
            int S = in.nextInt();

            long count = 0;
            for (int X = 0; X <= K; X++) {
                for (int Y = 0; Y <= K; Y++) {
                    int Z = S - (X + Y);
                    if (0 <= Z && Z <= K) {
                        count++;
                    }
                }
            }
            out.println(count);
        }

    }
}



Measured memory_bytes: 21204
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    a, b, k = [int(x) for x in input().split()]
    ans = set()

    for x in range(a, min(a+k, b)):
        ans.add(x)
    for x in range(max(a, b-k+1),b+1):
        ans.add(x)
        
    ans = list(ans)
    ans.sort()
    for e in ans:
        print(e)
    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()




"""

4
1 2
2 4
1 3
3
2 2 4
4 5 6

6
1 2
2 3
3 4
4 5
4 6
3
3 5 6
2 17 31 5 11

"""





Measured memory_bytes: 9404
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
//#define int long long
#define INF 1000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod
#define AddMult(x, y, z) x = (x + (y) * (z)) % mod



signed main(){

    string s; cin >> s;
    int n = SZ(s);
    vec dp(bit(26), INF);
    dp[0] = 0;
    int tmp = 0;
    REP(i, n){
        tmp ^= bit(s[i] - 'a');
        int m = INF;
        REP(k, 26) Min(m, dp[tmp ^ bit(k)]);
        if(m < dp[tmp]) dp[tmp] = m + 1;
        else if(i == n - 1) dp[tmp]++;
    }

    cout << dp[tmp] << endl;

    return 0;
}


Measured memory_bytes: 262736
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int n;
  cin>>n;
  vector<int> A;
  int m=0;
  rep(i,n){
    int a;
    cin>>a;
    A.push_back(a);
    m=max(m,a);
  }
  int r=0;
  if(n%2==0){
    rep(i,n){
      if(abs(A[i]-m/2)<abs(r-m/2)){
        r=A[i];
      }
    }
  }
  else{
    rep(i,n){
      int x=min(abs(m/2+1-A[i]),abs(m/2-A[i]));
      int y=min(abs(m/2+1-r),abs(m/2-r));
      //cout<<A[i]<<":"<<x<<" "<<r<<":"<<y<<endl;
      if(x<y) r=A[i];
    }
  }
  cout<<m<<" "<<r<<endl;
  return 0;
}

Measured memory_bytes: 892