akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize "-O3"
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define twoll pair<ll,ll>
#define four pair<two,two>
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define y1 y1922
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (int)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
#define FAST std::ios::sync_with_stdio(false)
#define xRand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rnd rng
#define IT iterator
typedef
tree<
  int,// aq pair<int,int> shegidzlia
  null_type,
  less/*_equal*/<int>,// aqac
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;
// '_equal' mashin ginda roca multiset gchirdeba
template<class key, class value,class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
ordered_map<int, int> my_map;
inline int rin(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
inline int bin(){
	int x=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}
int fen[400005], mas[400005], val[400005];
void modify(int pos)
{
	for (; pos < 400005; pos += pos & -pos)
		fen[pos]++;
}
int query(int pos)
{
	int Sum = 0;
	for (; pos; pos -= pos & -pos)
		Sum += fen[pos];
	return Sum;
}
int n;
int main(){FAST;xRand;
cin>>n;
for (int i = 0; i < n; i++)
	cin>>mas[i];
int l = 0, r = 1e9, ans = 0;
while (l <= r){
	memset(fen, 0, sizeof(fen));
	int m = l + r >> 1;
	ll sum = 0;
	modify(n + 1);
	for (int i = 0; i < n; i++){
		val[i] = (i ? val[i - 1] : 0) + (mas[i] >= m ? 1 : -1);
		sum += query(val[i] + n + 1);
		modify(val[i] + n + 1);
	}
	if (sum >= (ll)n * (n + 1) / 2 - sum){
		ans = m;
		l = m + 1;
	}
	else
		r = m - 1;
}
cout<<ans<<endl;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/



Measured memory_bytes: 3712
n,k=map(int,input().split())
s=input()
d=[]

if s[0] == "0":
  zero=True
  iti=False
else:
  iti=True
  zero=False

count=0
for i in range(0,len(s)):
  if zero and s[i]=="0":
    count+=1
  elif zero and s[i]=="1":
    d.append(count)
    iti=True
    zero=False
    count=1
  elif iti and s[i]=="0":
    d.append(count)
    zero=True
    iti=False
    count=1
  elif iti and s[i]=="1":
    count+=1
d.append(count)
d.append(0)
import itertools
acum = list(itertools.accumulate([0]+d))
#print(d)
#print(acum)
hantei=0
ans=0
if s[0]=="0":
  ks1=min(k*2,len(d))
  ks2=min(k*2+1,len(d))
else:
  ks1=min(k*2+1,len(d))
  ks2=min(k*2,len(d))
  
for i in range(0,len(d)-ks1+1,2):
  ans=max(acum[i+(ks1)]-acum[i],ans)
for i in range(1,len(d)-ks2+1,2):
  ans=max(acum[i+(ks2)]-acum[i],ans)
print(ans)
    

Measured memory_bytes: 14632
S = input()
K = int(input())

REPLACED = '_'


def get_start(s):
    i = 1
    while i < len(s):
        if s[0] != s[i]:
            break
        i += 1
    return s[:i]


def replace(s):
    characters = list(s)
    s_length = len(s)
    s_types = len(set(s))

    if s_length == s_types:
        return s

    start = get_start(s)
    if len(start) == 1:
        pass
    elif len(start) % 2 == 0:
        for i in range(0, len(start), 2):
            characters[i] = REPLACED
    else:
        for i in range(1, len(start), 2):
            characters[i] = REPLACED

    i = 0
    while i < s_length - 1:
        chunk = characters[i:i + 3]

        if REPLACED in chunk:
            i += 1
            continue

        chunk_length = len(chunk)
        chunk_types = len(set(chunk))
        if chunk_length == 1:
            break
        elif chunk_length == 2:
            if chunk_types == 2:
                break
            else:
                characters[i + 1] = REPLACED
                break
        elif chunk_length == 3:
            if chunk_types == 3:
                i += 2
                continue
            elif chunk_types == 2:
                if chunk[0] == chunk[1]:
                    characters[i] = REPLACED
                    i += 2
                    continue
                elif chunk[1] == chunk[2]:
                    characters[i + 2] = REPLACED
                    i += 3
                    continue
                else:
                    i += 2
                    continue
            else:
                characters[i + 1] = REPLACED
                i += 2
                continue
        else:
            raise Exception

    return ''.join(characters)


def check(s, k):
    s_length = len(s)
    s_types = len(set(s))
    if (s_types == 1) or (s_length == 1):
        return s_length * k // 2
    elif s_types == s_length:
        return 0
    else:
        replaced_s = replace(s)
        replaced_count = replaced_s.count(REPLACED)
        if replaced_s[0] == replaced_s[-1] and replaced_s[0] != REPLACED:
            return (replaced_count * k) + (k - 1)
        else:
            return replaced_count * k


print(check(S, K))


Measured memory_bytes: 3192
#include <stdio.h>
#include <stdbool.h>

#define NUM_BALL 10

int main(void)
{
  int		n;
  int		num;
  int		left, right;
  bool	flag = true;
  int 	i, j;

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
		left = right = -1;
		for (j = 0; j < NUM_BALL; j++) {
			scanf("%d", &num);
			if      (num > left)	{ left  = num; }
			else if (num > right)	{ right = num; }
			else									{ flag  = false; break; }
		}
		puts((flag) ? "YES" : "NO");
	}

	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>


#define fs first
#define sc second

using namespace std;

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


int main(){
    int a, b;
    cin >> a >> b;

    cout << max(0, a - b*2) << endl;

    return 0;
}


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

using namespace std;

int main()
{
    int a, b, c, d, e, na, nb, nc;
    while (cin >> a >> b >> c >> d >> e, a) {
        cin >> na >> nb >> nc;
        int cost = 0;
        if (nc >= d) {
            cost += nc * e;
            nc = 0;
        }

        if (na + nb + nc >= d) {
            int T = d - nc, j = 0, k = 0;
            
            while (j < nb && T > 0) {
                T--; j++;
            }

            while (k < na && T > 0) {
                T--; k++;
            }
            
            int t = a * na + b * nb + c * nc;
            int t2 = (k + j + nc) * e + a * (na - k) + b * (nb - j);            
            cost += min(t, t2);
        } else {
            int t = a * na + b * nb + c * nc;
            int t2 = d * e;
            cost += min(t, t2);
        }
        cout << cost << endl;
    }
    return 0;
}

Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include <string>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <bitset>

using namespace std;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

typedef long long ll;
typedef long double ld;

const ll SIZE = 1e6 + 10, MOD = 1e9 + 7;

vector<ll> vec;
bitset<5002> bits, sv;
bitset<5002> suf[5002], tree[5002 * 4];
vector<ll> psh[5002 * 4];

ll cnt = 0;

ll n, k;
void visit(int v, int l, int r) {
    tree[v] = bits;
    for (auto cur : psh[v]) {
        bits |= (bits << cur);
    }
    if (l == r - 1) {
        bool flag = false;
        for (int j = k - 1; j >= 0; j--) {
            if (bits[j] && (vec[l] + j >= k)) {
                flag = true;
            }
        }

        cnt += !flag;
    }
    else {
        int mid = (l + r) / 2;
        visit(v * 2 + 1, l, mid);
        visit(v * 2 + 2, mid, r);

    }
    bits = tree[v];
}

void add(int v, int l, int r, int askl, int askr, int val) {
    if (l >= askr || r <= askl) return;

    if (l >= askl && r <= askr) {
        psh[v].push_back(val);
        return;
    }

    int mid = (l + r) / 2;
    add(v * 2 + 1, l, mid, askl, askr, val);
    add(v * 2 + 2, mid, r, askl, askr, val);
}

int main() {
    fastInp;

    cin >> n >> k;
    vec.resize(n);
    for (int i = 0; i < n; i++) cin >> vec[i];

    for (int i = 0; i < n; i++) {
        if (vec[i] < k) {
            if (i != 0) add(0, 0, n, 0, i, vec[i]);
            if (i != n - 1) add(0, 0, n, i + 1, n, vec[i]);
        }
    }

    bits[0] = 1;
    
    visit(0, 0, n);
    cout << cnt;
    return 0;
}


Measured memory_bytes: 14544
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	// your code goes here
	int n; cin>>n;
	string s; cin>>s;
	int freq1[26] = {0}, freq2[26]={0};
	int maxCnt = 0;
	for(int i=0;i<n-1;i++){
		memset(freq1,0,sizeof(freq1));
		memset(freq2,0,sizeof(freq2));
		for(int j=0;j<=i;j++) freq1[s[j]-'a']++;
		for(int j=i+1;j<n;j++) freq2[s[j]-'a']++;
		int cnt = 0; //distinct character found in in both part
		for(int j=0;j<26;j++){
			//printf("%d %d %c %d %d\n",i,j, 'a'+j,freq1[j], freq2[j]);
			if(freq1[j] and freq2[j]) cnt++;
		}
		//printf("i = %d , cnt = %d\n",i, cnt);
		maxCnt = max(maxCnt, cnt);
	}
	printf("%d\n",maxCnt);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

typedef long long ll;

int main(){
  int n; cin >> n;
  ll a[n];
  map<ll, int> m;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }

  ll l1=0, l2=0;
  for(auto itr=--m.end(); itr!=--m.begin(); itr--){
    if(itr->second>=4){
      l1 = max(l1, itr->first);
      l2 = itr->first;
    }
    else if(itr->second>=2){
      l2 = l1;
      l1 = itr->first;
    }
    if(l1!=0 && l2!=0) break;
  }

  cout << l1*l2 << endl;
  return 0;
}


Measured memory_bytes: 7296
a,b,c=map(int,input().split())
if a==b and b==c and a%2!=1:
    print(-1)
else:
    s=a+b+c
    d=0
    j=0
    while a%2!=1 and b%2!=1 and c%2!=1:
        d+=1
        h=s
        j=a
        a=(s-a)//2
        b=j//2+c//2
        c=h-a-b
    print(d)

Measured memory_bytes: 3064
N = int(input())
S = list(input())
R = []
G = []
B = [0 for _ in range(N)]
b_cnt = 0
for i in range(N):
  if S[i] == 'R':
    R.append(i)
  elif S[i] == 'G':
    G.append(i)
  else:
    B[i] = 1
    b_cnt += 1
answer = 0
for r in R:
  for g in G:
    answer += b_cnt
    if (g-r)%2 == 0 and B[(r+g)//2] == 1:
      answer -= 1
    if 0 <= 2*g-r < N and B[2*g-r] == 1:
      answer -= 1
    if 0 <= 2*r-g < N and B[2*r-g] == 1:
      answer -= 1
print(answer)

Measured memory_bytes: 74500
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
    }
    let d0 = (1..n + 1).filter(|x| x % 2 == 0).count();
    let d1 = (1..n + 1).filter(|x| x % 2 == 1).count();
    let ans = d1 as f64 / (d0 + d1) as f64;
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>//min,max,swap,rand,reverse,sort,lower_bound
#include<functional>
#include<vector>
#include<list>
#include<map>
#include<tuple>
#include<cmath>//abs, sin, cos
#include<bitset>
using namespace std;

int main()
{
	int N, A, B;
	int up = 0;
	int rank = 1;
	string S;
	cin >> N >> A >> B;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'a' && up < (A + B)) {
			cout << "Yes" << endl;
			up++;
		}
		else if (S[i] == 'b' && up < (A + B) && rank <= B) {
			rank++;
			cout << "Yes" << endl;
			up++;
		}
		else
			cout << "No" << endl;
	}
	return 0;
}

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

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC targett("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define endl        '\n'
#define ll          long long int
#define pb          push_back
#define sz(x)       (int)(x).size()
const ll mod = 1e9 + 7;

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


ll powm(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1)
			res = (res * 1LL * a) % mod;
		b >>= 1LL;
		a = (a * 1LL * a) % mod;
	}
	return res;
}

