akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions

import sys
def input():
	return sys.stdin.readline().strip()

def soinsu_bunkai(n):
	ans = []
	num = n
	i = 2
	while i <= n**0.5:
		if num % i == 0:
			if len(ans) == 0 or ans[-1][0] != i:
				ans.append([i, 1])
			else:
				ans[-1][1] += 1
			num = num//i
		else:
			i+=1
	if num != 1:
		ans.append([num, 1])

	return ans

A, B = list(map(int, input().split()))

C = fractions.gcd(A, B)

C_list = soinsu_bunkai(C)

print(len(C_list) + 1)

Measured memory_bytes: 65132
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String[] tmpString = sc.nextLine().split(" ");
		int K = Integer.parseInt(tmpString[0]);
		int S = Integer.parseInt(tmpString[1]);
		
		int count = 0;
		for (int i = 0; i <= K; i++) {
			for (int j = 0; j <= K; j++) {
				int total = S - i - j;
				if (total >= 0 && total <= K) count++;
			}
		}
		
		System.out.println(count);
	}
}


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

typedef long long ll;
const int N = 100010;
inline int lowbit(int n){return n & -n;}

int n, m;
ll c[N], ans[N], a[N];

void add(int sit, ll value){
	for ( ; sit < N; sit += lowbit(sit)){
		c[sit] += value;
	}
}

ll query(int sit){
	ll ret = 0;
	for ( ; sit; sit -= lowbit(sit)){
		ret += c[sit];
	}
	return ret;
}

int main(){
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; ++ i){
		scanf("%d", &a[i]);
	}
	for (int i = 1; i < n; ++ i){
		if (a[i - 1] <= a[i]){
			int x = a[i] - a[i - 1];
			add(1, x);
			add(2, -x);
			add(a[i - 1] + 2, -1);
			add(a[i] + 1, x);
			add(a[i] + 2, -x + 1);
		}
		else{
			int x = a[i] + m - a[i - 1];
			add(1, a[i]);
			add(2, -a[i] - 1);
			add(a[i] + 1, x);
			add(a[i] + 2, 1 - x);
			add(a[i - 1] + 2, -1);
		}
		/*
		for (int i = 1; i <= m; ++ i){
			ans[i] = ans[i - 1] + query(i);
			printf("%d%c", ans[i], " \n"[i == m]);
		}*/
	}
	ll min = LLONG_MAX;
	for (int i = 1; i <= m; ++ i){
		ans[i] = ans[i - 1] + query(i);
		min = std::min(min, ans[i]);
	}
	return printf("%lld\n", min), 0;
}

Measured memory_bytes: 2560
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)
#define rrep(i,x) for(int i=(int)x-1;i>=0;--i)
#define rrep1(i,x) for(int i=(int)x;i>=1;--i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}
constexpr ll TEN(int n){return n==0?1:10*TEN(n-1);}

constexpr ll inf = TEN(9)+5;
constexpr ll linf = 3*TEN(18);

const int mod = TEN(9) + 7;

int N, M;
vector<int> D, T;
map<int, int> cnt[2];

signed main()
{
    cin >> N;
    D.resize(N);
    rep(i, N) cin >> D[i], cnt[0][D[i]]++;
    cin >> M;
    T.resize(M);
    rep(i, M) cin >> T[i], cnt[1][T[i]]++;

    bool f = true;

    for (pii p : cnt[1]) {
        if (p.scd > cnt[0][p.fst]) f = false;
    }

    cout << (f ? "YES" : "NO") << endl;
}


