akhauriyash/Code-Regression huggingface dataset:
/*    特徴    */

/*    教訓    */

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld  = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

#define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

// -------- template end - //


// - library ------------- //



// --------- library end - //




int main(){

  ll N = il();
  vector<ll> As;
  rep(i, N){
    As.p_b(il());
  }

  // まずは0が含まれる場合を検出
  rep(i, N){
    if (As[i] == 0){
      cout << 0 << endl;
      return 0;
    }
  }

  // 含まれない
  ll ans = 1;
  rep(i, N){
    ll tmp = ans;
    if (As[i] >1000000000000000000 / ans ){
      // こえた
      cout << -1 << endl;
      return 0;
    }
    else{
      ans *= As[i];
    }
  }

  cout << ans << endl;



}


Measured memory_bytes: 4288
d = {}
for i in range(3):
    Ai = list(input().split())
    # print(Ai)
    for j,a in enumerate(Ai):
        d[a] = 3*i+j
N = int(input())
A = [False]*9
for n in range(N):
    b = input()
    if b in d.keys():
        A[d[b]] = True

def check_bingo(li):
    bingo_list = [(0,3,6),(1,4,7),(2,5,8),(0,1,2),(3,4,5),(6,7,8),(0,4,8),(2,4,6)]
    for l in bingo_list:
        if li[l[0]] and li[l[1]] and li[l[2]]:
            return 'Yes'

    return 'No'

print(check_bingo(A))

Measured memory_bytes: 3064
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.15f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto x = RD;

	if (x > 1 && x < 2*N-1)
	{
		writeln("Yes");
		
		auto ans = new long[](2*N-1);
		auto M   = 2*N-1; 
		auto mid = M / 2;
		if (N == 2)
		{
			ans = [1, 2, 3];
		}
		else
		{
			foreach (i; mid..M)
			{
				ans[i] = (x+i-mid-1)%M+1;
			}
			foreach (i; 0..mid)
			{
				ans[i] = (x+mid+i)%M+1;
			}
		}

		foreach (e; ans)
			writeln(e);
	}
	else
		writeln("No");

	stdout.flush();
	debug readln();
}

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

constexpr int64_t MOD = 1e9 + 7;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int64_t> a(n+1);
    iota(begin(a), end(a), 0);
    partial_sum(begin(a), end(a), begin(a));
    int64_t ans = 0;
    for(int i = k; i < n + 1; i++){
        ans += ((a[n] - a[n-i]) - a[i-1] + 1) % MOD;
        ans %= MOD;
    }
    cout << (ans + 1) % MOD << endl;
    return 0;
}

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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define LL long long
#define ULL unsigned long long

// n개중에서 k 를 고르는 Combination table을 미리 세팅한다.
// C[n][k] -> nCk
ULL Comb[51][51];
void combination_table(int n)
{
    for(int i = 0; i <= n; ++i)
        for(int j = 0; j <= i; ++j)
        {
            if(j == 0 || j == i)
                Comb[i][j] = 1ll;
            else
                Comb[i][j] = Comb[i - 1][j - 1] + Comb[i - 1][j];
        }
}

