akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli, lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout << (x ? "Yes" : "No") << endl;
#define out(s) cout << s << endl;
#define pb(s) push_back(s);
#define sp " "
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(), s.end()
void vout(vi v)
{
    for (int i = 0; i < v.size(); i++)
        cout << v.at(i) << endl;
}
int main()
{
    lli n, m;
    cin >> n >> m;
    vi rec(n, 0);
    lli ans = 0, ans2 = 0;
    vec(bool) c(n, false);
    rep(i, m)
    {
        lli p;
        string s;
        cin >> p >> s;
        p--;
        if (s == "WA")
        {
            rec[p]++;
        }
        else
        {
            if (!c[p])
            {
                ans += rec[p];
                ans2++;
                c[p] = true;
            }
        }
    }
    out(ans2 << sp << ans);
}

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

#define pb push_back
#define mp make_pair
#define all(n) (n).begin(),(n).end()
#define fi first
#define se second

typedef pair<int, int> PII;
typedef long long ll;

const int MOD = 1e9+7;
const int MAXN = 1e6+5;
int cop[MAXN][10],v[MAXN],p[MAXN];

int main() {

	ios::sync_with_stdio(0);
	cin.tie(0);
	for (int i=0;i<MAXN;++i) cop[i][0]=1;
	for (int i=2;i<=1000001;++i) {
		if (!p[i]) {
			for (int j=i;j<=1000001;j+=i) {
				cop[j][cop[j][0]++]=i;
				p[j]=1;
			}
			p[i]=0;
		}
	}
	int n,f,l;
	cin >> n;
	bool pair=true;
	cin >> l;
	f=l;
	for (int i=1;i<n;i++) {
		int a;
		cin >> a;
		f=__gcd(f,a);
		if (pair) {
			for (int i=1;i<10;++i) {
				if (cop[a][i]==0) break;
				if (v[cop[a][i]]) {
					pair = false;
					break;
				}
				v[cop[a][i]]=1;
			}
		}
	}
	if (pair) cout << "pairwise coprime\n";
	else if (f==1) cout << "setwise coprime\n";
	else cout << "not coprime\n";
}

Measured memory_bytes: 50456
#include<cstdio>
#include<algorithm>

using namespace std;

int main() {
    int n;
    int a[10000];

    int minx, maxx;
    long long int sumx = 0;

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

    sort(a, a + n);

    minx = a[0];
    maxx = a[n - 1];

    printf("%d %d %ld\n", minx, maxx, sumx);

    return 0;
}


Measured memory_bytes: 2796
import fractions

a,b,c,d = map(int, input().split())

f=fractions.gcd(c,d)
f2=c*d//f

if a%c ==0:
  c_shita=a//c
else:
  c_shita=a//c +1
  
c_num=b//c-c_shita+1

#print(c_num)  
  
if a%d ==0:
  d_shita=a//d
else:
  d_shita=a//d +1
  
d_num=b//d-d_shita+1

#print(d_num)  

if a%f2 ==0:
  f2_shita=a//f2
else:
  f2_shita=a//f2 +1
  
f2_num=b//f2-f2_shita+1

#print(f2)
#print(f2_num)  
  
ans=b-a+1 -c_num -d_num +f2_num
print(ans)





Measured memory_bytes: 66156
fn main() {
    let _ = read::<usize>();
    let ps = read_vec::<u32>();
    let mut min_p = 20000000;
    let mut count = 0;
    for p in ps {
        if min_p >= p {
            count += 1;
            min_p = p;
        }
    }
    println!("{}", count);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long> vll;
typedef pair<int, int> pi;
typedef pair<long long, long long> pll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpll;

#define F first
#define S second
#define PB push_back
#define MP make_pair

int main() {
    int r;
    cin >> r;
    cout << ((double)r * 6.28318530718) << endl;
}


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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;
typedef pair<int, int>             pii;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

struct edge{
    int from, to, w;

    edge(){}
    edge(int x, int y, int we): from(x), to(y), w(we){}

    bool operator < (const edge &rhs) const{
        return w > rhs.w;
    }

};

int main(){
    fIO
//    freopen("", "r", stdin);
//    freopen("", "w", stdout);

    int n;
    cin >> n;

    int cnt[(int)1e5 + 5] = {};
    ll sum = 0;
    for(int i = 0; i < n; i++) {
        ll a;
        cin >> a;

        cnt[a]++;
        sum += a;
    }

    int q;
    cin >> q;

    while(q--) {
        ll b, c;
        cin >> b >> c;

        sum -= b * cnt[b];
        sum += cnt[b] * c;

        cout << sum << "\n";
        cnt[c] += cnt[b];
        cnt[b] = 0;
    }
}









Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define rep(i,n) for (int64_t i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n; cin>>n;
    if(n%2==0){
        cout<<n<<endl;
        return 0;
    }
    else{
        cout<<n*2<<endl;
        return 0;
    }
}

Measured memory_bytes: 256
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, M = list(map(int, sys.stdin.buffer.readline().split()))
AB = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(N)]