Measured memory_bytes: 23412
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int a, b, k; readV(a, b, k);
  foreach_reverse (i; 1..101) {
    if (a%i == 0 && b%i == 0) {
      --k;
      if (k == 0) {
	writeln(i);
	return;
      }
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef pair<l_l,ll> lll;
typedef vector<string> vs;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
const int mod = 1000000007;
struct mint {
ll x;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
ll n;
vector<ll> g[110000];
mint dp[110000][2];
void dfs(ll x,ll last=-1){
    dp[x][1]=dp[x][0]=1;
    for(auto y:g[x]){
        if(y==last)continue;
        dfs(y,x);
        dp[x][0]*=dp[y][0]+dp[y][1];
        dp[x][1]*=dp[y][0];
    }
}
int main(){
    cin>>n;
    ll u,v;
    rep(i,n-1){
        cin>>u>>v;
        g[u].pb(v);
        g[v].pb(u);
    }
    dfs(1,-1);
    mint ans=dp[1][1]+dp[1][0];
    cout<<ans.x<<endl;
    return 0;
}

Measured memory_bytes: 19380
import sys
input = sys.stdin.readline
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(N-2):
 mid =i+1
 l=0
 r=i+2
 while r<N:
  if L[r]-L[l]<L[mid]:
   ans+=(mid-l)
   r+=1
  else:
   if l==mid-1:
    r+=1
   else:
    l+=1
print(ans)

Measured memory_bytes: 3188
#include<iostream>

using namespace std;

int main() {

	int N = 0;
	int X = 0;
	int m[100] = {};
	int min = 1001;

	cin >> N >> X;

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

		cin >> m[i];
		X -= m[i];
		if (min > m[i])min = m[i];

	}

	cout << N + X / min << endl;

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define X ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
 
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
 
// long long p = 1e9+7;
 
typedef long long ll;
typedef pair<ll,ll> pl;
typedef vector<int> VI;
typedef vector<pair<ll,ll>> VP;
typedef vector<ll> VL;
typedef vector<bool> VB;
 
// typedef pair<ll, ll> PL;
typedef unordered_map<ll, ll> UMP;
#define FOR(i,b) for(i=0;i<b;i++)
#define pb push_back
#define mp make_pair
 
// typedef  unordered_set<ll>;
 
 
void printa(VI &x,ll n){
    ll i;
    FOR(i, n){
        cout<<x[i]<<" ";
    }
    cout<<endl;
}
 
 
/////GLOABLS VARS
ll MOD = 1e9+7;
ll gmx = 1e6+7; 

VL fact(gmx, 1);
//////FUNCTIONS
ll powp(ll val, ll deg)
{
    // debug(val, deg);
    if (!deg)
        return 1;
    if (deg & 1)
        return (powp(val, deg - 1) * val) % MOD;
    ll res = powp(val, deg >> 1);
    // debug(res);
    return (res * res) % MOD;
}





//It is not easy but it can be fun, if you think!!!

//
// ll mx = 2*1e5+7;


int main(){
      ios::sync_with_stdio(0);
      cin.tie(0);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    //     #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
    // #endif
    ll n,m;
    cin>>n>>m;
    cout<<(n+2*m)/(2*m+1);
    // }    
    
}

Measured memory_bytes: 11048
fun main (args : Array<String>) {
	val s = readLine()
	val S : Int = s!!.toInt()
	var list : MutableList<Int> = mutableListOf()
	var i : Int = 0
	list.add(S)
	do {
		if ( (list[i] % 2) == 0 ) {
			list.add(list[i] / 2)
		} else {
			list.add( (list[i] * 3) + 1)
		}
		i++
		
	} while (list.count {it == list[i]} != 2)
	println("${i + 1}")
}

Measured memory_bytes: 33780
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,Q; cin >> N >> Q;
    vector<ll> A(N),x(Q);
    rep(i,N) cin >> A[i];
    rep(i,Q) cin >> x[i];

    rep(i,Q) {
        ll ans = 0, right = 0, val = 0;
        for (ll left = 0; left < N; left++) {
            while (right < N && val + A[right] <= x[i]) {
                val += A[right];
                right++;
            }
            ans += right - left;
            if (left == right) right++;
            else val -= A[left];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N; cin >> N;
  int result = pow(10, 9);
  rep(i, N) {
    int A; cin >> A;
    int x = 0;
    while (A%2==0) {
      A /= 2;
      x++;
    }
    result = min(result, x);
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

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

int R, C, M, keep[60][60], on[60][60], off[60][60], X[2525], Y[2525];
bool checked[60][60];
vector<int> pass[60][60];
char board[60][60];
int tot = 0;

void read_input(int A[][60]) {
    for(int i=0; i<R; i++) {
        for(int j=0; j<C; j++) {
            scanf("%d", &A[i][j]);
        }
    }
}

int dfs(int x, int y, int tx, int ty, int d) {
    if(x == tx && y == ty) return d;
    for(int k=0; k<4; k++) {
        int nx = x + dx[k], ny = y + dy[k];
        if(nx < 0 || nx >= R || ny < 0 || ny >= C) continue;
        if(board[nx][ny] == '#' || checked[nx][ny]) continue;
        checked[nx][ny] = true;
        int val = dfs(nx, ny, tx, ty, d+1);
        checked[nx][ny] = false;
        if(val) {
            pass[x][y].push_back(tot + d);
            return val;
        }
    }
    return 0;
}

void solve() {
    for(int i=0; i<M-1; i++) {
        checked[ X[i] ][ Y[i] ] = true;
        tot += dfs(X[i], Y[i], X[i+1], Y[i+1], 0);
        checked[ X[i] ][ Y[i] ] = false;
    }
    pass[ X[M-1] ][ Y[M-1] ].push_back(tot);

    int ans = 0;
    for(int i=0; i<R; i++) {
        for(int j=0; j<C; j++) {
            int N = pass[i][j].size();
            if(!N) continue;
            ans += on[i][j] + off[i][j];
            for(int k=0; k<N-1; k++) {
                int diff = pass[i][j][k+1] - pass[i][j][k];
                int vl = on[i][j] + off[i][j];
                int vr = keep[i][j] * diff;
                ans += min(vl, vr);
            }
        }
    }
    printf("%d\n", ans);
}

int main() {
    scanf("%d%d%d", &R, &C, &M);
    for(int i=0; i<R; i++) {
        for(int j=0; j<C; j++) {
            scanf(" %c", &board[i][j]);
        }
    }
    read_input(keep);
    read_input(on);
    read_input(off);
    for(int i=0; i<M; i++) {
        scanf("%d%d", &X[i], &Y[i]);
    }

    solve();
    return 0;
}


Measured memory_bytes: 7676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    int r;
    cin >> r;
    if(r<1200){cout << "ABC" << endl;}
    else if(r<2800){cout << "ARC" << endl;}
    else{cout << "AGC" << endl;}
}


Measured memory_bytes: 764
package main

import "fmt"

func main() {
	var k int
	fmt.Scan(&k)
	ans := 0
	for p := 1; p <= k; p++ {
		for q := 1; q <= k; q++ {
			for r := 1; r <= k; r++ {
				ans += gcd(p, gcd(q, r))
			}
		}
	}
	fmt.Println(ans)
}

func gcd(a, b int) (ret int) {
	if a > b {
		a, b = b, a
	}
	for a > 0 {
		a, b = b%a, a
	}
	return b
}


Measured memory_bytes: 1840
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
template <typename T>
inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}

int main(){
    ll n,t;cin>>n>>t;
    ll ans=INF;
    rep(i,n){
        ll a,b;cin>>a>>b;
        if(b<=t){
            chmin(ans,a);
        }
    }

    if(ans!=INF) cout<<ans<<endl;
    else cout<<"TLE"<<endl;
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
using namespace std;
int n,m,i,j,vis[100005],d[100005];
vector<int> bi[100005],bi2[100005];
set<int> s[100005];
void dfs(int x,int p)
{
	vis[x]=1;
	ff(bi[x],it){
		if(*it==p)continue;
		if(vis[*it]==1){
			if(!s[*it].count(x)){
				s[x].insert(*it);
				printf("%d %d\n",x,*it);
				d[x]^=1;
			}
		}
		else{
			dfs(*it,x);
			bi2[x].push_back(*it);
		}
	}
}
void dfs2(int x,int p)
{
	ff(bi2[x],it){
		if(*it==p)continue;
		dfs2(*it,x);
		if(d[*it]){
			printf("%d %d\n",*it,x);
			d[*it]=0;
		}
		else{
			printf("%d %d\n",x,*it);
			d[x]^=1;
		}
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	fz1(i,m){
		int x,y;
		scanf("%d%d",&x,&y);
		bi[x].push_back(y);
		bi[y].push_back(x);
	}
	if(m&1){
		puts("-1");
		return 0;
	}
	dfs(1,0);
	dfs2(1,0);
	return 0;
}

Measured memory_bytes: 25600
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<utility>
#define pb push_back
#define sz(x) (int)x.size()
#define scf scanf
#define ptf printf
#define forp(i,j,k) for(int i=j;i<k;i++)
#define form(i,j,k) for(int i=j;i>k;i--)
using namespace std;
typedef long long LL;
const int N=51,dx[5]={0,-1,1,0,0},dy[5]={0,0,0,-1,1};

struct node
{
    int x,y;
}q[N*N];

int u[N][N],d[N][N],wl[N][N][5],ix,iy,ox,oy,w,h;

int  bfs()
{
    memset(u,0,sizeof(u));
    q[0].x=ix,q[0].y=iy;u[ix][iy]=1;d[ix][iy]=0;
    for(int l=0,r=1;l<r;l++)
    {
        int x=q[l].x,y=q[l].y;
        if(x==ox&&y==oy)return d[ox][oy];
        forp(i,1,5)
        {
            int xx=x+dx[i],yy=y+dy[i];
            if(!wl[x][y][i]&&xx>=0&&xx<w&&yy>=0&&yy<h&&!u[xx][yy])
            {
                q[r].x=xx;q[r].y=yy;r++;d[xx][yy]=d[x][y]+1;u[xx][yy]=1;
            }
        }

    }
    return -1;
}

int main()
{
    int x1,y1,x2,y2,n;
    scf("%d%d%d",&w,&h,&n);
    forp(i,0,n)
    {
        scf("%d%d%d%d",&x1,&y1,&x2,&y2);
        if(x1==x2&&(x1==0||x1==w))continue;
        if(y1==y2&&(y1==0||y1==h))continue;
        if(x1==x2)forp(j,min(y1,y2),max(y1,y2))wl[x1-1][j][2]=wl[x1][j][1]=1;
        if(y1==y2)forp(j,min(x1,x2),max(x1,x2))wl[j][y1-1][4]=wl[j][y1][3]=1;
    }
    scf("%d%d%d%d",&ix,&iy,&ox,&oy);
    int tans,ans;
    tans=ans=bfs();
    forp(i,0,w)
        forp(j,0,h)
        {
            if(i!=w-1&&!wl[i][j][2])
            {
                wl[i][j][2]=wl[i+1][j][1]=1;
                tans=max(tans,bfs());
                wl[i][j][2]=wl[i+1][j][1]=0;
            }
            if(j!=h-1&&!wl[i][j][4])
            {
                wl[i][j][4]=wl[i][j+1][3]=1;
                tans=max(tans,bfs());
                wl[i][j][4]=wl[i][j+1][3]=0;
            }
        }
    ptf("%d\n",tans-ans);
    return 0;
}

Measured memory_bytes: 1128
import collections 

s=input()
t=input()
s= collections.Counter(s)
t= collections.Counter(t)
#print(s)
sans=[]
tans=[]

for v in s.values():
    sans.append(v)
for v in t.values():
    tans.append(v)
sans.sort()
tans.sort()
#print(sans,tans)
if sans==tans:
    print('Yes')
else:
    print('No')


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

using namespace std;
int main(void){
    int n =0, s1=0, s2=0;
    int ans = INF;
    cin >> n;
    vector<int>W(n,0);
    rep(i, n) cin >> W[i];
    rep(i, n){
        for(int j =0; j<=i; j++){
            s1 += W[j];
        }
        for(int j=i+1; j<n; j++){
            s2 += W[j];
        }
        if (abs(s1-s2) < ans) ans = abs(s1-s2);
        //cout << abs(s1-s2) << endl;
        s1=0, s2=0;
    }
    cout << ans;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
L = 1
R = N
for i in range(M):
  l, r = map(int, input().split())
  if l > L:
    L = l
  if r < R:
    R = r
if R < L:
  print(0)
else:
  print(R - L + 1)

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

using namespace std;

const int INF = 1000000000;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  vector<int> dp(N, INF);
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    for (int k = 1; (k < K + 1 && i + k < N); k++) {
      dp[i + k] = min(dp[i + k], dp[i] + abs(H[i + k] - H[i]));
    }
  }
  cout << dp[N - 1] << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
int main(){
    ll a,b,c,k;
    cin >>a>>b>>c>>k;
    if (abs(a-b) > 1.0e18){
        cout << "Unfair" << endl;
        return 0;
    }
    switch(k%2){
        case 0:
            cout << a-b << endl;
            return 0;
        case 1:
            cout << b-a << endl;
            return 0;
    }
    
}

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

const int N=1e5+20,MOD=1e9+7;

int n,k,dp[N],ans;

int mul(int a,int b) {return (1ll*a*b)%MOD;}

int power(int a,int b)
{
	int num=a,ans=1;
	while(b)
	{
		if(b&1) ans=mul(ans,num);
		b>>=1;
		num=mul(num,num);
	}
	return ans;
}

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

	for(int i=k;i>=1;i--)
	{
		for(int j=2*i;j<=k;j+=i)
		{
			dp[i]=(dp[i]-dp[j])%MOD;
			if(dp[i]<0) dp[i]+=MOD;
		}
		dp[i]=(dp[i]+power(k/i,n))%MOD;
		ans=(ans+mul(i,dp[i]))%MOD;
	}

	printf("%d",ans);
}

Measured memory_bytes: 4096
/**
 * 	author: MahfuzAhmed
 * 	created: 09.08.2019 
**/

#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define forn(var,from,to) for(int var=(from);var<(to);var++)
#define forx(var,from,to) for(int var=(from);var<=(to);var++)
#define fory(var,from,to) for(int var=(from);var>=(to);var--)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vvi vector<vi>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define all(p) p.begin(),p.end()
typedef long long ll;
//~ const double pi = 2*acos(0.0);
//~ const long long mod = 1e9+7;
//~ const int MAX_N = 1e6+5;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
       
    #ifdef _DEBUG
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
    int n; cin >> n;
    int heights[n];
    
    forn(i, 0, n) cin >> heights[i];
    
    int b = heights[0];
    int cnt = 1;
    
    forn(i, 1, n){
        if(heights[i] >= b){
            cnt++;
            b = heights[i];
        }
    }
    
    cout << cnt << "\n";
    
    
    return 0;
}

Measured memory_bytes: 256
rows = int(input())
li = [list(map(int, input().split())) for i in range(rows)]
sum = 0
for l in li:
  if l[0]==l[1]:
    sum=sum+1
  else:
    sum=0
  if sum==3:
    break
if sum==3:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9176
#include <iostream>

using namespace std;

int main()
{
	int n;

	int i;
	int a;

	long max = -1000000, min = 1000000;
	long sum = 0;

	cin >> n;

	for (i = 0; i < n; i++)
	{
		cin >> a;

		sum += a;

		if (max < a)
			max = a;
		if (min > a)
			min = a;
	}

	cout << min << ' ' << max << ' ' << sum << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b);
#define chmin(a, b) (a)=min(a, b);
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k;
  
  ll N, K, S;
  cin >> N >> K >> S;
  
  
  if(S==1e9) {
    for(i=0; i<K; i++) pt(S);
    for(i=0; i<N-K; i++) pt(S-1);
  }else {
    for(i=0; i<K; i++) pt(S);
    for(i=0; i<N-K; i++) pt(S+1);
  }
  
}





Measured memory_bytes: 1280
/*
      @author: Charan Sai
*/
#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define ppi pair<int, int>
#define INT INT_MAX
#define endl "\n"
#define nl cout << "\n"
#define deb(x) cout << #x << " " << x << endl;

const int M = 1e5 + 1;
int N, W;
int wt[M], val[M];

// Top-Down Solution = Remove read-only arguments and redundant arguments
// and cache the results
// Time = (Range of possible values of the variable arguments) * (Time Compl of each function call)
// O(N * Weight) Time (Pseudo Polynomial)
// O(N * Weight) Space
int Top_Down(vector<vector<int>> dp, int i, int curr_w=W) {
    // Base Cases
    if(i == 0 || curr_w == 0) return 0;

    if(dp[i][curr_w] != -1) return dp[i][curr_w];

    // Choice
    if(wt[i] > curr_w)
        return Top_Down(dp, i-1, curr_w);

    int incl = Top_Down(dp, i-1, curr_w - wt[i]) + val[i];
    int excl = Top_Down(dp, i-1, curr_w);

    return (dp[i][curr_w] = max(incl, excl));
}

// O(N * Weight) Time & Space
int Bottom_Up() {
    vector<vector<int>> dp(N+1, vector<int>(W+1, 0));
    for(int i = 1; i <= N; ++i) {
        for(int curr_w = 1; curr_w <= W; ++curr_w) {
            if(wt[i] > curr_w) {
                dp[i][curr_w] = dp[i-1][curr_w];
                continue;
            }
            int incl = dp[i-1][curr_w - wt[i]] + val[i];
            int excl = dp[i-1][curr_w];
            dp[i][curr_w] = max(incl, excl);
        }
    }
    return dp[N][W];
}

int32_t main() {
    IOS;
    cin >> N >> W;
    // vector<vector<int>> dp(N+1, vector<int>(W+1, -1));
    for(int i = 1; i <= N; ++i) {cin >> wt[i]; cin >> val[i];}
    cout << Bottom_Up() << endl;
}

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

using namespace std;

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

int main( ){
	int k;
	cin>>k;
	if(k%7==0){
		k=k/7;
	}
	if(gcd(10,k)!=1){
		cout<<-1<<endl;
		return 0;
	}
	long long int l=1,v=1%k;
	while(v!=0){
		l++;
		v=(v*10+1)%k;
	}
	cout<<l<<endl;
	return 0;
}

Measured memory_bytes: 3604
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main (string[] args)
        {
            string[] str;
            str = Console.ReadLine ().Split (' ');

            long N = long.Parse (str[0]);

            string ans = "";
            for (int i = 1; i < 100; i++)
            {
                if (N <= Math.Pow (26, i))
                {
                    N -= 1;
                    for (int j = 0; j < i; j++)
                    {
                        ans = ((char) ('a' + (N % 26))).ToString () + ans;
                        N /= 26;
                    }
                    break;
                }
                else
                {
                    N -= (long) Math.Pow (26, i);
                }
            }

            Console.WriteLine (ans);
        }
    }

    class MyLibrary
    {

        // 自作の関数
        public static int MyFunction (int n)
        {
            return 0;
        }
    }
}

Measured memory_bytes: 27800
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
using namespace std;

const double kRate = 380000.0;

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

  int jpy = 0;
  double btc = 0;
  for (int i = 0; i < n; ++i) {
    string x, u;
    cin >> x >> u;
    if (u == "JPY")
      jpy += strtoll(x.c_str(), nullptr, 10);
    else
      btc += strtod(x.c_str(), nullptr);
  }
  std::printf("%.9f\n", jpy + btc * kRate);

  return 0;
}



