akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template < typename T >
ostream &operator<<(ostream &os, const vector< vector< T > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
int main() {
	ll N, X;
	cin >> N >> X;
	vector< ll > A(N);
	rep(i, N) cin >> A[i];
	ll ans = LLONG_MAX / 2;
	vector< vector< ll > > dp(N, vector< ll >(N, LLONG_MAX / 2));
	rep(i, N) dp[i][0] = A[i];
	rep(i, N) for (int j = 1; j < N; j++) {
		//dp[(i + 1) % N][j] = min(dp[(i + 1) % N][j - 1], dp[i][j - 1]);
		dp[i][j] = min(dp[i][j - 1], A[((i - j) % N + N) % N]);
	}
	rep(k, N) {
		ll tmp = k * X;
		rep(i, N) tmp += dp[i][k];
		chmin(ans, tmp);
	}
	//cout << dp;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 31616
N = int(input())
A = list(map(int, input().split()))

B = [[0] * 2 for i in range(300000)]
for i in range(N):
    if i == 0:
        B[0][0] = 0
        B[0][1] = A[0]
    elif i == 1:
        B[1][0] = 0
        B[1][1] = max([A[0], A[1]])
    elif i % 2 == 0:
        B[i][0] = max([B[i-2][0] + A[i], B[i-1][1]])
        B[i][1] = B[i-2][1] + A[i]
    else:
        B[i][0] = max([B[i-2][0] + A[i], B[i-1][0]])
        B[i][1] = max([B[i-2][1] + A[i], B[i-1][1]])

if i % 2 == 0:
    print(B[N-1][0])
else:
    print(B[N-1][1])


Measured memory_bytes: 119344
#include<iostream>
#include<utility>
#include<queue>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
ll dp[2010][2010]={0},in[2020],n,out;
queue<pii>q;
int main(){
	cin>>n;rep(i,n)cin>>in[i];
	rep(i,n)dp[i][1]=in[i],q.push(pii(i,1));
	while(!q.empty()){
		pii r=q.front();q.pop();
		int a=r.first,b=r.second;
		int s=a-1,t=(s+1+b)%n;
		if(s==-1)s=n-1;
		if(b%2){
			if(in[s]<in[t])s=a;
			if(dp[s][b+1]<dp[a][b]){
				dp[s][b+1]=dp[a][b];
				if(b+1!=n)q.push(pii(s,b+1));
			}
		}else{
			rep(i,2){
				if(dp[s][b+1]<dp[a][b]+in[(i?t:s)]){
					dp[s][b+1]=dp[a][b]+in[(i?t:s)];
					if(b+1!=n)q.push(pii(s,b+1));
				}
				s=a;
			}
		}
	}
	rep(i,n)out=max(out,dp[i][n]);
	cout<<out<<endl;
}

Measured memory_bytes: 32664
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int x,y;
	cin>>x>>y;
	if(y%2){cout<<"No";return 0;}
	if(y<x*2){cout<<"No";return 0;}
	if(y>x*4){cout<<"No";return 0;}
	cout<<"Yes";return 0;
	
}

Measured memory_bytes: 3632
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
    let n: usize = get_input().parse().unwrap();
    let mut a:Vec<(i64, i64)> = (0..n).map(|i| (get_input().parse().unwrap(), i as i64)).collect();

    a.sort();
    a.reverse();

    for i in 0..n as i64 {
        println!("{}", if i != a[0].1 { a[0].0 } else { a[1].0 } );
    }
}


