akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>

#define MAX_LEN (100)

using namespace std;

int is_only_lower(char str[]);

int main()
{
    char* s = new char[MAX_LEN + 1];
    char* p = new char[MAX_LEN + 1];

    do {
        cin >> s;
        cin >> p;
    } while (strlen(p) > strlen(s) || (strlen(p) < 1 || strlen(p) > 100) ||
	    (strlen(s) < 1 || strlen(s) > 100) ||
	    (is_only_lower(s) == 0 || is_only_lower(p) == 0));

    char* s2 = new char[MAX_LEN * 2 + 1];

    strcpy(s2, s);
    strcat(s2, s);

    if (strstr(s2, p) != NULL) {
        cout << "Yes" << endl;   
    } else {
        cout << "No" << endl;
    }

    delete[] s;
    delete[] p;
    delete[] s2;

    return (0);
}

int is_only_lower(char str[])
{
    int i;

    for (i = 0; str[i] != '\0'; i++) {
         if (str[i] < 'a' || str[i] > 'z') {
	     break;
         } else {
	     ;
         }
    }

    if (str[i] == '\0') {
        return (1);
    } else {
        return (0);
    }
}

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

void dfs(ll x,bool chk3,bool chk5,bool chk7){
  if(x<= n){
    if(chk3 && chk5 && chk7){
      ans++;
    }
    dfs(10 * x + 3,true,chk5,chk7);
    dfs(10 * x + 5,chk3,true,chk7);
    dfs(10 * x + 7,chk3,chk5,true);
  }
}

int main()
{
  cin >> n;
  dfs(0,false,false,false);
  cout << ans << endl;
}

Measured memory_bytes: 256
// g++ temp.cpp
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <string>
#include <climits>
using namespace std;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EACH(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
const unsigned long long MOD = 100000000000000000;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
void solve(){
  ll a=0,b=0,c=0,d=0;
  string s;
  cin>>s;
  
  for(ll i=0;i<s.size();i++){
    if(s[i]=='N'){
      a++;
    } else if(s[i]=='E'){
      b++;
    }else if(s[i]=='S'){
      c++;
    }else if(s[i]=='W'){
      d++;
    }
  }
  if((a>0&&b>0&&c>0&&d>0)||(a>0&&b==0&&c>0&&d==0)||(a==0&&b>0&&c==0&&d>0)){
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }
  return ;
}
int main(){
  solve();
  return 0;
}

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








int main(){

int n;
cin>>n;
vector<int> a(n),b(n);
for(int i=0;i<n;i++)
    cin>>a[i];
for(int i=0;i<n;i++)
    cin>>b[i];
reverse(b.begin(),b.end());
int el=-1;
for(int i=0;i<n;i++){
    if(a[i]==b[i]){
        el=a[i];
    }
}
if(el==-1){
    cout<<"Yes"<<endl;
    for(auto x: b)
        cout<<x<<" ";
    cout<<endl;
}
else{
queue<int> q1;
queue<int> q2;
for(int i=0;i<n;i++){
    if(a[i]==el && b[i]==el)
        q2.push(i);
    if(a[i]!=el && b[i]!=el){
        q1.push(i);
    }
}
if(q2.size()>q1.size()){
    cout<<"No"<<endl;
}
else{
cout<<"Yes"<<endl;
while(!q2.empty()){
    int i1=q2.front();
    q2.pop();
    int i2=q1.front();
    q1.pop();
    swap(b[i1],b[i2]);
}
for(auto x: b)
    cout<<x<<" ";

cout<<endl;
}
}

}


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

int main(){
    int n;
    cin >>n;
    int a[n];

    for (int i=0; i<n; i++){
        cin >> a[i];
    }
    for (int i=n-1; i>0; i--){
        cout << a[i] << " ";
    }
    cout << a[0] << endl;
}



Measured memory_bytes: 3096
import java.util.Scanner;

//AtCoder Beginner Contest 154
//D	Dice in Line
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		int[] p = new int[N];
		for (int i = 0; i < N; i++) {
			p[i] = Integer.parseInt(sc.next());
		}
		sc.close();

		int maxSum4 = 0;
		int sum4 = 0;
		for (int i = 0; i < N; i++) {
			if (i < K) {
				sum4 += p[i];
				maxSum4 = sum4;
			} else {
				sum4 += p[i];
				sum4 -= p[i-K];
				maxSum4 = Math.max(sum4, maxSum4);
			}
		}
		double ans = (maxSum4 + K) / 2.0d;
		System.out.println(ans);
	}
}