AB.sort()
AB = np.array(AB, dtype=int)
cs = AB[:, 1].cumsum()
i = np.searchsorted(cs, M, side='left')
ans = (AB[:i, 0] * AB[:i, 1]).sum()
ans += (M - AB[:i, 1].sum()) * AB[i, 0]
print(ans)


Measured memory_bytes: 39104
#include "bits/stdc++.h"
using namespace std;

int main() {
	string S;
	cin >> S;
	string ansS;
	ansS += S[0];
	ansS += to_string(S.size()-2);
	ansS += S[S.size() - 1];
	cout << ansS << endl;
	return 0;
}

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

int main() {
	long long n,h,w;
	cin>>n>>h>>w;
	long long Ok=0;
	while(n--)
	{
		long long a,b;
		cin>>a>>b;
		if(a>=h&&b>=w)
		{
			Ok++;
		}
		
	}
	cout<<Ok;
	
	
}

Measured memory_bytes: 256
N = int(input())
A = [int(input()) for _ in range(N)]

if N == 2:
    print("\n".join(map(str, A[::-1])))
else:
    a = sorted(A)
    maxv1 = a[-1]
    maxi1 = A.index(maxv1)
    maxv2 = a[-2]

    print("\n".join(map(str, [maxv1 if i != maxi1 else maxv2 for i in range(N)])))


Measured memory_bytes: 27572
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long

using namespace std;

const int N=1e5+100;
int n,p[N],vis[N],cnt,flag; ll a[N],b[N],ans;
map<ll,int> mp; map<ll,bool> g;

void sieve(int n){
	rep (i,2,n){
		if (!vis[i]) vis[i]=i,p[++cnt]=i;
		for (int j=1;j<=cnt&&i*p[j]<=n;j++){
			vis[i*p[j]]=p[j];
			if (i%p[j]==0) break;
		}
	}
}

int main(){
	scanf("%d",&n); sieve(2155);
	rep (i,1,n){
		ll x; scanf("%lld",&x); a[i]=b[i]=1;
		for (int j=1;j<=cnt&&p[j]*p[j]<=x;j++)
			if (x%p[j]==0){
				int y=0;
				while (x%p[j]==0) x/=p[j],y=(y+1)%3;
				if (y==1) a[i]*=p[j],b[i]*=p[j]*p[j];
				if (y==2) a[i]*=p[j]*p[j],b[i]*=p[j];
			}
		if (x>1){
			ll sq=sqrt(x);
			if (sq*sq==x) a[i]*=x,b[i]*=sq;
			else a[i]*=x,b[i]*=x*x; //可能爆long long？
		}
		if (a[i]==1) flag=1;
	}
	rep (i,1,n) if (a[i]!=1) mp[a[i]]++;
	rep (i,1,n) if (!g.count(a[i])){
		ans+=max(mp[a[i]],mp[b[i]]);
		g[a[i]]=g[b[i]]=1;
	}
	printf("%lld\n",ans+flag);
	return 0;
}

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

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

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

        return gcd(a, b % a);
    }
}

uint64_t calc(uint64_t m, uint64_t a, uint64_t b) {
    const uint64_t c = m / a;
    const uint64_t d = m / b;
    const uint64_t e = m / (a * b / gcd(a, b));

    return m - (c + d - e);
}

int main() {
    uint64_t A, B, C, D;
    std::cin >> A >> B >> C >> D;

    std::printf("%lu\n", calc(B, C, D) - calc(A - 1, C, D));    

    return 0;
}


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

int main() {
    int n, t_point = 0, h_point = 0;
    string t_card, h_card;
    cin >> n;

    rep(i,n) {
        cin >> t_card >> h_card;
        if (t_card == h_card) { t_point++; h_point++; }
        else if (t_card > h_card) t_point += 3;
        else h_point += 3;
    }

    cout << t_point << ' ' << h_point << endl;
}


Measured memory_bytes: 3224
/*
ALDS1_2_D
*/

#include <iostream>
#include <vector>

using namespace std;

static const int MAX = 1000000;

int cnt;

void insertionSort(int A[], int n, int g) {
    for(int i = g; i < n; i++) {
        int v = A[i];
        int j = i-g;
        while( (j >= 0) && (A[j] > v) ) {
            A[j+g] = A[j];
            j = j-g;
            cnt++;
        }
        A[j+g] = v;
    }
}

void shellSort(int A[], int n) {
    cnt = 0;

    vector<int> G;

    for(int i = 1; i <= n; ) {
        G.push_back(i);
        i = 3*i + 1;
    }


    for(int i = G.size()-1; i >= 0; i--) {
        insertionSort(A, n, G[i]);
    }

    cout << G.size() << endl;
    for(int i = G.size()-1; i >= 0; i--) {
        cout << G[i];
        if(i) cout << " ";
    }
    cout << endl << cnt << endl;
}

int main() {
    int n;
    int A[MAX];

    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> A[i];
    }

    shellSort(A, n);

    for(int i = 0; i < n; i++) {
        cout << A[i] << endl;
    } 

}


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

