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

int main() {
  int N, M,sum;
  cin >> N;
  M = N;
  sum = 0;
  while(N >=1){
    sum += N %10;
    N /= 10;
  }
  if(M % sum == 0) cout << "Yes" << endl;
  else cout << "No" << endl;  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define clr1(arr) memset(arr,-1,sizeof(arr));
#define clr0(arr) memset(arr,0,sizeof(arr));
#define pi pair<int,int>
#define pii pair<int,pi>
#define aint(v) v.begin(),v.end()
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
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 ump gp_hash_table<int,int,custom_hash>
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
/*int **dp,in main function,int row,col;dp=new int*[n];rep(i,n)dp[i]=new int[m]*/
//**** Maths Section*******/
int power(int x,int y);
bool isPrime(int n);
int modInv(int a,int b);
int gcdExtended(int a,int b,int *x,int* y);
int mpower(int a,int b,int p);
/***************************/
int32_t main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  fastio
  int x,y;
  cin>>x>>y;
  if(y%2!=0)
  {
    cout<<"No\n";
    exit(0);
  }
  repre(i,0,x)
  {
    int j=x-i;
    int temp=2*i + 4*j;
    if(temp==y)
    {
      cout<<"Yes\n";
      exit(0);
    }
  }
  cout<<"No\n";
  return 0;
}

int modInv(int a, int m)
{
int x, y;
int g = gcdExtended(a, m, &x, &y);
int res = (x%m + m) % m;
return res;
}

int gcdExtended(int a, int b, int *x, int *y)
{
if (a == 0){
    *x = 0, *y = 1;
    return b;
  }
  int x1, y1;
  int gcd = gcdExtended(b%a, a, &x1, &y1);
  *x = y1 - (b/a) * x1;
  *y = x1;
  return gcd;
}

int mpower(int x, int y, int p)
{
int res = 1;
x = x % p;
while(y > 0){
    if(y & 1) res = (res*x) % p;
      y = y>>1;
      x = (x*x) % p;
    }
    return res;
}
int power(int x, int y)
{
int res = 1;
while (y > 0){
    if (y & 1) res = res*x;
      y = y>>1;
      x = x*x;
    }
    return res;
}

bool isPrime(int n)
{
if (n <= 1)  return false;
  if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
      int p=sqrt(n);
      for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
          return false;
      return true;
}


Measured memory_bytes: 3700
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
for i in range(n):
  ans+=b[a[i]-1]
  if i>0 and a[i]==a[i-1]+1:
    ans+=c[a[i-1]-1]
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cins(int, n, a);
    
    unordered_map<int, int> c;
  	c[-1] = 3;
    ll ans = 1;
	For(i, n){
      c[a[i]] ++;
      int r = c[a[i]-1];
      if(r <= 0){
        Cout(0);
        return 0;
      }
      ans = (ans * r) % MOD;
      c[a[i]-1] --;
    }
    Cout(ans);
}




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

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

  int64_t N;
  cin >> N;
  int64_t A[N];
  rep(i, N){
    cin >> A[i];
  }
  int64_t ans = 0;
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      ans += A[i]*A[j];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

int checkDigits(int n) {
  int result = 1;
  while (n >= 10) {
    ++result;
    n /= 10;
  }
  return result;
}

