akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
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

int main() {
	int t;
	cin >> t;
	puts((t >= 30) ? "Yes\n" : "No\n");
}


Measured memory_bytes: 3600
#include <cstdio>
#include <iostream>
using namespace std;
int a[10]={1,2,4,8,16,32,64,128};
int main()
{
	int x,i;
	scanf("%d",&x);
	for(i=7;i>=0;--i)
		if(a[i]<=x){
			printf("%d",a[i]);
			break;
		}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[10000];
	int n,i,s=0,x,y;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>x>>y;
		s+=max(x,y)-min(x,y)+1;
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 105;
int row[N],col[N];
int main()
{
    IOS
 	int n,m;
 	cin>>n>>m;  
 	string s[n];
 	for(int i=0;i<n;i++)
 		cin>>s[i];
 	for(int i=0;i<n;i++)
 	{
 		int c = 0;
 		for(int j=0;j<m;j++)
 			c+=(s[i][j] == '.');
 		if(c == m)
 			row[i] = 1;
 	}	
 	for(int j=0;j<m;j++)
 	{
 		int c = 0;
 		for(int i=0;i<n;i++)
 			c+=(s[i][j]=='.');
 		if(c == n)
 			col[j] = 1;
 	}	
 	for(int i=0;i<n;i++)
 	{
 		if(row[i]) continue;
 		for(int j=0;j<m;j++)
 		if(col[j]) continue;
 		else cout<<s[i][j];
 		cout<<endl;
 	}
    return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, a, b = sc.nextInt()
  val v = Array.fill(n)(sc.nextLong()).sorted
  val max = v.takeRight(a).sum.toDouble / a
  val x = v(n-a)
  val m = v.count(_ == x)
  val k = v.takeRight(a).count(_ == x)

  def initCombTable(n: Int): Array[Array[Long]] = {
    val comb = Array.tabulate(n+1)(i => Array.fill(i+1)(1L))
    for {
      i <- 1 to n
      j <- 1 until i
    } {
      comb(i)(j) = comb(i-1)(j-1) + comb(i-1)(j)
    }
    comb
  }

  val comb = initCombTable(m)

  val ans = if (v.takeRight(a).distinct.length == 1) {
    (k to k + (b - a).min(m - k)).map(comb(m)(_)).sum
  } else {
    comb(m)(k)
  }

  println(f"$max%f")
  println(ans)
}


Measured memory_bytes: 55888
#include <stdio.h>
int main(void){
 int a,b,c,i,j;
 scanf("%d %d",&a,&b);
 char s[a][b+1];
 for(i=0;i<a;i++){
  scanf("%s",s[i]);
  for(c=0;c<2;c++){
   for(j=0;j<b;j++){
    printf("%c",s[i][j]);
   }
   putchar('\n');
  }
 }
 return 0;
}
  

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n, k;
  cin >> n >> k;
  long double max = -1;  
  
  vector<ll> p(n);
  vector<ll> s(n+1, 0);
  rep(i, 0, n)  {
    cin >> p.at(i);
    s.at(i+1) = s.at(i) + p.at(i);
  }
  
  rep(i, 0, n-k+1) {
    if(s.at(i+k) - s.at(i) > max)
      max = s.at(i+k) - s.at(i);
  }
  
  double ans = (max +k)/2;
  
  cout << fixed;
  cout << setprecision(10) << ans << "\n";

}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

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


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


public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                int cnt = 0;
                
                long N = scan.nextLong();
                if(N==1){
                   System.out.println(0);
                   System.exit(0);
               }
                
                ArrayList<Integer> a = new ArrayList<>();
                ArrayList<Integer> b = new ArrayList<>();
                
                a.add(2);
                b.add(2);
                a.add(3);
                b.add(3);
                
               for(int n=5; n<=1000000; n+=2){
                   boolean aru = false;
                   for(int i=0;a.get(i)*a.get(i)<=n; i++){
                       if(n % a.get(i)==0){
                           aru = true;
                           break;
                       }
                   }
                   if(aru==false){
                       a.add(n);
                       b.add(n);
                   }         
               }
               boolean OK = true;
               while(OK == true){
                    OK = false;
                    for(int i=0; i<a.size();i++){
                        if(N%a.get(i)==0){
                            N=N/a.get(i);
                            a.set(i,a.get(i) * b.get(i));
                            cnt++;
                            OK = true;
                            break;
                        }                        
                    }
               }
               if(N>1000000){
                   System.out.println(cnt+1);
               }else{
               System.out.println(cnt);
               }
        }
}

Measured memory_bytes: 42948
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define ll long long
using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef  long long ui64;

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

