akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

int main() {
    ll N,K;
    cin >> N >> K;
    set<int> ng;
    vector<int> can;
    int t=0;
    for(int i=0;i<K;i++){
        int d;
        cin >> d;
        ng.insert(d);
       
    }
    for(int i=0;i<10;i++){
        if(ng.find(i) == ng.end()){
            can.push_back(i);
        }
    }
    // for(int a:can){
    //     cerr << a << endl;
    // }
    queue<int> q;
    for(int a:can){
        q.push(a);   
    }
    sort(can.begin(),can.end());
    while(!q.empty()){
        int t= q.front();
        q.pop();
        if(t==0){
            continue;
        }
         if(t >=N){
            cout << t << endl;
            return 0;
        }
        for(int a:can){
            q.push(t*10+a);
        }
    }


    return 0;
}

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

int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= 9; ++i) {
    for (int j = 1; j <= 9;  ++j) {
      if (i * j == N) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3128
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

#define rep(i, n) for (int i=0; i<int(n); i++)
//static const int INFTY = (1<<20);

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

	vector<vector<string> > vec(n);
	rep(i, m) {
		int p;
		string s;
		cin >> p >> s;
		vec.at(p-1).push_back(s);
	}
	int ac_ans = 0;
	int wa_ans = 0;
	rep(i, vec.size()) {
		int wa_cnt = 0;
		rep(j, vec.at(i).size()) {
			if (vec.at(i).at(j) == "AC") {
				ac_ans++;
				if (wa_cnt > 0) wa_ans += wa_cnt;
				break;
			}
			if (vec.at(i).at(j) == "WA") wa_cnt++;
		}
	}
	cout << ac_ans << " " << wa_ans << endl;
}

Measured memory_bytes: 10368
void main() {
	auto ip = readAs!(int[]), N = ip[0], D = ip[1];
	auto X = readMatrix!real(N, D);
	ulong res;

	bool ok(real[] a, real[] b) {
		real tmp = 0;
		foreach(i; 0..a.length) {
			tmp += pow(a[i] - b[i], 2);
		}
		tmp = sqrt(tmp);
		debug tmp.writeln;
		return tmp.ceil == tmp.floor;
	}

	foreach(i; 0..N) foreach(j; i+1..N) {
		if(i >= j) continue;
		if(ok(X[i], X[j])) res++;
	}

	res.writeln;
}

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

import std.stdio;
import std.string;
import std.functional;
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: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define srt(i) sort(i.begin(), i.end())
#define rvt(i) sort(i.begin(), i.end(), greater<int>())

int main()
{
    int n,m,x;
    cin >> n >> m >> x;
    
    vector<int > cost(n);
    vector<vector <int > > abi(n, vector<int>(m));
    rep(i,n){
      int c;
      cin >> c;
      cost.at(i) = c;

      rep(j,m){
        int a;
        cin >> a;
        abi.at(i).at(j) = a;
      }
    }

    int result = INT_MAX;
    for(int tmp=0; tmp < (1<<n); tmp++){
      bitset<12 > bit(tmp);
      vector<int > learn(m);
      int result_tmp = 0;
      for(int i=0; i<12; i++){
        if(bit.test(i)) {
          rep(j,m){
            learn.at(j) += abi.at(i).at(j);
          }
          result_tmp += cost.at(i);
        }
      }

      bool clear = true;
      rep(i,m){
        if(learn.at(i)<x) clear=false;
      }
      if(clear) result = min(result, result_tmp);
    }

    if(result==INT_MAX) result = -1;
    cout << result << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
const db pi = 3.1415926535898;

int main()
{
	db a, b, h, m; cin >> a >> b >> h >> m;
	db angle = 2 * pi * abs(h / 12 + m / 720 - m / 60);
	angle = min(2 * pi - angle, angle);
	db ans;
	if(abs(pi / 2 - angle) < 1e-9)
	{
		ans = sqrt(a * a + b * b);
	}
	else if(angle < pi / 2)
	{
		db x = sin(angle) * a;
		db y = b - cos(angle) * a;
		ans = sqrt(x * x + y * y);
	}
	else
	{
		angle = pi - angle;
		db x = sin(angle) * a;
		db y = b + cos(angle) * a;
		ans = sqrt(x * x + y * y); 
	}
	printf("%.12f\n", ans);
	return 0;
}


Measured memory_bytes: 4016
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
using namespace std;
#define _GLIBCXX_DEBUG
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vit vector<lint>::iterator
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define mod 1000000007
#define graph_set(n) struct edge{int to,int cost;} vector<edge> G((n))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define range(x,y) ((x) >= 0 && (x) < h && (y) >= 0 && (y) < w)
#define pyes cout << "Yes" << endl
#define pno cout << "No" << endl
typedef vector<long long> vi;
typedef vector<pair<long long, long long>> vp;
typedef vector<vector<long long>> vvi;
typedef pair<long long, long long> pi;
typedef long long lint;
typedef long long ll;
lint qp(int a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
lint qp(int a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
lint gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
long long INF = 1e14;

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

int main(void) {
	string s; cin >> s;
	sort(all(s));
	if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) pyes;
	else pno;
	return 0;
}

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

int main(){
    int x , y;
    char op;
    
     while(1){
        cin >> x >> op >> y;
        
        if(op == '?' )break;
        if(op == '+' ){
            cout << x + y << endl;
        }else if(op == '-' ){
            cout << x - y << endl;
        }else if(op == '*' ){
            cout << x * y << endl;
        }else if(op == '/' ){
            cout << x / y << endl;
        }
    }
}


Measured memory_bytes: 3104
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=9e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,c[100005]={},s[200005]={},t[200005]={},x[200005]={},cnt[200005]={},ans=0,ch;
  cin >> n >> ch;
  for(int i=0; i<n; i++) {
    cin >> s[i] >> t[i] >> c[i];
  }
  for(int i=1; i<=ch; i++) {
    int time[200005]={};
    for(int j=0; j<n; j++) {
      if(c[j]==i) {
        time[s[j]*2-1]++,time[t[j]*2]--;
      }
    }
    for(int j=1; j<200005; j++) {
      time[j]+=time[j-1];
    }
    for(int j=0; j<200005; j++) {
      if(time[j]) {
        cnt[j]++;
      }
    }
  }
  for(int i=0; i<200005; i++) {
    ans=max(ans,cnt[i]);
  }
  cout << ans << endl;
}

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

int main(void){
    int n;
    int ind, num, a;
    std::cin >> n;
    std::vector<std::vector<int>> b(n, std::vector<int>(n));
    for(int i = 0; i < n; i++){
        std::cin >> ind >> num;
        ind--;
        for(int i = 0; i < num; i++){
            std::cin >> a;
            a--;
            b[ind][a] = 1;
        }
        
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(j != 0){
                std::cout << " " << b[i][j];
            }else{
                std::cout << b[i][j];
            }
        }
        std::cout << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3156
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

#define BIG_NUM 2000000000

using namespace std;

int main(){

	ll N,tmp,sum,num;
	priority_queue<ll> Q;

	while(true){
		scanf("%lld",&N);
		if(N == 0)break;

		sum = 0;
		num = N;

		while(!Q.empty())Q.pop();

		for(int i = 0; i < N; i++){
			scanf("%lld",&tmp);
			sum += tmp;
		}

		for(int i = 0; i < N-1; i++){
			scanf("%lld",&tmp);
			Q.push(tmp);
		}

		while((num-1)*(sum+Q.top()) > num*sum){
			sum += Q.top();
			num--;
			Q.pop();
		}

		printf("%lld\n",num*sum);
	}
	return 0;
}

Measured memory_bytes: 2988
n = gets.to_i
ds = []

n.times { 
	d1, d2 = gets.split.map &:to_i
	
	if d1 == d2 then
		ds << true
	else
		ds << false
	end
}

ds.each_cons(3){ |x|
	if x.all? then
		puts 'Yes'
		exit
	end
}

puts 'No'


Measured memory_bytes: 14344
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;



int main(void){

  string s,t;
  cin >> s >> t;

  int n=s.size();
  bool ans=false;
  for(int i=0;i<n;i++){
    bool fg=true;
    for(int j=i;j<i+n;j++)
      fg &= (s[j-i]==t[j%n]);
    ans |= fg;
  }
  if(ans)cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a+b>c && a<=c) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}



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

int main(){
	LL n;
	cin >> n;
	vector<LL> a;
	a.push_back(1);
	for(LL i = 0; i < n; i++){
		LL c;
		cin >> c;
		a.push_back(c);
	}
	a.push_back(1);
	n += 2;
	LL ans = 0;
	LL last = 0;
	LL up = 0;
	for(LL i = 0; i < n; i++){
		LL c = a[i];
		LL d = a[i]-1;
		LL m1 = -1;
		LL m2 = -1;
		for(LL i = 0; i < 31; i++){
			if(c >= (1LL << i)){
				m1 = i;
			}
			if(d >= (1LL << i)){
				m2 = i;
			}
		}
		m2++;
		if(m1 == m2){
			ans += abs(m1-last);
			last = m1;
			continue;
		} else {
			ans++;
			if(abs(m1-last) < abs(m2-last)){
				ans += abs(m1-last);
				last = m2;
				up = 0;
			} else if(abs(m2-last) < abs(m1-last)){
				ans += abs(m2-last);
				last = m1;
				up = 0;
			} else {
				cout << "HERE" << endl;
			}
		}
	}
	//cout << ans << endl;
	cout << ans/2 << endl;
}


Measured memory_bytes: 1528
/*input

*/


// assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pii         pair<ll ,ll >
#define vpii        vector< pii >
#define vi          vector<ll >
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define debug(x)     cout << #x << " " << x << endl;
#define debug_p(x)   cout << #x << " " << x.F << " " << x.S << endl;
#define debug_v(x)   {cout << #x << " "; for (auto ioi : x) cout << ioi << " "; cout << endl;}
#define debug_vp(x)  {cout << #x << " "; for (auto ioi : x) cout << '[' << ioi.F << " " << ioi.S << ']'; cout << endl;}
#define debug_v_v(x) {cout << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cout << ioi2 << " "; cout << '\n';} cout << "*/" << #x << endl;}
const ll M = 2019,mod = 2019;
ll inv_10  = 0;

ll modInverse(ll a, ll m) 
{ 
    a = a%m; 
    for (ll x=1; x<m; x++)  if ((a*x) % m == 1)  return x;
    return -1; 
} 
		
int solve()
{
	string s;cin>>s;
	ll n = sz(s);

	inv_10 = modInverse(10ll,M);
	// whatis(inv_10);

	vi dp1(M,0);
	vi dp2(M,0);

	ll ans=0;

	ll mm = 2019 * 205;
	vi vec_mod(mm);
	rep(i,0,mm) vec_mod[i] = i%M;	

	rep(i,0,n)
	{
		rep(m,0,M)
		{
			if(i==0) dp2[m] = ((s[i]-'0')==m);
			else
			{
				ll d = (s[i]-'0');
				ll k;
				if(m-d>=0) k = m-d;
				else k = M+m-d;
				k = vec_mod[k*inv_10];
				dp2[m] = dp1[k] + (d==m);
			} 
		}
		ans+=dp2[0];
		rep(m,0,M) dp1[m]=dp2[m];
	}

	cout<<ans<<"\n";





	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	//cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 6764
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#include <atcoder/all>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,a) for(ll i=ll(a-1);i>=0;--i)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using namespace atcoder;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const int INF = 1e9;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<long double,long double> point;
typedef complex<long double> Point;
const ll MAX = 1e9;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    scc_graph g(n);
    rep(i,m){
        ll a,b;
        cin >> a >> b;
        g.add_edge(a,b);
    }
    auto ans = g.scc();
    PRINT(ans.size());
    for (vector<int> v:ans){
        cout << v.size() << " ";
        array_output(all(v));
    }
}


Measured memory_bytes: 40116
#include <iostream>
#include <string>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <set>
#include <climits>
#include <map>
#include <cmath>
#include <deque>
#include <numeric>
#include <cassert>
using namespace std;

long long X[200000];
long long cum_sum_x[200000];
long long reverse_cum_sum_x[200000];
int main(){
  long long L;
  int N;
  cin >> L >> N;
  for(int i = 0; i < N; i++){
    cin >> X[i];
  }

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

  reverse_cum_sum_x[N - 1] = L - X[N - 1];
  for(int i = N - 2; i >= 0; i--){
    reverse_cum_sum_x[i] = reverse_cum_sum_x[i + 1] + (L - X[i]);
  }

  long long ans = 0;
  //no turnaround
  ans = max(ans, X[N - 1]);
  ans = max(ans, L - X[0]);

  for(int i = 0; i < N - 1; i++){
    int till = i + (N - (i + 1)) / 2;
    int reverse_till = till + 1;

    long long tmp_ans = 2 * X[i] + 2 * (cum_sum_x[till] - cum_sum_x[i] + reverse_cum_sum_x[reverse_till]);
    if((N - (i + 1)) % 2 == 0){
      tmp_ans -= X[till];
    } else {
      tmp_ans -= (L - X[reverse_till]);
    }

    ans = max(ans, tmp_ans);
    //cout << i << " " << till << " " << reverse_till << endl;
    //cout << tmp_ans << endl;
  }

  for(int i = N - 1; i > 0; i--){
    int reverse_till = i - i / 2;
    int till = reverse_till - 1;
    long long tmp_ans = 2 * (L - X[i]) + 2 * (reverse_cum_sum_x[reverse_till] - reverse_cum_sum_x[i] + cum_sum_x[till]);
    if(i % 2 == 0){
      tmp_ans -= (L - X[reverse_till]);
    } else {
      tmp_ans -= X[till];
    }

    ans = max(ans, tmp_ans);
    //cout << i << " " << reverse_till << " " << till << endl;
    //cout << tmp_ans << endl;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
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 FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,n) a[i] = in() - 1;
    VI ans;

    REP(i,n){
        int x = -1;
        REP(j,a.size()){
            if (a[j] == j) x = j;
        }
        if (x == -1){
            cout << -1 << endl;
            return 0;
        }
        ans.push_back(x);
        VI b;
        REP(j,a.size()) if (j != x) b.push_back(a[j]);
        a = b;
    }
    reverse(ALL(ans));
    REP(i,n) cout << ans[i] + 1 << endl;

    return 0;
}

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

namespace Csharp_ITP1 {
    class ITP1_2_C {
        static void Main() {
            string[] s = Console.ReadLine().Split();
            var i = s.Select(a => int.Parse(a)).ToArray();
            Array.Sort(i);
            Console.WriteLine(string.Join(" ", i));
        }
    }
}


Measured memory_bytes: 18500
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

/*-- template --*/

int main() {
    int N; cin >> N;
    ll A[N];
    rep(i, N) cin >> A[i];
    ll sum = 0, ans = 0;
    rep(i, N) {
        if(A[i] == 0) {
            ans += sum / 2;
            sum = 0;
        } else {
            sum += A[i];
        }
    }
    ans += sum / 2;
    cout << ans << endl;
}


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

#define endl '\n'
#define ll long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
const db pi = acos(-1);
const long long infl = LLONG_MAX;

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase 

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

ll i,x,j,y,z,k,n;


cin>>n>>k;	ll a[n];
rep(i,0,n,1)	cin>>a[i];
double r=0,t;
// ce(n<<" "<<k)
rep(i,1,n,1)	a[i]+=a[i-1];

// rep(i,0,n,1)	ce(a[i])
//k-1
r=(a[k-1]+k)/2.00;
rep(i,k,n,1){
	t=(a[i]-a[i-k]+k)/2.00;
	// ce(a[i]-a[i-k])
	r=max(r,t);
}
cout_p(r, 9);
}


Measured memory_bytes: 1792
use std::io;

enum Op {
    Plus,
    Minus
}

fn parse(input: &String) -> Option<(i32, Op, i32)> {
    let splitted = input.split_whitespace().collect::<Vec<&str>>();

    if splitted.len() != 3 {
        return None;
    }

    let a = match splitted[0].parse::<i32>() {
        Ok(x) => x,
        Err(_) => return None,
    };

    let op = match splitted[1] {
        "+" => Op::Plus,
        "-" => Op::Minus,
        _ => return None
    };

    let b = match splitted[2].parse::<i32>() {
        Ok(x) => x,
        Err(_) => return None
    };

    Some((a, op, b))
}

fn calc(a: i32, op: Op, b: i32) -> i32 {
    match op {
        Op::Plus => a + b,
        Op::Minus => a - b
    }
}

fn main() {
    let mut buffer = String::new();
    match io::stdin().read_line(&mut buffer) {
        Ok(_) => {
            let (a, op, b) = parse(&buffer).unwrap();
            println!("{}", calc(a, op, b));
        },
        Err(_) => println!("Err"),
    };
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

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

const int NMAX = 100;
bool flag;

bool cmp(int x,int y){
    return abs(0-x)<abs(0-y);
}

int main(){
    CIN(a,b,c,d);

    int low=max(a,c);
    int up=min(b,d);

    printf("%d\n",max(0,up-low));
    
    return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main{
  public static void main(String[] args){
     Scanner sc = new Scanner(System.in);
     String n = sc.next();
     String ans = "No";
     for(int i = 0; i<3 ; i++){
     	if(n.charAt(i) == '7') ans = "Yes";
     }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35692
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

#pragma region UnionFind
struct UnionFind
{
    vector<int> d;
    // d[x] is the index of the parent of x
    // d[x] is -size if x is a root

    UnionFind(int n) : d(vector<int>(n, -1)) {}
    int root(int x)
    {
        if (d[x] < 0)
        {
            return x;
        }
        return d[x] = root(d[x]);
    }

    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
        {
            return false;
        }
        if (d[x] > d[y])
            swap(x, y); // x always bigger tree

        d[x] += d[y];
        d[y] = x;
        return true;
    }

    bool same(int x, int y)
    {
        return root(x) == root(y);
    }
    int size(int x) { return -d[root(x)]; }
};
#pragma endregion

int main()
{
    int n, m;
    cin >> n >> m;
    vp e(m);
    rep(i, m)
    {
        cin >> e[i];
        e[i].first--;
        e[i].second--;
    }
    reverse(e.begin(), e.end());
    UnionFind uft(n);
    ll fuck = (ll)n * (n - 1) / 2;
    vll ans(m);
    rep(i, m)
    {

        ans[i] = fuck;
        ll a = uft.size(e[i].first), b = uft.size(e[i].second);
        bool newB = uft.unite(e[i].first, e[i].second);
        if (newB)
        {
            fuck -= a * b;
        }
    }
    reverse(ans.begin(), ans.end());
    for (ll a : ans)
    {
        cout << a << endl;
    }

    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod=998244353;
const ll maxn=1e10;
//vector<vector<int> > adj(maxn);
//vector<bool> used(maxn,false);
//vector<int> d(maxn),p(maxn);
ll bin(ll a, ll b) {
	//a%=m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a; //mod
        a = a * a; //mod
        b >>= 1;
    }
    return res;
}

int gcd(int a, int b, int & x, int & y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    int x1, y1;
    int d = gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}
ll fact(ll x)
{
  ll res=1;
  for(ll i=1;i<=x;i++)
    res=(res*i)%mod;

  return res;
}

ll lmod(string n,ll x)
{
	
	ll res=0;
	for(ll i=0;i<n.length();++i)
	{
		res=(res*10+(int)n[i]-'0')%x;
	}
	return res;
}
bool ispal(string s,int l,int r)
{
	string t=s;
	for(int i=l,j=r;i<=r;++i)
	{
		if(s[i]!=s[j])
			return false;
		else
			{
				--j;
			}
	}
	return true;
}
bool pl(string s)
{
	string t(s.rbegin(),s.rend());
	return t==s;
}
/*void bfs(int s,int &ans)
{
	queue<int> q;
	used[s]=true;
	p[s]=-1;
	d[s]=0;
	q.push(s);
	while(!q.empty())
	{
		int v=q.front();
		q.pop();
		for(int u: adj[v])
		{
			if(!used[u])
			{
				used[u]=true;
				q.push(u);
				d[u]=d[v]+1;
				ans=max(ans,d[u]);
				p[u]=v;
			}
			
		}
	}
}*/


int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5] && s[0]!=s[1])
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
		


	
	
	
}

Measured memory_bytes: 256
import numpy as np
n = int(input())
k = 0
A =[int(a) for a in input().split()]
A.sort()
A = np.array(A)
AC = [0]*n
AC = np.array(AC)
AC[1:] =A[:n-1]
AA = A - AC
if 0 in AA:
    print("NO")
elif A[n-2] == A[n-1]:
    print("NO")
else:
    print("YES")


Measured memory_bytes: 34180
#include <iostream>
#include <iomanip>
#include <cmath>
#include <stdio.h>
using namespace std;
int main(){
	double x,y,x1,x2,y1,y2,anser;
	cin>>x1>>y1>>x2>>y2;
	x=x2-x1;
	y=y2-y1;
	x=x*x;
	y=y*y;
	anser=x+y;
	anser =sqrt(anser);
	cout <<fixed<<setprecision(6)<< anser << endl;
	return 0;
}


Measured memory_bytes: 1284
import java.util.Scanner;

public class Main {
	final static int INT_MAX = 10000000;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int[][] table = new int[n][n];
			int m = sc.nextInt();
			int s = sc.nextInt();
			int g1 = sc.nextInt();
			int g2 = sc.nextInt();
			if (n == 0 && m == 0 && s == 0 && g1 == 0 && g2 == 0)
				break;
			int min = INT_MAX;
			for (int i = 0; i < m; i++) {
				int b1 = sc.nextInt();
				int b2 = sc.nextInt();
				int c = sc.nextInt();
				table[b1 - 1][b2 - 1] = c;
			}
			for (int i = 0; i < n; i++)
				for (int j = 0; j < n; j++)
					if (table[i][j] == 0)
						table[i][j] = INT_MAX;
			for (int i = 0; i < n; i++)
				table[i][i] = 0;
			for (int k = 0; k < n; k++)
				for (int i = 0; i < n; i++)
					for (int j = 0; j < n; j++) {
						table[i][j] = Math.min(table[i][j], table[i][k]
								+ table[k][j]);
					}
			for (int i = 0; i < n; i++) {
				min = Math.min(min, table[s - 1][i] + table[i][g1 - 1]
						+ table[i][g2 - 1]);
			}
			System.out.println(min);
		}
		sc.close();
	}
}