int main() {
  long long N;
  std::cin >> N;
  
  std::vector<std::vector<long long>> grid(10, std::vector<long long>(10, 0));
  
  for (int i=1; i<=N; ++i) {
    int digits = checkDigits(i);
    ++grid.at(static_cast<int>(i / std::pow(10, digits-1))).at(i % 10);
    //if (i >= 99 && i <= 200) std::cout << i << ": " << static_cast<int>(i / std::pow(10, digits-1)) << ", " << i % 10 << ", digits-1 = " << digits - 1 << "\n";
  }
  
  long long result = 0;
  for (int i=1; i<10; ++i) {
    for (int j=1; j<10; ++j) {
      result += grid.at(i).at(j) * grid.at(j).at(i);
    }
  }
  
  std::cout << result << "\n";
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include <functional>
#include <limits>


using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

class BIT{
	vector<int> bit;
	
public:
	
	BIT(){
	}
	
	BIT(int size){
		init(size);
	}
	
	void init(int size){
		bit.clear();
		bit.resize(size+1);
	}
	
	int sum(int i){
		int s = 0;
		while(i > 0){
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}

	void add(int i , int x){
		while(i < bit.size()){
			bit[i] += x;
			i += i & -i;
		}
	}

	int lower_bound(int w){
		if(w <= 0) return 0;
		int x = 0, t = 1;
		while(t*2 < bit.size()) t *= 2;
		
		for(int k = t; k > 0; k /= 2){
			if(x + k < bit.size() && bit[x + k] < w){
				w -= bit[x + k];
				x += k;
			}
		}
		return x + 1;
	}
};

// struct fast_io {
	// fast_io(){
		// cin.tie(nullptr);
		// ios::sync_with_stdio(false);
	// };
// };

signed main(){
	// cout<<fixed<<setprecision(10);
	
	int N, Q;
	string S;
	vector<BIT> bit(26);
	
	cin>>N;
	cin>>S;
	cin>>Q;
	
	for(int i = 0; i < 26; i++){
		bit[i].init(N+10);
	}
	
	for(int i = 0; i < N; i++){
		bit[S[i] - 'a'].add(i+1, 1);
	}
	
	for(int i = 0; i < Q; i++){
		int a, b;
		
		cin>>a>>b;
		
		
		if(a == 1) {
			char c;
			
			cin>>c;
			
			bit[S[b-1] - 'a'].add(b, -1);
			bit[c - 'a'].add(b, 1);
			S[b-1] = c;
			
		} else {
			int r;
			cin>>r;
			
			int con = 0;
			for(int j = 0; j < 26; j++){
				if(bit[j].sum(r) - bit[j].sum(b-1) >= 1) con++;
			}
			
			cout<<con<<endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 102528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

char c[2][3];

bool ok() {
  return c[0][0] == c[1][2] && c[0][1] == c[1][1] && c[0][2] == c[1][0];
}

int main () {
  rep(i,2)rep(j,3) cin >> c[i][j];

  cout << (ok() ? "YES" : "NO") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <deque>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
const long double PI = 3.14159265358979323846264338327950L;

// --------------------------------------
int a, b, h, m;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> a >> b >> h >> m;

  long double rad = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long double)m / 60.0);

  long double rsq = (long double)(a * a + b * b) - (long double)(2 * a * b) * cosl(rad);
  cout << fixed << setprecision(10) << sqrt(rsq) << endl;
}


Measured memory_bytes: 4072
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m;
string s;
Vi tg(3), v(8);

int calc(Vi use) {
    Vi cnt(4, 0), sum(4, 0);
    REP(i, n) {
        cnt[use[i]]++;
        sum[use[i]] += v[i];
    }
    if (*min_element(cnt.begin(), cnt.begin()+3) == 0) return 1e9;
    int res = 10 * (accumulate(cnt.begin(), cnt.begin()+3, 0) - 3);
    REP(i, 3) {
        res += abs(sum[i] - tg[i]);
    }
    return res;
}

int dfs(Vi use, int depth) {
    if (depth == n) {
        return calc(use);
    }
    int mini = 1e9;
    REP(i, 4) {
        use[depth] = i;
        mini = min(mini, dfs(use, depth+1));
    }
    return mini;
}

int main() {
    cin >> n >> tg[0] >> tg[1] >> tg[2];
    REP(i, n) cin >> v[i];

    std::cout << dfs(Vi(n, 0), 0) << '\n';

    return 0;
}


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

int main()
{
    string T;
    cin >> T;
    int ans=0;

    for (int i = 0; i < T.size(); i++)
    {
        if (T.at(i) == '?')
        {
            T.at(i) = 'D';
        }
    
        
        
    }

    cout << T;
    
}

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

using namespace std;
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];


int main (){
    int L, N;
    cin >> N >> L;
    string x[300];
    cinf(N, x);
    sort(x, x+N);
    for(int i = 0; i < N; i++){
        cout << x[i];
    }

    cout << endl;

    return 0;
}

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

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

    ll de=360;
    while(de%X != 0) de+=360;
    int ans=de/X;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
long long longpow(long long n, long long a, long long mod) {
  if (a == 0) return 1;
  if (a == 1) return n % mod;
  if (a % 2 == 1) return (n * longpow(n, a - 1, mod)) % mod;
  ll t = longpow(n, a / 2, mod) % mod;
  return (t * t) % mod;
}
int main() {
  int N;
  cin >> N;
  vector<ll> A(N + 2);
  REP(i, N + 1) cin >> A[i];
  ll ans = 0;
  vector<ll> L(N + 2), R(N + 2);
  L[N] = A[N], R[N] = A[N];
  for (int i = N - 1; i >= 0; i--) {
    L[i] = A[i] + (L[i + 1] + 1) / 2;
    R[i] = A[i] + R[i + 1];
  }
  if (L[0] != 1) {
    cout << -1 << endl;
    return 0;
  }
  ll current = 1;
  REP(i, N + 1) {
    ans += current;
    current -= A[i];
    current = min(current * 2, R[i + 1]);
  }

  cout << ans << endl;
}

Measured memory_bytes: 5640
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX_N = 1000;

int N, M;
int a[MAX_N];
int num[MAX_N];

int main() {
	cin >> N >> M;
	for(int i = 0; i < N; i++) cin >> a[i];
	fill(num, num + N, 0);
	for(int i = 0; i < M; i++){
		int b;
		cin >> b;
		for(int j = 0; j < N; j++){
			if(a[j] <= b){
				num[j]++;
				break;
			}
		}
	}
	cout << (max_element(num, num + N) - num) + 1 << endl;
	return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
  }
  int b=0;
  for(int i=0;i<n;i++){
    b+=a.at(i);
  }
  b/=n;
  int ansi=0;
  for(int i=0;i<n;i++){
    ansi+=(a.at(i)-b)*(a.at(i)-b);
  }
  b++;
  int ansj=0;
  for(int i=0;i<n;i++){
    ansj+=(a.at(i)-b)*(a.at(i)-b);
  }
  cout<<min(ansi,ansj)<<endl;
}
  
 

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;


int main(){
    string s; cin>>s;
    ll ans=0;
    for(int bit=0;bit<(1<<s.size()-1);bit++){
        bitset<9>b(bit);
        string ex="";
        ex+=s[0];
        for(int i=0;i<s.size()-1;i++){
            if(b.test(i))ex+='+';
            ex+=s[i+1];
        }
        string ss="";
        rep(i,ex.size()){
            if(ex[i]=='+'){
                ll num=stoll(ss);
                ans+=num;
                ss="";
            }
            else{
                ss+=ex[i];
            }
        }
        ll num=stoll(ss);
        ans+=num;

    }
    cout<<ans<<endl;
}








Measured memory_bytes: 256
n=int(input())
lis=input().split()
for i in range(n):
    lis[i]=int(lis[i])

a=0

if n==0:
    a=0
else:
    for i in range(n-1):
        if lis[n-i-2]>lis[n-i-1]:
            lis[n-i-2]-=1

    for i in range(n-1):
        if lis[i]>lis[i+1]:
            a+=1
            break

if a==0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 11740
#include "bits/stdc++.h"
using namespace std;
const int N=1e5+20;
int n,a[N];
multiset <int> ms;
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);

	for(int i=0;i<n;i++)
	{
		auto j=ms.lower_bound(a[i]);
		if(j!=ms.begin())
		{
			j--;
			ms.erase(j);
		}
		ms.insert(a[i]);
	}
	printf("%d",ms.size());
}