i64 n,ans=0;
// vi64 v;
cin>>n;
vi64 v(n);
forn(i,n){
cin>>v[i];
}
i64 dp[100000];
dp[0]=0;
for(int i=1;i<=n;i++)
{
	dp[i]=dp[i-1]+abs(v[i]-v[i-1]);
	if(i>=2)
	{
		dp[i]=min(dp[i],dp[i-2]+abs(v[i]-v[i-2]));
	}
}
cout<<dp[n-1]<<"\n";


	return 0;
}


Measured memory_bytes: 1792
S=[]
for i in range(5):
    S.append(int(input()))

lastorderval=10
lastorder=0

goukei=0
for i in range(5):
    if S[i]%10!=0:
    
        if S[i]%10<lastorderval:
            lastorderval=S[i]%10
            lastorder=i
            

for i in range(5):
    if i==lastorder:
        goukei+=S[i]
       
    elif S[i]%10==0:
        goukei+=S[i]
        
    else:
        goukei+=S[i]+(10-S[i]%10)
       

print(goukei)



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

int main() {
  int N;
  cin >> N;
  int cnt = 0, colors[8] = {};
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (a >= 3200)
      cnt++;
    else {
      colors[a / 400] = 1;
    }
  }
  int ans = 0;
  for (int i = 0; i < 8; i++) {
    ans += colors[i];
  }
  cout << max(ans, 1) << " " << ans + cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int > pii;
inline ll qpow(ll a,ll b,ll mod){ll res=1;while(b){if(b&1)res = (res*a)%mod;a=(a*a)%mod;b>>=1;}return res;}
const int mod = 1e9 + 7;
const int MAXN = 2e5 + 7;

int a[MAXN];
int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    int res = 0;
    for(int i = 2; i < n; ++i){
        if(min(min(a[i-1], a[i]), a[i+1]) != a[i] && 
            max(max(a[i-1], a[i]), a[i+1]) != a[i])  res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#define pb push_back
#define mp make_pair
using namespace std;

const long long mod = 1e9 + 7;

void solve() {
    int n; cin >> n;
    vector<int> c(5, 0);
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        c[x]++;
    }
    double dp[305][305][305];
    for (int k = 0; k < 305; k++) {
        for (int j = 0; j + k < 305; j++) {
            for (int i = 0; i + j + k < 305; i++) {
                int sum = i + j + k;
                dp[i][j][k] = 0;
                if (sum == 0) continue;
                dp[i][j][k] += 1.0 * n / sum;
                if (i) dp[i][j][k] += 1.0 * i / sum * dp[i - 1][j][k];
                if (j) dp[i][j][k] += 1.0 * j / sum * dp[i + 1][j - 1][k];
                if (k) dp[i][j][k] += 1.0 * k / sum * dp[i][j + 1][k - 1];
            }   
        }
    }
    cout << fixed << setprecision(10) << dp[c[1]][c[2]][c[3]] << endl;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 221824
//#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 500100, MAXK = 23;
const ll MOD = 998244353;
const int INF = 1e9+10;
const ld PI = asin(1) * 2;

void setIO () {
    FAST_IO;
}

void setIO (string s) {
    setIO();
 	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}



int main() {
	setIO();

    ll x; cin >> x;
    ll m = 1;
    while (true) {
        if ((360*m)%x == 0) {
            ll k = (360*m)/x;
            cout << k << "\n";
            return 0;
        }
        m++;
    }

	return 0;
}


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

// chmax, chmin
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;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long N, long long M, std::vector<long long> X) {
  vector<LL> diff;
  sort(X.begin(), X.end());
  for (int i = 0; i + 1 < X.size(); i++) {
    diff.push_back(X[i + 1] - X[i]);
  }
  LL sum = 0;
  sort(diff.begin(), diff.end());
  for (int i = 0; i < M - N; i++) {
    sum += diff[i];
  }
  cout << sum << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  std::vector<long long> X(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &X[i]);
  }
  solve(N, M, std::move(X));
  return 0;
}


Measured memory_bytes: 2168
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    ll a,b,h,m;
    cin>>a>>b>>h>>m;
    double pi=acos(-1);
    double min=2.0*pi*(double)(m)/(double)(60);
    double hour=2.0*pi*(double)(60*h+m)/(double)(60*12);
    double t=hour-min;
    cout<<setprecision(30)<<sqrt(1.0*a*a+b*b-2.0*cos(t)*a*b);


}


Measured memory_bytes: 4244
N = int(input())
if N <= 26:
    print(chr(ord('a') - 1 + N))