Measured memory_bytes: 61120
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		int d = sc.nextInt();
		sc.close();

		int ans = 0;
		for (int i = l; i <= r; i++) {
			if (i % d == 0) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	cin >> n;
	int l[n];
	for(int i=0; i<n; i++) cin >> l[i];
	sort(l, l+n);

	ll ans=0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			ans+=upper_bound(l+j+1, l+n, l[i]+l[j]-1)-lower_bound(l+j+1, l+n, l[j]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,j,k=0;
  int A,B,C;
  int K[1000];
  scanf("%d %d %d",&A,&B,&C);
  if(A<B){
    for(i=1;i<=A;i++){
      if(A%i==0&&B%i==0){
        K[k]=i;
        k++;
      }
    }
  }
  
  else{
    for(i=1;i<=B;i++){
      if(A%i==0&&B%i==0){
        K[k]=i;
        k++;
      }
    }
  }
  
  printf("%d\n",K[k-C]);
  return 0;
  
}

Measured memory_bytes: 128
#include <cstdio>
#include <iomanip>    // setw 控制输出间隔函数
#include <iostream>   // cin, cout, abs
#include <algorithm>  // max, min, swap, sort
#include <cmath>      // pow
#include <cstring>    // strlen, memset
#include <set>        // set 集合
#include <stack>      // stack 栈
#include <queue>      // queue 队列
#include <string>     // string 字(yang)符(rou)串, substr
#include <map>
#include <fstream>
using namespace std;
int main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    string h;
    cin >> h;
    if( h[a] != '-')
    {
        printf("No\n");
        return 0;
    }
    for( int i = 0; i <= a + b; i++)
    {
        if( i != a && !( h[i] >= '0' && h[i] <= '9'))
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, m;
  cin >> n >> m;
  int cur = 0, ret = 1;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    cur += x;
    if (cur <= m) ++ret;
  }
  cout << ret << endl;
  return 0;
}


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

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

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

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

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

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

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

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

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

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

    a = a * a % mod;

    n >>= 1;
  }

  return ans;
}