Measured memory_bytes: 5376
#include<iostream>
#include<math.h>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<string>
#include<string.h>
#include<map>
#include<vector>
#include<set>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main()
{
	long long q,h,s,d;
	long long n;
	cin>>q>>h>>s>>d>>n;
	long long m1=min(q*4,min(h*2,s));
	long long m2=min(m1*2,d);
	cout<<n/2*m2+n%2*m1;
	return 0;
}

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

long long f(vector<long long> m,vector<long long> c,long long n,long long w,vector<long long> &dp)
{
    long long mx=0;
    for (long long i=0;i<n;i++)
        for (long long j=w;j>=0;j--)
            if(m[i]<=j)
                dp[j]=max(dp[j],dp[j-m[i]]+c[i]);
    mx=*max_element(dp.begin(),dp.end());
    return mx;
}

int main()
{
    long long n,w;
    cin >> n >> w;
    vector<long long> m(n,0);
    vector<long long> c(n,0);
    vector<long long> dp(w+1,0);
    for (long long i=0;i<n;i++)
        cin >> m[i] >> c[i];
    cout << f(m,c,n,w,dp);
}


Measured memory_bytes: 1024
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
string ma[310];
int main()
{
	int n,out=0;
	cin>>n;
	rep(i,n) cin>>ma[i];
	rep(i,n){
		int f=1;
		rep(j,n) rep(k,n){
			if(ma[j][k]!=ma[k][j]) f=0;
		}
		out+=f*n;
		ma[n]=ma[0];
		rep(j,n) ma[j]=ma[j+1];
	}
	cout<<out<<endl;
}


Measured memory_bytes: 384
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      long n = sc.nextLong();

      System.out.println(recursive(n));
  }

  static Map<Long, Long> cache = new HashMap<>();
  
  private static long recursive(long n) {
    if(cache.containsKey(n))
      return cache.get(n);
    if(n == 1)
      return 1;

    long sum = recursive(n / 2) * 2 + 1;

    cache.put(n, sum);
    return sum;
  }
}

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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

PII x[510];

int a[510 * 510];

int n;

int main()
{
	gi(n);
	for (int i = 1; i <= n; ++i) gi(x[i].fi), x[i].se = i;
	int k = 1;
	sort(x + 1, x + n + 1);
	for (int i = 1; i <= n; ++i)
	{
		a[x[i].fi] = x[i].se;
		for (int j = 1; j < x[i].se; ++j)
		{
			while (a[k]) ++k;
			a[k] = x[i].se;
		}
		if (k > x[i].fi)
		{
			puts("No");
			return 0;
		}
	}
	k = 1;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = x[i].se + 1; j <= n; ++j)
		{
			while (a[k]) ++k;
			if (k < x[i].fi)
			{
				puts("No");
				return 0;
			}
			a[k] = x[i].se;
		}
	}
	puts("Yes");
	for (int i = 1; i <= n * n; ++i)
		printf("%d ", a[i]);
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
	int A, B;
	cin >> A >> B;
	int a[3] = { 1,2,3 };
	for (int i = 0; i < 3; i++) {
		if (a[i] != A && a[i] != B) {
			cout << a[i] << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
main()
{
	long long int h , m, h1, m1, t;
	cin >> h >> m >> h1 >> m1 >> t;
	long long int x = h*60+m, x1 = h1*60+m1;
	long long int y = x1-x;
	 cout << max(0LL, y-t);
	
	
	return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int n, l;
  cin >> n >> l;
  string s[n];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s, s + n);
  for (int i = 0; i < n; i++) {
    cout << s[i];
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <set>

using namespace std;

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

	set<int> s1({ 1, 3, 5, 7, 8, 10, 12 });
	set<int> s2({ 4, 6, 9, 11 });
	set<int> s3({ 2 });

	int x, y;
	cin >> x >> y;

	bool same = false;
	if (s1.find(x) != s1.end() && s1.find(y) != s1.end())
	{
		same = true;
	}
	else if (s2.find(x) != s2.end() && s2.find(y) != s2.end())
	{
		same = true;
	}
	else if (s3.find(x) != s3.end() && s3.find(y) != s3.end())
	{
		same = true;
	}

	if (same)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}

	return 0;
}


Measured memory_bytes: 3572
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a>>b;
    if (a==b){
        cout<<"Draw"<<endl;
    }
    else if(a==1 || b==1){
        if(a==1){
            cout<< "Alice" <<endl;
        }
        else{
            cout<< "Bob" <<endl;
        }
    }
    else if (b>a){
        cout<<"Bob"<<endl;
    }
    else{
        cout<<"Alice"<<endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int i, j;
  int c[3][3];
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      scanf("%d", &c[i][j]);
      if (i > 0) c[i][j] -= c[0][j];
    }
  }
  if (c[1][0] == c[1][1] && c[1][1] == c[1][2]
  &&  c[2][0] == c[2][1] && c[2][1] == c[2][2]) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 128
