akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  vector<int> ini(N);
  vector<int> fin(N);
  priority_queue<PII> pque;
  rep(i,N)cin >> ini[i];
  rep(i,N) cin >> fin[i];
  rep(i,N){
    int ni = (i+1)%N, pi = (i-1+N)%N;
    if(fin[i] > fin[ni] + fin[pi] && fin[i] != ini[i])pque.push(PII(fin[i],i));
  }

  ll count = 0;
  while(!pque.empty()){
    int val = pque.top().first;
    int i = pque.top().second;
    pque.pop();
    int ni = (i+1)%N,pi = (i-1+N)%N;
    int nni = (ni+1)%N,ppi = (pi-1+N)%N;
    int tag = fin[ni] + fin[pi];
    int nval = max(tag,ini[i]);
    int n = (fin[i] - nval + tag - 1)/tag;
    fin[i] -= tag*n;
    count += n;
    if(fin[i]<ini[i])break;
    else{
      if(fin[ni] > fin[i] + fin[nni] && fin[ni] != ini[ni])pque.push(PII(fin[ni],ni));
      if(fin[pi] > fin[i] + fin[ppi] && fin[pi] != ini[pi])pque.push(PII(fin[pi],pi));
    }
  }

  bool issat = true;
  rep(i,N)if(fin[i] != ini[i])issat = false;
  if(issat)cout << count << endl;
  else cout << -1 << endl;
  return 0;
}


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

int main() {
   ll n;
   cin>>n;
   ll arr[n];
   ll temp = 0;
   for(int i = 0;i<n;i++)
   {
       cin>>arr[i];
       temp^=arr[i];
   }
   
   ll res[n];
   for(int i = 0;i<n;i++)
   {
   	res[i] = temp^arr[i];
   }
   
   for(int i = 0;i<n;i++)
   cout<<res[i]<<" ";
   cout<<"\n";
	return 0;
}

Measured memory_bytes: 6640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N=1e6+5,inf=1e18,mod=1e9+7;
#define test ll testcases;cin>>testcases; while(testcases--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define ppll pair<ll,pair<ll,ll>>
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))
const ld pi=3.141592653589793238;

bool check_prime(ll n)
{
	ll flag=0,i;
	for(i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			flag=1;
			break;
		}
	}
	if(n==1)
	{
		return false;
	}
	else if(flag==0 || n==2 || n==3)
	{
		return true;
	}
	else
	{
		return false;
	}
}

ll fastexpo(ll a,ll b,ll MOD) 
{
	ll result=1;
	while(b>0)
	{
		if(b%2==1)
		{
			result=(result*a)%MOD;
		}
		a=(a*a)%MOD;
		b=b/2;
	}
	return result;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll i,s,n;
  cin>>n;
  ll a[n];
  for(i=0;i<n;i++)
  {
    cin>>a[i];
  }
  s=0;
  for(i=0;i<n-1;i++)
  {
	if(a[i]>a[i+1])
    {
		s+=(a[i]-a[i+1]);
      a[i+1]=a[i];
    }
  }
  cout<<s<<"\n";
       return 0;
}

Measured memory_bytes: 5176
#include <bits/stdc++.h> 
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<vector<int>>;