//--------------------------------------------------------------------------------------------------------------------------//
int n, m;
string a, b, ans;

int dp[3003][3003];

void build(int i, int j) {
	if (i == 0 || j == 0)
		return;
	if (a[i - 1] == b[j - 1]) {
		ans.pb(a[i - 1]);
		build(i - 1, j - 1);
		return;
	}
	if (dp[i - 1][j] > dp[i][j - 1])
		build(i - 1, j);
	else
		build(i, j - 1);
}

int main() {
	fast
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cin >> a >> b;
	n = sz(a) , m = sz(b);

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			dp[i][j] = max(dp[i - 1][j] , dp[i][j - 1]);
			if (a[i - 1] == b[j - 1]) {
				dp[i][j] = max(dp[i - 1][j - 1] + 1, dp[i][j]);
			}
		}
	}

	build(n, m);
	reverse(ans.begin(), ans.end());
	cout << ans << endl;

	return 0;

}





Measured memory_bytes: 38788
n = gets.to_i
edges = []
(n - 1).times { edges << gets.split.map(&:to_i) }
graph = Array.new(n + 1) { Array.new }
# 無向グラフなので両始点のグラフに入れる
edges.each do |f, t|
  graph[f] << [f, t]
  graph[t] << [t, f]
end

who_reachable = Array.new(n + 1, 0)