const int M = 1e9+7;

bool chk(int n , int k) {
    while(n % k == 0) n/= k;
    if(n == 1) return 1;
    else if(n % k == 1) return 1;
    else return false;
}

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

    int n;
    cin >> n;
    vector<int> a , b;
    for(int i = 1; i*i <= n; i++) {
        if(n % i == 0) {
            if(i > 1) a.push_back(i);
            if(n /i != i) a.push_back(n/i);
        }
    }
    for(int i = 1; i*i <= (n-1); i++) {
        if((n-1) % i == 0) {
            if(i > 1) b.push_back(i);
            if((n-1)/i != i) b.push_back((n-1)/i);
        }
    }
    int ans = b.size();
    for(int i = 0; i < a.size(); i++) {
        if(chk(n , a[i])) ans++;
    }
    cout << ans << "\n";


    return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int, int> PII;
template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

/* 円周率は M_PI を使おうね */
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
int mod = 1000000007;

/*FUNCs=================================================*/
vi move1 = {0,0,1,-1};
vi move2 = {1,-1,0,0};

/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);

    string n, m; cin >> n >> m;
    cout << m << n << '\n';
}


Measured memory_bytes: 256
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back 
#define MP make_pair
typedef long long ll;
const ll INF=1<<28;
const ll LINF=1ll<<61;
int n,q,dfn[500111],dfnr[500111],dfnt;
vector<int>con[500111];
char s[500111];
int go[500111][27],g[500111];
void dfs(int x)
{
	dfn[x]=++dfnt;
	for(int i=0;i<con[x].size();i++)dfs(con[x][i]);
	dfnr[x]=dfnt;
}
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	g[n+1]=n+1;
	for(int i=n;i>=1;i--)
	{
		for(int j=0;j<26;j++)
		{
			if(s[i]=='a'+j)
			{
				go[i][j]=i+1;
			}
			else if(j>0&&go[i][j-1]!=-1)
			{
				go[i][j]=go[go[i][j-1]][j-1];
			}
			else go[i][j]=-1;
		}
		if(go[i][25]!=-1&&go[i][25]<=n&&go[go[i][25]][25]!=-1)
		{
			int nxt=go[go[i][25]][25];
			con[nxt].PB(i);
			for(int j=0;j<26;j++)
			{
				if(go[i][j]==-1)go[i][j]=go[nxt][j];
			}
		}
		else g[i]=i;
	}
	for(int i=n+1;i>=1;i--)if(!dfn[i])dfs(i);
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int l,r;
		scanf("%d%d",&l,&r);
		if(dfn[r+1]<=dfn[l]&&dfnr[r+1]>=dfn[l])puts("Yes");else puts("No");
	}
	return 0;
}

Measured memory_bytes: 96768
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace template
{
    class Program
    {
        static void Main(string[] args)
        {
            var imp = Console.ReadLine().Split(' ');
            int AB = Convert.ToInt32 (imp[0]);
            int BC = Convert.ToInt32(imp[1]);
            Console.WriteLine(AB*BC/2);
        }
    }
}

Measured memory_bytes: 11220
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <vector>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 1e9 + 7;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;
int arr[MAXN];

ll f(ll x) {
    if (x == 1) return 1;
    return 2 * f(x / 2) + 1;
}
int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    ll x;
    scanf("%lld", &x);
    printf("%lld", f(x));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int a,b[5],ans = 0;
    rep(i, 5){
        cin >> a;
        ans += a;
        b[i] = (10 - a % 10) % 10;
        ans += b[i];
    }
    qsort(b, 5, sizeof(int), desc);
    cout << ans - b[0] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
typedef long long ll;


int main()
{
	int n;
	list<int> MyList;
	string direction;
	int key;
	bool afterInit = false;

	cin >> n;
	
	rep(i, n) {
		cin >> direction;

		if (direction == "insert") {
			cin >> key;
			MyList.push_front(key);
		}
		else if (direction == "delete") {
			cin >> key;
			for (list<int>::iterator it = MyList.begin(); it != MyList.end(); it++) {
				if (*it == key) {
					MyList.erase(it);
					break;
				}
			}
		}
		else if (direction == "deleteFirst") {
			MyList.pop_front();
		}
		else if (direction == "deleteLast") {
			MyList.pop_back();
		}
		else {
			cout << "Undefined Direction!" << endl;
		}
	}

	for (list<int>::iterator it = MyList.begin(); it != MyList.end(); it++) {
		if (afterInit) cout << " ";
		else afterInit = true;
		cout << *it;
	}
	cout << endl;

	return 0;
}



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