Measured memory_bytes: 59172
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H, W;
  cin >> H >>W;

  for(int i=0; i<H+2; i++){    
    for(int j=0; j<W+2; j++){
      char a;
      if(i==0||i==H+1||j==0||j==W+1) cout << '#';
      else {
        cin >> a;
        cout << a;
      }
    }
    cout << endl;
  }
}

        
        
  
  


Measured memory_bytes: 256
#include <iostream>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5+2;
const int INF=1e9;

int main(){
	int N,K;
	cin>>N>>K;
	int l=0;
	int x[MAX];
	rep(i,N){
		cin>>x[i];
		if(x[i]<=0)l++;
	}
	int r=N-l;
	
	int ans=INF;
	if(l>=K)ans=min(ans,(-1)*x[l-K]);
	if(r>=K)ans=min(ans,x[l-1+K]);
	int s=1;
	while(s<=l){
		if((K-s)>r){
          s++;
          continue;
        }
		ans=min(ans,(-2)*x[l-s]+x[l-1+K-s]);
		s++;
	}
	int t=1;
	while(t<=r){
		if((K-t)>l){
          t++;
          continue;
        }
		ans=min(ans,2*x[l-1+t]-x[l-K+t]);
      	t++;
	}
	cout<<ans;
} 

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

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

fn main() {
    let s: String = read();
    let t: String = read();

    println!("{}{}", t, s);
}

Measured memory_bytes: 4352
import java.util.Scanner;