n,m=map(int,input().split())
li=[input().split() for _ in range(m)]

ac=[0]*(n+1)
wa=[0]*(n+1)

cnt_ac=0
cnt_wa=0

for p,s in li:
  p=int(p)
  if s=="WA":
    wa[p]+=1
  elif s=="AC" and ac[p]==0:
    ac[p]+=1
    cnt_ac+=1
    cnt_wa+=wa[p]
  else:
    continue

print(cnt_ac,cnt_wa)

Measured memory_bytes: 33696
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int floor_num(int n){
	int ret = 0, i;
	if(n == 0){
		return 1;
	}else if(n < 0){
		ret++;
	}
	for(i = 0;n != 0;i++){
		n /= 10;
	}
	ret += i;
	return ret;
}

char *int_to_str(int n){
	int i, tmp, len;
	char *str;
	if(n == 0){
		str = (char *)malloc(sizeof(char) * 2);
		strcpy(str,"0");
	}
	len = floor_num(n) + 1;
	str = (char *)malloc(sizeof(char) * len);
	str[len - 1] = '\0';
	if(n < 0){
		n = -n;
		str[0] = '-';
		for(i = len - 2;i > 0;i--){
			str[i] = '0' + n % 10;
			n /= 10;
		}
	}else{
		for(i = len - 2;i >= 0;i--){
			str[i] = '0' + n % 10;
			n /= 10;
		}
	}
	return str;
}

bool mirror_judge(int n){
	int len, i;
	char *str;
	str = int_to_str(n);
	len = strlen(str);
	if(len % 2 == 0){
		for(i = 0;i < len / 2;i++){
			if(str[len / 2 + i] != str[len / 2 - 1 - i]){
				break;
			}
		}
		if(i == len / 2){
			return true;
		}
	}else{
		for(i = 0;i < len / 2;i++){
			if(str[len / 2 + 1 + i] != str[len / 2 - 1 - i]){
				break;
			}
		}
		if(i == len / 2){
			return true;
		}
	}
	return false;
}