Measured memory_bytes: 256
import java.io.*
import java.util.*

val pw = PrintWriter(System.out)
fun solve(C: String){
    val alphas = ('a'..'z').toList()
    val i = alphas.indexOfFirst{ it == C[0]} + 1
    println(alphas[i])
    pw.flush()
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val C = sc.next()
    solve(C)
}



Measured memory_bytes: 29596
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N, M;
  cin >> N >> M;
  
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  
  int mysum = 0;
  for(int i = 0; i < N; i++){
    mysum += vec.at(i);
  }
  
  int count = 0;
  for(int i = 0; i < N; i++){
    if(mysum <= 4 * vec.at(i) * M){
      count++;
    }
  }
  
  if(count >= M){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 384
import Data.Array

calcScore :: [[Int]] -> [Int] -> Int
calcScore ctx as = do
    let aas = array (0,(length as - 1)) $ zip [0..] $ reverse as
    sum $ map (\ [a,b,c,d] -> if aas!(b-1) - aas!(a-1) == c then d else 0) ctx


solve :: Int -> Int -> [[Int]] -> [Int] -> Int
solve n m ctx as = if length as == n
                      then calcScore ctx as
                      else maximum $ map (solve n m ctx) $ map (flip (:) as) [(if as==[] then 1 else head as)..m]

main = do
    [n,m,q] <- map read . words <$> getLine :: IO[Int]
    co <- getContents
    let ctx = map (map read . words) $ lines co :: [[Int]]
    print $ solve n m ctx []


Measured memory_bytes: 5000
<?php
$input = trim(fgets(STDIN));
List($a, $b, $c) = explode(" ", $input);

$ans = 0;
for ($i = $a; $i <= $b; $i++) {
  if (($c % $i) == 0) {
    $ans++;
  }
}

echo "{$ans}".PHP_EOL;

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

LL N, dp[2010], mod=1e9+7;

LL f(int n) {
	if (n<0) return 0;
	if (n==0) return 1;
	if (dp[n] != -1) return dp[n];
	dp[n] = 0;
	for(int i=3; i<=n; i++) {
		dp[n] += f(n-i);
		dp[n] %= mod;
	}
	return dp[n];
}

int main () {
	cin >> N;
	memset(dp, -1, sizeof(dp));
	cout << f(N) << endl;
}


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

string a = "aiueo";

int main() {
    int a, b;
    char op;
    cin >> a >> op >> b;
    
    int res;
    if(op == '+') res = a + b;
    else res = a - b;
    cout << res <<endl;
}

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

using namespace std;

int main(){
	int n;
	cin>>n;
	int sum = 0;
	vector<int> d(n);
	for(int i = 0; i<n ; i++){
		cin>>d[i];
		}
	for(int i = 0; i<n; i++){
		for(int j = i+1 ; j<n;j++){
			sum += d[i]*d[j];
			}
		}	
	cout<<sum;
	return 0;
	}


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

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

typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeSearch(Node x, int k){

  if(x == NIL || k == x->key){
    return x;
  }
  if(k < x->key ){
    return treeSearch(x->left, k);
  }else{
    return treeSearch(x->right, k);
  }
}

Node treeSuccessor(Node x){

  Node y;

  if(x->right != NIL){
    return treeMinimum(x->right);
  }
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL){
    y = z;
  }else{
    y = treeSuccessor(z);
  }

  if(y->left != NIL){
    x = y->left;
  }else{
    x = y->right;
  }

  if(x != NIL){
    x->parent = y->parent;
  }

  if(y->parent  == NIL){
    root = x;
  }else if(y == y->parent->left){
    y->parent->left = x;
  }else{
    y->parent->right = x;
  }

  if(y != z){
    z->key = y->key;
  }
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
  y = x;
  if(z->key < x->key){
    x = x->left;
  }else{
    x = x->right;
  }
  } 
  
  z->parent = y;

  if( y == NIL){
    root = z;
  }else if(z->key < y->key){
    y->left = z;
  }else{
    y->right = z;
  }
}