# [from, to, who]
queue = [[1, 1, :fennec], [n, n, :snuke]]
until queue.empty?
  from, to, who = queue.shift
  graph[to].each do |f, t|
    next if t == from || (t == n && who == :fennec) || (t == 1 && who == :snuke)
    who_reachable[t] = who if who_reachable[t] == 0
    queue << [f, t, who]
  end
end

fennec_reachable = who_reachable.count(:fennec)
snuke_reachable = who_reachable.count(:snuke)
puts fennec_reachable > snuke_reachable ? "Fennec" : "Snuke"


Measured memory_bytes: 29308
from functools import lru_cache
from itertools import product

N = int(input())
T = [''.join(t) for t in product(('A','C','G','T'),repeat = 3)]

def acg(s):
    return any(['ACG' in s[:i] + s[i+1:i+2] + s[i] + s[i+2:] for i in range(len(s))])

@lru_cache(maxsize=None)
def f(N,s):
    if N == 3 and acg(s):
        return 0
    elif N == 3 and not acg(s):
        return 1
    else: 
        return sum(f(N-1, c + s[:2]) for c in ('A','C','G','T') if not acg(c + s))

ans = sum(f(N,s) for s in T)
print(ans % 1000000007)

Measured memory_bytes: 5704
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(500 * r[0] >= r[1] ? "Yes" : "No");
        }
        
    }
}

