akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define mod 1000000007
#define maxn 100010
#define LL long long
int n,k;
int prime[maxn],not_prime[maxn],phi[maxn],tot;
LL ans;
LL quick_pow(LL a,LL b){//快速幂
	LL ans=1;
	while(b){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
void linear_shaker(int x){//线性筛求欧拉函数
	int i,j;
	phi[1]=1;
	for(i=2;i<=x;i++){
		if(!not_prime[i])prime[++tot]=i,phi[i]=i-1;
		for(j=1;i*prime[j]<=x;j++){
			if(i%prime[j]==0)phi[i*prime[j]]=phi[i]*prime[j];
			else phi[i*prime[j]]=phi[i]*phi[prime[j]];
			not_prime[i*prime[j]]=1;
			if(i%prime[j]==0)break;
		}
	}
}
int main(){
	int i;
	scanf("%d%d",&n,&k);
	linear_shaker(k);
	for(i=1;i<=k;i++)
		ans=(ans+quick_pow(k/i,n)*phi[i]%mod)%mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2544
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int sp_move = scan.nextInt();
        long[] monster = new long[num];
        for (int i = 0; i < num; i++) {
            monster[i] = scan.nextLong();

        }
        Arrays.sort(monster);
        long sum = 0;
        if(sp_move >= num)
            System.out.println(0);
        else{
            for (int i = 0; i < (num-sp_move); i++) {
                sum += monster[i];
            }
            System.out.println(sum);
        }
    }

}


Measured memory_bytes: 86932
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

int main() {
    vector<int> v(100,0);
    int i;
    while(cin >> i) {
        v[i-1]++;
    }
    int m = 0;
    REP(i,100) {
        m = max(m, v[i]);
    }
    REP(i,100){
        if (v[i] == m) {
            cout << i + 1 << endl;
        }
    }
    return 0;
}

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define debug(i) cout << i << endl;
#define debugarr(a) for(auto i : a) cout << i << " ";

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    int arr[n];

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

    multiset<int> last;

    for(int i = 0; i < n; i++) {
        multiset<int>::iterator it = last.lower_bound(arr[i]);
        if(it == last.begin()) {
            last.insert(arr[i]);
        }else {
            it--;
            last.erase(it);
            last.insert(arr[i]);
        }
    }
    cout << last.size() << endl;
}


Measured memory_bytes: 5376
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

int main() {
  int N, K; cin >> N >> K;
  vector<LL> A(N); cin >> A;
  LL sum = 1;
  for (int i = K; i < N; ++i) {
    if (A[i-K] < A[i]) cout << "Yes" << endl;
    else               cout << "No" << endl;
  }
}


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

int main(){
    int n;
    cin>>n;
    int digit = n%10;
    vector<int> hon = {2,4,5,7,9};
    vector<int> pon = {0,1,6,8};
    vector<int> bon = {3};
    if(binary_search(hon.begin(),hon.end(), digit)) cout<<"hon\n";
    else if(binary_search(pon.begin(),pon.end(), digit)) cout<<"pon\n";
    else cout<<"bon\n";
}

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

