akhauriyash/Code-Regression huggingface dataset:
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/


//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    int k,a,b;
    cin >> k;
    cin >> a >> b;

    int n = 1000 / k;
    int s = 0;
    REP(i,n){
        if(k * (i + 1) >= a && k * (i + 1) <= b){
            cout << "OK" << endl;
            s = 1;
            break;
        }
    }
    if(s == 0) cout << "NG" << endl;
    return 0;
}


Measured memory_bytes: 3600
using System;
using System.Web;
using System.IO;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using static System.Math;
 

class P
{
    static void Main()
    {
        string s = Console.ReadLine();
        Console.WriteLine(int.Parse(s) % s.Sum(x => x - '0') == 0 ? "Yes" : "No");
    }
}


Measured memory_bytes: 11220
#include<iostream>
using namespace std;
void trace(int A[],int n){
    for (int i = 0;i < n;i++){
        if (i > 0) cout << " ";
        cout << A[i];
        }
    cout << endl;
}

void insertion(int A[],int n){
    int i,j,v;
    for (i = 1;i < n;i++){
        v = A[i];
        j = i - 1;
        while (j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        trace(A,n);
    }
}
int main(){
    int n,i,j,A[100];
    cin >> n;
    for (i = 0;i < n;i++) cin >> A[i];
    trace(A,n);
    insertion(A,n);
    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;
constexpr size_t invalid = ~0ull;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  size_t n;
  cin >> n;

  vector <size_t> a (n);
  vector <ll> b (n), c (n - 1);
  rep (i, n)
  {
    cin >> a [i];
    -- a [i];
  }
  rep (i, n) cin >> b [i];
  rep (i, n - 1) cin >> c [i];

  size_t pre_dish = invalid;
  ll ans = 0;
  for (auto && dish : a)
  {
    ans += b [dish];
    if (pre_dish != invalid && pre_dish + 1 == dish)
    {
      ans += c [pre_dish];
    }
    pre_dish = dish;
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

char c[20];
int i,n,t1,t2;

int main()
{
	scanf("%s",c+1);
	n=strlen(c+1);
	for (i=1;i<=n;i++)
		t1=t1+c[i]-48;
	t2=c[1]-49+(n-1)*9;
	printf("%d",max(t1,t2));
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    ll K,N;
    cin>>K>>N;
    vector<ll> A(N);
    for(ll i=0; i<N; i++) cin>>A.at(i);
    sort(all(A));
    A.pb(K);
    A.pb(A.at(N-1)-K);
    sort(all(A));
    //rep(i,A.size()) cout<<A.at(i)<<" ";
    ll N1=A.size();
    ll a=0;
    for(ll i=0; i<N1-1; i++) {
        ll distance=A.at(i+1)-A.at(i);
        a=max(a,distance);
    }
    cout<<K-a<<endl;
}

Measured memory_bytes: 4864
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <stdlib.h>
#define ll long long
#define MOD_P 1000000007
using namespace std;

struct vec {
	int to;
	int cost;
};

int main()
{
	int n;
	cin >> n;
	vector<vector<vec>> to(n);
	vector<int> ans(n, -1);
	queue<int>q;

	for (int i = 1; i < n; i++) {
		int a, b, we;
		cin >> a >> b >> we;
		a--;
		b--;
		vec ob1, ob2;
		ob1.to = b;
		ob2.to = a;
		ob1.cost = ob2.cost = we;
		to[a].emplace_back(ob1);
		to[b].emplace_back(ob2);
	}

	q.push(0);
	while (!q.empty()) {
		int v = q.front();
		q.pop();
		for (int i = 0; i < to[v].size(); i++) {
			int u = to[v][i].to;
			int w = to[v][i].cost;
			if (ans[u] != -1)continue;
			ans[u] = (ans[v] + w) % 2;
			q.push(u);
		}
	}

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

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

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

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    int n, d;
    set<int> s;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> d;
        s.insert(d);
    }
    cout << s.size() << endl;
    return 0;
}

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

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;


signed main() {
  double N;
  cin >> N;
  double ans = 0;

  FOR(i, 1, N+1){
    if(i%2 == 1) ans++;
  }
  ans /= N;

  printf("%.9lf\n", ans);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int n, m;
ld p;
vector<vi> g;
vector<ld> dp;

int getbit(vi v)
{
	int res = 0;
	for (auto i : v)
	{
		res |= 1 << i;
	}
	return res;
}/*

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	cin >> n >> m >> p;
	g.resize(n, vi(n));
	dp.resize(1 << n);
	p /= 100.0;
	REP(i, m)
	{
		int a, b; cin >> a >> b;
		a--; b--;
		g[a][b]++;
		g[b][a]++;
	}
	dp[0] = 1.0;
	REP(i, n) dp[1 << i] = 1.0;
	FOR(i, 2, n + 1)
	{
		REP(bit, 1 << n)
		{
			if (__popcnt(bit) != i) continue;
			vi s;
			REP(j, n)
			{
				if ((bit >> j) & 1) s.push_back(j);
			}
			ld sum = 0;
			REP(j, 1 << i)
			{
				vi s1, s2;
				REP(k, i)
				{
					if ((j >> k) & 1) s1.push_back(s[k]);
					else s2.push_back(s[k]);
				}
				if (s1.size() == 0 || s2.size() == 0) continue;
				int edge = 0;
				for (auto a : s1)
				{
					for (auto b : s2)
					{
						if (g[a][b]) edge++;
					}
				}
				sum += dp[getbit(s1)] * pow(p, edge);
			}
			dp[bit] = 1.0 - sum;
		}
	}
	cout << dp[(1 << n) - 1] << endl;
	return 0;
}*/


int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	cin >> n >> m >> p;
	g.resize(n, vi(n));
	dp.resize(1 << n);
	p /= 100.0;
	REP(i, m)
	{
		int a, b; cin >> a >> b;
		a--; b--;
		g[a][b]++;
		g[b][a]++;
	}
	REP(s, 1 << n)
	{
		int v = s&~s;
		dp[s] = 1.0;
		for (int t = (s - 1) & s; t > 0; t = (t - 1)&s)
		{
			if (!(t&(1 << v))) continue;
			int edge = 0;
			int u = s^t;
			REP(i, n)
			{
				if (!((t >> i) & 1)) continue;
				REP(j, n)
				{
					if (((u >> j) & 1) && g[i][j]) edge++;
				}
			}
			dp[s] -= dp[t] * pow(p, edge);
		}
	}
	cout << dp[(1 << n) - 1] << endl;
	return 0;
}

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

using namespace std;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

typedef long long  ll;
#define endl '\n'




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


const int MOD = 1000000007;

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


int n, x;
int L[100];
void Input() {

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

        cin >> L[i];
    }
}



void Solve() {

    int com = 0;
    int cnt = 1;

    for(int i = 1; i <= n; i++) {


        com = com + L[i-1];
        if(com > x) {

            break;
        }

        cnt++;
    }

    cout << cnt << endl;


}

int main() {

  cin.tie(0);
  ios::sync_with_stdio(false);
  Input();
  Solve();


  return 0;

}



Measured memory_bytes: 256
#初期値
input_data = list(input())
processing = int(input())

#処理実行
for i in range(processing):
    order = input().split()
    if order[0] == "print":
        print("".join(input_data[int(order[1]):int(order[2])+1]))
    elif order[0] == "reverse":
        reverse_data = (input_data[int(order[1]):int(order[2])+1])
        reverse_data.reverse()
        input_data = input_data[0:int(order[1])] + reverse_data + input_data[int(order[2])+1:]
    elif order[0] == "replace":
        input_data = input_data[0:int(order[1])] + list(order[3]) + input_data[int(order[2])+1:]



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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    FOREACH(x, v) { cout << x << " "; }                                        \
    cout << "\n";

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll A, P;

int main() {
    cin >> A >> P;
    cout << (A * 3 + P) / 2 << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  
  int xdist=x2-x1;
  int ydist=y2-y1;
  
  cout << x2 - ydist <<" ";
  cout << y2 + xdist <<" ";
  cout << x2 - ydist - xdist <<" ";
  cout << y2 - ydist + xdist << endl;
  
  return 0;
}


Measured memory_bytes: 256
defmodule Main do
  def main do
    [n,k]=IO.gets("") |> String.trim |>String.split(" ") |> Enum.map(fn x->String.to_integer(x)end)
    IO.gets("") |> String.trim |> String.split(" ") |>Enum.map(fn x->String.to_integer(x)end)
    |> Enum.sort() |> Enum.slice(0..k-1) |>Enum.sum() 
    |>IO.puts()
  end
end


Measured memory_bytes: 30660
import sys
from bisect import bisect_left

sys.setrecursionlimit(10 ** 6)


def dfs(v, p, links, state, ans):
    ans[v] = len(state)
    for u in links[v]:
        if u == p:
            continue
        a = aaa[u]
        b, i = -1, -1
        if state[-1] < a:
            state.append(a)
        else:
            i = bisect_left(state, a)
            b = state[i]
            state[i] = a
        dfs(u, v, links, state, ans)
        if b == -1:
            state.pop()
        else:
            state[i] = b


n = int(input())
aaa = list(map(int, input().split()))
links = [set() for _ in range(n)]
for line in sys.stdin:
    u, v = map(int, line.split())
    u -= 1
    v -= 1
    links[u].add(v)
    links[v].add(u)
ans = [0] * n
dfs(0, -1, links, [aaa[0]], ans)
print('\n'.join(map(str, ans)))


Measured memory_bytes: 264520
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        double EPS = 1e-10;
        long a = scan.nextLong();
        long b = scan.nextLong();
        long c = scan.nextLong();


        if(4*a*b < (c-a-b)*(c-a-b) && c-a-b > 0) {
            os.println("Yes");
        } else {
            os.println("No");
        }
    }
}

