akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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

#A
def A():
    s = input()
    if s == "Sunny":
        print("Cloudy")
    elif s == "Cloudy":
        print("Rainy")
    else:
        print("Sunny")
    return

#B
def B():
    s = S()
    for i in range(len(s)):
        if i%2:
            if s[i] not in ["L","U","D"]:
                print("No")
                return
        else:
            if s[i] not in ["R","U","D"]:
                print("No")
                return
    print("Yes")
    return

#C
def C():
    n,k,q = LI()
    a = IR(q)
    f = [k-q]*(n)
    for i in range(q):
        ai = a[i]-1
        f[ai] += 1
    for i in f:
        if i <= 0:
            print("No")
        else:
            print("Yes")
    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

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


Measured memory_bytes: 50780
import java.util.Scanner;
import java.util.HashSet;
import java.util.Set;
 
public class Main{
    public static void main(String[] aaa){
        Scanner s = new Scanner(System.in);
        Set<String> hset = new HashSet<String>();
        int n,q,i,count=0;
        String a,b;
        n = s.nextInt();
        for(i=0;i<n;i++){
            a = s.next();
            b = s.next();
            if(a.equals("insert"))hset.add(b);
            else{
                if(hset.contains(b))System.out.println("yes");
                else System.out.println("no");
            }
        }
    }
}


Measured memory_bytes: 253572
import std;
enum inf(T)()if(__traits(isArithmetic,T)){return T.max/4;}
T scan(T=long)(){return readln.chomp.to!T;}
void scan(T...)(ref T args){auto input=readln.chomp.split;foreach(i,t;T)args[i]=input[i].to!t;}
T[] scanarr(T=long)(){return readln.chomp.split.to!(T[]);}
alias Queue=DList;auto enq(T)(ref Queue!T q,T e){q.insertBack(e);}T deq(T)(ref Queue!T q){T e=q.front;q.removeFront;return e;} 
alias Stack=SList;auto push(T)(ref Stack!T s,T e){s.insert(e);}T pop(T)(ref Stack!T s){T e=s.front;s.removeFront;return e;} 
struct UnionFind(T){T[T]u;ulong[T] rank;@property{bool inc(T e){return e in u;}auto size(){return u.keys.length;}auto dup(){T[] child=u.keys;T[] parent=u.values;auto res=UnionFind!T(child);child.each!(e=>res.add(e));size.iota.each!(i=>res.unite(child[i],parent[i]));return res;}}this(T e){e.add;}this(T[] es){es.each!(e=>e.add);}auto add(T a,T b=a){assert(b.inc);u[a]=a;rank[a];if(a!=b)unite(a,b);}auto find(T e){if(u[e]==e)return e;return u[e]=find(u[e]);}auto same(T a,T b){return a.find==b.find;}auto unite(T a,T b){a=a.find;b=b.find;if(a==b)return;if(rank[a]<rank[b])u[a]=b;else{u[b]=a;if(rank[a]==rank[b])rank[a]++;}}}
struct PriorityQueue(T,alias less="a<b"){BinaryHeap!(T[],less) heap;@property{bool empty(){return heap.empty;}auto length(){return heap.length;}auto dup(){return PriorityQueue!(T,less)(array);}T[] array(){T[] res;auto tp=heap.dup;foreach(i;0..length){res~=tp.front;tp.removeFront;}return res;}void push(T e){heap.insert(e);}void push(T[] es){es.each!(e=>heap.insert(e));}}T look(){return heap.front;}T pop(){T tp=look;heap.removeFront;return tp;}this(T e){ heap=heapify!(less,T[])([e]);}   this(T[] e){ heap=heapify!(less,T[])(e);}}
//END OF TEMPLATE