int main(void){
	int i, j, n, ans, a1 ,a2;
	scanf("%d",&n);
	for(i = n;;i++){
		if(mirror_judge(i)){
			break;
		}
	}
	a1 = i;
	for(i = n;;i--){
		if(mirror_judge(i)){
			break;
		}
	}
	a2 = i;
	if(a1 - n >= n - a2){
		ans = a2;
	}else{
		ans = a1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1032
def resolve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    check=[-1]*n
    iti=0
    rireki=[]
    while True:
        iti=a[iti]-1
        if check[iti]==0:
            mae=rireki.index(iti)
            Mae=rireki[:mae]
            Loop=rireki[mae:]
            roop=len(Loop)
            break
        rireki.append(iti)

        check[iti]=0
    if k <= mae:
        print(Mae[k-1]+1)
    else:
        k-=mae
        print(Loop[(k%roop)-1]+1)
resolve()

Measured memory_bytes: 96564
#include<stdio.h>
int main(){
int a[10001],b,i,d=0;
long int c=0;
while(1){
scanf("%d\n",&b);
if(b==0){
break;
}
for(i=0;i<b;i++){
scanf("%d",&a[i]);
c=c+a[i];
}
scanf("\n");
c=c/b;
for(i=0;i<b;i++){
if(c>=a[i]){
d++;
}
}
printf("%d\n",d);
c=0,d=0;
}
return 0;
}


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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector< vector<int> > Matrix;



int main() {
	ll n, m, i, j, k, ans;
	vector<ll>a;
	vector<pair<ll, ll> >bc;

	cin >> n >> m;

	SIZE(a, n);
	SIZE(bc, m);

	rep(i, n) {
		cin >> a[i];
	}
	rep(i, m) {
		cin >> j >> k;
		bc[i] = make_pair(k, j);
	}
	sort(ALL(a));
	sort(ALL(bc), greater<pair<ll,ll> >());

	j = 0;
	ans = 0;
	rep(i, m) {
		if (j >= n)break;
		if (a[j] > bc[i].first)
			ans += a[j++];
		else{
			rep(k, bc[i].second) {
				if (j >= n)break;
				if (a[j] < bc[i].first) {
					ans += bc[i].first;
					j++;
				}
				else {
					break;
				}
			}	
		}
	}
	repj(i, j, n) {
		ans += a[i];
	}

	cout << ans;

	return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// 1. 入力データの処理
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int v[] = new int[N];
		int c[] = new int[N];
		for(int i = 0; i < N; i++) {
			v[i] = sc.nextInt();
		}
		for(int i = 0; i < N; i++) {
			c[i] = sc.nextInt();
		}
		sc.close();

		int sum = 0;
		for(int i = 0; i < N; i++) {
			if(v[i] > c[i]) {
				sum += v[i] - c[i];
			}
		}

		System.out.println(sum);
	}

}


Measured memory_bytes: 22740
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string.h>
#include <queue>
#include <functional>
const int INF =1e5;
const int MOD = 1e9 + 7;
using namespace std;
typedef pair<int,int> P;
typedef long long lint;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fill(x,y) memset(x,y,sizeof(x))
#define all(x) (x).begin(),(x).end()
#define pb push_back

int main(){
    int n;
    cin>>n;
    char a;
    bool flag=false;
    rep(i,n){
        cin>>a;
        if(a=='Y'){
            flag=true;
            break;
        }
    }
    if(flag){
        cout<<"Four"<<endl;
    }else{
        cout<<"Three"<<endl;
    } 
    return 0;

}


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

from collections import deque
q = deque([0])
pre = {}
while True:
    mon = q.popleft()
    if mon == n:
        ans = 0
        while True:
            mon = pre[mon]
            ans += 1
            if mon == 0:
                break
        break
    six = 1
    while six <= n - mon:
        if six + mon not in pre:
            q.append(six + mon)
            pre[six + mon] = mon
        six *= 6
    nine = 9
    while nine <= n - mon:
        if nine + mon not in pre:
            q.append(nine + mon)
            pre[nine + mon] = mon
        nine *= 9

print(ans)

Measured memory_bytes: 17160
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n],i;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int dp[n]={0};
	dp[1]=abs(a[0]-a[1]);
	for(i=2;i<n;i++)
	{
		dp[i]=1e6;
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1024
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define F first
# define S second
# define pb push_back
# define all(x) x.begin(), x.end()

using namespace std;

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

const int N = 5e5+5;

void solve(){
	int n;
	cin>>n;
	int x=ceil(n*1.0/1.08);
	int j=x*1.08;
	//cerr<<j<<' '<<x<<' ';
	if(j==n)cout<<x<<' ';
	else cout<<":(";
}

int main(){
	ios_base :: sync_with_stdio(false);
	int test = 1; 
	//cin >> test;	
	while (test--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
const int N = 1e5 + 10;
int a[N], dp[N];
 
int main() {
  	int n;
  	cin >> n;
  	for (int i = 0; i < n; i++)
      	cin >> a[i];
  	dp[n] = -1;
  	for (int i = n - 1; i >= 0; i--)
      	if(a[i] >= a[i + 1])
        	dp[i] = dp[i + 1] + 1;
  		else
          dp[i] = 0;
  	int ans = 0;
  	for (int i = 0; i < n; i++)
      	ans = max(ans, dp[i]);
  	cout << ans << endl;
  	return 0;
}

Measured memory_bytes: 1024
fun main(args: Array<String>) {
    val n = read().toInt()

    val ans = IntArray(n){0}
    repeat(n-1) {
        ans[read().toInt()-1]++
    }

    ans.forEach {
        println(it)
    }
}

@JvmField val INPUT = System.`in`
@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
@JvmField var _ln = ""
@JvmField var _lnPtr = 0
fun read(): String {
    while (_lnPtr >= _ln.length) {
        _ln = readLine() ?: return ""
        _lnPtr = 0
    }
    var j = _ln.indexOf(' ', _lnPtr)
    if(j < 0) j = _ln.length
    val res = _ln.substring(_lnPtr, j)
    _lnPtr = j + 1
    return res
}

Measured memory_bytes: 59168
n,m=map(int,input().split())
g=[[] for x in range(n)]
for c in range(m):
    a,b= map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

ans_list=[-1]*n

queue=[0]

while queue:
    qi=queue.pop(0)
    for gi in g[qi]:
        if ans_list[gi]==-1:
            queue.append(gi)
            ans_list[gi]=qi

print("Yes")
for ans in ans_list[1:]:
    print(ans+1)

Measured memory_bytes: 34352
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int a[300001];
int main(){
    int n;
    cin>>n;
    rep(i,3*n) cin>>a[i];
    priority_queue<int,vector<int>,greater<int> > pq1;
    priority_queue<int> pq2;
    ll sum1=0,sum2=0;
    vector<ll> f(n+1),b(n+1);
    rep(i,n){
        pq1.push(a[i]);
        sum1+=a[i];
    }
    FOR(i,2*n,3*n){
        pq2.push(a[i]);
        sum2+=a[i];
    }
    ll ans=-1000100010001000;
    f[0]=sum1;
    b[n]=sum2;
    FOR(i,n,2*n){
        pq1.push(a[i]);
        ll p=pq1.top();pq1.pop();
        f[i-n+1]=f[i-n]+a[i]-p;
        pq2.push(a[3*n-i-1]);
        ll q=pq2.top();pq2.pop();
        b[2*n-i-1]=b[2*n-i]+a[3*n-i-1]-q;
    }
    FOR(i,0,n+1){
        ans=max(ans,f[i]-b[i]);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
	int h,a;
	cin >> h;
	cin >> a;
	int c;
	c=h;
	int temp,flag=0;
	for(int i=0; ;i++)
	{
		temp=h-a;
		h=temp;
			flag=flag+1;
		if(h<=0) break;
	}
	
	cout << flag;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
  int N, K, i, a[51], b, r = 0;
  
  scanf("%d %d", &N, &K);
  
  a[0] = 0;
  for (i = 1; i <= N; i++){
    scanf("%d", &b);
    for (int j = i - 1; j >= 0; j--){
      if(b > a[j]){
        a[j + 1] = b;
        break;
      } else {
        a[j + 1] = a[j];
      }
    }
  }
  
  for (i = 0; i < K; i++){
    r += a[N - i];
  }
  printf("%d\n", r);
  return 0;
}

Measured memory_bytes: 256
import sys
import bisect
input = sys.stdin.readline

N, M  = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(M)]
P = [int(v) for v in input().split()]

ans = 0
for i in range(1 << N):
    s = []
    
    for j in range(N):
        if (i >> j) & 1:
            s.append(j)

    cc = 0
    for j in range(M):
        v = L[j][1:]
        
        c = 0
        for k in v:
            if k - 1 in s:
                c += 1
                
        if c % 2 == P[j]:
            cc += 1
            
    if cc == M:
        ans += 1
        
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<vector<int64_t>> a(n);
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    a.at(i)={x,i};
  }
  sort(a.begin(),a.end(),greater<vector<int64_t>>());
  vector<int64_t> c(n,0);
  int64_t m=a.at(0).at(1);
  for(int i=1;i<n;i++){
    c.at(m)+=(a.at(i-1).at(0)-a.at(i).at(0))*i;
    m=min(m,a.at(i).at(1));
  }
  c.at(m)+=a.at(n-1).at(0)*n;
  for(int i=0;i<n;i++)
    cout<<c.at(i)<<endl;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
int a[25],b[25],c[25],ans,n;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
	    cin>>a[i];
	for(int i=1;i<=n;i++)
	    {
	    	cin>>b[i];
	    	ans+=b[i];
		}
	    
	for(int i=1;i<n;i++)
	    cin>>c[i];
	for(int i=1;i<n;i++)
	    {
	    	if(a[i]==a[i+1]-1)
	    	    ans+=c[a[i]];
		}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    set<int> tmp;
    multiset<int> s;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (tmp.count(x)) {
            s.insert(-x);
            tmp.erase(x);
        } else {
            tmp.insert(x);
        }
    }
    if (s.size() < 2) {
        cout << 0 << endl;
        return 0;
    }
    int x = *s.begin();
    s.erase(s.begin());
    int y = *s.begin();
    cout << (ll) x * y << endl;
}