void inorder(Node u){

  if(u != NIL){
    inorder(u->left);
    printf(" %d", u->key);  
    inorder(u->right);
  }
}
void preorder(Node u){

  if(u != NIL){
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
  }
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

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

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

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

    // start
    int res = 0;
    rep(i, 6)
    {
        char s;
        cin >> s;
        if (s == '1')
            res++;
    }
    cout << res << endl;
    // end

    return 0;
}


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

#define MAX_V 100
#define INF 10000000

using namespace std;

typedef pair<int, int> P;

struct edge {
	int to, info;
	edge(int _to, int _info) { to = _to, info = _info; };
};

vector<edge> Gc[MAX_V];
vector<edge> Gt[MAX_V];
int V, E;
int c[MAX_V];
int t[MAX_V];
int cm[MAX_V][MAX_V];
int tm[MAX_V][MAX_V];

void solve();
void dijkstra(int s, int g, int r);

int main()
{
	while (cin>>E>>V, E != 0 && V != 0) {
		for (int i = 0; i < V; i++) {
			fill(cm[i], cm[i] + V, INF);
			fill(tm[i], tm[i] + V, INF);
			cm[i][i] = 0, tm[i][i] = 0;
			Gc[i].clear(), Gt[i].clear();
		}
		for (int i = 0; i < E; i++) {
			int fr, to, co, ti;
			cin>>fr>>to>>co>>ti;
			Gc[fr - 1].push_back(edge(to - 1, co));
			Gc[to - 1].push_back(edge(fr - 1, co));
			Gt[fr - 1].push_back(edge(to - 1, ti));
			Gt[to - 1].push_back(edge(fr - 1, ti));
		}
		solve();
	}
}