/**
 * 9x9
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();

            if (A < 10 && B < 10) {
                System.out.println(A * B);
            } else {
                System.out.println(-1);
            }
        }
    }

}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}cout<<endl;}

int main() {
    ll a,b,c;
    cin>>a>>b>>c;
    if(c==0) {
        pr(b);
        return 0;
    }
    ll sum =1;
    c--;
    while(b>=1 && c>=1){
        sum++;
        sum++;
        b--;
        c--;
    }
    if(b==0) {
        pr(sum+min(a,c));
        return 0;
    }
    pr(sum + b);
    return 0;
}



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

using namespace std;

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

    int c, t;
    int ans = INT16_MAX;
    for (int i = 0; i < N; ++i) {
        cin >> c >> t;
        if (t <= T) ans = min(ans, c);
    }

    if (ans == INT16_MAX) {
        cout << "TLE" << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}


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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanLLInt(X);
    constexpr ll N = 121;
    unordered_map<int, ll> V;
    for (ll i = -N + 1; i < N; i++){
        V[i] = i * i * i * i * i;
    }
    for (auto& a : V){
        for (auto& b : V){
            if (a.second - b.second == X){
                cout << a.first << " " << b.first << endl;
                return 0;
            }
            if (b.second - a.second == X){
                cout << b.first << " " << a.first << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3708
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,pair<ll,ll> >
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#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

const ll N = 109;
ll n,m,x,y;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n>>m;
    y = 0;
    m /= 1000;
    m -= n;
    while(m - y*4 >= 0){
        if((m - 4*y)%9 == 0){
            x = (m - 4*y)/9;
            if(n - x - y >= 0){
                cout<<x<<" "<<y<<" "<<n - x - y;
                return 0;
            }
        }
        y++;
    }
    cout<<-1<<" "<<-1<<" "<<-1;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n ; i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n]=1;
  return res;
}
int main(){
  ll N; cin>>N;
  ll MA = 3501;
  rep(n,1,MA)rep(h,1,MA){
    ll s = 4*n*h - n*N - N*h;
    ll t = N*n*h;
    if(t==0 || s==0) continue;
    if(t%s==0 && t/s>0){
      cout << n <<" "<<h<<" "<<t/s<<endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

ll LCM[1 << 20];
ll dp[1<<20];
ll n, m;
ll a[20];
long double p[20];

ll MyLCM(ll a, ll b) {
    ll g = __gcd(a, b);
    if(a / g > 2e18 / b) return 2e18;
    else return a / g * b;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++) {
        cin >> p[i];
        p[i] /= 100;
    }
    for(int bits = 0; bits < (1 << n); bits++) {
        LCM[bits] = 1;
        for(int i = 0; i < n; i++) {
            if(bits & (1 << i)) {
                LCM[bits] = MyLCM(LCM[bits], a[i]);
            }
        }
        dp[bits] = m / LCM[bits];
        //cerr << bits << " " << LCM[bits] << " " << dp[bits] << endl;
    }
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < (1 << n); j++) {
            if(!(j & (1 << i))) {
                dp[j] -= dp[j | (1 << i)];
            }
        }
    }
    for(int bits = 0; bits < (1 << n); bits++) {
        //cerr << bits << " " << LCM[bits] << " " << dp[bits] << endl;
    }
    long double ans = 0.0;
    for(int bits = 0; bits < (1 << n); bits++) {
        long double compliment = 1;
        for(int i = 0; i < n; i++) {
            if(bits & (1 << i)) compliment *= (1 - p[i]);
        }
        ans += (1 - compliment) * dp[bits];
    }
    cout << fixed << setprecision(100) << ans << endl;
    return 0;
}


Measured memory_bytes: 19664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N;
ll A, B, C, D;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> A >> B >> C >> D;
  int yes = 0;
  if (C == D) {
    yes = (B - A) % C == 0;
    yes &= (B - A) / C <= N - 1;
  } else {
    for (int i = 0; i < N; i++) {
      ll rem = B - (A + C * i - C * (N - 1 - i));
      ll cnt = (abs(rem) + (D - C) - 1) / (D - C);
      if (rem > 0) {
        yes |= cnt <= i;
      } else if (rem < 0) {
        yes |= cnt <= (N - 1 - i);
      } else {
        yes = 1;
      }
    }
  }
  cout << (yes ? "YES" : "NO") << endl;

  return 0;
}

Measured memory_bytes: 256
S = gets.chomp
T = gets.chomp

cl = Hash.new
len = S.length
check = true
len.times do |i|
  if cl[S[i]] == nil
    cl[S[i]] = T[i]
  elsif cl[S[i]] != T[i]
    check = false
    break
  end
end
if cl.values.size != cl.values.uniq.size
  check = false
end

if check
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 2624
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <climits>
#include <unordered_map>
#include <numeric>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
typedef long long ll;
typedef pair<int,int> pii;
int main(){
    int n;
    scanf("%d", &n);
    vector<ll>vec;
    while(n--){
        ll a;
        scanf("%lld", &a);
        vec.push_back(a);
        int sz = vec.size();
        while(sz >= 3 and vec[sz-1] <= vec[sz-2] and vec[sz-3] <= vec[sz-2]){
            a = vec[sz-1] + vec[sz-3] - vec[sz-2];
            rep(i,3)vec.pop_back();
            vec.push_back(a);
            sz-=2;
        }
    }
    ll ans = 0;
    int i = 0, j = vec.size()-1;
    int k = 1;
    while(i<=j){
        if(vec[i] > vec[j]){
            ans += vec[i]*k;
            i++;
        }else{
            ans += vec[j]*k;
            j--;
        }
        k *= -1;
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
int A,B,C,min1,min2,max1,area;
cin>>A>>B>>C;
if(A<=B)
{min1=A;
max1=B;}
else{min1=B;
    max1=A;}
  if (max1<=C)
  {min2=max1;}
  else{min2=C;}
 area=0.5*min1*min2;
  cout<<area;

return 0;





}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    int n;
    cin >> n;

    vector<int> h(n);
    int minheight=inf;
    for(auto &x:h){
        cin >> x;
        minheight=min(minheight,x);
    }

    for(auto &x:h){
        x-=minheight;
    }

    int ans=minheight;
    for(int i=0;i<n;i++){
        if(i==0){
            ans+=h[i];
        }else{
            if(h[i]>h[i-1]){
                ans+=h[i]-h[i-1];
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3608
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()
	s := readString()

	println(strings.LastIndex(s, "Z") - strings.Index(s, "A") + 1)
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll a, b, c, k, ans;
  cin >> a >> b >> c >> k;
  ans = min(a, k);
  k = k - a - b;
  if(k > 0)
    ans -= k;
  cout << ans;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>
#include<map>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

int main(){
    ll n;
    cin >> n;
    if(n % 2 == 1 || n < 0){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    ll five = 5;
    while(five <= n){
        ans += (n/five) / 2;
        five *= 5;
    }
    cout << ans << endl;

}

Measured memory_bytes: 3564
#include<cstdio>
using namespace std;
int main()
{
	int n,a[100001],b[100000],i;
	long long int sum;
	scanf("%d",&n);
	for(i=0;i<n+1;i++)	scanf("%d",&a[i]);
	for(i=0;i<n;i++)	scanf("%d",&b[i]);
	sum=0;
	for(i=0;i<n;i++){
		// printf("i=%d ai=%d a+1=%d b=%d\n",i,a[i],a[i+1],b[i]);
		if(a[i]+a[i+1]>=b[i]){
			sum+=(long long int)b[i];
			if(a[i]<b[i]){
				b[i]-=a[i];
				a[i+1]-=b[i];
			}
			// printf("sum=%d b=%d a+1=%d\n",sum,b[i],a[i+1]);
		}
		else{
			sum+=(long long int)a[i]+a[i+1];
			a[i+1]=0;
		}
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 896
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

inline long long cross(pair<int, int> p1, pair<int, int> p2) {
    return p1.first * p2.second - p1.second * p2.first;
}

inline bool isPall(pair<int, int> p1, pair<int, int> p2) {
    return cross(p1, p2) == 0;
}

long long bfs(long long i, vector<pair<int, int>> &xy, vector<bool> &used, int M, int d, vector<int> &ord) {

    if (d == M / 2) {
        long long ans = 0;
        vector<pair<int, int>> vec(M / 2);
        for (int j = 0; j < M / 2; j++) {
            int l = j * 2;
            int r = j * 2 + 1;
            vec[j] = make_pair(xy[ord[l]].first - xy[ord[r]].first, xy[ord[l]].second - xy[ord[r]].second);
        }
        for (int j = 0; j < M / 2; j++) {
            for (int k = j + 1; k < M / 2; k++) {
                if (isPall(vec[j], vec[k])) ans++;
            }
        }
        return ans;
    }

    long long ret = 0;
    for (int j = i + 1; j < M; j++) {
            swap(ord[i + 1], ord[j]);
            ret = max(bfs(i + 2, xy, used, M, d + 1, ord), ret);
        swap(ord[i + 1], ord[j]);
    }
    return ret;
}

int main() {

    int M;
    cin >> M;

    vector<pair<int, int>> xy(M);
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        xy[i] = make_pair(x, y);
    }

    vector<bool> used(M, false);
    vector<int> ord(M);
    for (int i = 0; i < M; i++) ord[i] = i;
    auto ans = bfs(0, xy, used, M, 0, ord);

    cout << ans << endl;

    return 0;
}












































































Measured memory_bytes: 3056
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)(n);++i)
#define rep1(i, n) for (int i=1;i<=(int)(n);++i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=r-1;i>=(int)(l);--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;
using ll=long long;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

const int inf = 1e9 + 10;
const int mod = 1e9 + 7;

inline ll mod_pow(ll a, ll x, ll m)
{
	if (x == 0) return 1;

	ll res = mod_pow(a, x / 2, m);

	res *= res;
	res %= m;

	if (x % 2) {
		res *= a;
		res %= m;
	}

	return res;
}

int counter[26];

signed main()
{
	int N; cin >> N;
	string S; cin >> S;

	rep(i, N) {
		int c = S[i] - 'a';
		counter[c]++;
	}

	int ans = 1;

	rep(i, 26) (ans *= counter[i] + 1) %= mod;

	ans += mod - 1;
	ans %= mod;

	cout << ans << endl;
}



Measured memory_bytes: 512
#include<iostream>
#include<string>
using namespace std;
int main()
{
	char S;
	string W[3];
	W[0] = "Sunny";
	W[1] = "Cloudy";
	W[2] = "Rainy";
	cin >> S;
	if (S == 's' || S == 'S')
		cout << W[1];
	else if (S == 'c' || S == 'C')
		cout << W[2];
	else
		cout << W[0];

}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

int main() {
    int n;cin>>n;
    int ans=1,x=1;

    for(int i=0;i<n;i++){
      int a;cin>>a;
      if(a%2==0){
        x*=2;
      }
      ans*=3;
    }
    cout<<ans-x<<endl;
}


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

int main(){
  int e;

  while(cin >> e, e){
    int ans = e;
    for(int z = 0; z * z * z <= e; z++){
      int Z = z * z * z;
      for(int y = 0; Z + y * y <= e; y++){
        int Y = y * y;
        int x = e - Z - Y;
        ans = min(ans, x + y + z);
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1160
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    w, h, x, y = rli()
    s = w*h/2
    if x*2 == w and y*2 == h:
        print(w*h/2, 1)
    else:
        print(w*h/2, 0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
n,k=parse.(split(readline()))
dp=zeros(Int,n,k)
for j=1:k;dp[1,j]=1;end
for i=2:n,j=1:k,l=1:k
  if j==l;continue;end
  dp[i,j]+=dp[i-1,l]
end
print(sum(dp[n,:]))

Measured memory_bytes: 153628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> A(n); rep(i, n) cin >> A[i];
  ll xorAll = 0;
  rep(i, n) xorAll ^= A[i];
  rep(i, n) cout << (xorAll ^ A[i]) << ' ';
  cout << endk;
  return 0;
}


Measured memory_bytes: 4732
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000
using ll = long long;
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-10; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);

}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	llint ans = 0, n = 0, m = 0, count = 0, sum = 0;
	llint k, a=-100, b=-100,d,x;
	bool check = false;
	string ss,sss;
	string c;
	vector<llint> array,sarray;
	vector<bool> bo;
	cin >> ss >> sss;
	c = sss.at(ss.size());
	if (ss + c == sss)cout << "Yes" << endl;
	else cout << "No" << endl;
	please AC;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define UNIQUE(v) do{ (v).erase( unique(begin(v), end(v)), end(v) ); } while(0)

namespace std {
	template<class S, class T> pair<S, T> operator + (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first + b.first, a.second + b.second);}
	template<class S, class T> pair<S, T> operator - (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first - b.first, a.second - b.second);}
	template<class S, class T> pair<S, T>& operator += (pair<S, T> &a, const pair<S, T> &other) {return a = a + other;}
	template<class S, class T> pair<S, T>& operator -= (pair<S, T> &a, const pair<S, T> &other) {return a = a - other;}
	template<class S, class T> ostream& operator << (ostream& ost, pair<S, T> p) {ost << "(" << p.first << ", " << p.second << ")";return ost;}
	template<class T> ostream& print_iterable_container(ostream& ost, T& container) {
		for (auto&& iter = begin(container); iter != end(container); ++iter) ost << (iter == begin(container) ? " [ " : ", ") << (*iter);
		return ost << " ]";
	}
#	define APPLY_PRINT_ITERABLE_CONTAINER(container_type)\
	template<class T> ostream& operator << (ostream& ost, container_type<T>& container) {\
		return print_iterable_container(ost, container);\
	}
	APPLY_PRINT_ITERABLE_CONTAINER(vector);
	APPLY_PRINT_ITERABLE_CONTAINER(list);
	APPLY_PRINT_ITERABLE_CONTAINER(deque);
}

template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

using ld = long double;

template<class T> using VV = vector<vector<T> >;
template<class T> using maxPQ = priority_queue<T>;
template<class T> using minPQ = priority_queue<T, vector<T>, greater<T> >;
template<class T, class U> using uomap = unordered_map<T, U>;
template<class T> using uoset = unordered_set<T>;

const ll INF = 1001001001;
const ll INFll = (ll)INF * INF;
const ll MOD = 1000000007;
const ll MOD_FFT = 998244353;
const ld EPS = 1e-15;

//function<void(int,int)> tensi_no_3p=[&](int v,int d){
//};

int main() {
	ios_base::sync_with_stdio(false);

	int A, B; cin >> A >> B;
	char shiro = '.';
	char kuro = '#';
	if (A > B) {
		swap(A, B);
		shiro = '#';
		kuro = '.';
	}
	A--;

	vector<string> ans(100, string(100, shiro));
	rep(i, A) {
		int oy = i / 25 * 4;
		int ox = i % 25 * 4;
		rep(a, 3) rep(b, 3) ans[oy + a][ox + b] = (a == 1 && b == 1) ? shiro : kuro;
	}

	rep(i, B - A) {
		int oy = 99 - i / 50 * 2;
		int ox = i % 50 * 2;
		ans[oy][ox] = kuro;
	}

	cout << "100 100" << endl;
	rep(i, 100) cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define int long long
using namespace std;
bool b[1010];
signed main() {
    int n, k; cin >> n >> k;
    //ans=(n-1)C(k-1)
    int ans = 1;n--;k--;
    for (int i = 0; i < k; i++) {
        int p=n-i;
        for(int j=k;j>=1;j--){
            if(!b[j]&&p%j==0){
                b[j]=1;
                p/=j;
            }
        }
        ans*=p;
        ans%=1000000007;
    }
    for (int i = 1; i <= k; i++){
        if(!b[i]){
            while(ans%i!=0)ans+=1000000007;
            ans/=i;
        }
        ans%=1000000007;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3100
import java.util.*;

public class Main {
	
	static int result = 0;

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String[] strArray = s.split("");
		
		int zero = 0;
		int one = 0;
		for(int tmp = 0; tmp < strArray.length ; tmp++) {
			if(Integer.parseInt(strArray[tmp]) == 0) {
				one += 1;
			}else {
				zero += 1;
			}
		}
		System.out.println(strArray.length - Math.abs(zero - one));
	}
}

Measured memory_bytes: 33736
#include <iostream>
#include <algorithm>
#include <string>
#include <memory>
#include <cmath>
#include <vector>
#include <iomanip>
#include <queue>
int gcd(const int a, const int b) {
	return (b == 0) ? a : gcd(b, a % b);
}
int main() {
	int n; std::cin >> n;
	std::vector<int> num(n); for (auto& a : num) std::cin >> a;
	auto fromLeft = num;
	auto fromRight = num;
	for (auto i = 1; i < n; ++i) fromLeft[i] = gcd(fromLeft[i - 1], fromLeft[i]);
	for (int i = n - 2; i >= 0; --i) fromRight[i] = gcd(fromRight[i + 1], fromRight[i]);
	auto max = std::max(fromLeft[n - 2], fromRight[1]);
	for (auto mid = 1; mid < n - 1; ++mid) {
		auto g = gcd(fromLeft[mid - 1], fromRight[mid + 1]);
		if (max < g) max = g;
	}
	std::cout << max << std::endl;
}


Measured memory_bytes: 1408
import java.util.Scanner;
import java.util.Arrays;
class Main{
    public static void main(String[] args) {
        Scanner scn= new Scanner(System.in);
        int n=scn.nextInt();
        int[] a= new int[n];
        for(int i=0;i<n;i++){
            a[i]=scn.nextInt();
        }
        Arrays.sort(a);
        int alice=0;
        int bob=0;
        for(int i=0;i<n;i++){
            if(n%2==0){
                if(i%2==0){
                    bob+=a[i];
                }else{
                    alice+=a[i];
                }
            }else{
                if(i%2==0){
                    alice+=a[i];
                }else{
                    bob+=a[i];
                }
            }
        }
        System.out.println(alice-bob);
    }
}

Measured memory_bytes: 21844
using System;

class Wacth
{
	static void Main(){
		int time = int.Parse (Console.ReadLine ());



		int h = time / 3600;
		int h2 = time % 3600;

		int m = h2 / 60;
		int m2 = h2 % 60;

		int s = m2;

		Console.WriteLine (h + ":" + m + ":" + s);



	}
}

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1000000007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

// boolean でのガウスの消去法を行い、ランクを返す
template<size_t BITSIZE>
int gaussian_elimination(vector<bitset<BITSIZE>> &A){
    int H = A.size();
    int W = BITSIZE;
    int rank = 0;
    for(int c=0; c<W; c++){
        int pivot = -1;
        for(int r=rank; r<H; r++){
            if(A[r][c]){
                pivot = r;
                break;
            }
        }
        if(pivot==-1) continue;
        swap(A[pivot], A[rank]);
        for(int r=0; r<H; r++)
            if(r != rank && A[r][c]) A[r] ^= A[rank];
        rank++;
    }
    return rank;
}

bitset<60> reverse(bitset<60> x){
    bitset<60> y;
    for(int i=0; i<60; i++)
        y[i] = x[59-i];
    return y;
}

int main(){
    int N;
    cin >> N;
    vector<unsigned long long> A(N);
    REP(i, N) cin >> A[i];
    vector<bitset<60>> B(N);
    REP(i, N) B[i] = A[i];

    unsigned long long ans = 0;
    REP(i, 60){
        int cnt = 0;
        REP(j, N) if(A[j]&(1LL<<i)) cnt++;
        if(cnt%2){
            ans += (1LL<<i);
            REP(j, N) B[j][i] = 0;
        }
    }
    REP(i, N) B[i] = reverse(B[i]);
    gaussian_elimination(B);
    REP(i, N) B[i] = reverse(B[i]);

    unsigned long long x = 0;
    REP(i, N) x ^= B[i].to_ullong();
    ans += 2 * x;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
s = input()
t = input()

t_len = len(t)
s_len = len(s)
max_ = 0
temp = 0

for i in range(s_len - t_len + 1):
  for j in range(t_len):
    if s[i + j] == t[j]:
      temp += 1
  if max_ < temp:
    max_ = temp
  temp = 0

print(t_len - max_)

Measured memory_bytes: 8988
#include<iostream>
using namespace std;
int main(){
    int a,b,x,c;
    while(cin>>a>>b){
        x=0;
        c=a+b;
        while(1){
            c/=10;
            ++x;
            if(c==0){break;}
        }
        cout<<x<<endl;
       }
    
    
    return 0;
}

Measured memory_bytes: 3000
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long llong;

int main(){
  int n; cin >> n;
  vector<string> A(n);
  for (int i=0; i<n; i++){
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  llong cntm=0, cnta=0, cntr=0, cntc=0, cnth=0;
  for (vector<string>::iterator it=A.begin(); it!=A.end(); it++){
    string h = *it;
    if (h[0]=='M') cntm++;
    if (h[0]=='A') cnta++;
    if (h[0]=='R') cntr++;
    if (h[0]=='C') cntc++;
    if (h[0]=='H') cnth++;
  }
  llong sum =0;
  sum = cntm*cnta*cntr + cntm*cnta*cntc + cntm*cnta*cnth + cntm*cntr*cntc + cntm*cntr*cnth + cntm*cntc*cnth + cnta*cntr*cntc + cnta*cntr*cnth + cnta*cntc*cnth + cntr*cntc*cnth;

  cout << sum << endl;
}

Measured memory_bytes: 6144
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	order := make([]int, n)
	for i := 0; i < n; i++ {
		order[a[i]-1] = i + 1
	}
	for i := 0; i < len(order); i++ {
		fmt.Printf("%v ", order[i])
	}
}


Measured memory_bytes: 6016
#include<stdio.h>
#include<math.h>
double dist(int x[],int y[],int n,int p){
    if(p<=3){
        double d =0;
        for (int i=0;i<n;i++){
            d=d+pow(abs(x[i]-y[i]),p);
        }
        double res =pow(d,1.0/p);
        return res;
    }else{
    
        double max =0;
        for (int i=0;i<n;i++){
            int sum = abs(x[i]-y[i]);
            if(sum>max){
                max=sum;
            }
        }
        return max;
    }
}
int main(){
    int n,x[100],y[100];
    scanf("%d",&n);
    for (int i=0;i<n;i++){
        scanf("%d",&x[i]);
    }
    for (int i=0;i<n;i++){
        scanf("%d",&y[i]);
    }
    printf("%.6lf\n",dist(x,y,n,1));
    printf("%.6lf\n",dist(x,y,n,2));
    printf("%.6lf\n",dist(x,y,n,3));
    printf("%.6lf\n",dist(x,y,n,4));
}


Measured memory_bytes: 2048
import sys
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def tami(now, ContestType):
  res = c[ContestType] * (now - LastDay[ContestType])
  return res

D = I()
c = IL()
s = [IL() for i in range(D)]

for i in range(1,D+1):
  tmp = ["", 0]
  for j in range(26):
    if tmp[1] < s[i-1][j]:
      tmp = [j, s[i-1][j]]
  print(tmp[0]+1)

Measured memory_bytes: 73368
// Copyright 2020 yaito3014
#include <bits/stdc++.h>

int main() {
  using namespace std;
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  sort(begin(S), end(S));
  cout << (S == "abc" ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
h,w = map(int, input().split())
a=[input() for i in range(h)]

b = []
for i in range(h):
    if a[i]!="."*w:
        b.append(a[i])

c = ["" for i in range(len(b))]

for i in range(w):
    for j in range(len(b)):
        if b[j][i] != ".":
            for k in range(len(b)):
                c[k] += b[k][i]
            break


for i in range(len(c)):
    print(c[i])

Measured memory_bytes: 3064
/*
    Submitted With (^^) by -> Hossam ^_^
     ___     ___
    (^_^)   (^_^)
   /( | )\ /( | )\
     | |     | |
*/
#include <bits/stdc++.h>