Measured memory_bytes: 13396
#include<stdio.h>

int fib(int n){
  int i;
  int fib[44];

  fib[0] = 1;
  fib[1] = 1;
  
  for( i=2 ; i<=n ; i++ )
    fib[i] = fib[i-1] + fib[i-2];

  return fib[n];
}

int main(){
  int n;

  scanf("%d",&n);

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



Measured memory_bytes: 2112
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s; cin>>s;
    int n=s.size(),ans=inf;
    rep(i,n-2){
        int num=100*(s[i]-'0')+10*(s[i+1]-'0')+s[i+2]-'0';
        ans=min(ans,abs(753-num));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
/*cout <<setprecision(11)<<ret<<endl;で、数字部分を計11桁表示*/
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//Shift+Command+bでデバッグ
//その後ターミナルで./a.outを実行
//入力を貼り付ける

//////////////////
//  A
/*int main(void){
    string s;cin>>s;

    rep(i,3) cout<<s[i];
    cout<<endl;
    return 0;
}*/
//////////////////
//  B
int main(void){
    long long int a,b,v,w,t;
    cin>>a>>v>>b>>w>>t;

    if(a>b){
        if(a-v*t<=b-w*t) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }else{
        if(a+v*t>=b+w*t) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }


    return 0;
}
//////////////////
//  C
/*int main(void){

    return 0;
}*/
//////////////////
//  D
/*int main(void){

    return 0;
}*/
//////////////////
//  E
/*int main(void){

    return 0;
}*/
//////////////////
//  F
/*int main(void){

    return 0;
}*/


Measured memory_bytes: 3656
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            var s = cin.ArrayString(n);
            var m = cin.nextInt();
            var t = cin.ArrayString(m);

            var ans = 0;
            foreach (var item in s)
            {
                var tmp = 0;
                tmp += s.Count(c => c==item);
                tmp -= t.Count(c => c == item);
                ans = Math.Max(tmp, ans);
            }

            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public string[] ArrayString(int N)
        {
            string[] Array = new string[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = next();
            }
            return Array;
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


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

long long N;
double x[10];
double y[10];
double sum = 0;
double num = 0;

void dfs(long long cur, double cost, set<long long> visit){
	if(cur != -1){
		visit.insert(cur);
	}
	if(visit.size() == N){
		num++;
		sum += cost;
	}

	for(long long i = 0; i < N; i++){
		if(visit.count(i) == 0){
			double addcost = 0;
			if(cur != -1){
				addcost += sqrt(pow(x[cur] - x[i], 2) + pow(y[cur] - y[i], 2) );
			}
			dfs(i, cost + addcost, visit);
		}
	}
}

int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		cin >> x[i] >> y[i];
	}
	set<long long>visit;
	dfs(-1, 0, visit);
	printf("%.10f\n", sum/num);
}



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

int main(){
    int n,m;
    cin>>n>>m;
    
    if(n-m) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3624
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let s: Vec<char> = iterator.next().unwrap().chars().collect();
    let t: Vec<char> = iterator.next().unwrap().chars().collect();
    let mut count = 0;
    for i in 0..3 {
        if s[i] == t[i] {
            count += 1;
        }
    }
    return count.to_string();
}


Measured memory_bytes: 2124
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());

    vector<ll> v(2020, 0);
    const ll MOD = 1e9 + 7;
    ll tmp = 1;
    v[0]++;
    ll hoge = 0;
    REP(i, s.size()){
        hoge = (tmp * (s[i] - '0') + hoge) % 2019;
        v[hoge]++;
        tmp = (tmp * 10) % 2019;
    }
    ll ans = 0;
    REP(i, 2019) ans += v[i] * (v[i] - 1) / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3704
