akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

vector<vi> e;
int rec(int c, int p){
	int x = 0;
	for(int i : e[c]) if(i != p){
		x ^= 1 + rec(i, c);
	}
	return x;
}
int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n; cin >> n;
	e.resize(n);
	rep(i, n - 1){
		int a, b; cin >> a >> b; a--; b--;
		e[a].pb(b); e[b].pb(a);
	}
	cout << (rec(0, 0) ? "Alice" : "Bob") << endl;
	
	return 0;
}

Measured memory_bytes: 10368
m = 10**9+7
n,a,b = map(int,input().split())
def c(k):
  v = 1
  w = 1
  for i in range(k):
    v = v*(n-i)%m
    w = w*(i+1)%m
  return (v*pow(w,m-2,m)%m)
print((pow(2,n,m)-1-c(a)-c(b))%m)

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

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

using Graph = vector<vector<int>>;

ll kzyou(ll a,ll k){//aのk乗を返す
    ll zyou = 1;
    for(ll i = 1;i<=k;i++){
        zyou *= a;
    }
    return zyou;
}
typedef pair<int,int> P;

bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 0;
  for(int i = 0;i<=N-3;i++){
    if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') ans++;
  }
  cout << ans << endl;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
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; }
using namespace std;

struct RollingHash{ //ローリングハッシュ法
private:
    static const int mod1 = 1031326447, mod2 = 993766717;
    static const int base1 = 281, base2 = 383;
    vector<int_fast64_t> hash1, hash2, pow1, pow2;
public:
    string str;
    RollingHash(const string& s) : str(s) { //初期化
        int sz = (int)s.size();
        hash1.assign(sz + 1, 0); hash2.assign(sz + 1, 0);
        pow1.assign(sz + 1, 1); pow2.assign(sz + 1, 1);
        for(int i = 0; i < sz; i++){
            hash1[i + 1] = (hash1[i] * base1 + s[i]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + s[i]) % mod2;
            pow1[i + 1] = pow1[i] * base1 % mod1;
            pow2[i + 1] = pow2[i] * base2 % mod2;
        }
    }
    inline pair<int_fast64_t, int_fast64_t> get(int l, int r){ //[l, r)
        int_fast64_t res1 = (hash1[r] - hash1[l] * pow1[r - l]) % mod1;
        int_fast64_t res2 = (hash2[r] - hash2[l] * pow2[r - l]) % mod2;
        if(res1 < 0)res1 += mod1; if(res2 < 0)res2 += mod2;
        return { res1, res2 };
    }
    inline int getLCP(int x, int y){ //LCP S[a:], S[b:]
        int len = min((int)size() - x, (int)size() - y) + 1;
        int l = 0, r = len;
        while(r - l > 1){
            int m = (l + r) >> 1;
            if(get(x, x + m) != get(y, y + m))r = m;
            else l = m;
        }
        return l;
    }
    inline void add_str(const string& s){ //string型を連結
        int ns = (int)str.size(), ms = (int)s.size();
        str += s;
        hash1.resize(ns + ms + 1); hash2.resize(ns + ms + 1);
        pow1.resize(ns + ms + 1); pow2.resize(ns + ms + 1);
        for(int i = ns; i < ns + ms; i++){
            hash1[i + 1] = (hash1[i] * base1 + s[i - ns]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + s[i - ns]) % mod2;
            pow1[i + 1] = pow1[i] * base1 % mod1;
            pow2[i + 1] = pow2[i] * base2 % mod2;
        }
    }
    inline void add_char(const char& c){ //char型を連結
        str += c;
        hash1.push_back((hash1.back() * base1 + c) % mod1);
        hash2.push_back((hash2.back() * base2 + c) % mod2);
        pow1.push_back((pow1.back() * base1) % mod1);
        pow2.push_back((pow2.back() * base2) % mod2);
    }
    inline void add_rh(const RollingHash& rh){ //rhを連結
        add_str(rh.str);
    }
    inline size_t size(){ //strのsizeを返す
        return str.size();
    }
};

int main(){

    int N;
    cin >> N;

    string S;
    cin >> S;
    RollingHash rh(S);

    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < i; j++){
            int lcp = rh.getLCP(i, j);
            chmin(lcp, i - j);
            chmax(ans, lcp);
        }
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main()
{
    int n, m, a, b, node_p, node_d;
    queue<int> q;
    cin >> n >> m;
    vector<vector<int>> x(n+1, vector<int> ());
    vector<int> ans(n+1, 0);
    for(int i = 0; i < m; i++) {
        scanf("%d%d", &a, &b);
        x[a].push_back(b);
        x[b].push_back(a);
    }
    q.push(1);
    while(q.size() != 0) {
        node_p = q.front();
        q.pop();
        while (x[node_p].size() != 0) {
            node_d = x[node_p].back();
            x[node_p].pop_back();
            q.push(node_d);
            if (ans[node_d] == 0) {
                ans[node_d] = node_p;
            }
        }
    }
    cout << "Yes" << endl;
    for(int i = 2; i <= n; i++) {
        printf("%d\n", ans[i]);
    }
}