signed main(){
	int N,two=0,four=0; cin>>N;
	for(int i=0;i<N;i++){
		int a; cin>>a;
		if(a%2==0 and a%4!=0)two++;
		else if(a%4==0)four++;
	}
	cout<<((two==0 and N-two-four-1<=four) or (two!=0 and N-two-four<=four) ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;
int INF = 1001001001;

vector<string> ss;

void build_std(int n, int k, string s)
{
	if(sz(s) == n)
	{
		ss.push_back(s);
		return;
	}
	rep(i, k)
	{
		char c = char('a'+ i);
		string next = s;
		next.push_back(c);
		build_std(n, k, next);
	}
	string next = s;
	char c = char('a'+ k);
	next.push_back(c);
	build_std(n, k + 1, next);
	return;
}

void solve()
{
	int n; cin >> n;
	build_std(n,0,"");
	rep(i ,sz(ss))cout << ss[i] << endl;
	return;
}

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


Measured memory_bytes: 7796
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

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

    const int H = 500;

    auto dp = new real[][](N+1, H+1);
    foreach (i; 0..N+1) dp[i][] = 1L << 59;
    dp[0][1] = 0;

    foreach (i; 0..N) {
        foreach (j; 1..H+1) {
            if (dp[i][j] == 1L << 59) continue;
            foreach (k; 1..H+1) {
                real hj = abs(A[i] - j);
                real hk = abs(A[i] - k);
                real v;
                if (j < A[i] && k < A[i]) {
                    v = (hj + hk) / 2.0L;
                } else if (j < A[i] && k > A[i]) {
                    real a = 1.0L * hj / (hj + hk);
                    real b = 1.0L * hk / (hj + hk);
                    v = hj * a / 2.0L + hk * b / 2.0L;
                } else if (j > A[i] && k > A[i]) {
                    v = (hj + hk) / 2.0L;
                } else if (j > A[i] && k < A[i]) {
                    real a = 1.0L * hj / (hj + hk);
                    real b = 1.0L * hk / (hj + hk);
                    v = hj * a / 2.0L + hk * b / 2.0L;
                } else {
                    v  = (hj + hk) / 2.0L;
                }
                dp[i+1][k] = min(dp[i+1][k], dp[i][j] + v);
            }
        }
    }

    writefln("%.15f", dp[N].reduce!min);
}



Measured memory_bytes: 3448
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
//#include<unordered_map>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl;
#define wa() cout<<"No"<<endl;
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;};
//
const int maxm=2e5+5;