else:
    N -= 1
    d = [N % 26]
    N //= 26
    while N:
        N -= 1
        d.append(N % 26)
        N //= 26
    d.reverse()
    ans = chr(ord('a') + d[0])
    for i in range(1, len(d)):
        ans += chr(ord('a') + d[i])
    print(ans)


Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }

void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  string s;
  cin >> s;
  int k;
  cin >> k;

  /*
  if (k == 1) {
    int ans = 0;
    ans += (s[0] - '0');
    ans += (sz(s) - 1) * 9;
    cout << ans << endl;
    return;
  }
  */
  int n = sz(s);
  ll dp[n + 1][5][2];
  // 桁, 0以外の数, smaller
  rep(i, n + 1) rep(j, 5) rep(m, 2) dp[i][j][m] = 0;
  dp[0][0][0] = 1;

  rep(i, n) rep(j, 4) rep(m, 2) rep(l, 10) {
    if (m == 0 && l > s[i] - '0') continue;

    dp[i + 1][j + (l != 0)][m | (l < s[i] - '0')] += dp[i][j][m];
  }

  ll ans = 0;
  rep(m, 2) ans += dp[n][k][m];
  cout << ans << endl;
  /*
  rep(i, n + 1) {
    cout << i << endl;
    rep(j, 5) { rep(m, 2) cout << dp[i][j][m] << " "; cout << endl; }
  }
  */
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] A = new long[N+1];
		for( int i=0; i<N; i++ ){
			A[i] = sc.nextLong();
		}
		A[N] = 1000000001L;
		Arrays.sort(A);
		int ans = 0;
		int count = 1;
		for( int i=1; i<=N; i++ ){
			if( A[i]==A[i-1] ){
				count++;
			}
			if( A[i]!=A[i-1] ){
				if( count%2!=0 ){
					ans++;
				}
				count = 1;
			}
		}
		System.out.println(ans);
	}
}


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

typedef unsigned long long ll;
//ll mod = 1000000007;
#define mod 1000000007

ll pow(ll m, ll n){
	  if(n==0) return 1;
	  if(n%2==1)
			return ((pow(m,(n)/2) % mod) * (pow(m,(n)/2) % mod) % mod * (m % mod)) % mod;
	  else
			return ((pow(m,n/2) % mod) * (pow(m,n/2) % mod)) % mod;
}


ll mypow(ll m, ll n){
	  if(n==0) return 1;
	  if(n%2==1)	return mypow(m*m%mod,n/2) % mod * m % mod;
	  return mypow(m*m%mod,n/2) % mod;
}


int main(){

	  ll m,n; cin >> m >> n;
	  cout << pow(m,n)%mod << endl;
}

Measured memory_bytes: 1156
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		long k = sc.nextLong();
		
		long[] sa = new long[n + 1];
		long[] sb = new long[m + 1];
		
		sa[0] = 0;
		for (int i = 1; i <= n; i++) {
			long a = sc.nextLong();
			sa[i] = sa[i - 1] + a;
		}
 		
		sb[0] = 0;
		for (int i = 1; i <= m; i++) {
			long b = sc.nextLong();
			sb[i] = sb[i - 1] + b;
		}
		
		int ans = 0;
		int j = m;
		for (int i = 0; i <= n; i++) {
			if (sa[i] > k) break;
			
			while (sa[i] + sb[j] > k)
				j--;
			
			ans = Math.max(ans, i + j);
		}
		
		System.out.println(ans);
		
		sc.close();
	}
}