int cache[51][51];
LL bino2(int n, int r)
{
    if(r == 0 || n == r) return 1;

    int& ret = cache[n][r];
    if(ret != -1)
        return ret;
    return ret = (bino2(n - 1, r - 1) + bino2(n - 1, r));
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
    int N, A, B;
    cin >> N >> A >> B;

    VL items(N, 0);
    REP(i, 0, N) cin >> items[i];

    combination_table(N);
    sort(items.begin(), items.end(), greater<LL>());

    double max_avg = (double)accumulate(items.begin(), items.begin() + A, 0ll) / A;
    
    int num = 0, pos = 0;
    REP(i, 0, N){
        if(items[i] == items[A - 1])
        {
            ++num;
            if(i < A)
                ++pos;   
        }
    }

    LL cnt = 0ll;
    if(pos == A)
    {
        for(int i = A; i <= B; ++i)
            cnt += Comb[num][i];
    }
    else
        cnt += Comb[num][pos];

    cout.precision(10);
    cout << fixed << max_avg << endl << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(long long &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
long long N;
long long S;
int main(){
  long long b, k, t;
  rd(N);
  rd(S);
  for(b=(2);b<(400000);b++){
    k = N;
    t = 0;
    while(k){
      t += k % b;
      k /= b;
    }
    if(t==S){
      wt_L(b);
      wt_L('\n');
      return 0;
    }
  }
  for(k=400000;k;k--){
    t = S - k;
    if(t < 0 || N < t || (N-t) % k){
      continue;
    }
    b = (N - t) / k;
    if(k >= b || t >= b){
      continue;
    }
    wt_L(b);
    wt_L('\n');
    return 0;
  }
  if(N==S){
    wt_L(N+1);
    wt_L('\n');
    return 0;
  }
  wt_L(-1);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190902-1

// --- original code ---
// ll N, S;
// {
//   ll b, t, k;
// 
//   rd(N,S);
//   rep(b,2,4d5){
//     k = N;
//     t = 0;
//     while(k) t += k % b, k /= b;
//     if(t==S) wt(b), return 0;
//   }
// 
//   for(k=4d5;k;k--){
//     t = S - k;
//     if(t < 0 || N < t || (N-t) % k) continue;
//     b = (N - t) / k;
//     if(k >= b || t >= b) continue;
//     wt(b), return 0;
//   }
// 
//   if(N==S) wt(N+1), return 0;
// 
//   wt(-1);
// }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007;
struct edge {int from,to,cost;};

signed main() {
int n,a,b,c,d;
cin>>n>>a>>b>>c>>d;
for(int i=0;i<=n-1;i++){
    if((max(a+i*c,b+(n-1-i)*c)<=min(a+i*d,b+(n-1-i)*d))){
        cout<<"YES";
       // cerr<<i;
        return 0;
    }
}
cout<<"NO";
return 0;


}


Measured memory_bytes: 256
def max(a,b); a > b ? a : b end

n = gets.to_s.to_i
x,y,h =  Array.new(n){ gets.to_s.split.map{|t| t.to_i } }.sort_by{|_,_,h| h }.transpose

0.upto(100) do |c_x|
  0.upto(100) do |c_y|
    
    ok = true
    top = h[-1] + (x[-1]-c_x).abs + (y[-1]-c_y).abs
    n.times do |i|
      
      t = max(top - (x[i]-c_x).abs - (y[i]-c_y).abs, 0)
      
      if h[i] != t
        ok = false
        break
      end
    end
    
    if ok
      puts "#{c_x} #{c_y} #{top}"
      exit
    end
  end
end

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

int main(){
  int n;
  while(cin>>n,n){
  int a[5];
  int max=0;
  int min=10000000;
  for(int i=0;i<n;i++){
    int sum=0;
    for(int j=0;j<5;j++){
      cin>>a[j];
      sum+=a[j];
    }
    if(sum<min)min=sum;
    if(sum>max)max=sum;
  }
  cout<<max<<" "<<min<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

using namespace std;
#define int long long


class AProgrammingEducation {
public:
    void solve(std::istream &in, std::ostream &out) {
      int n;
      in >> n;
      int a, b;
      if (n == 2) {
        in >> a >> b;
        out << a + b << endl;
      } else {
        out << "Hello World" << endl;
      }
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  AProgrammingEducation solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main()
{
	int N;
	int *s;
	
	cin >> N;
	s = new int[N];

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

	int tmp;
	int sum = 0;
	for (int i = 0; i < N; i++){
		sum += s[i];
	}

	int answer = sum;

	if (answer % 10 != 0){
		cout << answer;
	}
	else{
		answer = 0;
		for (int i = 0; i < N; i++){
			tmp = sum - s[i];
			if (tmp  % 10 != 0){
				if (tmp > answer){
					answer = tmp;
				}
			}
		}
		cout << answer;

	}

	delete[] s;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;

int main(){
  int n; cin >> n;
  vector<string> w(n);
  rep(i,n) cin >> w[i];
  map<string,int> mp;
  mp[w[0]]++;
  bool flg = true;
  for(int i = 1; i < n; i++){
    mp[w[i]]++;
    if(mp[w[i]] == 2){
      flg = false;
    }
    if(w[i-1][w[i-1].size()-1] != w[i][0]){
      flg = false;
    }
  }
  if(flg) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

int N, M;
vector<vector<int>> edges(100010);

vector<int> memo(100010, -1);

int dp(int v){
    if(memo[v] >= 0) return memo[v];
    
    int res = 0;
    for(int to : edges[v]){
        res = max(res, dp(to)+1);
    }
    memo[v] = res;
    return res;
}

int main(){
    cin >> N >> M;
    rep(i,M){
        int x, y; cin >> x >> y; x--; y--;
        edges[x].push_back(y);
    }

    rep(i,N){
        if(edges[i].empty()) memo[i] = 0;
    }

    int ans = 0;
    rep(i, N) ans = max(ans, dp(i));

    cout << ans << endl;
}

Measured memory_bytes: 8192
#include <iostream>
#include <string>
#include <unordered_map>
#include <algorithm>

using namespace std;

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

	long long result = 0;
	unordered_map<string, int> m;
	for(auto i = 0; i < n; ++i) {
		string input;
		cin >> input;

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

		if(m[input] != 0) {
			result += m[input];	
		}

		m[input] = m[input] + 1;
	}

	cout << result;
}


Measured memory_bytes: 10660
#include <iostream>
 
using namespace std;
 
const uint64_t MOD = (1000000007);

uint64_t mod_pow(uint64_t x, uint64_t n, uint64_t mod) {
    uint64_t res = 1;
    while (n > 0) {
        if (n & 1) {
            res *= x;
            res %= mod;
        }
        x *= x;
        x %= mod;
        n >>= 1;
    }
    return res;
}

uint64_t comb(uint64_t a, uint64_t b, uint64_t p) {
    if (b > a - b) {
        return comb(a, a - b, p);
    }
    uint64_t c = 1, d= 1;
    for (uint64_t i = 0; i < b; i++) {
        c *= a - i;
        d *= b - i;
        c %= p;
        d %= p;
    }
    return c * mod_pow(d, p - 2, p) % p;
}

int main()
{
    uint64_t n, a, b;
    cin >> n >> a >> b;

    uint64_t s,t,u;

    s = comb(n, a, MOD);
    t = comb(n, b, MOD);
    uint64_t tmp = (s + t) % MOD;

    u = mod_pow(2, n, MOD);


    cout << (u + MOD - 1 - tmp) % MOD << endl;
}


Measured memory_bytes: 384
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
int main(){
    int t;
    scanf("%d",&t);
    for(int ix=0;ix<t;ix++){
        int n,k;
        scanf("%d%d",&n,&k);
        vector<int> ds;
        int bef,now,ret=0;
        scanf("%d",&bef);
        for(int i=1;i<n;i++){
            scanf("%d",&now);
            ds.push_back(now-bef);
            ret+=now-bef;
            bef=now;
        }
        sort(begin(ds),end(ds),greater<int>());
        for(int i=0;i<min(k-1,n-1);i++){
            ret-=ds[i];
        }
        printf("%d\n",ret);
    }
}

Measured memory_bytes: 1688
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define x_ real()
#define y_ imag()
#define cross(a, b) (conj(a)*(b)).imag()
#define dot(a, b) (conj(a)*(b)).real()
#define PI acos(-1)
#define F first
#define S second
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL)
#define fileIO freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<ld> point;
typedef tuple<int, int, int> line;
typedef vector<point> polygon;
typedef pair<double, double> pd;
//pair<int, int> dirs[] = { {1, 2}, {-1, 2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}, {1, -2}, {-1, -2} };
const ll mod = 1e9 + 7;
const ll N = 3e5 + 7;

ll ncr[2007][2007];
void pre() {
	for (int i = 0; i <= 2000; i++) {
		for (int j = 0; j <= i; j++) {
			if (j == 0 || i == 0) {
				ncr[i][j] = 1;
			}
			else {
				ncr[i][j] = (ncr[i - 1][j] + ncr[i - 1][j - 1]) % mod;
			}
		}
	}
}


int main() {
	fastIO;
	pre();
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= k; i++) {
		ll ans = (ncr[n - k + 1][i] * ncr[k - 1][i - 1]) % mod;
		cout << ans << '\n';
	}


}


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

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    map<char, string> mp {
        {'a', a},
        {'b', b},
        {'c', c}
    };
    char turn = 'a';
    char p;
    while (true) {
        if (mp[turn].empty()) {
            cout << (char)(turn - 32) << endl;
            break;
        }
        p = mp[turn][0];
        mp[turn] = mp[turn].substr(1);
        turn = p;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    double x, l = 1e10, r = -1;
    while(cin >> x){
        l = min(x, l); r = max(x, r);
    }
    printf("%.10lf\n", r-l);
    return 0;
}


Measured memory_bytes: 3140
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In,' '));
        }

        public void Solve(ConsoleInput cin)
        {
            int N = cin.ReadInt;
            string S = cin.ReadLine;
            
            int red = S.Replace("B","").Length;            

            if(red > N-red) WriteLine("Yes");
            else WriteLine("No");

        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream,char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0;i < tmp.Length;i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }

}


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

using namespace std;
inline void read(long long &x) {
    char ch;
    bool flag = false;
    for (ch = getchar(); !isdigit(ch); ch = getchar())if (ch == '-') flag = true;
    for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
    x = flag ? -x : x;
}
inline void write(long long x) {
    static const long long maxlen = 100;
    static char s[maxlen];
    if (x < 0) {   putchar('-'); x = -x;}
    if (!x) { putchar('0'); return; }
    long long len = 0; for (; x; x /= 10) s[len++] = x % 10 + '0';
    for (long long i = len - 1; i >= 0; --i) putchar(s[i]);
}

inline void read(int &x){
    char ch;
    bool flag = false;
    for (ch = getchar(); !isdigit(ch); ch = getchar())if (ch == '-') flag = true;
    for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
    x = flag ? -x : x;
}

const int MAXN =101000;

int n;
int a[ MAXN ];
bool f[ MAXN ];

const int P=1e9+7;

int main(){
    int m;
    read(n);read(m);
    if ( n<m )
        swap(n,m);
    if ( n>m+1 )
        {
            puts("0");
            return 0;
        }
    long long ans=1;
    for (int i=1;i<=n;i++)
        ans=ans*i%P;
    for (int i=1;i<=m;i++)
        ans=ans*i%P;
    if ( n==m )
        ans=ans*2ll%P;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import itertools

N = int(input())
L = list(map(int,(input().split())))
L.sort()
Combi = itertools.combinations(L, 3)
count = 0

for i, j, k in Combi:

    if((i+j)> k and i!=j!=k and  i<j <k ):
        count+=1
print(count)

Measured memory_bytes: 9128
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
//#include <unordered_set>
//#include <unordered_map>
//#include <bits/stdc++.h>

#define MP(A,B) make_pair(A,B)
#define PB(A) push_back(A)
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define fi first
#define se second

using namespace std;

template<typename T>inline bool upmin(T &x,T y) { return y<x?x=y,1:0; }
template<typename T>inline bool upmax(T &x,T y) { return x<y?x=y,1:0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod eps=1e-11;
const lod pi=acos(-1);
const int oo=1<<30;
const ll loo=1ll<<62;
const int mods=1e9+7;
const int MAXN=600005;
const int INF=0x3f3f3f3f;//1061109567
/*--------------------------------------------------------------------*/
inline int read()
{
	int f=1,x=0; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c>='0'&&c<='9') { x=(x<<3)+(x<<1)+(c^48); c=getchar(); }
	return x*f;
}
char st[MAXN]; 
int s[MAXN],f[MAXN],pre[MAXN][3],fst[MAXN];
int upd(int x,int y) { return x+y>=mods?x+y-mods:x+y; }
int main()
{
	scanf("%s",st+1); 
	int n=strlen(st+1);
	for (int i=1;i<=n;i++) s[i]=(s[i-1]+st[i]-'a'+1)%3;
	pre[0][0]=pre[0][1]=pre[0][2]=-1;
	for (int i=1;i<=n;i++) 
	{
		pre[i][0]=pre[i-1][0];
		pre[i][1]=pre[i-1][1];
		pre[i][2]=pre[i-1][2];
		pre[i][s[i-1]]=i-1;
	}
	for (int i=1;i<=n;i++) 
	{
		fst[i]=fst[i-1];
		if (st[i]==st[i-1]) fst[i]=i;
	}
	f[0]=1;
	for (int i=1;i<=n;i++) 
	{
		f[i]=f[i-1];
		int lst=fst[i]-1,num=(st[i]=='a')?2:1;
		if (~lst) 
		{
			lst=pre[lst][(s[i]-num+3)%3];
			if (~lst) f[i]=upd(f[i],f[lst]);
		}
		if (!s[i]&&i!=n) f[i]=upd(f[i],1);
	}
	if (!fst[n]) 
		for (int i=1;i<n;i++) 
			if (!s[i]) f[n]=upd(f[n],mods-1);
	printf("%d\n",f[n]);
}

Measured memory_bytes: 8960
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = [list(map(int, input().split())) for _ in range(M)]

ans = min(a) + min(b)
for x, y, c in xyc:
    ans = min(ans, a[x-1] + b[y-1] - c)
print(ans)

Measured memory_bytes: 80492
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

int main() {
    fast_io
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    ll dist = abs(b-a);

    ll x = v*t - w * t;
    if( x - dist >= 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3652
n, m = map(int, input().split())
s = []
for i in range(m):
  s.append(list(map(int, input().split())))
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
  flg = True
  for j in range(m):
    on_cnt = 0
    for k in range(1, s[j][0]+1):
      if (i >> s[j][k] - 1)&1:
        on_cnt += 1
    if on_cnt % 2 != p[j]:
      flg = False
      break
  if flg:
    ans += 1
print(ans)
  

Measured memory_bytes: 40176
#include<iostream>

using namespace std;

int main() {
	
	int a, b;
	
	while( cin >> a >> b) {
		
		int count = 0;
		
	int sum = a + b;
	
	while( sum != 0) {
		
		sum /= 10;
		count ++;
		
	}
		cout << count << "\n";
}
	return 0;
}



Measured memory_bytes: 2992
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

double x(string s) {
  double a=1,ans=0;
  rrep(i,2) {
    if(isdigit(s[i])) ans+=(int)(s[i]-'0')*a;
    else ans+=((int)(s[i]-'a')+10)*a;
    a*=16;
  }
  return ans;
}

int main() {
  double d[8][3]={{0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255},{255,255,0},{255,255,255}};
  string c[8]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};
  string s;
  while(cin >> s && s!="0") {
    int ans=0;
    double min=MAX;
    double z[3];
    s=s.substr(1);
    rep(i,3) z[i]=x(s.substr(i*2,2));
    rep(i,8) {
      double v=sqrt((z[0]-d[i][0])*(z[0]-d[i][0])+(z[1]-d[i][1])*(z[1]-d[i][1])+(z[2]-d[i][2])*(z[2]-d[i][2]));
      if(v<min) {
	ans=i;
	min=v;
      }
    }
    pr(c[ans]);
  }
  return 0;
}


Measured memory_bytes: 1188
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        n: usize,
        a: [f32;n],
    }

    // let mut mul = 1;
    // for &i in &a{
    //     mul *= i;
    //     println!("{}", i);
    // }

    // let mut div = 0;
    // for &i in &a{
    //     div += mul/i;
    //     println!("{}", i);
    // } 
    
    // let ans: f128 = (mul as f128) / (div as f128);
    // println!("{:.12}",ans);

    let mut ret: f32 = 0.0;
    for i in a{
        ret += 1.0/i;
    }   

    println!("{:.12}", 1.0/ret);

}

Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int w, h, x, y;
    cin >> w >> h >> x >> y;

    bool other = false;
    if ((float)w/2.0 == x && (float)h/2.0 == y) other = true;

    cout << fixed << setprecision(12) << (double)w*h/2.0 << " " <<(int)other << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll minn=1000000000005;
int main()
{
	ll n;
	cin>>n;
	ll x=minn;
	for(ll i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			x=min(x,i+n/i-2);
		}
	}
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005
  
typedef struct kouzou{
  char name[100];
  int t;
}K;
  
K Q[LEN];
int head,tail,n;
  
void enqueue(K x){
  Q[tail] = x;
  tail += 1;
  tail = tail % LEN;
}
  
K dequeue(){
  K x = Q[head];
  head += 1;
  head = head % LEN;
  return x;
}
  
int main(void){
  int min(int,int);
  int m = 0,a,i,q;
  K u;
  scanf("%d%d",&n,&q);
  for ( i = 1 ; i <= n ; i++ ){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head = 1;
  tail = n + 1;
  while ( head != tail ){
    u = dequeue();
    a = min(q,u.t);
    u.t -= a;
    m += a;
    if ( u.t > 0 ){
      enqueue(u);
    }
    else{
      printf("%s %d\n",u.name,m);
    }
  }
  return 0;
}
  
int min(int b, int c ){
  return b < c ? b:c;
}

Measured memory_bytes: 10756
INF = float('inf')

def warshall_floyd(G):
    # ワーシャルフロイド法で移動距離を求める
    # G[x][y]: xからyへ直接移動するときの距離。直接移動できない場合はINF
    # 
    cost = [g[:] for g in G]
    N = len(G)
    # cost[i][j]: 頂点v_iから頂点v_jへ到達するための辺コストの和
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if cost[i][k] != INF and cost[k][j] != INF:
                    cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j])
    return cost

def main():
    N, M, L = map(int, input().split())

    # G[x][y]: xからyへ直接移動するときのコスト。移動できない場合はINF
    G = [[INF] * (N+1) for n in range(N+1)]

    for i in range(M):
        a, b, c = map(int, input().split())
        G[a][b] = c
        G[b][a] = c

    Q = int(input())
    Queries = []
    for i in range(Q):
        s, t = map(int, input().split())
        Queries.append((s, t))

    # ワーシャルフロイド法で、全点間の距離を求める
    cost = warshall_floyd(G)

    # 全点間の距離のうち、移動距離がL以内でおさまる頂点同士は、給油せずにすむ
    # そこで、全点間の距離のうち、移動距離がL以内でおさまる頂点同士を距離1で結んだグラフを作成し、
    # そのグラフに対してワーシャルフロイド法で最短距離を計算することで、
    # refuel[x][y] =「xからyへ移動するときの給油回数+1」というグラフを作成できる
    no_refuel = [[1 if x <= L else INF for x in c] for c in cost]

    refuel_count = warshall_floyd(no_refuel)

    ans = []
    for s, t in Queries:
        d = refuel_count[s][t]
        ans.append(d-1 if d != INF else -1)
    
    print(*ans, sep='\n')

if __name__ == '__main__':
    main()

Measured memory_bytes: 95652
#include <iostream>
#include <stdio.h>
#include <sstream>
using namespace std;



int main(){
	//string a;

	for(;;){
		//if(a == "NULL") break;
		//		b= "000000000000";
		char cmap[2];
		int map[13][13]={0},flag[12][12]={0};
		int adjoin[100][100] = {0};
		//string linemap;


		//if(!fscanf(stdin,"%1d",&map[0][0])) break;
		//cout << map[0][0] <<endl;
		//if(!fscanf(stdin,"%1d",&map[0][0])) break;
		/*if(!fscanf(stdin,"%1d",&map[0][0])) break;
		cout << map[0][0] << endl;
		for(int j=1;j<12;j++){
		fscanf(stdin,"%1d",&map[0][j]);
		}*/
		for(int i=0;i<12;i++){
			//map[0][i] = a[i];
			for(int j=0;j<12;j++){
				//if(i ==0 && j == 0) continue;
				if(fscanf(stdin,"%1d",&map[i][j]) != EOF){
				//if(fgets(cmap,1,stdin)){
					//cout << i*13+j << " ";
					//sscanf(cmap,"%d",&map[i][j]);
				}
				else{
					//cout << "owatta" << endl;
					goto loop1;
				}
				//	fgets(&map[i][j],1,stdin)
			}
		}
		/*	if(map[0][0] == 'NULL'){
		cout << "break" << endl;
		break;
		}*/
		//cout << map[0][0] << endl;
		//if(map[0][0]==2) break;
		//		cout << map[0][2] << map[3][4] << endl;
		//		cout << endl;

		int count = 0;
		//Æè ¦¸¶Æãª éÈçêv³¹é
		for(int i=0;i<12;i++){
			for(int j=0;j<12;j++){
				if(map[i][j] == 1){
					if(j>0 && map[i][j-1]==1){
						flag[i][j] = flag[i][j-1];
					}
					else if(i>0 && map[i-1][j]==1){
						flag[i][j] = flag[i-1][j];
					}
					else{
						flag[i][j] = ++count;
						//	count++;
					}
				}
			}
		}

		//ÔÌ×ÚÖWðmF
		for(int i=0;i<11;i++){
			for(int j=0;j<12;j++){
				//cout << map[i][j];
				//				if(map[i][j] == 1){
				if(map[i][j]*map[i+1][j] != 0 && flag[i][j]!=flag[i+1][j]){
					//					adjoin[flag[i][j]][flag[i+1][j]] = 1;
					if(adjoin[flag[i][j]][flag[i+1][j]] == 0){
						//cout << count << " " << i <<" " << j << endl;
						--count;
						adjoin[flag[i][j]][flag[i+1][j]] = 1;
					}
				}
				//}
			}
		}

		/*for(int i=0;i<12;i++){
			for(int j=0;j<12;j++){
				cout << map[i][j] << " " ;
			}
			cout << endl;
		}*/
		//cout << endl;
		//if(!count) break;
		cout << count << endl;

	}
	loop1:;
}

Measured memory_bytes: 0
#include<stdio.h>

int main (void)
{
    int i,j,k;
    for(i=1;i<10;i++)
    {
        for(j=1;j<10;j++)
        {
            k=i*j;
            printf("%dx%d=%d\n",i,j,k);
        }
    }
    return 0;
}


Measured memory_bytes: 1964
#include <stdio.h>
int main(void) {
  int i,n,p[20],r=0;
  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%d",&p[i]);
  }
  for(i=1;i<n-1;i++) {
    r += (p[i] < p[i+1] && p[i] > p[i-1]) || (p[i] > p[i+1] && p[i] < p[i-1]);
  }
  printf("%d\n",r);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int A;
  int X;
  cin >> N >>A;
 
  X = N/500;
  N = N- 500*X;

  if (N > A) {
    cout << "No" << endl;
  }
  if(N <= A) {
    cout << "Yes" << endl;
  }    
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let w:f64 = read();
    let h:f64 = read();
    let x:f64 = read();
    let y:f64 = read();
    let ans = w * h / 2.0;
    println!("{}", ans);

    if x*2.0 == w && y * 2.0 == h {
        println!("1");
    } else {
        println!("0");
    }
}