using namespace std;

inline void prep()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
}

#define X first
#define Y second
#define ll long long
#define inf (0x7fffffffffffffff)
#define all(x) x.begin(), x.end()

const int MX = 1001;

int main()
{

    prep();


    int n;
    cin >> n;

    vector<int> spot(n + 2);
    spot[0] = spot[n + 1] = 0;

    int total_cost = 0;

    for(int i = 1; i <= n; ++i){
        cin >> spot[i];
        total_cost += abs(spot[i] - spot[i - 1]);
    }

    total_cost += abs(spot[n]);

    for(int i = 1; i <= n; ++i){
        cout << total_cost - abs(spot[i - 1] - spot[i]) - abs(spot[i] - spot[i + 1]) + abs(spot[i - 1] - spot[i + 1]) << " \n"[i == n];
    }

    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
  //freopen("input.txt", "r", stdin);
  ll a, b, c;
  cin >> a >> b >> c;
  if(a > b) swap(a, b);
  if(a == 0 && b == 0){
    cout << 1 << endl;
    return 0;
  }
  else if(a == 0){
    cout << (b / c) + 1 << endl;
    return 0;
  }
  else if(a == 1){
    cout << b / c << endl;
    return 0;
  }
  else{
    cout << (b / c) - ((a - 1) / c) << endl;
    return 0;
  }
  return 0;
}


