akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define ll long long int

int main(){
    string s;
    cin>>s;
    ll sum_of_dig=0;
    for(int i=0;i<s.length();i++){
        sum_of_dig+=(s[i]-'0');
    }
    if(sum_of_dig%9==0){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
using namespace std;
int main(void){
	int n;
	cin>>n;
	ll ans=0;
	FORN(i,1,n+1){
		if(i%3!=0&&i%5!=0)ans+=i;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#define ll long long
using namespace std;
ll t=10000000000000000;
int main(){
	int n;
	cin>>n;
	ll a[n],sum=0,sum1=0,sum2=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	ll ans=0;
	for(int i=0;i<n-1;i++){
		sum1=sum1+a[i];
		ans=sum-sum1*2;
		ans=abs(ans);
		if(t>ans){
			t=ans;
		}
	}
	cout<<t<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
long long n,k,m=1;
int main()
{
	
	cin>>n>>k;
	while(n)
	{
		n--;
		if(k<m)
		{
			m+=k;
		}
		else
		{
			m*=2;
		}
	}
	cout<<m<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <list>
#include <cmath>
using namespace std;
#define rep(i,m,n) for (int i = (int) (m); i < (int) (n); i++)
#define rep1(i,m,n) for (int i = (int) (m); i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
long long int Max(long long int a,long long int b){
    if(a>=b)return a;
    else return b;
}
long long int comb(long long int n,long long int r){
    vector<vector<long long int> > v(n+1,vector<long long int>(n+1,0));
    long long int i,j;
    rep(i,0,n+1){
        v.at(i).at(0)=1;
        v.at(i).at(i)=1;
    }
    rep(i,0,n+1){
        rep(j,0,i)v.at(i).at(j)=v.at(i-1).at(j-1)+v.at(i-1).at(j);
    }
    return v.at(n).at(r);
}
int main(void){
    int H,N,i,sum=0;
    cin>>H>>N;
    vector<int> data(N);
    rep(i,0,N)cin>>data.at(i);
    rep(i,0,N)sum+=data.at(i);
    if(sum>=H)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;
 
fn abc(mut a: Vec<i32>) -> i32 {
    a.sort();
    a.dedup();
    return a.len() as i32
}
 
fn main() {
    /*
    assert_eq!(abc(vec![10, 8, 8, 6, 3]), 3);
    assert_eq!(abc(vec![15, 15, 15]), 3);
    assert_eq!(abc(vec![50, 30, 50, 100, 50, 80, 30]), 4);
    */
    let n: i32 = read();
    let a: Vec<i32> = (0..n).map(|_| read()).collect();
 
    let result = abc(a);
 
    println!("{}", result);
}
 
 
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")
}

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

int main(){
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0; i<N; i++){
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
  cout << d.at(N/2)-d.at(N/2-1) << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<bool> ans(n, false);
    for (int i = 0; i < k; i++)
    {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++)
        {
            int a;
            cin >> a;
            ans[a - 1] = true;
        }
    }
    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        if (ans[i] == false)
        {
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}


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

int main(void){
	int n;
	cin >> n;
	vector<int> d(n);
	for(int i = 0; i < n; ++i){
		cin >> d[i];
	}
	long long sum = 0;
	for(int i = 0; i < n; ++i){
		for(int j = i+1; j < n; ++j){
			sum += d[i] * d[j];
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define N 10000
#define res register int
#define inf 0x3f3f3f
using namespace std;
int a[N],n,m,tot;
int main()
{
	scanf("%d",&n);
	for(res i=1;i<=n*2;i++)
	scanf("%d",&a[i]);
	sort(a+1,a+1+2*n);
	for(res i=1;i<=n;i++)
	tot+=a[i*2-1];
	printf("%d",tot);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using Graph = vector<vector<int>>;
const int INF = 1000000007;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
int main(){
  COMinit();
  ll n,m;
  cin >> n >> m;
  auto v = prime_factor(m);
  ll ans = 1;
  for(auto i : v){
    ll N = i.second,R = n;
    swap(N,R);
    ans *= COM(N + R - 1,R);
    ans %= INF;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 15564
import java.io.*;
import java.util.*;
class Main{
  public static void main(String args[])throws Exception{
    int area = 0;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    Deque<Integer> D = new ArrayDeque<Integer>();
    Deque<int[]> U = new ArrayDeque<int[]>();

    String str =  br.readLine();
    //一段ごと考える
    for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '\\')
      D.add(i);
      else if (false==D.isEmpty() && str.charAt(i) == '/') {
        int a = i - D.getLast();
        area += a;
        while (false==U.isEmpty() && D.getLast() < U.getLast()[0]) {
          a += U.getLast()[1];
          //エリアが小さいものを大きいものに含む為にキューを削除
          U.removeLast();
        }
        int[] data = { D.pollLast(), a };
        U.add(data);
      }
    }
    System.out.println(area);
    System.out.print(U.size());
    for(int [] t : U){
      System.out.print(" "+t[1]);
     }
    System.out.println();
  }
}


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

const ll INF = 1LL << 60;

ll H, W;
ll A[85][85], B[85][85];
ll AB[85][85];

const ll D = 160 * 80 + 10; // あり得る長さ
const ll D2 = D * 2; // あり得る値の範囲
typedef bitset<D2> bs;

// [r][c] にきたときに、この値はあり得るか。0 or 1
bs dp[85][85];

int main() {
    cin >> H >> W;
    rep(i, H)rep(j, W) cin >> A[i][j];
    rep(i, H)rep(j, W) cin >> B[i][j];

    rep(i, H)rep(j, W) AB[i][j] = abs(A[i][j] - B[i][j]);

    dp[0][0][D - AB[0][0]] = 1;
    dp[0][0][D + AB[0][0]] = 1;

    rep(i, H)rep(j, W) {
        if (i) {
            // たす
            dp[i][j] |= dp[i - 1][j] << AB[i][j];
            // 引く
            dp[i][j] |= dp[i - 1][j] >> AB[i][j];
        }

        if (j) {
            // たす
            dp[i][j] |= dp[i][j - 1] << AB[i][j];
            // 引く
            dp[i][j] |= dp[i][j - 1] >> AB[i][j];
        }
    }

    // 答えを求める D の分を戻す
    ll ans = INF;
    rep(i, D2) {
        if (dp[H - 1][W - 1][i]) ans = min(ans, abs(i - D));
    }
    cout << ans << endl;
}

Measured memory_bytes: 24156
/*
Author: Arham_doshi
@quote "Code like there's no tommorow!"
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
#include <bits/stdc++.h>

#define int         long long
#define double      long double
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define piii           pair<int,pair<int,int> >
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define bs(v,n)     binary_search(all((v)),(n))
#define lb(v,n)     lower_bound(all((v)),(n))
#define ub(v,n)     upper_bound(all((v)),(n))
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++)
#define _init(b)     memset(b,-1,sizeof(b))
#define _init0(b)     memset(b,0,sizeof(b))
#define MOD         1000000007
#define ef else if



using namespace std;

int gcd(int a, int b) {  if (a == 0)  return b; return gcd(b % a, a); }  
bool mod(double a,double b) {return a/b - floor(a/b);}

int occurs(vi v,int n){
auto it=lb(v,n);auto it1=ub(v,n);int x=it1-it;return x;}

int logb(int base, int x) {
    return (log(x) / log(base));
}



signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int i,j,x;
cin>>x;
cout<<x*x;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator sl
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define U (LL)0
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
map<LL,pair<LL,LL> >v;
V<LL>w;
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z;
    string a;
    cin>>n>>a;
    p=0;
    q=0;
    l=1;
    for(i=1; a[i]; i++)
    {
        if(a[i]=='W')
        {
            p++;
        }
        else
        {
            q++;
        }
        v[i]= {p,q};
    }
    k=q;
    for(i=1; a[i]; i++)
    {
         if(a[i-1]=='W')
         {
             q++;
         }
         if(a[i]=='E')
         {
             q--;
         }
         k=min(k,q);

    }
    cout<<k<<endl;


    return 0;

}


Measured memory_bytes: 19348
#include<iostream>
using namespace std;
const int e = 100000+10;

long long t[e];

int A(int a, int b)
{
    int c = a-b;
    if(c < 0)return -c;
    return c;
}

int main()
{
    long long n,w;
    cin >> n >> w;
    for(int i = 1; i <= e; i++)t[i] = 1e12;
    for(int i = 0; i < n; i++)
    {
        int a,b;
        cin >> a >> b;
        for(int i = e-1; i >= b; i--) t[i] = min(t[i], t[i-b]+a);
    }
    int wynik = 0;
    for(int i = 0; i < e; i++) if(t[i]<= w)  wynik = i;
    cout << wynik;
    return 0;
}


Measured memory_bytes: 1024
/* 解説後 */
#include <algorithm>
#include <iostream>
#include <vector>

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

	std::vector<std::pair<int, int>> red(N);
	std::vector<std::pair<int, int>> blue(N);
	for(int i = 0; i < N; i++) {
		std::cin >> red[i].first >> red[i].second;
	}
	for(int i = 0; i < N; i++) {
		std::cin >> blue[i].first >> blue[i].second;
	}

	std::sort(red.begin(), red.end());
	std::sort(blue.begin(), blue.end());

	int ans = 0;

	for(int bi = 0; bi < N; bi++) {
		// <y, index>
		std::vector<std::pair<int, int>> ok;
		for(int ri = 0; ri < red.size(); ri++) {
			if(red[ri].first < blue[bi].first && red[ri].second < blue[bi].second) {
				ok.emplace_back(red[ri].second, ri);
			}
		}

		if(!ok.empty()) {
			auto max = *std::max_element(ok.begin(), ok.end());
			red.erase(red.begin() + max.second);
			ans++;
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int main(){
    int N,M,C;
    cin>>N>>M>>C;
    int a[21][21];
    int b[21];
    for(int i=0;i<M;i++){
        cin>>b[i];
    }
    int ans=0;
    for(int i=0;i<N;i++){
        int c=0;
        for(int j=0;j<M;j++){
            cin>>a[i][j];
            c+=a[i][j]*b[j];
        }
        if(c+C>0){
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
int iinf=1<<30;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll poc(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
bool cmp(ppll a,ppll b){
    return a.first.first+a.first.second<b.first.first+b.first.second;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n;cin>>n;
    vector<ppll> v;
    rep(i,0,n){
        ll w,s,vv;cin>>w>>s>>vv;
        v.push_back({{s,w},vv});
    }
    sort(v.begin(),v.end(),cmp);
    ll dp[20001];
    fill(dp,dp+20001,-inf);
    dp[0]=0;
    rep(i,0,n){
        ll s=v[i].first.first,w=v[i].first.second,co=v[i].second;
        rrep(j,s,0){
            ll ne=j+w;
            if(ne<=20000)Max(dp[ne],dp[j]+co);
        }
    }
    ll ans=0;
    rep(i,0,20001)Max(ans,dp[i]);
    cout<<ans<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
//#define int long long
#define INF 1000000
using namespace std;
set<string> se;
void reversal(string x, string y){
    if(x.size() >= 2) {
        string tmp = x;
        reverse(tmp.begin(),tmp.end());
        se.insert(tmp+y);
        se.insert(y+tmp);
    }
    if(y.size() >= 2) {
        string tmp = y;
        reverse(tmp.begin(),tmp.end());
        se.insert(x+tmp);
        se.insert(tmp+x);
    }
    if(x.size() >= 2 && y.size() >=2){
        string tmp1 = x;
        reverse(tmp1.begin(),tmp1.end());
        string tmp2 = y;
        reverse(tmp2.begin(),tmp2.end());
        se.insert(tmp1+tmp2);
        se.insert(tmp2+tmp1);
    }
}
int main(){
    int n;
    cin >> n;
    rep(i,n){
        se.clear();
        string s;
        cin >> s;
        int divide = s.size()-1;
        rep(j,divide){
            string a = s.substr(0,j+1);
            string b = s.substr(j+1,divide-j);
            se.insert(a+b);
            se.insert(b+a);
            reversal(a,b);
        }
        cout << se.size() << endl;
    }
    return 0;
}


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

typedef long long ll;

#define F first 
#define S second 
#define PB push_back
#define MP make_pair 
#define rep(i,a,b) for (ll i=a;i<b;i++)

typedef vector<int> vi;
typedef pair<int,int> pi;


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


    vi a(n);



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


    int min = a[0]; 
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]<=min)
        {
            cnt++;
        }
        if(a[i]<=min) {
            min= a[i];
        }

    }
    cout<<cnt<<endl;

    return 0; 
}



Measured memory_bytes: 1024
import os
import sys

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = list(map(int, sys.stdin.readline().split()))
A, B = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(M)]))
A = np.array(A) - 1
B = np.array(B) - 1


def is_bridge(i):
    a = np.concatenate([A[:i], A[i + 1:]])
    b = np.concatenate([B[:i], B[i + 1:]])
    graph = csr_matrix(([True] * (M - 1), (a, b)), shape=(N, N))
    _, components = connected_components(graph, directed=False)
    return components.max() >= 1


ans = 0
for i in range(M):
    ans += is_bridge(i)
print(ans)


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

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

  X = (a * b) % 2;
  
  if (X == 0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define for1(i, m, n) for(int i = m;i < n;i++)
#define ll long long
#define endl '\n'
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;

    int cnt_b = 0, cnt = 0;
    rep(i, n) {
        if (s[i] == 'a') {
            if (cnt < a + b) {
                puts("Yes");
                cnt++;
            } else {
                puts("No");
            }
        }
        if (s[i] == 'b') {
            cnt_b++;
            if (cnt < a + b && cnt_b <= b) {
                puts("Yes");
                cnt++;
            } else {
                puts("No");
            }
        }
        if (s[i] == 'c') {
            puts("No");
        }
    }
	return 0;
}

Measured memory_bytes: 848
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		
		if(a<=b) {
			if(b<=c) {
				System.out.printf("%d %d %d\n",a,b,c);
			}else if(c<=a) {
				System.out.printf("%d %d %d\n",c,a,b);
			}else if((a<=c)&&(c<=b)) {
				System.out.printf("%d %d %d\n",a,c,b);
			}
		}else{
			if(a<=c) {
				System.out.printf("%d %d %d\n",b,a,c);
			}else if(c<=b) {
				System.out.printf("%d %d %d\n",c,b,a);
			}else if((b<=c)&&(c<=a)) {
				System.out.printf("%d %d %d\n",b,c,a);
			}
		}
	}
}



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

int main() {
  int k, x;
  cin >> k >> x;
  cout << (500 * k >= x ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
import string
count = {x: 0 for x in string.ascii_lowercase}
lines = ""

while True:
    try:
        lines += input().lower()
    except EOFError:
        break

for c in lines:
    if 'a' <= c <= 'z':
        count[c] += 1

for key in string.ascii_lowercase:
    print("{0} : {1}".format(key, count[key]))

Measured memory_bytes: 8068
#pragma region
// Author: Wenxing Mei
//   Date: 2018-08-25 20:05
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/trie_policy.hpp>
// using namespace __gnu_pbds;
#define rep(i, l, r) for (int i = (l); i < (r); ++i)
#define per(i, r, l) for (int i = (r); i >= (l); --i)
#define repv(ele, vec) for (auto &ele : vec)
#define zero(mem) memset(mem, 0, sizeof(mem))
#define sd(_) scanf("%d", &_)
#define sdd(_, __) scanf("%d%d", &_, &__)
#define sddd(_, __, ___) scanf("%d%d%d", &_, &__, &___)
#define sdddd(_, __, ___, ____) scanf("%d%d%d%d", &_, &__, &___, &____)
#define sf(_) scanf("%lf", &_)
#define sff(_, __) scanf("%lf%lf", &_, &__)
#define sfff(_, __, ___) scanf("%lf%lf%lf", &_, &__, &___)
#define sffff(_, __, ___, ____) scanf("%lf%lf%lf%lf", &_, &__, &___, &____)
#define sl(_) scanf("%lld", &_)
#define sll(_, __) scanf("%lld%lld", &_, &__)
#define slll(_, __, ___) scanf("%lld%lld%lld", &_, &__, &___)
#define sllll(_, __, ___, ____) scanf("%lld%lld%lld%lld", &_, &__, &___, &____)
#define sc(_) scanf("%c", &_)
#define ss(_) scanf("%s", _)
#define sz(x) (int)(x).size()
#define mid(a, b) (((a) + (b)) >> 1)
#define lfg(x) x << 1
#define rht(x) x << 1 | 1
#define inf 0x3f3f3f3f
#define all(container) container.begin(), container.end()
//#define MOD 19260817
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define get0 get<0>
#define get1 get<1>
#define get2 get<2>
#define get3 get<3>
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#pragma endregion

// Read the question correctly
// What are the exact constraints?
// Look out for SPECIAL CASES (n=1? n=1000000000?) and overflow (ull vs int?)

char g[200][200];

int main() {
  int h, w;
  sdd(h, w);
  zero(g);
  rep(i, 0, h) ss(g[i]);
  // rep(i, 0, h) { puts(g[i]); }
  set<int> empty_row, empty_col;
  rep(i, 0, h) {
    int empty = 1;
    rep(j, 0, w) {
      if (g[i][j] == '#') {
        empty = 0;
        break;
      }
    }
    if (empty) empty_row.insert(i);
  }
  rep(j, 0, w) {
    int empty = 1;
    rep(i, 0, h) {
      if (g[i][j] == '#') {
        empty = 0;
        break;
      }
    }
    if (empty) empty_col.insert(j);
  }

  rep(i, 0, h) {
    if (empty_row.count(i)) continue;
    rep(j, 0, w) {
      if (empty_col.count(j)) continue;
      putchar(g[i][j]);
    }
    puts("");
  }
  return 0;
}


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

class Program
{
	public static void Main()
	{
		var n = ReadLine().Split().Select(a => int.Parse(a) - 1).ToArray();
		WriteLine(n[0] * n[1]);
	}
}


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



int main() {
    double w,h,x,y; cin >> w >> h >> x >> y;
    double s3 = w*h/2;
    if(w/2 == x && h/2 == y)cout << s3 << " " << 1;
    else cout << s3 <<" " << 0;


    return 0;
}











Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int N;
    cin >> N;
    double x[N];
    double y[N];
    
    for(int i = 0; i < N; i++) cin >> x[i] >> y[i];
    
    double total = 0;
    for(int i = 0; i < N - 1; i++){
        for(int j = i + 1; j < N; j++){
            total += sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
        }
    }
    double M = N;
    printf("%f\n", total*2/M);
    return 0;
}


Measured memory_bytes: 256
import heapq
n,m = map(int,input().split())
l = list(map(lambda x: int(x)*(-1),input().split()))
heapq.heapify(l)
for i in range(m):
    min = heapq.heappop(l)
    heapq.heappush(l,(-1)*(-min//2))
    
print(-sum(l))

Measured memory_bytes: 14252
n = int(input())
As = list(map(int, input().split()))

negative_count = len(list(filter(lambda x: x < 0, As)))

if negative_count % 2 is 0:
    print(sum(list(map(lambda x: abs(x), As))))
else:
    abs_list = list(map(lambda x: abs(x), As))
    min = min(abs_list)
    abs_list.remove(min)
    print(sum(abs_list) - min)

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

int main(){
    vector<int>V;
    int a,b,c;
    cin>>a>>b>>c;
    V.push_back(a);
    V.push_back(b);
    V.push_back(c);
    sort(V.begin(),V.end());
    int r=V[0]+V[1];
    cout<<r<<endl;

}

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

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

int main(){
  int h,w;
  cin>>h>>w;
  h; w;
  vector<string> m(h);
  rep(i,h) cin>>m[i];
  
  queue<pair<int,int>> que;
  vector<vector<int>> dist(h,vector<int>(w,-1));
  
  dist[0][0] = 1;
  que.push({0,0});
  
  while(!que.empty()){
    int y = que.front().first;
    int x = que.front().second;
    que.pop();
    rep(i,4){
      int ny = y + dy[i];
      int nx = x + dx[i];
      if(ny<0||ny>=h||nx<0||nx>=w) continue;
      if(m[ny][nx] == '#') continue;
      if(dist[ny][nx] != -1) continue;
      que.push({ny,nx});
      dist[ny][nx] = dist[y][x]+1;
    }
  }
  int res = 0;
  if(dist[h-1][w-1] == -1){
    cout << -1 << endl;
    return 0;
  }
  rep(i,h) rep(j,w){        
    if(m[i][j] == '#') res++;
  }
  int ans = h*w-res-dist[h-1][w-1];
  cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int n, t;
    cin >> n >> t;
    vi a(n), b(n);
    vector<pii> ab(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        ab[i].first  = a[i];
        ab[i].second = b[i];
    }
    sort(ab.begin(), ab.end(), less<pii>());
    ll ret = 0;
    vvl dp(n + 1, vl(6001, 0));
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= 6000; ++j) {
            chmax(dp[i][j], dp[i - 1][j]);
            if (j - ab[i - 1].first >= 0)
                chmax(dp[i][j], ab[i - 1].second + dp[i - 1][j - ab[i - 1].first]);
            if (j <= t + ab[i - 1].first - 1)
                chmax(ret, dp[i][j]);
        }
        for (int j = t; j <= 6000; ++j) {
            dp[i][j] = 0;
        }
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 141184
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<bitset>
#include<iomanip>
using namespace std;
const int inf = 1001001000;

void print(vector<vector<int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

class UnionFind{
public:
	vector<int> parent;
	UnionFind(){}
	UnionFind(int n){
		this->parent = vector<int>(n,-1);
	}
	int root(int x){
		if (this->parent[x] < 0) return x;
		this->parent[x] = root(this->parent[x]);
		return this->parent[x];
	}
	int unite(int x, int y){
		int rx = this->root(x);
		int ry = this->root(y);
		if (rx == ry) return false;
		if (this->parent[rx] > this->parent[ry]) swap(rx, ry);
		this->parent[rx] += this->parent[ry];
		this->parent[ry] = rx;
		return true;
	}
	int same(int x, int y){
		int rx = this->root(x);
		int ry = this->root(y);
		return rx == ry;
	}
	int size(int x){
		return -this->parent[this->root(x)];
	}
};



int main(){
	int n, q; cin >> n >> q;
	UnionFind uf(n);
	for (int i = 0; i < q;i++){
		int c, x, y; cin >> c >> x >> y;
		if (c == 0) uf.unite(x, y);
		else if (c == 1) cout << uf.same(x, y) << endl;
	}



	return 0;
}



Measured memory_bytes: 3156
using System;

class MainClass
{
    static void Main()
    {
        //入力
        string[] input = Console.ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int a = int.Parse(input[1]);
        int b = int.Parse(input[2]);
        int sum = 0;

        //出力
        for (var i = 1; i <= n; i++)
        {
            var minisum = 0;
            var j = i;
            while(j>=10)
            {
                minisum += j % 10;
                j = j / 10;
            }
            if(j != 0)
            {
                minisum += j;
            }
            if(a <= minisum && minisum <= b )
            {
                sum += i;
            }
        }

        Console.WriteLine(sum);
    }

}

Measured memory_bytes: 11092
#include <iostream>

using namespace std;

int main(){
  int a,b;
  int count = 0;
  cin >> a >> b;
  for(int i = 1; i <= a; i++){
    for(int j = 1; j <= 31; j++){
      if(i == a && j > b){
        break;
      }
      if(i == j){
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説どおりに実装したソースコード
 * 
 * lower_boundとupper_boundの実装は https://qiita.com/taskie/items/b4e45e2005aa38e90bcb に参考
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			Integer[] a = new Integer[n], b = new Integer[n], c = new Integer[n];
			IntStream.range(0, n).forEach(i -> a[i] = scanner.nextInt());
			IntStream.range(0, n).forEach(i -> b[i] = scanner.nextInt());
			IntStream.range(0, n).forEach(i -> c[i] = scanner.nextInt());
			Arrays.sort(a);
			// Arrays.sort(b);
			Arrays.sort(c);
			System.out.println(
					IntStream.range(0, n).mapToLong(i -> getLessCount(b[i], a) * getGreaterCount(b[i], c)).sum());
		}
	}

	/**
	 * 配列の中で入力数字より小さい数字の数を返す
	 * 
	 * @param i 数字
	 * @param a 配列
	 * @return 配列の中で入力数字より小さい数字の数
	 */
	private static long getLessCount(int i, Integer[] a) {
		int result = Arrays.binarySearch(a, i, (x, y) -> (x.compareTo(y) >= 0) ? 1 : -1);
		if (result < 0) {
			result = ~result;
		}
		return result;
	}

	/**
	 * 配列の中で入力数字より大きい数字の数を返す
	 * 
	 * @param i 数字
	 * @param a 配列
	 * @return 配列の中で入力数字より大きい数字の数
	 */
	private static long getGreaterCount(int i, Integer[] a) {
		int result = Arrays.binarySearch(a, i, (x, y) -> (x.compareTo(y) > 0) ? 1 : -1);
		if (result < 0) {
			result = ~result;
		}
		return a.length - result;
	}
}


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

typedef long long ll;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18


int main(){
    vector<int> A(3); cin >> A[0] >> A[1] >> A[2];
    sort(ALL(A));
    cout << A[0] + A[1] + 10*A[2] << endl;

    return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>

class Dice4{
public:
	int number[6];

	void roll(char dst){
		switch(dst){
		case 'E':
			setNumber(number[3],number[1],number[0],number[5],number[4],number[2]);
			break;
		case 'N':
			setNumber(number[1],number[5],number[2],number[3],number[0],number[4]);
			break;
		case 'S':
			setNumber(number[4],number[0],number[2],number[3],number[5],number[1]);
			break;
		case 'W':
			setNumber(number[2],number[1],number[5],number[0],number[4],number[3]);
			break;
		}
	};

	bool isSameDice(int inputed[]){
		char order[25] = "NNNNWNNNWNNNENNNENNNWNNN";
		for(int i = 0; i < 24; i++){
			roll(order[i]);
			for(int j = 0; j < 6; j++){
				if(inputed[j] != number[j])
					break;
				if(j == 5)
					return true;
			}
		}
		return false;
	}

private:
	void setNumber(int n0,int n1,int n2,int n3,int n4,int n5){
		number[0] = n0;
		number[1] = n1;
		number[2] = n2;
		number[3] = n3;
		number[4] = n4;
		number[5] = n5;
	}

};

int main(){
	int n,k,j;
	scanf("%d",&n);
	Dice4 array[n];
	for(int i = 0; i < n; i++){
		scanf("%d %d %d %d %d %d",&array[i].number[0],&array[i].number[1],&array[i].number[2],
				&array[i].number[3],&array[i].number[4],&array[i].number[5]);
	}
	for(k = 0; k < n-1; k++){
		for(j = k+1; j < n; j++){
			if(array[k].isSameDice(array[j].number))
				break;
		}
		if(j < n) break;
	}
	if(k == n-1){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
}


Measured memory_bytes: 2680
let n, y = Scanf.scanf "%d %d" (fun a b -> (a, b))

let rec calc tt ft =
  let t = n - tt - ft in
  if tt * 10000 + ft * 5000 + t * 1000 = y then Some (tt, ft, t) else None


let rec inner tt =
  let rec aux ft =
    if tt + ft > n then None
    else match calc tt ft with Some x -> Some x | None -> aux (ft + 1)
  in
  aux 0


let rec main tt =
  if tt > n then (-1, -1, -1)
  else match inner tt with Some x -> x | None -> main (tt + 1)


let p (tt, ft, t) = Printf.printf "%d %d %d\n" tt ft t

let () = main 0 |> p

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

using P = pair<int, int>;

constexpr int MAX_H = 1000;
constexpr int MAX_W = 1000;

int H, W, N;
int sh{-1}, sw{-1}, gh{-1}, gw{-1};
char grid[MAX_H][MAX_W + 1];
int count[MAX_H][MAX_W];

//#define OCTAS
#ifdef OCTAS
constexpr int dh[]{-1, -1, -1, 0, 0, +1, +1, +1};
constexpr int dw[]{-1, 0, +1, -1, +1, -1, 0, +1};
#else
constexpr int dh[]{-1, 0, 0, +1};
constexpr int dw[]{0, -1, +1, 0};
#endif

// CAUTION!!!
// Call init_count() first!!!
//
void init_count() {
  fill(::count[0], ::count[0] + MAX_H * MAX_W, -1);
}

int bfs(int h, int w) {
  queue<P> que;
  ::count[h][w] = 0;
  que.push(P(h, w));

  while (!que.empty()) {
    P p = que.front();
    que.pop();
    int cnt = ::count[p.first][p.second];
    if (p.first == gh && p.second == gw) {
      return cnt;
    }
    ++cnt;
    for (int i{}; i < sizeof(dh) / sizeof(int); ++i) {
      int nh = p.first + dh[i];
      int nw = p.second + dw[i];
      if (nh < 0 || nh >= H ||
          nw < 0 || nw >= W ||
          ::count[nh][nw] >= 0 ||
          grid[nh][nw] == 'X')
        continue;
      ::count[nh][nw] = cnt;
      que.push(P(nh, nw));
    }
  }

  return -1;
}

int main() {
  scanf("%d%d%d", &H, &W, &N);
  for (int h{}; h < H; ++h) {
    scanf("%s", &grid[h][0]);
    if (gh < 0) {
      for (int w{}; w < W; ++w) {
        if (grid[h][w] == 'S') {
          gh = h;
          gw = w;
        }
      }
    }
  }

  int total{};
  for (int i{0}; i < N; ++i) {
    init_count();
    sh = gh;
    sw = gw;
    for (int h{}; h < H; ++h) {
      for (int w{}; w < W; ++w) {
        if (grid[h][w] == static_cast<char>('1' + i)) {
          gh = h;
          gw = w;
          goto FOUND;
        }
      }
    }
    FOUND:
    total += bfs(sh, sw);
  }

  printf("%d\n", total);
  return 0;
}



Measured memory_bytes: 8016
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
q=int(input())
from collections import Counter
d=Counter(a)
for b,c in [list(map(int,input().split()))for _ in range(q)]:
  bb,cc=d[b]*b,d[b]*c
  s+=cc-bb
  d[c]+=d[b]
  d[b]=0
  print(s)

Measured memory_bytes: 39672
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, x, n) for(int i = x; i < (int)(n); i++)
#define ALL(n) begin(n), end(n)
//struct cww{cww(){ios::sync_with_stdio(false);cin.tie(nullptr);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;

int main() {
  char s[100];
  scanf("%s", s);

  string str = string(s);
  string reversed = str;
  reverse(ALL(reversed));

  bool rev = true;
  if (str != reversed) {
    rev = false;
  }

  string sub = str.substr(0, (str.length() - 1) / 2);
  string reversed2 = sub;
  reverse(ALL(reversed2));

  if (sub != reversed2) {
    rev = false;
  }

  string sub2 = str.substr((str.length() + 3) / 2 - 1, str.length() - (str.length() + 3) / 2 + 1);
  string reversed3 = sub2;
  reverse(ALL(reversed3));

  if (sub2 != reversed3) {
    rev = false;
  }

  printf("%s\n", rev ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)
#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl

inline ll cube(ll n){return n*n*n;}

int main(){
    ll n,k;
    cin>>n>>k;
    if(!(k%2)){
        //cerr << n / (k / 2) - n / k;
        cout<< cube(n / k) + cube(n / (k / 2) - n / k) << endl;
    }else{
        cout<<cube(n/k)<<endl;
    }
    return 0;
}

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

int main() {
        long int n, m, l, a[100][100], b[100][100], r[100][100], i, j, k;
        for (i = 0; i < 100; i++) {
                for (j = 0; j < 100; j++) {
                        a[i][j] = 0;
                        b[i][j] = 0;
                        r[i][j] = 0;
                }
        }
        cin >> n >> m >> l;
        for (i = 0; i < n; i++) {
                for (j = 0; j < m; j++) {
                        cin >> a[i][j];
                        if (a[i][j] >  10000) {
                                cout << " Too Large" << endl;
                                return 1;
                        }
                }
        }
        for (i = 0; i < m; i++) {
                for (j = 0; j < l; j++) {
                        cin >> b[i][j];
                        if (b[i][j] > 10000) {
                                cout << "Too Large" << endl;
                                return 1;
                        }
                }
        }
        for (i = 0; i < n; i++) {
                for (j = 0; j < l; j++) {
                        for (k = 0; k < m; k++) {
                                r[i][j] += (a[i][k] * b[k][j]);
                        }
                }
        }
        for (i = 0; i < n; i++) {
                for (j = 0; j < l; j++) {
                        cout << r[i][j];
                        if (j != l - 1) cout << " ";
                        else cout << endl;
                }
        }
        return 0;
}

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

int main(){
    int n;
    double ans;
    cin >> n;
    vector<double> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    
    sort(v.begin(), v.end());
    ans = v[0];
    for(int i = 1; i < n; i++) ans = (ans + v[i]) / 2.0;

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

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

int main(void){
    long long int a, b, c;
    cin >> a >> b >> c;
    if(a + b < c) {
        if ( (a + b - c) * (a + b - c) > 4 * a * b) cout << "Yes";
        else cout << "No";
    } else {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int num[4] = {S[0] - '0',S[1] - '0',S[2] - '0',S[3] - '0'};
    rep(i,0,(1<<3)){
        int ans = num[0];
        rep(j,0,3){
            ans += (i >> j & 1 ? num[j+1] : num[j+1] * -1);
        }
        if(ans == 7){
            cout << num[0];
            rep(j,0,3){
                cout << (i >> j & 1 ? '+' : '-');
                cout << num[j+1];
            }
            cout << "=7" << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
package main

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

func main() {
	N := readInt()
	A := readInt()
	B := readInt()
	C := readInt()
	S := make([]string, N)
	for i := 0; i < N; i++ {
		S[i] = readString()
	}

	T := make([]string, N)
	ans := "Yes"
	for i, s := range S {
		if s == "AB" {
			if A == 0 && B == 0 {
				ans = "No"
				break
			}
			if A < B {
				A++
				B--
				T[i] = "A"
			} else if B < A {
				A--
				B++
				T[i] = "B"
			} else if i == N-1 || S[i+1] != "BC" {
				A++
				B--
				T[i] = "A"
			} else {
				A--
				B++
				T[i] = "B"
			}
		} else if s == "AC" {
			if A == 0 && C == 0 {
				ans = "No"
				break
			}
			if A < C {
				A++
				C--
				T[i] = "A"
			} else if C < A {
				A--
				C++
				T[i] = "C"
			} else if i == N-1 || S[i+1] != "BC" {
				A++
				C--
				T[i] = "A"
			} else {
				A--
				C++
				T[i] = "C"
			}
		} else {
			if B == 0 && C == 0 {
				ans = "No"
				break
			}
			if B < C {
				B++
				C--
				T[i] = "B"
			} else if C < B {
				B--
				C++
				T[i] = "C"
			} else if i == N-1 || S[i+1] != "AC" {
				B++
				C--
				T[i] = "B"
			} else {
				B--
				C++
				T[i] = "C"
			}
		}
	}
	fmt.Println(ans)
	if ans == "No" {
		return
	}
	for _, t := range T {
		fmt.Println(t)
	}
}

func myAbs(a int, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readChar() rune {
	stdinScanner.Scan()
	temp := stdinScanner.Text()
	return rune(temp[0])
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 6040