Measured memory_bytes: 2184
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <cstdint>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(ll i=(x);i<(y);i++)
#define disp(a) cout << a << endl;
typedef long long ll;
using namespace std;

bool comp(const int& a, const int& b) {
	return a > b;
}

int main()
{
	int N;
	string s = "No";
	vector<pair<int,int>> vec;
	fore(i,0,9){
		int t;
		cin >> t;
		vec.push_back(make_pair(t,0));
	}
	cin >> N;
	fore(i, 0, N) {
		int t;
		cin >> t;
		fore(j,0,vec.size()) {
			if (t == vec[j].first) {
				vec[j].second = 1;
			}
		}
	}
	if (vec[0].second == 1 && vec[1].second == 1 && vec[2].second == 1)s = "Yes";
	if (vec[3].second == 1 && vec[4].second == 1 && vec[5].second == 1)s = "Yes";
	if (vec[6].second == 1 && vec[7].second == 1 && vec[8].second == 1)s = "Yes";
	if (vec[0].second == 1 && vec[3].second == 1 && vec[6].second == 1)s = "Yes";
	if (vec[1].second == 1 && vec[4].second == 1 && vec[7].second == 1)s = "Yes";
	if (vec[2].second == 1 && vec[5].second == 1 && vec[8].second == 1)s = "Yes";
	if (vec[0].second == 1 && vec[4].second == 1 && vec[8].second == 1)s = "Yes";
	if (vec[2].second == 1 && vec[4].second == 1 && vec[6].second == 1)s = "Yes";
	cout << s << endl;
}