void solve()
{
	int k,p,q,r;
	cin>>k;
	for (int i = 0; i < k; i++) {
		cin>>p>>q>>r;
		if (r == 0 && (cm[p-1][q-1] != INF || cm[q-1][p-1] != INF)) {
			cout<<min(cm[p-1][q-1], cm[q-1][p-1])<<endl;
		} else if (r == 1 && (tm[p-1][q-1] != INF || tm[q-1][p-1] != INF)) {
			cout<<min(tm[p-1][q-1], tm[q-1][p-1])<<endl;
		} else {
			dijkstra(p - 1, q - 1, r);
		}
	}
}

void dijkstra(int s, int g, int r)
{
	priority_queue<P, vector<P>, greater<P> > que;
	switch (r) {
			case 0:
			que.push(P(0,s));
			fill(c, c + V, INF);
			c[s] = 0;
			while (!que.empty()) {
				P p = que.top();
				que.pop();
				int v = p.second;
	
				if (c[v] < p.first) continue;
				for (int i = 0; i < Gc[v].size(); i++) {
					edge e = Gc[v][i];
					if (c[e.to] > c[v] + e.info) {
						c[e.to] = c[v] + e.info;
						que.push(P(c[e.to], e.to));
					}
				}
			}
			
			for (int i = 0; i < V; i++) {
				cm[s][i] = c[i];
			}
			cout<<c[g]<<endl;
			
			break;
			
			case 1:
			que.push(P(0,s));
			fill(t, t + V, INF);
			t[s] = 0;
			while (!que.empty()) {
				P p = que.top();
				que.pop();
				int v = p.second;
				
				if (t[v] < p.first) continue;
				for (int i = 0; i < Gt[v].size(); i++) {
					edge e = Gt[v][i];
					if (t[e.to] > t[v] + e.info) {
						t[e.to] = t[v] + e.info;
						que.push(P(t[e.to], e.to));
					}
				}
			}
			
			for (int i = 0; i < V; i++) {
				tm[s][i] = t[i];
			}
			
			cout<<t[g]<<endl;
			
			break;
	}
}