signed main(){
    int a=re,b=re,c=re;
    swap(a,b);swap(a,c);
    pr(a);eee;
    pr(b);eee;
    pr(c);eee;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;


int main(){
    string master = "keyence";
    string s;
    cin >> s;

    int c = 0;
    for(int i = 0; i < 7; i++){
        if(master[i] == s[i]){
            c++;
        }else{
            break;
        }
    }
    for(int i = 1; i <= 7; i++){
        if(master[7-i] == s[s.size()-i]){
            c++;
        }else{
            break;
        }
    }

    if(c >= 7){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
    return 0;
}


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

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

    for (int i = 0; i < k; i++) {
        if (i % 2) {
            b /= 2;
            a += b;
        }
        else {
            a /= 2;
            b += a;
        }
        // cerr << a << " " << b << endl;
    }
    cout << a << " " << b << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(){
	
	int i,j,count=0;
	char a[27];
	
	scanf("%s",&a);
	
	for(i=0;i<strlen(a);i++){
		for(j=i+1;j<strlen(a);j++){
			if(a[i]==a[j])count=1;
		}
	}
	
	if(count==1)printf("no\n");
	else printf("yes\n");
	
	return 0;
}


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

int main() {
  int first, second;
  double average;
  cin >> first;
  cin >> second;
  
  
  average = (double)(first + second) / 2;
  if ((first + second) % 2 == 1) {
  	average += 0.5;
  }
  cout << average << endl;
}


Measured memory_bytes: 256
d=[1,'.,!? ','abc','def','ghi','jkl','mno','pqrs','tuv','wxyz'];[print(''.join(d[int(s[0])][len(s)%len(d[int(s[0])])-1]if s!=''else''for s in t))for t in[input().split('0')for _ in[0]*int(input())]]


Measured memory_bytes: 5952
N, Y = map(int, input().split())
x = y = z = -1

for i in reversed(range(N + 1)): # 10000
  for j in reversed(range(N + 1)): # 5000
    n = Y - 10000 * i - 5000 * j
    if n >= 0 and n % 1000 == 0:
      k = n // 1000
      if i + j + k == N:
        x, y, z = i, j, k
        break

print(x, y, z)

Measured memory_bytes: 9224
#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

vector<string> ds={"SUN","MON","TUE","WED","THU","FRI","SAT"};

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

  string a;
  cin>>a;
  rep(i,7){
    if(a==ds[i]){
      cout<<7-i<<endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
const int LOG = 20;
int ans[1100],ans2[1100],ans3[1100];
int main(){
      int n,m=0,l,i,j,k;
      scanf("%d",&l);
      for(i=0;i<=LOG;i++)
        if((1<<i)>l){
          n=i;
          break;
        }
      for(i=1;i<n;i++){
      	ans[++m]=i;
      	ans2[m]=i+1;
      	ans3[m]=0;
      	ans[++m]=i;
      	ans2[m]=i+1;
      	ans3[m]=1<<(i-1);
      }
      int t=1<<(n-1);
      l-=t;
      for(i=n-1;i>0;i--)
	    if((1<<(i-1))<=l){
      	ans[++m]=i;
      	ans2[m]=n;
      	ans3[m]=t;
      	t+=1<<(i-1);
      	l-=1<<(i-1);
      }
      printf("%d %d\n",n,m);
      for(i=1;i<=m;i++)
        printf("%d %d %d\n",ans[i],ans2[i],ans3[i]);
	  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        long[] input = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        long d = input[0];
        long n = input[1];
        if (d == 0)
            Console.WriteLine(n != 100 ? n : n + 1);
        else
            Console.WriteLine(n != 100 ? Math.Pow(100, d) * n : Math.Pow(100, d) * (n + 1));
    }
}

Measured memory_bytes: 13140
package main

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

const Mod = int(1e9) + 7

func main() {
	N, K := ReadInt(), ReadInt()
	a := make([][]int, N)
	for i := 0; i < N; i++ {
		a[i] = ReadInts(N)
	}

	g := Pow(a, K)
	ans := 0
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			ans += g[i][j]
			ans %= Mod
		}
	}
	fmt.Println(ans)
}

// 行列の積
func Mul(A [][]int, B [][]int) [][]int {
	C := make([][]int, len(A))
	for i := 0; i < len(A); i++ {
		C[i] = make([]int, len(B))
	}
	for i := 0; i < len(A); i++ {
		for k := 0; k < len(B); k++ {
			for j := 0; j < len(B[0]); j++ {
				C[i][j] += +A[i][k] * B[k][j]
				C[i][j] %= Mod
			}
		}
	}
	return C
}

// 行列の累乗
func Pow(A [][]int, n int) [][]int {
	B := make([][]int, len(A))
	for i := 0; i < len(A); i++ {
		B[i] = make([]int, len(A))
		B[i][i] = 1 // 単位行列にする
	}
	for n > 0 {
		if n&1 == 1 {
			B = Mul(B, A)
		}
		A = Mul(A, A)
		n >>= 1
	}
	return B
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 4664
//       Author: Mostafa Mounir Shehab
 
#include <bits/stdc++.h>
using namespace std;
 
#define PI  3.14159265  // PI = acos(-1)
#define EPS (1e-10)
#define endl "\n"
#define SZ(v) (int)(v.size())
typedef long long ll;
typedef long double ld;
//template <class Type>
 
 
void Fast(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL);
}
 
inline int D(){
	int t;
	scanf("%d",&t);
	return t;
}
inline ll llD(){
	ll t;
	scanf("%lld",&t);
	return t;
}
 
 
ll MOD=1e9 + 7;
ll OO=1e6;  
const int N=1e6 + 2;
ll arr[N];
int arr2[N];


ll n,m,k,cnt,SU,idx,len,MN,MX,T;
ll l,r,mid;
ll a,b,c,d;


int main(){
	
	cin>>n>>m;
	for(int i=0;i<m;++i)
		cin>>arr[i];
	
	for(int i=1;i<m;++i)
		cnt=max(cnt,arr[i]-arr[i-1]);
	
	cnt=max(cnt,arr[0]+n-arr[m-1]);
	
	cout<<n-cnt<<endl;
	
	
}
 
 
 
 
 
 
 
 


Measured memory_bytes: 4352
from collections import Counter

city = [list(map(int,input().split())) for _ in range(3)]

li = []

for i in range(3):
    for j in range(2):
        li.append(city[i][j])
        
c = Counter(li)

for i in range(1,5):
    if c[i] >= 3:
        print("NO")
        exit()
        
print("YES")

Measured memory_bytes: 3316
#include <cstdio>  
using namespace std;  
int main() { 	
	char a,b,c,d,e; 	
	scanf("%c%c%c", &a, &b, &c);
	if(a==b || b==c || c==a){
		printf("No");
	}
	else{
		printf("Yes");
	}
} 






Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define  ff first
#define  ss second
#define sz(a) (ll)a.size()
#define lli long long int
#define pb push_back
#define pf push_front
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;
#define M 1000000007
#define pi 3.1415926535

int main(){

fast;

ll n;
cin>>n;

ll a[n];
ll sum=0;
vector<ll> v(100001);
for(int i=0;i<n;i++){
	cin>>a[i];
	sum+=a[i];
	v[a[i]]++;
}
ll q;
cin>>q;
while(q--){
	ll b,c;
	cin>>b>>c;
	sum+=(c-b)*v[b];
	v[c]+=v[b];
	v[b]=0;
	cout<<sum<<"\n";
}

return 0;
}


Measured memory_bytes: 4728
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] t = new int [N];
        int[] a = new int [N];
        for(int i = 0;i < N;i++){
            t[i] = sc.nextInt();
            a[i] = sc.nextInt();
        }
        long A = t[0];
        long B = a[0];
        long n = 1;
        for(int i = 1;i < N;i++){
            if(t[i] < A || a[i] < B){
                //    nの値を更新 nはA,B
                if(A % t[i] == 0 && B % a[i] == 0){
                    n = Math.max(A/t[i],B/a[i]);
                }
                if(A % t[i] != 0 && B % a[i] != 0){
                    n = Math.max(A/t[i]+1,B/a[i]+1);
                }
                if(A % t[i] != 0 && B % a[i] == 0){
                    n = Math.max(A/t[i]+1,B/a[i]);
                }
                if(A % t[i] == 0 && B % a[i] != 0){
                    n = Math.max(A/t[i],B/a[i]+1);
                }
            }
            A = n*t[i];
            B = n*a[i];
            //System.out.println("n = " + n);
            //System.out.printf("A = %d B = %d\n",A,B);
        }
        System.out.println(A+B);
    }
}


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


