akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define endl "\n"
#define deb(x) cerr << #x << "=" << x << endl
#define debb(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define mod ((ll)1e9+7)
#define N ((ll)3e5+20)
#define pb push_back
#define in insert
#define F first
#define S second
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define PI 3.1415926535897932384626
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
ll dr[] = { -1, 1, 0, 0};
ll dc[] = {0, 0, 1, -1};

/*Functions*/
ll gcd(ll a, ll b);
ll exp(ll x, ll y, ll p);
ll exp(ll x, ll y);
void InverseofNumber();
void InverseofFactorial();
void factorial();
ll Binomial(ll n, ll R);


ll factorialNumInverse[N + 1];
ll naturalNumInverse[N + 1];
ll fact[N + 1];

void fileIO() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int main() {
    clock_t start, end;
    start = clock();
    speed
    // InverseofNumber(),InverseofFactorial(),factorial();
    //fileIO();
    ll D, T, S; cin >> D >> T >> S;
    double time = (double)D / (double)S;
    double tt = (double)T;
    if (time <= tt) {
        cout << "Yes";
    }
    else cout << "No";







    end = clock();
    double timeTaken = (double(end - start) * (double(1000))) / double(CLOCKS_PER_SEC);
    deb(timeTaken);
    return 0;
}


/*All Functions*/
ll gcd(ll a, ll b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll exp(ll x, ll y, ll p) {
    ll res = 1;
    while (y) {
        if (y % 2)
            res = (res * x % p) % p;
        x = (x * x) % p;
        y /= 2;
    }
    return res;
}
ll exp(ll x, ll y) {
    ll res = 1;
    while (y) {
        if (y % 2)
            res = (res * x ) ;
        x = (x * x) ;
        y /= 2;
    }
    return res;
}
void InverseofNumber() {
    naturalNumInverse[0] = naturalNumInverse[1] = 1;
    for (ll i = 2; i <= N; i++)
        naturalNumInverse[i] = naturalNumInverse[mod % i] * (mod - mod / i) % mod;
}
void InverseofFactorial() {
    factorialNumInverse[0] = factorialNumInverse[1] = 1;
    for (ll i = 2; i <= N; i++)
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % mod;
}
void factorial() {
    fact[0] = 1;
    for (ll i = 1; i <= N; i++)
        fact[i] = (fact[i - 1] * i) % mod;
}
ll Binomial(ll n, ll R) {
    ll ans = ((fact[n] * factorialNumInverse[R]) % mod * (factorialNumInverse[n - R]) % mod) % mod;
    return ans;
}


Measured memory_bytes: 3768
// --------------
// Tejas Pandey  |
// 26 - 01 - 20  |
// ATCODER #153  |
// --------------

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

#define mod 1000000007
#define lim 100000000000000000
#define vi vector<int>
typedef long long int ll;

int main (void)
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1;
	//cin >> t;
	while(t--)
	{
		//cout << "Case #" << c-t << ": ";
		ll h,n,k;
		cin >> h >> n;
		ll dp[50007];
		memset(dp,0,sizeof(dp));
		vector<pair<int,int>> kp(n);
		for(int i = 0;i < n;i++)
			cin >> kp[i].first >> kp[i].second;
		for(int i = 1;i <= 50000;i++)
			dp[i] = lim;
		dp[0] = 0;
		for(int i = 0;i < n;i++){
			for(int j = 1;j <= 50000;j++)
				if(j - kp[i].first > -1)
					dp[j] = min(dp[j - kp[i].first] + kp[i].second,dp[j]); 
		}
		ll ans = dp[h];
		for(int i = h + 1;i <= 50000;i++)
			ans = min(ans,dp[i]);
		cout << ans << "\n";
	}
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    string n;   cin >> n;
    if(n[0] == '7') cout << "Yes" << endl;
    else if(n[1] == '7')    cout << "Yes" << endl;
    else if(n[2] == '7')    cout << "Yes" << endl;
    else    cout << "No" << endl;
}


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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int L, R;
    L = A + B;
    R = C + D;
    if (L > R){
        cout << "Left" << endl;
    }
    else if (R > L){
        cout << "Right" << endl;
    }
    else{
        cout << "Balanced" << endl;
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int x = 0, y = 0, z = 0;
  for (int i = 0, a; i < N && cin >> a; i++) {
    if (!(a % 4)) x++;
    else if (!(a % 2)) y++;
    else z++;
  }
  cout << ((x + 1 >= y % 2 + z) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
K = int(input())
import queue
q = queue.Queue()
for i in range(1,10):
    q.put(i)

for i in range(K-1):
    num = q.get()
    if num%10!=0:
        q.put(10*num+(num%10)-1)
    q.put(num*10+(num%10))
    if num%10!=9:
        q.put(10*num+(num%10)+1)
    
        
print(q.get())

Measured memory_bytes: 57428
n , k = map(int,input().split())
h = list(map(int,input().split()))
import numpy as np
h = np.array(h)
dp =np.zeros(n,dtype = int)
for i in range(1,n):
    s = max(0,i-k)
    dp[i] = np.min(dp[s:i] + np.abs(h[s:i] - h[i]))
print(dp[-1])

Measured memory_bytes: 17204
#include<bits/stdc++.h>
using namespace std;
int sqr(int n){
	return n*n;
}
int main(){
	int n;
	cin>>n;
	int total = 0;
	vector<int>arr(n);
	for(int i=0; i<n; i++){
		cin>>arr[i];
		total+=arr[i];
	}
	int ret1 = 0;
	int meeting = total/n;
	for(int i=0; i<n; i++) ret1+=sqr(meeting-arr[i]);
	int ret2 = 0;
	meeting++;
	for(int i=0; i<n; i++) ret2+=sqr(meeting-arr[i]);
	cout<<min(ret1,ret2);
}

Measured memory_bytes: 3592
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		StringBuilder str = new StringBuilder();
		
		while(true){
			int m = scan.nextInt();
			int f = scan.nextInt();
			int r = scan.nextInt();
			
			if(m == -1 && f == -1 && r == -1) break;
			
			if(m == -1 || f == -1) str.append("F\n"); 
			else if(m+f >= 80) str.append("A\n");
			else if(m+f >= 65) str.append("B\n");
			else if(m+f >= 50) str.append("C\n");
			else if(m+f >= 30){
				if(r >= 50) str.append("C\n");
				else str.append("D\n");
			}
			else str.append("F\n");
			
			if(m == -1 && f == -1 && r == -1) break;
		}
		System.out.print(str);
		
	}
}