void main(){
    auto r=scan!long;
    (2*r*3.14159265).writeln;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
using lli=long long int;
using ld=long double;

lli N;
lli memo[1001][10001];

struct element
{
	lli w;
	lli s;
	lli v;
	lli w_plus_s;
};

element arr[1001];

bool compare(element i,element j)
{
	return(i.w_plus_s > j.w_plus_s);
}



lli max_value(lli index,lli wt)
{
	if(wt>10000)
		return 0;
	if(index==-1)
		return 0;
	if(memo[index][wt]!=-1)return memo[index][wt];
	if(wt>arr[index].s)
		return ( memo[index][wt] = max_value(index-1,wt) );
	return( memo[index][wt] =   max( max_value(index-1,wt) , max_value(index-1,wt+arr[index].w)+arr[index].v )   );
}


int main()
{
	lli i,j;
	for(i=0;i<=1000;i++)
		for(j=0;j<=10000;j++)
			memo[i][j]=-1;


	cin>>N;

	for(i=0;i<N;i++)
	{
		cin>>arr[i].w>>arr[i].s>>arr[i].v;
		arr[i].w_plus_s=arr[i].w + arr[i].s;
	}
	sort(arr,arr+N,compare);


	lli ans=max_value(N-1,0);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 78592
N = int(input())
S = input()

a = dict()

for i in range(N):
    s = S[i]
    for j in range(100):
        if ("0" + str(j))[-2:] in a:
            a[("0" + str(j) + s)[-3:]] = 1
    if (N - i) >= 2:
        for j in range(10):
            if str(j) in a:
                a[str(j) + s] = 1
    if (N - i) >= 3:
        a[str(s)] = 1

ans = 0
for k in a.keys():
    if len(k) == 3:
        ans += 1
print(ans)


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

int main() {
  int total=1;
  int N;
  cin >> N;
  vector<int> a(N);
  
  for(int i=0; i<N; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  for(int i=0; i<N-1; i++){
    if(a[i]<a[i+1]) total++;
  }
  cout << total << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
long long int m,n;
int main()
{
    while(scanf("%lld%lld",&m,&n)!=EOF)
    {
        if(n<=2*m)
            printf("%lld\n",n/2);
        else
        {
            long long int flag=n-2*m;
            printf("%lld\n",flag/4+m);
        }
    }
    return 0;
}


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

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;

int main()
{
    string S,res;
    ll K;
    ll iMin = 999999;
    ll majiImin = 999999;
    ll tmp;


    cin >> S >> K;

    res = "1";

    ll end = K;
    if(S.size() < K)end = S.size();
    REP(i,end)
    {
        if(S[i] != '1')
        {
            res = S[i];
            break;
        }
    }

    cout << res << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef vector<ll> vi;
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  ll n, k;
  cin >> n >> k;
  if(n%k==0){
    print(0);
  }
  else{
    print(1);
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//String t= sc.next();
		String buff= "";
		//double n = sc.nextInt()/1000.0;
		int m = sc.nextInt();
		int k = sc.nextInt();
		//String s=sc.next();
		long count=0,flag=0;
		long count1=0,count2=0;
		int count3=0;
		int[] array = new int[m];
		/*array[0]=n-m;
		array[1]=n*m;
		array[2]=n+m;*/
		//Arrays.sort(array);

		for(int i=0;i<m;i++) {
			array[i]=sc.nextInt();
		}
		for(int i=0;i<m;i++) {
			if(array[i]>=k) {
				count++;
			}
		}

		/*if(count==0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}*/

		System.out.println(count);
	}
}




Measured memory_bytes: 51164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()


int main() {
    int x, n;
    cin >> x >> n;
    vector<int> isexist(102, 0);
    rep (i, n) {
        int p;
        cin >> p;
        isexist[p] = 1;
    }
    int m = 10000;
    int ans = 10000;
    for (int i = 101; i >= -1; --i) {
        if (isexist[i]) {
            continue;
        }
        if (m >= abs(i-x)) {
            m = abs(i-x);
            ans = i;
        }
    }
    cout << ans << endl;
}




Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N, K;
  cin >> N >> K;
  
  int ans = 1;
  for (int i = 0; i < N; i++)
  {
    ans = min(ans * 2, ans + K);
  }
  

  cout << ans << endl;
}

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

typedef long long i64;
const int MAX_N = 2000006, MOD = 1000000007;

i64 fac[MAX_N], ifac[MAX_N], inv[MAX_N];
int X[6], Y[6];

inline i64 binom(int n, int m) {
  if (n < m) return 0;
  return fac[n] * ifac[m] % MOD * ifac[n - m] % MOD;
}

i64 work(int x1, int y1, int x2, int y2) {
  i64 result = 0, way;
  int len_x = X[3] - X[2] + 1, len_y = Y[3] - Y[2] + 1;
  for (int i = X[2]; i <= X[3]; ++i) {
    way = binom(i - x1 + Y[3] - y1, i - x1) * binom(x2 - i + y2 - Y[3] - 1, x2 - i) % MOD;
    result = (result + way * (i - X[2] + len_y) % MOD) % MOD;
    way = binom(i - x1 + Y[2] - y1 - 1, i - x1) * binom(x2 - i + y2 - Y[2], x2 - i) % MOD;
    result = (result - way * (i - X[2]) % MOD) % MOD;
  }
  for (int i = Y[2]; i <= Y[3]; ++i) {
    way = binom(X[3] - x1 + i - y1, i - y1) * binom(x2 - X[3] - 1 + y2 - i, y2 - i) % MOD;
    result = (result + way * (i - Y[2] + len_x) % MOD) % MOD;
    way = binom(X[2] - x1 - 1 + i - y1, i - y1) * binom(x2 - X[2] + y2 - i, y2 - i) % MOD;
    result = (result - way * (i - Y[2]) % MOD) % MOD;
  }
  return result;
}

int main() {
  fac[0] = ifac[0] = inv[1] = 1;
  
  for (int i = 1; i < MAX_N; ++i) fac[i] = fac[i - 1] * i % MOD;
  for (int i = 2; i < MAX_N; ++i) inv[i] = -(MOD / i) * inv[MOD % i] % MOD;
  for (int i = 1; i < MAX_N; ++i) ifac[i] = ifac[i - 1] * inv[i] % MOD;

  for (int i = 0; i < 6; ++i) scanf("%d", &X[i]);
  for (int i = 0; i < 6; ++i) scanf("%d", &Y[i]);

  static int val1[4], val2[4], p1[4][2], p2[4][2];
  
  i64 result = 0;
  p1[0][0] = X[0] - 1, p1[0][1] = Y[0] - 1, val1[0] = 1;
  p1[1][0] = X[1], p1[1][1] = Y[0] - 1, val1[1] = -1;
  p1[2][0] = X[0] - 1, p1[2][1] = Y[1], val1[2] = -1;
  p1[3][0] = X[1], p1[3][1] = Y[1], val1[3] = 1;

  p2[0][0] = X[5] + 1, p2[0][1] = Y[5] + 1, val2[0] = 1;
  p2[1][0] = X[4], p2[1][1] = Y[5] + 1, val2[1] = -1;
  p2[2][0] = X[5] + 1, p2[2][1] = Y[4], val2[2] = -1;
  p2[3][0] = X[4], p2[3][1] = Y[4], val2[3] = 1;

  for (int i = 0; i < 4; ++i)
    for (int j = 0; j < 4; ++j)
      result = (result + val1[i] * val2[j] * work(p1[i][0], p1[i][1], p2[j][0], p2[j][1])) % MOD;
  printf("%lld\n", (result + MOD) % MOD);
  return 0;
}


Measured memory_bytes: 46976
'''input
2
3 1 2
6 1 1
'''

#~ @author = dwij28 (Abhinav Jha) ~#

n, data = input(), []
for N in xrange(n):
	t, x, y = map(int, raw_input().strip().split())
	data.append([t, x, y])
xp, yp, tp, ans = 0, 0, 0, True
for i in xrange(n):
	t, x, y = data[i]
	d = abs(x - xp) + abs(y - yp)
	tc = t - tp
	if not (d <= tc and tc % 2 == d % 2):
		ans = False
		break
	xp, yp, tp = x, y, t
print 'Yes' if ans else 'No'

Measured memory_bytes: 18308
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
#include <cassert>
using namespace std;

typedef long long ll;


int n, m;
vector<int> edg[100003];
vector<int> ok[100003];
int cnt[100003], cnt2[100003];
int rk[100003];
int ans[100003];

int main() {
	cin >> n >> m;
	for (int i = 0; i < n - 1 + m; i++) {
		int a, b; scanf("%d %d", &a, &b);
		edg[a].push_back(b);
		ok[a].push_back(1);
		cnt[b]++;
	}
	int rt;
	for (int i = 1; i <= n; i++) if (cnt[i] == 0) rt = i;
	deque<pair<int, int>> que;
	que.push_back({ rt, 0 });
	while (!que.empty()) {
		int idx = que.front().first, ran = que.front().second;
		que.pop_front();
		for (int to : edg[idx]) {
			cnt2[to]++;
			rk[to] = max(rk[to], ran + 1);
			if (cnt2[to] != cnt[to]) continue;
			que.push_back({ to, rk[to] });
		}
	}
	que.push_back({ rt, 0 });
	ans[rt] = 0;
	while (!que.empty()) {
		int idx = que.front().first, ran = que.front().second;
		que.pop_front();
		for (int to : edg[idx]) {
			if (rk[idx] + 1 != rk[to]) continue;
			ans[to] = idx;
			que.push_back({ to, rk[to] });
		}
	}
	for (int i = 1; i <= n; i++) cout << ans[i] << "\n";
	return 0;
}

Measured memory_bytes: 13312
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, long long Y)
{
    ll ans = 0;
    for (int i = 0; i <= N; i++)
    {
        for (int j = 0; j <= N; j++)
        {
            int k = N - i - j;
            if (k < 0)
            {
                continue;
            }

            if (10000 * i + 5000 * j + 1000 * k == Y)
            {
                cout << i << " " << j << " " << k << endl;
                return;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long Y;
    scanf("%lld", &Y);
    solve(N, Y);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
vector< int > z_algorithm(const string &s) {
  vector< int > prefix(s.size());
  for(int i = 1, j = 0; i < s.size(); i++) {
    if(i + prefix[i - j] < j + prefix[j]) {
      prefix[i] = prefix[i - j];
    } else {
      int k = max(0, j + prefix[j] - i);
      while(i + k < s.size() && s[k] == s[i + k]) ++k;
      prefix[i] = k;
      j = i;
    }
  }
  prefix[0] = (int) s.size();
  return prefix;
}
int main()
{
	int n; cin>>n;
	string s; cin>>s;
	int ans=0;
	for(int i=0; i<n; i++){
		string t=s.substr(i);
		vector<int> v=z_algorithm(t);
		for(int j=1; j<v.size(); j++){
			ans=max(ans, min(j, v[j]));
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Ll long long
using namespace std;
const int N=2e5+5;
int n,m,x,y,c;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		cin>>c;m=0;
		if(c%2==0)m++;
		if(c%4==0)m++;
		if(m==1)x++;
		if(m==2)y++;
	}
//	cout<<x<<' '<<y<<endl;
	if(y>=n-x-y)puts("Yes");else 
	if(!x&&y==n/2)puts("Yes");else puts("No");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

template<typename T>
vector<T> Divisors(T n) {
	vector<T> res;
	for(T i = 1; i * i <= n; ++i) {
		if( n % i == 0 ) {
			res.push_back(i);
			
			if( i < n / i ) res.push_back(n / i);
		}
	}
	
	sort(res.begin(), res.end());
	
	return res;
}

int main(void) {
	ll n;
	cin >> n;
	
	vector<ll> div = Divisors(n);
	
	ll ans = 0LL;
	for(auto& x : div) {
		if( x >= (n - x) / x ) break;
		
		ans += (n - x) / x;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf (int)50000000000000000 //5･10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  int a,b,k;
  cin>>a>>b>>k;
  rep(i,k) {
    if(i%2) {
      b-=b%2;
      a+=b/2;
      b/=2;
    }
    else {
      a-=a%2;
      b+=a/2;
      a/=2;
    }
  }
  cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=2e5+4;
inline int read() {
	int x=0;char c=getchar();
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x;
}
int n;
int a[N];
int ans;
int main() {
	n=read();
	int pre=N;
	for (register int i=1;i<=n;++i) {
		a[i]=read();
		if (a[i]<pre) {
			++ans;
			pre=a[i];
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

namespace procon
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var count=0;
            for (int i = 0; i < n-1; i++)
            {
                var min = i;
                for (int j = i; j < n; j++)
                {
                    if (inputs[min] > inputs[j])
                    {
                        min = j;
                    }
                }
                if (i!=min)
                {
                    var t = inputs[min];
                    inputs[min] = inputs[i];
                    inputs[i] = t;

                    count++;
                }
            }

            Console.WriteLine(string.Join(" ",inputs.Select(s=>s.ToString()).ToArray<string>()));
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 9620
import java.util.*;
import java.io.*;

public class Main {	
	private static void solve(){
		//Implement solution here.
		long H = nl();
		long W = nl();
		
		if(H <= 1 || W <= 1) {
			System.out.println(1);
			return;
		}
		if(H % 2 == 0) {
			System.out.println(W * (H / 2));
		} else {
			if(W % 2 == 0) {
				System.out.println(W * (H / 2) + W / 2);
			} else {
				System.out.println(W * (H / 2) + W / 2 + 1);
			}
		}
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();	
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();			
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			} 
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

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

int main(){
	int n;
	cin >> n;
	vector<int> x(n);
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		x[i] = 0;
		x[i] -= i;
	}
	for(int i = 0; i < n; i++){
		cin >> a[i];
		a[i] -= i;
	}
	if(x[0] != a[0]){
		cout << -1 << endl;
		return 0;
	}
	for(int j = 0; j < n; j++){
		if(a[j] > 0){
			cout << -1 << endl;
			return 0;
		}
		if(j > 0 && a[j-1] < a[j]){
			cout << -1 << endl;
			return 0;			
		}
	}
	vector<int> maxindex(n, 0);
	for(int j = 0; j < n; j++){
		maxindex[-a[j]] = max(maxindex[-a[j]], j);
	}
	LL ops = 0;
	for(int i = 0; i < n; i++){
		ops += max(0, maxindex[i] - i);
	}
	cout << ops << endl;

}


Measured memory_bytes: 2688
#include <stdio.h>

int main(){
   int a,b,i;
 
   scanf("%d %d",&a,&b);
   for (i=1;;i++) 
      if (b<=a*i-i+1) break;
   if (b==1) puts("0");
   else      printf("%d\n",i);
   return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h> 
using namespace std;
//関数
const long INF=1000000000000000;
const long MOD=1000000007;
bool check=false;


int main(void){
    
    long A,B;
    cin>>A>>B;
    
    if(A<10 && B<10) cout<<A*B<<endl;
    else cout<<-1<<endl;
    
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            char[] c = in.next().toCharArray();
            int l = 0, r = N - 1;
            int ans = 0;
            while (l < N - 1) {
                if (c[l] == 'W') {
                    while (0 <= r && c[r] != 'R') {
                        r--;
                    }
                    if (r > l) {
                        char t = c[l];
                        c[l] = c[r];
                        c[r] = t;
                        ans++;
                    }
                }
                l++;
            }
            out.println(ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



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

int main(){
	int n,a,b;
	cin >> n >> a >> b;
	
	cout << min(n*a,b) << endl;
	
}



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

using namespace std;
using ll = long long;

int main(){
    int N; cin >> N;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin >> A[i];

    ll ans = 0ll;

    for(int i=0;i<N;i++){
        ans += A[i]/2;
        A[i] %= 2;

        if(i+1 < N){
            int d = min(A[i], A[i+1]);
            A[i] -= d;
            A[i+1] -= d;
            ans += d;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  VEC<int> m(210,0);
  m[0]=300000;
  m[1]=200000;
  m[2]=100000;
  int X, Y;
  cin >> X >> Y;
  X--;Y--;
  int s=0;
  if(X==0&&Y==0)s+=400000;
  cout<<s+m[X]+m[Y]<<endl;

  return 0;
}


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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int n;
	cin >> n;
	vector<int> c;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		c.push_back(a);
	}
	vector<int> right;
	vector<int> left;
	for (int i = 0; i < n; i++) {
		if (i == 0) {
			right.push_back(c[i]);
		}
		else {
			right.push_back(lcm(c[i], right[i - 1]));
		}

	}
	reverse(c.begin(), c.end());
	for (int i = 0; i < n; i++) {
		if (i == 0) {
			left.push_back(c[i]);
		}
		else {
			left.push_back(lcm(c[i], left[i - 1]));
		}

	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (i == 0) {
			ans = max(ans,right[n - 1-1]);
			continue;
		}
		if (i == n - 1) {
			ans = max(ans, left[n - 1-1]);
			continue;
		}
		int k = lcm(right[i-1], left[n-1-i-1]);
		ans = max(ans, k);
	}
	cout << ans;

}


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

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

	long long a, b;
	cin >> a >> b;

	vector<long long> x(n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &x[i]);
	}

	long long ans = 0;
	for (int i = 0; i < n - 1; i++) {
		ans += min(a * (x[i + 1] - x[i]), b);
	}

	cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

public class Main {
	static FastReader f = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		solve();
		out.close();
	}

	static int MOD = (int) (1e9+7);
	static void solve() {
		int n = f.nextInt();
		long[] arr = new long[n];
		long[] prefSum = new long[n];
		for(int i=0;i<n;i++) {
			arr[i] = f.nextInt();
			prefSum[i] = arr[i];
		}

		for(int i=1;i<n;i++) {
			prefSum[i] += prefSum[i-1];
		}

		long ans = 0;
		for(int i=0;i<n-1;i++) {
			ans += (((prefSum[n-1] - prefSum[i]) % MOD) * arr[i]) % MOD;
			if(ans >= MOD) {
				ans %= MOD;
			}
		}

		out.println(ans % MOD);
 	}

	static class FastReader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		String next() {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			String str = "";

			try {
				str = br.readLine();
			} catch(IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 57564
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int k = sc.nextInt();

      for(int i = a; i < Math.min(a + k, b + 1); i++)
        System.out.println(i);

      for(int i = Math.max(a + k, b - k + 1); i <= b; i++)
        System.out.println(i);
  }
}

Measured memory_bytes: 22996
// by newbiechd
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>

// DELETE the debugging information!
#define debug(x) std::cerr << #x << " = " << (x) << std::endl

const int N_MAX = 100003;
bool f[N_MAX];
int cnt[N_MAX];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  f[1] = 1;
  for (int i = 1; i <= n; ++i)
    cnt[i] = 1;
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    f[y] |= f[x];
    if (--cnt[x] == 0)
      f[x] = 0;
    ++cnt[y];
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    ans += f[i];
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 768
#include <stdio.h>
#include <math.h>
#define swap(a,b) a^=b^=a^=b

int main(){
	
	int a, b, c, d, e, f, B, C;
	double A, D, E;
	
	while(scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF){
		B = c*e-b*f;
		C = -d*c+a*f;
		A = 1/(a*e*1.0-b*d*1.0);
		D = A*(B*1.0);
		E = A*(C*1.0);
		if (D == -0.000000) D = 0.000000;
        if (E == -0.000000) E = 0.000000;
		printf("%.3f %.3f\n", D, E);
	}
	return 0;
}

Measured memory_bytes: 636
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

long n;
long a[100005];
long sum;
long s;
long d[100005];

int main(){
	scanf("%ld", &n);
	for(int i = 0; i < n; i++){
		scanf("%ld", &a[i]);
		sum += a[i];
	}
	
	for(int i = 0; i < n; i++){
		d[i] = a[(i+1)%n] - a[i];
	}
	
	if(sum % (n*(n+1)/2) != 0){
		//printf("case 1\n");
		printf("NO\n");
		return 0;
	}
	s = sum / (n*(n+1)/2);
	for(int i = 0; i < n; i++){
		if(s - d[i] < 0 || (s-d[i]) % n != 0){
			//printf("case 2 %d\n", i);
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}


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

using namespace std;

int main() {
  int N;
  vector<string> input;
  list<string> words;
  
  bool ans = true;
  
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    string in;
    
    cin >> in;
    
    input.push_back(in);
    
    if (find(words.begin(), words.end(), in) != words.end()) {
      ans = false;
    } else {
      words.push_back(in);
    }
  }
  
  string s; 
  string s_n;
  for (int j = 0; (ans && j < N - 1); j++) {
    s = input[j];
    s_n = input[j + 1];
    
    if (s[s.length() - 1] != s_n[0]) {
      ans = false;
      break;
    }
  }
  
  
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}

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

using ll = long long; 

// dp[i] - no. of ways to match this subset of women
// ans - dp[1<<n-1]
int add(int a, int b) {
    const int mod = 1e9+7;
    
    return (a+b) % mod;
}

int main() {
    int n;
    
    scanf("%d", &n);
    
	vector<vector<int>> can(n, vector<int>(n));
	
	for (int i = 0; i < n; i++) {
	    for (int j = 0; j < n; j++) {
	        scanf("%d", &can[i][j]);
	    }
	}
	
	vector<int> dp(1<<n);
	
	dp[0] = 1;
	
	for (int mask = 0; mask < (1<<n)-1; mask++) {
	    int men = __builtin_popcount(mask);
	    for (int women = 0; women < n; women++) {
	        if (can[men][women] && !((1<<women)&mask)) {
	            int m2 = mask | (1<<women);
	            dp[m2] = add(dp[m2], dp[mask]);
	        }    
	    }
	}
	
	printf("%d\n", dp[(1<<n)-1]);
	
	return 0;
}

Measured memory_bytes: 8448
s = str(input())
t = str(input())
ans = 1001
for i in range(len(s)-len(t)+1):
    tmp = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            tmp += 1
    ans = min(len(t)-tmp,ans)
print(ans)

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

using namespace std;

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    while (a % 2 == 0) {
      a /= 2;
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static final int MOD = 1000000007;
 	public static void main (String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean[] arr = new boolean[n + 1];
		for (int i = 1; i <= n; i++) {
		    arr[i] = (sc.nextInt() == 1);
		}
		TreeSet<Integer> set = new TreeSet<>();
		for (int i = n; i >= 1; i--) {
		    int count = 0;
		    for (int j = 2; j * i <= n; j++) {
		        if (set.contains(j * i)) {
		            count++;
		        }
		    }
		    if (count % 2 == 1 ^ arr[i]) {
		        set.add(i);
		    }
		}
		System.out.println(set.size());
		StringBuilder sb = new StringBuilder();
		boolean flag = false;
		for (int x : set) {
		    if (flag) {
		        sb.append(" ");
		    }
		    flag = true;
		    sb.append(x);
		}
		System.out.println(sb);
	}
}


Measured memory_bytes: 92472
//https://atcoder.jp/contests/abc153/tasks/abc153_e
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in");
    //std::ifstream in("./input.txt");
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll H,N; cin>>H>>N;
    struct Data{
        ll a,b;
    };
    vector<Data> abn;
    abn.reserve(N);
    REP(i,N){
        Data d;
        cin>>d.a>>d.b;
        abn.push_back(d);
    }

    vector<ll> hpb(H+1, INT32_MAX);
    hpb[H]=0;

    for(ll h=H;h>=0;--h){
        for(const auto& d:abn){
            auto nex_h=max(h-d.a,0LL);
            chmin(hpb[nex_h], hpb[h]+d.b);
        }
    }
    auto ans=hpb[0];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
	int n,m;
	int a[51];
	int b[51];
	int i;
	int x=0;;
	int j=0;
	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++){
		
		
		scanf("%d%d",&a[i],&b[i]);
		
		
		
		
		
		
	}

	for(j=1;j<=n;j++){
	for(i=0;i<m;i++){
		if(a[i]==j){
			
			
			x++;
			
			//printf("!%d %d\n",a[i],j);
			
			
			
			
			
		}
		if(b[i]==j){
			
			x++;
			
			
			
			
		}
		
		//printf("%d\n!",a[i]);
		
		
		
		
		
		
	}
	printf("%d\n",x);
	x=0;
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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;
}

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

ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}

constexpr ll LNF = 1LL<<50;

constexpr int INF = 1e9+7;

const long double PI=3.14159265358979323846;


vector<int> dx = {1,0,-1,1,-1,0};
vector<int> dy = {1,1,1,0,0,-1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    rep(_n,1,n+1){
        int ans = 0;
        int p = _n*2;
        rep(i,0,200){
            if(i*i>=p){
                break;
            }
            rep(j,0,200){
                if(i*i+j*j>=p){
                    break;
                }
                int q = p-i*i-j*j;
                int r = sqrt(q);
                if(q==r*r){
                    if(i+j-r>0 && j+r-i>0 && i+r-j>0 && (i+j+r)%2==0){
                        ans++;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3500
#include<bits/stdc++.h> 
#define ll                 long long                            
#define ra                 return a;                                          
#define pb                 push_back                                                     
#define sti                stack<ll>
#define spi                stack<pair<ll,ll>>
#define S                  second
#define msi                map<string,ll >
#define msi                map<string,ll >
#define mii                map<ll ,ll >
#define dbg(x)             { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y)          { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z)        { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define mis                map<ll , string>
#define rep(i,a,b)         for(ll  i=a;i<b;i++)
#define mpi                map<pair<ll ,ll >,ll >                                                
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define F                  first 
#define vi                 vector<ll >
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define vs                 vector<string>
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define hell               1000000007
#define bs                 binary_search
#define mp                 make_pair
#define qi                 queue<ll>
#define qs                 queue<string>
#define qpi                queue<pair<ll,ll>>
#define qps                queue<pair<ll,string>> 
#define endl               '\n' 
#define itr(a,it)          for(typeof(a.begin()) it=a.begin();it!=a.end();it++)// This will produce const_iterator for const object and normal iterator for non-const object
#define ss                 set<string>
using namespace std;
#define N  300005
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
//    cin>>t;
    while(t--)
{
    ll n;
    cin>>n;
    pii a[n];
    rep(i,0,n)
    {
    	cin>>a[i].S>>a[i].F;
    }
    sort(a,a+n);
    ll key=1,time=0;
    rep(i,0,n)
    {
    	if(time+a[i].S<=a[i].F)
    	{
    		time+=a[i].S;
    	}
    	else 
    	{
    		key=0;
    		break;
    	}
    }
    if(!key)
    {
    	cout<<"No";
    }
    else cout<<"Yes";
}
    return 0;
}

Measured memory_bytes: 3328
class Entry
  attr_reader :name, :point, :index

  def initialize(name, point, index)
    @name = name
    @point = point
    @index = index
  end

  def <=>(other)
    return name <=> other.name if name != other.name
    other.point <=> point
  end
end

def guide_book(cities, points)
  entries = []
  cities.each_with_index { |city, i| entries << Entry.new(city, points[i], i + 1) }
  entries.sort!.map { |e| e.index }
end

n = gets.to_i
cities = []
points = []
n.times do
  city, point = gets.split
  cities << city
  points << point.to_i
end

puts guide_book(cities, points)

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N, K; cin >> N >> K;
    if (N > K) N -= K * (N / K);
    cout << min(N, K - N) << "\n";
}

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

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

	int len = s.size();

	rep(i, len) {
		cout << "x";
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void listElements(int*, int);

int main() {
  int i = 0, j, n, key;
  int num[100];
  
  scanf("%d ", &n);
  while((scanf("%d", &num[i])) != EOF) {
    i++;
  }
  
  for (i = 1; i < n; i++) {
    listElements(num, n); 
    key = num[i];
    j = i -1;
    
    while(j >= 0 && num[j] > key) {
      num[j+1] = num[j];
      j--;
    }
    num[j+1] = key;
  }
  listElements(num, n); 
  
  return 0;
}

void listElements(int *num, int n) {
  int i;
  for(i = 0; i < n; i++) {
    if (i == (n-1)) {
      printf("%d\n", num[i]);
      break;
    }
    printf("%d ", num[i]);
  }
  return;
}

Measured memory_bytes: 600