Measured memory_bytes: 256
# frozen_string_literal: true

# Disjoint Set Union
class DSU
  def initialize(n = 0)
    # root node: -1 * component size
    # otherwise: parent
    @n = n
    @parent_or_size = Array.new(n, -1)
  end

  def merge(a, b)
    x = leader(a)
    y = leader(b)
    return x if x == y

    x, y = y, x if -@parent_or_size[x] < -@parent_or_size[y]
    @parent_or_size[x] += @parent_or_size[y]
    @parent_or_size[y] = x
    x
  end

  def same(a, b)
    leader(a) == leader(b)
  end

  def leader(a)
    @parent_or_size[a].negative? ? a : (@parent_or_size[a] = leader(@parent_or_size[a]))
  end

  def size(a)
    -@parent_or_size[leader(a)]
  end

  def groups
    leader_buf = Array.new(@n, 0)
    group_size = Array.new(@n, 0)
    (0...@n).each do |i|
      leader_buf[i] = leader(i)
      group_size[leader_buf[i]] += 1
    end
    result = Array.new(@n) { [] }
    (0...@n).each do |i|
      result[leader_buf[i]].push i
    end
    result.delete_if(&:empty?)
    result
  end

  alias root leader
  alias find leader
  alias unite merge
  alias same? same