Measured memory_bytes: 4992
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = b[a[0] - 1]
for i in range(1,n):
    if a[i] - a[i-1] == 1:
        ans += c[a[i-1] - 1]
    ans += b[a[i] - 1]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#define fr(i,b,e) for(int i=(b); i<(e); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long int li;
typedef long long ll;
 
int chk(vector<int> a){
    int n=a.size();
    fr(i,0,n){
        cout << a.at(i);
    }
    cout << endl;
}
 
int gcd(int a,int b){ //a>b
    int tmp=a%b;
    a=b;
    b=tmp;
    if(b!=0){
        return gcd(a,b);
    }else{
        return a;
    }
}
 
ll power(ll a,ll n){
    if(n==1){
        return a;
    }
    else if(n&1==1){
        --n;
        return power(a,n)*a;
    }else{
        n=n>>1;
        return power(a,n)*power(a,n);
    }
}
 
int main(void){
 
    string s;
    cin >> s;
    bool a=0,b=0;
    if(s.at(0)=='0' && s.at(1)!='0'){
        a=1;
    }else if(s.at(0)=='1'){
        if(s.at(1)=='0' || s.at(1)=='1' || s.at(1)=='2')
        a=1;
    }else{

    }
 
    if(s.at(2)=='0' && s.at(3)!='0'){
        b=1;
    }else if(s.at(2)=='1'){
        if(s.at(3)=='0' || s.at(3)=='1' || s.at(3)=='2')
        b=1;
    }else{

    }
 
    if(a==1 && b==1){
        cout << "AMBIGUOUS" << endl;
    }else if(a==1 && b==0){
        cout << "MMYY" << endl;
    }else if(a==0 && b==1){
        cout << "YYMM" << endl;
    }else{
        cout << "NA" << endl;
    }
}

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