Measured memory_bytes: 18884
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    int N,M;
    cin >> N >>M;
    vector<int>a(M);
    for (int i = 0 ; i < M ; i++){
        cin >> a[i];
    }
    int s = 0;
    for (int i = 0 ; i < M ; i++){
        s+=a[i];
    }
    if (s > N ){
        cout << -1;
    }else {
        cout << N-s;
    }
}

Measured memory_bytes: 3640
#include <stdio.h>
 
int main () {
 
    int N, i, c, j, k, d;
    int a[1000];
    c = 0;
 
    scanf("%d", &N);
 
    for (i = 0; i < N; i++)
        scanf("%d", &a[i]);
 
    for (i = 1; i <= N; i++) {
        for (j = 0; j < N - 1; j++) {
            printf("%d ", a[j]);
        }

        printf("%d", a[N - 1]);
        puts("");
 
        for (k = 1; i - k >= 0; k++) {
            if (a[i + 1 - k] <= a[i - k]) {
                c = a[i - k];
                d = a[i + 1 - k];
                a[i + 1 - k] = c;
                a[i - k] = d;
            }
        }
 
    }
 
    return 0;
 
}


Measured memory_bytes: 2136
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  string S;cin>>S;
  
  for(int i=0;i<3;i++){
    if(S[i]=='1'){
      S[i]='9';
    }
    else{
      S[i]='1';
    }
  }
  
  cout<<S<<endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }

int main() {
    int M, N;
    scanf("%d %d", &N, &M);
    int A[N];
    int SUM = 0;
    for (int i = 0; i < N; ++i) {
        scanf("%d", &A[i]);
        SUM += A[i];
    }
    qsort(A, sizeof(A) / sizeof(A[0]), sizeof(int), downint);

    if (A[M-1] >= 1.0*SUM / (4 * M)) {
        printf("Yes");
        return 0;
    } else {
        printf("No");
        return 0;
    }
}

int A(){
    int A,B,C;
    scanf("%d %d %d",&A,&B,&C);
    printf("%d %d %d",C,A,B);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 100005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);
#define fi(a,b,c) for(int i=a;i<b;i=i+c)
#define fj(a,b,c) for(int j=a;j<b;j+=c)
using namespace std;
 
ll gcd(ll n1,ll n2) {
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent) {
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%MOD;
		base=(base*base)%MOD;
		exponent/=2;
	}
	return ans;
}
ll max(ll a,ll b,ll c) {
	return max(a,max(b,c));
}
int max(int a,int b,int c) {
	return max(a,max(b,c));
}

int main()
{
	int x;
	sd(x);
	cout<<(1-x);
}

Measured memory_bytes: 3756
N = int(input())

AC = 0
WA = 0
TLE = 0
RE = 0

for i in range(N):
    S = input()
    if S == "AC":
        AC += 1
    elif S == "WA":
        WA += 1
    elif S == "TLE":
        TLE += 1
    elif S == "RE":
        RE += 1

print("AC x", str(AC))
print("WA x", str(WA))
print("TLE x", str(TLE))
print("RE x", str(RE))

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