/*
ID: Motyaspr
LANG: C++11
TASK: dualpa
*/

#define _CRT_SECURE_NO_WARNINGS

// comment(linker, "/STACK:256000000")
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <ctime>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <deque>
#include <cassert>
#include <cstdlib>
#include <bitset>
#include <algorithm>
#include <string>
#include <list>
#include <fstream>
#include <cstring>
#include <climits>
#include <stack>
#include <random>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define forn(i, n) for(int i = 0; i < n; i++)
#define pk push_back
#define mk make_pair
#define all(v) v.begin(), v.end()
#define X first
#define Y second
#define TASK "ufo"

const double EPS = 1e-9;
const double pi = acos(-1.0);

const int MAXN = (int)1e5 + 150;
const ll INF = (ll)1e9 + 7;
const ll LINF = (ll)1e18 + 7;
const ll MOD = (ll)1e9 + 7;;
const ll P = 31;
const ll SZ = 50000 + 228;
const int K = 10;

ll n, x[MAXN], a, b;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#else
	//freopen(TASK".in", "r", stdin), freopen(TASK".out", "w", stdout);
#endif
	srand(time(0) + 'P'	);	
	ll ans = 0;
	cin >> n; 
	cin >> a >> b;
	for (int i = 0; i < n; i++)
		cin >> x[i];
	for (int i = 1; i < n; i++)
		ans += min((x[i] - x[i - 1]) * a, b);
	cout << ans;
	return 0;
}

