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

#define MP make_pair
#define PB push_back
#define ll long long int
#define F first
#define S second
#define MAX(x,y) (x)>(y)?(x):(y)
#define MIN(x,y) (x)<(y)?(x):(y)
#define REP(i,a,n) for(i=a;i<(n);i+=1)
#define REPL(i,a,n) for(i=a;i<=(n);i+=1)
#define REPr(i,n) for(i=n-1;i>=0;i-=1)

typedef vector<int> vi;
typedef vector<ll> vll;
typedef set<int>::iterator sit;
typedef unordered_set<int>::iterator usit;
typedef multiset<int>::iterator msit;
typedef unordered_multiset<int>::iterator umsit;
typedef vector<ll>::iterator vllit;

//cin.ignore(numeric_limits<streamsize>::max(),'\n');

ll MAX3(ll x, ll y, ll z){
    ll temp = max(x,y);
    return max(temp,z);
}

const int N = 101;
const ll W = 100001;
ll dp[N][W];
vector<pair<ll, ll>> items;

ll n,w;

void solve(){
    int i,k,x;
    REPL(i,0,w)
        dp[0][i] = 0;
    REPL(i,0,n)
        dp[i][0] = 0;

    REPL(k,1,n){
        REPL(x,1,w){
            dp[k][x]=0;
            if(x -items[k].F >= 0)
                dp[k][x] = items[k].S + dp[k-1][x-items[k].F];
            dp[k][x] = max(dp[k][x], dp[k-1][x]);
        }
    }  
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    items.clear();
    items.shrink_to_fit();
    cin>>n>>w;
    ll a,b;
    int i;
    pair<ll,ll> p;
    p = MP(0,0);
    items.PB(p);
    REP(i,0,n){
        cin>>a>>b;
        p = MP(a,b);
        items.PB(p);
    }
    solve();
    cout<<dp[n][w]<<endl;
    return 0;
}

Measured memory_bytes: 79232
import java.util.*;
public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		//String word_before = sc.next();
		int N = sc.nextInt();
		int K = sc.nextInt();
		
		double exp_arr[] = new double[N];
		double exp_sum[] = new double[N];
		// boolean flag = true;
		//格納
		//期待値算出
		//期待値合計
		for (int i = 0; i < N; i++) {
			exp_arr[i] = (double)(1+sc.nextInt())/2;
			if(i==0){
				exp_sum[i] = exp_arr[i];
			}else{
				exp_sum[i] = exp_arr[i] + exp_sum[i-1];
			}
		}

		double exp_max_arr[] = new double[N-K+1];
		double max = 0;
		for (int i = 0; i < exp_max_arr.length; i++) {
			if(i==0){
				exp_max_arr[i] =exp_sum[i+K-1] - 0;
			}else{
				exp_max_arr[i] =exp_sum[i+K-1] - exp_sum[i-1];
			}


			if (max<=exp_max_arr[i]) {
				max = exp_max_arr[i];
			}
		}
      
		System.out.println(max);
      	
    }
		
}