int main(int argc, char* argv[]){
    int sunuke[100]={0};
    int n,k,d,a;
    int cnt = 0;

    cin >> n;
    cin >> k;
    for(int i=0; i<k; i++){
        cin >> d;
        for(int j=0; j<d; j++){
            cin >> a;
            sunuke[a-1]++;
        }
    }

    /*
    for(int i=0; i<n; i++){
        cout << sunuke[i] << " ";
    }
    cout << endl;
    */
    for(int i=0; i<n; i++){
        if(sunuke[i]==0) cnt++;
    }

    cout << cnt <<endl;

}

Measured memory_bytes: 3568
#include<stdio.h>
int main(void) {
	int x, y, z,i;
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	scanf("%d%d%d", &x, &y,&z);
	if (x > y) {
		i = x;
		x = y;
		y = i;
	}
	if (y > z) {
		i = y;
		y = z;
		z = i;
	}
	if (x > y) {
		i = x;
		x = y;
		y = i;
	}
	printf("%d %d %d\n", x, y, z);



	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	return 0;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h1,h2,k1,k2,a,b,c,d;
  cin>>h1>>h2>>k1>>k2>>a>>b>>c>>d;
  int ans1,ans2;
  ans1=h1*a+h2*b;
  ans2=k1*a+k2*b;
  ans1+=h1/10*c+h2/20*d;
  ans2+=k1/10*c+k2/20*d;
  if(ans1==ans2) cout<<"even"<<endl;
  else if(ans1<ans2) cout<<"kenjiro"<<endl;
  else cout<<"hiroshi"<<endl;

return 0;
}


Measured memory_bytes: 3104
#include<iostream>
#include<algorithm>
#include<deque>

using namespace std;

int main(){
    int n, num, order, d;
    deque<int> a, out;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> order;
        switch (order){
        case 0:
            cin >> d >> num;
            if(d==0) a.push_front(num); 
            else a.push_back(num);
            break;
        case 1:
            cin >> num;
            out.push_back(a[num]);
            break;
        case 2:
            cin >> d;
            if(d==1)a.pop_back();
            else a.pop_front();
            break;
        default:
            break;
        }
    }
    deque<int>::iterator it = out.begin();
    while(it!=out.end()) {
        cout << *it << endl;
        it++;
    }    
}


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

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

using ll = long long;
using namespace std;

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

    auto m = 10 - n;
    auto answer = (0 < m) ? r + 100*m : r;

    cout << answer << endl;
}


Measured memory_bytes: 256
from math import sqrt

q = int(input())
query = [tuple(map(int, input().split())) for _ in range(q)]


def sqrtfloor(x):
    s = int(sqrt(x))
    if s ** 2 == x:
        s -= 1
    return s


def solve(a, b):
    a, b = min(a, b), max(a, b)
    if a == b or a + 1 == b:
        return 2 * a - 2
    else:
        s = sqrtfloor(a * b)
        if s * (s + 1) < a * b:
            return 2 * s - 1
        else:
            return 2 * s - 2


for a, b in query:
    print(solve(a, b))


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
using namespace std;