Measured memory_bytes: 256
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
 */
import java.util.*;
import java.awt.*;
import java.awt.geom.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        String s=sc.next();
        for (int i = 0; i < s.length(); i++) {
            for (int j = i; j < s.length(); j++) {
                String t=s.substring(0,i);
                String u=s.substring(i,j);
                String v=s.substring(j,s.length());
                if((t+v).equals("keyence")){
                    out.println("YES");
                    exit(0);
                }
            }
        }
        out.println("NO");
    }
}

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

int main(){
    ll mod=1e9+7;
    int n;cin>>n;
    vector <ll> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    ll presum=0;
    for(int i=0;i<n;i++){
        presum=(presum%mod+v[i]%mod)%mod;
    }
    ll sum=0;
    for(int i=0;i<n;i++){
        presum=(presum%mod-v[i]%mod+mod)%mod;
        sum=(sum%mod+(v[i]*(presum%mod))%mod)%mod;
    }
        
    cout<<sum<<endl;
}

Measured memory_bytes: 4728
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>

//#include<boost/circular_buffer.hpp>
using namespace std;

//cout << fixed << setprecision(10);
typedef long long ll;
#define PI 3.141592653589793
#define Yes(a) a ? "Yes" : "No";
#define YES(a) a ? "YES" : "NO";
#define rep(i,n) for(int i=0;i<n;i++)

