akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    string S; cin >> S;
    int N = SZ(S);

    int ans = 0, t = 0, p = 1;
    vec cnt(2019, 0);
    cnt[t]++;
    IREP(i, N){
        (t += p * (S[i] - '0')) %= 2019;
        (p *= 10) %= 2019;
        ans += cnt[t];
        cnt[t]++;
    }
    Out(ans);

    return 0;
}


Measured memory_bytes: 3648
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){n(1)(n(2).readFileSync("/dev/stdin","UTF-8"))},function(e,t){e.exports=function(e){var t=e.split("\n"),n=Number(t[0]);console.log(n*n*n)}},function(e,t){e.exports=require("fs")}]);

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

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    for(int i = 0; i < n; i++){
        cin >> d.at(i);
    }
    sort(d.begin(),d.end());
    int abc = d.at(n/2 -1);
    int arc = d.at(n/2);
    cout << arc - abc << endl;
}


Measured memory_bytes: 640
void main() {
	alias Pair = Tuple!(int, "start", int, "end");
	auto ip = readAs!(int[]), N = ip[0], M = ip[1];
	Pair[] pairs;
	foreach(i; 0..M) {
		auto ip2 = readAs!(int[]), a = ip2[0], b = ip2[1];
		pairs ~= Pair(a, b);
	}
	pairs.sort!"a.end < b.end";
	int p, res;
	foreach(i; pairs) {
		if(p <= i.start) {
			p = i.end;
			res++;
		}
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 4092
#include <bits/stdc++.h>
#define println(cont, type) copy(cont.begin(), cont.end(), ostream_iterator<type>(cout, " "))
using namespace std;

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

int main()
{
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b + c > 21 ? "bust" : "win");

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define M 100

void push(int);
int pop(void);
int A[M];
int top=0;

int main()
{
  int i,x,y,z;
  char s[M];
  while(scanf("%s",s)!=EOF)
    {
      if(s[0]==' ') i++;
      if(s[0]=='+')
	{
	  x=pop();
	  y=pop();
	  push(x+y);
	}
     else if ( s[0]=='-')
       {
	 x=pop();
	 y=pop();
	 push(y-x);
       }
     else if ( s[0]=='*')
       {
         x=pop();
	 y=pop();
	 push(x*y);
       }
     else
       {
      z=atoi(s);
      push(z);
       }
    }
  printf("%d\n",pop());
  return 0;
}

int pop()
{
  if(top==0)
    {
      printf("Stack is empty\n");
      exit(1);
    }
  top--;
  return A[top+1];
}

void push(int x)
{
  if(top==100)
    {
      printf("Stack overflow\n");
      exit(1);
    }
  top++;
  A[top]=x;
}
    



Measured memory_bytes: 2048
#include<bits/stdc++.h> 
using namespace std;
long long s, n, m, h[100005], a, b, z[100005];
int main(){
	scanf("%lld%lld", &n, &m);
	for(long long i=1; i<=n; i++){
		scanf("%lld", &h[i]);
	}
	for(long long i=1; i<=m; i++){
		scanf("%lld%lld", &a, &b);
		if(h[a]>h[b]){
			z[b]++;
		}
		else if(h[b]>h[a]){
			z[a]++;
		}
		else{
			z[a]++;
			z[b]++;
		}
	}
	for(long long i=1; i<=n; i++){
		if(z[i]==0){
			s++;
		}
	}
	printf("%lld", s);
	return 0;
}

Measured memory_bytes: 5356
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> t(n+1), x(n+1), y(n+1);
  for(int i=1; i<n+1; i++){
    cin >> t[i] >> x[i] >> y[i];
  }
  bool ok = true;
  for(int i=0; i<n; i++){
    if((t[i+1] - t[i]) % 2 != abs(x[i+1] - x[i] + y[i+1] - y[i]) % 2 || abs(x[i+1] - x[i] + y[i+1] - y[i]) > t[i+1] - t[i]){
      ok = false;
      
    }
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long tint;
 
const tint INF = 2e14+1;
const long double PI = 3.141592;
const int MOD = 998244353;
 
#define forsn(i, s, n) for(int i=s;i<int(n);i++)
#define forn(i, n) forsn(i, 0, n)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define NACHO ios_base::sync_with_stdio(0);cin.tie(NULL);
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

int contWA[110000];
int contAC[110000];

int main(){
	int n, m; cin >> n >> m;
	forn(i,m){
		int a; string b;
		cin >> a >> b;
		if(b == "WA" && !contAC[a-1]) contWA[a-1]++;
		else contAC[a-1]++;
	}
	int conta = 0, contw = 0;
	forn(i, n){
		if(contAC[i]){
			contw+=contWA[i];
			conta++;
		}
	}
	cout << conta << " " << contw << "\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    int a,b;
    cin>>a>>b;
    if(a*b==15||a+b==15){
        if(a+b==15){
            cout<<"+"<<endl;
        }
        else{
            cout<<"*"<<endl;
        }
    }
    else{
        cout<<"x"<<endl;
    }
}


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

int n;
int a[1000000];
int cnt;

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

void shellSort() {
	int g[100000];
	g[0] = 1;
	int m = 0;
	while (g[m] <= n) {
		g[m + 1] = 3 * g[m] + 1;
		m ++;
	}
	printf("%d\n", m);
	for (int i = m - 1; i >= 0; i --) {
		if (i < m - 1) printf(" ");
		printf("%d", g[i]);
	}
	puts("");
	for (int i = m - 1; i >= 0; i --) {
		insertionSort(g[i]);
	}
	printf("%d\n", cnt);
	for (int i = 0; i < n; i ++) {
		printf("%d\n", a[i]);
	}
}

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

Measured memory_bytes: 4956
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
typedef long long int lli;

const vector<int> reset_vec(26, 0);

int main(){
    vector<int> alphabet_num(26, 50);
    vector<int> alphabet_num_count(26, 0);
    int n;
    cin >> n;

    for(int i = 0; i < n; ++i){
        string s;
        cin >> s;

        alphabet_num_count = reset_vec;
        for(int j = 0; s[j] != '\0'; ++j){
            alphabet_num_count[s[j] - 'a']++;
        }

        for(int j = 0; j < 26; ++j){
            alphabet_num[j] = min(alphabet_num[j], alphabet_num_count[j]);
        }
    }

    for(int i = 0; i < 26; ++i){
        for(int j = 0; j < alphabet_num[i]; ++j){
            char c = 'a' + i;
            cout << c;
        }
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int n,A[50];
int solve(int i,int m)
{
    if(m == 0) return 1;
    if(i>=n) return 0;
    int res = solve(i+1,m)|| solve(i+1,m-A[i]);
}
int main()
{
    int q,M,i;
    scanf("%d",&n);
    for(i = 0;i<n;i++) scanf("%d",&A[i]);
    scanf("%d",&q);
    for( i = 0 ;i<q;i++)
    {
        scanf("%d",&M);
        if(solve(0,M)) printf("yes\n");
        else printf("no\n");
    }
}



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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 1e5;

ll n;

ll cal(ll p, ll x)
{
    ll rs = 0;
    p *= x;
    while (n / p)
    {
        rs += n / p;
        p *= x;
    }
    return rs;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    if (n & 1)
    {
        cout << 0;
    }
    else
    {
        cout << min(cal(1, 2), cal(2, 5));
    }
    return 0;
}


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

int main(){
  int N,T;
  cin>>N>>T;
  int dan=100001;
  for(int i=0; i<N;i++){
    int c,t;
    cin>>c>>t;
    if(t<=T){
      dan=min(dan,c);
    }
  }
  if(dan>100000){
    cout<<"TLE"<<endl;
  }
  else{
    cout<<dan<<endl;
  }
}

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

#define MT make_tuple
#define all(x) begin(x), end(x)
#define putchar(x) cout << (x)
static int fastio = [](){ ios_base::sync_with_stdio(false); cin.tie(0); cout.precision(17); return 0; }();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename ...T> string format(const string& fmt, T&&... args) {
    size_t sz = snprintf(nullptr, 0, fmt.c_str(), args...) + 1;
    unique_ptr<char[]> buf(new char[sz]);
    snprintf(buf.get(), sz, fmt.c_str(), args...);
    return string(buf.get(), buf.get() + sz - 1);
}

template<class T> struct rge { T b, e; auto begin() const { return b; } auto end() const { return e; } };
template<class T> rge<T> range(T i, T j) { return rge<T>{i, j}; }
template<class T> auto dud(T* x) -> decltype(cerr << *x, 0);
template<class T> char dud(...);

struct debug {
#if DEBUG == 2
    debug(int line) {
        if(line) cerr << "LINE(" << line << ") -> ";
    }
    template<class T> typename enable_if<sizeof dud<T>(0) != 1, debug&>::type operator<<(T i) {
        cerr << boolalpha << i; return * this;
    }
    template<class T> typename enable_if<sizeof dud<T>(0) == 1, debug&>::type operator<<(T i) {
        return *this << range(begin(i), end(i));
    }
    template<class T, class U> debug& operator<<(pair<T, U> d) {
        return *this << "(" << d.first << ", " << d.second << ")";
    }
    debug& operator<<(tuple<>&) { return *this << "()"; };
    template<class ...T> debug& operator<<(tuple<T...> d) {
        *this << "("; debug_tuple<sizeof...(T), 0>(d);
        return *this << ")";
    }
    template<size_t L, size_t I, class T> void debug_tuple(const T& t) {
        *this << (I == 0 ? "" : ", ") << get<I>(t);
        if(I + 1 < L) debug_tuple<L, (I + 1) % L>(t);
    }
    template<class T> debug & operator <<(rge<T> d) {
        *this << "[";
        for(auto it = d.b; it != d.e; ++it)
            *this << (it != d.b ?  ", " : "") << *it;
        return *this << "]";
    }
    debug& operator<<(ostream&(*pf)(std::ostream&)) {
        cerr << pf; return *this;
    }
#else
    debug(int) {}
    template<class T> debug& operator<<(T&&) { return *this; }
    debug& operator<<(ostream&(*)(std::ostream&)) { return *this; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ << ": " << (__VA_ARGS__) << "] "

#define debug0()  debug(__LINE__)
#define debug1(x) debug(0)
#define GET_MACRO(_0, _1, NAME, ...) NAME
#define debug(...) GET_MACRO(_0, ##__VA_ARGS__, debug1, debug0)(__VA_ARGS__)
/*}}}*/
using LL = long long;

const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const LL LLINF = 0x3f3f3f3f3f3f3f3f;
const int MAX_N = 200005;

void solve(int) {
    int N, X, T;
    cin >> N >> X >> T;
    cout << ((N + X - 1) / X * T) << endl;
}

int main() {
    int T = 1;
    //cin >> T;
    for(int i = 1; i <= T; ++i) {
        solve(i);
    }
    return 0;
}


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

int main(){
  
  string a, b; cin >> a >> b;
  if(a.size() < b.size()) cout << "LESS" << endl;
  else if(a.size() > b.size()) cout << "GREATER" << endl;
  else{
    
    int n = (int)a.size();
    for(int i = 0; i < n; i++){
		if(a[i] < b[i]){ 
          cout << "LESS" << endl;
      	  return 0;
        }else if(a[i] > b[i]){
          cout << "GREATER" << endl;
          return 0;
        }
    }
    
    cout << "EQUAL" << endl;
  }
  
  return 0;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  char ch;
  
  for(int i=0; i<H+2;i++){
    for(int j=0; j< W+2; j++){
      if(i==0||i==H+2-1||j==0||j==W+2-1)cout << '#';
      else{
        cin >> ch;
        cout << ch;
      }
      if(j==W+2-1) cout << endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt()-1;
		int B = sc.nextInt()-1;
		int C = sc.nextInt()-1;
		int D = sc.nextInt()-1;
		String S = sc.next();
		if (C<D) {
			if (check(A,B,S) && check(B,D,S)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		} else {
			if (check(A,B,S) && check(B,D,S) && check(D,C,S) && canjump(B,D,S)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}

	public static boolean check(int s, int g,String S) {
		int flag=0;
		for (int i=s+1;i<g;i++) {
			if (S.charAt(i)=='#') {
				if (flag==0) {
					flag=1;
				} else {
					return false;
				}
			} else {
				flag=0;
			}
		}
		return true;
	}

	public static boolean canjump(int s, int g, String S){
		int flag=1;
		for (int i=s+1;i<g+1;i++) {
			if (S.charAt(i)=='.') {
				if (flag==0 || flag==1) {
					flag++;
				} else {
					return true;
				}
			} else {
				flag=0;
			}
		}
		if (S.charAt(s-1)=='.' && S.charAt(s+1)=='.') {
			return true;
		}
		if (S.charAt(g-1)=='.' && S.charAt(g+1)=='.') {
			return true;
		}
		return false;
	}
}


Measured memory_bytes: 27568
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
    int m,n,a[2000]={},i,count=0,sum=0;
    char token[3000000]={};
    fgets(token, sizeof(token), stdin);
    n=atoi(strtok(token, " "));m=atoi(strtok(NULL, " "));
    fgets(token, sizeof(token), stdin);
    a[0]=atoi(strtok(token, " "));sum+=a[0];
    for (i=1; i<n; i++) {
        a[i]=atoi(strtok(NULL, " "));
        sum+=a[i];
    }
    if (sum%(4*m)==0) {
        for (i=0; i<n; i++) {
            if(sum/(4*m)<=a[i]) count++;
        }
    }else{
        for (i=0; i<n; i++) {
            if(sum/(4*m)<a[i]) count++;
        }
    }
    
    if (count>=m) printf("Yes");
    else printf("No");
    return 0;
}




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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << endl; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

vector<Int> G[100001];
Int d[100001];
Int par[100001];

int main() {
    Int n, m;
    cin >> n >> m;
    for (Int i = 0; i < (Int)m; i++) {
        Int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for (Int i = 0; i < (Int)n; i++) {
        d[i] = INF;
    }
    d[0] = 0;
    queue<Int> q;
    q.push(0);
    while (not q.empty()) {
        Int p = q.front();
        q.pop();
        for (Int i = 0; i < (Int)G[p].size(); i++) {
            Int to = G[p][i];
            if (d[to] > d[p] + 1) {
                par[to] = p;
                d[to] = d[p] + 1;
                q.push(to);
            }
        }
    }
    print("Yes");
    for (Int i = 1; i < (Int)n; i++) {
        print(par[i] + 1);
    }
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    vector<ll> S(N + 1, 0);
    rep(i, N) {
        S[i + 1] += S[i] + A[i];
    }
    map<ll, ll> cnt;
    ll ans = 0;
    rep(i, N + 1) {
        ll s = S[i];
        ll now = (s - i) % K;
        ans += cnt[now];
        cnt[now]++;
        if (i - (K - 1) >= 0) {
            ll j = i - (K - 1);
            ll s2 = S[j];
            ll prev = (s2 - j) % K;
            cnt[prev]--;
        }
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

int main() {
    int a;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++){
        if (s[i] == 'o'){
            a++;
        }
    }
    if (15 - s.size() + a > 7){
        cout << "YES" << endl;
    }else{
    cout << "NO" << endl;
    }
}

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


int main()
{
    // input
    int m,k;
    cin >> m >> k;

    // solve
    if(k>=pow(2,m)) cout << "-1" << endl;
    else if(m==0){
        cout << "0 0" << endl;
    }
    else if(m==1){
        if(k==0) cout << "0 0 1 1" << endl;
        else if(k==1) cout << "-1" << endl;
    }
    else{
        for(int i=0; i<=pow(2,m)-1; i++){
            if(i==k) continue;
            cout << i << " " << endl;
        }
        cout << k << " " << endl;
        for(int i=pow(2,m)-1; i>=0; i--){
            if(i==k) continue;
            cout << i << " " << endl;
        }
        cout << k << " " << endl;
    }

    // output
    return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <queue>
#include <math.h>
#include <cmath>
#include <unordered_map>

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


int main(){
    int h,a;
    cin>>h>>a;
    if(h%a==0){
        cout<<h/a<<endl;
    }else{
        cout<<(h/a)+1<<endl;
    }

}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")

#include <bits/stdc++.h>
using namespace std;
 
#define len(x) (int)((x).size())
#define endl '\n'
#define int long long
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(9);
    solve();
    return 0;
}
 
const int MOD = 998244353, MAXN = 3e5 + 10, INF = 1e18 + 10;

void solve() {
	int k, n;
    cin >> k >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    vector<int> b(n);

    b[0] = a[0];
    for (int i = 1; i < n; ++i) {
        b[i] = a[i] - a[i - 1];
    }
    
    b[0] += (k - a.back());

    cout << k - *max_element(b.begin(), b.end()) << endl;
}	

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


void solve(long long N, std::vector<std::string> S){
  std::sort(S.begin(), S.end());
  S.erase(std::unique(S.begin(), S.end()), S.end());

  cout << ((S.size() == 3) ? "Three" : "Four") << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  std::vector<std::string> S(N);
  for(int i = 0 ; i < N ; i++){
    std::cin >> S[i];
  }
    solve(N, std::move(S));
    return 0;
}


Measured memory_bytes: 3652
n=int(input())
A=list(map(int,input().split()))
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal as D  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
from fractions import Fraction as F  #F(a,b)で正確なa/b
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########

C=Counter(A)
NUM=[]
if n%3!=0:
    if len(C)!=1 or A[0]!=0:
        print("No");exit()
    else:
        print("Yes");exit()
if all([i%(n//3)==0 for i in C.values()]):
    for i,v in C.items():
        if v==n//3:
            NUM.append(i)
        if v==n*2//3:
            NUM.append(i)
            NUM.append(i)
        if v==n:
            if i==0:print("Yes");exit()
            print("No");exit()
    a,b,c=NUM
    print("Yes" if a^b==c else "No");exit()
print("No")

Measured memory_bytes: 98700
N, M = map(int, input().split())
A = []
min_state = [10**9] * (2**N)
min_state[0] = 0
for _ in range(M):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))
    key = 0
    for tmp in c:
        key += 2**(tmp-1)
    A.append((a, key))
L = len(min_state)
for a, key in A:
    for i, score in enumerate(min_state):
        next_key = key | i

        if min_state[next_key] > score + a:
            min_state[next_key] = score + a
if min_state[-1] == 10**9:
    print(-1)
else:
    print(min_state[-1])



Measured memory_bytes: 3188
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <time.h>
#include <random>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#define LONG_INF 10000000000000000
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
using namespace std;
int main() {
#define int long long
	int n;
	cin >> n;
	vector<int> hoge;
	REP(i,3*n) {
		int tmp;
		cin >> tmp;
		hoge.push_back(tmp);
	}
	int ans = 0;
	sort(hoge.begin(), hoge.end());
	for (int i = 0;i < n;++i) {
		ans += hoge[(3 * n) - (2 * (i + 1))];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6000
#include<bits/stdc++.h>
 
#define rep(i,n) for(int i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;

int n,m,q;
vector<int> a,b,c,d;
int ans;

void dfs(vector<int> A){
    if(A.size() == n){
        int now = 0;
        rep(i,q) {
            if(A[b[i]-1] - A[a[i]-1] == c[i]) now += d[i];
        }
        ans = max(ans,now);
        return;

    }

    A.push_back(A.back());
    while(A.back() <= m){
        dfs(A);
        A.back()++;
    }

}

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

    string s,t;
    cin >> s >> t;
    rep(i,s.length()){
        if(s[i] == t[i]){
            continue;
        }else {
            cout << "No" << endl;
            return 0;
        }
    }
    if(t.length() -1 == s.length()) cout << "Yes" << endl;
    else cout << "No" << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>

const int INF = 1001001001;

int n;
std::vector<int> a, ans;
std::vector<std::vector<int>> to; //隣接情報
std::vector<int> dp; //Longest Increasing Subsequence

void dfs(int v, int p = -1){
	int i = std::lower_bound(dp.begin(), dp.end(), a[v]) - dp.begin();
	int old = dp[i];
	dp[i] = a[v];
	ans[v] = i;
	if(p != -1){
		ans[v] = std::max(ans[v], ans[p]);
	}
	for(int u : to[v]){
		if(u == p) continue;
		dfs(u, v);
	}
	dp[i] = old;
}

int main(){
	std::cin >>n;
	a = ans = dp = std::vector<int>(n);
	to = std::vector<std::vector<int>>(n);
	for(int i=0; i<n; i++){
		std::cin >> a[i];
	}
	for(int i=0; i<n-1; i++){
		int u, v;
		std::cin >> u >> v;
		u--;
		v--;
		to[u].push_back(v);
		to[v].push_back(u);
	}
	for(int i=0; i<n; i++){
		dp[i] = INF;
	}
	
	dp[0] = -INF;
	dfs(0);
	for(int i=0; i<n; i++){
		std::cout << ans[i] << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 27984
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1e9 + 7;
int INF = 2e18;

signed main() {
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i = 0; i < N; i++) cin >> d[i];
    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
use std::io::stdin;
use std::vec::Vec;

mod utils {
    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        #[allow(unused)]
        #[inline]
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        #[allow(unused)]
        #[inline]
        pub fn read_vec<T: FromStr>(&mut self) -> Vec<T> {
            return self.read_until::<String>(b'\n').trim().split_whitespace().map(|c| c.parse().ok().unwrap()).collect();
        }

        #[inline]
        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (),
                    _ => {
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break;
                    }
                }
            }

            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
         }
    }
}


fn main(){
    let stdin = stdin();
    let mut r = utils::StdinReader::new(stdin.lock());
    let n:i32 = r.readl();
    let Ps:Vec<i32> = r.read_vec();
    let mut min:i32 = std::i32::MAX;
    let mut ans = 0;
    for elm in Ps {
        if(min == std::i32::MAX) {
            min = elm;
        }
        if(min >= elm){
            ans += 1;
            min = elm;
        }else{
        }
    }
    println!("{}",ans);
}


Measured memory_bytes: 10492
from collections import Counter
N = int(input())
A = [int(i) for i in input().split()]

def comb(a):
    return a*(a-1)//2

m = Counter(A)
s = 0
ls = []
for a, b in m.items():
    s += comb(b)
for a in A:
    if m[a] == 1:
        ls.append(s)
    elif m[a] == 2:
        ls.append(s-1)
    else:
        ls.append(s-comb(m[a])+comb(m[a]-1))
print(*ls, sep='\n')

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

vector<int> Div(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

LL solve(int bi);

vector<pair<LP, LL>> v;
int n, m;

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

    cin >> n >> m;

    LL a, b, c;
    for(int i = 0; i < n; ++i) {
        cin >> a >> b >> c;
        v.pb(MP(MP(a, b), c));

    }

    LL res = 0;
    for(int i = 0; i < 8; ++i) {
        res = max(res, solve(i));

    }
    cout << res << endl;
    return 0;
}

LL solve(int bi) {
    vector<LL> t;
    for(int i = 0; i < n; ++i) {
        LL sum = 0;
        for(int j = 0; j < 3; ++j) {
            if((bi >> j) & 1) {
                if(j == 0) {
                    sum += v[i].F.F;

                }
                if(j == 1) {
                    sum += v[i].F.S;

                }
                if(j == 2) {
                    sum += v[i].S;

                }
            } else {
                if(j == 0) {
                    sum -= v[i].F.F;

                }
                if(j == 1) {
                    sum -= v[i].F.S;

                }
                if(j == 2) {
                    sum -= v[i].S;

                }
            }
        }
        t.pb(sum);

    }
    sort(all(t), greater<LL>());

    LL res = 0;
    for(int i = 0; i < m; ++i) {
        res += t[i];

    }

    return res;
}


Measured memory_bytes: 256
import collections
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

N = int(input())
d = [int(input()) for i in range(N)]
print(len(collections.Counter(d)))

Measured memory_bytes: 22440
def resolve():
    '''
    code here
    '''
    import string
    S = [item for item in input()]
    temp_abc = [item for item in string.ascii_lowercase]

    if len(S) < 26:
        for item in S:
            temp_abc.remove(item)
        res = ''.join(S) + temp_abc[0] 

    else:
        if S == temp_abc[::-1]:
            res = -1
        else:
            tail_inorder = []
            prev = 'a'
            cnt = 0
            for item in S[::-1]:
                if item >= prev:
                    tail_inorder += [item]
                    cnt += 1
                else:
                    break
                prev = item
            end_letter = S[-1*(cnt+1)]
            tail_inorder.sort()
            for item in tail_inorder:
                if end_letter < item:
                    res_end_letter = item
                    break

            res = S[:-1*(cnt+1)] + [res_end_letter]
    print(''.join(res)) if res != -1 else print(res)

if __name__ == "__main__":
    resolve()


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    vector a(n, 0uL);
    uint64_t x = 0;
    for (auto&& aa : a) {
        cin >> aa;
        x ^= aa;
    }

    const auto* delim = "";
    for (auto aa : a) {
        cout << delim << (aa ^ x);
        delim = " ";
    }
    cout << endl;
}

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

int main(){

    int X;
    cin >> X;

    if(X == 1){
        cout << 1 << endl;
        return 0;
    }

    int max = 0;
    for(int b = 2; b * b <= X; b++){
        for(int p = 2; (int)pow(b, p) <= X; p++){
            if(max < (int)pow(b, p)) max = (int)pow(b, p);
        }
    }
    cout << max << endl;
    
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  int max = 1;
  for(int i = 1;i<33;i++){
    for(int j = 2;j<10;j++){
      if(pow(i,j) <= a && max < pow(i,j))
        max = pow(i,j);
    }
  }
  cout << max << endl;
}
  

Measured memory_bytes: 256
#include<stdio.h>
int main(){

int n;
while(1){
scanf("%d",&n);if(n==0)break;

int c=0;if(n<=2)c=0;
else{
for(int i=1;i<=(n/2+1);i++)
{int s=0;
for(int j=i;j<=(n/2+1);j++){
	s+=j;if(s==n){c++;break;}}
}}
printf("%d\n",c);
}
return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

int a[3005][3005];
ll dp[3005][3005][4];

int main() {
    int R, C, K;
    cin >> R >> C >> K;
    rep(i,K) {
      int r, c, v;
      cin >> r >> c >> v;
      a[r-1][c-1] = v;
    }

    rep(i,R)rep(j,C) {
      for (int k = 2; k >= 0; k--) {
        chmax(dp[i][j][k+1], dp[i][j][k] + a[i][j]);
      } 
      rep(k,4) {
        chmax(dp[i][j+1][k], dp[i][j][k]);
        chmax(dp[i+1][j][0], dp[i][j][k]);
      }
    }
    ll ans = 0;
    rep(k,4) chmax(ans, dp[R-1][C-1][k]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 320076
#include<bits/stdc++.h>
using namespace std;
int main(){
	long n,k;
	cin>>n>>k;
	long sum=0;
	if(k==0){
	    cout<<n*n;
	    return 0;
	}
	for(int i=k+1; i<=n; i++){
	    sum+=(n/i)*(i-k);
	    sum+=max(n%i-k+1,(long)0);
	}
	cout<<sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll cnt=0;
    ll i=1;
    ll sum=0;
    while(i<=n)
    {
        if(i%3==0 || i%5==0)
        {

        }
        else
        {
            sum += i;
        }
        i++;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
// int count(int n)
// {
//   if(n == 0||n==1||n==1){
//     return 0;
//   }else{
//     return 1 + count(n/(-2));
//   }
  
// }
int main()
{
  int n;
  cin >> n;
  string ans = "";
  if(n == 0){
    cout << 0 << endl;
    return 0;
  }
  while(n != 0){
    if(n%(2) != 0){
      n -= 1;
      ans = "1" + ans;
      n /= -2;
    }else{
      ans =  "0" + ans;
      n /= -2;
    }
    // cout << "n = " << n << ", ans = " << ans << endl;
  } 
  cout << ans << endl;
  // cout << a << " = (-2)*" << a/(-2) << " + " << a%(-2) << endl;
  // cout << (-2) * a/(-2) + a%(-2)<< endl;
  // // cout << a/(-2) << endl;
  // // cout << a%(-2) << endl;
  // cout << count(a) << endl;
}


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

int main(){
    string s;
    cin>>s;
    for(i64 i=0;i<3;i++){
        if(s[i]=='7'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }

    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3624
while 1:
    N,M,P = map(int,raw_input().split())
    if N == 0 and M == 0 and P == 0:
        break
    total = 0
    for i in range(N):
        x = int(input())
        total += x*100
        if i+1 == M:
            y = x
    if y == 0:
        print 0
    else:
        print total*(100-P)/100/y

Measured memory_bytes: 6328
#include <bits/stdc++.h>
using namespace std;
template<class T> bool chmax(T& a,T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a,T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int k;
	string s;
    cin >> k >> s;
    string ans = s.substr(0, k);
    if (s.length() <= k) {
        cout << ans << '\n';
    } else {
        cout << ans << "..." << '\n';
    }
    return 0;
}

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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

template<typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}


int main(int, char**)
{
	long long N;
	scanf("%lld",&N);
	long long M;
	scanf("%lld",&M);
	vector<vector<bool>> adj(N, vector<bool>(N, false));
	std::vector<long long> a(M);
	std::vector<long long> b(M);
	for(ll i = 0 ; i < M ; i++){
		ll a, b;
		scanf("%lld",&a);
		scanf("%lld",&b);
		--a;
		--b;
		adj[a][b] = true;
		adj[b][a] = true;
	}

	vector<ll> p(N);
	iota(p.begin(), p.end(), 0);
	int counter = 0;
	do {
		ll before = 0;
		bool connected = true;
		for (ll i = 1; i < N && connected; ++i)
		{
			if (!adj[before][p[i]])
			{
				connected = false;
				break;
			}
			before = p[i];
		}
		if (connected)
		{
			++counter;
		}
	} while (next_permutation(p.begin() + 1, p.end()));

	cout << counter << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222





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


  double a, b;
  cin >> a >> b;
  cout.precision(10);
  cout << fixed << a / b << endl;



  return 0;
}

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

using namespace std;


int main()
{
  int n;
  cin >> n;
  vector<int> storage(n);
  int maxL = 0;
  int now = 0;
  for (int i = 0; i < n; ++i)
  {
    cin >> storage[i];
    if (i > 0)
    {
      if (storage[i] <= storage[i - 1])
      {
        ++now;
      }
      else
      {
        if (now > maxL)
          maxL = now;
        now = 0;
      }
    }
  }
  if (now > maxL)
    maxL = now;
  cout << maxL << endl;

  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string.h>
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    for (int i = 0; i < n - 1; i++) {
        if (a[i] == a[i+1]) { puts("NO"); return 0 ;}
    }
    puts("YES");
}

Measured memory_bytes: 1024
n,m = map( int, input().split() )

a = [-1]
for i in range(m):
    a.append(int(input()))
a.append(n+1)
m += 1

ans = 1
for i in range(m):
    if a[i+1]-a[i]-1 == 0:
        ans = 0
        break
    elif a[i+1]-a[i]-1 == 1:
        continue
    else:
        dp = [1] + [0]*(a[i+1]-a[i]-2)
    for j in range(1, a[i+1]-a[i]-1):
        dp[j] = dp[j-1] + dp[j-2]
    ans *= dp[-1]

print(ans%1000000007)

Measured memory_bytes: 470536
#include <stdio.h>
#include <string.h>
#include <ctype.h>
 
int main(int argc, const char * argv[]) {
     
    int i, c = 0;
    char s[1000], p[11], stop[] = "END_OF_TEXT";
     
    scanf("%s",p);
     
    for(i=0;i<strlen(p);i++){
        p[i] = tolower(p[i]);
    }
     
    while(1){
         
        scanf("%s",s);
        for(i=0;i<strlen(s);i++){
            if(strcmp(s,stop) == 0) break;
            else s[i] = tolower(s[i]);
        }
        if(strcmp(s,p) == 0){
            c++;
        }
        if(strcmp(s,stop) == 0) break;
    }
    printf("%d\n",c);
    return 0;
}

Measured memory_bytes: 552
// g++ -I ~/Documents/programming/cppLib -std=gnu++14 -o test ~/Documents/programming/cppLib/test.cpp && ./test && rm test
#include <bits/stdc++.h>
using namespace std;
template <typename T> using vector2 = vector <vector  <T>>;
template <typename T> using vector3 = vector <vector2 <T>>;
template <typename T> using vector4 = vector <vector3 <T>>;
using lint = long long;
#define FOR( i, a, b ) for( lint i=(a) ; i < (b) ; ++i )
#define REP( i, n )    for( lint i= 0  ; i < (n) ; ++i )
#define ALL( v )       (v).begin(), (v).end()

//	cinからvectorへ入力
template<typename T>
istream& operator >> ( istream& is, vector<T>& vec ) {
    for( T& x: vec ) {
        is >> x;
    }
    return is;
}

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

    vector<int> X(M);
    cin >> X;

    sort(ALL(X));

    vector<int> dif(M-1);
    REP(i, M-1) {
        dif[i] = X[i+1] - X[i];
    }

    sort(ALL(dif));

    int D = M - N;
    int ans = 0;

    REP( i, D ) {
        ans += dif[i];
    }

    cout << ans << endl;
}


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

int main() {
  int N, K, ans = 0;
  vector<int> A;
  cin >> N >> K;
  for (int i = 0; i < 200000; ++i) A.push_back(0);
  for (int i = 0; i < N; ++i) {
    int tmp;
    cin >> tmp;
    A[tmp]++;
  }
  sort(A.rbegin(), A.rend());
  for (int i = K; i < N; ++i) ans += A[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] lines = line.split("");
		boolean flag = true;
		int before = Integer.parseInt(lines[0]);

		for(int i = 1 ; i < lines.length ; i++) {
			int after = Integer.parseInt(lines[i]);
			if(before == after) {
				flag = false;
				break;
			}
			before = after;
		}

		if(flag) {
			System.out.println("Good");
		}else {
			System.out.println("Bad");
		}

	}

}


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


int main()
{
	int N;
	cin>>N;
	string s,t;
	cin>>s>>t;
	rep(i,N)
	{
		cout<<s[i]<<t[i];
	}
	cout<<"\n";
	return 0;
}


Measured memory_bytes: 3504