int main()
{
    int i;
    float n, flag=0;
    cin>>n;

    for(i=1; i<=n; i++)
    {
        if(i%2 != 0)
            flag++;
    }

    printf("%.10f", flag/n);

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a, b;
  a = 1;
  b = 0;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  while (true) {
    a = vec.at(a - 1);
    b++;
    if (a == 2) {
      cout << b << endl;
      break;
    }
    else if (b == N) {
      cout << -1 << endl;
      break;
    }
  }
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <chrono>
#include<map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef unsigned int ui;
typedef unsigned short us;
typedef unsigned long long ull;

using namespace std;


int inputValue() {
  int a;
  scanf("%d", &a);
  return a;
};
void inputVector(vector<int>* v) {
  int a;
  while (cin >> a) {
    if (a == -1)break;
    v->push_back(a);
  }
};

void inputVector(vector<int> * p, int a) {
  p->clear();
  p->shrink_to_fit();
  rep(i, a) {
    int input;
    cin >> input;
    p->push_back(input);
  }
}

void inputVector2(vector<vector<int>>& v, ui r, ui c) {
  int temp;
  for (size_t i = 0; i < r; i++)
  {
    for (size_t j = 0; j < c; j++)
    {
      scanf("%d", &temp);
      v[i][j] = temp;
    }
  }
}
void inputVector3(vector<int>* v0, vector<int>* v1) {
  int a;
  unsigned short count = 0b0;
  while (cin >> a) {
    if (a == -1)break;
    if (count)v0->push_back(a); else v1->push_back(a);
    count = count ^ 1;
  }
};

template <typename T>
void output(T a, int precision) {
  if (precision > 0) {
    cout << setprecision(precision) << a << "\n";
  }
  else {
    cout << a << "\n";
  }
}

template<template <class...> class Map, typename T_0, typename T_1, typename... Args>
void inputMap(Map<T_0, T_1, Args...>& mp) {
  T_0 a;
  T_1 b;
  while (cin >> a && a != -1) {
    cin >> b;
    mp.insert(make_pair(a, b));
  }
}
template<template <class...> class Vec1, template <class...> class Vec2, typename T, typename... Args1, typename... Args2>
void input2dPairVector(Vec1<Vec2<T, Args2...>, Args1...>& vec) {
  T a;
  T b;
  while (cin >> a && a != -1) {
    cin >> b;
    vec.push_back(vector<T>({ a - 1, b - 1 }));
  }
}
template<template <class...> class Vec1, template <class...> class Vec2, typename T, typename... Args1, typename... Args2>
void input2dPairVector(Vec1<Vec2<T, Args2...>, Args1...>& vec, ull size) {
  T a;
  T b;
  for (size_t i = 0; i < size; i++) {
    scanf("%d %d", &a, &b);
    vec.push_back(vector<T>({ a - 1, b - 1 }));
  }
}

template<template <class...> class Vec, typename T, typename U, typename... Args>
void numberToBoolenVector(Vec<T, Args...>& vec, U a) {
  ui i = 0;
  T amari;
  do {
    if (a % (ull)pow(2, i + 1)) {
      amari = 1;
      vec.push_back(amari);
      a -= (ull)pow(2, i);
    }
    else {
      amari = 0;
      vec.push_back(amari);
    }
    i++;
  } while (a);
}

template<template <class...> class Vec, typename T, typename... Args>
ull boolenVectorToNumber(Vec<T, Args...>& vec) {
  ull r = 0;
  for (size_t i = 0; i < vec.size(); i++)
  {
    r += vec[i] * (ull)pow(2, i);
  }
  return r;
}

int main(int argc, const char * argv[]) {
  int a, b;

  scanf("%d %d",&a, &b);
  if (a >= 13) {
    printf("%d\n", b);
  }
  else if (a >= 6) {
    printf("%d\n", b / 2);
  }
  else {
    printf("0\n");
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(a,b,c) for((a)=(b);(a)<(c);(a)++)

using namespace std;

int main(){
    vector<string> ds = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string d;
    cin >> d;
    int i;
    REP(i,0,ds.size()){
        if(d == ds[i]){
            cout << 7 - i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		double r = scan.nextDouble();
		final double PI = 3.14159265358979;
		double a= PI*r*r,c=2*PI*r;
		System.out.println(String.format("%.8f", a) + " " + String.format("%.8f", c));
	}
}


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

int main(){
    int N;
    string S;
    cin >> N >> S;
    vector<int> W(N+1),E(N+1);
    for(int i=0;i<N;i++){
        if(S[i]=='W'){
            W[i+1]=W[i]+1;
            E[i+1]=E[i];
        }else{
            W[i+1]=W[i];
            E[i+1]=E[i]+1;
        }
    }
    ll ans = INF;
    for(int i=0;i<N;i++){
        ll left = W[i];
        ll right = E[N]-E[i+1];
        //cout << left + right << endl;
        ans = min(ans,left+right);
    }
    cout << ans << endl;
    return 0;
}

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

#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long int lli;
const int MOD = 1e9+7;

int main()
{
    fio;
    int h,w;
    cin>>h>>w;
    char g[h][w];
    int dp[h][w];
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++) cin>>g[i][j];
    }
    dp[0][0] = g[0][0] == '.' ? 1 : 0;
    for(int i=1;i<h;i++)
    {
        if(dp[i-1][0] == 0) dp[i][0] = 0;
        else if(g[i][0] == '#') dp[i][0] = 0;
        else dp[i][0] = 1;
    }
    for(int j=1;j<w;j++)
    {
        if(dp[0][j-1] == 0) dp[0][j] = 0;
        else if(g[0][j] == '#') dp[0][j] = 0;
        else dp[0][j] = 1;
    }
    for(int i=1;i<h;i++)
    {
        for(int j=1;j<w;j++)
        {
            if(g[i][j] == '#') dp[i][j] = 0;
            else dp[i][j] = (dp[i-1][j]%MOD + dp[i][j-1]%MOD)%MOD; 
        }
    }
    // for(int i=0;i<h;i++)
    // {
    //     for(int j=0;j<w;j++) cout<<dp[i][j]<<" ";
    //     cout<<endl;
    // }
    cout<<dp[h-1][w-1]<<endl;
    cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s" << "\n";
    return 0;
}

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

bool linearSearch(vector<int> S, int key) {
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == key) {
      return true;
    }
  }
  return false;
}