int main(void) {
	long long int L, R;
	cin >> L >> R;

	if (R - L >= 2019)
	{
		cout << 0 << endl;
		return 0;
	}

	long long int minv = 1000000000;
	for (long long int i = L; i < R; i++)
	{
		for (long long int j = i + 1; j <= R; j++)
		{
			minv = min((i * j) % 2019, minv);
		}
	}

	cout << minv << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
input = sys.stdin.readline

N,C=map(int,input().split())
H=list(map(int,input().split()))


DP=[0]*N#コストの最小値.DP[0]=0

#i番目では,
#j番目(0<=j<i)のうちで
#DP[j]+(H[j]-H[i])**2+Cが最小になるものを取る

#展開して
#DP[j]+C+H[j]**2+H[i]**2-2*H[i]*H[j]

#つまり
#x=H[i]として,
#-2*H[j]*x+(DP[j]+H[j]**2)
#が最小になるものを求めれば良い

#DP[i]=(この最小値)+H[i]**2+C

LINES=deque()#直線を表す[a,b]でax+b
LINES.append([-2*H[0],DP[0]+H[0]**2])#h_0に関する直線

for i in range(1,N):
    while len(LINES)>1 and LINES[0][0]*H[i]+LINES[0][1]>LINES[1][0]*H[i]+LINES[1][1]:
        LINES.popleft()#単調性より,左端の直線は不要になったら削除できる
            
    DP[i]=LINES[0][0]*H[i]+LINES[0][1]+H[i]**2+C

    while True: #不要になる直線について調べ,削除する
        if len(LINES)<2:
            break
        
        a0,b0=LINES[-2]
        a1,b1=LINES[-1]
        a2,b2=-2*H[i],DP[i]+H[i]**2

        if (b0-b1)/(a0-a1)<=(b0-b2)/(a0-a2):#Hの単調性より分母は0にならない
            LINES.pop()
        else:
            break
        
    LINES.append([-2*H[i],DP[i]+H[i]**2])

print(DP[-1])

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll S; cin >> S;
  ll m = 1e9, c = ceil(sqrt(S)); 
  ll x1= min(c+1,m), y2= min(S/x1+1, m);
  ll x2= 0,y1;
  ll res= x1*y2-S;
  if (res == 0) y1 = 0;
  else {
    ll cc = ceil(sqrt(res));
    x2 = cc;
    while(res%x2 != 0) x2-=1;
    y1 = res/x2;  
  }
  printf("%d %d %lld %lld %lld %lld\n",0,0,x1,y1,x2,y2);
  return 0;
}

Measured memory_bytes: 256
s = input()
k = int(input())
n = len(s)
s_list = []
if n > k:
    for i in range(n-k+1):
        s_list.append(s[i:i+k])
else:
    s_list.append(s)
ans_list = []
for ss in s_list:
    for i in range(len(ss)+1):
        for j in range(i+1, len(ss)+1):
            t = ss[i:j]
            ans_list.append(t)
ans_list = list(set(ans_list))
ans_list.sort()
print(ans_list[k-1])

Measured memory_bytes: 7132
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define testcase ll T; cin >> T; for (ll tc = 1; tc <= T; tc++)
#define M 1000000007
#define MM 998244353
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
#define r2 1.41421356237
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod;assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  //testcase {
  int n,m;
  cin>>n>>m;
  vector<int>v(n+1,-1);
  while(m--) {
  	int c,d;
  	cin>>c>>d;
  	//if(v[p]==q || v[q]==p) { continue; }
  	while(v[c]>0) { c=v[c]; }
  	while(v[d]>0) { d=v[d]; }
  	if(c==d) { continue; }
  	if(v[c]<v[d]) { v[c]+=v[d]; v[d]=c; }
  	else { v[d]+=v[c]; v[c]=d; }
  }
  int ans=M;
  for(int i=1;i<=n;i++) { ans=min(ans,v[i]); }
  	cout<<-ans;
  //}  
  return 0;
}


Measured memory_bytes: 3984
R,C,K = map(int, input().split())
a = [[0] * (C+1) for i in range(R+1)]
dp = [[[0] * (C+1) for i in range(R+1)] for j in range(4)]
for i in range(K):
  r,c,v = map(int, input().split())
  a[r-1][c-1] = v
  
for i in range(R):
  for j in range(C):
    for k in range(2,-1,-1):
      dp[k+1][i][j] = max(dp[k+1][i][j], dp[k][i][j] + a[i][j])
    for k in range(4):
      dp[0][i+1][j] = max(dp[0][i+1][j], dp[k][i][j])
      dp[k][i][j+1] = max(dp[k][i][j+1], dp[k][i][j])
ans = 0
for k in range(4):
  ans = max(ans, dp[k][R-1][C-1])
print(ans)

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

template <typename T>
vector<T> dijkstra(Int s,vector<vector<pair<Int, T> > > & G,T INF){
  using P = pair<T, Int>;
  Int n=G.size();
  vector<T> d(n,INF);
  vector<Int> b(n,-1);
  priority_queue<P,vector<P>,greater<P> > q;
  d[s]=0;
  q.emplace(d[s],s);
  while(!q.empty()){
    P p=q.top();q.pop();
    Int v=p.second;
    if(d[v]<p.first) continue;
    for(auto& e:G[v]){
      Int u=e.first;
      T c=e.second;
      if(d[u]>d[v]+c){
	d[u]=d[v]+c;
	b[u]=v;
	q.emplace(d[u],u);
      }
    }
  }
  return d;
}

//INSERT ABOVE HERE
signed main(){
  Int n,m,s,t;
  cin>>n>>m>>s>>t;
  s--;t--;
  using P = pair<Int, Int>;
  vector<vector<P> > G(n);
  
  for(Int i=0;i<m;i++){
    Int a,b,c,d;
    cin>>a>>b>>c>>d;
    a--;b--;c--;
    G[a].emplace_back(b,d);
    G[a].emplace_back(c,d);
    G[b].emplace_back(a,d);
    G[b].emplace_back(c,d);
    G[c].emplace_back(a,d);
    G[c].emplace_back(b,d);
  }

  const Int INF = 1e15;
  auto D=dijkstra(s,G,INF);

  cout<<D[t]<<endl;
  return 0;
}