int main()
{
int k,x;cin>>k>>x;
int start=max(x-k+1,-1000000),end=min(x+k-1,1000000);
for(int i=start;i<=end;i++)
	cout<<i<<" ";
return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<double>vec(n);
  vector<string>s(n);
  double sum=0;
  for(int i=0;i<n;i++){
    cin>>vec.at(i)>>s.at(i);
    if(s.at(i)=="BTC")
      vec.at(i)*=380000;
    sum+=vec.at(i);
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define ppll pair<pll,ll>
#define vi vector <pll>
#define out(x) return cout<<x,0;
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define f(i,x,n) for(ll i=x;i<n;i++)
#define lc(n) 2*n+1
#define rc(n) 2*n+2
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;} 
const ll N = 1e6 + 5, M = 1e12 + 5, mod = 1e9 + 7;
 
int main(){
    FAST;
    ll n, m, x = 0, k, i, t, ans = 0, j, y = 0, z = 4, c = 0;
    string s;
    cin >> s;
    f(i, 0, s.size())
        if(s[i] == '7')
            out("Yes");
    out("No");
 
}

Measured memory_bytes: 3652
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <map>
#include <set>
#include <string>

using namespace std;

int main()
{
    int x,a,b;
    scanf("%d %d %d",&x,&a,&b);
    if(a-b>=0) {
        printf("delicious\n");
    } else if(b-a<=x){
        printf("safe\n");
    } else {
        printf("dangerous\n");
    }
    return 0;
}


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

using namespace std;

typedef long long int Int;

int main(void)
{
    string s;
    int bit_1 = 0,bit_2 = 0;

    cin>>s;
    if(s[0] == s[s.size()-1])
	bit_1 = 1;
    if(s.size()%2)
	bit_2 = 1;

    if(bit_1 ^ bit_2)
	cout<<"First"<<endl;
    else
	cout<<"Second"<<endl;


    return 0;
}


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



int main() {
	int a, b, c, d, e = 0, f = 0, g = 0, h = 0;
	cin >> a >> b >> c >> d;
	e = c - (d - b);
	f = d + (c - a);
	g = a - (d - b);
	h = b + (c - a);
	cout << e << " " << f << " " << g << " " << h << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<string>

using namespace std;

int main(){
    

    stack<string> st;
    string str;

    while(cin >> str){
        if(str == "+"){
            int a = stoi(st.top());
            st.pop();
            int b = stoi(st.top());
            st.pop();
            st.push(to_string(a+b));
        }else if(str == "-"){
            int a = stoi(st.top());
            st.pop();
            int b = stoi(st.top());
            st.pop();
            st.push(to_string(b-a));
        }else if(str == "*"){
            int a = stoi(st.top());
            st.pop();
            int b = stoi(st.top());
            st.pop();
            st.push(to_string(a*b));
        }else if(str == "/"){
            int a = stoi(st.top());
            st.pop();
            int b = stoi(st.top());
            st.pop();
            st.push(to_string(a/b));
        }else{
            st.push(str);
        }
    }
    cout << st.top() << endl;
}

Measured memory_bytes: 3292
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/





int N;
//---------------------------------------------------------------------------------------------------
int check(vector<int> &v) {
    rep(i, 0, 9) if (v[0] != v[i]) return 0;
    rep(i, 9, 12) if (v[9] != v[i]) return 0;
    rep(i, 12, 15) if (v[12] != v[i]) return 0;
    rep(i, 15, 18) if (v[15] != v[i]) return 0;
    rep(i, 18, 21) if (v[18] != v[i]) return 0;
    rep(i, 21, 30) if (v[21] != v[i]) return 0;
    return 1;
}
pair<int, int> E[4][5] = {
    {{7,22},{8,23} ,{9,24} ,{18,13} ,{10,12} }
    ,{ {3 , 22},{ 6, 25} ,{ 9, 28} ,{ 12, 19} ,{13 ,15 } }
    ,{ {1 , 24},{ 4,27 } ,{7 ,30 } ,{ 10,21 } ,{16 , 18} }
    ,{ {1 ,28 },{2 ,29 } ,{3 , 30} ,{21 ,19 } ,{15 ,16 } }
};
//---------------------------------------------------------------------------------------------------
int solve() {
    vector<int> v;
    rep(i, 0, 30) { int p; cin >> p; v.push_back(p); }

    set<vector<int>> done;
    if (check(v)) return 0;
    queue<vector<int>> que;

    done.insert(v);
    que.push(v);
    rep(i, 1, 8) {
        queue<vector<int>> que2;

        while (!que.empty()) {
            vector<int> q = que.front(); que.pop();

            rep(j, 0, 4) {
                vector<int> qq = q;
                rep(k, 0, 5) swap(qq[E[j][k].first - 1], qq[E[j][k].second - 1]);
                if (done.count(qq)) continue;
                if (check(qq)) return i;
                que2.push(qq);
                done.insert(qq);
            }
        }

        swap(que, que2);
    }
    return 8;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(_, 0, N) cout << solve() << endl;
}



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

int main(){
    int n ;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    int cnt = 0;
    for(int i = 0; i < n-2; i++){
        if(p[i] < p[i+1]&& p[i+1] < p[i+2]) cnt++;
        else if(p[i]> p[i+1]&& p[i+1] > p[i+2]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
k = int(input())
x, y = [int(x) for x in input().strip().split(" ")]
x, y = x-y, x+y

def main():
    if k % 2 == 0:
        if x % 2 != 0:
            return -1
    return to(x,y)

def cc(x, xs):
        if abs(x-xs) <= 2*k:
            if abs(x+k-xs) % 2 == k % 2:
                if abs(x+k-xs) <= abs(x-k-xs):
                    xs = x+k
                else:
                    xs = x-k
                return (True,xs)
            else:
                if x > xs:
                    xs += k
                else:
                    xs -= k
        else:
            if x > xs:
                xs += k
            else:
                xs -= k
        return (False,xs)


def to(x, y):
    rs = []
    xs, ys = 0, 0
    while True:
        if abs(x-xs) == k or abs(y-ys) == k:
            if abs(x-xs) <= k and abs(y-ys) <= k:
                return rs + [(x, y)]
        mm, ys = cc(y, ys)
        if mm:
            if x > xs:
                xs += k
            else:
                xs -= k
        else:
            mm, xs = cc(x, xs)
        rs.append((xs, ys))

if __name__ == '__main__':
    jj = main()
    if jj == -1:
        print(-1)
    else:
        print(len(jj))
        for r in jj:
            print((r[0]+r[1])//2, (r[1]-r[0])//2)




Measured memory_bytes: 26324
#include <stdio.h>
#include <math.h>

int calculate_min_num_operations (int len_sequence, int num_elements_replacing)
{
    return ceil( ( (double)(len_sequence - (int)1) ) / ( (double)(num_elements_replacing - (int)1) ) );
}

int main (void)
{
    // variables for main process
    int len_sequence;
    int num_elements_replacing;
    int rtvl_scanf;

    // STEP.01
    // read out the given string
    rtvl_scanf = scanf("%d %d", &len_sequence, &num_elements_replacing);

    // STEP.02
    // calculate & output minumum value of the number of operations that can be realized in a given sequence
    printf("%d\n", calculate_min_num_operations (len_sequence, num_elements_replacing));

    // STEP.END
    return 0;
}

Measured memory_bytes: 128
// --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>

using namespace std;


int main(int argc, char* argv[]) {

	long long X,ans=1;

	cin >> X;

	for(int i=1;i<sqrt((double)X);i++){
		for(int j=2;j<sqrt((double)X);j++){
			if(pow((double)i,(int)j) <= X && pow((double)i,(int)j) > ans){
				ans = pow((double)i,(int)j);
			}
		}
	}

	cout << ans << endl;

	return 0;

}



Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::pair;
using std::swap;
using std::sort;
using std::lower_bound;
using std::unique;
using std::abs;

using int64 = long long int;
using pii   = pair<int, int>;
using pii64 = pair<int64, int64>;

const int NIL = -1;
const int INF = (int)2e9;
const int64 INF64 = (int64)2e18;

void init_IO() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
}

template<typename T>
std::ostream& operator<<(std::ostream& os, const vector<T>& vec) {
	os << '[';
	int fst = 1;

	for(auto& elem: vec) {
		if(fst == 0) {
			os << ' ';
		}

		os << elem;
		fst = 0;
	}

	os << ']';
	return os;
}

const int MAX_N = (int)1e5 + 777;

vector<pii> g[MAX_N];
int color[MAX_N], n;

void dfs(int v, int parent) {
	for(auto& ed: g[v]) {
		int u = ed.first;

		if(u != parent) {
			color[u] = color[v] ^ (ed.second);
			dfs(u, v);
		}
	}
}

void solve() {
	cin >> n;

	for(int i = 0; i < n - 1; ++i) {
		int v, u, w;
		cin >> v >> u >> w;
		--v, --u;

		g[v].emplace_back(u, w & 1);
		g[u].emplace_back(v, w & 1);
	}

	dfs(0, NIL);

	for(int i = 0; i < n; ++i) {
		cout << color[i] << '\n';
	}
}

int main() {
	init_IO();
	solve();

	return 0;
}


Measured memory_bytes: 8448
#include<iostream>

using namespace std;

int main(){

	int N,A,B,C,X;

	while(cin>>N>>A>>B>>C>>X,N){
		int *Y=new int [N];

		for(int i=0;i<N;i++)	cin>>Y[i];
		int kekka=0;
		int cnt=0;
		for(int j=0;j<10001;j++){
			if(Y[cnt]==X){
					cnt++;
				}
			X=(X*A+B)%C;
			if(cnt==N){
				cout<<kekka<<endl;
				delete []Y;
				break;
			}
			kekka++;
			if(kekka>10000){
				cout<<-1<<endl;
				delete []Y;
				break;
			}
		}

	}
}

Measured memory_bytes: 1196
#!/usr/bin/env python3

def main():
    s = input().split()
    sa, sb = s[0], s[1]
    a, b = int(sa), int(sb)
    ap = int(sa[0] + sa[1] + sa[2] + sa[1] + sa[0])
    bp = int(sb[0] + sb[1] + sb[2] + sb[1] + sb[0])
    da = int(a / 100)
    db = int(b / 100)
    if ap < a:
        da += 1
    if b < bp:
        db -= 1


    print(db - da + 1)


if __name__ == '__main__':
    main()



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

#define int long long
#define double long double

//main.cpp-Sample


namespace math
{
	double PI = 3.14159265359;
	int step(int n);
	int ncr(int n,int r);

	int step(int n){
		if(n<=1){
			return 1;
		}else{
			return n * step(n-1);
		}
	}
	int ncr(int n,int r){
		for(int i=1;i<r;i++){
			n *= n-i;
		}
		for(int i=1;i<r;i++){
			r *= r-1;
		}
		return n/r;
	}
}


using namespace std;
signed main (){
	int n;
	cin >> n;
	if((n & 0b1)==1){
		cout<<n/2*(n/2+1)<<endl;
	}else{
		cout<<(n/2)*(n/2)<<endl;
	}
	return 0;
}




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

int main() {
    int N, M; cin >> N >> M;

    priority_queue<long long> que;
    for (int i = 0; i < N; ++i) {
        long long A; cin >> A; que.push(A);
    }
    for (int i = 0; i < M; ++i) {
        long long t = que.top(); que.pop();
        que.push(t/2);
    }
    long long res = 0;
    while (!que.empty()) res += que.top(), que.pop();
    cout << res << endl;
}

Measured memory_bytes: 1400
#include <cstdio>
#include <iostream>

using namespace std;

const long long MOD = 1000000007;

int H, W, A, B;

long long fact[200010];

inline long long madd(long long a, long long b) { return (a+b) % MOD; }
inline long long mmul(long long a, long long b) { return (a*b) % MOD; }

long long mpow(long long a, long long p) {
    if (p == 0) return 1;
    if (p == 1) return a;
    long long half = mpow(a, p/2);
    long long ret = mmul(half, half);
    if (p % 2) ret = mmul(ret, a);
    return ret;
}

long long bino(int n, int k) {
    long long ret = 1;
    while (n || k) {
        long long nn = n % MOD, kk = k % MOD;
        if (nn < kk) return 0;
        ret = mmul(ret, fact[nn]);
        ret = mmul(ret, mpow(mmul(fact[kk], fact[nn-kk]), MOD-2));
        n /= MOD, k /= MOD;
    }
    return ret;
}

long long count(int r, int c) {
    return bino(r+c, min(r, c));
}

long long solve() {
    fact[0] = 1;
    for (int n = 1; n < 200010; n++) fact[n] = mmul(fact[n-1], n);
    long long ret = 0;
    for (int r = 1; r <= H-A; r++)
        ret = madd(ret, mmul(count(r-1, B-1), count(H-r, W-B-1)));
    return ret;
}

int main() {
    scanf("%d%d%d%d", &H, &W, &A, &B);
    long long ans = solve();
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  string s;
  cin >> s;

  if(s[0] != s[1] && s[1] != s[2] && s[2] != s[0]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

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

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

int main(){
    int T,i,j,x;
    int n;

    cin>>n;
    bool ok=0;

    int g;
    scanf("%d",&g);
    for(i=1;i<n;i++){
        scanf("%d",&x);
        if(!ok){
            g=gcd(g,x);
            if(g==1) ok=1;
        }

    }
    printf("%d\n",g);



return 0;
}


Measured memory_bytes: 3788
#!/usr/bin/env python3
import sys
import collections


def solve(N: int, K: int, A):
    c = collections.Counter(A).most_common()
    z = 0
    m = len(c)
    for i in range(m - K):
        z += c[m - i -1][1]
    print(z)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A)

if __name__ == '__main__':
    main()


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

int main(){
	int a[7],k,flag = 0;
  for(int i = 1;i<=5;i++){
    cin >> a[i];
  }
  sort(a+1,a+5+1);
  cin >> k;
  for(int i =1;i<=5;i++){
    for(int j = i+1;j<=5;j++){
        if(a[j]-a[i]>k)flag = 1;
    }
  }
  if(flag) cout << ":(" <<endl;
  else cout << "Yay!" <<endl;
return 0;
}

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

int main(){
    int a,b;
    int d,r;
    double f;

    std::cin>>a>>b;


    d=a/b;
    r=a%b;
    f=(double)a/(double)b;

    std::cout<<std::fixed;
    std::cout<<d<<" "<<r<<" "<<std::setprecision(5)<<f<<std::endl;

    return 0;
}


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

int g[8][8];

int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a][b] = true;
    g[b][a] = true;
  }

  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
  }
  int ans = 0;
  do {
    if (p[0] != 0) continue;
    bool ok = true;
    for (int i = 0; i < n - 1; i++) {
      if (!g[p[i]][p[i + 1]]) {
        ok = false;
      }
    }
    if (ok) {
      ans++;
    }
  } while (next_permutation(p.begin(), p.end()));
  cout << ans << endl;
}


Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>n;
    if(30<=n) Yes;
    else No;

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
 /* #ifndef ONLINE_JUDGE
      // for getting input from input.txt
      freopen("input.txt", "r", stdin);
      // for writing output to output.txt
      freopen("output.txt", "w", stdout);
  #endif*/
fast();
//ll  t;cin>>t;while(t--)
{
  ll b,h,n=3;
 ll int a[n];for(int i=0;i<n;i++)cin>>a[i];
 s()
 if(a[0]+a[1]==a[2])
 {
  Yes
 }
else
{
  No;
}
  
  
  

}
return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

answers = [
    [0, 1, 2],
    [3, 4, 5],
    [6, 7, 8],
    [0, 3, 6],
    [1, 4, 7],
    [2, 5, 8],
    [0, 4, 8],
    [2, 4, 6],
]

A = []
A.extend(list(map(int, input().split())))
A.extend(list(map(int, input().split())))
A.extend(list(map(int, input().split())))

N = int(input())

b = []
for i in range(N):
    b.append(int(input()))

hole = []
for i in b:
    if i in A:
        hole.append(A.index(i))
    else:
        continue

for answer in answers:
    i, j, k = answer
    if i in hole and j in hole and k in hole:
        print("Yes")
        exit(0)
print("No")


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

namespace ABC158B
{
    class Program
    {
        static void Main(string[] args)
        {
            var NAB = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var N = NAB[0];
            var A = NAB[1];
            var B = NAB[2];

            if (N <= A)
            {
                Console.WriteLine(N);
                return;
            }

            if (A + B >= N)
            {
                Console.WriteLine(A);
                return;
            }

            var ans = 0L;
            long rem;
            var d = Math.DivRem(N, A + B, out rem);

            ans = A * d + Math.Min(A, rem);

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;

int solve() 
{
	//happy coding

	string s1,s2;
	cin>>s1>>s2;
	if(s1 == s2.substr(0,s1.size())){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <stdlib.h>

int n, key;
struct node{
  struct node *left;
  struct node *right;
  struct node *parent;
  int key;
};

struct node *t;
struct node *root, *NIL;

void insert(struct node *, int key);
struct node* find(struct node *, int key);
void inorder(struct node *t);
void preorder(struct node *t);
	  
int main(){

  int i, j, k;
  char order[20];
  struct node *result;
  
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%s", order);

    if(order[0]=='i'){
      scanf("%d", &key);
      insert(t, key);
     
    }//insert

    else if(order[0]=='f'){

      scanf("%d", &key);
      result=find(root, key);
      if(result != NIL) printf("yes\n");
      else printf("no\n");
      
    }
    
    else if(order[0]=='p'){
      
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }//print
  }
  return 0;
}

void insert(struct node *t, int key){

  struct node *y=NIL;
  struct node *x=root;
  struct node *z;

  z=(struct node*)malloc(sizeof(struct node));
  z->key=key;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL){//適した入れる場所見付けるまで繰り返す
    y=x;
    if(z->key < x->key){
      x=x->left;
    }
    else x=x->right;
  }
  z->parent=y;

  if(y==NIL){
    root = z;
  }
  else {
    if(z->key < y->key){
    y->left = z;
    }
    else y->right=z;
  }
}
struct node* find(struct node *x, int key){

  while(x!=NIL && x->key!=key){

    if(key< x->key) x=x->left;
    else x=x->right;
    
  }
  return x;  
}
void inorder(struct node *t){

  if(t==NIL) return;

  inorder(t->left);
  printf(" %d", t->key);
  inorder(t->right);
}
void preorder(struct node *t){

  if(t==NIL) return;
  printf(" %d", t->key);
  preorder(t->left);
  preorder(t->right);
}
  




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

int ask(int a, int b){
    cout << "? " << a << " " << b << endl;
    int d;
    cin >> d;
    if(d == -1) exit(0);
    return d;
}

int main(){
    int N, S, T;
    cin >> N >> S >> T;
    int D = ask(S, T);

    vector<pair<int, int>> cand;

    for(int i=1; i<=N; i++) if(S != i && T != i){
        int d1 = ask(i, S);
        int d2 = ask(i, T);
        if(d1+d2 == D) cand.emplace_back(d1, i);
    }

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

    int ld = 0;
    vector<int> ans = {S};
    for(auto& p : cand){
        int b = ans.back();
        int i = p.second;
        int d1 = ask(b, i);
        int d2 = ask(i, T);
        if(ld + d1 + d2 == D){
            ld = p.first;
            ans.push_back(i);
        }
    }
    ans.push_back(T);

    cout << "!";
    for(int a : ans) cout << " " << a;
    cout << endl;

    return 0;
}



Measured memory_bytes: 4648
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdio>
#include<set>
#include<map>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++) 
#define lint long long
#define all(x) (x).begin(), (x).end()


int gcd(int x, int y){
    if (x > y)
        return gcd(y, x);
    int m = 1;
    while(m != 0){
        m = y % x;
        y = x;
        x = m;
    }
    return y;
}

int main(){
    string s; cin>>s;
    int n = s.size();
    int cnt0 = 0; int cnt1 = 0;
    rep(i, n){
        if(s[i] == '0') cnt0++;
        else cnt1++;
    }
    cout << min(cnt0, cnt1)*2 << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(void){
  long n,m;
  long a[100000];
  long b[100000];
  vector<pair <int, int> > vect;
  cin>>n>>m;
  REP(i,n){
    int a,b;
    cin>>a>>b;
    vect.push_back(make_pair(a,b));
  }
  SORT(vect);
  REP(i,n){
    a[i]=vect[i].first;
    b[i]=vect[i].second;
  }
  long ans=0;
  REP(i,n){
    if(m>=b[i]){
      m-=b[i];
      ans+=a[i]*b[i];
    }
    else{
      ans+=a[i]*m;
      break;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 2804
#include<cstdio>
#include<cctype>
#include<algorithm>
using namespace std;
long long n,ans,a[200005];
inline long long read(){
	long long x=0;char ch=getchar();
	while (!isdigit(ch)) ch=getchar();
	while (isdigit(ch)) x=(x<<3)+(x<<1)+ch-48,ch=getchar();
	return x;
}
int main()
{
	n=read();
	for (int i=1;i<=n;++i) a[i]=read()-i;
	sort(a+1,a+1+n);long long mid=a[n+1>>1];
	for (int i=1;i<=n;++i) ans+=abs(a[i]-mid);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1664
//I am so vegetable
//#define _LOCAL_
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll N = 2e5 + 5;
const int MOD = 10000;
const double eps = 1e-6;
const double pi = acos(-1);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }

int main() {
	FIO;
	ll n,k;cin>>n>>k;
	if(n==k)cout<<0;
	else {
		if(n>k)n-=n/k*k;
		if(n>k/2)cout<<k-n;
		else cout<<n;
	}
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    H=[input() for i in range(N)]
    W=[input() for i in range(M)]
    dh=defaultdict(int)
    dw=defaultdict(int)
    for i in range(N):
        s=H[i]
        dh[s]+=1
        for j in range(i+1,N):
            s+=H[j]
            dh[s]+=1
    for i in range(M):
        s=W[i]
        dw[s]+=1
        for j in range(i+1,M):
            s+=W[j]
            dw[s]+=1
    print sum(dh[h]*dw[h] for h in dh if h in dw)

Measured memory_bytes: 53220
#include <stdio.h>
#include <math.h>
 
#define PI 3.1415926535897932384626433832795
 
double d; int a;
double vcos[6], vsin[6];
double x, y;
 
void koch_curve(int k)
{
    if (k == 0) {
        x += d*vcos[a % 6], y += d*vsin[a%6];
        printf("%.8lf %.8lf\n", x, y);
    } else {
        d /= 3;
        koch_curve(k-1), a++, koch_curve(k-1);
        a += 4;
        koch_curve(k-1), a++, koch_curve(k-1);
        d *= 3;
    }
}
 
int main()
{
    int n, i;
     
    for (i = 0; i < 6; i++) vcos[i] = cos(i*PI/3), vsin[i] = sin(i*PI/3);
 
    scanf("%d", &n);
 
    d = 100;        // (0,0) - (100,0);
 
    a = 0, x = 0, y = 0; puts("0.00000000 0.00000000");
    koch_curve(n);
    return 0;
}



Measured memory_bytes: 2100
#include<stdlib.h>
#include<stdio.h>
#include<iostream>
#include<algorithm>

using namespace std;
int main()
{
	int V[22];
	int C[22];
	int D[22];
	int N = 0;
	cin >> N;
	for(int i = 1; i <= N; i++)
	{
		cin >> V[i];
	}
	for (int i = 1; i <= N; i++)
	{
		cin >> C[i];
	}

	for (int i = 1; i <= N; i++)
	{
		D[i] = V[i] - C[i];
	}
	int ans = 0;

	for (int i = 1; i <= N; i++)
	{
		if (D[i] > 0)
		{
			ans = ans + D[i];
		}
	}
	cout << ans << endl;
	// system("pause");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner
import java.io.PrintWriter

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    var a: Seq[(Int, Int)] = Seq()
    for (i <- 0 until n) {
      a +:= (sc.nextInt(), i + 1)
    }
    a = a.sortBy(_._1)
    val pw = new PrintWriter(System.out)
    for (ans <- a) {
      pw.print(s"${ans._2} ");
    }
    pw.println()
    pw.flush()
  }
}

Measured memory_bytes: 80220
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int t[1100000];

bool check(int n){
	int m=n-1;
	int i,j;
	for(i=0;(1<<i)<=m;i++){
		int a=1<<i;
		if((m&a)==0)continue;
		for(j=n;j>=a;j--){
			t[j]+=t[j-a];
			t[j]&=1;
		}
	}
	if(t[m]==0)return true;
	return false;
}

string sa;

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n;
	cin>>sa;
	a=0;
	for(i=0;i<n;i++){
		t[i]=(int)sa[i]-(int)'1';
		if(t[i]==1)a++;
	}
	if(a==0){
		for(i=0;i<n;i++){
			t[i]/=2;
		}
		if(check(n))cout<<0<<endl;
		else cout<<2<<endl;
	}else if(check(n))cout<<0<<endl;
	else cout<<1<<endl;
}

Measured memory_bytes: 5380
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll INF=1e10+100;
const ll white=0;
const ll gray=1;
const ll black=2;

vector<pll> m[100005]; 

ll v,r;

void dijkstra(){
    priority_queue<pll> PQ;
    ll color[v];
    ll d[v];
    rep(i,v){
        d[i]=INF;
        color[i]=white;
    }
    d[r]=0;
    PQ.push(make_pair(0,r));
    color[r]=gray;
    while(!PQ.empty()){
        pll f=PQ.top();
        PQ.pop();
        ll u=f.second;
        color[u]=black;
        if(d[u]<f.first*(-1)) continue;
        for(ll j=0;j<m[u].size();j++){
            ll v=m[u][j].first;
            if(color[v]==black) continue;
            if(d[v]>d[u]+m[u][j].second){
                d[v]=d[u]+m[u][j].second;
                PQ.push(make_pair(d[v]*(-1),v));
                color[v]=gray;
            }
        }
    }
    rep(i,v){
        if(d[i]==INF){
            cout << "INF" << endl;
        }
        else{
            cout << d[i] << endl;
        }
    }
}

int main()
{
    ll e;
    cin >> v >> e >> r;
    rep(i,e){
        ll s;
        ll t;
        ll c;
        cin >> s >> t >> c;
        m[s].push_back(make_pair(t,c));
    }
    dijkstra();
} 


Measured memory_bytes: 20172
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(x) for(auto it=(x).begin();it!=(x).end();it++) 
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
 
using namespace std;
int n;
bool f=false;
vector<int> v;

void dfs(int sum,int i,int num){
    if(i==n){
        if(sum==num)f=true;
        return ;
    }
    dfs(sum+v[i],i+1,num);
    dfs(sum,i+1,num);
    return;
}


int main(){
    cin>>n;
    v.resize(n);
    rep(i,0,n)cin>>v[i];
    
    int m; cin>>m;
    vector<int> vv(m);
    rep(i,0,m){
        cin>>vv[i];
        dfs(0,0,vv[i]);
        if(f)cout<<"yes"<<endl;
        else cout<<"no"<<endl;
        f=false;
    }
    
    
    
    
    return 0;
}


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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n {0};
  string s = "";
  cin >> n;
  cin >> s;
  string s1 = "";
  string s2 = "";
  if (n%2 == 1){
      cout << "No" << "\n";
  }
  else {
    for(int i = 0; i < n/2; i = i + 1){
          s1 = s1 + s[i];
          s2 = s2 + s[i + n/2];
      }
    if(s1.compare(s2) == 0){
        cout << "Yes" << "\n";
    }
    else{
        cout << "No" << "\n";
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  string a;
  cin >> a;
  bool flag;
  int ans = 0;
  REP(i, a.size()){
    for(int j = i;j < a.size();j ++ ){
      string tmp = a.substr(i,j - i + 1);
      flag = true;
      for(int k = 0; k < j - i + 1;k ++ ){
	if(tmp[k] == 'A'||tmp[k] == 'G'||tmp[k] == 'T'||tmp[k] == 'C'){
	  flag = true;
	}else{flag = false; break;}
      }
      if(flag){
	ans = max(ans, j - i + 1);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static const int N=200010;
int R[N],n;
int main() {
    cin>>n>>R[0];
    int minv=R[0],maxv=-2000000000;
    for (int i = 1; i < n; ++i) {
        cin>>R[i];
        if(maxv<R[i]-minv) maxv=R[i]-minv;
        if(minv>R[i]) minv=R[i];
    }
    cout<<maxv<<endl;
    return 0;
}



Measured memory_bytes: 3860
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

S = input()
T = input()

l = len(S)
m = len(T)
ans = 1 << 28
for i in range(l - m + 1):
    cnt = 0
    for j in range(m):
        if S[i + j] != T[j]:
            cnt += 1
    ans = min(ans, cnt)

print(ans)

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

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	int N;
	cin >> N;
	int M=0, sum=0;
	while(sum<N){
		M++;
		sum+=M;
	}
	vector<int> ans;
	rep(i,M){
		if(i+1==sum-N) continue;
		ans.emplace_back(i+1);
	}
	rep(i,ans.size()) cout << ans[i] << endl;

	return 0;
}

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

int main(){
    int m,d;
    cin>>m>>d;
    int ans=0;
    for(int i=1; i<=m; ++i){
        for(int j=1; j<=d; ++j){
            int x=j%10,y=j/10;
            if(x>=2&&y>=2&&x*y==i)ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
	int n,k;
	int ans=0;
	cin>>n>>k;
	vector<int>p(n);
	rep(i,n){
		cin>>p[i];
	}
	sort(p.begin(),p.end());
	rep(i,k){
		ans+=p[i];
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3612
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()




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

	int ans = 0;
	long long n, d;
	cin >> n >> d;
	rep(i, n) {
		long long x, y;
		cin >> x >> y;
		if (x * x + y * y <= d * d)ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3644
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<ctype.h>
#include<cwchar>
#include<cwctype>
#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<math.h>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<stdio.h>
#include<stdlib.h>
#include<streambuf>
#include<string.h>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
using namespace std;
vector<int> adj[100010];
int rnk[100010];
int ism[100010];
int cnt[100010];
int n;
void dfs(int fa,int i){
	for (int j=adj[i].size()-1;~j;j--){
		if (adj[i][j]!=fa){
			rnk[adj[i][j]]=rnk[i]+1;
			dfs(i,adj[i][j]);
			cnt[i]+=cnt[adj[i][j]];
			ism[i]|=ism[adj[i][j]];
		}
	}
}
int main(void){
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		int a,b;
		cnt[i]=1;
		scanf("%d%d",&a,&b);
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	ism[n]=1;
	cnt[n]=1;
	rnk[1]=1;
	dfs(-1,1);
	int mxrnk=(rnk[n]+3)>>1,ans;
	for (int i=1;i<=n;i++){
		if (rnk[i]==mxrnk&&ism[i]){
			ans=cnt[i];
			break;
		}
	}
	printf("%s",(n-ans>ans)?"Fennec":"Snuke");
	return 0;
}

Measured memory_bytes: 13184
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<queue>

using namespace std;

long long n,m;

int main(){
  cin>>n>>m;
  if( n%m != 0 ) cout<<n<<endl;
  else cout<<"-1"<<endl;
  return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  atCoder
//
//  Created by 佐々木勇星 on 2019/07/23.
//  Copyright © 2019 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <regex>


int main(void) {
    
    using namespace std;
    
    int N;
    cin >> N;
    cout << N * N * N << endl;
    
    return 0;
}


Measured memory_bytes: 256