signed main(){
	int N, K, i, ans = 0;
	scanf("%d%d", &N, &K);
	vector<int> p(N);
	for(i = 0; i < N; i++){
		scanf("%d", &p[i]);
	}
	sort(p.begin(), p.end());
	for(i = 0; i < K; i++){
		ans += p[i];
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3692
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <cassert>
#include <queue>
#include <ctime>
#include <string>
#include <cstring>
#include <random>
#define mp make_pair
#define pb push_back
#define NAME ""
#define y1 y1_423
#define list lista

using namespace std;

typedef long long ll;
typedef long double ld;

template<typename T>
ostream& operator << (ostream& cout, const vector<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "()");
	}
	cout << "(" << a[0];
	for (int i = 1; i < (int)a.size(); i++) {
		cout << "; " << a[i];
	}
	return (cout << ")");
}

template<typename T>
ostream& operator << (ostream& cout, const set<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "{}");
	}
	auto it = a.begin();
	cout << "{" << *it;
	++it;
	for (; it != a.end(); ++it) {
		cout << "; " << *it;
	}
	return (cout << "}");
}

template<typename T>
ostream& operator << (ostream& cout, const multiset<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "{}");
	}
	auto it = a.begin();
	cout << "{" << *it;
	++it;
	for (; it != a.end(); ++it) {
		cout << "; " << *it;
	}
	return (cout << "}");
}

template<typename T1, typename T2>
ostream& operator << (ostream& cout, const pair<T1, T2> &a) {
	return cout << "(" << a.first << "; " << a.second << ")";
}

random_device gen;
mt19937 rnd(gen());

const int nmax = 2000 * 1000;
const int inf = 2000 * 1000 * 1000;
const ll infl = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll;
const int mod = 1000 * 1000 * 1000 + 7;
const ld pi = acos(-1.0);

int p[nmax], sz[nmax];
bool used[nmax];
vector<int> a[nmax];

void dfs(int v, int par = -1) {
	p[v] = par;
	sz[v] = 1;
	used[v] = true;
	for (int u : a[v]) {
		if (!used[u]) {
			dfs(u, v);
			sz[v] += sz[u];
		}
	}
}

int main() {
	//freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
	//freopen(NAME".in", "r", stdin);freopen(NAME".out", "w", stdout);
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n - 1; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		x--, y--;
		a[x].pb(y);
		a[y].pb(x);
	}
	dfs(0);
	vector<int> now;
	int ind = n - 1;
	while (ind != -1) {
		now.pb(ind);
		ind = p[ind];
	}
	ind = now[now.size() / 2 - 1];
	int sz2 = sz[ind], sz1 = n - sz[ind];
	if (sz1 > sz2) {
		cout << "Fennec";
	} else {
		cout << "Snuke";
	}
	return 0;
}



Measured memory_bytes: 61948
//h15-2 ケーキの切り分け2
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace boost_multiprecision = boost::multiprecision;
#define LL long long
#define CINT boost_multiprecision::cpp_int
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int N;
vector<LL> A;
LL dp[2000][2000];

LL solve(int begin, int end){
    if(begin < 0) begin = N+begin;
    if(end >= N) end = end-N;
    if(begin == end) return 0;
    if(dp[begin][end] != -1) return dp[begin][end];

    LL re = 0;
    if(A[begin] > A[end]){
        int b = begin - 1;
        if(b < 0) b = N+b;
        if(b == end){
            re = A[b];
        }
        else{
            re = max(re, solve(b-1,end) + A[b]);
            re = max(re, solve(b,end+1) + A[end]);
        }
    }
    if(A[begin] < A[end]){
        int e = end + 1;
        if(e >= N) e = e-N;
        if(begin == e){
            re = A[begin];
        }
        else{
            re = max(re, solve(begin-1,e) + A[begin]);
            re = max(re, solve(begin,e+1) + A[e]);
        }
    }
    dp[begin][end] = re;
    //cout << begin << " " << end << " " << re << endl;
    return re;
}