Measured memory_bytes: 53880
#include<iostream>
using namespace std;
int main(){
int n,num[100];
cin >> n;
for(int a=0; a<n; a++){
cin >> num[a];
}
for(int a=n-1; a>=0; a--){
if(a!=n-1) cout << " ";
cout << num[a];
}
cout <<endl;
return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll long long int
#define ld long double
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define pi 3.14159265358979
#define goodset tree<pa, null_type, less<pa>, rb_tree_tag, tree_order_statistics_node_update>

const ll mod = 1000000007 ;
const ll N=5e5+5;

ld dp[1005][1005];
int main()
{
    FAST
    ll tc,i,j;
    //cin>>tc;
    tc=1;
    /*ll po[15]={0};
    po[0]=1;
    for(i=1; i<15; i++)
    {
        po[i]=26*po[i-1];
        if(i>1)
        //cout<<po[i]<<"\n";
    }
    ll po1[14]={0};
    ll po1[0]=1;
    for(i=1; i<14; i++)
    {
        po1[i]=po[i];
        po1[i]+=po1[i-1];
        //cout<<po1[i]<<"\n";
    }*/

    while(tc--)
    {
        ll n;
        cin>>n;
        ll a[n];
        for(i=0; i<n; i++)
        {
            cin>>a[i];
        }
        ll xo=a[0];
        for(i=1; i<n; i++)
            xo=(xo^a[i]);
        for(i=0; i<n; i++)
        {
            ll val=xo^a[i];
            cout<<val<<" ";
        }

    }
    return 0;
}


Measured memory_bytes: 5236
using System;
using System.IO;

namespace contest
{
    class Program
    {
        static void Main(string[] args)
        {
            solve_abc125_b();
        }

        //Скорее всего можно решить за константу.
        public static void solve_abc125_a()
        {
            string[] abt = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(abt[0]);
            int b = Convert.ToInt32(abt[1]);
            int c = Convert.ToInt32(abt[2]);

            int count = 0;
            int i = 1;
            while (i * a <= c)
            {
                count += b;
                i++;
            }

            Console.WriteLine(count);
        }

        /*
        Перый подход найти два числа такие, чтобы разность
        суммы ценностей и суммы цен была максимальной неверен. 
        Невнимательно прочитал задание. Там сказано, что можно взять
        несколько или не брать вообще. Может быть не ровно два. 
        */
        public static void solve_abc125_b()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] values = Console.ReadLine().Split(' ');
            string[] costs  = Console.ReadLine().Split(' ');

            int max = 0;
            for (int i = 0; i < values.Length; i++)
            {
                max = Math.Max(max, max + Convert.ToInt32(values[i]) - Convert.ToInt32(costs[i]));
            }

            Console.WriteLine(max);
        }
    }
}


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

#define MAX_SIZE 101
#define ALPHABET_SIZE 26

//O(n) runtime

int main() {
    // hash , A-0 B-1, C-2 ....
    int hash[ALPHABET_SIZE];
    char w[MAX_SIZE];

    fgets(w, MAX_SIZE, stdin);

    int i;
    for(i = 0; i < ALPHABET_SIZE; i++)
        hash[i] = 0;

    for(i = 0; i < MAX_SIZE; i++) {
        // Check if char is null
        if (w[i] == 0) 
            break;

        if (w[i] >= 'a' && w[i] <= 'z')
            hash[w[i]-'a']++;
    }

    for (i = 0; i < ALPHABET_SIZE; i++) {
        if (hash[i]%2) {
            printf("No\n");
            return EXIT_SUCCESS;
        }
    }

    printf("Yes\n");


    return EXIT_SUCCESS;
}

Measured memory_bytes: 128
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()

#define mp make_pair
#define in insert
#define er erase
#define con continue
#define pb push_back
#define sc scanf
#define pr printf
#define ub upper_bound
#define lb lower_bound
#define s second
#define f first
#define int long long

const long long infl = 1e18; 
const int N = 3e5 + 300, N2 = 2e3, inf = 1e9 + 200;

set <int> S;
vector <int> g;
int n, m, k;
int a[N];
string ss;

main (){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	cout << m * (m - 1) / 2 + n * (n - 1) / 2;
	
	return 0;
}












Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 309 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e9 + 15;
int dp[100009][3];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    int vet[n+2];
    rep(i,0,n){
        cin>>vet[i];
    }
    rep(i,0,k+1){
        dp[i][2]=0;
        dp[i][1]=3;
    }
    rep(i,0,k+1){
        rep(j,0,n){
            if(i<vet[j]){
                dp[i][1]=min(dp[i][1],2);
                dp[i][2]=max(dp[i][2],1);
            }
            else{
                dp[i][2]=max(dp[i][2],dp[i-vet[j]][1]);
                dp[i][1]=min(dp[i][1],dp[i-vet[j]][2]);
            }   
        }
    }
    // cout<<dp[k][1]<<'\n';
    if(dp[k][1]==1)cout<<"First"<<'\n';
    else cout<<"Second"<<'\n';
    return 0;   
}

Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
void merge(int*, int, int, int,unsigned long long*);
void mergeSort(int*, int, int, unsigned long long*);
int main() {
	int *S, n, i=0;
	unsigned long long cnt = 0;
	//FILE *fp;
	scanf("%d", &n);
	S = (int*)calloc(n+21, sizeof(int));
	/*
	fp = fopen("ALDS1_5_D-in19.txt", "r");
	if (fp == NULL) { printf("fopen error\n"); return -1; }
	while (fscanf(fp, "%d", S + i) != EOF) ++i;
	*/
	
	for (i = 0; i < n; i++) {
		scanf("%d", S + i);
	}
	
	mergeSort(S, 0, n,&cnt);
	/*
	fclose(fp);
	fp = fopen("result.txt", "w");
	if (fp == NULL) { printf("fopen error\n"); return -1; }
		fprintf(fp, "%lld\n", cnt);
	fclose(fp);
	*/
	printf("%lld\n", cnt);
	free(S);
	
	return 0;
}

