akhauriyash/Code-Regression huggingface dataset:
a,b,k = map(int,input().split())

ans = {}
for i in range(a,a+k):
    if i<=b:
        ans.setdefault(i,0)
        ans[i] += 1
    else:
        break
for i in range(b-(k-1),b+1):
    if a<=i:
        ans.setdefault(i,0)
        ans[i] += 1
    else:
        break
for i in ans.keys():
    print(i)

Measured memory_bytes: 9124
#include<iostream>
#include <vector>
#include <numeric>

using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    vector<int> b(N);
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }
    for (int i = 0; i < N; i++){
        cin >> b[i];
    }

    ll cnt = 0;
    for (int i = 0; i < N; i++){
        if (a[i] < b[i]) {
            cnt += (b[i] - a[i]) / 2;
        } else {
            cnt -= (a[i] - b[i]);
        }
    }

    bool isValid;
    if (cnt >= 0){
        isValid = true;
    } else {
        isValid = false;
    }

    if (isValid){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
// #include <string.h>
// #include <math.h>

int main() {
    int m,f,r;
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        if(m==-1&&f==-1&&r==-1){
            break;
        }else{
            if(m==-1 || f==-1){
                printf("F\n");
            }else if(m+f>=80){
                printf("A\n");
            }else if(m+f>=65 && m+f<80){
                printf("B\n");
            }else if(m+f>=50 && m+f<65){
                printf("C\n");
            }else if(m+f>=30 && m+f<50){
                if(r>=50){
                    printf("C\n");
                }else{
                    printf("D\n");
                }
                
            }else if(m+f<30){
                printf("F\n");
            }
        }
    }

    return 0;
}


Measured memory_bytes: 2116
import numpy as np
import math
import collections
import bisect
import itertools
from collections import Counter

suf_xor_dict = {}
pre_xor_dict = {}


def suf_xor(N, p):
    # print(p)
    global xor_dict
    if N - len(p) + 1 in suf_xor_dict:
        return suf_xor_dict[N - len(p) + 1]

    if len(p) == 0:
        return 0
    if len(p) == 1:
        suf_xor_dict[N] = p[0]
        return p[0]
    if len(p) == 2:
        suf_xor_dict[N] = p[1]
        suf_xor_dict[N - 1] = p[0] ^ p[1]
        return(p[0] ^ p[1])
    else:
        ret = p[0] ^ suf_xor(N, p[1:])
        suf_xor_dict[N - len(p) + 1] = ret
        return ret


def pre_xor(N, p):
    global pre_xor_dict
    if len(p) in pre_xor_dict:
        return pre_xor_dict[len(p)]

    if len(p) == 0:
        return 0
    if len(p) == 1:
        pre_xor_dict[1] = p[0]
        return p[0]
    if len(p) == 2:
        pre_xor_dict[1] = p[0]
        pre_xor_dict[2] = p[0] ^ p[1]
        return(p[0] ^ p[1])
    else:
        ret = p[-1] ^ pre_xor(N, p[:-1])
        pre_xor_dict[len(p)] = ret
        return ret


def main():
    N = int(input())
    a = list(map(int, input().split()))
    ans = []
    pre_xor_list = [0]
    suf_xor_list = [0]
    for i in range(N):
        pre_xor_list.append(pre_xor_list[i] ^ a[i])
        suf_xor_list.append(suf_xor_list[i] ^ a[N - i - 1])

    pre_xor_list = pre_xor_list[1:]
    suf_xor_list = suf_xor_list[1:]

    for i in range(N):
        ans.append((0 if i - 1 < 0 else pre_xor_list[i - 1]) ^ (0 if i >= N - 1 else suf_xor_list[N - i - 2]))

    for item in ans:
        print(item, end=' ')
    print('')


if __name__ == "__main__":
    main()


Measured memory_bytes: 59612
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
    ll n;
    string s;
    cin>>n>>s;
    
    if(s.length()<=n)
    cout<<s;
    else
    {
        string t="";
        t=s.substr(0,n);
        t.append("...");
        cout<<t;
    }

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main() {
   int a[5],b[5],i,j;;
   for(i=0;i<5;i++)a[i]=i+1;
   for(i=0;i<5;i++)cin>>b[i];
   for(i=0;i<5;i++)
   {
       if(a[i]!=b[i])
       {
           cout<<a[i];break;
       }
   }
}

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long int;