void solve();

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

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

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

long long N, K;
void solve() {
  cin >> N >> K;
  cout << min((N - (N / K) * K), abs((N - ((N / K) + 1) * K)));
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	H := nextInt()
	W := nextInt()
	K := nextInt()

	c := make([][]byte, H)

	for i := 0; i < H; i++ {
		c[i] = nextBytes()
	}

	ans := 0

	for i := 0; i < pow2(H); i++ {
		for j := 0; j < pow2(W); j++ {
			k := 0
			for h := 0; h < H; h++ {
				for w := 0; w < W; w++ {
					if nthbit(i, h) == 0 && nthbit(j, w) == 0 && c[h][w] == '#' {
						k++
					}
				}
			}
			if k == K {
				ans++
			}
		}
	}

	fmt.Println(ans)
}

func pow2(n int) int {
	return int(math.Pow(float64(2), float64(n)))
}

func nthbit(a int, n int) int { return int((a >> uint(n)) & 1) }

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}

func debug(args ...interface{}) {
	fmt.Fprintln(os.Stderr, args)
}


Measured memory_bytes: 1812
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(i);
// sort(arr, arr+n, greater<int>());
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


int main(void)
{
	fast();
	int n;
	cin>>n;
	ll sum=0;
	for(ll i=1;i<=n;i++)
	{
    	    if(i%3==0 || i%5==0)
    	    {
    	        continue;
    	    }
    	    else
    	    {
    	        sum=sum+i;
    	    }
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    ll n,m;cin >> n >>m;
    vl ans(m),aans(m);
    if(n%2==1){
        rep(i,m){
            ans[i]=i+1;
        }
        rep(i,m){
            aans[i]=m+i+1;
        }
        rev(all(aans));
        rep(i,m){
            cout << ans[i] <<" " <<aans[i] <<endl;
        }
    }
    else{
        ll p=n/2;
        rep(i,n/2/2){
            if(i==m)return 0;
            cout << i+1 <<" " <<p-i <<endl;
        }
        rep(i,m-n/2/2){
            cout << p+1+i <<" "  << n-1-i <<endl;
        }
    }
}

Measured memory_bytes: 4516
// vacations-->akash_codex
#include<iostream>
typedef long long ll;
using namespace std;

int main(){
	ll n;
	cin>>n;
	ll happ[n][3],dp[n][3];
	for(ll i=0;i<n;i++)
	for(ll j=0;j<3;j++) cin>>happ[i][j];
	dp[0][0]=happ[0][0];
	dp[0][1]=happ[0][1];
	dp[0][2]=happ[0][2];
	
	for(ll i=1;i<n;i++){
		for(ll j=0;j<3;j++){
			if(j==0) dp[i][j]=happ[i][j]+max(dp[i-1][1],dp[i-1][2]);
			if(j==1) dp[i][j]=happ[i][j]+max(dp[i-1][0],dp[i-1][2]);
			if(j==2) dp[i][j]=happ[i][j]+max(dp[i-1][1],dp[i-1][0]);
		}
	}
	ll max_happ=max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
	cout<<max_happ;
	return 0;
}

Measured memory_bytes: 8272
/* https://arc067.contest.atcoder.jp/tasks/arc067_d */
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
typedef long long int ll;
using namespace std;

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define BITCOUNT(n) __builtin_popcount(n)
#define BITCOUNTLL(n) __builtin_popcountll(n)
#define sz(a) (int)(a).size()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define x first
#define y second

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N = 5010, M = 210, LOG = 12;
const ll inf = -1e18;
ll d[N], best[N];
int rmq[M][N][LOG+2], val[M], a[N][M], logm[N];
int n, m;

void pre_rmq(int n){
    int i, j, t;
    for(i = 1;i <= m; i++)
        for(j = 1; j <= n; j++)
            rmq[i][j][0] = a[j][i];
    for(i = 2; i <= n; i++)
        logm[i] = logm[i>>1] + 1;
    for(t = 0; t < LOG; t++){
        for(i = 1;i <= m; i++)
            for(j = 1; j + (1<<(t + 1)) - 1 <= n; j++)
                rmq[i][j][t+1] = max(rmq[i][j][t], rmq[i][j+(1<<t)][t]);
    }
}

void refresh(int x, int y){
    int p = logm[y - x + 1], i;
    for(i = 1;i <= m; i++)
        val[i] = max(rmq[i][x][p], rmq[i][y - (1<<p) + 1][p]);
}

void solve(int l, int r, int optL, int optR){
    if(l > r)
        return;
    int mid = (l + r) >> 1;
    int opt = mid;
    if(optL > mid)
        refresh(mid, optL - 1);
    else
        rep(i, 1, m + 1)
            val[i] = 0;
    ll act = 0;
    rep(i, 1, m + 1)
        act += val[i];
    best[mid] = inf;
    for(int i = max(optL, mid); i <= optR; i++){
        rep(j, 1, m + 1){
            if(a[i][j] > val[j]){
                act += a[i][j] - val[j];
                val[j] = a[i][j];
            }
        }
        if(act - d[i] > best[mid])
            best[mid] = act - d[i], opt = i;
    }
    best[mid] += d[mid];
    solve(l, mid - 1, optL, opt);
    solve(mid + 1, r, opt, optR);
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    cin >> n >> m;
    for(int i = 2; i <= n; i++)
        cin >> d[i], d[i] += d[i-1];
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            cin >> a[i][j];
    pre_rmq(n);
    solve(1, n, 1, n);
    ll ans = 0;
    rep(i, 1, n + 1)
        ans = max(ans, best[i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 59776
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a,b;
  cin >> a >> b;
  for (int i = 0; i < a.length(); i++) {
    if(a.at(i)!=b.at(i)){
      cout << "No" << endl;
      exit(0);
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int n = Integer.valueOf(arr01[0]);
        int k = Integer.valueOf(arr01[1]);
        int cnt = 0;
        while (n >= 1) {
//            System.out.println(n / k);
            n = n / k;
            cnt += 1;
        }

        System.out.println(cnt);

    }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#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 rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX
typedef pair<long long, long long> P;
int main(){
    long long n,k;
    cin>>n>>k;
    vector<long long>x(n);
    rep(i,n){
        cin>>x[i];
    }
    vector<long long>y(n-(k-1));
    rep(i,n-(k-1)){
        long long j=i+(k-1);
        if(abs(x[i]+x[j])==abs(x[i])+abs(x[j])){
            y[i]=max(abs(x[i]),abs(x[j]));
        }
        else{
            y[i]=min(abs(x[i]*2)+abs(x[j]),abs(x[i])+abs(x[j]*2));
        }
    }
    sort(y.begin(),y.end());
    
    cout<<y[0]<<endl;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)



int main(){
	int a,p;
	cin >> a >> p;
	
	cout << (a*3+p)/2 << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
#define dcml(n) fixed<<setprecision(n)
//CONST
//------------------------------------------
const ll INF=1010000000000000017LL;
const ll MOD=1000000007LL;
const ld EPS=1e-12;
const ld PI=3.14159265358979323846;
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define  FORS(i,m,n) for(ll (i)=(m);   (i)<=(n); (i)++)
#define  RFOR(i,m,n) for(ll (i)=(n)-1; (i)>=(n); (i)--)
#define RFORS(i,m,n) for(ll (i)=(n);   (i)>(n);  (i)--)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
#define WREPS(i,in,j,jn) REPS(i,in)REPS(j,jn)
//-----------------------------------------
//namespace
using namespace std;
//ライブラリはここに
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

//-----------------------------------------
int main(void){
    ll A,B,C,X,Y;cin>>A>>B>>C>>X>>Y;
    ll AB=C*2;
    ll ans=INF;
    REP(i,max(X,Y)+1){
        ans=min(ans,i*AB+max(0ll,(X-i))*A+B*max(0ll,Y-i));
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 256
import numpy as np
from scipy.sparse import csgraph
H, W = map(int, input().split())
maze = "".join(input() for _ in range(H))
array = np.zeros((H * W, H * W), dtype=np.bool)
for n in range(H * W):
    if maze[n] == "#":
        continue
    r, c = divmod(n, W)
    if c and maze[n - 1] == ".":
        array[n][n - 1] = 1
        array[n - 1][n] = 1
    if r and maze[n - W] == ".":
        array[n][n - W] = 1
        array[n - W][n] = 1
dist = csgraph.shortest_path(array)
print(int(dist[dist < 401].max()))


Measured memory_bytes: 19388