void merge(int *A, int l, int m, int r, unsigned long long* cnt) {
	int n1 = m - l, n2 = r - m, *L, *R, i, j, k;
	L = (int*)malloc(sizeof(int)*n1+2);
	R = (int*)malloc(sizeof(int)*n2+2);
	for (i = 0; i < n1; i++) *(L + i) = *(A + l + i);
	for (i = 0; i < n2; i++) *(R + i) = *(A + m + i);
	*(L + n1) = 2147483647;
	*(R + n2) = 2147483647;
	for (k = l, i = j = 0; k < r; k++) {
		if (*(L + i) <= *(R + j)) { *(A + k) = *(L + i); ++i; }
		else { *(A + k) = *(R + j); ++j; *(cnt) += n1 - i; }
	}
	//free(L); free(R);
}

void mergeSort(int *A, int l, int r, unsigned long long *cnt) {
	int m;
	if (l + 1 < r) {
		m = (l + r) / 2;
		mergeSort(A, l, m,cnt);
		mergeSort(A, m, r,cnt);
		merge(A, l, m, r,cnt);
	}
}

Measured memory_bytes: 24648
#include <stdio.h>

int main(){
  char c;
  int num,count[10];
  num = 0;
  for(int i = 0; i < 10; ++i){
    count[i] = 0;
  }
  int ret;
  while(1){
	ret = scanf("%c",&c);
    if(ret == EOF || c == '\n') break;
	if(c == 'A' || c == 'C' || c == 'G' || c == 'T') count[num]++;
    else num++;
  }
  int answer = count[0];
  for(int i = 0; i < 10; ++i){
    if(count[i] > answer) answer = count[i];
  }
  printf("%d\n",answer);
  return 0;
}

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

int main(void){
    string s;
    cin>>s;
    int a,z;
    for (int i=0;i<s.size();i++){
        if (s[i]=='A') {
            a=i;
            break;
        }
    }
    for (int i=s.size()-1;i>=0;i--){
        if (s[i]=='Z'){
            z=i;
            break;
        }
    }
    cout<<z-a+1<<endl;
    return 0;
}

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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

int n;
string s,sam;

void nhap()
{
    scanf("%d",&n);
    cin>>s;
    for (char i='A';i<='Z';++i)
        sam+=i;
    for (char i='A';i<='Z';++i)
        sam+=i;
    for (int i=0;i<s.length();++i)
        cout<<sam[s[i]-'A'+n];
}

int main()
{
    nhap();
    return 0;
}


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

namespace Test01
{ 
    struct Cake
    {
        public long x;
        public long y;
        public long z;
        public Cake(long x, long y, long z)
        {
            this.x = x;
            this.y = y;
            this.z = z;
        }
    }

    class Program
    {
        