Measured memory_bytes: 85180
#include<stdio.h>
int main(){
  char a[101],b[101];
  int s=0,t=0,i;
  scanf("%s%s",a,b);
  for(s=0;a[s];s++);for(t=0;b[t];t++);
  if(s<t){printf("LESS");return 0;}
  if(s>t){printf("GREATER");return 0;}
  for(i=0;i<s;i++){if(a[i]<b[i]){printf("LESS");return 0;}if(a[i]>b[i]){printf("GREATER");return 0;}}
  printf("EQUAL");
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.La;
		if(s[0]==1||s[1]==1){
			Console.WriteLine(1);
			return;
		}
		var p=((s[0])/2)*s[1];
		if(s[0]%2==1){
			p+=(s[1]+1)/2;
		}
		Console.WriteLine("{0}",p);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13268
import sys
input = sys.stdin.readline
N,T = [int(i) for i in input().split()]
minc = 100000
for i in range(N) :
    c,t = [int(i)for i in input().split()]
    if t > T :
        continue
    else :
        minc = min(minc,c)
if minc == 100000 :
    print("TLE")
else :
    print(minc)

Measured memory_bytes: 3060
// AOJ  0517: Longest Steps
// 2017.8.30 bal4u@uu
// 2017.11.14

#include <stdio.h>
#include <string.h>

char c[100005];

char buf[20], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int n, k, a;
	int i, f, w, w0, ans;

	while (fgets(p=buf, 20, stdin) && *p != '0') {
		n = getint(), p++, k = getint();

		memset(c, 0, n+3), f = 0;
		while (k--) {
			fgets(p=buf, 10, stdin);
			a = getint();
			if (a == 0) f = 1;
			else c[a] = 1;
		}
		for (ans = w0 = w = 0, i = 1; i <= n; i++) {
			if (c[i]) w++;
			else if (w > 0) {
				if (w0 + w + f > ans) ans = w0 + w + f;
				if (f && c[i+1]) w0 = w; else w0 = 0;
				w = 0;
			}
		}
		if (w0 + w + f > ans) ans = w0 + w + f;
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1748
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n, k;
  cin >> n >> k;
  double ans = 0;
  if(n>=k){
    ans += (n - k + 1) / (double)n;
  }
  double coin=1;
  ll b;
  while (k > 1){
    coin*=0.5;
    if(k%2==0){
      b = k / 2;
    }
    else{
      b = k / 2 + 1;
    }
    if(b>n){
      ans += 0;
    }
    else if(n>=k){
      ans += (k - b) / (double)n * coin;
    }
    else if(k>n&&n>=b){
      ans += (n - b + 1) / (double)n * coin;
    }
    k = b;
  }
  cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin
from itertools import accumulate

s_in = lambda: stdin.readline()[:-1] # s = s_in()
d_in = lambda: int(stdin.readline()) # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split())) # List = ds_in()

MOD = 10**9 + 7

N = d_in()
A_list = ds_in()

def factorial(N):
    val = 1
    for i in range(1, N+1):
        val = (val * i) % MOD
    return val

N_factorial = factorial(N)

Coefs = []
lastval = 0
for i in range(1, N+1):
    temp = (N_factorial * pow(i, MOD-2, MOD)) % MOD
    lastval = (lastval + temp) % MOD
    Coefs.append(lastval)

if N == 1:
    print(A_list[0])
else: 
    ans = 0
    for i in range(N):
        ans = (ans + A_list[i] * (Coefs[i] + Coefs[N-i-1] - Coefs[0])) % MOD 
    print(ans)


Measured memory_bytes: 14044
#include <math.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;

using ll = long long;
typedef pair<ll, ll> P_ll;
typedef pair<int, int> P;

const ll INF_ll = 1e17;
const int INF = 1e8;

int main() {
  // string A;
  // cin >> A;
  // double B;
  // cin >> B;
  // int B_100 = (int)(B * 100);
  // if (A == "0") {
  //   cout << 0 << endl;
  //   return 0;
  // }

  // if (A.size() <= 2) {
  //   int A_i = stoi(A);
  //   int A_100 = A_i * 100;
  //   int tmp = B_100 * A_100;
  //   int ans = tmp / 10000;
  //   cout << ans << endl;
  //   return 0;
  // }

  // int A_2dig = (A[A.size() - 1] - '0') + (A[A.size() - 2] - '0') * 10;
  // int A_2dig_100 = A_2dig * 100;
  // // cout << A_2dig_100 << endl;
  // int tmp = B_100 * A_2dig_100;
  // int ans_2dig = tmp / 10000;
  // A[A.size() - 1] = '0';
  // A[A.size() - 2] = '0';
  // ll A_ll = stoll(A);
  // ll A_ll_100 = A_ll / 100;
  // ll ans = A_ll_100 * B_100;
  // ans = ans / 100;
  // ans = ans * 100;

  // cout << A_ll_100 << endl;
  // cout << B_100 << endl;

  // cout << ans << endl;
  // cout << ans_2dig << endl;
  // cout << ans + ans_2dig << endl;
  long double A, B;
  cin >> A >> B;
  ll ans = floorl(A * B);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0;i<n;i++)
#define rev(i, n) for(ll i=n-1;i>=0;i--)
#define forr(i, x, y) for(ll i=x;i<y;i++)
#define f first
#define s second
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vpii vector<pair<int,int>>

int main()
{

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

    ll n=s.length();
    ll m=t.length();

    ll dp[n+1][m+1];

    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i==0||j==0)
            dp[i][j]=0;
            else if(s[i-1]==t[j-1])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else
            {
                dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
            }
            

        }
    }
    int len=dp[n][m];

    string ans="";

    ll i=n;
    ll j=m;

    while(j>0&&i>0){

        if(s[i-1]==t[j-1]){
            ans+=s[i-1];
            i--;
            j--;
        }
        else if(dp[i-1][j]>dp[i][j-1]){
            i--;
        }
        else
        {
            j--;
        }
        

    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;



}

