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

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

int n,a[305];
ll tot,mn=LLONG_MAX;

int main(){
  cin >> n;
  for(int i=0;i<n;++i){
    cin >> a[i];
  }
  for(int i=0;i<=100;++i){
    tot=0;
    for(int j=0;j<n;++j){
        tot+=(a[j]-i)*(a[j]-i);
    }
    mn=min(mn,tot);
  }
  cout << mn;
  return 0;
}


Measured memory_bytes: 256
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}          // Least Commont Multiple オーバーフローしないように先に割る

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

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("a.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

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

    if (a >= 13) cout << b;
    else if (a >= 6) cout << b/2;
    else cout << 0;

    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int,int> P;
using ll = long long;
int main(){
    int n;
    cin>>n;
    vector<int> a(n+1),b(n+1),c(n+1);
    vector<vector<int>> dat(3,vector<int>(n+1));
    rep(i,n) cin>>a[i]>>b[i]>>c[i];
    dat[0][0]=a[0];
    dat[1][0]=b[0];
    dat[2][0]=c[0];
    for(int i=1;i<=n;i++){
        dat[0][i]+=max(dat[1][i-1],dat[2][i-1])+a[i];
        dat[1][i]+=max(dat[0][i-1],dat[2][i-1])+b[i];
        dat[2][i]+=max(dat[0][i-1],dat[1][i-1])+c[i];
    }
    cout<<max(dat[0][n],max(dat[1][n],dat[2][n]));
}

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

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

ll const mod = 1e9+7;

int main() {
  int N;
  cin >> N;
  vector<ll> A(N),B(N),C(N);
  rep(i,N) cin >> A[i];
  rep(i,N) cin >> B[i];
  rep(i,N) cin >> C[i];
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  sort(C.begin(),C.end());

  vector<ll> cntB(N,0);
  rep(i,N) {
    cntB[i] += C.begin() + N - upper_bound(C.begin(),C.end(),B[i]);
  }
  for (int i=N-2;i>=0;i--) {
    cntB[i] += cntB[i+1];
  }
  ll cnt=0;
  rep(i,N) {
    if (upper_bound(B.begin(),B.end(),A[i])!=B.end())
    cnt += cntB[upper_bound(B.begin(),B.end(),A[i]) - B.begin()];
    // cout << cnt << endl;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3328
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("Failed 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 n:u32 = read();
    let mut ps: Vec<u32> = (0..n).map(|_| read()).collect();
    ps.sort_by(|x, y| x.cmp(y).reverse());
    let mut ans = 0;
    for (i, &x) in ps.iter().enumerate(){
        if i == 0{
            ans += x / 2;
        }
        else{
            ans += x;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
//using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define per(i,j,n) for(int i=(int)(j);(int)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb push_back
#define mp make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::pair;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=pair<ll,ll>;
const ll MOD=1e9+7;
const int MAX=1e5;
const ll INF=(1ll<<62)-1;
signed main(){
    std::set<string> S;
    int N; cin>>N;
    rep(i,0,N){
        string str; cin>>str;
        S.insert(str);
    }
    cout<<S.size()<<endl;
}

Measured memory_bytes: 19260
N = int(input())
A = list(map(int, input().split()))

M, Mi = 0, 0
for i, a in enumerate(A):
    if abs(a) > abs(M):
        M = a
        Mi = i

ans = []
if M > 0:
    for i in range(N):
        ans.append((Mi, i))
        A[i] += A[Mi]

    for i in range(N - 1):
        if A[i] > A[i + 1]:
            ans.append((i, i + 1))
            A[i + 1] += A[i]

else:
    for i in range(N):
        ans.append((Mi, i))
        A[i] += A[Mi]
    
    for i in range(N - 1, 0, -1):
        if A[i - 1] > A[i]:
            ans.append((i, i - 1))
            A[i - 1] += A[i]

print(len(ans))
for x, y in ans:
    print(x + 1, y + 1)


Measured memory_bytes: 3064
#include <stdio.h>
#include <ctype.h>
  
int main(void){
    char ch;
    int alfa[27] = {};
    int i;
    i=0;
    while(scanf("%c", &ch) != EOF){
        if(isupper(ch)){
            ch = tolower(ch);
        }
        i = ch - 'a';
        alfa[i] += 1;
    }
    for(i=0;i<26;i++){
        printf("%c : %d\n",i+'a',alfa[i]);
    }
    return(0);
}
    


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

int main() {
  int N,X;
  cin>>N>>X;
  int L[N];
  for (int i = 0; i < N;i++) cin>>L[i];

  int Xc = 0;
  int i = 0;
  for (i = 0; i < N;i++) {
    Xc += L[i];
    if (Xc>X) break;
  }
  cout<<i+1<<endl;

  // int val = 0;
  // cout<<val<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans = 1;
  int cur = a[0];
  for (int i = 1; i < n; i++) {
    if (a[i] <= cur) {
      ans++;
    }
    cur = min(cur, a[i]);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 1024
n = int(input())
A = list(input().split())

BS = A[::]
SS = A[::]

#BS
for i in range(0, n):
  for j in range(n-1, i, -1):
    if int(BS[j][1]) < int(BS[j-1][1]):
      BS[j], BS[j-1] = BS[j-1], BS[j]
print(*BS, sep=" ")
print("Stable")

#SS
for i in range(0, n):
  minj = i
  for j in range(i, n):
    if int(SS[j][1]) < int(SS[minj][1]):
      minj = j
  SS[i], SS[minj] = SS[minj], SS[i]
print(*SS, sep=" ")
if SS == BS:
  print("Stable")
else:
  print("Not stable")


Measured memory_bytes: 5612
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.ABC_115
{
    class D
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            long[] nx = ReadLongs();
            long n = nx[0];
            long x = nx[1];
            var pCnt = new long[n+1][];// all, p  L= 0 ~ n
            pCnt[0] = new long[2] { 1, 1 };
            for(int i = 1; i <= n; i++)
            {
                pCnt[i] = new long[2] {
                    pCnt[i-1][0] * 2 + 3, pCnt[i - 1][1] * 2 + 1 };
            }
            long cnt = 0;
            long nn = n;
            long now = x - 1;
            while (nn > 0)
            {
                if (now == 0)
                {
                    Console.WriteLine(cnt);
                    return;
                }
                else if (now < pCnt[nn][0] / 2)
                {
                    now--;
                    nn--;
                }
                else if(now==pCnt[nn][0]/2)
                {
                    Console.WriteLine(cnt + pCnt[nn - 1][1] + 1);
                    return;
                }
                else if (now < pCnt[nn][0]-1)
                {
                    now -= pCnt[nn - 1][0] + 2;
                    cnt += pCnt[nn - 1][1] + 1;
                    nn--;
                }
                else if (now == pCnt[nn][0]-1)
                {
                    Console.WriteLine(cnt + pCnt[nn][1]);
                    return;
                }

            }
            Console.WriteLine(cnt + 1);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MOD=1e9+7;
static const ll MAX=101010;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k, l;
  
  ll D[2];
  cin >> D[0] >> D[1];
  
  vector<P> v;
  for(i=0; i<D[0]; i++) {
    ll p;
    cin >> p;
    v.push_back(P(p, 0));
  }
  
  for(i=0; i<D[1]; i++) {
    ll q;
    cin >> q;
    v.push_back(P(q, 1));
  }
  
  sort(v.begin(), v.end());
  
  ll ans=0;
  ll pos[2]={};
  for(i=0; i<D[0]+D[1]; i++) {
    ll c=v[i].first;
    ll r=v[i].second;
    
    ans+=(D[1-r]+1-pos[1-r])*c;
    pos[r]++;
  }
  
  pt(ans);
}




Measured memory_bytes: 6512
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
 
using namespace std;
 
int main(){
  cout.sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> v(N);
  for(auto& i : v)cin >> i;
 
  int result = 1;
  int min = v.at(0);
  for(int i = 1; i < N ; ++i){
    if(v.at(i) <= min){
      min = v.at(i);
      ++result;
    }
  }
 
  cout << result << endl;
 
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;

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

    vector<int> d(N);
    REP(i, N)   cin >> d[i];

    set<int> height;

    REP(i, N)   height.insert(d[i]);

    cout << height.size() << endl;
}

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

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int N=cin.nextInt();
        int M = cin.nextInt();
        string ans="Yes";
        if(N!=M)ans="No";
        Console.WriteLine(ans);
        
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 11092
#include <cstdio>
#include <cctype>

int main(){
	char ch;
	
	while(1){
		scanf("%c", &ch);
		
		if(islower(ch)) printf("%c", toupper(ch));
		else if(isupper(ch)) printf("%c", tolower(ch));
		else printf("%c", ch);
		
		if(ch=='\n') break;
	}

	return 0;
}



Measured memory_bytes: 2620
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

int main() {
  lli N ,K;
  cin >> N >> K;
  vector<lli> height(N);
  rep(i, N) cin >> height[i];
  sort(ALL(height));
  lli ans=height[K-1]-height[0];
  rep(i, N-K+1){
  ans=min(height[K+i-1]-height[i],ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<int>> cnt(n+1, vector<int>(n+1, 0));
    rep(i, m){
        int l, r;
        cin >> l >> r;
        cnt[l][r]++;
    }
    rep(i, n)rep(j, n){
        cnt[i+1][j+1] += cnt[i][j+1] + cnt[i+1][j] - cnt[i][j];
    }
    rep(i, q){
        int p, q;
        cin >> p >> q;
        int ans = cnt[q][q] - cnt[q][p-1] - cnt[p-1][q] + cnt[p-1][p-1];
        cout << ans << endl;
    }
    
}

Measured memory_bytes: 1920
n = int(input())

lst = list(map(int, input().split()))

result = 0
for i in range(1, n-1):
    #print(lst[i -1], lst[i], lst[i + 1], " " ,end="")
    j = (lst[i - 1] < lst[i] and lst[i] < lst[i + 1]) or (lst[i - 1] > lst[i] and lst[i] > lst[i + 1]) 
    #print(j)
    if j:
        result += 1


print(result)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int a[1<<18],x,m;
main()
{
	for(cin>>x;cin>>x;)a[x]++;
	for(int i=1;i<1<<17;i++)m=m<(x=a[i-1]+a[i]+a[i+1])?x:m;
	cout<<m<<endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
template <class _T> static _T tp_pow(int base, int exp)
{
	_T ans = 1;

	for (int i = 0; i < exp; i++) {
		ans *= base;
	}
	return ans;
}

static void C_task();

int main()
{
	C_task();
	fflush(stdout);
	return 0;
}

static void C_task()
{
	int N;
	get1int(N);
	
	int bfrMax = 0;
	int bfr = 0;
	int now = 0;
	const char* ans = "Yes\n";
	for (int i = 0; i < N; i++) {
		get1int(now);
		if (bfr > now) {
			bfr--;
		}
		else {
			now = tp_max(now - 1, bfr);
		}
		bfrMax = tp_max(bfrMax, now);

		if ((bfr > now) || (bfrMax > now)){
			ans = "No\n";
			break;
		}
		bfr = now;
	}
	printf(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;

template <typename T> void max_self(T& a, T b){
  a = max(a,b);
}

template <typename T> void min_self(T& a, T b){
  a = min(a,b);
}

void solve(){	
  int d,t,s;
  cin>>d>>t>>s;
  if(t*s < d)
    cout<<"No\n";
  else
    cout<<"Yes\n";
}

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


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

using namespace std;

#define int long long
#define ff first
#define ss second
#define pii pair<int, int>
#define pb emplace_back
#define pf emplace_front
#define mp make_pair
#define ld long double

const int MAXN = 100009;
vector<int> g[MAXN];
int c[MAXN];
bool used[MAXN];
int n, m, q, t;
pii ed[MAXN];

int dfs(int v, int col)
{
    int sz = 1;
    used[v] = true;
    c[v] = col;
    for (int to : g[v])
    {
        if (!used[to])
            sz += dfs(to, col);
    }
    return sz;
}

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m >> q;
    for (int i = 0; i < q; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        if (c == 0)
        {
            g[a].pb(b);
            g[b].pb(a);
        }
        else
        {
            ed[t].ff = a;
            ed[t].ss = b;
            t++;
        }
    }
    int col = 0;
    for (int i = 0; i < n; i++)
    {
        if (!used[i])
        {
            m -= dfs(i, col) - 1;
            col++;
        }
    }
    for (int i = 0; i < t; i++)
    {
        int a = ed[i].ff;
        int b = ed[i].ss;
        if (c[a] == c[b])
        {
            cout << "No";
            return 0;
        }
    }
    if ((m >= col || ((col == 1 && m >= 0)) || (t == 0 && m >= col - 1)) && m <= col * (col - 1) / 2)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 8320
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

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

  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (p[i] == i + 1) {
      if (i < n - 1) {
	swap(p[i], p[i + 1]);
      }
      count++;
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 640
n = int(input())
x = []
for i in range(n):
    x.append(list(map(int, input().split())))

from math import sqrt
from itertools import permutations

length = []
r = list(permutations(range(n)))

for i in r:
    for j in range(n-1):
        x1 = x[i[j]][0]
        y1 = x[i[j]][1]
        x2 = x[i[j+1]][0]
        y2 = x[i[j+1]][1]
        length.append(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)))

print(sum(length)/len(r))

Measured memory_bytes: 60908
n, m = map(int, input().split())
li1 = []
li2 = []
for i in range(n):
	li1.append(input())
for j in range(m):
	li2.append(input())
k = 0	
for i in range(n - m + 1):
	for j in range(n - m + 1):
		x = i
		for k in range(m):
			if li1[x].find(li2[k], j) != j:
				break
			if k == m-1:
				print("Yes")
				exit()
			x += 1
print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int h, w;
vector<vector<int>> hor(2000, vector<int>(2000, -1));
vector<vector<int>> ver(2000, vector<int>(2000, -1));
vector<string> s(2000);
int dfs_hor(int x, int y, int sum = 0) {
	sum++;
	if (x >= w || s[y][x] == '#') return 0;
	else {
		return hor[y][x] = max(sum, dfs_hor(x + 1, y, sum));
	}
}

int dfs_ver(int x, int y, int sum = 0) {
	sum++;
	if (y >= h || s[y][x] == '#') return 0;
	else {
		return ver[y][x] = max(sum, dfs_ver(x, y + 1, sum));
	}
}

int main() {
	cin >> h >> w;
	rep(i, h) cin >> s[i];

	rep(y, h)rep(x, w) {
		if (s[y][x] == '#' || hor[y][x] > -1) continue;
		else {
			dfs_hor(x, y);
		}
	}
	rep(x, w)rep(y, h) {
		if (s[y][x] == '#' || ver[y][x] > -1) continue;
		else {
			dfs_ver(x, y);
		}
	}

	int ans = -2;
	rep(x, w)rep(y, h) {
		ans = max(ans, hor[y][x] + ver[y][x] - 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 37760
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn binary_search(k: usize, D: &Vec<usize>) -> usize {
    let mut lb: usize = 0;
    let mut ub: usize = D.len()-1;
    if k>D[ub] || k<D[lb] {
        return D.len();
    }
    while ub-lb>1 {
        let mut mid = (ub+lb)/2;
        if D[mid]==k {
            return mid;
        } else if D[mid]<k {
            lb = mid;
        } else {
            ub = mid;
        }
    }
    return D.len();
}

use std::collections::HashMap;
#[allow(non_snake_case, unused_variables)]
fn main() {
    input!{
        N: usize,
        D: [usize; N],
        M: usize,
        T: [usize; M],
    }
    let mut map = HashMap::new();
    for d in D {
        if map.contains_key(&d) {
            *map.get_mut(&d).unwrap() += 1;
        } else {
            map.insert(d, 1);
        }
    }
    let mut ans = "YES";
    for t in T {
        if !map.contains_key(&t) || *map.get(&t).unwrap()==0 {
            ans = "NO";
        } else {
            *map.get_mut(&t).unwrap() -= 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 23316
#include <cstring>
#include <iostream>

using namespace std;
int n;
string s;
int r,g,b;
unsigned long long ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>n>>s;
    for(int i=0;i<n;i++){
        if(s[i]=='R') r++;
        if(s[i]=='G') g++;
        if(s[i]=='B') b++;
    }
    ans=r*g;
    ans*=b;
    if(!ans){cout<<0;return 0;}
    for(int a=0;a<n-2;a++)
        for(int b=a;b<n-1;b++){
            int c=b+(b-a);
            if(c>=n) continue;
            if(s[a]!=s[b]&&s[a]!=s[c]&&s[b]!=s[c]) ans--;
        }
    cout<<ans;
    return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n,cnt=0,ans=0,a,b,c,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("snuke"),alphh("ABCDEFGHIJK"),s;

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


  cin >> n >> a >> b;
  if(a>b){
      Cout(0);
  }
  else{
      if(n==1){
          if(a==b){
              Cout(1);
          }
          else{
              Cout(0);
          }
      }
          else{
               Cout((b-a)*(n-2)+1);
          }
      }
  
return 0;
}


Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
using namespace std;
const int N=1e5+5;
int st[N],a[N],id[N],tt,n,m,top;
inline void Ot(){printf("%d\n",top);fp(i,1,top)printf("%d%c",st[i]," \n"[i==top]);}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%d",&n,&m);
	fp(i,1,m){
		scanf("%d",&a[i]);
		if(a[i]&1)id[++tt]=i;
	}
	if(tt>2)return puts("Impossible"),0;
	if(tt>0)swap(a[1],a[id[1]]);if(tt>1)swap(a[m],a[id[2]]);
	fp(i,1,m)printf("%d%c",a[i]," \n"[i==m]);
	if(m==1){
		st[++top]=1;
		if(a[1]-1)st[++top]=a[1]-1;
	}else{
		--a[1],++a[m];
		fp(i,1,m)if(a[i])st[++top]=a[i];
	}
	return Ot(),0;
}

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


#define ALL(a) 		(a.begin() , a.end())
#define ll 			long long int
#define ff          first
#define ss          second
#define pb          push_back
#define ar 			array
#define mp 			make_pair
#define f(i,a,b)   	for(ll i =a;i<=b;i++)
#define inf 		INT_MAX
#define pll 		pair<ll,ll>
#define mat 		vector<vector<ll>>


#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 //debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }


 

const ll INF = 1e18;
void init(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE 
		freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#endif
}
 
bool checkp2(ll n){
	return n && !(n & (n-1));
}

ll numsetbit(ll n){
	ll count = 0;
	for(;n;count++){
		n = n & (n-1);
	}
	return count;
}
 
ll powe(ll x , ll n , ll mod){
    x = x % mod;
	ll po = 1;
	while(n){
		if(n & 1){
			po = (po*x) % mod;
		}
		n = n>>1;
		x = ((x % mod) * (x % mod)) % mod;
	}
	return po;
}

ll powm(ll x , ll n){
	ll po = 1;
	while(n){
		if(n & 1){
			po = (po*x);
		}
		n = n>>1;
		x = (x*x);
	}
	return po;
} 



bool isPrime(ll x){
	if(x < 2)
		return 0;
	for(ll y = 2; y * y <= x; y++){
		if(x % y == 0){
			return 0;
		}
	}
	return true;
}

void solve(){

		ll a,b,c,d;
		cin>>a>>b>>c>>d;
		cout<<max({a*c , a*d , b*c , b*d})<<endl;

}

int main(){
	
	//init();
	ll t = 1;
	//cin>>t;
	for(ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
		solve();
	}
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main() {
	string str;
	cin >> str;
	int count[3] = { 0 };
	for (auto c : str) {
		count[c - 'a']++;
	}
	if (count[0] == 1 && count[1] == 1 && count[2] == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
a, b = map(float, input().split())
a = int(a)
b = str(b)
s = int(b[0])*100
s += int(b[2])*10
try:
    s += int(b[3])*1
except:
    pass

ans = a*s
ans = str(ans)
check = len(ans)

if check < 3:
    print(0)
else:
    print(ans[0:-2])

Measured memory_bytes: 9160
n = int(input())
x = list(input())
c1 = x.count("1")+1
c2 = c1-2

now1 = 0
now2 = 0

for i in range(n):
    if x[-1-i] == "1":
        now1 += pow(2,i,c1)
        if c2 != 0:
            now2 += pow(2,i,c2)
        
    now1 %= c1
    if c2 != 0:
        now2 %= c2

for i in range(n):
    if x[i] == "1":
        #print(n-1-i)
        if c2 == 0:
            print(0)
            continue
        now = (now2-pow(2,n-1-i,c2))%c2
        #print(i,now,c2)
        count = 1
        while now > 0:
            q = bin(now)
            y = q.count("1")
            now %= y
            count += 1
        print(count)
    else:
        #print(n-1-i)
        now = (now1+pow(2,n-1-i,c1))%c1
        #print(i,now,c1)
        count = 1
        while now > 0:
            q = bin(now)
            y = q.count("1")
            now %= y
            count += 1
        print(count)


Measured memory_bytes: 89560
using System;

class main
{
    static void Main(String[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int b = 100000;
        for (int i = 0; i < n; i++)
        {
            b = (int)((double)b * 1.05);
            b += 999;
            b = ((int)(b / 1000)*1000);
        }
        Console.WriteLine(b);
        Console.ReadKey();
    }
}

Measured memory_bytes: 5560
def alds13b
    n,q = gets.chomp.split(/\s/).map{|x| x.to_i}

    nt = []
    for i in 1..n
        na, ti = gets.chomp.split(/\s/)#.map{|x| x.to_i})
        nt.push([na, ti.to_i])
    end

    to = 0
    until nt == nil
        j = nt.delete_at(0)
        t = j[1] - q
        if t <= 0
            to += j[1]
            print "#{j[0]} #{to}\n"
            nt = nil if nt.length == 0
        else
            to += q
            j[1] -= q
            nt.push(j)
        end
    end
end

alds13b


Measured memory_bytes: 14180
#include <iostream>
//#include <string>
#include <algorithm>
//#include <functional>
//#include <array>
#include <math.h>
using namespace std;
typedef long long ll;

int main() {
	int n;
	char a[110];
	bool flag = true;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		if (a[i] == 'Y') {
			flag = false;
		}
	}
	if (flag) {
		cout << "Three"  << endl;
	}
	else {
		cout << "Four"  << endl;
	}
	
	return 0;

}


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

int main() {
vector<int> vec(3);
for (int i = 0; i < 3; i++) {
  cin >> vec.at(i);
}
  
  sort(vec.begin(), vec.end()); 
  
  cout << vec.at(0) << " " << vec.at(1) << " " << vec.at(2) << endl;

  return 0;
}



Measured memory_bytes: 3160
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    int solve(int n, int a, int b) {
        const int MOD = 1e9 + 7;
        auto norm = [&](long long a) {
            a %= MOD;
            if (a < 0) {
                a += MOD;
            }
            if (a >= MOD) {
                a -= MOD;
            }
            return a;
        };

        auto power = [&](long long x, long long e) {
            long long res = 1;
            while (e > 0) {
                if (e & 1) {
                    res = (res * x) % MOD;
                }
                e >>= 1;
                x = (x * x) % MOD;
            } 
            return res;
        };
        auto inverse = [&](long long a) {
            long long b = MOD;
            long long u = 0, v = 1;
            a = norm(a);
            while (a != 0) {    
                long long d = b / a;
                b -= d * a;
                u -= d * v;
                swap(a, b);
                swap(u, v);
            }

            u = norm(u);
            return u;
        };

        const int N = 201000; 
        vector<long long> invs(N + 1, 1);
        for (int i = 2; i <= N; ++i) {
            invs[i] = (MOD - MOD / i) * 1LL * invs[MOD % i] % MOD;
            assert(invs[i] == inverse(i));
            assert(i * invs[i] % MOD == 1);
        }

        auto nCr = [&](int n, int r) {
            long long res = 1;
            for (int i = 0; i < r; ++i) {
                res = res * 1LL * (n - i) % MOD;
                res = res * invs[i + 1] % MOD;
                // res = res * inverse(i + 1) % MOD;
                assert((i + 1) * invs[i + 1] % MOD == 1);
            }
            // cout << n << " " << r << " : " << res << endl;
            return res;
        };
        long long res = (power(2, n) - 1 + MOD) % MOD;
        res -= nCr(n, a);
        res -= nCr(n, b);
        res = norm(res);
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, a, b;
    cin >> n >> a >> b;
    Solution sol;

    cout << sol.solve(n, a, b) << "\n";


    return 0;
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int seat[100005];
int main(void) {
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);

    int n;
    cin >> n;

    ll ans = 0;
    for(int i=0; i<n; i++){
        int l, r;
        cin >> l >> r;

        ans += (r - l) + 1;

    }

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
template<typename T> T gcd(T a,T b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int n;
ll A[200000];

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n) cin >> A[i];
  ll x = 0, ans = 0;
  int r = 0;
  FOR(i, 0, n){
    while((r < n) && ((x & A[r]) == 0)){
      x ^= A[r];
      r++;
    }
    ans += r - i;
    x ^= A[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

//typedef tuple<int, int, int> T;
// get<K>(tuple型の変数)

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}


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

    int n; cin >> n;
    vector<int> L(n);
    rep(i, n) cin >> L[i];
    sort(L.begin(), L.end());
    
    vector<int> v;
    rep(i, n) repr(j, i+1, n) v.push_back(L[i]+L[j]);
    sort(v.begin(), v.end());

    ll ans = 0;
    rep(i, n){
        int c = L[i];
        auto itr = upper_bound(v.begin(), v.end(), c);
        ll cnt = v.end()-itr;
        ans += cnt - (n-i)*i - (n-i)*(n-i-1)/2;
    }

    cout << ans << endl;

    return 0;
} 

Measured memory_bytes: 10348
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[N];
    ll num = 0;
    REP(i, 0, N) {
        cin >> A[i];
        if (A[i] < 0) {
            num++;
        }
    }
    if (num & 1) {
        ll tmp = inf;
        ll mark = -1;
        REP(i, 0, N) {
            if (abs(A[i]) < tmp) {
                tmp = abs(A[i]);
                mark = i;
            }
        }
        ll ans = 0;
        REP(i, 0, N) {
            if (i == mark) {
                ans -= tmp;
            } else {
                ans += abs(A[i]);
            }
        }
        cout << ans << endl;
    } else {
        ll ans = 0;
        REP(i, 0, N) {
            ans += abs(A[i]);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1LL << 60;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> H(N);
  for(int i=0; i<N; i++){
    cin >> H[i];
  }
  sort(H.begin(),H.end(),greater<int>());
  for(int i=0; i<min(K,N); i++){
    H[i] = 0;
  }
  ll sum = 0;
  for(int i=0; i<N; i++){
    sum += H[i];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    int x;
    cin>>x;

    int ans = 1;
    for (int i = 2; i * i <= x; ++i) {
        int temp = i;
        int cnt = 0;
        while (temp <= x) {
            temp *= i;
            cnt++;
        }
        temp /= i;
        if (cnt && ans < temp) ans = temp;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input.trim());
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var N = input[0];
  var A = input[1];
  var B = input[2];
  var output = 0;
  for(var i = 1; i <= N; i++){
    var tmp = i.toString().split("");
    var digitSum = 0;
    for(var j = 0; j < tmp.length; j++){
      digitSum += parseInt(tmp[j]);
    }
    if(digitSum >= A && digitSum <= B){
       output += i;
       }
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 8368
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;
ll f, t, need;

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

  cin >> n;
  rep(i, n) cin >> a[i];
  rep(i, n) {
    if (a[i] % 4 == 0)
      f++, need++;
    else if (a[i] % 2 == 0)
      t++;
    else
      need++;
  }
  if (t != 0) need += 1;
  if (f >= need / 2)
    Cout("Yes");
  else
    Cout("No");
  return 0;
}

Measured memory_bytes: 1024