        static void Bit(List<string> str, string s, int cnt)
        {
            if(cnt == 3)
            {
                str.Add(s);
                return;
            }

            Bit(str, s + "2", cnt + 1);  //2はプラス
            Bit(str, s + "0", cnt + 1);  //0はマイナス
        }
        static void Main(string[] args)
        {
            //入力1(N, M)
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int N = input[0];
            int M = input[1];
            //入力2(cake)
            Cake[] cake = new Cake[N];
            for(int i = 0; i < N; i++)
            {
                long[] xyz = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
                cake[i] = new Cake(xyz[0], xyz[1], xyz[2]);
            }

            List<string> str = new List<string>();
            Bit(str, "", 0);

            long ans = 0;  //答え
            foreach(string pat in str)
            {
                long cur = 0;
                long[] maxi = new long[N];
                for(int i = 0; i < N; i++)
                {
                    maxi[i] = cake[i].x * (pat[0] - '1') + cake[i].y * (pat[1] - '1') + cake[i].z * (pat[2] - '1');
                }
                maxi = maxi.OrderByDescending(x => x).ToArray();
                for (int i = 0; i < M; i++) cur += maxi[i];
                ans = Math.Max(ans, cur);
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11744
import java.util.Scanner;

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

		if (n >= 10) {
			System.out.println(r);
		} else {
			System.out.println(r + 100 * (10 - n));
		}
	}
}


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

int main() 
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
  ll n;cin>>n;
  vector<ll>a(n);
  for(ll i=0;i<n;i++)cin>>a[i];
  ll start=1,com=a[0];
  for(ll i=1;i<n;i++)
  {if(a[i]<=com)start++,com=a[i];
  }
  cout<<start;
 return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 233333;
int n,v,a[N],len,bh[20][N],num;Vi e[N*20];
struct Seg{
	int r[N];
	void init(int x){
		per(i,n,1){r[i]=i;if(i+1<=n&&a[i+1]-a[i]<=x)r[i]=r[i+1];}
	}
}b[20];
map<Vi,bool>Map[20];
bool ck(int dep, Vi c){
	if(SZ(c)>len-dep+1)return 0;if(dep==len||!SZ(c))return 1;
	sort(c.begin(),c.end());
	if(Map[dep].count(c))return Map[dep][c];
	bool ok=0;int tot=0;
	int a[25];rep(j,0,SZ(c)-1)a[j]=SZ(e[c[j]]),tot+=a[j];
	rep(i,0,SZ(c)-1)if(tot-a[i]<=len-(dep+1)+1){
		Vi d;rep(j,0,SZ(c)-1)if(i!=j)rep(k,0,SZ(e[c[j]])-1)d.pb(e[c[j]][k]);
		if(ck(dep+1,d)){ok=1;break;}
	}
	return Map[dep][c]=ok;
}
int main() {//freopen("57.txt","r",stdin);freopen("1.out","w",stdout);
	read(n);read(v);rep(i,1,n)read(a[i]);
	while(1){b[++len].init(v);if(!v)break;v/=2;}
	rep(i,1,len)rep(j,1,n)if(b[i].r[j]!=b[i].r[j-1])bh[i][j]=++num;
	rep(i,1,len-1)rep(j,1,n)if(bh[i][j]){
		for(int k=j;k<=b[i].r[j];k=b[i+1].r[k]+1)
			e[bh[i][j]].pb(bh[i+1][k]);
	}
	Vi top;rep(i,1,n)if(bh[1][i])top.pb(bh[1][i]);
	if(SZ(top)>=20){
		rep(i,1,n)puts("Impossible");return 0;
	}
	for(int i=1;i<=n;i=b[1].r[i]+1){
		Vi c;rep(j,0,SZ(top)-1)if(top[j]!=bh[1][i])rep(k,0,SZ(e[top[j]])-1)c.pb(e[top[j]][k]);
		bool ok=ck(2,c);
		rep(j,i,b[1].r[i])printf("%s\n",ok?"Possible":"Impossible");
	}
	rep(i,1,len)cerr<<i<<' '<<SZ(Map[i])<<endl;
	return 0;
}


Measured memory_bytes: 169088
N= int(raw_input())

# print list(str(N))

sum_all = N
sum_tmp = N
tmp_A = 1
tmp_B = N
list_A_i = []
#for A in range(N):
for A in range(1, N/2):
    B = N - A
    list_A = list(str(A))
    list_B = list(str(B))
#    print list_A, list_B
    sum_tmp = sum(map(int, list_A))+ sum(map(int, list_B))
    if sum_tmp < sum_all:
        tmp_A = A
        tmp_B = B
        sum_all = sum_tmp

#print tmp_A, tmp_B
print sum_all


Measured memory_bytes: 4228
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using P = pair<int,int>;
int main(void) {
    int n; cin >> n;
    vector<P> p(n);
    rep(i, n) cin >> p[i].first >> p[i].second;
    sort(p.begin(), p.end());
    cout << p[n-1].first + p[n-1].second;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);

        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();