Measured memory_bytes: 1404
#include <stdio.h>

int main(){
	int i, j, n[5], tmp, max;
	for (i = 0;i < 5;i++) scanf("%d", n + i);
	for (i = 0;i < 4;i++){
		max = i;
		for (j = i;j < 5;j++){
			if (n[max] < n[j]) max = j; 
		}
		if (max != i){
			tmp = n[i];
			n[i] = n[max];
			n[max] = tmp;
		}
	}
	
	for (i = 0;i < 5;i++){
	  if(i != 0) putchar(' ');
	  printf("%d", n[i]);
	}
	printf("\n");
	return 0;
}

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

using namespace std;

int main(){
  string a,b,c; cin>>a>>b>>c;
  (a[a.size()-1]==b[0] &&b[b.size()-1]==c[0])? cout<<"YES":cout<<"NO";
  
  
  return 0;
}


Measured memory_bytes: 256
M,K = map(int,input().split())

def createL(k):
    L = []
    for i in range(2**M):
        if i!=k: L.append(i)
    return L,L[:][::-1]

S = []
if K>=(2**M):
    print(-1)
elif M==0:
    print("0 0")
elif M==1:
    if K==1: print(-1)
    else: print("0 0 1 1")
else:
    L,Lrev = createL(K)
    print(" ".join(str(i)for i in L+[K]+Lrev+[K]))