Measured memory_bytes: 70656
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Ans[2] = {"No", "Yes"};
string ANS[2] = {"NO", "YES"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    cout << (n - 1) / 2;
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() 
{  
    string s;
    cin>>s;
    int sum=700;
    int cnt=0;
    for(int i=0; i<s.size(); i++)cnt+=(s[i]=='o');
    cout<<sum+cnt*100<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF=999999999;
char a[10][10];
int main() {
    string S;
    cin>>S;
    if(S=="SUN"){cout<<7<<endl;}
    if(S=="SAT"){cout<<1<<endl;}
    if(S=="MON"){cout<<6<<endl;}
    if(S=="TUE"){cout<<5<<endl;}
    if(S=="WED"){cout<<4<<endl;}
    if(S=="THU"){cout<<3<<endl;}
    if(S=="FRI"){cout<<2<<endl;}

 return 0;}

Measured memory_bytes: 256
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		int pre = -1;
		for(int i = 0; i  < n; i++) {
			if(pre <= h[i]-1) {
				pre = h[i]-1;
			}
			else if(pre <= h[i]) {
				pre = h[i];
			}
			else {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}

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

const int MAXN = 1e5 + 5;
int n;
int dp[MAXN];

int main() {
    cin >> n;
    dp[0] = 0;
    for (int i = 1; i <= n; i++) {
        dp[i] = 1 + dp[i - 1];
        int p = 6;
        while (p <= i) {
            dp[i] = min(dp[i], 1 + dp[i - p]);
            p *= 6;
        }
        p = 9;
        while (p <= i) {
            dp[i] = min(dp[i], 1 + dp[i - p]);
            p *= 9;
        }
    }
    cout << dp[n];
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a[3],k;
	cin >> a[0] >> a[1] >> a[2] >> k;
	sort(a,a+3);
	cout << a[0]+a[1]+a[2]*(int)pow(2,k) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; int a, b, c, i, n;
main(){while(true){n=0;cin>>a>>b>>c;if(!a){break;}
while(n<c){if(a<2){goto E;}
for(i=2;i*i<=a;i++){if(a%i==0){goto E;}}n++;E:;a+=b;}
printf("%d\n",a-b);}}

Measured memory_bytes: 1144
(* O(n) *)
Scanf.scanf "%d %d" @@ fun n x ->
  let ms = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0 in
  let x' = x - Array.fold_left (+) 0 ms in
  n + x' / Array.fold_left min max_int ms |> Printf.printf "%d\n"

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

using namespace std;

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

#define F first
#define S second

const int MAXN = 500 + 2;
const int INF = 1e9;

int n, m, a, b, x[MAXN][MAXN];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> a >> b;
	if (n % a == 0 && m % b == 0){
		cout << "No\n";
		return 0;
	}
	
	cout << "Yes\n";
	if (m % b != 0){
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				if (j % b == b-1)
					x[i][j] = -INF;
				else
					x[i][j] = (INF-1)/(b-1);
	}
	else{
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				if (i % a == a-1)
					x[i][j] = -INF;
				else
					x[i][j] = (INF-1)/(a-1);
	}

	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++)
			cout << x[i][j] << " ";
		cout << "\n";
	}
	return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; 
  cin>>n;
  vector<int> vec(211);
  for(int i=0; i<n; i++){
    cin>>vec.at(i);
  }
  int count = 0;
  bool ExistOdd =false;


  while(true){
    for(int i=0; i<n; i++){
      if(vec.at(i)%2 != 0) ExistOdd = true;
      vec.at(i) /= 2;
    }
    if(ExistOdd) break;
    count++;

  }

  cout<<count<<endl;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main()
{
    int n;
    scanf("%d", &n);

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

        if (a % 2 == 1)
            odd += 1;
    }
    if (odd % 2 == 0)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << min(min(a + b, a + c), b + c) << endl;
  return 0;
}

Measured memory_bytes: 256
fn main() {
    let s: String = read();
    let ans = s.chars().enumerate().all(|(i, c)| {
        if i % 2 == 0 {
            c == 'R' || c == 'U' || c == 'D'
        } else {
            c == 'L' || c == 'U' || c == 'D'
        }
    });

    println!("{}", if ans { "Yes" } else { "No"} );
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

Measured memory_bytes: 4352
#include<stdio.h>

int main(){
  int i, n, data, yearsold[7];

  while(1){
    scanf("%d", &n);
    if(n == 0) break;

    for(i=0; i<7; i++)
      yearsold[i] = 0;

    for(i=0; i<n; i++){
      scanf("%d", &data);

      if(data < 10)
	yearsold[0]++;
      else if(data < 20)
	yearsold[1]++;
      else if(data < 30)
	yearsold[2]++;
      else if(data < 40)
	yearsold[3]++;
      else if(data < 50)
	yearsold[4]++;
      else if(data < 60)
	yearsold[5]++;
      else
	yearsold[6]++;
    }

    for(i=0; i<7; i++)
      printf("%d\n", yearsold[i]);
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long int


int main(){
    int n; cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        if(a[i]%2 == 0){
            if(a[i]%3==0 || a[i]%5==0){
                continue;
            }else{
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }

    cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});
process.stdin.on('end', () => {
  const [, ...lines] = content.trim().split('\n');
  const buildings = lines
    .map(line => line.split(' '))
    .reduce(
      (buildings, [b, f, r, v]) => addTenant(buildings, b, f, r, parseInt(v)),
      {}
    );

  render(buildings);
});

const render = buildings => {
  const numBuildings = 4;
  for (let i = 1; i <= numBuildings; i++) {
    renderBuilding(buildings, i.toString());
    if (i !== numBuildings) {
      console.log('#'.repeat(20));
    }
  }
};

const renderBuilding = (buildings, id) => {
  const numFloors = 3;
  for (let i = 1; i <= numFloors; i++) {
    renderFloor(buildings[id] || {}, i.toString());
  }
};

const renderFloor = (building, id) => {
  const numRooms = 10;
  if (building[id] === undefined) {
    console.log('', '0'.repeat(numRooms).split('').join(' '));
    return;
  }
  
  const floor = building[id];
  const numTenants = [];
  for (let i = 1; i <= numRooms; i++) {
    if (floor[i.toString()] === undefined) {
      numTenants.push(0);
    } else {
      numTenants.push(floor[i.toString()]);
    }
  }

  console.log('', numTenants.join(' '));
};

const setValue = (obj, [path, ...rest], val) => {
  if (rest.length === 0) {
    return Object.assign({}, obj, { [path]: val });
  } else {
    return Object.assign({}, obj, {
      [path]: setValue(obj[path] || {}, rest, val),
    });
  }
};

const getValue = (obj, [path, ...rest], val) => {
  if (rest.length === 0) {
    return obj[path] || val;
  } else {
    return obj[path] ? getValue(obj[path], rest, val) : val;
  }
};

const addTenant = (buildings, buildingId, floor, room, amount) => {
  const numTenants = getValue(buildings, [buildingId, floor, room], 0);
  return setValue(buildings, [buildingId, floor, room], amount + numTenants);
};


Measured memory_bytes: 17604
#include<stdio.h>

int main() {
	int  n, a[200000] = {}, b[200000] = {};
	long long sum = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		b[a[i]-1]++;
	}
	for (int i = 0; i < n; i++) {
		sum += (long long)b[i] * ((long long)b[i] - 1) / 2;
	}
	for (int i = 0; i < n; i++) {
		printf("%lld\n", sum-(long long)b[a[i]-1]+1);
	}

	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> x(n);
    rep(i,n) cin >> x[i];

    int max = *max_element(x.begin(), x.end());
    int min = *min_element(x.begin(), x.end());
    int ans =INF;
    for(int p = min; p <=max; ++p)
    {
        int sum = 0;
        rep(i,n) sum += (x[i] -p)*(x[i] -p);
        if( ans > sum) ans = sum;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
use proconio::input;
use proconio::marker::*;
use std::collections::VecDeque;

fn main() {
  let n = 3;
  input!{
    vals: [[isize;n];n]
  }
 
  let mut memo: Vec<isize> = vec![0;n];
  for v in -100..=100 {
    for i in 0..n {
      memo[i] = vals[0][i] - v;
    }
    
    let mut flag = true;
    for i in 1..n {
      let vv = vals[i][0] - memo[0];
      for ii in 1..n {
        if vv + memo[ii] != vals[i][ii] {
          flag = false;
        }
      }
    }
    
    if flag {
      println!("Yes");
      return
    }
  }

  println!("No");
}

Measured memory_bytes: 2140
import collections
n = int(input())
S = []
for _ in range(n):
    S.append(input())
c = collections.Counter(S)
print("AC x "+str(c["AC"]))
print("WA x "+str(c["WA"]))
print("TLE x "+str(c["TLE"]))
print("RE x "+str(c["RE"]))

Measured memory_bytes: 16608
Module Module1
 
Sub main()
	'read : XX = Console.ReadLine()
	'write: Console.WriteLine( XX )
    Dim temp as Integer
    temp = Console.ReadLine()
    
    If temp >= 30 Then
      Console.WriteLine("Yes")
    Else
      Console.WriteLine("No")
    End If
end sub
  
end module

Measured memory_bytes: 28296
S = list(input())

first = S.pop(0)
if first != "A":
    print("WA")
else:
    second = S.pop(0)
    last = S.pop(-1)
    if second.isupper() or last.isupper():
        print("WA")
    else:
        count = 0
        while S != []:
            s = S.pop(0)
            if s == "C":
                count += 1
            elif s.isupper():
                count = 100

        if count == 1:
            print("AC")
        else:
            print("WA")

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline

mod = 10**9 + 7


n, k = map(int, input().split())
A = list(map(int, input().split()))

FACTORIAL = [1] * (n + 1)
for i in range(1, n + 1):
    FACTORIAL[i] = FACTORIAL[i - 1] * i % mod
INVERSE = [1] * (n + 1)
INVERSE[n] = pow(FACTORIAL[n], mod - 2, mod)
for i in range(n - 1, -1, -1):
    INVERSE[i] = INVERSE[i + 1] * (i + 1) % mod

def combination(n, r):
    return FACTORIAL[n] * INVERSE[n - r] % mod * INVERSE[r] % mod

A.sort()
sum_max = 0
for i in range(k - 1, n):
    sum_max = (sum_max + A[i] * combination(i, k - 1)) % mod

A.sort(reverse = True)
sum_min = 0
for i in range(k - 1, n):
    sum_min = (sum_min + A[i] * combination(i, k - 1)) % mod

print((sum_max - sum_min) % mod)


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

int n, a;
bool stat = true;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a);
		if(a % 2 == 0){
			if(a % 3 != 0 && a % 5 != 0) stat = false;
		}
	}
	if(stat) printf("APPROVED\n");
	else printf("DENIED\n");
	return 0;
}

Measured memory_bytes: 256
S = list(input())
if S[0]=="A":
    s = S[2:-1]
    C_count = s.count("C")
    if C_count==1:
        C_index = s.index("C")
        del S[0] 
        del S[C_index+1]
        if "".join(S).islower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <cmath>
int main(){
    using namespace std;
    double r;
    cin >> r;
    double ans1,ans2;
    ans1 = M_PI*r*r;
    ans2 = 2*M_PI*r;
    cout << fixed << setprecision(12) << ans1 << " " << ans2 << endl;
    return 0;
}

Measured memory_bytes: 3268
'use strict';
function Main(inputs) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  const input = inputs.split("\n");
  const a = Number(input[0].split(' ')[0]);
  const b = Number(input[0].split(' ')[1]);
  const k = Number(input[0].split(' ')[2]);

  console.log((a > k ? a - k : 0), (a > k ? b : a + b > k ? a + b - k : 0));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7496
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int is_integer(int *X_i, int *X_j, int D) {
    int sum = 0;
    for (int k = 1; k <= D; k++) {
        sum += (X_i[k] - X_j[k]) * (X_i[k] - X_j[k]);
    }
    int res = (int) sqrt(sum);
    return (res * res) == sum;
}

int main() {
    int N, D;
    scanf("%d", &N);
    scanf("%d", &D);
    int **X = malloc((1 + N) * sizeof(int*));
    for (int i = 1; i <= N; i++) {
        X[i] = malloc((1 + D) * sizeof(int));
        for (int j = 1; j <= D; j++) {
            scanf("%d", &X[i][j]);
        }
    }

    int ans = 0;
    for (int i = 1; i < N; i++) {
        for (int j = i + 1; j <= N; j++) {
            if (is_integer(X[i], X[j], D)) {
                ans += 1;
            }
        }
    }
    
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define FOR(i, j, k) for(int i=j ; i<k ; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

#define MAX 1000000000

int main() {

    int N; cin >> N;
    vi a(N);
    REP(i, N) cin >> a[i];

    vi x(N, 0), y(N, 0);
    int b = 0, c = 0;
    REP(i, N) {
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            x[i]++;
            b++;
        }
    }

    REP(i, N) {
        while (a[i] * 3 < MAX) {
            a[i] *= 3;
            y[i]++;
            c++;
        }
    }

    cout << b << endl;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int h,w;
    cin>>h>>w;
    int dp[10][10];
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            int a;
            cin>>a;
            dp[i][j]=a;
        }
    }
    for(int k=0;k<10;k++){
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(dp[i][j]>dp[i][k]+dp[k][j]){
                    dp[i][j]=dp[i][k]+dp[k][j];
                }
            }
        }
    }
    int ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int a;
            cin>>a;
            if(a!=-1){
                ans+=dp[a][1];
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define MOD 1000000007
#define ll long long int
const ll INF = (1LL << 58);

#ifdef BUGGY
	bool DEBUG = 1;
#endif
#ifndef BUGGY
	bool DEBUG = 0;
#endif


std::vector<int> adj[100005];
bool vis[100005];

int nodes, edges;
deque<int> q;

int main()
{
	scanf("%d", &nodes);
	scanf("%d", &edges);

	for(int i = 0; i < edges; i++)
	{
		int x, y;
		scanf("%d %d", &x, &y);
		adj[x].push_back(y);
		adj[y].push_back(x);
	}

	q.push_back(1);
	vis[1] = 1;

	while(1)
	{
		int node = q.front();

		if(DEBUG)
		{
			cerr << node << " < ";
		}

		bool f = 0;
		for(int i = 0; i < adj[node].size(); i++)
		{
			int v = adj[node][i];
			if(!vis[v])
			{
				f = 1;
				if(DEBUG)
				{
					cerr << v << "\n";
				}
				q.push_front(v);
				vis[v] = 1;
				break;
			}
		}

		if(!f)
			break;
	}

	while(1)
	{
		int node = q.back();
		bool f = 0;
		for(int i = 0; i < adj[node].size(); i++)
		{
			int v = adj[node][i];
			if(!vis[v])
			{
				f = 1;
				q.push_back(v);
				vis[v] = 1;
				break;
			}
		}

		if(!f)
			break;
	}

	printf("%d\n", q.size());
	for(int i = 0; i < q.size(); i++)
	{
		printf("%d ", q[i]);
	}





	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int MOD = (1e9)+7;
const int N = 1e6+5;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int n;
        cin>>n;
        int c = 100;
        int ans = 0;
        while(1)
        {
            if(c>=n)break;
            c+=(c/100);
            ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstring>
#include <string>
#include <queue>
#include <algorithm>

#define MAX_H 1000
#define MAX_W 1000
char m[MAX_H+2][MAX_W+2];
int mindist[MAX_H+2][MAX_W+2];
const int INF = MAX_H*MAX_W*2;
int d[][2] = {1,0, -1,0, 0,1, 0,-1};
using namespace std;

int bfs(int &sx, int &sy, int power){
	//init
	for(int i = 0; i < MAX_H+2; ++i){
		for(int j = 0; j < MAX_W+2; ++j){
			mindist[i][j] = INF;
		}
	}
	queue<pair<int,int>> q;
	q.push(pair<int,int>(sx,sy));
	mindist[sx][sy] = 0;
	while(true){
		auto p = q.front();
		q.pop();
		int x,y;
		x = p.first;
		y = p.second;
		if(m[x][y]-'0' == power){
			sx = x;
			sy = y;
			return mindist[x][y];
		}
		for(int i = 0; i < 4; ++i){
			int x_ = x+d[i][0];
			int y_ = y+d[i][1];
			if(m[x_][y_] == 'X'){
				continue;
			}
			if(mindist[x_][y_] > mindist[x][y]+1){
				q.push(pair<int,int>(x_, y_));
				mindist[x_][y_] = mindist[x][y]+1;
			}
		}
	}
}

int main(){
	int H, W, N;
	cin >> H >> W >> N;
	memset(m, 'X', sizeof m);
	//read
	cin.ignore();
	for(int i = 0; i < H; ++i){
		string s;
		getline(cin, s);
		for(int j = 0; j < W; ++j){
			m[i+1][j+1] = s.at(j);
		}
	}
	//search start
	int minutes = 0;
	int x, y;
	for(int i = 1; i <= MAX_H; ++i){
		for(int j = 1; j <= MAX_W; ++j){
			if(m[i][j] == 'S'){
				x = i;
				y = j;
			}
		}
	}
	for(int i = 1; i <= N; ++i){
		minutes += bfs(x, y, i);
	}
	cout << minutes << endl;
}

Measured memory_bytes: 6128
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
const ll MOD=1e+9+7;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  mint& operator+=(const mint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};
const int NMAX=2000010;
mint fact[NMAX],infac[NMAX];
void Make_Fact(){
  fact[0]=fact[1]=1;
  for(int i=2;i<=NMAX-1;++i){
    fact[i]=fact[i-1]*(mint)i;
  }
}
void Make_InvFact(){
  infac[0]=infac[1]=1;
  for(int i=2;i<=NMAX-1;++i){
    infac[i]=infac[i-1]/(mint)i;	
  }
}
mint Comb(int n,int k){
  if(n<0||k<0||n-k<0) return 0;
  return fact[n]*infac[k]*infac[n-k];
}

mint g(int a,int b){
  mint res;
  for(int i=1;i<=b+1;++i){
    res += Comb(a+i,a);
  }
  return res;
}

int main()
{
  int r1,r2,c1,c2;
  cin >> r1 >> c1 >> r2 >> c2;

  Make_Fact();
  Make_InvFact();
  
  mint res = g(r2,c2)-g(r1-1,c2)-g(r2,c1-1)+g(r1-1,c1-1);
  cout << res.x << "\n";

  return 0;
}


Measured memory_bytes: 31488
H, N, *AB = map(int, open(0).read().split())
A = AB[::2]
B = AB[1::2]

dp = [float("inf")] * (H + 1)
dp[0] = 0

for i in range(N):
    for h in range(H):
        dec_health = min(h + A[i], H)
        dp[dec_health] = min(dp[dec_health], dp[h] + B[i])
print(dp[-1])


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


int main()
{
	int l,r,d;   cin>>l>>r>>d;
	int cnt=0;
	for(int i=l;i<=r;i++){
		
		if(i%d==0){
			
			cnt++;
		}
		
	}
	cout<<cnt<<endl;
	
}



Measured memory_bytes: 3580
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
//#define num 1000000007
#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define up(a,b) (((a)%(b)==0)?((a)/(b)):((a)/(b))+1)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) (a>b)?(a>c)?a:c:(b>c)?b:c
#define min3(a,b,c) (a<b)?(a<c)?a:c:(b<c)?b:c
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;

ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b, a%b);
}
bool prime[3001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=3000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=3000; i += p) 
                prime[i] = false; 
        } 
    } 
}
ll powe[20];
void power()
{
	powe[0]=1;
	REP(i,1,20)
	{
		powe[i]=(powe[i-1]*10)%num;
        if(powe[i]<0)
        powe[i]+=num;
	}
}
struct vertex
{
	vll adj;
};
void dfs(ll i,vertex V[], bool vis[], ll dist[])
{
	vis[i]=true;
	//cout<<i<<" ke liye\n";
	for(auto x : V[i].adj)
	{
		if(!vis[x])
		{
			dfs(x,V,vis,dist);
		}
		dist[i]=max(dist[i],1+dist[x]);
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n,m;
	cin>>n>>m;
	vertex V[n+1];
	ll dist[n+1];
	bool vis[n+1];
	memset(dist,0,sizeof(dist));
	memset(vis,false,sizeof(vis));
	REP(i,0,m)
	{
		ll x,y;
		cin>>x>>y;
		V[x].adj.push(y);
	}
	REP(i,1,n+1)
	{
		if(!vis[i])
		{
			dfs(i,V,vis,dist);
		}
	}
	ll maxm=1;
	REP(i,0,n+1)
	{
		//cout<<dist[i]<<" ";
		maxm=max(maxm,dist[i]);
	}
	//cout<<endl;
	cout<<maxm<<"\n";
	return 0;
}

Measured memory_bytes: 9984
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
           String s= Console.ReadLine();


           List<string> comp = new List<string> {  "SUN" ,"MON", "TUE", "WED", "THU", "FRI", "SAT"};
        int num = 7;
        
        foreach(string com in comp){
            if (com.CompareTo(s) == 0)
            {
                break;
            }
            num--;

        }
        Console.WriteLine(num);

    }
    
    
    
    }
}

