akhauriyash/Code-Regression huggingface dataset:
#include<bits/extc++.h>
#ifdef _debug 
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#include<bits/stdc++.h>
#define dout(i) 0&&0
#endif
#pragma GCC optimize("unroll-loops,no-stack-protector,O3")
#define eout(i) {cout << (i) << '\n';exit(0);}
#define rout(i) {return cout << (i) << '\n', 0;}
#define priority_queue __gnu_pbds::priority_queue
#define unordered_map __gnu_pbds::gp_hash_table
#define rep(a, b) {for(int _i = a;_i > 0;--_i){b;}}
#define multe int _T;for(cin >> _T;_T--;)
using namespace std;
using ll = long long;using ull = unsigned long long;using ul = unsigned;using db = double;
using __gnu_pbds::null_type;
template<typename T> void read(int n, T s){while(n--)cin >> *s, ++s;}
template<typename T> void write(int n, T s){while(n--)cout << *s << " \n"[n==0], ++s;}
template<typename T> using rbtree = __gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T> inline ostream& operator << (ostream &ou, const vector<T> &a){for(auto it = a.begin();it != a.end();++it)ou << (it != a.begin() ? " " : "") << *it;return ou;}
template<typename T1, typename T2>inline istream& operator >> (istream &in, pair<T1, T2> &a){return in >> a.first >> a.second;}
template<typename T1, typename T2>inline ostream& operator << (ostream &ou, const pair<T1, T2> &b){return ou << b.first << ' ' << b.second;}
template<typename T> inline long long pow(long long v, long long t, const T &p){long long res = 1;for(;t;t >>= 1, v = v * v % p)if(t & 1)res = res * v % p;return res;}
const int maxn = 1001;
//  q : if there is a group with X people, there must be ql ~ qr of these groups
int ql, qr, gl, gr, n;
// g : from gl ~ gr people per group
const int p = 1e9+7;
ll dp[maxn][maxn];
ll fa[maxn]{1,1}, fainv[maxn]{1,1}, inv[maxn]{1,1};
void init(){
	for(int i = 2;i < maxn;++i){
		fa[i] = fa[i-1] * i % p;
		inv[i] = (p-p/i) * inv[p%i] % p;
		fainv[i] = fainv[i-1] * inv[i] % p;
	}
}
ll C(int a, int b){
	return fa[a] * fainv[b] % p * fainv[a-b] % p;
}
ll pick(int from, int quan, int team){
	// cout << "PICK " << "from " << from << ' ' << "quan " << quan << ' ' << "team " << team << ' ' <<  C(from, quan) * fa[quan] % p * pow(fainv[quan/team], team, p) % p * inv[team] % p << '\n';
	return fa[from] * fainv[from-quan] % p * pow(fainv[quan/team], team, p) % p * fainv[team] % p;
	return C(from, quan) * fa[quan] % p * pow(fainv[quan/team], team, p) % p * inv[team] % p;
}
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	init();
	cin >> n >> gl >> gr >> ql >> qr;
	dp[0][0] = 1;
	int cur = 1;
	// for(int i = 1;i <= n;++i)cout << i << " \n"[i == n];cout << '\n';
	for(int per = gl;per <= gr;++per, cur ^= 1){
		memcpy(dp[cur], dp[!cur], sizeof dp[0]);
		for(int gc = ql, quan = ql * per;gc <= qr and quan <= n;++gc, quan += per){
			for(int sor = 0;sor + quan <= n;++sor){
				if(dp[!cur][sor]){
					dp[cur][sor + quan] = (dp[cur][sor+quan] + (dp[!cur][sor] * pick(n-sor, quan, gc) % p)) % p;
				}
			}
		}
		// for(int i = 1;i <= n;++i)cout << dp[cur][i] << " \n"[i == n];
	}
	cout << dp[!cur][n] << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin>>N;

    int L[N];
    map<int,int> m;
    rep(i,N){
        cin>>L[i];
        //m[L[i]]++;
    }
    sort(L,L+N);
    int ans=0;
    // rep(i,N){
    //     if(m[L[i]]>0)continue;
    //     m[L[i]]++;

    // }
    rep(i,N-2){
        for(int j=i+1;j<N-1;j++){
            for(int k=j+1;k<N;k++){
                if(L[i]!=L[j]&&L[j]!=L[k]){
                    if(L[i]+L[j]>L[k])ans++;
                }
            }
        }
    }
    cout <<ans <<endl;





    



}