int main()
{
	int n, m;
	ll k;
	cin >> n >> m >> k;
	auto a = vector<int>(n);
	auto b = vector<int>(m);
	for(auto&& aa : a) cin >> aa;
	for(auto&& bb : b) cin >> bb;
	auto c = vector<ll>();
	c.push_back(0LL);
	for(int i = 0; i < n; ++i){
		c.push_back(c.back() + a[n - i - 1]);
	}
	for(int i = 0; i < m; ++i){
		c.push_back(c.back() + b[i]);
	}
	int p = 0, q = n, ans = 0;
	while(p <= n){
		if(p > q) q = p;
		while(q <= n + m && c[q] - c[p] <= k){
			ans = max(ans, q - p);
			++q;
		}
		++p;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int N , sum = 0;
  cin >> N;
  
  for (int i = 0;i < N;i++){
    int l , r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 int a[400];
int main(){
    int n; cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    bool flag = false;
    int  cnt = 0;
    while(!flag){
        for (int i = 1; i <= n; ++i){
            if(a[i]&1){
                flag = true;
                break;
            }
        } 
        if(flag) break;
        for (int i = 1; i <= n; ++i){
            a[i] /= 2;
        }  
        ++cnt;
    }
    cout << cnt << endl;
    return 0;
}

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

// typedef

// macro
#define REP(index, num) for (auto index = 0; index < num; index++)
#define REP1(index, num) for (auto index = 1; index <= num; index++)

#define MAX_NUM 60

// using namespace 
using namespace std;

// global
int A, B, C, X;

int main()
{
  cin >> A >> B >> C >> X;

  int count = 0;

  REP(aId, A + 1)
  {
    REP(bId, B + 1)
    {
      REP(cId, C + 1)
      {
        if (500 * aId + 100 * bId + 50 * cId == X)
          count++;
      }
    }
  }

  cout << count << endl;
}


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

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            var sum = str[0] + str[1];

            if (str[0] <= 8 && str[1] <= 8)
            {
                Console.WriteLine("Yay!");
            }
            else
            {
                Console.WriteLine(":(");
            }

        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
int main(void)
{
	int a=0,b=0;
	scanf("%d %d",&a,&b);
	if(a>b)
	{
		printf("a > b\n");
	}
	else if(a<b)
	{
		printf("a < b\n");
	}
	else
	{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
s = input()
if s =="SUN":
    print(7)
elif s =="MON":
    print(6)
elif s=="TUE":
    print(5)
elif s =="WED":
    print(4)
elif s=="THU":
    print(3)
elif s=="FRI":
    print(2)
else:print(1)


Measured memory_bytes: 2940
/*
	written by Pankaj Kumar.
	country:-INDIA
*/
#include<algorithm>
#include<string.h>
#include<iostream>
#include<vector>
#include<cmath>
#include<set>
using namespace std;
typedef long long ll ;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vpl;
typedef vector<string> vs;
typedef set<string> ss;
typedef set<int> si;
typedef set<ll> sl;
typedef set<pair<int,int>> spi;
typedef set<pair<ll,ll>> spl;
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
// define values.
#define mod 1000000007;
#define phi 1.618
/* Bit-Stuff */
#define get_set_bits(a) (__builtin_popcount(a))
#define get_set_bitsll(a) ( __builtin_popcountll(a))
#define get_trail_zero(a) (__builtin_ctz(a))
#define get_lead_zero(a) (__builtin_clz(a))
#define get_parity(a) (__builtin_parity(a))
/*  Abbrevations  */
#define ff first;
#define second ss;
#define mk make_pair;
#define line cout<<endl;
#define pb push_back
#define INT_SIZE sizeof(int)
#define INT_BITS INT_SIZE*8-1
/* ascii value 
A=65,Z=90,a=97,z=122
*/
/*  -----------------------------------------------------------------------------------*/


int main()
{
	pan;
	int r;
	cin>>r;
	printf("%0.11f",2*r*3.1415926535);
}

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var T = Console.ReadLine();
            for (int i = 0; i < S.Length; i++)
            {
                if (T[i] == S[i])
                {
                    continue;
                }
                else
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");
        }
    }
}


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

int main(){
    double x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    printf("%.10f",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
    return 0;
}


Measured memory_bytes: 3296
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll aa , bb;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->aa - ((fr*)q)->aa;}
/*aのb進数時の桁数*/
ll digits(ll a, ll b){return a/b?1+digits(a/b,b):1;}


int main(void){
    // char ;
    ll n;
    scanf("%lld",&n);
    rrep(i,sqrt(n)+1,1){
        if(n%i==0){
            printf("%lld\n", max2( digits(i,10),digits(n/i,10) ) );
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <unordered_map>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

constexpr int mod = 1e9 + 7;

std::vector<unordered_map<string, int>> table;
std::vector<int> sum;

std::vector<char> chars = {'A', 'T', 'C', 'G'};

void init_table() {
    table.reserve(110);
    for (int i = 0; i <= 110; ++i) {
        sum.push_back(0);
        table.push_back(unordered_map<string, int>());
        for (char c1 : chars) {
            for (char c2 : chars) {
                for (char c3 : chars) {
                    std::string str; str+=c1; str+=c2; str+=c3;
                    table[i].insert(make_pair(str, 0));
                }
            }
        }
    }
}

bool is_ok(const std::string& str) {
    if (str[1] == 'G' && str[2] == 'A' && str[3] == 'C') return false;
    if (str[1] == 'A' && str[2] == 'G' && str[3] == 'C') return false;
    if (str[0] == 'A' && str[1] == 'G' && str[2] == 'C') return false;
    if (str[1] == 'A' && str[2] == 'C' && str[3] == 'G') return false;
    if (str[0] == 'A' && str[2] == 'G' && str[3] == 'C') return false;
    if (str[0] == 'A' && str[1] == 'G' && str[3] == 'C') return false;
    return true;
}

void create_table() {
    table[1]["TTA"] = 1;
    table[1]["TTT"] = 1;
    table[1]["TTG"] = 1;
    table[1]["TTC"] = 1;
    sum[1] = 4;
    for (int i = 1; i < 110; ++i) {
        for (auto it = table[i].begin(); it != table[i].end(); ++it) {
            for (char c : chars) {
                std::string str = it->first + c;
                if (is_ok(str)) {
                    table[i+1][str.substr(1)] = (table[i+1][str.substr(1)] + (it->second % mod)) % mod;
                    sum[i+1] = (sum[i+1] + (it->second % mod)) % mod;
                }
            }
        }
    }
}

int main(int argc, char** argv) {
    size_t N;
    cin >> N;
    init_table();
    create_table();
    cout << sum[N] << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

int main(void){
	set<ll> s;
	ll N,A;
	cin>>N;
	rep(i,N){
		cin>>A;
		if(s.count(A)==0){
			s.insert(A);
		}else{
			s.erase(A);
		}
	}
	cout<<s.size()<<endl;
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int i,ans=10000;
    for(i=0;i<s.size()-2;i++)
    {
        int t=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
        ans=min(ans,abs(753-t));
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> tbl(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> tbl[i][j];
    vector<bool> flg_h(h, false);
    vector<bool> flg_w(w, false);
    rep(i, h) {
        bool flag = true;
        rep(j, w) {
            if (tbl[i][j] == '#')
                flag = false;
        }
        if (flag)
            flg_h[i] = true;
    }
    rep(i, w) {
        bool flag = true;
        rep(j, h) {
            if (tbl[j][i] == '#')
                flag = false;
        }
        if (flag)
            flg_w[i] = true;
    }
    /* rep(i, h) cout << flg_h[i];
    cout << endl;
    rep(i, w) cout << flg_w[i];
    cout << endl; */
    rep(i, h) rep(j, w) {
        if (!flg_h[i] && !flg_w[j])
            cout << tbl[i][j];
        if (j == w - 1 && !flg_h[i])
            cout << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
long long a [100010];
int main (){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%lld",&a[i]);
int zero =0;
for(int i=0;i<n;i++)if(a[i]==0) zero++;
if(zero >0){
printf("0\n");
return 0;
}
long long prod =1;
for(int i=0;i<n;i++){
if(a[i ] <=1000000000000000000/ prod ){
prod *=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod );
}


Measured memory_bytes: 2468
S = input()

if 'N' in S and 'S' not in S: print('No')
elif 'S' in S and 'N' not in S: print('No')
elif 'W' in S and 'E' not in S: print('No')
elif 'E' in S and 'W' not in S: print('No')
else: print('Yes')

Measured memory_bytes: 2940
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCoder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const int INF = 2e9;
const ll large_P = 1e9 + 7;



//繰り返し2乗法
//N^aの、Mで割った余りを求める。
ll my_pow(ll N, ll a, ll M) {
	ll tempo;
	if (a == 0) {
		return 1;
	}
	else {
		if (a % 2 == 0) {
			tempo = my_pow(N, a / 2, M);
			return (tempo * tempo) % M;
		}
		else {
			tempo = my_pow(N, a - 1, M);
			return (tempo * N) % M;
		}
	}
}



//N_C_a を M で割った余り
ll my_combination(ll N, ll a, ll M) {
	ll answer = 1;

	rep(i, a) {
		answer *= (N - i);
		answer %= M;
	}

	rep(i, a) {
		answer *= my_pow(i + 1, M - 2, M);
		answer %= M;
	}

	return answer;
}



ll my_gcd(ll& a, ll& b) {
	if (b == 0) return a;
	ll temp = a % b;
	return my_gcd(b, temp);
}



// long long型 n を、base 進法での、i 桁目の数が入った vector にする。
void ll_to_vector(ll base, ll n, vector<ll>& v) {
	ll tempo = n;

	ll n_digit = floor(log10(n) / log10(base)) + 1;
	v.assign(n_digit, 0);

	//ll n_digit = v.size();

	for (ll i = 0; i < n_digit; i++) {
		v.at(i) = tempo / pow(base, n_digit - 1 - i);
		tempo -= v.at(i) * pow(base, n_digit - 1 - i);
	}
}



int char_to_int(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4;
	case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9;
	default: return 0;
	}
}


//エラトステネスの篩で、prime で ないところに false を入れる。
//true で初期化された vector を代入する必要がある。
void prime_judge(vector<bool>& prime_or_not) {

	prime_or_not.at(0) = false;
	prime_or_not.at(1) = false;

	ll n = prime_or_not.size() - 1;
	ll region = sqrt(n) + 1;

	for (ll i = 2; i <= n / 2; i++) {
		prime_or_not.at(2 * i) = false;
	}


	for (ll i2 = 1; i2 < n / 2; i2++) {
		ll i = 2 * i2 + 1;  //ここからは奇数のみ探索
		if (i < region && prime_or_not.at(i)) {
			ll j = i * i;
			while (j < n + 1) {
				prime_or_not.at(j) = false;
				j += 2 * i;
			}
		}
	}
};



map<int, int> divide_to_prime(int target) {
	map<int, int> res;

	//sqrt(target) まで調べる。
	int upper_lim = ceil(sqrt(target));
	vector<bool> prime_or_not(upper_lim + 1, true);

	if (upper_lim < 20) prime_or_not.assign(25, true);
	prime_judge(prime_or_not);

	int tempo = target;
	rep(i, upper_lim + 1) {
		if (prime_or_not.at(i)) {
			while (tempo % i == 0) {
				tempo /= i;
				res[i]++;
			}
		}
	}

	if (tempo != 1) res[tempo]++; //sqrt(target) より大きな素因数は高々1つしかない。



	return res;
}





signed main() {
	string S; cin >> S;

	bool res = true;

	rep(i, S.size()) {
		if (i % 2 == 1 && S.at(i) == 'R') { //偶数文字目
			res = false;
			break;
		}
		if (i % 2 == 0 && S.at(i) == 'L') {  //奇数文字目
			res = false;
			break;
		}
	}

	if (res) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
n, k, s = map(int, input().split())

ans = []
for i in range(k):
    ans.append(s)
    
if s == 10 ** 9:
    out_of_s = 1
else:
    out_of_s = s + 1

for i in range(n - k):
    ans.append(out_of_s)
    
for a in ans:
    print(a, end=' ')

Measured memory_bytes: 5016
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String[] lines = sc.next().split(",");
            int[] cards = new int[13];
            int max = 0;
            int max2 = 0;
            for (String s:lines) {
                int n = Integer.parseInt(s) - 1;
                cards[n]++;
                if (max < cards[n]) {
                    max = cards[n];
                } else if (max2 < cards[n]) {
                    max2 = cards[n];
                }
            }
            String a=max>=4?"four card":max==3?max2==2?"full house":"three card":max==2?max2==2?"two pair":"one pair":"null";

                int count = 0;
                for (int i = 0; i < 14; i++) {
                    if (cards[i % 13] == 1) {
                        count++;
                        if (count == 5) {
                            a = "straight";
                            break;
                        }
                    } else {
                        count = 0;
                    }
               // }
            }
            System.out.println(a);
        }
    }
}


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

int main() {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;

  int a = 0;
  int b = 0;
  int ab = 0;

  // 必要なピザの枚数を比較して、A・Bの両方で最低限必要な枚数を算出
  int n = min(X, Y);

  // ABを2枚購入する方が、A・Bを1枚ずつ購入するより安い場合
  if ((C * 2) < (A + B)) {
    ab = n * 2;
  // ABを2枚購入する方が、A・Bを1枚ずつ購入するより高い場合
  } else {
    a = n;
    b = n;
  }

  // 残りの必要なピザの枚数
  int x_rest = X - n;
  int y_rest = Y - n;

  // 残りのAピザを、Aピザ1枚 or ABピザ2枚の安い方で補填する
  if ((C * 2) < A) {
    ab += x_rest * 2;
  } else {
    a += x_rest;
  }

  // 残りのBピザを、Bピザ1枚 or ABピザ2枚の安い方で補填する
  if ((C * 2) < B) {
    ab += y_rest * 2;
  } else {
    b += y_rest;
  }

  cout << (A * a + B * b + C * ab) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <cstring>
using namespace std;
int main()
{
	int n,a,flag=0;
	deque<int>t;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		if(i%2==0)
		{
			t.push_back(a);
		}
		else
		{
			t.push_front(a);
		}
	}
	if(n%2==0)
	{
		for(int i=0;i<n;i++)
		{
			printf("%d%c",t[i],i==n-1?'\n':' ');
		}
	}
	else
		{
			for(int i=0;i<n;i++)
			{
				printf("%d%c",t[n-1-i],i==n-1?'\n':' ');
			}
		}
	return 0;
 } 

Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
#define N 1000015
const int p=1e9+7;
int n,k,a[N],tot,dp[N];
inline int ksm(int d,int tk){int ret=1;while(tk){if(tk&1)ret=1ll*ret*d%p;d=1ll*d*d%p;tk>>=1;}return ret;}
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i*i<=n;i++)if(n%i==0)
    {
    	a[++tot]=i;if(i*i!=n)a[++tot]=n/i;
	}
	sort(a+1,a+1+tot);int ans=0;
	for(int i=1;i<=tot;i++)
	{
		dp[i]=ksm(k,(a[i]+1)/2);
		for(int j=1;j<i;j++)if(a[i]%a[j]==0)dp[i]=(dp[i]-dp[j]+p)%p;
		if(a[i]%2==0)ans=(ans+1ll*dp[i]*(a[i]/2)%p)%p;
		else ans=(ans+1ll*dp[i]*a[i]%p)%p;
	}printf("%d\n",ans);
}


Measured memory_bytes: 2304
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


/* TEMPLATE ENDS HERE */

int main() {
	cout << fixed << setprecision(12);	
	ll n;
	cin >> n;
	cout << (n * (n - 1)) / 2 << endl;
	return 0;
}


ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
  #define int long
  int H,W,K;cin>>H>>W>>K;
  
  vector<string> strs(H);
  int tmp=1;
  for(int y=0;y<H;y++){
    string s;cin>>s;
    vector<int>ids;
    for(int x=0;x<W;x++){
      if(s[x]=='#')ids.push_back(x);
    }
    if(ids.size()){
      int l=-1;
      for(int id:ids){
        for(int i=l;i<id;i++)strs[y]+=to_string(tmp)+" ";
        l=id;
        tmp++;
      }
      while(l!=W-1){
        strs[y]+=to_string(tmp-1)+" ";
        l++;
      }
      
    }

    
  }
  
  int y=0,filled=-1;
  while(y<H){
    if(!strs[y].empty()){
      while(filled!=y){
        cout<<strs[y]<<endl;
        filled++;
      }
    }
    y++;
  }  
  for(int i=filled;i<H-1;i++){ 
    cout<<strs[filled]<<endl;
  }
  
  
  
}



Measured memory_bytes: 1664
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <functional>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <string>

using namespace std;

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)

ll const INF = 1000000000000000000;
int const I_MAX = 2147483647;
ll const MOD = 1e9 + 7;
int const POW_MAX = 1e5;
int const N_MAX = 1e5;

// nCr
ll po[POW_MAX + 2];
ll mod_pow(ll x, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
ll mod_inv (ll x) {
  return mod_pow(x, MOD - 2) % MOD;
}
ll comb(int n, int r) {
  if (!po[n]) {
    po[0] = 1;
    FOR(i, 1, n + 1) po[i] = po[i - 1] * i % MOD;
  }
  return (((po[n] * mod_inv(po[r])) % MOD) * mod_inv(po[n - r])) % MOD;
}
// greatest common divisor
ll gcd(ll a, ll b) {
  while (a % b != 0) {
    ll tmp = a;
    a = b;
    b = tmp % b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

ll A, B, C, D;

int main() {
  scanf("%lld %lld %lld %lld", &A, &B, &C, &D);

  ll c_a;
  ll c_d = 0;
  if (A % C == 0) {
    c_a = A;
  } else {
    c_a = ((A / C) + 1) * C;
  }
  ll c_x = B - c_a;
  if (c_x > 0) c_d += c_x / C + 1;
  else if (c_x == 0) c_d++;

  ll d_a;
  ll d_d = 0;
  if (A % D == 0) {
    d_a = A;
  } else {
    d_a = ((A / D) + 1) * D;
  }
  ll d_x = B - d_a;
  if (d_x > 0) d_d += d_x / D + 1;
  else if (d_x == 0) d_d++;

  ll cd_a;
  ll cd = lcm(C, D);
  ll cd_d = 0;
  if (A % cd == 0) {
    cd_a = A;
  } else {
    cd_a = ((A / cd) + 1) * cd;
  }
  ll cd_x = B - cd_a;
  if (cd_x > 0) cd_d += cd_x / cd + 1;
  else if (cd_x == 0) cd_d++;

  ll count = (B - A + 1) - c_d - d_d + cd_d;
  printf("%lld\n", count);
}


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

using namespace std;
using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9+7;
const ll mod = 1e9+7;

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

    vector<int>h(n);
    rep(i,n)cin>>h[i];
    vector<int>j(n,1);

    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;
        b--;

        if(h[a]>h[b])j[b]=0;
        else if(h[a]<h[b])j[a]=0;
        else if(h[a]==h[b]){
            j[a]=0;
            j[b]=0;
        }
    }

    int cnt=0;

    rep(i,n)if(j[i]==1)cnt++;

    cout<<cnt<<endl;
}



Measured memory_bytes: 4048
#include<cstdio>
#include<algorithm>
const int N=3e5+24,D=1<<19;
struct point{int x,y;}a[N],b[N],c[N],d[N];
struct segment{
	int l,r,h;
}up[N+N],dn[N+N];
int n,w,h,m,ans,k0,k1,st[N],top,k,l,left[N],right[N],tmp[N];
bool Cmpl(const segment&a,const segment&b){return a.l<b.l;}
bool Cmp(const point&a,const point&b){
	if((a.y>=m)==(b.y>=m))
	  return a.x==b.x?a.y<b.y:a.x<b.x;
	return a.y>=m;
}
struct segment_tree{
	int mx[D+D];
	inline void Init(){for(int i=0;i<(D+D);i++)mx[i]=0;}
	inline int Max(int l,int r){
		int res=0;
		for(l+=D,r+=D+2;l^r^1;l>>=1,r>>=1){
		  if(~l&1)res=std::max(res,mx[l^1]);
		  if( r&1)res=std::max(res,mx[r^1]);
		}return res;
	}
	inline void Insert(int k,int a){
		for(k+=D+1,mx[k]=std::max(mx[k],a),k>>=1;k;k>>=1)
		  mx[k]=std::max(mx[k<<1],mx[k<<1|1]);
	}
}t;
void Solve(int w,int h,point*a){
	m=h/2;
	for(int i=1;i<=n;i++)tmp[i]=a[i].x;
	tmp[n+1]=w;
	std::sort(tmp+1,tmp+2+n);
	k=0;
	for(int i=1;i<=n+1;i++)if(tmp[i]!=tmp[i-1])tmp[++k]=tmp[i];
	for(int i=1;i<=n;i++)a[i].x=std::lower_bound(tmp,tmp+1+k,a[i].x)-tmp;
	std::sort(a+1,a+1+n,Cmp);
	k0=k1=0;
	for(int i=0;i<=n;i++){
	  if(i==n||a[i+1].y<m){l=i;break;}
	}
	for(int i=2;i<=l;i++)
	  up[++k0]=(segment){a[i-1].x,a[i].x,h-m};
	for(int i=l+2;i<=n;i++)
	  dn[++k1]=(segment){a[i-1].x,a[i].x,m};
	if(l){
	  up[++k0]=(segment){0,a[1].x,h-m};
	  up[++k0]=(segment){a[l].x,k,h-m};
	}
	else up[++k0]=(segment){0,k,h-m};
	if(n-l){
	  dn[++k1]=(segment){0,a[l+1].x,m};
	  dn[++k1]=(segment){a[n].x,k,m};
	}
	else dn[++k1]=(segment){0,k,m};
	top=0;
	for(int i=1;i<=l;i++){
	  for(;top&&a[st[top]].y>=a[i].y;--top);
	  left[i]=!top?0:a[st[top]].x;
	  st[++top]=i;
	}
	top=0;
	for(int i=l;i;i--){
	  for(;top&&a[st[top]].y>=a[i].y;--top);
	  right[i]=!top?k:a[st[top]].x;
	  st[++top]=i;
	}
	top=0;
	for(int i=l+1;i<=n;i++){
	  for(;top&&a[st[top]].y<=a[i].y;--top);
	  left[i]=!top?0:a[st[top]].x;
	  st[++top]=i;
	}
	top=0;
	for(int i=n;i>l;i--){
	  for(;top&&a[st[top]].y<=a[i].y;--top);
	  right[i]=!top?k:a[st[top]].x;
	  st[++top]=i;
	}
	for(int i=1;i<=n;i++){
	  if(i<=l){
		if(i==1||a[i].x>a[i-1].x)
		  up[++k0]=(segment){left[i],right[i],a[i].y-m};
	  }
	  else{
		if(i==n||a[i].x<a[i+1].x)
		  dn[++k1]=(segment){left[i],right[i],m-a[i].y};
	  }
	}
	std::sort(up+1,up+1+k0,Cmpl);
	std::sort(dn+1,dn+1+k1,Cmpl);
	t.Init();
	for(int i=1,j=1;i<=k0;i++){
	  for(;j<=k1&&dn[j].l<=up[i].l;j++)
		t.Insert(dn[j].r,tmp[dn[j].r]+dn[j].h);
	  ans=std::max(ans,t.Max(up[i].l,up[i].r)-tmp[up[i].l]+up[i].h);
	}
	t.Init();
	for(int i=k0,j=k1;i;i--){
	  for(;j&&dn[j].l>=up[i].l;j--)
		t.Insert(dn[j].r,tmp[dn[j].r]-tmp[dn[j].l]+dn[j].h);
	  ans=std::max(ans,t.Max(up[i].l,up[i].r)+up[i].h);
	}
}
int main(){
    scanf("%d%d%d",&w,&h,&n);
	for(int i=1;i<=n;i++){
	  scanf("%d%d",&a[i].x,&a[i].y);
	  b[i].y=a[i].x,b[i].x=a[i].y;
	  c[i].x=a[i].x,c[i].y=h-a[i].y;
	  d[i].x=b[i].x,d[i].y=w-b[i].y;
	}
	Solve(w,h,a);
	Solve(h,w,b);
	Solve(w,h,c);
	Solve(h,w,d);
	printf("%d\n",ans<<1);
	return 0;
}

Measured memory_bytes: 32384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int ABCD = in.nextInt();
        	int a = ABCD / 1000;
        	int b = (ABCD / 100) % 10;
        	int c = (ABCD / 10) % 10;
        	int d = ABCD % 10;
        	String ans = "";
        	
        	if(a + b + c + d == 7) {ans = a + "+" + b + "+" + c + "+" + d;}
        	if(a + b + c - d == 7) {ans = a + "+" + b + "+" + c + "-" + d;}
        	if(a + b  - c + d == 7) {ans = a + "+" + b + "-" + c + "+" + d;}
        	if(a - b + c + d == 7) {ans = a + "-" + b + "+" + c + "+" + d;}
        	if(a - b - c - d == 7) {ans = a + "-" + b + "-" + c + "-" + d;}
        	if(a - b - c + d == 7) {ans = a + "-" + b + "-" + c + "+" + d;}
        	if(a - b + c - d == 7) {ans = a + "-" + b + "+" + c + "-" + d;}
        	if(a + b - c - d == 7) {ans = a + "+" + b + "-" + c + "-" + d;}
        	
        	out.println(ans + "=7");
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

int main(void) {
    int A, B, C, D;
    std::cin >> A >> B >> C >> D;
    bool flag = false;
    do {
        if (!flag) {
            C -= B;
        } else {
            A -= D;
        }
        flag = !flag;
    } while (A > 0 && C > 0);

    printf("%s\n", flag ? "Yes" : "No");

    return 0;
}


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

int main() {
  int64_t N,D,A;
  cin>>N>>D>>A;
  vector<pair<int64_t,int64_t>> p(N);
  vector<int64_t> q(N+1);
  for(int i=0;i<N;i++){
    int64_t a,b;
    cin>>a>>b;
    p[i]=make_pair(a,b);
    q[i]=a;
  }
  q[N]=167167167167;
  sort(p.begin(),p.end());
  sort(q.begin(),q.end());
  vector<int64_t> kez(N+1);
  int64_t Z=0;
  for(int i=0;i<N;i++){
    int64_t X,H;
    tie(X,H)=p[i];
    H-=kez[i];
    if(H>0){
      int64_t L=X+2*D+1;
      int b=lower_bound(q.begin(),q.end(),L)-q.begin();
      int64_t Q=(H-1)/A+1;
      Z+=Q;
      kez[i]+=Q*A;
      kez[b]-=Q*A;
    }
    kez[i+1]+=kez[i];
  }
  cout<<Z<<endl;

    
}

Measured memory_bytes: 9520
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<ll, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int n, m;
ll f[MAXN], rev[MAXN];
vector<II> a;

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

ll C(ll n, ll k) {
    return f[n] * rev[n - k] % MODBASE * rev[k] % MODBASE;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    f[0] = 1;
    rev[0] = binPowMod(f[0], MODBASE-2, MODBASE);
    FOR(i,1,200000) {
        f[i] = f[i-1] * i % MODBASE;
        rev[i] = binPowMod(f[i], MODBASE-2, MODBASE);
    }
    FOR(i,2,int(sqrt(m))) 
        if (m % i == 0) {
            int cnt = 0;
            while (m % i == 0) {
                cnt++;
                m /= i;
            }
            a.emplace_back(II(i, cnt));
        }
    if (m > 1) a.emplace_back(II(m, 1));
    ll res = 1;
    FOR(i,0,SZ(a)-1) {
        int x = a[i].SE;
        res = res * C(x+n-1, n-1) % MODBASE;
    }
    cout << res;
    return 0;
}

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

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

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

  sort(l.begin(), l.end());

  if (2 * l[n - 1] < sum)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    unsigned long r, d, x;
    int i;
    scanf("%lu%lu%lu", &r, &d, &x);
    for ( i = 1; i <= 10; i++ ) {
        x = r * x - d;
        printf("%lu\n", x);
    }
    return 0;
}

Measured memory_bytes: 128
//17
#include<iostream>
#include<vector>
#include<utility>
#include<cstdlib>
#include<algorithm>

using namespace std;

typedef pair<int,int> pii;

int ds(pii a,pii b){
  return abs(a.first-b.first)+abs(a.second-b.second);
}

int main(){
  for(int w,h;cin>>w>>h,w|h;){
    vector<pii> v[5];
    pii s,g;
    for(int y=0;y<h;y++){
      for(int x=0;x<w;x++){
	char c;
	cin>>c;
	switch(c){
	case 'S':
	  s=make_pair(x,y);
	  break;
	case 'G':
	  g=make_pair(x,y);
	  break;
	case '.':
	  break;
	default:
	  v[c-'1'].push_back(make_pair(x,y));
	  break;
	}
      }
    }
    int l=0;
    for(int i=0;i<5;i++){
      l+=v[i].empty();
    }
    if(l>=2){
      cout<<"NA"<<endl;
    }else{
      int m=1<<30,p;
      for(int ii=0;ii<5;ii++){
	int i=(ii+1)%5;
	int d[4][1000];
	fill(d[0],d[4],1<<30);
	for(int j=0;j<v[i].size();j++){
	  d[0][j]=ds(v[i][j],s);
	}
	for(int j=1;j<=3;j++){
	  for(int k=0;k<v[(i+j)%5].size();k++){
	    for(int l=0;l<v[(i+j-1)%5].size();l++){
	      d[j][k]=min(d[j][k],d[j-1][l]+ds(v[(i+j-1)%5][l],v[(i+j)%5][k]));
	    }
	  }
	}
	for(int j=0;j<v[(i+3)%5].size();j++){
	  if(m>d[3][j]+ds(g,v[(i+3)%5][j])){
	    m=d[3][j]+ds(g,v[(i+3)%5][j]);
	    p=ii+1;
	  }
	}
      }
      cout<<p<<' '<<m<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1264
import sys
from random import randint
from datetime import datetime

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]

def randomize(n):
    return [ randint(1, 26) for _ in range(n) ]

def get_now():
    dt = datetime.now()
    return dt.second + dt.microsecond/1000000

def main():
    start = get_now()
    end = get_now()
    # 開催日数
    D = ii()
    # 満足度の下がりやすさ
    C = lmi()
    # 得られる満足度
    S = lmif(D)
    # 開催するコンテスト
    T = randomize(D)

    def scoring():
        # 最後に開かれた日付
        last = [0]*26
        score = 0
        for i in range(D):
            score += S[i][T[i]-1]
            last[T[i]-1] = i+1
            for j in range(26):
                score -= C[j] * (i+1 - last[j])
        return score

    max_score = scoring()
    # print(max_score)
    ans = T.copy()
    # a = 0
    while end - start < 1.95:
        idx, value = randint(0, D-1), randint(1, 26)
        old = T[idx]
        T[idx] = value
        score = scoring()
        if max_score < score:
            ans = T.copy()
            max_score = score
        else:
            T[idx] = old
        # if a % 10000 == 0:
        #     print(a, *T, score, max_score)
        # a += 1
        end = get_now()
    print(*ans, sep='\n')

main()


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

ull GCD(ull x, ull y){
    if(x < y) swap(x, y);
    int r = x % y;
    while(r!=0){
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}

int main(){
    ull a, b, c, d;
    cin >> a >> b >> c >> d;

    ull lcm = c * d / GCD(c, d);
    a--;
    ull ans = b - (b/c + b/d - b/lcm) - (a - (a/c + a/d - a/lcm));
    cout << ans << endl;
}


Measured memory_bytes: 256
L, R = map(int, input().split())
if R - L >= 2019:
    can = list(range(2019))
else:
    L = L%2019
    R = R%2019
    can = []
    if R - L >= 2019:
        can = list(range(2019))
        print(1)
    elif L < R:
        can = list(range(L, R+1))
    elif L==R:
        print(L%2019)
        exit(0)
    else:
        can = list(range(L, 2019))+list(range(0, R+1))

ans = float('inf')
for i in range(len(can)-1):
    for j in range(i+1, len(can)):
        tmp = can[i]*can[j]%2019
        if ans >= tmp:
            ans = tmp
        if ans==0:
            print(0)
            exit(0)
ans = max(ans, 0)
print(ans%2019)

Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))

a = sorted(a)

r = 0
minV = 10**10
for i in range(n-1):
	curr = abs(a[-1] / 2 - a[i])
#	print(a[-1],a[i],curr)
	if minV > curr:
		r = a[i]
		minV = curr

print(a[-1], r)

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

typedef long long ll;

#define pb push_back
#define ft first
#define sd second
#define all(x) begin((x)), end((x))
#define forn(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define isz(x) (int)(x).size()
/* <-------------------> */

int n;
string s;

map<pair<string, string>, ll> cnt;

void f0(int m) {
    string x2 = "", y2 = "";
    forn (i, n) {
        if (m & (1 << i)) x2 += s[n + i];
        else y2 += s[n + i];
    }
    ++cnt[{x2, y2}];
}

int f(int m) {
    string x1 = "", y1 = "";
    forn (i, n) {
        if (m & (1 << i)) x1 += s[i];
        else y1 += s[i];
    }
    string x2 = y1, y2 = x1;
    reverse(all(x2)); reverse(all(y2));
    return cnt[{x2, y2}];
}

void solve() {
    cin >> n >> s;
    ll ans = 0;
    forn (mask, (1 << n)) f0(mask);
    forn (mask, (1 << n)) ans += f(mask); 
    cout << ans; 
}

/* <-------------------> */
// #define LOCAL
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
}


Measured memory_bytes: 87040
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int i;
	int arr[n];
	for(i=0;i<n;i++)
		cin>>arr[i];
	int dp[n]={0};
	dp[0]=0;
	for(i=1;i<n;i++)
	{
		int min_=INT_MAX;
		int j=i-1;
		int temp=k;
		while(temp-- && j>=0)
		{
			min_=min(min_,abs(arr[i]-arr[j])+dp[j]);
			j--;
		}
		dp[i]=min_;

	}
	cout<<dp[n-1]<<"\n";
	return 0;
}

Measured memory_bytes: 4176
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

//各桁の和を出力
long long Sum(long long n) {
  long long m = 0;
  while (n) {
    m += n % 10;
    n /= 10;
  }
  return m;
}

const int MAX = 510000;
const int MOD = 1000000007;

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

void Comuse() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

#define comuse Comuse()
// nCk(comuseを使え)
long long combi(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// pCk(comuseを使え)
long long perm(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] % MOD) % MOD;
}

//最小公倍数(aとbの)
long long lcm(long long a, long long b) {
  long long n;
  n = a / __gcd(a, b) * b;
  return n;
}

// auto A = div(n)
vector<long long> div(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

//(aのn乗をmodで割ったあまり)
long long modpow(long long a, long long n, long long mod) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * a % mod;
    }

    a = a * a % mod;

    n >>= 1;
  }

  return ans;
}

void solve();

const int MAX_N = 131072;
// segment tree
int NN;
int seg[MAX_N * 2 - 1];
void seguse() {
  for (int i = 0; i < 2 * NN - 1; i++) {
    seg[i] = INT_MAX;
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;
  solve();
}

///////////////////////////////////////////////////////////

string S;
string A,B;
void solve() {
  cin >> S;
  for(int i = 0; i < S.size(); i++){
    if(S[i] != S[S.size() - 1 - i]){
      cout << "No" << endl;
      return;
    }
  }
  for(int i = 0; i < S.size() / 2; i++){
    A.push_back(S[i]);
    B.push_back(S[S.size()/2 - 1 - i]);
  }
  if(A == B){
    cout << "Yes" <<endl;
  } else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int n,a,b,max,min;
  scanf("%d%d%d",&n,&a,&b);
  max=a<b?a:b;
  if(a+b<n){
    min=0;
  }else{
    min=a+b-n;
  }
  printf("%d %d\n",max,min);
  return 0;
}


Measured memory_bytes: 128
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};
const main=()=>{
  let [a,b]=tnn(2)
  to(a*b/gcd(a,b))
}
main()


Measured memory_bytes: 7372