int main() {
  int n;
  cin >> n;
  vector<int> S(n);
  for (int i = 0; i < n; i++) {
    cin >> S[i];
  }
  int q;
  cin >> q;
  int ans = 0;
  int key;
  for (int i = 0; i < q; i++) {
    cin >> key;
    if (linearSearch(S, key)) {
      ans++;
    }
  }
  cout << ans << endl;
}


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

int main() {
    string line;
    getline(cin, line);
    for (int i = 0; i < line.size(); i++) {
        if (line[i] == '\n') break;
        if (isalpha(line[i])) {
            char d = isupper(line[i]) ? tolower(line[i]) : toupper(line[i]);
            cout << d;
            continue;
        }

        cout << line[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3216
import java.io.*;
import java.util.*;

class Main {

    void solve(){

	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt(), k = sc.nextInt();

	int res = 0;
	int row = 1;
	int w = 0;
	while ( n >= row ) {
	    if ( row*k >= w ) {
		++res;
		w += row;
		n -= row;
	    }
	    else if ( n >= row+1 ) ++row;
	    else break;
	}
    
	System.out.println( res );
    }

    public static void main(String[] a) { new Main().solve(); }
}



Measured memory_bytes: 26372
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPD(i,n) for(int i=(n)-1;i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
#define TLE() cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms.\n";
const ll MOD = 1E9+7;
const ll IINF = 1E18;
const int INF = 1e9;
const double EPS = 1E-9;
const double PI = atan(1.0) * 4.0;
template<class T> T getbit(T s, int i) {return s>>i&1;}
template<class T> void flipbit(T& s, int i) {s^=(1LL<<i);}
constexpr int cntbit(ll x) {return __builtin_popcountll(x);}
constexpr int lg2(ll x) {return __lg(x);} // return int(log2(x))
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
ll fpow(ll a,ll p){ll res=1LL;while(p){if(p&1LL) res=res*a%MOD;a=a*a%MOD;p>>=1LL;} return res;}

const int N=1e5+5;
int n;
string s;

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>s;
	n=sz(s);
	bool ok=s[n-1]=='0';
	string t=s.substr(0,n-1);
	reverse(t.begin(),t.end());
	bool zero=true;
	REP(i,n-1)
		zero&=s[i]=='0';
	ok&=!zero;
	if(!ok||!(t==s.substr(0,n-1)))
		exit(puts("-1")*0);
	vector<int> pos;
	REP(i,n)
		if(s[i]=='1') pos.pb(i);
	int id=1;
	REP(i,sz(pos))
		cout<<id<<' '<<id+1<<'\n',++id;
	FOR(i,1,sz(pos)-1)
		REP(j,pos[i]-pos[i-1]-1)
			cout<<i+1<<' '<<id+1<<'\n',++id;
}



Measured memory_bytes: 4052
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second


int main() {
	ll n, ans = INF;
	cin >> n;
	for (int i = 1;i < n;i++) {
		ll m = n - i, sum = 0, j = i;
		while (true) {
			if (j == 0)break;
			sum += j % 10;
			j /= 10;
		}
		while (true) {
			if (m == 0)break;
			sum += m % 10;
			m /= 10;
		}
		ans = min(ans, sum);
	}
	cout << ans << endl;
	return 0;
}


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

typedef long long ll;
const int _ = 2e5 + 10;
const int __ = 4000 + 10;
const int delta = 2000 + 1;
const ll mod = 1e9 + 7;
int N;
ll f[__][__], fac[__ << 1], facinv[_ << 1];
struct node {
	int x, y;
} p[_];

ll ksm(ll a, ll b) {
	ll ret = 1;
	for ( ; b; b >>= 1) {
		if (b & 1) ret = ret * a % mod;
		a = a * a % mod;
	}
	return ret;
}

inline void init(int lim = 8010) {
	fac[0] = 1;
	for (int i = 1; i <= lim; ++i) fac[i] = 1ll * fac[i - 1] * i % mod;
	facinv[0] = 1, facinv[lim] = ksm(fac[lim], mod - 2);
	for (int i = lim - 1; i >= 1; --i) facinv[i] = 1ll * facinv[i + 1] * (i + 1) % mod;
}

ll C(ll n, ll m) { return fac[n] * facinv[m] % mod * facinv[n - m] % mod; }

signed main() {
	init();
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		p[i] = {x, y};
		f[-x + delta][-y + delta] += 1;
	}
	for (int i = 1; i <= delta * 2; ++i)
		for (int j = 1; j <= delta * 2; ++j)
			f[i][j] = (f[i][j] + f[i - 1][j] + f[i][j - 1]) % mod;
	ll ans = 0;
	for (int i = 1; i <= N; ++i) {
		ans = (ans + f[p[i].x + delta][p[i].y + delta]) % mod;
		ans = (ans - C(2 * p[i].x + 2 * p[i].y, 2 * p[i].x) + mod) % mod;
	}
	ans = ans * ksm(2, mod - 2) % mod;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 128000
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f

using namespace std;
using namespace __gnu_pbds;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<int,null_type, less<int>,rb_tree_tag,tree_order_statistics_node_update>   ordered_set;
const int N=2e5+1, mod=1e9+7;

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	string s; bool can=1;
	cin>>s;	
	for(int i=0;i<(int)s.length();i++){
		if(s[i]=='R' && i&1 ) can=false;
		if(s[i]=='L' && !(i&1) ) can=false;
	}
	cout<<(can?"Yes":"No");
}


Measured memory_bytes: 256