Measured memory_bytes: 11180
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;

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

int n;
int now[20];
vector<int> G[20];
int prev[20];
int type[20];

int dfs(int v){
	if(type[v]>=0){
		return type[v];
	}else if(type[v]==-1){
		int res=0;
		for(int i=0;i<G[v].size();i++){
			res+=dfs(G[v][i]);
		}
		return res;
	}else{
		int res=1;
		for(int i=0;i<G[v].size();i++){
			res*=dfs(G[v][i]);
		}
		return res;
	}
}

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<20;i++){
			G[i].clear();
		}
		int cnt=0;
		for(int i=0;i<n;i++){
			string str;
			cin >> str;
			int pp=0;
			for(int j=0;j<str.size();j++){
				if(str[j]>='0' && str[j]<='9'){
					if(pp>0)G[now[pp-1]].push_back(cnt);
					type[cnt++]=str[j]-'0';
				}else if(str[j]=='+'){
					now[pp]=cnt;
					if(pp>0)G[now[pp-1]].push_back(cnt);
					type[cnt++]=-1;
				}else if(str[j]=='*'){
					now[pp]=cnt;
					if(pp>0)G[now[pp-1]].push_back(cnt);
					type[cnt++]=-2;
				}else{
					pp++;
				}
			}
		}
		printf("%d\n",dfs(0));
	}
	return 0;
}

Measured memory_bytes: 3204
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
// #include<unordered_map>
#include<set>
// #include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y, idx;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

template<typename T>
T minT(T a, T b) {
	if (a < b) return a;
	else return b;
}

template<typename T>
T maxT(T a, T b) {
	if (a > b) return a;
	else return b;
}

template<typename T>
T absT(T a) {
	if (a < 0) a *= -1;
	return a;
}

template<typename T>
T powT(T a, T x) {
	T res = 1;
	while (x > 0) {
		if (x & 1) res = res * a;
		a = a * a;
		x >>= 1;
	}
	return res;
}

ll StoLL(string str) {
	ll ret = 0, ini = 0;
	if (str[0] == '-') ini = 1;
	repi(i, ini, str.length()) {
		ret *= 10;
		ret += (ll)(str[i] - '0');
	}
	if (ini) ret *= -1;
	return ret;
}

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

int main() {
	ll n, m, k;
	bool ans = false;
	cin >> n >> m >> k;
	repi(i, 0, n + 1) {
		repi(j, 0, m + 1) {
			if (i * m + j * n - i * j * 2 == k) {
				ans = true;
			}
		}
	}

	if (ans) wrln("Yes");
	else wrln("No");

	return 0;
}


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

int getValue(char ch){
  if(ch == 'S'){ return 0; }
  if(ch == 'H'){ return 1; }
  if(ch == 'C'){ return 2; }
  if(ch == 'D'){ return 3; }
}