int gcd(int a, int b) {
	if (a < b) {
		int tmp = a;
		a = b;
		b = tmp;
	}
	int r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

int lcm(int a, int b) {
	long long int L;
	L = (a * b) / gcd(a, b);
	return L;
}

vector<long long  int> Prime;
void Eratosthenes(long long int n) {
	vector<bool> is_prime(n, true);
	for (int i = 2; i * i <= n; i++) {
		;
		if (is_prime.at(i)) {
			for (int j = i * i; j <= n; j += i) {
				is_prime.at(j) = false;
			}
		}
		Prime.emplace_back(i);
	}
}

/*
map<int, int> prime;
void Prime_number(long long int n) {
	for (int i = 2; i <= n; i++) {
		int count = 0;
		while (n % i == 0) {
			count++;
			n /= i;
		}
		if (count != 0) {
			prime.insert(make_pair(i, count));
		}
	}
}
*/
//std::cout.fill('0');

int keta(long long int N) {
	int k = 0;
	while (N > 0) {
		N /= 10;
		k++;
	}
	return k;
}

int main() {
	int n;
	cin >> n;
	double ans = n / 1.08;
	int s = floor(ans);
	if (floor(s * 1.08) == n)
		cout << s << endl;
	else if (floor((s + 1) * 1.08) == n)
		cout << s + 1 << endl;
	else
		cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lint long long
//#define P pair<int, int>

lint MOD = 1e9 + 7;


int main()
{
    int N, X;
    cin >> N >> X;
    
    vector<int> L(N);
    for(int i = 0; i < N; ++i){
        cin >> L[i];
    }
    
    int pos = 0, count = 1;
    
    for(int i = 0; i < N; ++i){
        pos += L[i];
        if(pos > X) {
            cout << i + 1 << endl; return 0;
        }
    }
    cout << N + 1 << endl;
}

Measured memory_bytes: 256
import collections

def main():
    n = int(input())
    l = [input() for i in range(n)]
    c = collections.Counter(l)
    max_values = max(c.values())
    max_words = [k for k, v in c.items() if v == max_values]
    max_words.sort()
    ans = "\n".join(max_words)
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 114640
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String r = sc.next();
		String b = sc.nextLine();
		int rn = sc.nextInt();
		int bn = sc.nextInt();
		sc.nextLine();
		String u = sc.nextLine();

		if(r.equals(u)){
			System.out.println(rn-1+" "+bn);
		}else{
			bn--;
			System.out.println(rn+" "+bn);
		}
		}
}