Measured memory_bytes: 13404
#include<bits/stdc++.h>//不用unsigned会掉精 
using namespace std;
unsigned long long ans,n,a,b,s,ss;
int main(){
    cin>>n>>a>>b>>ss;
    for(int i=2;i<=n;i++){
    	scanf("%d",&s);
		unsigned long long cha=abs(s-ss)*a*1.0;
		if(cha<b)ans+=cha;
		else ans+=b;
		ss=s;
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>


int main(){
  int N;
  scanf("%d", &N);
  std::map<std::string, int > mp;
  std::string s;
  for (int i=0; i<N; i++){
    std::cin >> s;
    mp[s]++;
  }
  printf("AC x %d\n", mp["AC"]);
  printf("WA x %d\n", mp["WA"]);
  printf("TLE x %d\n", mp["TLE"]);
  printf("RE x %d\n", mp["RE"]);
  return 0;
}

Measured memory_bytes: 3296
#At coder 2020/3/9 B
#import math
#import time
A,B,M=list(map(int,input().split())) 
a=list(map(int,input().split())) 
b=list(map(int,input().split())) 

ans=min(a)+min(b)

for ii in range(M):
    x,y,c=list(map(int,input().split())) 
    ans=min(ans,a[x-1]+b[y-1]-c)
    
print(ans)


Measured memory_bytes: 18736
#include<stdio.h>

int main(void){
    int n;
    int a[100];
    
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",a+i);
    }
    
    int minj,count=0,tmp;
    for(int i=0;i<n;i++){
        minj=i;
        for(int j=i;j<n;j++){
            if(a[j]<a[minj]){
                minj=j;
            }
        }
        tmp=a[i];
        a[i]=a[minj];
        a[minj]=tmp;
        if(i!=minj)count++;
    }
    
    for(int i=0;i<n-1;i++)printf("%d ",a[i]);
    printf("%d\n%d\n",a[n-1],count);
}




Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
//#define endl "\n"
#define pi acos(-1.0)

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long n,a,b,x,y,z;
    cin>>n>>a>>b;

    if(a%2==b%2)
        {
            cout<<((a+b)/2)-min(a,b)<<endl;
            return 0;

        }

    x=(b-a+1)/2+a-1;
    y=abs((a+(n-b)+1+n)/2-n)+(n-b)+1;
    z=min((max(a,b)-1),(n-min(a,b)));

    //cout<<x<<y<<z<<endl;
    cout<<min(x,min(y,z))<<endl;


    return  0;
}