Measured memory_bytes: 23764
import math
a,b,h,m=map(int,input().split())
hm = 60*h+m
hmd = math.pi*hm/360
md = math.pi*m/30

ax = a * math.cos(hmd)
ay = a * math.sin(hmd)
bx = b * math.cos(md)
by = b * math.sin(md)

print(((ax-bx)**2+(ay-by)**2)**(0.5))

Measured memory_bytes: 9516
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif

#define ynmes(a) (a) ? mes("Yes") : mes("No")
#define YNmes(a) (a) ? mes("YES") : mes("NO")
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
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; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void)
{    
    ll h, w;
    cin >> h >> w;

    vs stg(h);
    ll cnt = 0;
    
    rep(i, h) {
        cin >> stg[i];
        rep(j, w) {
            if (stg[i][j] == '#') cnt ++;
        }
    }
    
    (cnt == h+w-1) ? mes("Possible") : mes("Impossible");
    
    
    


    
	
    
    
    
    
    
    
    
}



Measured memory_bytes: 3540
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;

ll a[51];
int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int f=0;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]>n-1){
			f=1;
        }
    }
    if(f==0){
		cout<<0<<endl;
		return 0;
    }

	ll y=0;
    ll k=0;
    while(1)
    {
        int max=0;
        for(int i=0; i<n; i++)
        {
            if(a[i]>a[max])
            {
                max=i;
            }
        }
        if(a[max]<=n-1){
			break;
        }
        y=a[max]/n;
        for(int i=0; i<n; i++)
        {
            if(i==max)
            {
                a[i]=a[i]%n;
            }
            else
            {
                a[i]+=y;
            }
        }
		k=k+y;
    }

	cout<<k<<endl;
    return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