Measured memory_bytes: 1024
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(A[K-1])

Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x, y;
	cin >> x >> y;

	int i = 0;
	while(true) {
		ll tmp = x * pow(2, i);
		if(tmp > y) {
			cout << i << endl;
			break;
		}
		i++;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

int main(int argc, char const *argv[])
{
    int n, t;
    cin >> n >> t;

    vector<pair<int, int>> m(n);
    vector<int> a(n), b(n);
    rep(i, n)
    {

        cin >> a[i] >> b[i];
        m[i] = {a[i], b[i]};
    }
    sort(ALL(m));
    vector<vector<int>> dp(6000, vector<int>(2, 0));
    rep(i, n)
    {
        auto next = dp;
        rep(j, t + 1)
        {
            int ca = m[i].first;
            int cb = m[i].second;
            if (j - 1 >= 0)
            {
                next[j][1] = max(dp[j][1], dp[j - 1][0] + cb);
            }
            if (j - ca >= 0)
            {
                next[j][0] = max(dp[j][0], dp[j - ca][0] + cb);
            }
        }
        dp = next;

       /* rep(j, t) cerr << dp[j][0] << " ";
        cerr << endl;
        cerr << "---------" << endl;
        rep(j, t) cerr << dp[j][1] << " ";
        cerr << endl;
   */ }
       cout << dp[t][1] << endl;

       return 0;
}


Measured memory_bytes: 1008
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int main()
{
	int n; cin>>n; ll ans=0;
	for(int i=1;i<=n;i++)
	{
		ans+=n/i;
		if(n%i==0) ans--;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3632
import collections

n=int(input())
d=list(map(int,input().split()))
if d[0]!=0:
  print(0)
elif 0 in d[1:]:
  print(0)
else:
  dic=collections.Counter(d[1:])
  sorted(dic)
  p=1
  for i in range(1,len(dic)):
    p*=dic[i]**dic[i+1]
  print(p%998244353)


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, m, x, y, p, q, k;
string s, t;

// <------------- Implement Functions Here ----------> //

bool comp(pair<string,pll> &a, pair<string,pll> &b) {
	if(a.f == b.f) return a.s.f > b.s.f;
	return a.f < b.f;
}

// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	vector<pair<string,pll>> val;
	for(ll i=0;i<n;i++) {
		cin>>s>>k;
		val.pb({s,{k,i+1}});
	}

	sort(all(val),comp);

	for(ll i=0;i<n;i++) {
		cout<<val[i].s.s;newl;
	}
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3664
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)

int main() {

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

	int ans = 0;

	for (int i = a; i <= t; i += a) {
		ans += b;
	}

	cout << ans << endl;

	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

int n;
string s;
ll sum[200010];

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

  cin>>n>>s;

  rep(i,n){
    if(s[i]=='#')sum[i+1]=1;
  }
  rep(i,n)sum[i+1]+=sum[i];

  ll res=INF;
  rep(i,n+1){
    ll rb=sum[n]-sum[i];
    ll lb=sum[i];
    minch(res,lb+(n-i-rb));
  }
  cout<<res<<endl;

  return 0;
}


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

typedef long long LL;
typedef pair<int, int> II;

const int MAXN = 300 + 10;
int n, a[MAXN][MAXN], b[MAXN][MAXN];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n; ++j) {
			scanf("%d", &a[i][j]);
			b[i][j] = a[i][j];
		}
	
	for (int k = 1; k <= n; ++k)
		for (int i = 1; i <= n; ++i)
			for (int j = 1; j <= n; ++j)
				b[i][j] = min(b[i][j], b[i][k] + b[k][j]);
	for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) {
		if (a[i][j] != b[i][j]) {
			puts("-1");
			return 0;
		}
	}

	LL ans = 0;
	for (int i = 1; i <= n; ++i) for (int j = i + 1; j <= n; ++j) {
		int flag = 1;
		for (int k = 1; k <= n; ++k)
			if (k != i && k != j) flag &= a[i][k] + a[k][j] > a[i][j];
		if (flag) ans += a[i][j];
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <stack>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define dd(x) cout << #x << "=" << x << ", "
#define de(x) cout << #x << "=" << x << endl
#define ds() puts("---stop here---")
#define mset(a,i) memset(a,i,sizeof(a))
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define E 1e-6
#define INF 0x3f3f3f3f
void open(){freopen("data.txt","r",stdin);}
void out(){freopen("out.txt","w",stdout);}
const int maxn = 101010;
const int MOD = 1e9 + 7;
struct BigInteger
{
    static const int BASE = 100000000;
    static const int WIDTH = 8;
    vector<int> s;
    BigInteger(long long num = 0)
    {
        *this = num;
    }
    BigInteger operator=(long long num)
    {
        s.clear();
        do {
            s.push_back(num%BASE);
            num /= BASE;
        } while (num > 0);
        return *this;
    }
    BigInteger operator=(const string& str)
    {
        s.clear();
        int x;
        int len=(str.length() - 1)/WIDTH + 1;
        for (int i = 0;i < len;i++)
        {
            int end = str.length() - i*WIDTH;
            int start = max(0, end - WIDTH);
            sscanf(str.substr(start, end - start).c_str(), "%d", &x);
            s.push_back(x);
        }
        return *this;
    }
    BigInteger operator+(const BigInteger& b) const {
        BigInteger c;
        c.s.clear();
        for (int i = 0,g = 0;;i++)
        {
            if (g == 0 && i >= s.size() && i >= b.s.size())
                break;
            int x = g;
            if (i < s.size())
                x += s[i];
            if (i < b.s.size())
                x += b.s[i];
            c.s.push_back(x%BASE);
            g = x / BASE;
        }
        return c;
    }
};


ostream& operator << (ostream &out, const BigInteger& x)
{
    out << x.s.back();
    for (int i = x.s.size() - 2;i >= 0;i--)
    {
        char buf[20];
        sprintf(buf, "%08d", x.s[i]);
        for (int j = 0;j < strlen(buf);j++)
            out << buf[j];
    }
    return out;
}

BigInteger num[100];
int main()
{
    num[0] = BigInteger(2);
    num[1] = BigInteger(1);
    int n;
    scanf("%d",&n);
    rep(i,2,n+1) num[i] = num[i-2]+num[i-1];
    cout<<num[n];
}





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

using namespace std;
using namespace __gnu_pbds;
typedef long long LL;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> 
new_data_set;
const LL MOD = 1000003;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	cout << max(0, C - (A - B)) << "\n";	
}