// 10 1 10



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int a, b;
    cin >> a >> b;

    cout << (a + b) % 24 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
#include<list>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int a[5],i,j;
  for(i=0;i<3;i++){
    cin >> a[i];
  }
  int ans=(1<<29);
  for(i=0;i<3;i++){
    for(j=i+1;j<3;j++){
      ans=min(ans,a[i]+a[j]);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>

int main() {
  std::string s, t, u;
  int a, b;
  std::cin >> s >> t >> a >> b >> u;
  if (u == s) --a;
  else --b;
  std::cout << a << " " << b << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include "math.h"
#include <set>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long int lli;
lli mod = 1e9 + 7;
lli f(lli n)
{
    if (n == 0)
        return 1;
    else
        return n % mod * f(n - 1) % mod;
}
int main()
{
    lli n, m;
    cin >> n >> m;
    if (abs(n - m) > 1) {
        cout << 0 << endl;
        return 0;
    } else {
        if (abs(n - m) == 0) {
            cout << 2 * f(n) % mod * f(m) % mod << endl;
            return 0;
        } else {
            cout << f(n) % mod * f(m) % mod << endl;

            //cout << n !*m ! << endl;
        }
    }
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define FO(i,a,b) for (int i = (a); i < (b); i++)

long long cp2[100];
int logfloor(int c) {
    FO(i,0,50) {
        if (cp2[i] > c) return i-1;
    }
    return 0;
}

int N;
int a[100005];
int ans;
int main() {
    cp2[0] = 1;
    FO (i,1,50) cp2[i] = 2*cp2[i-1];
    scanf ("%d", &N);
    FO (i,0,N) scanf ("%d", &a[i]);
    int fAm = 0;
    FO (i,0,N) {
        int fl = logfloor(a[i]);
        int re = fl;
        if (cp2[fl] != a[i]) re++;
        if (re > fAm) {
            ans += re - fAm;
            fAm = re;
        } else if (re == fAm) {
            if (fl == re) {
            } else {
                fAm--;
            }
        } else {
            fAm = fl;
        }
    }
    printf ("%d\n", ans);
    return 0;
}


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

typedef long long ll;

int main() {
    int N, Q, l, r;
    cin >> N >> Q;
    vector<int> a(N);
    rep(i, N) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    rep(i, Q) {
        cin >> l >> r;
        cout << upper_bound(a.begin(), a.end(), r) - lower_bound(a.begin(), a.end(), l) << endl;
    }
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
#define ll long  long 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const unsigned int M = 1000000007;

  
int main()
{
	

     ll x;
     cin>>x;
     if(x>=30)
      cout<<"Yes";
    else
      cout<<"No";

return 0;
}




Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, K;
    cin >> N >> K;
    vector<long long> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    long long ans = 1e12;
    if (K == 1)
    {
        cout << "0" << endl;
        return 0;
    }
    for (int bit = 0; bit < (1 << N - 1); bit++)
    {
        vector<long long> tmp = a;
        long long cost = 0;
        vector<int> v;
        for (int i = 0; i < N - 1; i++)
        {
            if (bit & (1 << i))
            {
                v.push_back(i + 1);
            }
        }
        if (v.size() >= K - 1)
        {
            for (int i = 0; i < v.size(); i++)
            {
                long long max_h = 0;
                for (int j = 0; j < v[i]; j++)
                {
                    max_h = max(max_h, tmp[j]);
                }
                cost += max(0LL, max_h - tmp[v[i]] + 1);
                tmp[v[i]] += max(0LL, max_h - tmp[v[i]] + 1);
            }
            ans = min(ans, cost);
        }
    }
    cout << ans << endl;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();
            int n = line[0], m = line[1];

            var k = Console.ReadLine().Split().Select(z => long.Parse(z)).ToArray();
            Array.Sort(k);

            var dict = new Dictionary<long, int>();
            for (var i = 0; i < k.Length; i++)
            {
                if (dict.ContainsKey(k[i]))
                    dict[k[i]]++;
                else
                    dict[k[i]] = 1;
            }

            for (var i = 0; i < m; i++)
            {
                var tmp = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();
                if (dict.ContainsKey(tmp[1]))
                    dict[tmp[1]] += tmp[0];
                else
                    dict[tmp[1]] = tmp[0];
            }

            var total = 0L;
            dict = dict.OrderByDescending(o => o.Key).ToDictionary(t => t.Key, t => t.Value);

            foreach (var d in dict)
            {
                if (n > d.Value)
                    total += d.Key * d.Value;
                else
                {
                    total += d.Key * n;
                    break;
                }

                n -= d.Value;

            }

            Console.WriteLine(total);
        }
    }
}


Measured memory_bytes: 42808
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;

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

int main() {
  int N;
  cin >> N;
  if(N % 10 == 2 || N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9) {
    cout << "hon" << endl;
  } else if(N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8) {
    cout << "pon" << endl;
  } else {
    cout << "bon" << endl;
  }
  return 0;
}

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		char S[] = sc.nextLine().toCharArray();
		if(S[0]==S[1]||S[1]==S[2]||S[2]==S[3]) {
			System.out.println("Bad");
		}
		else
			System.out.println("Good");
	}
}

Measured memory_bytes: 23124