Measured memory_bytes: 23764
if __name__ == "__main__":
    import sys
    N = int(sys.stdin.readline().strip())
    A = [int(e) for e in sys.stdin.readline().strip().split()]
    cnt = 0
    for i in range(N-1):
        for j in range(N-1, i, -1):
            if A[j] < A[j-1]:
                A[j-1], A[j] = A[j], A[j-1]
                cnt += 1
    print " ".join(map(str, A))
    print cnt

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

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n>0)
    {
        if(n & 1 ==1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n=n>>1;
    }
    return result;
}



int32_t main()
{
    IOS

    ll n,w;
    cin>>n>>w;

    ll v[n],wt[n];
    ll tot=0;
    for(ll i=0;i<n;i++)
    {
    	cin>>wt[i]>>v[i];
    	tot+=v[i];
    }
    
    vector<ll> min(tot,-1);
    tot=0;
    ll ans=0;
    min[0]=0;
    for(ll i=0;i<n;i++)
    {
    	tot+=v[i];
    	for(ll j=tot;j>=v[i];j--)
    	{
    		if(min[j-v[i]]!=-1)
    		{
    			ll req=min[j-v[i]]+wt[i];
    			if(req<=w)
    				ans=max(ans,j);
    			if(min[j]==-1||min[j]>req)
    				min[j]=req;
    		}
    	}
    }

    cout<<ans<<endl;

    return 0;
}

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

     signed main(){
      
      int n,q;
      cin>>n>>q;
      string s;
      cin>>s;
      char t[q],d[q];
      for(int i=0;i<q;i++)cin>>t[i]>>d[i];
      int ng=-1,ok=n,mid;
      while(abs(ok-ng)>1){
           mid=(ok+ng)/2;
           for(int i=0;i<q&&mid!=-1&&mid!=n;i++){
                if(t[i]==s[mid]){
                     if(d[i]=='L')mid--;
                     else mid++;
                }
           }
           if(mid==n)ok=(ok+ng)/2;
           else ng=(ok+ng)/2;
      }
      int ans=ok;
      ng=-1;ok=n;
      while(abs(ok-ng)>1){
           mid=(ok+ng)/2;
           for(int i=0;i<q&&mid!=-1&&mid!=n;i++){
                if(t[i]==s[mid]){
                     if(d[i]=='L')mid--;
                     else mid++;
                }
           }
           if(mid==-1)ng=(ok+ng)/2;
           else ok=(ok+ng)/2;
      }
      cout<<ans-ok<<endl;


      }

        