Measured memory_bytes: 3648
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main(void){
	int n,k;
	int m;

	scanf("%d %d",&n,&k);
	m = n%k;
	if(m == 0){
	printf("0\n");
	}
	else{
	printf("1\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int dp[s.size()+1][t.size()+1];
    for(int i=0;i<=s.size();i++)
        dp[i][0]=0;
    for(int i=0;i<=t.size();i++)
        dp[0][i]=0;
    for(int i=1;i<=s.size();i++)
    {
        for(int j=1;j<=t.size();j++)
        {
            if(s[i-1]==t[j-1])
                dp[i][j]=1+dp[i-1][j-1];
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    if(dp[s.size()][t.size()]==0)
    {
        cout<<' '<<"\n";
        return 0;
    }
    string com;
    int i=s.size();
    int j=t.size();
    while(i!=0&&j!=0)
    {
        if(s[i-1]==t[j-1])
        {
            com.push_back(s[i-1]);
            i--;
            j--;
        }
        else
        {
            if(dp[i-1][j]>=dp[i][j-1])
                i--;
            else
                j--;
        }
    }
    reverse(com.begin(),com.end());
    cout<<com<<"\n";
    return 0;
}


Measured memory_bytes: 35456
#include<stdio.h>

int main(){
  int o,n,k,i,j;
  int key;
  scanf("%d",&n);
  int A[n];
  for(i=1;i<=n;i++)
	{
		scanf("%d",&A[i]);
	}
  
  for(j=1;j<=n;j++)
    {   
    	 
	      key = A[j];		
	      i = j-1;
	      while(i>0 && A[i]>key)
		{
		  A[i+1]=A[i];  
		  i = i-1;
		}
	      A[i+1] = key;
	      for(k=1;k<=n;k++){
	      	if(k == n){
	      		printf("%d\n",A[k]);
	      	}
	      	else{ printf("%d ",A[k]);}
	      }
    }
  
  return 0;
}


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,k;
signed main(){
    cin>>n>>k;
    n%=k;
    cout<<min(n,k-n)<<endl;
    return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

max_step = 0
for i in range(H * W):
    sy, sx = i // W, i % W
    if S[sy][sx] == "#":
        continue

    steps = [[-1] * W for _ in range(H)]
    steps[sy][sx] = 0
    queue = [(sy, sx)]
    while len(queue) >= 1:
        cy, cx = queue.pop(0)
        for dy, dx in ((0, 1), (0, -1), (1, 0), (-1, 0)):
            ny, nx = cy + dy, cx + dx
            if not (0 <= ny <= H - 1 and 0 <= nx <= W - 1):
                continue
            if S[ny][nx] == "#" or steps[ny][nx] >= 0:
                continue
            queue.append((ny, nx))
            steps[ny][nx] = steps[cy][cx] + 1

    ms = max(max(r) for r in steps)
    max_step = max(ms, max_step)

print(max_step)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>
#include <fstream>

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353;
constexpr int MAX = 5000000;

vector<ll> enumdiv(ll x) {
	vector<ll> res;
	for (ll i = 1; i * i <= x; i++) {
		if (x % i == 0) {
			res.emplace_back(i);
			if (i != x / i) res.emplace_back(x / i);
		}
	}
	sort(res.begin(), res.end());
	return res;
}

int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	ll a, b; cin >> a >> b;
	auto d = enumdiv(gcd(a, b));
	vector<bool> bad(d.size());
	int res = 1;
	for (int i = 1; i < d.size(); i++) {
		if (bad[i]) continue;
		res++;
		for (int j = i + 1; j < d.size(); j++) {
			if (d[j] % d[i] == 0) bad[j] = true;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3636
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> vpi;

const long long INF = 1LL << 55;

#define itn int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
 
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
 
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//mint
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  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;
  }
};

/******************************************/


/*****************************************/

int main(void){
   cin.tie(0);
   ios::sync_with_stdio(false);
   
   ll n;cin >> n;
   cout << n*(n-1)/2 << endl;
   
   return 0;
}

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

#define rep1(i, a, n) for (int i = a; i < n; i++)
#define rep2(i, a, n) for (int i = n; i >= a; i--)
#define asc(v) sort(v.begin(), v.end())
#define desc(v) sort(v.begin(), v.end(), greater<int>())

using namespace std;

int main() {
  string s;
  cin >> s;
  int sum = 0;
  rep1(i, 0, s.size()) {
    int a = (int)(s[i] - '0');
    sum += a;
  }
  cout << (atoi(s.c_str()) % sum == 0 ? "Yes" : "No") << endl;
  return 0;
}

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

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int)(x).size())

using namespace std;

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

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

const int maxn = 20;
int n, m, x, c[maxn], a[maxn][maxn], now[15];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
#endif

    cin >> n >> m >> x;
    forn(i, n) {
        cin >> c[i];
        forn(j, m) cin >> a[i][j];
    }
    int ans = INT_MAX;
    for (int i = 0; i < (1 << n); ++i) {
        memset(now, 0, sizeof(now));
        int sum = 0;
        for (int j = 0; j < n; ++j) {
            if (i & (1 << j)) {
                for (int k = 0; k < m; ++k) {
                    now[k] += a[j][k];
                }
                sum += c[j];
                //cerr << "j : " << (1<<j) << ' ' << i << ' ' << n << endl;
            }
        }
        //cerr << i << ' ' << sum << endl;
        bool flag = true;
        for (int k = 0; k < m; ++k) {
            flag &= now[k] >= x;
        }
        if (flag) ans = min(ans, sum);
    }
    cout << (ans == INT_MAX ? -1 : ans) << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll N;
vector<ll> A, B;
vector<vector<ll>> dp;

ll dfs(ll l, ll r) {
    if (r - l == 1) {
        return 0;
    } else if (r - l == 2) {
        return dp[l][r] = A[r - 1] + A[l];
    } else {
        if (dp[l][r] != INF) {
            return dp[l][r];
        } else {
            rep2(k, l + 1, r) {
                dp[l][r] = min(dp[l][r], dfs(l, k) + dfs(k, r) + (B[k] - B[l]) + (B[r] - B[k]));
            }
            return dp[l][r];
        }
    }
}

void solve() {
    cin >> N;
    A.resize(N);
    B.resize(N + 1, 0);
    dp.resize(N + 1, vector<ll>(N + 1, INF));
    rep(i, N) cin >> A[i];
    rep(i, N) {
        B[i + 1] += B[i] + A[i];
    }
    cout << dfs(0, N) << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 4460
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

struct Node{
int key;
Node * prev, *next;};

Node *nil;
void init()
{
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void insert(int key)
{
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev=x;
    nil->next = x;
    x->prev = nil;

}

Node * listsearch(int key)
{
    Node *cur = nil->next;
    while(cur != nil && cur->key != key)
        cur = cur->next;
    return cur;
}

void deletenode(Node *t)
{
    if(t==nil)
        return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst()
{
    deletenode(nil->next);
}
void deleteLast()
{
    deletenode(nil->prev);
}
void deleteX(int key)
{
    deletenode(listsearch(key));
}

void print()
{
    Node *cur = nil->next;
    int isf = 0;
    while(1)
    {
        if(cur == nil)
            break;
        if(isf++>0)
            printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}
int main()
{
    init();
    int n;
    scanf("%d", &n);
        for(int i = 0;i<n;i++)
        {
            char s[15];
            int c;
            scanf("%s %d", &s,&c);
            if (strcmp(s,"insert") == 0)
            {
                insert(c);
            }
            else if(strcmp(s, "delete") == 0)
            {
                deleteX(c);
            }
            else if(strcmp(s, "deleteFirst")==0)
            {
                deleteFirst();
            }
            else if(strcmp(s,"deleteLast")==0)
            {
                deleteLast();
            }
        }
        print();

    return 0;
}



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

int main() {
	int n;
	cin>>n;
	vector<int> arr(n);
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr.begin(),arr.end());
	cout << abs(arr[0]-arr[n-1]) << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
using namespace std;
using vi = vector<int>;

int main(void){
    int n, m, cnt = 0;
    cin >> n >> m;
    vi H(n), A(n, 1);
    for(int &h : H) cin >> h;
    for(int i=0; i<m; i++){
        int a, b;
        cin >> a >> b;
        a -= 1; b -= 1;
        if(H[a] <= H[b]) A[a] = 0;
        if(H[b] <= H[a]) A[b] = 0;
    }
    for(int &a : A) cnt += a;
    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 4068
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void printAns(int t1, int t2){
	int h1 = t1/3600, m1 = (t1%3600)/60, s1 = t1%60;
	int h2 = t2/3600, m2 = (t2%3600)/60, s2 = t2%60;
	printf("%02d:%02d:%02d %02d:%02d:%02d\n", h1, m1, s1, h2, m2, s2);
}

int main(){
	int n;
	while(cin >> n, n){
		vector< pair<int,int> > v;
		for(int i=0;i<n;i++){
			int t[3];
			cin >> t[0] >> t[1] >> t[2];
			sort(t, t+3);
			do{
				for(int j=0;j<60;j++){
					if(t[0]%5 == t[1]/12)
						v.push_back(make_pair((t[0]/5)*3600 + t[1]*60 + t[2],i));
					for(int k=0;k<3;k++) t[k] = (t[k]+1)%60;
				}
			}while(next_permutation(t,t+3));
		}
		sort(v.begin(), v.end());
		int start = 0, end = 12*60*60;
		for(int i=0;i<v.size();i++){
			int s = v[i].first, e = -1;
			bool see[10] = {}; see[v[i].second] = true;
			int count = 1;
			for(int j=i+1;j<v.size();j++){
				if(see[v[j].second]) continue;
				see[v[j].second] = true;
				count++;
				if(count == n) {
					e = v[j].first;
					break;
				}
			}
			if(e == -1) break;
			if(end-start > e-s) start = s, end = e;
		}
		printAns(start, end);
	}
}

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

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

  
  if(a>c){
    cout<<"NO"<<endl;
  }
  else if(a+b<c){
    cout<<"NO"<<endl;
  }
  else{
    cout<<"YES"<<endl;
  }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int h,n;
  cin>>h>>n;
  int a[n],i,sum=0;
  for(i=0;i<n;i++)
  {
    cin>>a[i];
    sum+=a[i];
  }
  if(sum>=h)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 640
from bisect import bisect_right

N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(N):
    A[i] = (A[i]-1)%K

B = [0]
for a in A:
    B.append((B[-1]+a)%K)

dic = {}
for i, b in enumerate(B):
    if not b in dic.keys():
        dic[b] = [i]
    else:
        dic[b].append(i)

ans = 0
for L in dic.values():
    for i in range(len(L)):
        #print(L, i)
        j = bisect_right(L, L[i]+K-1)
        #print(j)
        ans += j-i-1
print(ans)

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

int main() {
	string s;
	cin >> s;
	int ans = 1;
	char c0 = s.at(0);
	char c1 = '0';
	bool c2 = false;
	for (size_t i = 1; i < s.length(); i++){
		if (c2==false && s.at(i) != c0) {
			ans++;
			c0 = s.at(i);
		}
		else if (c2 == false && s.at(i) == c0) {
			if (i == s.length() - 1)c1 = s.at(i);
			else {
				ans++;
				c0 = s.at(i);
				c2 = true;
			}
		}
		else if(c2 ==true&&c1=='0'){
			c1 = s.at(i);
		}
		else {
			ans++;
			c0 = s.at(i);
			c1 = '0';
			c2 = false;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let K: usize = read();
    use std::collections::VecDeque;
    let mut queue: VecDeque<i64> = VecDeque::new();
    queue.push_back(1);
    queue.push_back(2);
    queue.push_back(3);
    queue.push_back(4);
    queue.push_back(5);
    queue.push_back(6);
    queue.push_back(7);
    queue.push_back(8);
    queue.push_back(9);
    for _ in 0..K - 1 {
        let v = queue.pop_front().unwrap();
        let rem = v % 10;
        match rem {
            0 => {
                queue.push_back(v * 10 + rem);
                queue.push_back(v * 10 + rem + 1)
            }
            9 => {
                queue.push_back(v * 10 + rem - 1);
                queue.push_back(v * 10 + rem);
            }
            _ => {
                queue.push_back(v * 10 + rem - 1);
                queue.push_back(v * 10 + rem);
                queue.push_back(v * 10 + rem + 1)
            }
        }
    }
    println!("{}", queue.pop_front().unwrap());
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 200001;
const int MOD = 1000000007;

        signed main() {
        int n,m;
        cin>>n>>m;
        int x[n];for(int i=0;i<n;i++)x[i]=-1;
        int s,c;
        for(int i=0;i<m;i++){
                cin>>s>>c;s--;
                if(x[s]!=-1&&x[s]!=c){
                        cout<<-1;
                        return 0;
                }
                x[s]=c;
        }
        if(x[0]==0){
              if(n!=1)  cout<<-1;
              else cout<<0;
                return 0;
        }
        if(x[0]==-1){
                if(n!=1)x[0]=1;
                else x[0]=0;
        }
        for(int i=1;i<n;i++)if(x[i]==-1)x[i]=0;
        for(int i=0;i<n;i++)cout<<x[i];

      }


        


Measured memory_bytes: 256
n, k = map(int,input().split())
p = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = -float('inf')
for i in range(n):
    score = []
    check = [0] * n
    now = i
    cycle = 0
    for _ in range(k):
        go = p[now] - 1
        if check[go] == 1:
            break
        now = go
        if len(score) == 0:
            score.append(c[now])
        else:
            score.append(score[-1] + c[now])
        check[now] = 1
        cycle += 1

    t = k // cycle
    m = k % cycle

    sum_cycle = score[-1]
    if m == 0:
        ans = max(sum_cycle * t, sum_cycle * (t - 1) + max(score), max(score), ans)
    else:
        ans = max(sum_cycle * t + max(score[:m]), sum_cycle * (t - 1) + max(score), max(score), ans)

print(ans)

Measured memory_bytes: 89772
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<stdlib.h>

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

    int offset = 25 - D;
    printf("Christmas");

    for (int i=0; i<offset; i++) {
        printf(" Eve");
    }

    printf("\n");
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {


        Scanner input=new Scanner(System.in);

        int a=input.nextInt();
        input.nextLine();
        String s=input.nextLine();


        if(a>=3200)
            System.out.println(s);

        else System.out.println("red");

    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll dp[10005][100][2];
int main() {
    init();
    string S;
    ll D, K;
    cin >> S >> D;
    K = S.size();

    dp[0][0][0] = 1;
    rep(i, K){
        ll s = S[i] - '0';
        rep(j, D) rep(k, 10){
            if (k < s) (dp[i + 1][(j + k) % D][1] += dp[i][j][0]) %= MOD;
            (dp[i + 1][(j + k) % D][1] += dp[i][j][1]) %= MOD;
        }
        rep(j, D)(dp[i + 1][(j + s) % D][0] += dp[i][j][0]) %= MOD;

    }

    cout << (dp[K][0][0] + dp[K][0][1] + MOD - 1) % MOD << endl;
}

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

int main(){
  int w, h, x, y, r;
  cin >> w >> h >> x >> y >> r;
  if ((x + r <= w && 0 <= x - r) && (y + r <= h && 0 <= y - r)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

signed main(){

  int n;
  cin>>n;
  vector<int> a(n);
  for(auto& ai:a)cin>>ai;

  int q;
  cin>>q;
  while(q--){
    int l,r,k;
    cin>>l>>r>>k;
    cout<< count(a.begin()+l,a.begin()+r,k) <<endl;
  }

}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t

const ll mod=1e9+7;

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n,m;
	cin>>n>>m;
	vector<char> s(n+5),t(n+5);
	vector<vector<ll>> dp(n+5,vector<ll>(n+5));
	for(int i=1;i<=n;++i){
		cin>>s[i];
		t[i]=s[i];
	}
	for(int i=0;i<m;++i){
		int l,r;
		cin>>l>>r;
		sort(s.begin()+l,s.begin()+r+1);
		sort(t.begin()+l,t.begin()+r+1,greater<char>());
	}
	dp[0][0]=1;
	int lo=0,hi=0;
	for(int i=1;i<=n;++i){
		lo+=s[i]=='1';
		hi+=t[i]=='1';
		for(int j=lo;j<=hi;++j)
			(dp[i][j]=dp[i-1][j]+(j>0?dp[i-1][j-1]:0))%=mod;
	}
	cout<<dp[n][lo]<<'\n';
}



Measured memory_bytes: 73932
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}

int main(){
    ll N,K;
    string S;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
        A[i]--;
    }
    ll cnt = 0;
    ll a = 0;
    ll b;
    map<ll,ll> mp;
    mp[0]++;
    rep(i,N){
        b = A[a];
        mp[b]++;
        cnt++;
        if(mp[b] > 1){
            break;
        }
        a = b;
    }
    
    a = 0;
    ll c = 0;
    ll cnt2 = 0;
    rep(i,N){
        c = A[a];
        cnt2++;
        if(c == b){
            break;
        }
        a = c;
    }
    //cout << "afg" << endl;
    //cout << "cnt: "<<cnt<<" cnt2:"<<cnt2<<endl;
    if(cnt2 >= K){
        //cout << "bbb" << endl;
        ll a = 0;
        ll d = 0;
        rep(i,K){
            d = A[a];
            a = d;
        }
        cout << d+1 << endl;
    }else{
        //cout << "ccc" << endl;
        //cout << cnt <<" "<<cnt2<<endl;;
        if(cnt != cnt2){
            K -= cnt2;
            cnt -= cnt2;
        }
        //cout << cnt << endl;
        ll L = K % cnt;
        //L++;
        //cout << L << endl;
        a = b;
        b;
        rep(i,L){
            b=A[a];
            a = b;
        }
        cout << b+1 <<endl;
    }
}

Measured memory_bytes: 17152
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int k = sc.nextInt();
		
		// 計算
		int result = 0;
		for(int i = 0; i < k; i++){
		    System.out.print("ACL");
		}
		
		// 出力
		//System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 25396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
//void chmin(int &a, int b) { if (a > b) a = b; }
//void chmax(int &a, int b) { if (a < b) a = b; }

vector<pair<ll,ll>> p_rekkyo(ll n){
    vector<pair<ll,ll>> p_vec;
    for (ll i = 2; i*i <= n; ++i) {
        if(n%i != 0) continue;
        int cnt = 0;
        while(n%i == 0){
            cnt++;
            n /= i;
        }
        p_vec.push_back({i,cnt});
    }
    if(n != 1) p_vec.push_back({n,1});
    return p_vec;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int n,m;
    cin >> n >> m;
    COMinit();
    auto v = p_rekkyo(m);
    ll ans = 1;
    for(auto i: v){
        ll kosuu = i.second;
        ll tmp = COM(n-1+kosuu,kosuu);
        ans = (ans*tmp)%mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12160
from heapq import heappush, heappop, heapify

N, M = map(int ,input().split())
q = []
for i in map(int ,input().split()):
    heappush(q, -i)

for _ in range(M):
    a = heappop(q)
    heappush(q, ((-a)//2)*-1)

print(-sum(q))

Measured memory_bytes: 14180
n,k = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**9
for i in range(n-k+1):
    if x[i]*x[i+k-1] < 0:
        left = 2*abs(x[i])+abs(x[i+k-1])
        right = 2*abs(x[i+k-1])+abs(x[i])
        ans= min(ans,min(left,right))
    else:
        ans = min(ans,max(abs(x[i]),abs(x[i+k-1])))
print(ans)

Measured memory_bytes: 14252
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<long,long>
#define INF 1000000000000000000
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; }
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<int, int> mp;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
class Union_Find {
private:
	vector<int> par;
	vector<int> rank;
public:
	Union_Find(int n) {
		rep(i, n) {
			par.push_back(i);
			rank.push_back(0);
		}
	}
	int find(int x) {
		if (par.at(x) == x) return x;
		else return par.at(x) = find(par.at(x));
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (rank.at(x) < rank.at(y)) {
			par.at(x) = y;
		}
		else {
			par.at(y) = x;
			if (rank.at(x) == rank.at(y)) rank.at(x)++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};
long long N, X[1009], Y[1009], H[1009]; vector<tuple<long long, long long, long long>>vec;
 
signed main() {
	cin >> N; tuple<long long, long long, long long>G = make_tuple(-1, -1, -1);
	for (int i = 1; i <= N; i++) {
		cin >> X[i] >> Y[i] >> H[i];
		if (H[i] >= 1) G = make_tuple(X[i], Y[i], H[i]);
	}
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			long long V = get<2>(G) + abs(get<0>(G) - i) + abs(get<1>(G) - j); V = max(V, 0LL); bool flag = true;
			for (int k = 1; k <= N; k++) {
				long long VV = V - abs(X[k] - i) - abs(Y[k] - j); VV = max(VV, 0LL);
				if (H[k] != VV) flag = false;
			}
			if (flag == true) vec.push_back(make_tuple(i, j, V));
		}
	}
	if (vec.size() == 1) {
		cout << get<0>(vec[0]) << " " << get<1>(vec[0]) << " " << get<2>(vec[0]) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
N=int(input())
e=[0]*(N+1)
for i in range(2,N+1):
    cur=i
    for j in range(2,i+1):
        while cur%j==0:
            e[j]+=1
            cur//=j
def num(m):return len(list(filter(lambda x:x>=m-1,e)))
print(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+num(5)*(num(5)-1)*(num(3)-2)//2)

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

using ll = long long;
using pii = pair<int, int>;

int main() {
    int n, m; cin >> n >> m;
    vector<pii> v(n);
    for(int i = 0; i < n; ++i) {
        cin >> v[i].first >> v[i].second;
    }
    sort(begin(v), end(v));

    ll ans = 0;
    for(auto& p : v) {
        const ll u = min(m, p.second);
        ans += u * p.first;
        m -= u;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int a, b;
	for( a = 1; a <= 9; a++ )
	{
		for( b = 1; b <= 9; b++ )
		{
			printf( "%dx%d=%d\n", a, b, a*b );
		}
	}
	return 0;
}


Measured memory_bytes: 2032
#include <bits/stdc++.h>
////////////////////////////////////////////////////////////
#define all(x) (x).begin(), (x).end() 
const int inf = 1e9;
const long long INF=1e15;
#define endl '\n'
#define forn(i, n) for(int i=0;i<(n);++i)
#define pb push_back
#define eb emplace_back
#define fastio ios::sync_with_stdio(false);cin.tie(0); //cout.tie(0);

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

int main() {
	fastio;
	int n; cin >> n;
	vi x(n); forn(i, n) cin >> x[i];
	int mini = 1e9;
	for(int p=1;p<=100;p++) {
		int sta = 0;
		forn(i, n) sta += (x[i]-p)*(x[i]-p);
		mini = min(sta, mini);
	}
	cout << mini;
}

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

namespace Exawizards
{
    class D
    {
        static int _Mod = 1000000007;

        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToArray();
            int N = a[0], X = a[1];
            List<int> S = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToList();
            S = S.OrderByDescending(z => z).ToList();
            
            Dictionary<int, long> dic = new Dictionary<int, long>();
            long[] num = new long[X + 1];
            num[X] = 1;
            for (int i = 0; i < N; i++)
            {
                for (int k = 0; k <= X; k++)
                {
                    int m = S[i];
                    int nw = k % m;

                    long c = num[k];

                    num[nw] += c;
                    num[nw] %= _Mod;
                    num[k] += c * (N - i - 2);
                    num[k] %= _Mod;
                }
                //Console.WriteLine(num.Sum());
            }
            //期待値
            long sum=num.Select((x, i) => x * i).Sum();
            sum %= _Mod;
            Console.WriteLine(sum);

            //long sum = 0;
            //List<string> list = MakePermutation(N);
            //foreach(string p in list)
            //{
            //    string s = "";
            //    int x = X;
            //    int[] id = p.ToCharArray().Select(z => z - '0').ToArray();
            //    for(int i = 0; i < N; i++)
            //    {
            //        int index = id[i] - 1;
            //        int k = S[index];
            //        x %= k;
            //        s += " " + k;
            //    }
            //    sum += x;
            //    Console.WriteLine(s + " " + x);
            //}


        }

        //階乗n!(mod p)のベクトル
        public static List<long> Factorial(int n)
        {
            long x = 1;
            List<long> list = new List<long>();
            list.Add(x);
            for (int i = 1; i <= n; i++)
            {
                x = (x * i) % _Mod;
                list.Add(x);
            }
            return list;
        }

        //9までの順列を全列挙
        static List<string> MakePermutation(int n)
        {
            List<List<int>> current = new List<List<int>>();
            current.Add(new List<int> { 1 });
            for (int i = 2; i <= n; i++)
            {
                List<List<int>> next = new List<List<int>>();
                List<int> newList = new List<int>();

                foreach (List<int> list in current)
                {
                    for (int j = 0; j <= list.Count; j++)
                    {
                        List<int> ilist = new List<int>(list);
                        ilist.Insert(j, i);
                        next.Add(ilist);
                    }
                }
                current = next;
            }
            List<string> arr = current.Select(x => string.Join("", x)).ToList();
            arr.Sort();
            return arr;
        }


    }
}


Measured memory_bytes: 14048
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

//for debugging 
/*
g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 
*/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
// debugging ends here

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


void solve(){
	int n;
	cin >> n;
	map<string,int> mapka;
	while(n--){
		string v;
		cin >> v;
		mapka[v]++;
	}
	cout << "AC x " << mapka["AC"] << endl;
	cout << "WA x " << mapka["WA"] << endl;
	cout << "TLE x " << mapka["TLE"] << endl;
	cout << "RE x " << mapka["RE"] << endl;



}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


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

typedef long long ll;

using namespace std;

ll is(vector<ll> &a, ll m, ll k)
{
	ll count = 0;
	for(ll i = 0; i < a.size(); i++)
	{
		count = count + a[i] / m;
		if(a[i] % m == 0)
			count--;
	}

	if(count > k)
		return 0;
	else if(count == k)
		return 1;
	
	return 2;
}

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

	vector<ll> a(n);
	for(ll i = 0; i < n; i++)
		cin >> a[i];

	sort(a.begin(), a.end());

	cout.setf(ios::fixed);
	cout << setprecision(0);
	if(!k)
	{
		cout << a[n - 1] << endl;
		return 0;
	}
	else if(k == 1)
	{
		if(n == 1)
			cout << ((ll) round(a[0] / 2)) << endl;
		else
			cout << max((ll)round(a[n - 1] / 2), a[n - 2]) << endl;
	}

	double ans = 0;
	ll l = 1, r = 1000000000;
	while(l <= r)
	{
		ll m = l + (r - l) / 2;
		ll count = is(a, m, k);
		if(count >= 1)
		{
			ans = m;
			r = m - 1;
		}
		else
		{
			l = m + 1;
		}
	}

	cout << ans << endl;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
vl modinv;
void fillModInv(ll n, ll mod){
  modinv = vl(n+1);
  modinv[1] = 1;
  FOR(i,2,n+1){
    modinv[i] = modinv[mod%i] * (mod - mod/i) % mod;
  }
}
/*}}}*/
int main() {
  ll h,a;
  cin >> h >> a;

  ll ans = h/a;
  if(h%a>0) ans ++;
  
  //cout << fixed << setprecision(10);
  cout << ans << endl;
  return 0;
}


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

using ll = long long ;
const ll N_MAX = 2e5 + 5 ; 

int count(ll x){
  ll y  =  ( x*(x-1) )/2 ;
  return y ; 
}

int main(){
  ll N ;
  cin >> N ; 
  vector<int> A(N) ; 
  vector<ll> C(N_MAX) ; //同じA_iの値が何個あるか？
  
  for(int i = 0 ; i < N_MAX ; i++) C.at(i) = 0 ; 

  for(int i = 0 ; i < N ; i++){
    cin >> A.at(i) ; 
    C.at(A.at(i))++ ; 
  }

 
  ll MAX_ANS = 0  ; 

  for(int j = 1 ; j < N_MAX ; j++){
    ll ANS = 0 ; 
    if(C.at(j) > 0){
      ANS = C.at(j)*(C.at(j)-1)/2 ; 
      MAX_ANS += ANS ;  
      
      //cout << MAX_ANS << endl ; 
    }
  }
  
  
  for(int i = 0  ; i < N ; i++){
    
    C.at(A.at(i))-- ;     
    ll ans = 0 ; 
    ll T = 0 ; 
    
    ans = C.at(A.at(i)) ; 
    T += count(ans+1);
    T -= count(ans) ; 
    
    cout << MAX_ANS - T << endl ; 
    
    C.at(A.at(i))++ ;     
  }

}

Measured memory_bytes: 5632
#include <stdio.h>

int main()
{
    int a,b,c;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);

    int count=1;

    if(a!=b){
        count++;
        if(a!=c){
            if(b!=c){
                count++;
            }
        }
    }else if(a==b){
        if(a!=c){
            count++;
        }
    }
    printf("%d",count);
    return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long

void check(int (&a)[3][3], int t) {
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            if (a[i][j] == t) {
                a[i][j] = 0;
                break;
            }
        }
    }
}

bool bingo(int(&a)[3][3]) {
    int mid = 0, row = 0, col = 0;
    for (int i = 0; i < 3; ++i) {
        if (a[i][i] == 0) mid++;
    }
    if (mid == 3) return true;
    mid = 0;
    if (a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0) return true;

    for (int i = 0; i < 3; ++i) {
        row = 0;
        for (int j = 0; j < 3; ++j) {
            if (a[i][j] == 0) row++;
        }
        if (row == 3) return true;
    }

    for (int j = 0; j < 3; ++j) {
        col = 0;
        for (int i = 0; i < 3; ++i) {
            if (a[i][j] == 0) col++;
        }
        if (col == 3) return true;
    }

    return false;
}

int main() {
    fastio;
    int a[3][3];
    for (int i = 0; i < 3; ++i) 
        for (int j = 0; j < 3; ++j)
            cin >> a[i][j];
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int t;
        cin >> t;
        check(a, t);
    }

    bool ans = bingo(a);
    if (ans) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <string.h>
void swap_int(int* x, int* y) {
    int temp;
    temp = *x;
    *x = *y;
    *y = temp;
}
void swap_char(char* x, char* y) {
    char temp;
    temp = *x;
    *x = *y;
    *y = temp;
}

void asc_sort(int* array, int n) {
    int i, j;
    for (i = 0; i < n - 1; i++) {
        for (j = i + 1; j < n; j++) {
            if (array[i] > array[j]) {
                swap_int(&array[i], &array[j]);
            }
        }
    }
}

void dec_sort(int* array, int n) {
    int i, j;
    for (i = 0; i < n - 1; i++) {
        for (j = i + 1; j < n; j++) {
            if (array[i] < array[j]) {
                swap_int(&array[i], &array[j]);
            }
        }
    }
}

int max(int x, int y) {
    if (x > y) {
        return x;
    } else {
        return y;
    }
}

int min(int x, int y) {
    if (x > y) {
        return y;
    } else {
        return x;
    }
}
int main(void) {
    int a[3], b[3], x[4];
    int i, j, k;
    for (i = 0; i < 3; i++) x[i] = 0;
    for (i = 0; i < 3; i++) {
        scanf("%d %d", &a[i], &b[i]);
        x[a[i] - 1]++;
        x[b[i] - 1]++;
    }

    int cnt = 0;
    for (i = 0; i < 3; i++) {
        if (x[i] >= 2) {
            cnt++;
        }
    }
    if (cnt >= 2) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 128
import scala.collection.mutable.ListBuffer
import scala.io.StdIn

object Main extends App {

  val buff = ListBuffer.empty[Double]
  var n = -1
  do{
    n = StdIn.readLine().toInt
    if(n != 0){
      val nums = StdIn.readLine().split(' ').map(_.toDouble)
      val ave = nums.sum / n
      
      val rsq = nums.foldLeft(0D){ (acc, p) =>
        acc + (p - ave)*(p - ave)
      }
      val result = scala.math.sqrt(rsq/n)
      buff += result
    }
    

  } while(n!=0)
  
  buff.foreach(f => println(f"$f%.8f"))
  
}


Measured memory_bytes: 45264