end

UnionFind        = DSU
UnionFindTree    = DSU
DisjointSetUnion = DSU

n, m = gets.split.map(&:to_i)
ab = m.times.map { gets.split.map(&:to_i) }

u = UnionFind.new(n)

ab.each do |a, b|
  u.merge(a - 1, b - 1)
end
puts u.groups.size - 1


Measured memory_bytes: 27492
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn =1e5+5;
ll a[maxn];
ll b[maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	ll sum=0;
	for(int i=1;i<=n+1;i++)
    {
        cin>>a[i];
    }

    for(int i=1;i<=n;i++)
    {
        cin>>b[i];
    }
    for(int i=1;i<=n;i++)
    {
        if(b[i]>=a[i])
        {
            b[i]-=a[i];
            sum+=a[i];
        }
        else
        {
            sum+=b[i];
            continue;
        }
        if(b[i]>=a[i+1])
        {

            sum+=a[i+1];
            a[i+1]=0;
        }
        else
        {
            a[i+1]-=b[i];
            sum+=b[i];
        }
    }
    cout<<sum<<'\n';

}


Measured memory_bytes: 1792
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,T = LI()
ct = [LI() for _ in range(n)]
ct.sort()
for c,t in ct:
    if t <= T:
        print(c)
        quit()
print('TLE')

Measured memory_bytes: 38384