Measured memory_bytes: 900
#include<stdio.h>
int main(void)
{
	int a[10], aa, i, j;

	for(i = 0;i < 10;i++){
		scanf("%d", &a[i]);

	}

	for(j = 0;j < 3;j++){
		for(i = 0;i < (9 - j);i++){
			if(a[i] > a[i + 1]){
				aa = a[i];
				a[i] = a[i + 1];
				a[i + 1] = aa;
			}
		}
	} 	

	printf("%d\n", a[9]);
	printf("%d\n", a[8]);
	printf("%d\n", a[7]);

	return 0;

}

Measured memory_bytes: 0
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <cstring>

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))

#define INF (int)1e9+7

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

using namespace std;

int cnt[100010];
int r[100010];
int l[100010];

int main(){
    int q, n;
    string s;

    cin >> n >> q;
    cin >> s;

    rep(i, q){
        int li, ri;
        cin >> li >> ri;
        l[i] = li - 1;
        r[i] = ri - 1;
    }

    int a = 0;
    cnt[0] = 0;
    for(int i = 1; i < s.size(); i++){
        if(s[i-1] == 'A' && s[i] == 'C'){
            a++;
        }
        cnt[i] = a;
    }
    for(int i = 0; i < q; i++){
        cout << cnt[r[i]] - cnt[l[i]] << endl;
    }
    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define inf 100000000000000000
#define ll long long 
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define test ll t ; cin>>t; while(t--)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
int main(){
	//mahakal(),fast;
	ll n , m ;
	cin>> n >> m ;
	ll arr[n];
	ll sum=0;
	ll cnt=0;
	for(ll i=0;i<n ;i++)cin>>arr[i],sum+=arr[i];
	for(ll i=0;i< n ;i++){
		if(arr[i]*4*m>=sum){
			cnt++;
		}
	}	
	if(cnt>=m){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*N
dp[1]=abs(h[1]-h[0])
for i in range(2,N):
    dp[i]=abs(h[i]-h[i-1])+dp[i-1]
    for j in range(i-2,max(0,i-K)-1,-1):
        dp2=abs(h[i]-h[j])+dp[j]
        if dp[i]>dp2:
            dp[i]=dp2
print(dp[N-1])


Measured memory_bytes: 52576
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset> 
using namespace std;
typedef long long ll;
int main(void)
{
	ll n;
	scanf("%lld",&n);
	ll a[4]={0};
	char s[10];
	char mub[4][4]={"AC","WA","TLE","RE"};
	while(n--)
	{
		scanf(" %s",s);
		for(ll i=0;i<4;i++)
		{
			if(strcmp(s,mub[i])==0) a[i]++;
		}
	}
	printf("AC x %lld\n",a[0]);
	printf("WA x %lld\n",a[1]);
	printf("TLE x %lld\n",a[2]);
	printf("RE x %lld",a[3]);
}

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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	
	int n;
	cin>>n;
	cout << (n+1)/2 << '\n';
}


Measured memory_bytes: 256