int main(){
    int n;
    cin>>n;
    map<string,int> mp;
    rep(i,n){
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;

}


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



int main(){
  int N;
  //vector<int> A;
  double ans=0;
  cin>>N;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    ans+=1.0/a;
  }
  ans=1.0/ans;
  cout <<ans<<endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define ull unsigned long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define pi acosl(-1)
#define sqr(x) ((x)*(x))
#define mod (1000*1000*1000+7)
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
template <typename T>
string NumberToString(T pNumber)
{
     ostringstream oOStrStream;
     oOStrStream << pNumber;
     return oOStrStream.str();
}
ll modPow(ll x,ll n,ll m)
{
    if(n==0)
    return 1%m;
    ll u = modPow(x,n/2,m);
    u=u*u%m;
    if(n%2==1)
    u=u*x%m;
    return u;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
ll seive[1000000];
void seiveForm()
{
    ll i,j;
    seive[0]=seive[1]=1;
    f(i,2,100000)
    {
        if(seive[i]==0)
            for(j=i*i;j<1000000;j+=i)
                seive[j]=1;
    }
}
bool isPerfectSquare(ll num)
{
    double n = sqrt(num);
    return n==(ll)n?true:false;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k,i,j,t,temp=0;
    ll d[10]={0};
    bool f;
    cin>>n>>k;
    rep(i,k)
    {
        cin>>t;
        d[t]=1;
    }
    for(i=n;i<1000005;i++)
    {
        string s = NumberToString(i);
        for(j=0;j<s.size();j++)
        {
            if(d[ s[j] - '0'])
                goto j;
        }
        cout<<i;
        break;
        j:;
    }
    cout<<endl;
    return 0;
}


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

#define ll long long
#define ld double
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define setpr(pp) fixed<<setprecision(pp)
#define FOR(I,N) for(I=0;I<N;++I)
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod	%1000000007
#define pi 3.141592653
#define NL -5000000

int main()
{	IOS;
	ll n,k;
	cin>>n>>k;
	ll i,a[n];
	FOR(i,n)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	ll s=0;
	FOR(i,k)
		s+=a[i];
	cout<<s;
	
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 


int main() {
    ll n, m; cin >> n >> m;
    ll ret = (2*n > m ? m/2 : (2*n+m)/4) ;
    cout << ret << endl; 
    return 0;
}

Measured memory_bytes: 384
//nani?
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i,a,b) for( int i = a; i < b ; i++ ) 
#define sor(a) sort( a.begin(), a.end() )
#define rsor(a) sort( a.rbegin(), a.rend() )
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
//#define inf 1LL<<62
typedef long long ll;
typedef double ld;
using namespace std;
const int inf=1e7;
const ll MOD=1e9+7;
const ll mod=998244353;
// ac cmtr;
const int MAX_N = 1e5+5;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif
//---------------------------


int main(){
    fastio;
    ll n;
  	cin>>n;
  ll ans=n/500;
  n-=(ans*500);
  ll sum=1000*ans;
  ans=n/5;
  sum+=(ans*5);
  cout<<sum<<endl;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int N;
  cin >> N;  
  bool flag;
  for(int i=2;N>0;i+=5){
    flag=true;
    for(int k=2;k<i;k++){
      if(i%k==0){flag=false;break;}
    }
    if(flag){
      cout << i <<" "; N--;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<utility>
#include<stack>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
stack<char>s, ans;
int main() {
	char ch;
	while(1) {
		ch = getchar();
		if(ch == '\n')
			break;
		if(ch != 'B')
			s.push(ch);
		else {
			if(!s.empty()) {
				s.pop();
			}
		}
	}
	while(!s.empty()) {
		ch = s.top();
		s.pop();
		ans.push(ch);
	}
	while(!ans.empty()) {
		ch = ans.top();
		ans.pop();
		cout << ch;
	}
	cout << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)

const int MAX = 1000001;

bool prime[MAX];
int a, d, n;

int main()
{
    prime[0] = true;
    prime[1] = true;
    for(int i =2; i < MAX; i++)if(!prime[i])
        for(int j= i*2;j<MAX;j+= i) prime[j] = true;


    while(cin >> a >> d >> n && a)
    {
        int ans = 0, cnt = 0;
        for(int i = a; a < MAX; i += d )if(!prime[i])
        {
            cnt++;
            if(cnt == n){ ans = i;break;}

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

Measured memory_bytes: 0
#include <iostream>
#include <list>
#include <set>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <queue>

using namespace std;
using P=pair<int,int>;
#define rep(i, n) for (int i = 0; i < n; i++)

int main(){
  char s;
   cin >> s;

   if (isupper(s))
   {
       cout << "A" << endl;
   }
   else
   {
       cout << "a" << endl;
   }

   return 0;

}

Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

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

    string S;
    cin >> S;

    int ans = 700;
    for (int i = 0; i < 3; ++i) {
        if (S[i] == 'o') ans += 100;
    }

    cout << ans << endl;

    return 0;
}


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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int main(){
  ll N,M,K;
  cin>>N>>M>>K;
  vector<ll> A(N),B(M);
  for(int i(0);i<N;i++) cin>>A[i];
  for(int i(0);i<M;i++) cin>>B[i];
  vector<ll> Ar(N+1,0),Br(M+1,0);
  for(int i(1);i<=N;i++){
    Ar[i] = Ar[i-1] + A[i-1];
  }
  for(int i(1);i<=M;i++){
    Br[i] = Br[i-1] + B[i-1];
  }
  ll ans(0);
  for(int i(0);i<=N;i++){
    ll tmp = Ar[i];
    if(tmp <= K){
      int nokori = K-tmp;
      int sasuu = upper_bound(Br.begin(),Br.end(),nokori) - Br.begin() - 1;
  //    cout << tmp << " " << i << " " << nokori << " " << sasuu <<  endl;
      ans = max(ans,ll(sasuu + i));
    }
  }
  cout << ans << endl;
  return 0;
}



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

int main() {
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if (u == s) {
    cout << a - 1 << " " << b << endl;
  } else {
    cout << a << " " << b - 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
def sssp ms, n
  colors = Array.new(n){1} # 1:white, 2:gray, 3:black
  costs = Array.new(n){Float::INFINITY}

  costs[0] = 0
  colors[0] = 2

  while true
    min_cost = Float::INFINITY
    min_cost_i = nil
    colors.each_with_index do |color, i|
      if color == 2 && costs[i] < min_cost
        min_cost = costs[i]
        min_cost_i = i
      end
    end

    break unless min_cost_i

    colors[min_cost_i] = 3

    ms[min_cost_i].each_with_index do |m, i|
      if colors[i] != 3
        new_cost = min_cost + m
        costs[i] = new_cost if new_cost < costs[i]
        colors[i] = 2
      end
    end
  end

  costs
end

n = gets.chomp.to_i
ms = []
n.times do
  _, i, *paths = gets.split(' ').map(&:to_i)
  rows = Array.new(n){Float::INFINITY}
  (0..(i - 1)).each do |j|
    rows[paths[2 * j]] = paths[2 * j + 1]
  end
  ms << rows
end
costs = sssp(ms, n)
costs.each_with_index do |cost, i|
  puts "#{i} #{cost}"
end


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

int main() {
    int n; cin >> n;
    int i;
    for (i = 1; i<= n; i++) {
        if (n == 108 * i / 100)
            break;
    }

    if (n == 1)
        cout << 1 << endl;
    else if (i == n+1)
        cout << ":(" << endl;
    else
        cout << i << endl;
}

Measured memory_bytes: 256
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

    N, K = ii(), ii()
    ret = 1
    for n in range(N):
        ret = min(ret*2, ret+K)
    print(ret)


if __name__ == '__main__':
    main()


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int>ac(n);
    vector<int>wa(n);
    for(int i=0; i<m; i++){
        int p;
        string s;
        cin >> p >> s;
        p--;
        if(ac[p])continue;
        if(s == "AC"){
            ac[p] = 1; 
        }else{
            wa[p]++;
        }
    }
    int AC = 0,WA = 0;
    rep(i,n){
        AC += ac[i];
        if(ac[i])WA += wa[i];
    }
    cout << AC <<" "<<  WA << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n; cin >> n;
  vector<pair<ll,int>> a(n);
  rep(i,n){
    cin >> a[i].F;
    a[i].S = i;
  }
  sort(a.rbegin(),a.rend());
  vector<ll> b(n,0);
  int pos = n;
  rep(i,n-1){
    pos = min(pos,a[i].S);
    b[pos] += (i+1)*(a[i].F-a[i+1].F);
  }
  b[0] += n*a[n-1].F;
  for(auto ans:b){
    cout << ans << endl;
  }
  return 0;
}

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

int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    
    int counter = 0;
    int sum;
    
    for (int i = 0; i <= A; ++i) {
        for (int j = 0; j <= B; ++j) {
            for (int k = 0; k <= C; ++k) {
                sum = 500 * i + 100 * j + 50 * k;
                if (sum == X) ++counter;
            }
        }
    }
    cout << counter << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

string dir;
vector<string> ope;

string solve(string s, int i)
{
    int n = s.size();
    if(n == 1)
        return s;
    if(s[0] == '(' && s[n-1] == ')'){
        int m = 0;
        for(int j=0; j<n-1; ++j){
            if(s[j] == '(')
                ++ m;
            else if(s[j] == ')'){
                -- m;
                if(m == 0)
                    break;
            }
        }
        if(m == 1)
            return solve(s.substr(1, n-2), 0);
    }

    string ret;
    if(dir[i] == 'L'){
        int j = 0;
        int k = 0;
        int m = 0;
        while(k <= n){
            if(k < n && s[k] == '(')
                ++ m;
            if(k < n && s[k] == ')')
                -- m;
            if(m == 0 && (k == n || find(ope[i].begin(), ope[i].end(), s[k]) != ope[i].end())){
                if(j > 0)
                    ret += s[j-1];
                ret += solve(s.substr(j, k-j), i+1);
                if(j > 0)
                    ret = '(' + ret + ')';
                j = k + 1;
            }
            ++ k;
        }
    }else{
        int j = n-1;
        int k = n-1;
        int m = 0;
        while(k >= -1){
            if(k >= 0 && s[k] == '(')
                ++ m;
            if(k >= 0 && s[k] == ')')
                -- m;
            if(m == 0 && (k == -1 || find(ope[i].begin(), ope[i].end(), s[k]) != ope[i].end())){
                if(j < n-1)
                    ret = s[j+1] + ret;
                ret = solve(s.substr(k+1, j-k), i+1) + ret;
                if(j < n-1)
                    ret = '(' + ret + ')';
                j = k - 1; 
            }
            -- k;
        }
    }

    return ret;
}

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

    while(--d >= 0){
        int g;
        cin >> g;
        dir.resize(g);
        ope.resize(g);
        for(int i=0; i<g; ++i){
            int m;
            cin >> dir[i] >> m;
            ope[i].resize(m);
            for(int j=0; j<m; ++j)
                cin >> ope[i][j];
        }

        int n;
        cin >> n;
        for(int i=0; i<n; ++i){
            string s;
            cin >> s;
            cout << solve(s, 0) << endl;
        }

        if(d > 0)
            cout << endl;
    }

    return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
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; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c; cin >> a >> b >> c;
	cout << (a <= c&&c <= b ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
struct __fastio__{ __fastio__() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } __fast_io__;
template<class T, class U> bool chmin (T &a, const U &b) { if (a > b) { a = b; return 1; } return 0; }
template<class T, class U> bool chmax (T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; }

int main() {
	int n;
	std::cin >> n;
	std::vector<long long> x(n), y(n);
	for (int i = 0; i < n; i++) {
		int r, c;
		std::cin >> r >> c;
		x[i] = r - c;
		y[i] = r + c;
	}
	
	std::sort(x.begin(), x.end());
	std::sort(y.begin(), y.end());
	
	long long max_x = std::abs(x[0] - x[n - 1]);
	long long max_y = std::abs(y[0] - y[n - 1]);
	
	std::cout << std::max(max_x, max_y) << '\n';
	
	return 0;
}

Measured memory_bytes: 6360
#include "bits/stdc++.h"
using namespace std;

long long int gcd(long long int l, long long int r) {
	assert(l > 0 && r > 0);
	if (l > r)return gcd(r, l);
	else {
		const long long int num = r%l;
		if (num) {
			return gcd(l, num);
		}
		else {
			return l;
		}
	}
}
long long int lca(long long int l, long long int r) {
	return l / gcd(l, r)*r;
}
int main() {
	string st; cin >> st;
	reverse(st.begin(), st.end());
	cout << st << endl;
	return 0;
}

Measured memory_bytes: 3172
#include <stdio.h>
#include <math.h>


struct Point { double x, y; };
double pi = 3.14159265357989;



void koch(int n, Point p1, Point p2) {
	if (n == 0) return;
	Point s, t, u;
	double th = pi / 3;
	s.x = (2 * p1.x + p2.x) / 3;
	s.y = (2 * p1.y + p2.y) / 3;
	t.x = (p1.x + 2 * p2.x) / 3;
	t.y = (p1.y + 2 * p2.y) / 3;
	u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
	u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

	koch(n - 1, p1, s);
	printf("%.8f %.8f\n", s.x, s.y);
	koch(n - 1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);
	koch(n - 1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);
	koch(n - 1, t, p2);
}

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

	a.x = 0;
	a.y = 0;
	b.x = 100;
	b.y = 0;

	printf("%.8f %.8f\n", a.x, a.y);
	koch(n, a, b);
	printf("%.8f %.8f\n", b.x, b.y);
	

	return 0;
}


Measured memory_bytes: 3000
#include <iostream>
#include <stack>
using namespace std;
static const int MAX_V = 100;
static const int INF = 10000000;
int cost[MAX_V][MAX_V];
bool wasUsed[MAX_V];
int mincost[MAX_V];
//n???????????°
int n;

int prim(){
    for(int i=0;i<n;i++){
        wasUsed[i] = false;
        mincost[i] = INF;
    }
    mincost[0] = 0;
    int res = 0;
    while(true){
        int v = -1;
        for(int u =0;u<n;u++){
            if(!wasUsed[u] && (v==-1||mincost[u] < mincost[v]))
               v = u;
        }
        if(v==-1) break;
        wasUsed[v] = true;
        res += mincost[v];
        
        for(int u=0;u<n;u++)
            mincost[u] = min(mincost[u],cost[v][u]);
    }
    return res;
}

int main(int argc, const char * argv[]) {
    cin >> n;
    
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++){
            int a;
            cin >> a;
            if(a == -1) a = INF;
            cost[i][j] = a;
        }
    
    cout << prim() << endl;
    return 0;
}

Measured memory_bytes: 1200
# -*- coding: utf-8 -*-
import sys
from collections import Counter, defaultdict
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline


class RollingHash():
    """
    Original code is https://tjkendev.github.io/procon-library/python/string/rolling_hash.html
    """
    class RH():
        def __init__(self, s, base, mod):
            self.base = base
            self.mod = mod
            self.rev = pow(base, mod-2, mod)

            l = len(s)
            self.h = h = [0]*(l+1)
            tmp = 0
            for i in range(l):
                num = ord(s[i])
                tmp = (tmp*base + num) % mod
                h[i+1] = tmp

            self.pw = pw = [1]*(len(s)+1)
            v = 1
            for i in range(l):
                pw[i+1] = v = v * base % mod

        def calc(self, l, r):
            return (self.h[r] - self.h[l] * self.pw[r-l]) % self.mod

    @staticmethod
    def gen(a, b, num):
        import random
        import math
        result = set()
        while 1:
            while 1:
                v = random.randint(a, b)//2*2+1
                if v not in result:
                    break
            for x in range(3, int(math.sqrt(v))+1, 2):
                if v % x == 0:
                    break
            else:
                result.add(v)
                if len(result) == num:
                    break
        return result

    def __init__(self, s, rand=False, num=5):
        if rand:
            bases = RollingHash.gen(2, 10**3, num)
        else:
            assert num <= 10
            bases = [641, 103, 661, 293, 547, 311, 29, 457, 613, 599][:num]

        MOD = 10**9+7
        self.rhs = [self.RH(s, b, MOD) for b in bases]

    def calc(self, l, r):
        return tuple(rh.calc(l, r) for rh in self.rhs)


class Bisect:
    def __init__(self, func):
        self.__func = func

    def bisect_left(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if self.__func(mid) < x:
                lo = mid+1
            else:
                hi = mid
        return lo

    def bisect_right(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if x < self.__func(mid):
                hi = mid
            else:
                lo = mid+1
        return lo


def slv(N, S):
    srh = RollingHash(S, num=5)

    def f(m):
        h2i = defaultdict(list)
        for i in range(N-m+1):
            j = i + m
            h = srh.calc(i, j)
            h2i[h].append(i)

        for l in h2i.values():
            l0 = l[0]
            for i in range(1, len(l)):
                n = l[i] - l0
                if n >= m:
                    return 0
        return 1

    return Bisect(f).bisect_right(0, 1, N//2+1) - 1


def main():
    N = int(input())
    S = input()
    print(slv(N, S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 50140
# -*- coding: utf-8 -*-
loop = 1
while(loop):
    l = list(input().strip().split())
    a = int(l[0])
    b = int(l[2])
    op = l[1]

    if(op == "?"):
        loop = 0
        break;
    elif(op == "+"):
        ret = a + b
    elif(op == "-"):
        ret = a - b
    elif(op == "*"):
        ret = a * b
    elif(op == "/"):
        ret = a / b
    else:
        continue
    print(int(ret))

Measured memory_bytes: 7680
#include<bits/stdc++.h>
using namespace std;
using p = pair<int,int>;

int main(){
    string s;
    cin >> s;
    int t = s.size();
    int sum = 0;
    for(int i = 0; i < t; i++){
        sum += s[i] - '0'; 
    }
    if(sum%9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using ll = long long;

const int mod = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll A, B, K;
    cin >> A >> B >> K;
    if (K <= A)
        cout << A - K << " " << B << endl;
    else if (K <= A + B)
        cout << "0 " << A + B - K << endl;
    else
        cout << "0 0" << endl;
}

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

int main() {
  int a,n;
  cin>>n;
  double c;
  for(int i=0;i<n;i++){
  cin >> a;
  double b=1.00000/a;
    
      c+=b;
  }
double d;
  d=1.00000/c;
  cout<<d<<endl;
 
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

const long long INF = 1e18;

int main(){

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

    vector<vector<pair<int, int>>> E(N);

    int a, b, c;
    for(int i = 0; i < M; i++){
        cin >> a >> b >> c;
        E[a - 1].emplace_back(make_pair(b - 1, c));
    }

    vector<long long> score(N, -INF);
    vector<long long> nextScore(N, -INF);
    score[0] = 0;
    nextScore[0] = 0;

    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            long long tempScore = score[j];
            if(tempScore == -INF){
                continue;
            }

            for(auto next: E[j]){
                long long nextCost = tempScore + next.second;
                if(nextCost > nextScore[next.first]){
                    nextScore[next.first] = nextCost;
                }
            }
        }

        for(int j = 0; j < N; j++){
            score[j] = nextScore[j];
        }
    }

    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            long long tempScore = score[j];
            if(tempScore == -INF){
                continue;
            }

            for(auto next: E[j]){
                long long nextCost = tempScore + next.second;
                if(nextCost > nextScore[next.first]){
                    nextScore[next.first] = INF;
                }
            }
        }

        for(int j = 0; j < N; j++){
            score[j] = nextScore[j];
        }
    }

    if(score[N - 1] == INF){
        cout << "inf" << endl;
    }
    else{
        cout << score[N - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>
#include<iomanip>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const int MOD = 1000000007;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
template<class T>
int dp2csv(const vector<vector<T>>& dp, const string fname);
int range_check(int val, int min, int max) {
	if (val < min) {
		return min;
	}
	if (val > max) {
		return max;
	}
	return val;
}
int main() {
	int hei, wid, ber;
	cin >> hei >> wid >> ber;
	vector<VE> cak(hei, VE(wid, -1));
	VEP berry_list;
	string str;
	REP(h, hei) {
		cin >> str;
		REP(w, wid) {
			if (str[w] == '#') {
				cak[h][w] = 0;
				berry_list.push_back(make_pair(h, w));
			}
		}
	}
	vector<VE> active_cak = cak;
	REP(b, ber) {
		int nowh = berry_list[b].first;
		int noww = berry_list[b].second;
		int up = 0, down = 0, left = 0, right = 0;
		active_cak[nowh][noww] = b+1;
		while (noww - left > 0) {
			bool all_ok = true;
			for (int h = nowh - up; h <= nowh + down; ++h) {
				if (active_cak[h][noww - left - 1] != -1) {
					all_ok = false;
					break;
				}
			}
			if (all_ok) {
				left++;
			}
			else {
				break;
			}
		}
		while (noww + right < wid - 1) {
			bool all_ok = true;
			for (int h = nowh - up; h <= nowh + down; ++h) {
				if (active_cak[h][noww + right + 1] != -1) {
					all_ok = false;
					break;
				}
			}
			if (all_ok) {
				right++;
			}
			else {
				break;
			}
		}
		while (nowh - up > 0) {
			bool all_ok = true;
			for (int w = noww - left; w <= noww + right; ++w) {
				if (active_cak[nowh - up -1][w] != -1) {
					all_ok = false;
					break;
				}
			}
			if (all_ok) {
				up++;
			}
			else {
				break;
			}
		}
		while (nowh + down < hei -1) {
			bool all_ok = true;
			for (int w = noww - left; w <= noww + right; ++w) {
				if (active_cak[nowh + down + 1][w] != -1) {
					all_ok = false;
					break;
				}
			}
			if (all_ok) {
				down++;
			}
			else {
				break;
			}
		}
		for (int h = nowh - up; h <= nowh + down; ++h) {
			for (int w = noww - left; w <= noww + right; ++w) {
				active_cak[h][w] = b + 1;
			}
		}
	}
	REP(h, hei) {
		REP(w, wid) {
			cout << active_cak[h][w] << " ";
		}
		cout << endl;
	}
	return 0;
}
template<class T>
int dp2csv(const vector<vector<T>>& dp, const string fname) {
	ofstream ofs(fname);
	if (ofs.fail()) { cerr << "cannot open file. :" + fname << endl; return -1; }
	for (auto dp_row : dp) {
		for (auto dp_cell : dp_row) {
			ofs << dp_cell << ",";
		}
		ofs << endl;
	}
	ofs.close();
	return 0;
}


Measured memory_bytes: 2164
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    N = int(lines.pop(0))
    A = list(map(int, lines.pop(0).split(' ')))
    res = 0
    for n in A:
        while( n % 2 == 0 ):
            n = int(n / 2)
            res += 1

    print(res)
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 4084
N = int(input())
S = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]

sCount = {}
for s in S:
    sCount[s] = S.count(s)

tCount = {}
for t in T:
    tCount[t] = T.count(t)

union = sCount.keys() & tCount.keys()
ans = sCount;
for i in union:
    ans[i] = sCount[i] - tCount[i]
    
if max(ans.values()) >= 0:
    print(max(ans.values()))
else:
    print(0)

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main(){

    double x,h;

    while(cin>>x>>h , x || h){
        printf("%lf\n",x * x + sqrt(x / 2.0 * x / 2.0 + h * h) * x / 2.0 * 4);
    }

    return 0;
}

Measured memory_bytes: 1232
import java.util.*;
import java.math.*;
import java.io.*;


public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        String s = sc.next();
        int a = Integer.parseInt(s.substring(0,2));
        int b = Integer.parseInt(s.substring(2,4));
        boolean yymm = b <= 12 && b >= 1;
        boolean mmyy = a <= 12 && a >= 1;
        if(yymm && mmyy) System.out.println("AMBIGUOUS");
        else if(yymm) System.out.println("YYMM");
        else if(mmyy) System.out.println("MMYY");
        else System.out.println("NA");
    }
}

Measured memory_bytes: 23124
from collections import Counter
n = int(input())
l = [{} for _ in range(n)]
for i in range(n):
    l[i] = Counter(input())
for i in range(26):
    w = chr(ord("a") + i)
    c = 51
    for j in range(n):
        c = min(c, l[j][w])
    print(w * c, end = "")
print()


Measured memory_bytes: 3316
def mod_max(loop, mod):
    if mod == 0:
        return 0
    loop_len = len(loop)
    mm = min(loop)
    for start in range(loop_len):
        current_sum = 0
        for i in range(mod):
            current_sum += loop[(start + i) % loop_len]
            mm = max(current_sum, mm)
    return mm


def main():
    n, k = map(int, input().split())
    p = [int(i) - 1 for i in input().split()]
    c = [int(i) for i in input().split()]

    seen = set()
    loop_list = []
    for start in range(n):
        v = start
        loop = []
        while v not in seen:
            seen.add(v)
            loop.append(c[v])
            v = p[v]
        seen.add(v)
        if loop:
            loop_list.append(loop)

    ans = min(c)
    for loop in loop_list:
        loop_len = len(loop)
        loop_num = k // loop_len
        loop_mod = k % loop_len
        loop_sum = sum(loop)
        ans = max(mod_max(loop, min(loop_len, k)), ans)
        if loop_num > 0:
            ans = max(loop_sum * loop_num + mod_max(loop, loop_mod), ans)
            ans = max(loop_sum * (loop_num - 1) + mod_max(loop, loop_len), ans)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74444
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll N;
    ll A[MAX_N + 1], B[MAX_N];
    ll answer = 0;

    cin >> N;
    rep(i, N + 1) cin >> A[i];
    rep(i, N) cin >> B[i];

    rep(i, N){
        if (B[i] >= A[i + 1] + A[i]) {
            answer += A[i + 1] + A[i];
            A[i + 1] = 0;
        }else if (B[i] >= A[i]) {
            answer += B[i];
            A[i + 1] -= B[i] - A[i];
        }else answer += B[i];
    }

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
using namespace std;
using ll = long long;

int n, k;
vector<int> a;
bool stop = false;

void imos() {
    vector<int> b(n + 1, 0);

    for(int i = 0; i < n; i++) {
        int l = max(0, i - a[i]);
        int r = min(n - 1, i + a[i]);

        b[l]++;
        b[r + 1]--;
    }

    for(int i = 1; i < n; i++) {
        b[i] += b[i - 1];
    }
    b.pop_back();
    
    if(a == b) stop = true;
    else a = b;
}



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

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

    for(int i = 0; i < k; i++) {
        imos();
        if(stop) break;
    }

    for(int i = 0; i < n; i++) {
        cout << a[i] << ' ';
    }
    cout << endl; 

    return 0;
}

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

int main(){
  int n,m;
  cin >> n;
  r(i,1000000){
    if(i*i>n){
      m=i-1;
      break;
    }
  }
  cout << m*m<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
//#include <string.h>

int main(void){
  int a,b,sum;
  scanf("%d %d", &a, &b);
  //sum = a*b;
  if(a<10 && b<10){
      printf("%d", a*b);
  }
  else
    printf("-1");

  return 0;
}


Measured memory_bytes: 1712
#include<stdio.h>
int main()
{
	int t=0, s=0,b, a=0,i,j;
	for (j = 0; j < 4; j++) {
		scanf("%d", &a);
		s = a + s;
	}
	for (i = 0; i < 4; i++) {
		scanf("%d", &b);
		t = b + t;
	}
	if (s> t) {
		printf("%d\n",s);
	}
	else {
		printf("%d\n", t);
	}
}

Measured memory_bytes: 2756
#include <iostream>
#include<algorithm>
#include <malloc.h>
#include<stack>
#include<map>
#include<stdio.h>
#include<set>
#define INF 0x3f3f3f3f
using namespace std;
int a[1000];
int main()
{
    int n;
     int sum=0;
     double ss;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    ss=sum*1.0/n;
    int j;
    double mins=INF;
    for(int i=0;i<n;i++)
    {
       double sss=(ss-a[i]);
        if(sss<0)
         sss=-sss;
        if(sss<mins)
        {
           j=i;
           mins=sss;
        }
    }
    printf("%d\n",j);

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	result := make(map[int]struct{})

	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		result[a] = struct{}{}
	}
	fmt.Println(len(result))
}


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

void input(vector<int>& rvnNum)
{
  int nSize;
  cin >> nSize;
  rvnNum.resize(nSize);

  for (int& rnElm : rvnNum)
    cin >> rnElm;
}

llong calcSignChgTimes(const vector<int>& cnrvnNum)
{ 
  vector<llong> vnTimes(2);

  for (int nParity = 0; nParity < vnTimes.size(); nParity++)
  {
    llong nTimes = 0;
    llong nSum   = 0;
    for (int n = 0; n < cnrvnNum.size(); n++)
    {
      nSum += cnrvnNum[n];
      if (n % 2 == nParity)
        if (nSum > 0);
        else
        {
          nTimes += 1 - nSum;
          nSum = 1;
        }
      else
        if (nSum >= 0)
        {
          nTimes += 1 + nSum;
          nSum = -1;
        }
        else;
    }
    vnTimes[nParity] = nTimes;
  }
  auto itElm = min_element(begin(vnTimes), end(vnTimes));
  return *itElm;
}

int main()
{
  vector<int> vnNum;

  input(vnNum);
  cout << calcSignChgTimes(vnNum) << endl;

  return 0;
}

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

const int nIMPOS = -1;
struct StDist
{
  int m_nDist;
  int m_nFromMeTo;

  StDist(int nDist) : m_nDist(nDist), m_nFromMeTo(0)
  { }
};

void fnInput(vector<vector<int>>& rvvnAdjcy, vector<StDist>& rvoDist)
{
  int nxSiz;
  cin >> nxSiz;

  rvvnAdjcy.resize(nxSiz + 1, vector<int>(nxSiz + 1, 0));
  for (int i = 0; i < nxSiz; ++i)
  {
    int nx, nySiz;
    cin >> nx >> nySiz;
    for (int j = 0; j < nySiz; ++j)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
  StDist oDist(nIMPOS);
  rvoDist.resize(nxSiz + 1, oDist);
}

void fnBreadthFirstSearch(const vector<vector<int>>& cnrvvnAdjcy, 
                          queue<int>& rqnBFSrch, vector<StDist>& rvoDist)
{
  while (rqnBFSrch.size())
  {
    int nx = rqnBFSrch.front(); rqnBFSrch.pop();
    if (rvoDist[nx].m_nFromMeTo)  continue; 

    rvoDist[nx].m_nFromMeTo = 1;
    for (int ny = 1; ny < cnrvvnAdjcy[nx].size(); ++ny)
      if (cnrvvnAdjcy[nx][ny])
      {
        int nDist = rvoDist[nx].m_nDist + 1;
        if (rvoDist[ny].m_nDist == nIMPOS)
          rvoDist[ny].m_nDist = nDist;
        else
          rvoDist[ny].m_nDist = min(rvoDist[ny].m_nDist, nDist);

        rqnBFSrch.push(ny);
      }
  }
}

void fnResult(const vector<StDist>& cnrvoDist)
{
  for (int i = 1; i < cnrvoDist.size(); ++i)
    cout << i <<  " " << cnrvoDist[i].m_nDist << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;
  queue<int>  qnBFSrch;
  vector<StDist> voDist;

  fnInput(vvnAdjcy, voDist);

  voDist[1].m_nDist = 0;
  qnBFSrch.push(1);
  fnBreadthFirstSearch(vvnAdjcy, qnBFSrch, voDist);
  fnResult(voDist);

  return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define YN(y, n, b) (b? y : n)
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    i32 N;
    cin >> N;
    Vec<i32> a(N + 1, 0);
    for (i32 i = 1; i * i <= N; i++) {
        for (i32 j = 1; j * j <= N; j++) {
            if (i * i + j * j + i * j >= N) break;
            for (i32 k = 1; k * k <= N; k++) {
                i32 index = i * i + j * j + k * k + i * j + j * k + k * i;
                if (index > N) break;
                a[index]++;
            }
        }
    }
    for (i32 i = 1; i <= N; i++) {
        cout << a[i] << endl;
    }
}


Measured memory_bytes: 3612
#include<stdio.h>
#include<string.h>

int main(){
  char s[2000001]={};
  unsigned int ans_a=0, ans_z;

  scanf("%s", s);
  while(s[ans_a] != 'A' && ans_a<=strlen(s)){
    ans_a++;
  }
  ans_z = strlen(s);
  while(s[ans_z] != 'Z' && ans_z >= 0){
    ans_z--;
  }
  printf("%d\n", ans_z-ans_a+1);
  return 0;
}

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


public class Main{
	static boolean[] isPrime = calcPrimes(50100);

	private static boolean[] calcPrimes(int n) {
		boolean[] result = new boolean[n];
		Arrays.fill(result, true);
		
		result[0] = false;
		for(int i = 0; i < result.length; i++) {
			if(result[i]) {
				for(int j = 2; (i + 1) * j < result.length; j++) {
					result[(i + 1) * j - 1] = false;
				}
			}
		}
		return result;
	}

	private static int goldbach(int n) {
		int result = 0;
		for(int i = 1; i <= n / 2; i++) if(isPrime[i-1] && isPrime[n-i-1]) result++;
		return result;
	}
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(true) {
			int in = sc.nextInt(); if(in == 0) break;
			System.out.println(goldbach(in));
		}
		sc.close();
	}
}

Measured memory_bytes: 42692
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws FileNotFoundException {

//    	File file = new File("src/in.txt");

        //コード
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int X = sc.nextInt();
    	sc.close();

    	if(X>=30) {
    		System.out.println("Yes");
    	} else {
    		System.out.println("No");
    	}

    }
}

Measured memory_bytes: 35644
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int ans=s.size();
    int si=s.size();
    for(int i=1;i<s.size();i++)
    {
        if(s[i]!=s[i-1])
        ans=min(ans,max(i,si-i));
    }
    cout<<ans;
}


Measured memory_bytes: 512
#include<stdio.h>
  
int main()
{
  int t[4][14];
  int n, i,j,c;
  char m, d;
  for(i=0; i < 4; i++){
    for(j=0; j < 14; j++){
      t[i][j]=0;
    }
  }
 scanf("%d", &c);
  for(i = 0; i < c; i++){
    scanf("%c", &d);
    scanf("%c %d", &m, &n);
    if(m == 'S'){
      t[0][n] = 1;
    }
    else if(m == 'H'){
      t[1][n] = 1;
    }
    else if(m == 'C'){
      t[2][n] = 1;
    }
    else if(m == 'D'){
      t[3][n] = 1;
    }
  }
  for(j=1; j < 14; j++){
    if(t[0][j] != 1){
      printf("S %d\n", j);
    }
  }
  
 for(j=1; j < 14; j++){
    if(t[1][j] != 1){
      printf("H %d\n", j);
    }
  }
  
 for(j=1; j < 14; j++){
    if(t[2][j] != 1){
      printf("C %d\n", j);
    }
  }
  
 for(j=1; j < 14; j++){
    if(t[3][j] != 1){
      printf("D %d\n", j);
    }
  }
 return 0;
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORD(i,b,a) for (int i = (int)(b) - 1; i >= a; --i)
#define REP(i,N) FOR(i,0,N)
#define st first
#define nd second
#define pb push_back

typedef pair<int, int> PII;
typedef long long LL;

const LL MOD = 1000000007;

LL get(const vector<int>& c) {
  LL res = 0;
  REP(i, c.size() - 1) {
    LL tmp = (c[i+1] - c[i]) * (LL)(i+1) % MOD;
    tmp = tmp * (c.size() - 1 - i) % MOD;
    res += tmp;
    res %= MOD;
  }
  return res;
}

vector<int> c[2];
int main() {
  int N, M;
  scanf("%d%d", &N, &M);
  int a;
  REP(i,N) {
    scanf("%d", &a);
    c[0].pb(a);
  }
  REP(i,M) {
    scanf("%d", &a);
    c[1].pb(a);
  }

  LL result = get(c[0]) * get(c[1]) % MOD;
  printf("%lld\n", result);
}


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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
#define int long long

string s;

int32_t main()
{
	IOS;
	cin >> s;
	int n = s.size();
	int cnt = 0;
	for (int i = 2; i < n-1; i++) {
		if (s[i] == 'C') cnt++;
	}
	int no = 1;
	for (int i = 1; i < n; i++) {
		if (s[i] != 'C') {
			if (s[i] >= 'A' && s[i] <= 'Z')
				no = 0;
		}
	}
	if (no && s[0] == 'A' && cnt == 1) cout << "AC" << endl;
	else cout << "WA" << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<string>
#include<algorithm>
#define REP(i,n) for(int i=0; i<int(n); i++)
using namespace std;
int main() {
	string S,T;
	int N;
	cin >> N >> S;
	if (N % 2 == 1) {
		cout << "No" << endl;
	}
	else {
		T = S.substr(0, N / 2);
		if (S == T + T) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 256