string s;

int main(){
	cin.sync_with_stdio(false);
	cin>>s;
	int n=s.length();
	if(n%2==1){
		cout<<"No"<<endl;
		return 0;
	}
	rep(i,n){
		if(!((s[i]=='p'&&s[n-i-1]=='q')||(s[i]=='b'&&s[n-i-1]=='d')||(s[i]=='q'&&s[n-i-1]=='p')||(s[i]=='d'&&s[n-i-1]=='b'))){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


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

void strInit(char str[]);//str[]を0で初期化
void extIntStr(char str[],int data[]);//str[]から数値(int)を抽出しdata[]に順次格納
void incsort(int data[],int len);//data[]を昇順ソート
void decsort(int data[],int len);//data[]を降順ソート
void printIntArray(int data[],int len);//data[]をprint
int* inputArray(int n);//文字列を受け取り数値を抽出、n個の数値(int)を格納した配列のポインタをreturn
int* cpyArray(int data[],int len);//配列(int)を複製した配列のポインタをreturn

//don't forget free(data);

int main(){
    char str[101];
    scanf("%s",str);
    int flag = 1;
    for(int i=1;i<101;){
        if(str[i]=='R')flag = 0;
        i+=2;
    }
    for(int i=0;i<101;){
        if(str[i]=='L')flag = 0;
        i+=2;
    }
    if(flag)printf("Yes");
    else printf("No");
    return 0;
}

//temp##############################################

void strInit(char str[]){
    int len=strlen(str);
    for(int i=0;i<len;i++){
        str[i]=0;
    }
}

void extIntStr(char str[],int data[]){
    int length=strlen(str);
    str[length-1]=' ';
    char buff[12];
    int j,index;
    index=j=0;
    for(int i=0;i<length;i++){
        if(str[i]!=' '){
            buff[j++]=str[i];
        }else{
            data[index++]=atoi(buff);
            strInit(buff);
            j=0;
        }
    }
}

void incsort(int data[],int len){
    for(int i=0;i<len-1;i++){
        for(int j=i+1;j<len;j++){
            if(data[i]>data[j]){
                int tmp=data[i];
                data[i]=data[j];
                data[j]=tmp;
            }
        }
    }
}

void decsort(int data[],int len){
    for(int i=0;i<len-1;i++){
        for(int j=i+1;j<len;j++){
            if(data[i]<data[j]){
                int tmp=data[i];
                data[i]=data[j];
                data[j]=tmp;
            }
        }
    }
}

void printIntArray(int data[],int len){
    for(int i=0;i<len;i++){
        printf("%d\n",data[i]);
    }
}

int* inputArray(int n){
    int *data;
    data=(int*)malloc(sizeof(int)*n);
    char *get;
    get=(char*)malloc(sizeof(char)*11*n+1);
    fgets(get,11*n+1,stdin);
    extIntStr(get,data);
    free(get);
    return data;
}

int* cpyArray(int data[],int len){
    int *cp;
    cp=(int*)malloc(sizeof(int)*len);
    for(int i=0;i<len;i++){
        cp[i]=data[i];
    }
    return cp;
}

//temp##############################################


Measured memory_bytes: 128
#include <stdio.h>

int main(void){
	int A;
	int B;
	scanf("%d", &A);
	scanf("%d", &B);
	if(A+B<10){
		printf("%d \n", A+B);
		return 0;
	}else{
		printf("  error\n");
		return 0;
	}
}

Measured memory_bytes: 128
N,M = map(int,input().split())
ab = []
cd = []
for i in range(N):
    a = list(map(int,input().split()))
    ab.append(a)
    
for i in range(M):
    c = list(map(int,input().split()))
    cd.append(c)
ans = []
for i in range(N):
    array = []
    for j in range(M):
        array.append(abs(ab[i][0] - cd[j][0])+abs(ab[i][1] - cd[j][1]))
    ans.append(array.index(min(array))+1)
    
for i in ans:
    print(i)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <map>
#include <cctype>
#include <cstdlib>
using namespace std;

map<string, int> at;

bool isnumber(char c) {
  return c >= '0' && c <= '9';
}

string get(string str) {
  string s = "";
  s += str[0];
  if(str[0] == '(' || str[0] == ')') return s;
  if(str.length() == 1) return s;
  if(isalpha(str[0])) {
    if(islower(str[1])) return s + str[1];
    else                return s;
  } else {
    for(int i = 1; i < str.length() && isnumber(str[i]); i++) {
      s += str[i];
    }
    return s;
  }
}

int pos;
string sss;
int solve() {
  int w = 0;
  int cnt = 0;
  while(pos < sss.length()) {
    string s = get(sss.substr(pos, sss.length()-pos));
    pos += s.length();
    if(s == "(") {
      cnt += w;
      w = solve();
      if(w == 0) return 0;
    } else if(s == ")") {
      cnt += w;
      return cnt;
    } else if(isalpha(s[0])) {
      cnt += w;
      w = at[s];
      if(w == 0) return 0;
    } else {
      cnt += w*atoi(s.c_str());
      w = 0;
    }
  }
  cnt += w;
  return cnt;
}

main() {
  string str;
  while(cin >> str) {
    if(str == "END_OF_FIRST_PART") break;
    cin >> at[str];
  }
  while((cin >> sss) && sss != "0") {
    pos = 0;
    int ans = solve();
    if(ans == 0) cout << "UNKNOWN" << endl;
    else         cout << ans << endl;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <map>

using namespace std;

int main()
{
    int N;
    cin >> N;
    map<int, int> mp;

    for (int i = 0; i < N; ++i)
    {
        int tmp;
        cin >> tmp;
        mp[tmp]++;
    }

    for (auto itr = mp.begin(); itr != mp.end(); itr++)
    {
        if (itr->second > 1)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

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

int main(){

	int N;
	cin >> N;
	int a[N];
	for(int i = 0; i < N; i++){
		cin >> a[i];
	}

	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(a[i]  > a[j]){
				int tmp;
				tmp = a[j];
				a[j] = a[i];
				a[i] = tmp;
			}
		}
	}



	int A=0;
	int B = 0;
	for(int i = 0; i < N; i++){
		if(i%2 == 0){
			A = A +a[i];
		}
		else{
			B = B +a[i];
		}
	}

	cout << A - B;


	return 0;

}

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

int bubbleSort(int* array, int n);

int main(void) {
	int n; //???????????°
	int i; //??????????????°
	int result; //?????????
	int *p; //?????????????????¨???????????????

	scanf("%d", &n);

	p = (int*)malloc(sizeof(int) * n);
	if(p == NULL) {
		printf("Memory Error\n");
		exit(1);
	}

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

	result = bubbleSort(p, n);

	printf("%d", p[0]);
	for(i = 1; i < n; i++) {
		printf(" %d", p[i]);
	}
	printf("\n%d\n", result);

	return 0;
}

int bubbleSort(int* array, int n) {
	int flag = 1; //????????????????????????1
	int i = 0; //??????????????¨?????????????????????????????????
	int j; //??????????????°
	int temp = 0; //???????????°
	int count = 0; //???????????????

	while(flag) {
		flag = 0;
		for(j = n - 1; j > i; j--) {
			if(array[j] < array[j - 1]) {
				temp = array[j];
				array[j] = array[j - 1];
				array[j - 1] = temp;
				flag = 1;
				count++;
			}
		}
		i++;
	}

	return count;
}

Measured memory_bytes: 600
import java.io.*;

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String input = br.readLine();
			String[] size = input.split(" ");
			Integer height = Integer.parseInt(size[0]);
			Integer width = Integer.parseInt(size[1]);
			if(height == 0 && width == 0){
				break;
			}
			for(int i=1; i <= height; i++){
				String rect = "";
				for(int j=1; j <= width; j++){
					rect += "#";
				}
				rect += "\n";
				System.out.print(rect);
			}
			System.out.println("");
		}

	}

}

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, c=0;
  cin >> n;
  vecll a(n + 2);
  
  a[0] = 0;
  c += abs(a[0]);
  forll(i, 1, n + 1){
	cin >> a[i];
	c+= abs(a[i] - a[i-1]);
  }
  a[n+1] = 0;
  c += abs(a[n+1] - a[n]);
  
  forll(i, 1, n+1){
	cout << c - abs(a[i]-a[i-1]) - abs(a[i+1] - a[i]) + abs(a[i+1] - a[i-1])<< endl;
  }
}


Measured memory_bytes: 2048
package main

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

func main() {
	// scan_init()
	nK := readLineToSlice()
	// fmt.Println(nK)
	n,_ := strconv.Atoi(nK[0])
	k,_ := strconv.Atoi(nK[1])
	//n := readLineToNumber()
	//k := readLineToNumber()
	//r := readLineToNumber()
	//s := readLineToNumber()
	//p := readLineToNumber()
	rsp := readLineToSlice()
	r,_ := strconv.Atoi(rsp[0])
	s ,_:= strconv.Atoi(rsp[1])
	p,_ := strconv.Atoi(rsp[2])
	t := readLine()
	// fmt.Println(n,k,r,s,p,t)
	wakeru := make([][]int, k)
	for i:= 0; i<k; i++ {
		wakeru[i] = make([]int,(n/k)+1)
	}
	kCount := 0
	sizeIndex := 0
	for i:= 0; i<n; i++ {
		wakeru[kCount][sizeIndex] = sirabe(t[i])
		kCount++
		if kCount == k {
			kCount = 0
			sizeIndex++
		}
	}
	count := make([]int, 3)
	for i:= 0; i<k; i++ {
		kaburi := 0
		// fmt.Println("check!!", wakeru[i], kaburi)
		for j:= 0; j<(n/k); j++ {
			// fmt.Println("check", wakeru[i][j], kaburi)
			if j == len(wakeru[i]) || wakeru[i][j+1] == 0 {
				// lastはみない
				break
			}
			if wakeru[i][j] != 0 {
				kaburi ++
				if wakeru[i][j] == wakeru[i][j+1] {
					continue
				}
				// fmt.Println(count, wakeru[i][j]-1)
				count[wakeru[i][j]-1] += kaburi - kaburi/2
				kaburi = 0
			} else {
				break
			}
		}
		lastIndex := 0
		if wakeru[i][len(wakeru[i])-1] == 0 {
			lastIndex = len(wakeru[i])-2
		} else {
			lastIndex = len(wakeru[i])-1
		}
		if kaburi > 0 {
			// fmt.Println("!!last", lastIndex, wakeru[i])
			kaburi ++
			// last一つ前で被ってることをみているので
			count[wakeru[i][lastIndex]-1] += kaburi - kaburi/2
		} else {
			// fmt.Println("last!!", lastIndex, wakeru[i])
			count[wakeru[i][lastIndex]-1] += 1
		}
	}
	sum := 0
	sum += count[0] * p + count[1] * r + count[2] * s
	fmt.Println(sum)
}
func sirabe (a byte) int {
	// r = ぐー s = チョキ t = パー
	if a == 'r' {
		return 1
	} else if a == 's' {
		return 2
	} else {
		return 3
	}
}
var sc = bufio.NewScanner(os.Stdin)

func scan_init() {
	sc.Split(bufio.ScanWords)
}
func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func scan() string {
	sc.Scan()
	return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 200000)

func readLine() string {
	buf := make([]byte, 0, 200000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}
func readLineToNumber() int {
	S := readLine()
	number, _ := strconv.Atoi(S)
	return number
}
func readLineToSlice() []string {
	S := readLine()
	list := strings.Split(S, " ")
	return list
}
func readLineToNumberSlice(memo map[string]int) []int {
	// err時は-1を代入
	S := readLine()
	intList := make([]int, len(S))
	for i := 0; i < len(S); i++ {
		if val, ok := memo[string(S[i])]; ok {
			intList[i] = val
		} else {
			intList[i] = -1
		}
	}
	return intList
}

Measured memory_bytes: 5752
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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;

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

    int d;
    cin >> d;

    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(d, vector<int>(26));
    rep(i, d) rep(j, 26) cin >> s[i][j];

    vector<int> t(d);
    // rep(i, d){
    //     cin >> t[i];
    //     --t[i];
    // }

    vector<int> last(26, 0);
    vector<pair<int, int>> sms(d);
    int total = 0;
    rep(i, d){
        int res = -1001001001;
        int mxidx = -1;
        rep(tt, 26){
            int sm = 0;
            sm += s[i][tt];
            vector<int> l = last;
            
            int minus = 0;

            rep(j, 26) ++l[j];
            l[tt] = 0;
            rep(j, 26) minus += c[j] * l[j];

            sm -= minus;
            if(sm > res){
                mxidx = tt;
                res = sm;
            }
        }
        rep(j, 26) ++last[j];
        last[mxidx] = 0;
        t[i] = mxidx;
        sms[i] = make_pair(res, i);
        total += res;
    }

    // rep(i, d) cout << t[i] << endl;

    sort(sms.begin(), sms.end());
    rep(_, 3){
        int res = total;
        rep(didx, d){
            if(didx > 10) break;
            int to = -1;
            rep(kidx, 26){
                vector<int> tt = t;
                tt[sms[didx].second] = kidx;

                vector<int> last(26, 0);
                int res_c = 0;
                rep(i, d){
                    res_c += s[i][tt[i]];
                    
                    int minus = 0;

                    rep(j, 26) ++last[j];
                    last[tt[i]] = 0;
                    rep(j, 26) minus += c[j] * last[j];

                    res_c -= minus;
                    
                }
                if(res_c > res){
                    to = kidx;
                    res = res_c;
                }
            }

            if(to != -1) t[sms[didx].second] = to;
        }
    }

    rep(i, d) cout << t[i]+1 << endl;


    return 0;
}

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

int main(){
  int A,B;
  cin >> A >> B;
  int ans = -1;
  for (int i=1; i<=1250; i++){
    double a_1 = i*0.08;
    double b_1 = i*0.1;
    int a = a_1;
    int b = b_1;
    if (A == a && B == b){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
char ans[210];
ll A,B,C,D;
int cnt;
int main(){
	int T;read(T);
	while(T--){
		read(A);read(B);read(C);read(D);
		int flag=A<B;
		if(flag){
			swap(A,B);
			C=A+B-C+1;D=A+B-D+1;
			swap(C,D);
		}
		int L=(A+B)/(B+1);
		int l=0,r=A/L+1;
		while(l+1<r){
			int mid=l+r>>1;
			if((A-mid*L)*L>=B-mid) l=mid;
			else r=mid;
		}
		int k=l;
		cnt=0;
		int len=k*(L+1);
		len+=(A-k*L)-(B-k)/L;
		for(int i=C;i<=D;i++)
			if(i<=len) ans[++cnt]=i%(L+1)?'A':'B';
			else ans[++cnt]=(A+B-i+1)%(L+1)?'B':'A';
		if(flag){
			reverse(ans+1,ans+cnt+1);
			for(int i=1;i<=cnt;i++)
				ans[i]=ans[i]=='A'?'B':'A';
		}
		for(int i=1;i<=cnt;i++)
			putchar(ans[i]);
		puts("");
	}
	return 0;
}


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

int main(){
	int N;
	int A[10000];
	int Count = 0;
	cin >> N;
	for(int i = 1; i < N; i++){
		cin >> A[i];
		if(A[i] != i){
			Count += 1;
		}
	}
	if(Count > 2){
	    cout << "NO\n";
	}else{
		cout << "YES\n";
	}
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int a[5],sum=0,x,ans;
    for(int i=0;i<5;i++){
        scanf("%d",&a[i]);
        if(a[i]%10==0){
            sum+=a[i];
        }
        else{
            sum+=a[i]/10*10+10;
        }
    }
    ans=sum;
    for(int i=0;i<5;i++){
        if(a[i]%10){
            ans=min(ans,sum-a[i]/10*10-10+a[i]);
        }
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 128
while true
a,op,b = gets.split(" ")
a = a.to_i
b = b.to_i
  case op
  when "+" then
    puts a + b
  when "-" then
    puts a - b
  when "*" then
    puts a * b
  when "/" then
    puts a / b
  else
    break
  end
end

Measured memory_bytes: 8712
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,q;
  cin>>n>>q;
  vector<ll>a(n),sa(n),sa2(n);
  rep(i,n)cin>>a[i];
  sa[0]=a[0];
  sa2[0]=a[0];
  sa2[1]=a[1];
  rep(i,n-1)
  {
    sa[i+1]+=sa[i]+a[i+1];
  }
  repi(i,2,n)
  {
    sa2[i]+=sa2[i-2]+a[i];
  }
  auto fsa=[&](ll i){if(i<0)return 0LL;return sa[i];};
  auto fsa2=[&](ll i){if(i<0)return 0LL;return sa2[i];};
  //cout<<endl;
  auto check=[&](ll idx,ll x){auto id=lower_bound(all(a),2*x-a[idx])-a.begin();return id+n-1-idx>idx;};
  rep(i,q)
  {
    ll x;
    cin>>x;
    ll ix=lower_bound(all(a),x)-a.begin();
    if(ix>0)
    {
      if(a[ix]-x>=x-a[ix-1])ix--;
    }
    if(ix>=n-1){cout<<sa2[n-1]<<"\n";continue;}
    if(ix==0){cout<<sa[n-1]-sa[(n-2)/2]<<"\n";continue;}
    ll ng=n-1,ok=ix;
    while(ng-ok>1)
    {
      ll mid=(ok+ng)/2;
      if(check(mid,x))ok=mid;
      else ng=mid;
    }
    ll l=min(ix,(ll)(lower_bound(all(a),2*x-a[ok])-a.begin())),r=ok,rr=l+n-1-r;
    //cout<<x<<"lr"<<l<<r<<rr<<endl;
    ll res=fsa(n-1)-fsa(rr-1);
    //cout<<res<<endl;
    while(r!=rr)
    {
      rr--;
      if(r==rr){res+=fsa2(l-1);break;}
      res+=a[rr];
      if(l-1>=0&&x-a[l-1]<=a[r+1]-x)l--;
      else r++;
      if(r==rr){res+=fsa2(l-2);break;}
    }
    cout<<res<<"\n";
  }
  cout<<flush;
  return 0;

}


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

namespace ABC127
{
    class B
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] ans = new int[10];
            int count = x[2];
            for (int i = 0; i < 10; i++)
            {
                ans[i] = count * x[0] - x[1];
                count = ans[i];
                Console.WriteLine(ans[i]);
            }
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
int n,m,a[200][200],b[200],c,ans;
bool pass(int row){
    int tot = c;
    for(int i=1;i<=m;i++){
        tot+=a[row][i]*b[i];
    }
    if(tot>0)return true;
    else return false;
}
int main(){
    cin>>n>>m>>c;
    for(int i=1;i<=m;i++)cin>>b[i];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j];
        }
    }
    for(int i=1;i<=n;i++){
        if(pass(i))ans++;
    }
    cout<<ans<<endl;
}


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

            	const int maxn = 1e5+2;
int wa,tle,ac,re;
int main(){
	//freopen("in.txt","r",stdin);
	
	const int maxn = 1e5+2;
	int n;
	cin>>n;
	
	while(n--){
		string s;
		cin>>s;
		switch(s[0]){
			case 'A':{
				ac++;
				break;
			}
			case 'W':{
				wa++;
				break;
			}
			case 'T':{
				tle++;
				break;
			}
			default:{
				re++;
				break;
			}
		}
	}
	cout<<"AC x "<<ac<<endl<<"WA x "<<wa<<endl<<"TLE x "<<tle<<endl<<"RE x "<<re<<endl;
	return 0;
}






Measured memory_bytes: 3640
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> >vvi;
const ll MOD=1000000007LL;
int main(){
  int n,m;
  cin>>n>>m;
  vi a(m);
  rep(i,m)cin>>a[i];
  sort(a.begin(),a.end());
  vi d(m-1);
  rep(i,m-1){
    d[i]=a[i+1]-a[i];
   // cout<<d[i]<<endl;
  }
  sort(d.begin(),d.end());
  if(m-n<1){
    cout<<0<<endl;
    return 0;
  }
  int ans=0;
  rep(i,m-n){
    ans+=d[i];
  }
  cout<<ans<<endl;
}
  

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;



int main() {
    string s, t;
    cin >> s >> t;
    map<char,int> smp, tmp;
    int n = s.size();
    rep(i,n) {
        smp[s[i]]++;
        tmp[t[i]]++;
    }
    vector<int> a(26);
    priority_queue<int> sq, tq;
    for (auto p : smp) {
        a[p.first-'a']++;
        sq.push(p.second);
    }
    for (auto p : tmp) {
        a[p.first-'a']++;
        tq.push(p.second);
    }
    /*
    rep(i,26) {
        if (a[i] != 0 && a[i] != 2) {
            cout << "No" << endl;
            return 0;
        } 
    }
    */
    if (sq.size() != tq.size()) {
        cout << "No" << endl;
        return 0;
    }
    while (!sq.empty()) {
        int x = sq.top(); sq.pop();
        int y = tq.top(); tq.pop();
        if (x != y) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3912
#include<iostream>
using namespace std;
int main(){
	int m=0,d=0,n=0,date[50]={0},i=0;
	while(cin>>m&&m!=0){
		cin>>d;
		switch(m){
			case 1:
				break;
			case 2:
				d=d+3;
				break;
			case 3:
				d=d+4;
				break;
			case 4:
				break;
			case 5:
				d=d+2;
				break;
			case 6:
				d=d+5;
				break;
			case 7:
				break;
			case 8:
				d=d+3;
				break;
			case 9:
				d=d+6;
				break;
			case 10:
				d=d+1;
				break;
			case 11:
				d=d+4;
				break;
			case 12:
				d=d+6;
				break;
		}
		date[i]=d%7;
		i++;
		n++;
	}
	for(int i=0;i<n;i++){
		switch(date[i]){
			case 0:
				cout<<"Wednesday"<<endl;
				break;
			case 1:
				cout<<"Thursday"<<endl;
				break;
			case 2:
				cout<<"Friday"<<endl;
				break;
			case 3:
				cout<<"Saturday"<<endl;
				break;
			case 4:
				cout<<"Sunday"<<endl;
				break;
			case 5:
				cout<<"Monday"<<endl;
				break;
			case 6:
				cout<<"Tuesday"<<endl;
				break;
		}
	}
}

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

int main() {
    int N, ue, shita;
    cin >> N;
    cin >> ue >> shita;

    int ans = 0;
    int tmp = 0;
    for(int i = 0; i < N-1; i++) {
        if(ue >= shita) {
            tmp ++;
        }
        else {
            ans = max(tmp, ans);
            tmp = 0;
        }
        ue = shita;
        cin >> shita;
    }

    ans = max(tmp, ans);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
S = input()[::-1]
W = [w[::-1] for w in ['dream', 'dreamer', 'erase', 'eraser']]
L = len(S)
ans = 'YES'
i = 0
while i < L:
    f = 1
    for w in W:
        if w == S[i : i + len(w)]:
            i += len(w)
            f = 0
            break
    if f:
        ans = 'NO'
        break
print(ans)

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

int main(){
	unsigned long long N, i, ans=999999999999;
	cin >> N;
	for(i = 1; i <= (long long )sqrt(N); i++){
		if(N % i == 0 && N/i+i-2 < ans) ans = N/i+i-2;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int f(ll a, ll b) {
    ll m = max(a, b) / 10;
    int r = 1;
    
    while (m) {
        m /= 10;
        r++;
    }
    
    return r;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    int ans = f(n, 1);
    
    for (ll a = 2; (a * a) <= n; a++) {
        if ((n % a) != 0) {
            continue;
        }
        
        ans = min(ans, f(n / a, a));
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
  int N;
  cin>> N;
  for(int i = 0; i < N ;i++){
    string S;
    cin>>S;
    if(S == "Y"){
      cout<<"Four"<<endl;
      return 0;
    }
  }
  cout<<"Three"<<endl;
  return 0;
  }


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

int main(){
    int A, B, C, X;
    std::cin >> A >> B >> C >> X;
    int cnt = 0;
    for(int a = 0; a <= A; a++){
        for(int b = 0; b <= B; b++){
            for(int c = 0; c <= C; c++){
                int cash = a * 500 + b * 100 + c * 50;
                if(cash == X) cnt++;
            }
        }
    }

    std::cout << cnt << std::endl;
    return 0;
}


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

int main()
{

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

        long long left = 4 * a * b;
        long long right = (c - b - a) * (c - b - a);
        if (c - a - b < 0) {
                cout << "No" << endl;
                return 0;
        }
        if (left < right) {
                cout << "Yes" << endl;
        }
        else {
                cout << "No" << endl;
        }



}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
ll dp[100001];
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
int t[200];
int main(void) {
  int cnt=0;
  FORJ(2){
    int n;
    scanf("%d",&n);
    FOR(n){
      int a,b;
      scanf("%d %d",&a,&b);
      t[cnt]=a*60+b;
      cnt++;
    }
  }
  t[cnt]=-1;
  qsort(t,cnt,sizeof(int),u);
  int e=0;
  FOR(cnt){
    if(t[i]!=t[i+1]){
      if(e){
        PRC(' ');
      }else{
        e=1;
      }
      printf("%d:%02d",t[i]/60,t[i]%60);
    }
  }
  PRS("");
  return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  
  int count = 0;
  for (int i = A; i <= B; i++){
    string X = to_string(i);
    string Y = X;
    reverse(Y.begin(), Y.end());
    if ( X == Y ) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<long long> h(n);
  for(int i = 0; i < n; i++) cin >> h[i];
  sort(h.begin(), h.end());
  long long ans = h[k-1] - h[0];
  for(int i = 1; i <= n-k; i++)
    ans = min(h[k-1+i]-h[i], ans);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024