Measured memory_bytes: 11772
#include<bits/stdc++.h>
using namespace std;
int main() { 
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >>A[i];
  }
  sort(A.begin(), A.end(), greater<int>());
  int sum=0;
  for(int i=0;i<K;i++){
    sum += A[i];
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <tuple>
#include <vector>
using namespace std;

#define int long

signed main(){
  int n, k;
  cin >> n >> k;
  if(k>(n+1)/2){
    cout << -1;
    return 0;
  }
  else{
    vector<int>b(n);
    for(int i=0; i<n; i++){
      b[i]=k+2*n-1-i;
    }
    int ik[2]={0, k};
    for(int i=0; i<k-1; i++){
      swap(b[ik[i%2]], b[ik[i%2]+k-1-i]);
      ik[i%2]++;
    }
    vector<tuple<int, int, int>>s(n);
    for(int i=0; i<n; i++){
      s[i]=make_tuple(k+i+b[i], k+i, b[i]);
    }
    sort(s.begin(), s.end());
    for(int i=0; i<n; i++){
      cout << get<1>(s[i]) << ' ' << get<2>(s[i]) << ' ' << k+2*n+i << endl;
    }
    return 0;
  }
}


Measured memory_bytes: 5376
n, m, k = [int(i) for i in input().split()]
a = [0] + [int(i) for i in input().split()]
b = [0] + [int(i) for i in input().split()]
for i in range(1, n+1):
  a[i] += a[i-1]
for i in range(1, m+1):
  b[i] += b[i-1]
cnt, cnt_ = 0, 0
for i in range(n+1):
  if a[i] <= k:
    cnt = i
for j in range(m+1):
  if b[j] + a[cnt] <= k:
    cnt_ = j
ans = cnt + cnt_
for i in range(cnt):
  for j in range(cnt_, m+1):
    if a[cnt - i - 1] + b[j] > k:
      cnt_ = j
      break
    else:
      ans = max(ans, cnt - i - 1 + j)
print(ans)

Measured memory_bytes: 42192
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, string> P;
typedef tuple<int, string, string> T;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;

int solve() {
    return n % 1000 == 0 ? 0 : 1000 - (n % 1000);
}

void input() {
    cin >> n;
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 3588
def demerge(ary, count)

  if ary.size > 1

    divisor  = ary.size/2 - 1
    ary_1stH = ary[0 .. divisor]
    ary_2ndH = ary[divisor + 1 .. ary.size - 1]

    demerge(ary_1stH, count)
    demerge(ary_2ndH, count)

    merge(ary_1stH, ary_2ndH, ary, count)
  end
end

def merge(ary_1stH, ary_2ndH, ary, count)

  size = 0

  while ary_1stH.size > 0 && ary_2ndH.size > 0

    count[0] += 1

    if ary_1stH[0] < ary_2ndH[0]
      ary[size] = ary_1stH.shift
      size += 1
    else
      ary[size] = ary_2ndH.shift
      size += 1
    end
  end

  if ary_1stH.size > 0

    ary[size .. size + ary_1stH.size - 1] = ary_1stH
    size     += ary_1stH.size - 1
    count[0] += ary_1stH.size
  end

  if ary_2ndH.size > 0

    ary[size .. size + ary_2ndH.size - 1] = ary_2ndH
    size     += ary_2ndH.size - 1
    count[0] += ary_2ndH.size
  end
end

size_of_ary = gets.to_i
ary         = gets.split.map &:to_i

count       = [0]
demerge(ary, count)

puts ary.join(" "), count[0]



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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template <class T> vector<T> make_v(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto make_v(size_t N,T... t){return vector<decltype(make_v(t...))>(N,make_v(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int N,D; cin >> N >> D;
    cout << N / (2*D + 1) + (N % (2*D+1) == 0 ? 0 : 1) << endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define N 500005
using namespace std;
int n,cnt,sum,a[N],sz[N],tmp[N],ansx[N],ansy[N];
map<int,int>b;
vector<int>G[N];
inline bool cmp(int x,int y){return a[x]>a[y];}
void dfs(int u,int fa,int dep){
	sum+=dep;
	for (int i=0;i<(int)G[u].size();i++){
		int v=G[u][i];
		if (v==fa) continue;
		dfs(v,u,dep+1);
	}
}
signed main(){
	scanf("%lld",&n);
	for (int i=1;i<=n;i++) scanf("%lld",&a[i]),b[a[i]]=i,tmp[i]=i,sz[i]=1;
	sort(tmp+1,tmp+n+1,cmp);
	for (int i=1;i<n;i++){
		int x=tmp[i];
		int dis=a[x]-(n-sz[x])+sz[x];
		if (!b[dis]) return puts("-1"),0;
		int y=b[dis];
		sz[y]+=sz[x];ansx[++cnt]=x;ansy[cnt]=y;
		if (x==y) return puts("-1"),0;
		G[y].push_back(x);
	}
	int rt=tmp[n];sum=0;
	dfs(rt,-1,0);
	if (sum!=a[rt]) return puts("-1"),0;
	for (int i=1;i<=cnt;i++) printf("%lld %lld\n",ansx[i],ansy[i]);
	return 0;
}

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

using namespace std;

int a[222222], b[222222];
int main()
{
	int n, r = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%d", a + i);
		if (n & 1) r ^= a[i];
	}
	for (int i = 0; i < n; i++) {
		scanf("%d", b + i);
		if (n & 1) r ^= b[i];
	}
	for (int i = 1 << 30; i; i >>= 1) {
		for (int j = 0; j < n; j++)
			a[j] &= i - 1;
		sort(a, a + n);
		for (int j = 0; j < n; j++) {
			auto t = lower_bound(a, a + n, i - (b[j] & (i - 1)));
			if (a + n - t & 1)
				r ^= i;
		}
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 1792
a = gets.chomp

    if a[0] == a[1] && a[2] == a[3] && a[1] != a[2]
     puts "Yes"
        elsif a[0] == a[2] && a[1] == a[3] && a[0] != a[1]
     puts "Yes"
        elsif a[0] == a[3] && a[1] == a[2] && a[0] != a[1]
        puts "Yes"
    else
    puts "No"
    end


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

import sys
input=sys.stdin.readline

n,k=map(int,input().split())
arr=list(map(int,input().split()))
l=0
r=max(arr)+1
while r-l!=1:
    persuit=(r+l)//2
    cnt=0
    for val in arr:
        if val<=persuit:
            continue
        if val%persuit==0:
            cnt+=val//persuit-1
        else:
            cnt+=val//persuit
    if cnt<=k:
        r=persuit
    else:
        l=persuit
print(r)

Measured memory_bytes: 91948
import sys

n = int(input())
d = [list(map(int, input().split())) for i in range(n)]

cnt = 0

for e in d:
    if (e[0] + e[1])/2 == e[0]:
        cnt = cnt + 1
        if cnt == 3:
            print("Yes")
            sys.exit()
    else:
        cnt = 0

print("No")


Measured memory_bytes: 62564
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

struct Edge {
    ll rev, from, to;
    ll cap, original_cap;
    Edge(ll r, ll f, ll t, ll c) : rev(r), from(f), to(t), cap(c), original_cap(c) {};
};

struct Graph {
    vector<vector<Edge>> g;
    Graph(ll n) { g = vector<vector<Edge>>(n); };
    vector<Edge>& operator[](ll i) { return g[i]; }
    size_t size() {return g.size(); }
    Edge& redge(Edge e) {
        return g[e.to][e.rev];
    }
    void add_edge(ll from, ll to, ll cap) {
        g[from].push_back(Edge(g[to].size(), from, to, cap));
        g[to].push_back(Edge(g[from].size() - 1, to, from, 0));
    }
};

struct FordFulkerson {
    vector<bool> used;
    Graph& G;
    FordFulkerson(Graph& g) : G(g) {};
    ll dfs(ll v, ll t, ll f) {
        if(v == t) return f;
        used[v] = true;
        for(auto& e : G[v]) {
            if(used[e.to] || e.cap <= 0) continue;
            ll d = dfs(e.to, t, min(f, e.cap));
            if(d <= 0) continue;
            e.cap -= d;
            G.redge(e).cap += d;
            return d;
        }
        return 0;
    }
    ll max_flow(ll s, ll t) {
        ll flow = 0;
        while(true) {
            used.assign(G.size(), false);
            ll f = dfs(s, t, INFL);
            if(f == 0) return flow;
            else flow += f;
        }
        return 0;
    }
};

void solve() {
    ll n, m;
    cin >> n >> m;
    Graph G(n);
    for(ll i = 0; i < m; i++) {
        ll u, v, c;
        cin >> u >> v >> c;
        G.add_edge(u, v, c);
    }
    FordFulkerson F(G);
    cout << F.max_flow(0, n - 1) << endl;
    return;
}

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


Measured memory_bytes: 3356
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int n, k;
    cin >> n >> k;
    int r, s, p;
    cin >> r >> s >> p;
    string t;
    cin >> t;

    map<char, int> mp;
    mp['r'] = p; mp['s'] = r; mp['p'] = s;

    int res = 0;
    rep(i, k) {
        int temp = i;
        string ts = "";
        while(temp < t.size()) {
            ts += t[temp];
            temp += k;
        }
        //cout << ts << endl;
        int cnt = 0;
        int tmp = 0;
        bool flag = false;
        char c;
        rep(j, ts.size()-1) {
            if(ts[j]==ts[j+1]) {
                if(flag) cnt++;
                else {
                    cnt = 2;
                    c = ts[j];
                    flag = true;
                }
            } else {
                if(flag) {
                    tmp += mp[c]*(cnt/2);
                    if(cnt%2) tmp+=mp[c];
                    cnt = 0;
                    flag = false;
                } else {
                    tmp += mp[ts[j]];
                }
            }
        }
        if(flag) {
            tmp += mp[c]*(cnt/2);
            if(cnt%2) tmp += mp[c];
        } else tmp += mp[ts[ts.size()-1]];

        res += tmp;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>


using namespace std;

int main(){

  int N;
  cin >> N;
  vector<int> A(N, 0); // ダムの水
  long long sum = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    sum += A[i];
  }
  vector<int> M(N, 0);
  M[0] = sum;
  for(int i = 1; i < N; i+=2){
    M[0] -= 2*A[i];
  }
  for(int i = 1; i < N; i++){
    M[i] = 2*A[i-1] - M[i-1];
  }
  for(int i = 0; i < N-1; i++){
    cout << M[i] << " ";
  }
  cout << M[N-1] << endl;


  return 0;
}


Measured memory_bytes: 2048
#include<stdio.h>
const int N = 105;
int main()
{
	int n, a[N] = {0};
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}
	for(int i = n - 1; i >= 0; i--)
	{
		if(i)
		{
			printf("%d ", a[i]);
		}
		else
		{
		    printf("%d\n", a[i]);
		}
	}
	return 0;
 } 


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

int main(){
	int a = -1,b = -1;
	char s[1000004];
	scanf("%s",s);
	
	for(int i  = 0; i < strlen(s); i++){
		if(s[i] == s[i+1] ){
			a = i + 1 ;
			b = i + 2;
			break;
		}
		if(s[i] == s[i+2]){
			a = i + 1;
			b = i + 3;
			break ;
		}
	}
	
	cout << a << " " << b << "\n";
	return 0;
}

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

int main(){
  long long H,N;
  cin >> H >> N;
  vector<long long> A(N);
  for(int i=0;i<N;i++)  cin >> A.at(i);

  long long ans=0;
  for(int i=0;i<N;i++)  ans+=A.at(i);
  if(ans>=H)  cout << "Yes" << endl;
  else  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
	int W, H, x, y, r;
	
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

	/* 円中央＋半径が長方形の上下左右からはみ出しているか判定 */
	if ((W < (x+r)) || (0 > (x-r)) || (H < (y+r)) || (0 > (y-r))){
		printf("No\n");
	}/* それぞれはみ出してない場合は入っている*/
	else{
		 printf("Yes\n");
	}
	
	return 0;
}

Measured memory_bytes: 584
class mystr:
    def __init__(self,string):
        self.value = string

    def isEven(self):
        l = len(self.value)
        if (not l & 1) and self.value[:l//2] == self.value[l//2:]:
            return True
        else:
            return False

    def pop(self):
        l = len(self.value)
        self.value = self.value[:l-1]

s = mystr(input())
l = len(s.value)
for i in reversed(range(l)):
    s.pop()
    if s.isEven():
        print(i)
        break


Measured memory_bytes: 9068
#include <cstdio>
#include <iostream>
#define mod 998244353
using namespace std;

int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

int n, a[200005], mx;
long long ans, f[1000006], g[1000006];
int main() {
    n = read();
    for (int i = 1; i <= n; i++) {
        mx = max(a[i] = read(), mx);
        for (int j = 1; j * j <= a[i]; j++)
            if (a[i] % j == 0) {
                g[j] += a[i] / j;
                if (j * j != a[i]) g[a[i] / j] += j;
            }
    }
    for (int i = 1; i <= mx; i++)
        g[i] %= mod, f[i] = g[i] * g[i] % mod * i % mod;
    for (int i = mx; i; i--) {
        for (int j = 2; i * j <= mx; j++)
            f[i] = (f[i] - f[i * j] * j % mod + mod) % mod;
        ans += f[i];
    }
    ans %= mod;
    for (int i = 1; i <= n; ++i) (ans += mod - a[i]) %= mod;

    printf("%lld\n", ans * 499122177 % mod);
    return 0;
}

Measured memory_bytes: 16640
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def det(a,b):
        return a[0]*b[1]-a[1]*b[0]

    def minus(a,b):
        return (a[0]-b[0],a[1]-b[1])

    def convex_hull(ps):
        n = len(ps)
        ps.sort(key = lambda x:(x[1],x[0]))
        k = 0
        qs = [0]*(n+2)
        for i in range(n):
            while k > 1 and det(minus(qs[k-1], qs[k-2]), minus(ps[i], qs[k-1])) < 0:
                k -= 1
            qs[k] = ps[i]
            k += 1
        t = k
        for i in range(n-1)[::-1]:
            while k > t and det(minus(qs[k-1], qs[k-2]), minus(ps[i], qs[k-1])) < 0:
                k -= 1
            qs[k] = ps[i]
            k += 1
        qs = qs[:min(n,k-1)]
        return qs
    n = I()
    ps = LIR(n)
    qs = convex_hull(ps)
    print(len(qs))
    for i in qs:
        print(*i)
    return

#Solve
if __name__ == "__main__":
    solve()



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

using namespace std;

void bubbleSort(int *, int, int *);
void printArray(int *, int);

int main(int argc, char const* argv[]) {
    int n;
    cin >> n; 
    int A[100];
    int count;
    for (int i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }
    bubbleSort(A, n, &count);
    printArray(A, n);
    cout << count << endl;
    return 0;
}

void bubbleSort(int *A, int n, int *count) {
    int flag = 1;
    while (flag == 1) {
        flag = 0;
        for (int i = n - 1; i > 0; i--) {
            if (A[i] < A[i-1]) {
                int tmp = A[i];
                A[i] = A[i-1];
                A[i-1] = tmp;
                flag = 1;
                (*count)++;
            }
        }
    }
}

void printArray(int *A, int n) {
    for (int i = 0; i < n - 1; i++) {
        printf("%d ", A[i]);
    }
    printf("%d\n", A[n-1]);
}

Measured memory_bytes: 3212
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(), B = sc.nextInt(), X = sc.nextInt();
    if(X >= A && X <= A+B){
      System.out.println("YES"); 
    }
    else{
      System.out.println("NO"); 
    }
  }
}

Measured memory_bytes: 27088
#include<stdio.h>
#define n 5

int main(void)
{
	int a[n],i,j,t;

	for(i=0;i<n;i++)
	  scanf("%d",&a[i]);

	for( i = 1; i < n; ++i )//a[0]はソート済みだから１から始める
	{
		t = a[i];//ソート済みの部分の次で挿入する数値。
		for( j = i; j > 0 && a[j-1] < t; --j )//ソート済み部分を見る。
		{//探索しつつa[j]を一つづつ下げる。終了条件はj=0かa[j-1]が挿入部分よりも小さいならば
			a[j] = a[j-1];
		}
		a[j] = t;//挿入
	}
	printf("%d",a[0]);
	for(i=1;i<n;i++)
		printf(" %d",a[i]);
	printf("\n");
  return 0;
}

Measured memory_bytes: 1032
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  int a,b;
  char s[110],t[110];
  scanf("%s",s);
  scanf("%s",t);
  a=strlen(s);
  b=strlen(t);
  if(a>b)
    printf("GREATER\n");
  else if(a<b)
    printf("LESS\n");
  else if(strcmp(s,t)==0)
    printf("EQUAL\n");
  else{
    for(int i=0;i<a;i++){
      if(s[i]>t[i]){
        printf("GREATER\n");
        return 0;
      }
      else if(s[i]<t[i])
        printf("LESS\n");
      return 0;
    }
  }
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int t = sc.nextInt();
        int res = (n/x)*t;
        if (n % x > 0){
            res += t;
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 35640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ll n;
    cin >>n;
    string s;
    cin >>s;
    ll a=0,p=0;
    ll ans[n];
    ll wr[n];ll er[n];
    ll wl[n];ll el[n];
    for(ll i=0;i<n;i++){
      if(s[i]=='#') {
        a++;
      }
      else p++;
    }
    for(ll i=0;i<n;i++) wr[i]=0;
    for(ll i=0;i<n;i++) er[i]=0;
    for(ll i=0;i<n;i++) wl[i]=0;
    for(ll i=0;i<n;i++) el[i]=0;
    for(ll i=1;i<n;i++){
      if(s[i-1]=='#'){
         wl[i]++;
      }
      else el[i]++;
      wl[i]+=wl[i-1];el[i]+=el[i-1];
    }
    for(ll i=n-2;i>=0;i--){
      if(s[i+1]=='#'){
         wr[i]++;
      }
      else er[i]++;
      wr[i]+=wr[i+1];er[i]+=er[i+1];
    }
    for(ll i=0;i<n;i++){
      ans[i]=(wl[i]+er[i]);
      if(s[i]!='#') ans[i]++;
    }
    sort(ans,ans+n);
    cout << min({ans[0],a,p})<<endl;
  }


Measured memory_bytes: 8324
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    vector<int>v(m),diff(m-1);;
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    for(int i=0;i<v.size()-1;i++)
    {
        diff[i]=v[i+1]-v[i];
    }
    sort(diff.begin(),diff.end());
    n--;
    m--;
    int s=m-n;
    if(s<0)s=0;
    int sum=0;
    for(int i=0;i<s;i++)
    {
        sum+=diff[i];
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 4044
N, M, C = map(int, input().split())
B = list(map(int, input().split()))

ans = 0

for i in range(N):
    A = list(map(int, input().split()))

    sum = C
    for j in range(M):
        sum += A[j] * B[j]

    if sum > 0:
        ans += 1

print(ans)


Measured memory_bytes: 3060
int main(int argc ,const char *argv[])
{
    int a,b,c,s=0;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    for(int i=a;i<=b;i++){
    if(c%i==0){
        s++;
    }
    }
    printf("%d\n",s);
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(int& a){printf("%d",a);}
//void print(long long& a){printf("%lld",a);}
void print(double& a){printf("%.15lf",a);}
template<class T> void print(T& a){cout<<a;}
template<class T> void print(vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(Head& head, Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(T& a){cerr<<a;}
template<class T> void dprint(vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(Head& head, Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    string s;
    ll ans=0;
    codefor{
        in(s);
        if(s=="E869120")ans++;
    }
    out(ans);
}


Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
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;
    ll res=1900*m+100*(n-m);
    rep(i,m) res*=2;
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<18;
const ll INF=1LL<<55;

int main(){
    
    //std::ifstream in("text.txt");
    //std::cin.rdbuf(in.rdbuf());
    
    int A,B,C,D,E;cin>>A>>B>>C>>D>>E;
    if(A<0) cout<<(-A)*C+D+E*B<<endl;
    else cout<<(B-A)*E<<endl;
    
    
}




Measured memory_bytes: 3100
#include <algorithm>
#include <cstdio>
#define MOD 1000000007
typedef long long ll; 
inline ll quick_pow(ll a, int n)
{
	ll res = 1; 
	while (n)
	{
		if (n & 1)
			res = res * a % MOD; 
		a = a * a % MOD; 
		n >>= 1; 
	}
	return res; 
}
ll ans, fact[305], inv[305]; 
inline ll C(int n, int m)
{
	return fact[n] * inv[m] % MOD * inv[n - m] % MOD; 
}
int seq[305], n, k; 
char str[305]; 
inline void work(int len, int sum)
{
	int cur_one = 0, cur_two = 0, need = 0, arb = 0; 
	for (int i = 0; i < k; i++)
	{
		if (str[i] == 'r' && cur_one < len)
			need += seq[cur_one++] != 1; 
		else if (str[i] == 'b' && need)
		{
			need--; 
			arb += seq[cur_two++] - 2; 
		}
		else if (arb)
			arb--; 
	}
	if (cur_one < len || need || arb)
		return;
	ll res = fact[len], pos = len + 1; 
	for (int i = 0, j = 0; i < len; i = j)
	{
		while (j < len && seq[i] == seq[j])
			j++; 
		res = res * inv[j - i] % MOD; 
		pos += (j - i) * (seq[i] * 2 - 1); 
	}
	(ans += res * C(n - sum + pos - 1, pos - 1)) %= MOD; 
}
void dfs(int cur, int len, int sum)
{
	if (sum > n)
		return; 
	work(len, sum); 
	for (int i = cur; i; i--)
	{
		seq[len] = i; 
		dfs(i, len + 1, sum + std::max(1, i * 2 - 3) + (len != 0)); 
	}
}
int main()
{
	// freopen("ARC089-F.in", "r", stdin); 
	scanf("%d%d%s", &n, &k, str); 
	fact[0] = inv[0] = 1; 
	for (int i = 1; i <= 300; i++)
	{
		fact[i] = fact[i - 1] * i % MOD; 
		inv[i] = quick_pow(fact[i], MOD - 2); 
	}
	dfs(70, 0, 0); 
	printf("%lld\n", ans);
	return 0; 
}


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

int main()
{
    int n, t, ci, ti, cmin = 1 << 10;
    cin >> n >> t;
    for(int i = 0; i < n; i++){
        cin >> ci >> ti;
        if(ti <= t && ci <= cmin) cmin = ci;
    }
    if(cmin == 1 << 10) cout << "TLE" << endl;
    else cout << cmin << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int n,k,x,y;
    scanf("%d %d %d %d",&n,&k,&x,&y);
    if (n >= k)  printf("%d",k*x+(n-k)*y);
    else printf("%d",n*x);
	system("pause");
	return 0;
}

Measured memory_bytes: 376
def main():
    H, W, K = map(int, input().split())
    c = [input() for _ in range(H)]

    ans = 0
    for maskH in range((1 << H) - 1):
        for maskW in range((1 << W) - 1):
            black = 0
            for h in range(H):
                for w in range(W):
                    if (maskH >> h) & 1 == 0 and (maskW >> w) & 1 == 0 and c[h][w] == '#':
                        black += 1
            
            if black == K: ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9068
def traveling_plan(N: int, A: list) -> list:
    # 計算しやすいように最初と最後に原点を加えておく。
    A = [0] + A + [0]
    # 向き付き距離。d[i] = A[i+1] - A[i]
    d = [0] * (N + 1)
    # 総移動距離
    S = 0

    for i in range(0, N + 1):
        d[i] = A[i+1] - A[i]
        S += abs(d[i])

    def diff(a: int, b: int) -> int:
        return (a + b) - (max(a, b) - min(a, b))

    return [S - diff(abs(d[i]), abs(d[i + 1])) if d[i] * d[i + 1] < 0 else S
            for i in range(N)]


if __name__ == "__main__":
    N = int(input())
    A = [int(s) for s in input().split()]
    ans = traveling_plan(N, A)
    for a in ans:
        print(a)


Measured memory_bytes: 14888
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll MOD = 1e9+7;

const ll N = 1e6;



//a^(p-2)=a^(-1) (mod p)

//(x^n)%mod

ll mod_pow(ll x,ll n,ll mod){

  if(n==0)return 1;

  ll res=mod_pow( x*x%mod , n/2 , mod );

  if( n & 1 )res = res*x%mod;

  return res;

}



ll fact[N];

ll infact[N];



void make_factorial(void){

  fact[0] = 1;

  for( ll i = 1 ; i < N ; i++ ){

    fact[i] = fact[i-1] * i;

    fact[i] %= MOD;

  }

  for( ll i = 0 ; i < N ; i++ ){

    infact[i] = mod_pow( fact[i] , MOD-2 , MOD );

  }

}



ll comb(ll a,ll b){

  if(a == 0 && b == 0)return 1;

  if(a < b || a < 0)return 0;

  ll tmp = infact[a-b]* infact[b] % MOD;

  return tmp * fact[a] % MOD; 

}

int main(){
  ll n,k;
  cin>>n>>k;
  if(n>k){
	cout<<0<<endl;
	return 0;
  }
  make_factorial();
  cout<<comb(k,n)<<endl;
  return 0;
}



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

int main() {
  int N;
  cin >> N;
  vector<int> f(N);
  for (int x=1; x*x<N; x++){
    for (int y=1; y*y<N; y++){
      for (int z=1; z*z<N; z++){
        int n;
        n=x*x+y*y+z*z+x*y+y*z+z*x;
        if (n<=N) f.at(n-1)++;
      }
    }
  }
  for (int i=0; i<N; i++)
    cout << f.at(i) << endl;
  return 0;
}

Measured memory_bytes: 3584
import java.util.*;

public class Main{
    public static void main(String[] args){
        int count = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[100000 + 1];
        for(int i = 0; i<n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);
        int q = sc.nextInt();
        int[] Key = new int[100000];
        for(int i = 0; i < q; i++){
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        }
        System.out.println(count);

    }

    public static int binarySearch(int[] A, int Key){
        int left = 0;
        int right = A.length;
        int YesNo = 0;
        while(left < right){
            int mid = (int)Math.ceil((left + right)/2);
            if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            }
        }
        return YesNo;

    }
}



Measured memory_bytes: 68624
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  LL n,k;
  cin >> n >> k;
  vector<LL> a(n);
  for(LL &x:a) cin >> x;
  vector<int> bc(50);
  for(LL x:a) {
    REP(i, 50) {
      if(x & (1ll << i)) ++bc[i];
    }
  }
  LL opt = 0ll;
  REP(i, 50) if(bc[i] < n-bc[i]) opt += (1ll << i);
  LL answer = 0ll;
  for(LL x:a) answer += x ^ k;
  REP(i, 50) {
    if (k & (1ll << i)) {
      LL fx = (k & (~0ll << (i + 1))) | (opt & ~(~0ll << i));
      LL tmp = 0;
      for(LL x:a) tmp += x ^ fx;
      answer = max(answer, tmp);
    }
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int) N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=(int) n;i--)
#define p(s) cout<<(s)<<endl
#define DEBUG(x,y) cout<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl;
#define CK(n,a,b) ((a)<=(n)&&(n)<=(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const ll inf=1e9;



int main(){
	int n;
	cin>>n;
	deque<int> dq;
	REP(i,0,n){
		int a;
		cin>>a;
		if(i%2==1) dq.push_front(a);
		else dq.push_back(a);
	}
	bool flag=false;
	if(n%2==1)reverse(dq.begin(),dq.end());
	for(auto itr=dq.begin();itr!=dq.end();itr++){
		if(!flag){
			cout<<*itr;
			flag=true;
		}
		else cout<<" "<<*itr;
	}
	p("");
	return 0;
}


Measured memory_bytes: 2944
H, W = map(int, input().split(" "))
A=[]
for i in range(H):
    tmp = input()
    A.append ([c  for c in tmp])
    
# print (A)

h=H
w=W
for i in range(H-1,-1,-1):
    cnt = 0    
    for j in range(W):
        if A[i][j] == ".":
            cnt += 1


    if cnt == W:
        h -= 1
        for ii in range(i, H-1):
            for jj in range(W):
                A[ii][jj] = A[ii+1][jj]

for j in range(W-1,-1,-1):
    cnt = 0    
    for i in range(h):
        if A[i][j] == ".":
            cnt += 1


    if cnt == h:
        w -= 1
        for jj in range(j, W-1):
            for ii in range(h):
                A[ii][jj] = A[ii][jj+1]

def printA(A, h, w):
    for i in range(h):
        st = ""
        for j in range(w):
            st += (A[i][j])

        print (st)    

printA(A, h, w)

Measured memory_bytes: 3188
#include <stdio.h>
#include <math.h>
typedef long long ll;

int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    int p[m];
    char s[10];
    int x[m];
    int y[n];
    for(int i=0;i<n;i++){
        y[i]=1;
    }
    for(int i=0;i<m;i++){
        scanf("%d %s",&p[i],s);
        x[i]=(s[0]=='A')?1:0;
        
    }
    int ac=0;
    int pe=0;
    for(int i=0;i<m;i++){
        if(y[p[i]-1]>0){
            if(x[i]==0){
                pe++;
                y[p[i]-1]++;
            }
            else{
                ac++;
                y[p[i]-1]=0;
            }
        }
    }
    for(int i=0;i<n;i++){
        if(y[i]>0) pe-=y[i]-1;
    }
    printf("%d %d",ac,pe);
}



Measured memory_bytes: 1280
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	inputs := strings.Split(sc.Text(), " ")

	var raw = make([]int, num)
	for i := range raw {
		raw[i], _ = strconv.Atoi(inputs[i])
	}

	for i := range raw {
		key := raw[i]
		for j := i - 1; j >= 0; j-- {
			if raw[j] > key {
				raw[j+1] = raw[j]
				if j == 0 {
					raw[0] = key
				}
			} else {
				raw[j+1] = key
				break
			}
		}
		fmt.Println(strings.Trim(strings.Join(strings.Fields(fmt.Sprint(raw)), " "), "[]"))
	}

}



Measured memory_bytes: 1524
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int g = 5, mod = 924844033, N = 6e5 + 10;
int F[N], G[N], cnt[N], fac[N], inv[N], pos[N], sz[N], n;
vector<int> gr[N];
void dfs(int u, int fa) {
    sz[u] = 1;
    for(auto v : gr[u]) {
        if(v == fa) continue;
        dfs(v, u);
        sz[u] += sz[v];
        ++cnt[sz[v]];
    }
    ++cnt[n - sz[u]];
}
int qpow(int a, int b) {
    int c = 1;
    while(b) {
        if(b & 1) c = 1ll * c * a % mod;
        a = 1ll * a * a % mod;
        b >>= 1;
    } return c;
}
void NTT(int * a, int len, int op) {
    for(int i = 0; i < len; ++i)
        if(i < pos[i]) swap(a[i], a[pos[i]]);
    for(int i = 1; i < len; i <<= 1) {
        int s = i << 1;
        int wn = qpow(g, (mod - 1) / s);
        if(op == -1) wn = qpow(wn, mod - 2);
        for(int j = 0; j < len; j += s) {
            int w = 1;
            for(int k = 0; k < i; ++k, w = 1ll * w * wn % mod) {
                int x = a[k + j];
                int y = 1ll * w * a[i + j + k] % mod;
                a[k + j] = (x + y) % mod;
                a[i + k + j] = (x - y + mod) % mod;
            }
        }
    }
    if(op == -1) {
        int inv = qpow(len, mod - 2);
        for(int i = 0; i < len; ++i) 
            a[i] = 1ll * a[i] * inv % mod;
    }
}
int main() {
    scanf("%d", &n);
    for(int i = 1, u, v; i < n; ++i) {
        scanf("%d %d", &u, &v);
        gr[u].push_back(v);
        gr[v].push_back(u);
    }
    dfs(1, 0);
    fac[0] = 1; for(int i = 1; i <= n; ++i) fac[i] = 1ll * i * fac[i - 1] % mod;
    inv[n] = qpow(fac[n], mod - 2);
    for(int i = n; i >= 1; --i) inv[i - 1] = 1ll * i * inv[i] % mod;
    for(int i = 1; i <= n; ++i) F[i] = 1ll * cnt[i] * fac[i] % mod;
    reverse(F, F + 1 + n);
    for(int i = 0; i <= n; ++i) G[i] = inv[i];
    int len = 1, num = 0;
    while(len <= (n << 1)) len <<= 1, ++num;
    for(int i = 0; i < len; ++i) pos[i] = (pos[i >> 1] >> 1) | ((i & 1) << (num - 1));
    NTT(F, len, 1); NTT(G, len, 1);
    for(int i = 0; i < len; ++i) F[i] = 1ll * F[i] * G[i] % mod;
    NTT(F, len, -1);
    reverse(F, F + 1 + n);
    for(int i = 1; i <= n; ++i) {
        int ans = 1ll * n * fac[n] % mod * inv[i] % mod * inv[n - i] % mod;
        ans = (ans - 1ll * inv[i] * F[i] % mod + mod) % mod;
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 46528
#include <stdio.h>

int main() {

	int n, a[123] = { 0 };
	int min, max;
	int tmp=0, ans=0;

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

	for (int i = 0; i < n; i++) {
		if (i == 0) {
			min = a[i];
			max = a[i];
		}
		if (min > a[i])min = a[i];
		if (max < a[i])max = a[i];
	}

	for (int i = min; i < max; i++) {
		if (min == max) { ans = 0; break; }
		for (int j = 0; j < n; j++) {
			tmp += (a[j] - i)*(a[j] - i);
		}
		if (i == min) { ans = tmp; }
		if (ans > tmp) { ans = tmp; }
		tmp = 0;
	}

	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int n, m;
    cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

int main() {
    int a, b;
    int ans = 1;
    std::cin >> a >> b;
    if (b == 1) {
        std::cout << 0 << std::endl;
        return 0;
    }
    ans += ceil((float) (b - a) / (a - 1));

    std::cout << ans << std::endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    int n, y;
    cin >> n >> y;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n-i; j++){
            if(i*10000 + j*5000 + (n-i-j)*1000 == y){
                cout << i << " " << j << " " << n-i-j << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}

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

int main(void) {
	//?????°????????°?????\???
	int row;
	int col;
	scanf("%d %d\n", &row, &col);

	int cellnum[1000][1000] = { 0 };
	int colsum[1000] = { 0 };

	int i, j;
	//?????°?????????
	for (i = 0; i < row; i++) {
		char tmp[1000];
		//???????????\???
		fgets(tmp, sizeof(tmp), stdin);

		//???????????????
		cellnum[i][0] = atoi(strtok(tmp, " "));
		//?????°?????????
		for (j = 1; j < col; j++) {
			cellnum[i][j] = atoi(strtok(NULL, " "));
		}
		//?????°???????????????

	}
	//?????°???????????????

	//?????°?????????
	for (i = 0; i < row; i++) {

		//?????°?????????
		int  j;
		int rowsum = 0;
		for (j = 0; j < col; j++) {

			//??????????????°??????????????????
			printf("%d ", cellnum[i][j]);
			rowsum += cellnum[i][j];

			//???????????????????¨???????????????????
			if (j + 1 == col) {
				printf("%d\n", rowsum);
				colsum[j + 1] = rowsum;

			}
			//?????????????????????????¨????????????????????¶????
			colsum[j] += cellnum[i][j];
		}
		//?????°???????????????

	}
	//?????°???????????????

    int sum=0;
	//?????°?????????
	for (i = 0; i <= col; i++) {
	    
		if (i == col) {
			printf("%d\n", sum);
			break;
		}
		printf("%d ", colsum[i]);
        sum+=colsum[i];
	}
	//?????°???????????????

	return 0;
}

Measured memory_bytes: 4524
#include <stdio.h>

int main(void){
    int n;
    scanf("%d",&n);
    int count = 0;
    int ans = 0;
    for(int i=1;i<=n;i+=2){
        for(int j=1;j<=i;j+=2){
            if(i%j==0) count++;
        }
        if(count!=8) count = 0;
        else if(count=8){
            ans++;
            count = 0;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define pf pop_front
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
typedef long long ll;
const ll mod=1e9+7;
const ll maxn=3005;
const ll inf=1e9+7;
double dp[maxn][maxn];
double p[maxn];
double n;
int main()
{
    while(cin>>n)
    {
        double a=n/3,b=n/3;
        double c=n-a-b;
        cout<<fixed<<setprecision(6)<<a*b*c<<"\n";
    }
}


Measured memory_bytes: 256
#include<stdio.h> 
int main()
{
	int n, m;
	while(scanf("%d %d", &n, &m))
	{
		bool ok = true, go = false;
		if(n == 0 && m == 0)
		{
			break;
		}
		for(int i = 0; i < n; i++)
		{
			if(ok)
			{
				go = true;
				for(int j = 0;j < m;j++)
				{
					if(go)
					{
						printf("#");
						go = false;
					}
					else
					{
						printf(".");
						go = true;
					}
				}
				printf("\n");
				ok = false;
			}
			else
			{
				go = true;
				for(int j = 0;j < m;j++)
				{
					if(go)
					{
						printf(".");
						go = false;
					}
					else
					{
						printf("#");
						go = true;
					}
				}
				printf("\n");
				ok = true;
			}
		
		}
		
		 printf("\n");
	}

	return 0;
}


Measured memory_bytes: 2624
#include<bits/stdc++.h>
using namespace std;
int main(){


  int ara[105];
  int a=0,b,i,t,n=0;
  int ma=ara[0];
  cin>>t;
  for(i=0;i<t;i++){

    cin>>ara[i];
  n=n+ara[i];


}
sort(ara, ara+t);
a=n-ara[t-1];


    if(ara[t-1]<a){
        cout<<"Yes"<<"\n";
    }
    else{
        cout<<"No"<<"\n";
    }
return 0;

}

Measured memory_bytes: 256
#include <stdio.h>

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B

#define swap(a, b)                                                             \
    a = a + b;                                                                 \
    b = a - b;                                                                 \
    a = a - b;

int main(int argc, char **argv) {
    int n, i, j, a[1024], min, cnt = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    for (i = 0; i < n; i++) {
        min = i;
        for (j = i + 1; j < n; j++) {
            if (a[j] < a[min])
                min = j;
        }
        if (min != i) {
            swap(a[min], a[i]);
            cnt++;
        }
    }
    for (i = 0; i < n; i++) {
        printf("%d", a[i]);
        if (i == n - 1)
            printf("\n");
        else
            printf(" ");
    }
    printf("%d\n", cnt);

    return 0;
}


Measured memory_bytes: 2048