Measured memory_bytes: 256
a,b = input().split()
a = int(a)
b0 = int(b[0])
b1 = int(b[2])
b2 = int(b[3])
r = str(a*100*b0 + a*10*b1 + a*b2)
if len(r) < 3:
    print(0)
else:
    print(r[:-2])

Measured memory_bytes: 9192
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
using namespace std;
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;
}
int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    ll answer = 0;
    if ((B - A) % 2 == 0) {
        ll a = (B + A) / 2;
        cout << a - A << endl;
        return 0;
    } else {
        if (N - B <= A - 1) { // Bのほうが近い
            while(true) {
                ++A;
                ++B;
                ++answer;
                if (B == N) {
                    ++A;
                    ++answer;
                    if (A == B) {
                        cout << answer << endl;
                        return 0;
                    }

                    if ((B - A) % 2 == 0) {
                        ll a = (B + A) / 2;
                        cout << (a - A) + answer << endl;
                        return 0;
                    } else {
                        ++A;
                        ++B;
                        ++answer;
                    }
                }
            }
        } else { // Aが近い
            while(true) {
                --A;
                --B;
                ++answer;
                if (A == 1) {
                    --B;
                    ++answer;
                    if (A == B) {
                        cout << answer << endl;
                        return 0;
                    }

                    if ((B - A) % 2 == 0) {
                        ll a = (B + A) / 2;
                        cout << (a - A) + answer << endl;
                        return 0;
                    } else {
                        --A;
                        --B;
                        ++answer;
                    }
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, A, B, *X = map(int, read().split())

    ans = 0
    for i in range(N - 1):
        if A * (X[i + 1] - X[i]) < B:
            ans += A * (X[i + 1] - X[i])
        else:
            ans += B

    print(ans)
    return


if __name__ == '__main__':
    main()


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

using ll=long long;
const ll MOD=1e9+7;

class BIT{
    int N;
    vector<ll> dat;
    public:
    BIT(int N):N(N),dat(N,0LL){};
    void update(int pos,ll x){
        pos++;
        while(pos<=N){
            dat[pos-1]=(dat[pos-1]+x)%MOD;
            pos+=pos&-pos;
        }
    }
    ll query(int pos){
        ll res=0;
        while(pos>0){
            res+=dat[pos-1];            
            res%=MOD;
            pos-=pos&-pos;
        }
        return res;
    }
    ll query(int l,int r){
        return ((query(r)-query(l))%MOD+MOD)%MOD;
    }
};


void setVal(int pos,ll v,vector<ll> &dp,BIT &bit){
    dp[pos]=v;
    bit.update(pos,v);
}
int main(){
    int N;
    cin>>N;
    ll A,B;
    cin>>A>>B;
    vector<ll> S(N+2);
    S[0]=S[1]=-max(A,B);
    for(int i=0;i<N;i++){
        cin>>S[i+2];
    }
    N+=2;
    BIT bitX(N);
    BIT bitY(N);
    vector<ll> dpX(N,0);
    vector<ll> dpY(N,0);
    setVal(0,1,dpX,bitX);
    int idxX=0;
    int idxY=0;
    int rx=0;
    int ry=0;
    for(int i=1;i+1<N;i++){
        while(idxX<i && S[i+1]-S[idxX]>=B){
            idxX++;
        }
        while(idxY<i && S[i+1]-S[idxY]>=A){
            idxY++;
        }
        ll bufX=ry<idxY ? bitY.query(ry,idxY): 0LL;        
        ll bufY=rx<idxX ? bitX.query(rx,idxX): 0LL;
        setVal(i,dpX[i]+bufX,dpX,bitX);
        setVal(i,dpY[i]+bufY,dpY,bitY);
        if(S[i+1]-S[i]<A){
            rx=i;
        }
        if(S[i+1]-S[i]<B){
            ry=i;
        }
    }
    ll xsum=bitX.query(rx,N);
    ll ysum=bitY.query(ry,N);
    cout<<(xsum+ysum)%MOD<<endl;
    return 0;
}

Measured memory_bytes: 4224
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var nq=arr[0].split(" ").map(Number);
var s = arr[1].split("");
var a=[0,0];
var cnt=0;
for(var i=1;i<s.length;i++){
   if(s[i]=="C" && s[i-1]=="A")cnt++;
   a.push(cnt);
}
var ans=[];
for(var i=2;i<nq[1]+2;i++){
   var lr=arr[i].split(" ");
   ans.push(a[lr[1]-0]-a[lr[0]-0]);
}
console.log(ans.join("\n"));

Measured memory_bytes: 35536
import java.io.*;
import java.util.*;
class Main{
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int n = str.length();
		String[] s = str.split("");
		int[] a = new int[s.length];

		for(int i = 0;i < s.length;i++){
			a[i] = Integer.parseInt(s[i]);
		}
		long sam = 0;
		long ans = 0;
		for(int i = 0;i < Math.pow(2, n-1);i++){
			sam = a[0];
			for(int j = 0;j < (n-1);j++){
				if(((i>>j)&1) == 1){
					ans += sam;
					sam = 0;
				}
				sam *= 10;
				sam += a[j+1];
			}
			ans += sam;
		}
		System.out.println(ans);
		
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21844
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll max(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
double max(double a, double b) {

	if (a > b)return a;
	else return b;

}
//a??¨b?????§?????????

ll min(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//a??¨b????°??????????

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//a??¨b???????????¶??????

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//p????´???°,a???b??????p??§?????£?????????

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//p????´???°,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

	}
	ll r;
	r = b%a;
	if (r == 0)return a;
	else return gcd(r, a);

}
//?????§??¬?´???°

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//????°???¬?????°

int main() {
	
	int n, x, count;

	while (1) {

		cin >> n >> x;

		if (n == 0 && x == 0)break;
		else {

			count = 0;
			for (int i = 1; i <= n - 2; i++) {

				for (int j = i + 1; j <= n - 1; j++) {

					for (int k = j + 1; k <= n; k++) {

						if (i + j + k == x)count++;

					}

				}

			}
			cout << count << endl;

		}

	}

	return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

void solve(istream &in, ostream &out) {
    vector<string> d = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

    string s;
    in >> s;

    int res = 7 - (find(d.begin(), d.end(), s) - d.begin());
    out << res << '\n';
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solve(in, out);
}


Measured memory_bytes: 256