Measured memory_bytes: 27884
def partition(li, p, r):
    """Separate li with a value of li[r].
    Returns index of the partition value.

    >>> ax = [13, 19, 9, 5, 12, 8, 7, 4, 21, 2, 6, 11]
    >>> partition(ax, 0, 11)
    7
    >>> ax
    [9, 5, 8, 7, 4, 2, 6, 11, 21, 13, 19, 12]
    """
    x = li[r]
    i = p - 1
    for j in range(p, r):
        if li[j] <= x:
            i += 1
            li[i], li[j] = li[j], li[i]

    i += 1
    li[i], li[r] = li[r], li[i]

    return i


def run():
    c = int(input())
    ax = [int(n) for n in input().split()]

    p = partition(ax, 0, c-1)
    for (i, a) in enumerate(ax):
        if i == p:
            val = '[{}]'.format(a)
        else:
            val = str(a)

        if i < c-1:
            print(val, end=" ")
        else:
            print(val)


if __name__ == '__main__':
    run()



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

#define ll unsigned long long int
#define endl '\n'
#define inf 1e18


void testCase()
{
    //ll t; cin>>t; while(t--)
    {
      string s,t;
      cin>>s>>t;
      ll ans=1e10;
      for(int i=0;i<=s.length()-t.length();i++)
      {
            ll cnt=0;
            for(int j=0;j<t.length();j++)
            {
                if(t[j]!=s[j+i])
                cnt++;
            }
            ans=min(ans,cnt);
        
      }
      cout<<ans;


    } 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    testCase();
    return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

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

void shellSort(int A[], int n) {
	for(int h = 1; ; ) {
		if(h > n) break;
		G.push_back(h);
		h = 3*h + 1;
	}

	for(int i = G.size()-1; i >= 0; i--) {
		insertionSort(A, n, G[i]);
	}
}

int main() {
	cin >> n;
	for(int i = 0; i < n; i++) scanf("%d", &A[i]);
		cnt = 0;

	shellSort(A, n);

	cout << G.size() << endl;
	for(int i = G.size() - 1; i >= 0; i--) {
		printf("%d", G[i]);
		if(i) printf(" ");
	}
	printf("\n");
	printf("%lld\n", cnt);
	for(int i = 0; i < n; i++) printf("%d\n", A[i]);

	return 0;
}

Measured memory_bytes: 7176
import java.util.Scanner;

public class Main {

    public static void main( String[] args ){

        Scanner in = new Scanner(System.in);
        String[] rows = in.nextLine().split(" ");
        int a = Integer.parseInt( rows[0] );
        int p = Integer.parseInt( rows[1] );
        System.out.println(( a * 3 + p )/2);

    }
}

Measured memory_bytes: 22868
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

int main()
{
   int n,k,q;
   cin>>n>>k>>q;
   vector<int>point(n,k),damage(n,q);
   rep(i,q){
       int a;
       cin>>a;
       a--;
       damage[a]--;
   }
   rep(i,n){
       if(damage[i]<point[i]){
           cout<<"Yes"<<endl;
       }else{
           cout<<"No"<<endl;
       }
   }

}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x,a,b;
  cin>>x>>a>>b;
  if(a<b){
  if(x<(a+b)/2){
    cout<<'A'<<endl;
  }
  else if(x>(a+b)/2){
      cout<<'B'<<endl;
  }
  }
  else if(a>b){
      if(x<(a+b)/2){
    cout<<'B'<<endl;
      }
    else if(x>(a+b)/2){
      cout<<'A'<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <stack>
#include <map>
#include <unordered_map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    int n, h;
    VI as, bs;
    cin >> n >> h;
    REP(i,n) {
        long a, b;
        cin >> a >> b;
        as.push_back(a);
        bs.push_back(b);
    }
    sort(as.begin(), as.end());
    sort(bs.begin(), bs.end());
    int cnt = 0;
    long sum = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (bs[i] > as.back()) {
            sum += bs[i];
            cnt++;
            if (sum >= h) {
                cout << cnt << endl;
                return 0;
            }
        } else {
            break;
        }
    }
    h -= sum;
    cout << cnt + h / as.back() + bool(h % as.back()) << endl;
}


Measured memory_bytes: 2036
Scanf.scanf "%s %s" (fun s t ->
    let n = String.length s in
    let rec loop i acc =
        if i = n then acc else
            let acc = if s.[i] = t.[i] then acc else acc + 1 in
            loop (i + 1) acc
    in
    loop 0 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 4680
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

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

	
	int N;
	cin >> N;
	string S;
	cin >> S;

	int A[26] = {};
	rep(i, N) A[S[i] - 'a']++;

	ll kotae = 1;
	ll mod = 1e9 + 7;
	rep(i, 26) kotae = (kotae * (A[i] + 1)) % mod;

	co(kotae - 1);

	Would you please return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

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

struct Node {
    int key;
    Node *l, *r, *p;
};

Node *root, *NIL;

static void insert(int k) {
    Node *x = root;
    Node *y = NIL;
    Node *z = (Node*)malloc(sizeof(Node));
    z->key = k;
    z->l = NIL;
    z->r = NIL;

    while(x != NIL) {
        y = x;
        if (k < x->key)  {
            x = x->l;
        } else {
            x = x->r;
        }
    }

    z->p = y;
    if (y == NIL) {
        root = z;
    } else {
        if (k < y->key) {
            y->l = z;
        } else {
            y->r = z;
        }
    }
}

static void inorder(Node* n) {
    if (n == NIL) return;
    inorder(n->l);
    printf(" %d", n->key);
    inorder(n->r);
}

static void preorder(Node* n) {
    if (n == NIL) return;
    printf(" %d", n->key);
    preorder(n->l);
    preorder(n->r);
}

int main() {

    int n; cin >> n;
    REP(i, n) {
        string com; cin >> com;
        if (com == "insert") {
            int key; cin >> key;
            insert(key);
        }
        if (com == "print") {
            inorder(root);
            cout << "\n";
            preorder(root);
            cout << "\n";
        }
    }

    return 0;
}


Measured memory_bytes: 26564
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<double,P> PP;
typedef pair<string, P>PPP;
struct edge { int to; int cost; };
string s[106]; int p[106];
signed main() {
	int n; cin >> n;
	rep(i, n)cin >> s[i] >> p[i];
	vector<PPP>V;
	rep(i, n) {
		V.push_back(PPP(s[i], P(-p[i], i)));
	}
	sort(V.begin(), V.end());
	rep(i, n)cout << V[i].second.second + 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    string s;
    cin >> s;
    cout << s.substr(0,5) << " " << s.substr(6,7) << " " << s.substr(14) << endl;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc081/tasks/arc086_b
# 全部負か全部正なら簡単。じゃその状態に持っていけないか考えるべきだよね？


import sys
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


N = read_a_int()
A = read_ints()
ma, mi = max(A), min(A)
print(2 * N - 2)
if abs(ma) > abs(mi):  # すべて正にするのが良い
    x = A.index(ma)
    for y in range(N):
        if x == y:
            continue
        print(x + 1, y + 1)
    # 累積和みたいにすれば良い
    for i in range(1, N):
        print(i, i + 1)
else:  # すべて負にするのがよい
    x = A.index(mi)
    for y in range(N):
        if x == y:
            continue
        print(x + 1, y + 1)
    for i in range(N, 1, -1):
        print(i, i - 1)


Measured memory_bytes: 3064