int main(){
  int N,x;
  char ch;
  std::string marks = "SHCD";
  std::set<std::pair<int,int>> cards;
  for(int i = 0 ; i < 4 ; i++){
    for(int j = 0 ; j < 13 ; j++){
      cards.insert(std::make_pair(i,j+1));
    }
  }
  std::cin >> N;
  for(int i = 0 ; i < N ; i++){
    std::cin >> ch >> x;
    cards.erase(std::make_pair(getValue(ch),x));
  }
  for(auto v : cards){
    std::cout << marks[v.first] << " " << v.second << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

vector<int> a[3];

int main(void){
	int n,i,k;
	ll inp,ans=0ll;
	cin >> n;
	for(k=0; k<3; ++k){
		for(i=0; i<n; ++i){
			cin >> inp;
			a[k].push_back(inp);
		}
		sort(a[k].begin(),a[k].end());
	}
	for(i=0; i<n; ++i){
		ans += ((ll)(lower_bound(a[0].begin(),a[0].end(),a[1][i])-a[0].begin()))*((ll)(a[2].end()-upper_bound(a[2].begin(),a[2].end(),a[1][i])));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2292
fun main(args: Array<String>) {
    var n = readLine()!!.toInt()
    var s = readLine()
    val str1 = s!!.substring(0, n / 2)
    val str2 = s.substring(n / 2, n)
    if (str1 == str2) {
        println("Yes")
    } else {
        println("No")
    }
}

Measured memory_bytes: 31672
#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

int main(){

	int m,f,r;
	char ans;

	while (1){
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) break;

		if (m == -1 || f == -1){
			ans = 'F';
		}
		else if (m + f >= 80){
			ans = 'A';
		}
		else if (m + f >= 65){
			ans = 'B';
		}
		else if (m + f >= 50){
			ans = 'C';
		}
		else if (m + f >= 30){
			if (r >= 50){
				ans = 'C';
			}
			else{
				ans = 'D';
			}
		}
		else{
			ans = 'F';
		}

		cout << ans << endl;
	}



	return 0;
}

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

using namespace std;

int main() {
    std::ios::sync_with_stdio(false); 
    cin.tie(nullptr);
    
    constexpr int MOD = 1'000'000'007;
    int N;
    string S;
    cin >> N >> S;
    int res = 1;
    for (char c = 'a'; c <= 'z'; ++c) {
        int cnt = count(begin(S), end(S), c);
        res = 1LL * res * (cnt + 1) % MOD;
    }
    cout << (res - 1 + MOD) % MOD << "\n";

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define int long long
#define sz(x) (int)x.size()
#define mp make_pair
#define fi first
#define se second
#define io ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
#define INF 1e7

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

	int ans = max(a*c,max(a*d,max(b*c,b*d)));
	cout << ans <<endl;
}
 
	
		



Measured memory_bytes: 3648
import java.util.*;
 
import java.io.*;
 
public class Main{
    
    
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
        double A = s.nextDouble();
        double B = s.nextDouble();
        double H = s.nextDouble();
        double M = s.nextDouble();
        double arg = Math.abs(6.0*M/180.0 - (30.0*H + (M/60)*30)/180.0);
        double A2 = Math.pow(A, 2);
        double B2 = Math.pow(B, 2);
        System.out.println(Math.sqrt(A2 + B2 - 2*A*B*Math.cos(arg*Math.PI)));
        
        

 
	}
} 

Measured memory_bytes: 37416
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int N, K, R, S, P;
    cin >> N >> K >> R >> S >> P;
    string T;
    cin >> T;

    ll dp[3][N];
    ll score = 0;
    REP(i, K) {
        int itr = 1;
        dp[0][0] = 0; //gu-
        dp[1][0] = 0; //choki
        dp[2][0] = 0; //pa-
        for (int j = i; j < N; j += K) {
            int tmp;
            tmp = (T[j] == 's')? R : 0;
            dp[0][itr] = tmp + max(dp[1][itr - 1], dp[2][itr - 1]);
            tmp = (T[j] == 'p')? S : 0;
            dp[1][itr] = tmp + max(dp[0][itr - 1], dp[2][itr - 1]);
            tmp = (T[j] == 'r')? P : 0;
            dp[2][itr] = tmp + max(dp[0][itr - 1], dp[1][itr - 1]);
            itr++;
        }
        score += max({dp[0][itr - 1], dp[1][itr - 1], dp[2][itr - 1]});
    }

    cout << score << endl;
    return 0;
}


Measured memory_bytes: 2816
require 'pp'

s = gets.chomp!
t = gets.chomp!

index = 0

max = 0
0.upto(s.length - t.length) do |i|
    cnt = 0
    s[i, t.length].chars.each_with_index do |ch, j|
        if ch == t[j]
            cnt += 1
        end
    end    

    if max < cnt
        max = cnt
    end
end

puts t.length - max


Measured memory_bytes: 14624
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
  int n, k;
  cin >> n >> k;
  int at  = -1;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    if (a == 1) at = i;
  }
  int l = at;
  int r = n - 1 - at;
  int result = l / (k - 1) + r / (k - 1);
  l %= k - 1;
  r %= k - 1;
  if (l + r > 0) {
    result += l + r + 1 <= k ? 1 : 2;
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
import           Data.List
import           Control.Applicative
import           Control.Monad
import           Control.Monad.State

judge :: [String] -> State [Int] [String]
judge []         = return []
judge ("+" : xs) = do
  (b : a : rest) <- get
  put rest
  judge $ show (a + b) : xs
judge ("-" : xs) = do
  (b : a : rest) <- get
  put rest
  judge $ show (a - b) : xs
judge ("*" : xs) = do
  (b : a : rest) <- get
  put rest
  judge $ show (a * b) : xs
judge ("/" : xs) = do
  (b : a : rest) <- get
  put rest
  judge $ show (div a b) : xs
judge [x     ] = return [x]
judge (x : xs) = do
  modify (read x :)
  judge xs

main = do
  r <- judge . words <$> getLine
  putStrLn $ head $ evalState r []


Measured memory_bytes: 4144
//  __/\\\\____________/\\\\______/\\\\\\\\\______/\\\________/\\\___/\\\\\\\\/\\____/\\\\\\\\\\_|
//   _\/\\\\\\________/\\\\\\____/\\\\\\\\\\\\\___\/\\\________/\\\__\/\\\____\/\\\__\////\\\///__|
//    _\/\\\//\\\____/\\\//\\\___/\\\/////////\\\__\/\\\________/\\\__\/\\\____\/\\\\____\/\\\_____|
//     _\/\\\\///\\\/\\\/_\/\\\__\/\\\_______\/\\\__\/\\\\\\\\\\\\\\\__\/\\\____\/\\\\____\/\\\_____|
//      _\/\\\__\///\\\/___\/\\\__\/\\\\\\\\\\\\\\\__\/\\\/////////\\\__\/\\\____\/\\\\____\/\\\_____|
//       _\/\\\____\///_____\/\\\__\/\\\/////////\\\__\/\\\_______\/\\\__\/\\\____\/\\\_____\/\\\_____|
//        _\/\\\_____________\/\\\__\/\\\_______\/\\\__\/\\\_______\/\\\__\/\\\___/\\\\______\/\\\_____|
//         _\/\\\_____________\/\\\__\/\\\_______\/\\\__\/\\\_______\/\\\__\/\\\\\\/\\_____/\\\\\\\\\\__|
//          _\///______________\///___\///________\///___\///________\///___\/////////_____\//////////___|
#include<bits/stdc++.h>
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef vector< int > vi;
typedef vector< char > vc;
typedef vector< string > vs;
typedef vector< long long > vl;
#define hurry ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define setp setprecision
#define popp pop_back()
#define pb push_back
#define mp make_pair
#define beg begin()
#define end end()
#define sc second
#define sz size()
#define fr first
#define endl '\n'
//=======================================================================================================================
//GLOBAL
ll dp[102][100002];
ll ans;
//=======================================================================================================================
//FUNCTIONS
//=======================================================================================================================
int main()
{
    int n,k;
    cin>>n>>k;
    int w[n];
    ll v[n];
    for(int i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            if(w[i]<=j)
                dp[i][j]=max((dp[i-1][j-w[i]]+v[i]),dp[i-1][j]);
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    for(int i=1;i<=k;i++)
    {
        ans=max(ans,dp[n][i]);
    }
    cout<<ans;
}
//========================================================================================================================


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

namespace ABC
{
    class ProgramC
    {
        struct Info
        {
            public int a;
            public int b;
            public int c;
            public int d;
        }

        static int _depth, _count;
        static Info[] _list;

        // 深さ優先探索
        static int dfs(List<int> g)
        {
            if (g.Count == _depth)
            {
                // Console.WriteLine(string.Join("", g));
                return calc(g);
            }

            var start = g.Count > 0 ? g.Last() : 1;
            var result = 0;
            for (var i = start; i <= _count; i++)
            {
                g.Add(i);
                result = Math.Max(result, dfs(g));
                g.RemoveAt(g.Count - 1);
            }

            return result;
        }

        static int calc(List<int> g)
        {
            var result = 0;
            foreach (var l in _list)
            {
                if (g[l.b] - g[l.a] == l.c)
                {
                    result += l.d;
                }
            }
            return result;
        }

        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var n = int.Parse(inputs[0]);
            var m = int.Parse(inputs[1]);
            var q = int.Parse(inputs[2]);

            _depth = n;
            _count = m;

            _list = new Info[q];
            for (var i = 0; i < q; i++)
            {
                var inputs1 = Console.ReadLine().Split(" ");
                _list[i].a = int.Parse(inputs1[0]) - 1;
                _list[i].b = int.Parse(inputs1[1]) - 1;
                _list[i].c = int.Parse(inputs1[2]);
                _list[i].d = int.Parse(inputs1[3]);
            }

            var result = dfs(new List<int>());
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 28136
n=int(input())
d=list(map(int,input().split()))
d.sort()
t=[0]
for i,x in enumerate(d):
    if x==0:t.append(0)
    elif i%2:t.append(24-x)
    else:t.append(x)
t.sort()
ans=12
for i in range(1,n+1):
    ans=min(ans,t[i]-t[i-1])
print(ans)

Measured memory_bytes: 9116
import numpy as np

W,H,N = [int(i) for i in input().split()]

x = np.ones(N)
y = np.ones(N)
a = np.ones(N)

for i in range(N):
    x[i],y[i],a[i] = [int(i) for i in input().split()]
    


init_s = np.zeros([H+1,W+1])

ind_a_1 = [ind for ind,v in enumerate(a) if v == 1]
ind_a_2 = [ind for ind,v in enumerate(a) if v == 2]
ind_a_3 = [ind for ind,v in enumerate(a) if v == 3]
ind_a_4 = [ind for ind,v in enumerate(a) if v == 4]

if len(ind_a_1)==0:
    x_1 = 0
else:
    x_1=x[int(ind_a_1[0])]
    for i in ind_a_1:
        int_ind = int(i)
        if x_1<x[int_ind]:
            x_1=x[int_ind]
    
if len(ind_a_3)==0:
    y_3 = 0
else:
    y_3=y[int(ind_a_3[0])]
    for i in ind_a_3:
        int_ind = int(i)
        if y_3<y[int_ind]:
            y_3=y[int_ind]  
            
if len(ind_a_2)==0:
    x_2 = W
else:
    x_2=x[int(ind_a_2[0])]
    for i in ind_a_2:
        int_ind = int(i)
        if x_2>x[int_ind]:
            x_2=x[int_ind]
            
if len(ind_a_4)==0:
    y_4 = H
else:
    y_4=y[int(ind_a_4[0])]
    for i in ind_a_4:
        int_ind = int(i)
        if y_4>y[int_ind]:
            y_4=y[int_ind]
            
            
if (x_2-x_1>0) & (y_4-y_3>0):
    ans =int((x_2-x_1)*(y_4-y_3))
else:
    ans = int(0)
print(ans)

Measured memory_bytes: 12544
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>

using namespace std;


#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;

//constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;


/*vectorの要素を全部確認するやつだよ。普通に拡張for文したほうがいいよ。

for (vector<int>::iterator itr = ans.begin(); itr != ans.end(); ++itr) {
	cout << *itr << " ";
}

*/


/*for文でx,yを上下左右確認するやつだよ。正直使いづらいよ。

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


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}

*/


/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}

*/


/*実行開始からの経過時間を表すよ。

while (clock() < 1900000) {  }

*/


/*まだ使えないテクニックのメモだよ。

for (int bit = 0; bit < (1<<n); ++bit)//bit全探索用のfor文だよ

*/


/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; ++i) {
	for (int j = 0; j < w; ++j) {

	}
}

*/


int main() {
	int n; cin >> n;
	int d, x; cin >> d >> x;
	int a;
	int ans = x;
	d--;
	for (int i = 0; i < n; i++) {
		cin >> a;
		ans += d / a;
		ans++;
	}

	cout << ans << endl;


}



Measured memory_bytes: 256
def invr():
    return(map(int, input().split()))


def insr():
    s = input()
    return(list(s[:len(s)]))


strs = []
a, b = invr()

for i in range(a):
    s = input()
    strs.append(s)
print("#"*(b+2))
for s in strs:
    print("#"+s+"#")
print("#"*(b+2))


Measured memory_bytes: 3060
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>

using namespace std;

int main() {
	string w;
	bool check;
	int cnt[26] = { };
	cin >> w;
	for (auto x : w) {
		cnt[x % 26]++;
	}
	for (int i = 0; i < 26; i++) {
		if (cnt[i] % 2) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

int main(){
  int N;
  cin>>N;
  vector<string> W(N);
  for (int i=0;i<N;i++){
    cin>>W.at(i);
  }
  bool flag=false;
  
  for (int i=1; i<N; i++){
    for (int j=0; j<i; j++){
      if (W.at(i)==W.at(j)){
        flag=true;
      }
    }
  }
  
  for (int i=1; i<N; i++){
    if (W.at(i).at(0)!=W.at(i-1).at(size(W.at(i-1))-1)){
      flag=true;
    }
  }
  
  if (flag){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 3636
def main():
    N = int(input())
    p = list(map(int, input().split()))
    ans = 0; cnt = 0
    for i, q in enumerate(p):
        if q == i + 1:
            cnt += 1
            if cnt == 3:
                cnt = 1
                ans += 1
        else:
            if cnt == 0:
                continue
            cnt = 0
            ans += 1
    if cnt in [1, 2]:
        ans += 1
    print(ans)
        
if __name__ == "__main__":
    main()


Measured memory_bytes: 20524
#include<bits/stdc++.h>
using namespace std;
int main()
{

   string s;

   while (cin >> s) {
         int ans = max(s[0]- '1' + ((int)s.size() - 1) * 9, s[0] - '0');
         int i;
         for(i = 1; i < (int)s.size() && s[i] == '9'; i++);
         if( i == (int)s.size()){
            ans = max(s[0] - '0' + ((int)s.size() - 1) * 9, ans);
         }
         cout << ans << endl;

   }

   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P pair<int,int>
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; }

vint X;
int n,k;

int Count(int a){
  int res = 0;
  for(auto p:X){
    if((p & a) == a){
      res++;
    }
  }
  return res;
}

signed main(){
  cin >> n >> k;
  vint A(n);
  rep(i,0,n) cin >> A[i];
  rep(i,0,n){
    int tmp = 0;
    rep(j,i,n){
      tmp += A[j];
      X.push_back(tmp);
    }
  }
  // rep(i,0,X.size()) cout << X[i] << endl;
  int ans = 0;
  for(int i = 40;i >= 0;i--){
    int key = 1LL<<i;
    if(Count(ans|key) >= k){
      ans |= key;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 6516
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<map>
using namespace std;
 
typedef long long ll;
 
 
int main(){
	int a,b;
	cin >> a >> b;
	
	int tmp = 1;
	int res = 0;
	while(tmp < b){
		tmp += a;
		tmp -=1;
		res++;
	}
	
	cout << res <<endl;
	
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>

using namespace std;

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

    vector<pair<int, int>> dt(n, make_pair(0, 0));
    for (int i = 0; i < n; i++) {
        cin >> dt[i].second >> dt[i].first;
    }

    sort(dt.begin(), dt.end(), greater<pair<int, int>>());

    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que_used;
    priority_queue<int, vector<int>, less<int>> que_unused;

    vector<int> cnt_used(n + 1, 0);
    long long base = 0, type = 0;

    for (int i = 0; i < n; i++) {
        if (i < k) {
            que_used.push(dt[i]);
            cnt_used[dt[i].second]++;

            base += dt[i].first;
            if (cnt_used[dt[i].second] == 1) {
                type++;
            }
        } else if (cnt_used[dt[i].second] == 0) {
            que_unused.push(dt[i].first);
            cnt_used[dt[i].second]++;
        }
    }

    long long res = base + type * type;

    while (!que_used.empty() && !que_unused.empty()) {
        pair<int, int> pick_out = que_used.top();
        que_used.pop();

        while (!que_used.empty() && cnt_used[pick_out.second] == 1) {
            pick_out = que_used.top();
            que_used.pop();
        }

        if (cnt_used[pick_out.second] == 1) {
            break;
        }

        cnt_used[pick_out.second]--;

        int pick_in = que_unused.top();
        que_unused.pop();

        base = base - pick_out.first + pick_in;
        type++;

        if (res < base + type * type) {
            res = base + type * type;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 2552
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        double total = 0.0;

        for (int i = 0; i < N; i++) {
            String tmp = sc.next();
            if (sc.next().equals("JPY")) {
                total += Double.parseDouble(tmp);
            } else {
                total += 380000.0 * Double.parseDouble(tmp);
            }
        }

        System.out.println(total);
    }
}


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

int main()
{
 ll n;
  cin>>n;
  ll arr[n];
  for(ll i=0;i<n;i++)
  {
    cin>>arr[i];
  }
  ll num=0;
  for(ll i=1;i<n;i++)
  {
    if(arr[i]<arr[i-1])
    {
     num+=(arr[i-1]-arr[i]);
      arr[i]=arr[i-1];
    }
  }
  cout<<num<<endl;
}

Measured memory_bytes: 5180
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    int n;
    cin>>n;
    int p[n];
    int k[3];
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>p[i];
        if(i>=2){
            k[0]=p[i-2];
            k[1]=p[i-1];
            k[2]=p[i];
            sort(k,k+3);
            if(k[1]==p[i-1])ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3584
N=int(input())
A=list(map(int,input().split()))
money=1000
k=0
row=0
high=0

for i in range(N-1):
  if row==0 and A[i]<A[i+1]:
    row=min(A[k:i+1])
    k=i+1
  if A[i]>A[i+1]:
    high=max(A[k:i+1])
    k=i+1
    if row==0:
      continue
    div,mod=divmod(money,row)
    money=div*high+mod
    row=0
  if i==N-2:
    high=max(A[k:])
    if row==0:
      continue
    div,mod=divmod(money,row)
    money=div*high+mod
print(money)
    
  
  

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

int main(void){
    bool f[4][14];
    fill(f[0], f[4], false);
    string m = "SHCD";
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string c;
        int num;
        cin >> c >> num;
        int j;
        for(j = 0; j < 4; j++) if(c[0] == m[j]) break;
        f[j][num] = true;
    }
    for(int i = 0; i < 4; i++){
        for(int j = 1; j < 14; j++){
            if(!f[i][j]) cout << m[i] << ' ' << j << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3176
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	int pn = 1;
	if (*ci == '-') {
		pn = -pn;
		ci++;
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return pn * tmp;
}

ll A[200001];
void pakuri_sort(int N, ll A[]) {
	const int b = 8;
	ll tmp[200001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N = getint();
	rep1(i, N) {
		A[i] = getint() + A[i - 1];
	}

	pakuri_sort(N + 1, A);

	ll kotae = 0;
	ll mae = 1e18;
	int kazu = 0;
	rep(i, N + 1) {
		if (mae != A[i]) {
			mae = A[i];
			kazu = 0;
		}
		kotae += kazu++;
	}

	printf("%lld\n", kotae);

	Would you please return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	int A[N];
	int max_a = -1;
	rep(i, 0, N) {
		cin >> A[i];
		max_a = max(max_a, A[i]);
	}
	int G = A[0];
	rep(i, 1, N) G = gcd(G, A[i]);
	if(K <= max_a and K % G == 0) cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;


}


Measured memory_bytes: 640
while 1:
    n = int(input())
    if n == 0:
        break
    l = list(map(int,input().split()))
    d = [ l[i+1] - l[i] for i in range(n)]
    if d[0] == d[n-1]:
        for i in range(1,n-1):
            if d[i]!= d[0]:
                print(l[i+1])
                break
    elif d[n-1] == d[n-2] and d[n-2] == d[n-3] and d[1] == d[2]:
        print(l[0])
    elif d[n-1] == d[n-2] and d[n-2] == d[n-3] and d[1] != d[2]:
        print(l[1])
    elif d[0] == d[1] and d[1] == d[2] and d[n-2] == d[n-3]:
        print(l[n])
    else:
        print(l[n-1])


Measured memory_bytes: 5632
#include <stdio.h>

int main(){
    int s;
    int t=0;
    scanf("%d", &s);

    if(s >= 100){
        t++;
        s = s - 100;
    }
    if(s >= 10){
        t++;
        s = s - 10;
    }
    if (s >= 1){
        t++;
    }
    printf("%d", t);
    return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int man = 2e5+10;
#define IOS ios::sync_with_stdio(0)
template <typename T>
inline T read(){T sum=0,fl=1;int ch=getchar();
for(;!isdigit(ch);ch=getchar())if(ch=='-')fl=-1;
for(;isdigit(ch);ch=getchar())sum=sum*10+ch-'0';
return sum*fl;}
template <typename T>
inline void write(T x) {static int sta[35];int top=0;
do{sta[top++]= x % 10, x /= 10;}while(x);
while (top) putchar(sta[--top] + 48);}
template<typename T>T gcd(T a, T b) {return b==0?a:gcd(b, a%b);}
template<typename T>T exgcd(T a,T b,T &g,T &x,T &y){if(!b){g = a,x = 1,y = 0;}
else {exgcd(b,a%b,g,y,x);y -= x*(a/b);}}
#ifndef ONLINE_JUDGE
#define debug(fmt, ...) {printf("debug ");printf(fmt,##__VA_ARGS__);puts("");}
#else
#define debug(fmt, ...)
#endif
typedef long long ll;
const ll mod = 1e9+7;
map<string,int>sp;
string s[man];

int main() {
    #ifndef ONLINE_JUDGE
        //freopen("in.txt", "r", stdin);
        //freopen("out.txt","w",stdout);
    #endif
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >>s[i];
        sp[s[i]]++;
    }   
    int max = -1;
    for(auto &it:sp){
        if(it.second > max)max = it.second;
    }
    for(auto &it:sp){
        if(it.second==max){
            cout << it.first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 26752
// atcoder/abc179/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  str s;
  while (cin >> s) {
    if (s.back() == 's') cout << s << "es" << endl;
    else cout << s << "s" << endl;
  }

  return 0;
}


Measured memory_bytes: 3660
//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
	string s;cin>>s;
	for(int i = 0; s.size()/2 > i; i++){
		if(s[i]!=s[s.size()-i-1]){
			cout << "No" << endl;
			return 0;
		}
	}
	for(int i = 0; s.size()/4 > i; i++){
		if(s[i]!=s[s.size()/2-i-1]){
			cout << "No" << endl;
			return 0;
		}
	}
	for(int i = s.size()/2+1,j=0; s.size() > i; i++,j++){
		if(s[i]!=s[s.size()-j-1]){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main(){
    int N,M,X;

    cin >> N >> M >> X;

    int l = 0;
    int r = 0;

    for(int i = 0; i < M; i++){
        int a;
        cin >> a;
        if(a < X){
            l++;
        }
        if(a > X){
            r++;
        }
    }

    cout << min(l,r) << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())

S = input()

re = [0] * N # 右からの累積和
le = [0] * N # からの累積和
INF = float("inf")
for i in range(1,N):
    
    if S[i-1] == "E":
        le[i] = le[i-1] + 1
    else:
        le[i] = le[i-1]

    if S[N-i] == "E":
        re[N-1-i] = re[N-i] + 1
    else:
        re[N-1-i] = re[N-i]

ans = [INF] * N

for i in range(N):
    ans[i] = (i - le[i]) + (re[i])

print(min(ans))

Measured memory_bytes: 55132
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define all(c) (c).begin(), (c).end()
#define endl '\n'
// auto start = high_resolution_clock::now(); 
// auto stop = high_resolution_clock::now(); 
// auto duration = duration_cast<microseconds>(stop - start); 
 
// cout << duration.count() << endl; 


int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
//      int t;
//      cin >> t; 
//      while(t--){
     	
// }


     string s;
     cin >> s;
     fo(i,0,s.length()){
     	if(s[i] == '7'){
     		cout << "Yes" << endl;
     		return 0;
     	}
     }
     cout << "No" << endl;
     


return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  double w;
  while(cin>>w){
    if(w>91.00)cout<<"heavy"<<endl;
    else if(w>81.00&&w<=91.00)cout<<"light heavy"<<endl;
    else if(w>75.00&&w<=81.00)cout<<"middle"<<endl;
    else if(w>69.00&&w<=75.00)cout<<"light middle"<<endl;
    else if(w>64.00&&w<=69.00)cout<<"welter"<<endl;
    else if(w>60.00&&w<=64.00)cout<<"light welter"<<endl;
    else if(w>57.00&&w<=60.00)cout<<"light"<<endl;
    else if(w>54.00&&w<=57.00)cout<<"feather"<<endl;
    else if(w>51.00&&w<=54.00)cout<<"bantam"<<endl;
    else if(w>48.00&&w<=51.00)cout<<"fly"<<endl;
    else cout<<"light fly"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3168
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line1 = sc.nextLine();
		String line2 = sc.nextLine();
		int n = Integer.parseInt(line1);
		String[] x = line2.split(" ");
		int[] a = new int[x.length];

		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(x[i]);
		}

		Arrays.sort(a);

		long sum = 0;
		for (int i = 0; i < n; i++) {
			sum += a[i];
		}

		System.out.println(a[0] + " " + a[n - 1] + " " + sum);

	}

}

Measured memory_bytes: 31756
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
long long int comp(const void *a, const void *b){
    return *(long long *)b - *(long long *)a;
}

int main() {
  int n;
  scanf("%d", &n);
  long long a[n];
  for(int i=0;i<n;i++) {
    scanf("%lld", &a[i]);
  }
  long long ans=0;
  qsort(a, n, sizeof(long long), comp);
  int cnt=0;
  for(int i=1;i<n;i++){
    ans+=a[i/2];
  }

  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 5044
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

void redir() {
	#ifndef ONLINE_JUDGE
	freopen("../input.txt", "r", stdin);
	freopen("../output.txt", "w", stdout);
	#endif
}

int main()
{
	// redir();

	int N, M;
	cin >> N >> M;

	vector<int> votes(N);
	for (int &v : votes) {
		cin >> v;
	}

	sort(votes.begin(), votes.end(), greater<int>());

	double thresold = 1.0 / (4 * M);

	int S = accumulate(votes.begin(), votes.end(), 0);
	int count = 0;
	for (int v : votes) {
		double t = (double) v / S;
		if (t >= thresold) {
			count++;
		}

		if (count >= M) {
			break;
		}
	}

	cout << ((count >= M) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<map>
using namespace std;
const int MAXX=3000;
const int MAXN=100010;
map<long long ,int >num;
map<long long ,bool >vis;
int prime[MAXN],v[MAXN];
int n,tot,ans;
long long a[MAXN],b[MAXN];
inline void init(){
    for(int i=2;i<=MAXX;++i){
    	if(!v[i]){
    		prime[++tot]=i;
    		v[i]=i;
    	}
    	for(int j=1;j<=tot;++j){
    		if(i*prime[j]>MAXX||v[i]<prime[j])break;
    		v[i*prime[j]]=prime[j];
    	}
    }
}
inline void solve(long long x,int pos){
	long long u=1;
	long long v=1;
    for(int i=1;i<=tot;++i){
    	if(x%prime[i]==0){
        long long cnt=0;
        while(x%prime[i]==0){
           x/=prime[i];
           cnt++;
         }
          cnt%=3;
          if(cnt==1){
          	u*=prime[i];
          	v*=prime[i]*prime[i];
          }
          if(cnt==2){
          	u*=prime[i]*prime[i];
          	v*=prime[i];
          }
       }
       if(x==1)break;
    }
    if(x>1){
    	long long t=(long long)sqrt(x);
    	u*=x;
    	if((t*t)==x)v*=t;
    	else v*=x*x;
    }
    //cout<<u<<" "<<v<<endl;
    a[pos]=u;
    b[pos]=v;
    num[u]++;
}
int main(){
    init();
    //for(int i=1;i<=10;++i)cout<<prime[i]<<" ";
    scanf("%d",&n);
    for(int i=1;i<=n;++i)cin>>a[i];
    for(int i=1;i<=n;++i)solve(a[i],i);
    for(int i=1;i<=n;++i){
    	if(!vis[a[i]]){
    		vis[a[i]]=1;
    		vis[b[i]]=1;
    		if(a[i]==b[i])ans++;
    		else ans+=max(num[a[i]],num[b[i]]);
    	}
    }
    cout<<ans<<endl;	
    return 0;
}
/*
9
14
81
1
3
61
61
77
11
41
*/

Measured memory_bytes: 26880