int main(){
    cin >> N;
    for(int i=0; i<N; i++){
        LL tmp;
        cin >> tmp;
        A.push_back(tmp);
    }

    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            dp[i][j] = -1;
        }
    }

    LL ans = 0;
    for(int i=0; i<N; i++){
        ans = max(ans, solve(i-1,i+1) + A[i]);
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 34504
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 

 

 
int main(){
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll ans=a*c;
  ans=max(ans,a*d);
  ans=max(ans,b*c);
  ans=max(ans,b*d);
  cout << ans << endl;

} 


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll get(ll n,ll base) {
	ll ret = 0;
	while(n > 0) {
		ret += n % base;
		n /= base;
	}	
	return ret;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n,s;
	cin >> n >> s;
	
	if(n == s) {
		cout << n+1 << endl;
	}
	else {
		ll bound = sqrt(n);
		for(int i=2;i<=bound;i++)
			if(get(n,i) == s) {
				cout << i << endl;
				return 0;
			}
		for(int i=min(s,n/(bound+1));i>=1;i--) {
			ll target = s - i;
			ll l = n/(i+1)+1 , r = n/i , m;
			while(true) {
				if(r-l<3) {
					for(m=l;m<=r && n%m >= target;m++);
					m--;
					break;
				}
				m = (l+r)>>1;
				if(n % m >= target)
					l = m;
				else
					r = m-1;
			}
			if(n % m == target) {
				cout << m << endl;
				return 0;
			}
		}
		cout << -1 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
s = str(input())
n = len(s)
lists = []
ans_list = []
Sum = 0
for i in range(2**n):
    lists = []
    ans_list = []
    Sum = int(s[0])
    for j in range(n-1):
        if ((i >> j) & 1):
            lists.append(1)
        else:
            lists.append(0)
    for k in range(n-1):
        ans_list.append(s[k])
        if lists[k] == 1:
            ans_list.append("+")
        else:
            ans_list.append("-")
    ans_list.append(s[-1])
    for l in range(1,len(ans_list) -1 ):
        if ans_list[l] == "+":
            Sum += int(ans_list[l+1])
        elif ans_list[l] == "-":
            Sum -= int(ans_list[l+1])
    if Sum == 7:
        ans_list.append("=7")
        ans = "".join(ans_list)
        print(ans)
        exit()

    

Measured memory_bytes: 3064
#include <iostream>
#include<string>
#include<cctype>
#include<algorithm>
#include <stdio.h>
#include<cstdlib>

using namespace std;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	a = b - a;
	if (a % 2 == 0)cout << "Alice" << endl;
	else cout << "Borys" << endl;

	return 0;
		

}

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

typedef long long ll;
 
int main(){
  int n;
  cin >> n;
  int k;
  cin >> k;
  int ans = 0;
  for(int i=0; i<n; i++){
    int a; cin >> a;
    ans += 2 * min(a, abs(k-a));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
  string a,b;
  cin>>a>>b;
  int x=stoi(a+b);
  for(int i=1;i<=200000;i++){
    if(i*i==x){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}
  


Measured memory_bytes: 256
n, k = [int(i) for i in input().split()]
hs = []
for i in range(n):
    hs.append(int(input()))

hs.sort()
# print(hs)

min_diff = hs[k - 1] - hs[0]
for i in range(n - k + 1):
    diff = hs[i + k - 1] - hs[i]
    if diff == 0:
        min_diff = 0
        break

    if diff < min_diff:
        min_diff = diff

print(min_diff)


Measured memory_bytes: 7512
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::cmp;

fn read_vec() -> Vec<String> {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.split(' ').map(|x| x.to_string()).collect::<Vec<String>>()
}

fn main() {
    let n: i32 = read_vec()[0].trim().parse().expect("");
    println!("{}", 800 * n - 200 * (n / 15));
}


Measured memory_bytes: 4476
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(long long int i=a; i<n; i++)
#define rloop(i,a,n) for(long long int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcount(a)
#define mod 1000000007
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define stkll stack<ll>
#define qll queue<ll>
#define pqll priority_queue<ll>
#define M 998244353
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1;
    while(power>0)
    {
        if(power%2==1)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1)
    {
        return false;
    }
    if(n<=3)
    {
        return true;
    }
    if(n%2==0 || n%3==0)
    {
        return false;
    }
    for(ll i=5; (i*i)<=n; i+=6)
    {
        if(n%i==0 || n%(i+2)==0)
        {
            return false;
        }
    }
    return true;
}
using namespace std;
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b)
{
    return (a.second<b.second);
}
int main()
{
    FAST
    FO
    FI
    int a,b,c;
    IN a>>b>>c;
    if((a+b+c)>=22)
    {
        OUT "bust";
    }
    else
    {
        OUT "win";
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int A,B;
    scanf("%d%d",&A,&B);
    if(A >= 13)printf("%d\n",B);
    else if(A >= 6&& A <= 12)printf("%d\n",B / 2);
    else if(A <= 5)printf("%d\n",0);
	return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){int b=0;for(auto itr :a){if(b++!=0)cout << " "; cout << itr;} }
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
#define int ll
signed main(){
    int n,m;
    while(cin >> n >> m, n+m){
        auto Ld = vectors(301,301,INF);
        auto Sd = vectors(301,301,INF);
        rep(i,n)Ld[i][i] = Sd[i][i] = 0;
        rep(i,m){
            int a,b,c; char s;
            cin >> a >> b >> c >> s;
            --a,--b;
            if(s == 'L'){
                cmin(Ld[a][b],c);
                Ld[b][a] = Ld[a][b];
            }else{
                cmin(Sd[a][b], c);
                Sd[b][a] = Sd[a][b];
            }
        }
        rep(k,n)rep(i,n)rep(j,n){
            cmin(Sd[i][j],Sd[i][k] + Sd[k][j]);
            cmin(Ld[i][j],Ld[i][k] + Ld[k][j] );
        }
        int r; cin >> r;
        vector<int>v;
        rep(i,r){
            int t; cin >> t;
            v.push_back(--t);
        }
        auto dp = vectors(1000+1,300+1,INF);
        dp[0][v[0]]=0;
        rep(i,r-1){
            rep(j,n){
                cmin(dp[i+1][j],dp[i][j]+Ld[v[i]][v[i+1]]);
                rep(k,n){
                    cmin(dp[i+1][k],dp[i][j] + Ld[v[i]][j] + Sd[j][k] + Ld[k][v[i+1]]);
                }
            }
        }
        int ans = INF;
        rep(i,n)cmin(ans,dp[r-1][i]);
        cout << ans << endl;
    }
}



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



int MyRandom(int n, int m){
    string str = "";
    int num = 0;
    n *= n;

    while(1){
        str.insert( str.begin() , (n%10) + '0' );
        n /= 10;
        if( str.size() == 2*m ) break;
    }
    str = str.substr( m/2 , m );

    for(int i=0 ; i<str.size() ; i++){
        num *= 10;
        num += str[i] - '0';
    }

    return num;
}

int main(){
    int n, a, r;
    const int m = 4;

    cin >> n;
    for(int i=0 ; i<n ; i++){
        cin >> r;
        cout << "Case " << (i+1) << ":" << endl;
        for(int j=0 ; j<10 ; j++){
            if( j != 0 ){
                r = MyRandom( r , m );
            }
            cout << MyRandom( r , m ) << endl;
        }
    }
}

Measured memory_bytes: 0
<?PHP
 $single_line_input = trim(fgets(STDIN));

$stack = array();

foreach (range(1, 9) as $left) {
    foreach (range(1, 9) as $right) {
array_push($stack,$left*$right);
    }
}


if (in_array($single_line_input, $stack) ){
  echo  'Yes';
}
else{
    echo  'No';
}


Measured memory_bytes: 3700
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	listX := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&listX[i])
	}

	result := "No"
	countMap := map[string]int{}
	for i := 0; i < n-1; i++ {
		if listX[i][len(listX[i])-1] == listX[i+1][0] {
			result = "Yes"
		} else {
			result = "No"
			break
		}
	}
	for i := 0; i < n; i++ {
		countMap[listX[i]]++
		if countMap[listX[i]] > 1 {
			result = "No"
			break
		}
	}

	fmt.Println(result)

}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    ll l, a, b, m;
    cin >> l >> a >> b >> m;
    a -= b;
    ll d[19];
    d[0] = 0;
    ll f[19];
    ll t = 0;
    for(int i = 1; i <= 18; i++){
        t = (t + 1) * 10 - 1;
        d[i] = max(0ll, min(l, (t - a) / b));
        f[i] = (a + b * d[i]) % m;
    }
    for(int i = 18; i > 0; i--) d[i] = d[i] - d[i - 1];
    ll p[19];
    p[0] = 1;
    for(int i = 1; i <= 18; i++) p[i] = p[i - 1] * 10 % m;
    ll ans = 0;
    t = 1;
    for(int i = 18; i > 0; i--){
        ll s = f[i];
        ll u = p[i];
        ll v = b % m;
        while(d[i]){
            if(d[i] % 2){
                ans = (ans + s * t % m) % m;
                t = t * u % m;
                s = (s + m - v % m) % m;
            }
            s = (s + (s + m - v % m) % m * u % m) % m;
            v = v * (u + 1) % m * 2 % m;
            u = u * u % m;
            d[i] /= 2;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
a, b = map(int, input().split())
s = input()

flag = True
for i in range(a):
    if s[i] == '-':
        flag = False
        break

if s[a] != '-':
    flag = False

for i in range(b):
    if s[a+1+i] == '-':
        flag = False
        break

if flag:
    print('Yes')
else:
    print('No')

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
/*
 execution in cmd of windows: g++ p1.cpp -op1
  
  
  p1
 
 */
typedef double dd;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define nl <<"\n"
#define con continue
#define br break
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
ll mx=INT_MAX;
ll mi=INT_MIN;
#define mem0(a)         memset(a,0,sizeof(a))
#define mem1(a)         memset(a,-1,sizeof(a))
#define all(v) v.begin(), v.end()
#define fsort(v) sort(all(v))  
#define rsort(v) sort(v.rbegin(),v.rend())
#define rev(v) reverse(all(v))
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define sumv(v,x) accumulate(v.begin(),v.end(),x);
const ll mod = 1000000007;
const ll inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
#define io { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define cer cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#define cs ll t;cin>>t;while(t--)
#define cs1 ll t;t=1;while(t--)


int main()
{
   
        io;
        //////////////////////////////////
        cs1{
             ll i,j,k,l,s=0,p=INT_MAX,n,m,q=0,e;
             cin>>n>>m>>k;
             if(m*k>=n) cout<<"Yes" nl;
             else cout<<"No" nl;

        }
        //////////////////////////////////
 
}

Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

//#define DEBUG
#define maxn 200010
#define abs(i) ((i)>=0?(i):-(i))
typedef long long ll;
ll ai[maxn],n;

inline int readin(){
	int x=0,s=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')s=-1;ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';ch=getchar();
	}
	return x*s;
}

int main(){
#ifdef DEBUG
	//freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	ll ans=0;
	n=readin();
	for(int i=1;i<=n;++i)ai[i]=readin()-i;
	sort(ai+1,ai+n+1);
	for(int i=1;i<=n;++i)ans+=abs((ai[i]-ai[n/2+1]));
	cout<<ans<<endl;
#ifdef DEBUG
	fclose(stdin);
	fclose(stdout);
#endif
	return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
using namespace std;
const int maxn=20005;
int n,ans[2][maxn];
inline char nc(){
	static char buf[100000],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline int read(){
	int ret=0;bool f=0;char ch=nc();
	while(ch>'9'||ch<'0') f^=ch=='-',ch=nc();
	while(ch<='9'&&ch>='0') ret=ret*10+ch-'0',ch=nc();
	return f?-ret:ret;
}
int main(){
	n=read();
	ans[0][0]=1,ans[1][n+1]=1;
	for (int i=1;i<=n;i++){
		int x=read();
		ans[0][x+1]+=n-i+1,ans[1][x-1]+=n-i+1;
	}
	for (int i=1;i<=n;i++) ans[0][i]+=ans[0][i-1];
	for (int i=n;i;i--) ans[1][i]+=ans[1][i+1];
	for (int i=1;i<=n;i++) printf("%d%c",ans[0][i],i==n?'\n':' ');
	for (int i=1;i<=n;i++) printf("%d%c",ans[1][i],i==n?'\n':' ');
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define repi(i,a,n) for(int i = (int)a; i < (int)(n); i++)
#define ll long long

int main(void){
    string days[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string today;
    std::cin >> today;
    
    rep(i,7){
        if(days[i]==today){
            std::cout << 7-i << std::endl;
        }
    }
}

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

using namespace std;

int main()
{
    int N,K;
    cin >> N >> K;
    vector<bool> person(N,false);
    int d;
    rep(i,N)
    {
        cin >> d;
        rep(j,d)
        {
            int num;
            cin >> num;
            person[num-1] = true;
        }
    }

    int count = 0;
    rep(i,N) if(person[i] == false) count++;
    cout << count << endl;
}


Measured memory_bytes: 3608
n,m = map(int,input().split())
x,y =[],[]
for i in range(n):
    x.append(list(input()))
for i in range(m):
    y.append(list(input()))
for i in range(n-m+1):
    for j in range(n-m+1):
        for a in range(m):
            s = True
            for b in range(m):
                if x[i+a][j+b] != y[a][b]:
                    s = False
                    break
            if not s:
                break
        if s:
            print("Yes")
            exit()
print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const ll INF = (ll)(1e18)+1;
ll dp[100005][2];

int main(void){
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  dp[0][0] = 0;
  dp[0][1] = -INF;
  REP(i, n){
    //i桁目で符号の反転を行わない場合
    //前の桁で反転されてない場合+ai, されてる場合-ai
    dp[i+1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i]);

    //i桁目で反転を行う場合
    ///前の桁で反転されてない場合-ai, されてる場合+ai
    dp[i+1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i]);
  }
  cout << dp[n][0] << endl;
  return 0;
}

Measured memory_bytes: 2176
import re
n=int(input())
s=input()
for i in range(4):
  u=format(i,'02b')
  a=('S' if u[0]=='0' else 'W')
  b=('S' if u[1]=='0' else 'W')
  t=['?']*n
  t[0]=a
  t[1]=b
  for j in range(1,n+2):
    if s[j%n]=='o' and t[j%n]=='S' or s[j%n]=='x' and t[j%n]=='W':
      t[(j+1)%n]=t[(j-1)%n]
    else:
      t[(j+1)%n]=('S' if t[(j-1)%n]=='W' else 'W')
  if t[0]==a and t[1]==b:
    print(re.sub("[^SW]","",str(t)))
    exit()
print(-1)
exit()

Measured memory_bytes: 9684
import java.util.Scanner;

public class Main {
    public Scanner in=new Scanner(System.in);
    public int[] inputNum=new int[4];
    public String outputNum;

    public static void main(String args[]){
        Main m=new Main();

        int iii=m.in.nextInt();

        m.inputNum[0]=iii/1000;
        m.inputNum[1]=(iii/100)%10;
        m.inputNum[2]=(iii/10)%10;
        m.inputNum[3]=iii%10;
//        for(int i=0;i<4;i++){
//            m.inputNum[i]=m.in.nextInt();
//        }

        
        if(m.inputNum[0]+m.inputNum[1]+m.inputNum[2]+m.inputNum[3]==7){
            System.out.println(m.inputNum[0]+"+"+m.inputNum[1]+"+"+m.inputNum[2]+"+"+m.inputNum[3]+"=7");
            return;
        }
        if(m.inputNum[0]+m.inputNum[1]+m.inputNum[2]-m.inputNum[3]==7){
            System.out.println(m.inputNum[0]+"+"+m.inputNum[1]+"+"+m.inputNum[2]+"-"+m.inputNum[3]+"=7");
            return;
        }
        if(m.inputNum[0]+m.inputNum[1]-m.inputNum[2]+m.inputNum[3]==7){
            System.out.println(m.inputNum[0]+"+"+m.inputNum[1]+"-"+m.inputNum[2]+"+"+m.inputNum[3]+"=7");
            return;
        }
        if(m.inputNum[0]+m.inputNum[1]-m.inputNum[2]-m.inputNum[3]==7){
            System.out.println(m.inputNum[0]+"+"+m.inputNum[1]+"-"+m.inputNum[2]+"-"+m.inputNum[3]+"=7");
            return;
        }
        if(m.inputNum[0]-m.inputNum[1]+m.inputNum[2]+m.inputNum[3]==7){
            System.out.println(m.inputNum[0]+"-"+m.inputNum[1]+"+"+m.inputNum[2]+"+"+m.inputNum[3]+"=7");
            return;
        }
        if(m.inputNum[0]-m.inputNum[1]+m.inputNum[2]-m.inputNum[3]==7){
            System.out.println(m.inputNum[0]+"-"+m.inputNum[1]+"+"+m.inputNum[2]+"-"+m.inputNum[3]+"=7");
            return;
        }
        if(m.inputNum[0]-m.inputNum[1]-m.inputNum[2]+m.inputNum[3]==7){
            System.out.println(m.inputNum[0]+"-"+m.inputNum[1]+"-"+m.inputNum[2]+"+"+m.inputNum[3]+"=7");
            return;
        }
        if(m.inputNum[0]-m.inputNum[1]-m.inputNum[2]-m.inputNum[3]==7){
            System.out.println(m.inputNum[0]+"-"+m.inputNum[1]+"-"+m.inputNum[2]+"-"+m.inputNum[3]+"=7");
            return;
        }
    }
}


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

int main() {
    int n;
    cin>>n;
    map<string,int> mp;
    mp["AC"]=0;
    mp["WA"]=0;
    mp["TLE"]=0;
    mp["RE"]=0;
    rep(i,0,n){
        string tmp;
        cin>>tmp;
        mp[tmp]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;
    return 0;
}


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

string S;

int main() {
    cin >> S;

    int check[3];
    for (int i = 0; i < 3; i++) {
        check[i] = 0;
    }
    for (int i = 0; i < 3; i++) {
        if (S[i] == 'a') check[0]++;
        else if (S[i] == 'b') check[1]++;
        else check[2]++;
    }

    bool f = true;
    for (int i = 0; i < 3; i++) {
        if (check[i] != 1) f = false;
    }
    
    if (f) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 764
import numpy as np

def is_int_distance(xi, xj):
    R2 = 0
    for i in range(len(xi)):
        R2 += (xi[i]-xj[i])**2
    if np.sqrt(R2) == float(int(np.sqrt(R2))):
        return 1
    else:
        return 0

if __name__=="__main__":
    N, D = map(int, input().split(' '))
    X = [[None for _ in range(D)] for _ in range(N)]

    for i in range(N):
        for j, t in enumerate(map(int, input().split(' '))):
            X[i][j]=t
    count = 0
    for i in range(N):
        for di in range(1, N - i):
            count += is_int_distance(X[i], X[i+di])
    
    print(count)

Measured memory_bytes: 18812
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int a[10],i;
    for(i=0;i<10;i++)
        scanf("%d",&a[i]);
    i--;
    sort(a,a+10);
    while(i>=7)
    {
        printf("%d\n",a[i]);
        i--;
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main()
{
        int n,ans=0,min=100000000,current;
        cin >> n;
        while (n--) {
                cin >> current;
                if (current <= min) {
                        ans++;
                        min = current;  
                }   
        }   
        cout << ans << endl;
        return 0;
}

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

using namespace std;
int main()
{
    int x;
    while(cin >> x){
        if(x==0){
            break;
        }
        int cnt=0;
        int a=1000-x;
        cnt+=a/500;
        a%=500;
        cnt+=a/100;
        a%=100;
        cnt+=a/50;
        a%=50;
        cnt+=a/10;
        a%=10;
        cnt+=a/5;
        a%=5;
        cnt+=a;
        cout << cnt <<endl;
    }
    
    return 0;
}



Measured memory_bytes: 3088
h,w = map(int, input().split( ))

s = ["#"*(w+2)]

for _ in range(h):
    inpt = input()
    s.append("#"+inpt+"#")
s.append("#"*(w+2))

dp1 = [[0 for j in range(w+2)] for i in range(h+2)]
dp2 = [[0 for j in range(w+2)] for i in range(h+2)]

dp3 = [[0 for j in range(w+2)] for i in range(h+2)]
dp4 = [[0 for j in range(w+2)] for i in range(h+2)]

for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j] != "#":
            dp1[i][j] = dp1[i-1][j] + 1
            dp3[i][j] = dp3[i][j-1] + 1
        if s[h+1-i][w+1-j] != "#":
            dp2[h+1-i][w+1-j] = dp2[h+1-i+1][w+1-j]+1
            dp4[h+1-i][w+1-j] = dp4[h+1-i][w+1-j+1]+1
            
dp5 = [[dp1[i][j]+dp2[i][j]+dp3[i][j]+dp4[i][j]-3 for j in range(w+2)] for i in range(h+2)]
mx = 0

for i in range(h+2):
    mx = max(mx,max(dp5[i]))
print(mx)

Measured memory_bytes: 216708
<?php
fscanf(STDIN, "%s%s", $N, $D);
$count = 0;
for ($i = 0; $i < $N; $i++) {
    fscanf(STDIN, "%s%s", $p, $q);
    $distance = ($p * $p) + ($q * $q);
    $availableDistance = $D * $D;
    if($distance <= $availableDistance) $count++;
}
echo $count;

Measured memory_bytes: 16112
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

#define F first
#define S second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    ll x, a, b;
    cin >> x >> a >> b;
    if (b - a <= 0) {
        cout << "delicious" << endl;
    }else if(b - a <= x){
        cout << "safe" << endl;
    }else{
        cout << "dangerous" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		int N = sc.nextInt();

		for (int i = 1; i <= 9; i++)
			if (N > 111 * i)
				continue;
			else {
				System.out.println(111 * i);
				break;
			}
	}
	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 19284
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>

using namespace std;

constexpr int INF = 1000000000;/* 1e+9a */
constexpr int MODULO = 1000000007;

typedef int64_t ll;

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

bool solve(int N){
    for (int i = 0; i <= N; i+=4) {
        if((N -i) % 7 == 0) return true;
    }
    return false;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
   cout << (solve(N) ? "Yes" : "No") << endl;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

struct uf_tree
{
    vector<int> par, rank;
    uf_tree(int n) : par(n), rank(n)
    {
        for (int i = 0; i < n; i++)
        {
            par[i] = i;
            rank[i] = 0;
        }
    }

    int find(int x)
    {
        if (x == par[x])
            return x;
        return par[x] = find(par[x]);
    }

    void unite(int x, int y)
    {
        x = find(x);
        y = find(y);

        if (x == y)
            return;

        if (rank[x] < rank[y])
            swap(x, y);
        par[y] = x;
        rank[x] += rank[y];
    }

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

struct edge
{
    int from, to, cost;
    bool operator<(const edge &e) const
    {
        return cost < e.cost;
    }
};

int kruskal(int n, vector<edge> ed)
{
    int sum = 0;
    sort(ALL(ed));

    uf_tree uf(n + 1);

    rep(i, ed.size())
    {
        if (!uf.same(ed[i].from, ed[i].to))
        {
            sum += ed[i].cost;
            uf.unite(ed[i].from, ed[i].to);
        }
    }

    return sum;
}

int main()
{
    int v, e;
    cin >> v >> e;

    vector<edge> ed(e);
    rep(i, e) cin >> ed[i].from >> ed[i].to >> ed[i].cost;

    OP(kruskal(v, ed));

    return 0;
}


Measured memory_bytes: 5252
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    a, b = MI()
    L = sorted([a, b])
    if L[0] == a:
        ans = int(str(a)*b)
    else:
        ans = int(str(b)*a)
    print(ans)


    
    

if __name__ == "__main__":
	main()

Measured memory_bytes: 9140
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s, t;
    cin >> s >> t;
    int n = sz(s);
    int m = sz(t);
    vvi is(26);
    rep(i, n) is[s[i]-'a'].pb(i);
    rep(i, n) is[s[i]-'a'].pb(i+n);
    ll ans = 0;
    int p = 0;
    rep(i, m) {
        int c = t[i] - 'a';
        if (sz(is[c]) == 0) {
            puts("-1");
            return 0;
        }
        p = *lower_bound(all(is[c]), p) + 1;
        if (p >= n) {
            ans += n;
            p -= n;
        }
    }
    ans += p;
    cout << ans << endl;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define N 100005
#define m 1000000007
#define dd double
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
int32_t main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,i;
	cin>>n;
	string s;
	map<string,int>mp;
	mp["AC"]=0;
	mp["WA"]=0;
	mp["TLE"]=0;
	mp["RE"]=0;
	for(i=0;i<n;++i)
	{
		cin>>s;
		mp[s]++;
	}
	cout<<"AC x "<<mp["AC"]<<endl
		<<"WA x "<<mp["WA"]<<endl
		<<"TLE x "<<mp["TLE"]<<endl
		<<"RE x "<<mp["RE"];
}


Measured memory_bytes: 3660
#include <stdio.h>

#define MAX 10000
#define NIL -1

struct Node {int p, l, r;};
struct Node T[MAX];
int n;

/* 先行順巡回 */
void preParse(int u) {
  if(u == NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

/* 中間順巡回 */
void inParse(int u) {
  if(u == NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

/* 後方順巡回 */
void postParse(int u) {
  if(u == NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(void) {
  int i, v, l, r, root;
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    T[i].p = NIL;
  }
  
  for(i=0; i<n; i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }
  
  for(i=0;i<n;i++) if(T[i].p == NIL) root = i;
  
  printf("Preorder\n");
  preParse(root);
  printf("\n");

  printf("Inorder\n");
  inParse(root);
  printf("\n");

  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}




Measured memory_bytes: 2108