        if(A==B && B==C)System.out.printf("No");
        else if(A!=B && B==C)System.out.printf("Yes");
             else if(A==B && B!=C)System.out.printf("Yes");
                  else if(A==C && A!=B)System.out.printf("Yes");
                       else System.out.printf("No");
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define MAX 1e18
using namespace std;
typedef long long int ll;

int main(){
  int h, w; cin >> h >> w;
  vector<string> imagePixel(h);
  string str(w+2, '#');
  rep(i, 0, h)  {
    cin >> imagePixel[i];
    imagePixel[i] = '#'+imagePixel[i]+'#';
  }
  cout << str << endl;
  rep(i, 0, h)  cout << imagePixel[i] << endl;
  cout << str << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int box[100005];
int main()
{
    int n,x;
    while (scanf("%d%d",&n,&x)!=EOF)
    {
        for (int i=1;i<=n;i++)
            scanf("%d",&box[i]);
        long long all=0;
        if (box[1]>x)
        {
            all+=box[1]-x;
            box[1]=x;
        }
        for (int i=2;i<=n;i++)
        {
            int k = box[i]+box[i-1]-x;
            if (k>0)
            {
                all+=k;
                box[i]-=k;
            }
        }
        printf("%lld\n",all);
    }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += n/i;
    if (n%i == 0)
      ans--;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> v(N);
    for(int i = 0; i < N; i++)    cin >> v[i];
    sort(v.begin(), v.end());
    double ans = v[0];
    for(int i = 1; i < N; i++){
        ans = (ans + v[i])/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        int count = 0;
        int maxCount = 0;
        for(int i = 0; i < s.Length; i++)
        {
            if (s[i] == 'R')
                count++;
            else
            {
                if (count > maxCount)
                    maxCount = count;
                count = 0;
            }
        }

        if (count > maxCount)
            maxCount = count;
        
        Console.WriteLine(maxCount);
      
    }


}




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

int main() {
  string S,T;
  int x;

  cin >> S >> T;
  x = S.size();
  for(int i=0;i<=x;++i){
    S.insert(S.begin(),S.at(x-1));
    S.pop_back();
    if(S == T){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3644
/*
  AOJ 2413
  Title:Tree Planting
  @kankichi573
*/
#include <stdio.h>
#include <string.h>
int H,W;
char forest[1000][1000];
char tate[1000],yoko[1000];

main()
{
  int i,j,t;
  
  scanf("%d %d",&H,&W);
  memset(tate,0,sizeof(tate));
  memset(yoko,0,sizeof(yoko));
  for(i=0;i<H;i++)
    for(j=0;j<W;j++)
      {
	scanf("%d",&t);
	forest[i][j]=t;
	yoko[i]^=t;
	tate[j]^=t;
      }
  for(i=0;i<H;i++)
    {
      for(j=0;j<W;j++)
	{
	  printf("%d",yoko[i]^tate[j]^(1^forest[i][j]));
	  if(j<W-1)
	    printf(" ");
	}
      printf("\n");
    }
   
return(0);
}

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

using namespace std;

const long long MOD = 1000000000 + 7;
const string abc = "abacaba";

void solve() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if (v[i] != v[j] && v[j] != v[k] && v[i] + v[j] > v[k]) {
                    res++;
                }
            }
        }
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
//    int t;
//    cin >> t;
//    for (int tt = 0; tt < t; tt++) {
//        solve();
//    }
    solve();
    return 0;
}

Measured memory_bytes: 3656
n = int(input())
a = input().split()
a = [int(i) for i in a]

total = sum(a)
mid = int((total + 1) / 2)

temp_sum = 0
for i in range(len(a)):
    temp_sum += a[i]
    if temp_sum >= mid:
        over_idx = i
        break

diff1 = abs(sum(a[:over_idx]) - sum(a[over_idx:]))
diff2 = abs(sum(a[:over_idx+1]) - sum(a[over_idx+1:]))

ans = min(diff1, diff2)

print(ans)

Measured memory_bytes: 26220
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int H, W, N;
    cin >> H >> W >> N;
    VEC(Pii) cells(N);
    set<Pii> cellset;
    FOR(i, 0, N) {
        cin >> cells[i].first >> cells[i].second;
        cellset.emplace(cells[i].first, cells[i].second);
    }

    vector<set<Pii> > countset(10);
    FOR(i, 0, N) {
        int cy = cells[i].first, cx = cells[i].second;
        FOR(y, cy - 2, cy + 1)
            FOR(x, cx - 2, cx + 1) {
                if (y <= 0 || x <= 0 || y + 2 > H || x + 2 > W)
                    continue;

                int count = 0;
                FOR(yy, y, y + 3) {
                    FOR(xx, x, x + 3)
                        count += cellset.count(PAIR(yy, xx));
                }

                if (count > 0) {
                    countset[count].insert(PAIR(y, x));
                }
            }
    }

    int nonzero = 0;
    FOR(i, 1, 10)
        nonzero += countset[i].size();

    lint zero = (H - 2) * 1LL * (W - 2) - nonzero;
    cout << zero << endl;
    FOR(i, 1, 10)
        cout << countset[i].size() << endl;
    return 0;
};


Measured memory_bytes: 47872
import math

n, m = input().split()
n, m = int(n), int(m)

def calc(x):
    if x >= 2:
        return math.factorial(x) / (math.factorial(x - 2) * 2)
    else:
        return 0

even = (calc(n)) + (calc(m))

print(int(even))

Measured memory_bytes: 38256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, K, A[202020];

int A2[202020];

void emu()
{
	for (int i = 0; i < N; ++i) A2[i] = 0;
	for (int i = 0; i < N; ++i) {
		A2[max(0, i - A[i])]++;
		if (A[i] + i + 1 < N) A2[i + A[i]+ 1]--;
	}
	int v = 0;
	for (int i = 0; i < N; ++i) {
		v += A2[i];
		A[i] = v;
	}
}

int main()
{
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; ++i) scanf("%d", A + i);