Measured memory_bytes: 24308
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int d,t,s;
  cin>>d>>t>>s;



  cout << (s*t>=d?"Yes":"No") << endl;

}

Measured memory_bytes: 3644
A, B = map(int, input().split()) # 横に2個

if A <= 0 and 0 <= B:
    ans = 'Zero'
elif A > 0:
    ans = 'Positive'
elif (B - A) % 2 == 0:
    ans = 'Negative'
else:
    ans = 'Positive'

print(ans)


Measured memory_bytes: 2940
n, q = list(map(int, input().split()))
s = input()
dp = [0, 0]
for i in range(1, n):
    if s[i-1]=="A" and s[i]=="C":
        dp.append(dp[-1]+1)
    else:
        dp.append(dp[-1])
for i in range(q):
    l, r = map(int, input().split())
    ans = dp[r] - dp[l]
    print(ans)

Measured memory_bytes: 6100
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll n;
    cin>>n;
    vl v;
    rep(i,n)
    {
        ll c;
        cin>>c;
        v.pb(c);
    }
    ll req=0;
    for(int i=2;i<n;i++)
        req^=v[i];
    if((req^v[0]^v[1])==0)
    {
        cout<<0<<'\n';
        return;
    }
    ll sum=v[0]+v[1];
    ll my=0;
    vl store;
    ll possible=0;
    vl fun;
    for(int i=0;i<50;i++)
    {
        if(((1LL<<i)&(req))!=0)
        {
            my+=(1LL<<i);
            fun.pb(i);
        }
        else
        {
            store.pb(i);
            possible+=(1LL<<i);
        }
    }
    ll diff=sum-my;
    if(diff<0)
    {
        cout<<-1;
        return;
    }
    if((diff%2)!=0)
    {
        cout<<-1;
        return;
    }
    ll x=diff/2;
    if((x&possible)!=x)
    {
        cout<<-1<<'\n';
        return;
    }
    sort(all(fun));
    reverse(all(fun));
    for(auto it:fun)
    {
        if((x|(1LL<<it))<=v[0])
        {
            x|=(1LL<<it);
        }
    }
    if(x==0)
    {
        cout<<-1<<'\n';
        return;
    }
    if(x>v[0])
    {
        cout<<-1<<'\n';
        return;
    }
    assert(x>=1);
    if((x^(sum-x))!=req)
    {
        cout<<-1;
        return;
    }
    cout<<(v[0]-x);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 15532
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>

using namespace std;
typedef long long int ll;

int main(){

    string S;
    ll K;
    cin >> S >> K;

    if(S[0] == '1' && K == 1){
        cout << "1" << endl;
        return 0;
    }else if(S[0] == '1' && K >= 1){
        for(ll i = 0; i < K; i++){
            //cout << S[i] << endl;
            if(S[i] != '1'){
                cout << S[i] << endl;
                return 0;
            }
        }
        cout << "1" << endl;
        return 0;        
    }

    cout << S[0] << endl;
    return 0;     
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   int a,b,c,d,e,f;
           cin>>a>>b>>c>>d>>e>>f;
           //全探索？
           int water=0,sugar=0;
           //mizu
           int ans_w=1,ans_s=0;
           rep(i,0,31){
            rep(j,0,32){
              sugar=0;
              water=100*a*i+100*b*j;
              //sugar
              rep(k,0,32){
                 rep(l,0,3002){
                       sugar=l*c+d*k;
                   if(water+sugar>f)break;
                   if(water*e<100*sugar)break;
                   if(ans_s*(water+sugar)<=sugar*(ans_w+ans_s)){
                         ans_s=sugar;
                          ans_w=water;
                 //    cout<<i<<j<<k<<l<<endl;
                      }
                 }
              }
            }
           }
           cout<<ans_w+ans_s<<" "<<ans_s<<endl;
          // cout<<double(ans_s*100/(ans_w+ans_s))<<endl;
          // cout<<double(934*100/2634)<<endl;
}

Measured memory_bytes: 3596
#include <iostream>

using namespace std;

#define int long long

const int N = 2e5 + 10;

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);    
  string s;
  cin >> s;
  cout << s;
  if (s[s.length() - 1] == 's') {
    cout << "es";
  } else {
    cout << "s";
  }
  return 0;
}


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

int main(){

	int n, m, ans=0, tmp=0;
	string s[101], t[101];
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> s[i];
	}
	cin >> m;
	for(int i=0; i<m; i++){
		cin >> t[i];
	}

	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			if(s[i]==t[j]){
				tmp--;
			}
		}
		for(int j=0; j<n; j++){
			if(s[i]==s[j]){
				tmp++;
			}
			if(ans<tmp){
				ans=tmp;
			}
		}
		tmp=0;
	}

	cout << ans << endl;

  
  return 0;
}


Measured memory_bytes: 256