	K = min(K, 60);
	for (int i = 0; i < K; ++i) emu();
	for (int i = 0; i < N; ++i) printf("%d%c", A[i], i == N - 1 ? '\n' : ' ');
	return 0;
}


Measured memory_bytes: 4784
N = int(input())
L = []

for _ in range(N):
    L.append(list(map(int,input().split())))

ans = 0

for i in range(N-1):
    for j in range(i + 1, N):
        ans += ((L[i][0] - L[j][0]) ** 2 + (L[i][1] - L[j][1]) ** 2) ** 0.5

ans *= 2 / N

print(ans)

Measured memory_bytes: 9388
#include<bits/stdc++.h>
#define int         long long
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
using namespace std;

signed main(){
    tezz   
    
    int a,b;
    cin >> a >> b;
    cout << (6-a-b) << endl;
    
    
    return 0;
}   


Measured memory_bytes: 256
S=input();T=input()
for i in range(2):
    d={}
    S,T = T,S
    for i in range(len(S)):
        if S[i] not in d:
            d[S[i]] = T[i]
        else:
            if d[S[i]] != T[i]:
                print("No")
                exit()

print("Yes")


Measured memory_bytes: 3632
from numpy import*
from scipy.sparse import*
_,*s=open(0)
s=array([list(map(int,t[:-1]))for t in s])
m=csgraph.floyd_warshall(csr_matrix(s))
i=m[0]%2<1
j=i^True
print(all(s[i][:,i]==0)*all(s[j][:,j]==0)*int(m.max()+1)or-1)

Measured memory_bytes: 15468
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long n = Long.parseLong(sc.next());
        long k = Long.parseLong(sc.next());
        StringBuilder sb = new StringBuilder();
        while(n > 0L) {
            sb.append(n % k);
            n /= k;
        }
        System.out.println(sb.toString().length());
    }
}

Measured memory_bytes: 21844
# include <bits/stdc++.h>
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define ll long long int
#include <tr1/unordered_map>
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define f(i,a,b)  for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end()
#include <map>
using namespace std;



int main()
{




     flash;
     ///////////////////////////////////////////////////////////////////////////////////////
   

ll n;
cin>>n;
ll arr[n];
for(ll i=0;i<n;i++)
{
  cin>>arr[i];
}
sort(arr,arr+n);
ll sum=arr[n-1];
ll count=2;
ll temp=n-2;
while(count<n)
{
  if(count<n)
  {
    sum+=arr[temp];
    count++;
  }
  if(count<n)
  {
    sum+=arr[temp];
    count++;
  }
  temp--;

}
cout<<sum;


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

     return 0;

}


Measured memory_bytes: 5120
# -*- coding: utf-8 -*-

# 区間スケジューリング典型

### TESTCASE
test = ""
#test = \
"""
4
2 4
4 3
9 3
20 5
ans
3
"""

"""
5
10 1
2 1
4 1
6 1
8 1
ans
5
"""

"""
3
3 2
5 1
7 2
ans
"""
############
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
####### MAIN
        
n = int(input2())
XL = [tuple(map(int, input2().split())) for _ in range(n)]

arms = [(x[0]+x[1], x[0]-x[1]) for x in XL]
armsx = sorted(arms, reverse=True)

varmax = -1 * 10**15
ans = 0
while armsx:
    tmp = armsx.pop()
    
    if tmp[1]+1 > varmax:
        varmax = tmp[0]
        ans += 1

print(ans)




Measured memory_bytes: 31252
#include <stdio.h>

int main(){
	int a;
	scanf("%d", &a);
	a=a%10;
	if(a==3){
		printf("bon");
	}
	else if(a==0||a==1||a==6||a==8){
		printf("pon");
	}
	else {
		printf("hon");
	}
}

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

int main()
{
    ll N, M;
    cin >> N >> M;
    if(N > M) { ll tmp = N; N = M; M = tmp; }

    if(N == 1) {
        cout << (M - 2 >= 0 ? M - 2 : 1) << endl; return 0;
    }

    if(N > 1) {
        cout << (ll)(N-2)*(M-2) << endl;
    }
    return 0;
}

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


ans=0
Gates=[0]*(N+2)

for i in range(M):
    L,R=map(int,input().split())
    Gates[L]+=1
    Gates[R+1]-=1

for i in range(N+1):
    Gates[i+1]+=Gates[i]

for i in range(1,N+1):
    if Gates[i]==M:
        ans+=1

print(ans)


Measured memory_bytes: 6900