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

const int mod=1e9+7;

signed main()
{
   string s; cin>>s;
   int N=s.size();

   vector<vector<int> > dp(N+1,vector<int>(4));
   dp[0][0]=1;
   for(int i=0;i<N;i++){
      for(int j=0;j<=3;j++){
         if(s[i]=='?'){
            (dp[i+1][j]+=dp[i][j]*3)%=mod;
         }
         else{
            (dp[i+1][j]+=dp[i][j])%=mod;
         }
      }
      if(s[i]=='A' or s[i]=='?'){
         (dp[i+1][1]+=dp[i][0])%=mod;
      }
      if(s[i]=='B' or s[i]=='?'){
         (dp[i+1][2]+=dp[i][1])%=mod;
      }
      if(s[i]=='C' or s[i]=='?'){
         (dp[i+1][3]+=dp[i][2])%=mod;
      }
   }
   cout<<dp[N][3]<<endl;
}


Measured memory_bytes: 7424
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int uli;
typedef long double Lf;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define fastIO  std::ios::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007
#define N 30005
#define NN 2005
#define SZ(x) ((lli) (x).size())
#define loop(i,s,n) for(int i=(s);i<(n);i++)
#define loopr(i,n,s) for(int i=(n)-1;i>=(s);i--)
#define pb push_back
#define o2(a,b) cout<<(a)<<" "<<(b)<<endl
#define o3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define o4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define cl cout<<endl
#define r0 return 0
#define e0 exit(0)
#define x first
#define y second
#define endl "\n"


int main(){
    
	lli n;
	cin>>n;
	
	string str;
	cin>>str;
	
	if(str.length()<=n)cout<<str<<endl;
	else 
	{
		string str1=str.substr(0,n);
		str1=str1+"...";
		cout<<str1<<endl;
	}
	
}

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

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

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> s(H+2);
    for(int i=1; i<=H; i++){
        cin >> s[i];
        s[i] = '.' + s[i] + '.';
    }
    s[0] = string(W+2, '.');
    s[H+1] = string(W+2, '.');

    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            if(s[i][j] == '.') continue;
            bool flag = false;
            for(int k=0; k<4; k++){
                if(s[i+dy[k]][j+dx[k]] == '#')
                    flag = true;
            }
            if(!flag){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

using namespace std;

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

	int arr[n];

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

	sort(arr,arr+n);

	int ans=0;
	int i=0,j=i+1;
	int k=j+1;

	while(i<n-2)
	{
		j=i+1;
		while(j<n-1 && arr[j]==arr[i])
			j++;

		while(j<n-1)
		{
			k=j+1;
			while(k<n && arr[k]==arr[j])
				k++;

			while(k<n && (arr[i]+arr[j])>arr[k])
			{
				k++;
              ans++;
			}

				j++;
		}

			i++;
	}

	cout<<ans;
}

Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

int main(){
    vector<int> x(3);
    cin >> x.at(0) >> x.at(1) >> x.at(2);

    int cnt=0;
    sort(x.begin(),x.end());

    cnt+=x.at(2)-x.at(1);
    if((x.at(2)-(x.at(0)+cnt))%2==1){
        cnt+=(x.at(2)-(x.at(0)+cnt))/2+2;
    }else{
        cnt+=(x.at(2)-(x.at(0)+cnt))/2;
    }

    cout << cnt << endl;
}

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

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

  vector<int> h(N);
  rep(i, N) cin >> h[i];

  sort(h.begin(), h.end());

  int ans = 1e9;
  rep(i, N - K + 1) ans = min(ans, h[i + K - 1] - h[i]);

  cout << ans << endl;
}

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

int main() {
    //
    int num;
    cin >> num;

    for (int i = 0; i < 1000; i++) {
        if ((num + i) % 111 == 0) {
            cout << num+i;
            break;
        }
    }
    //
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <functional>
#include <algorithm>
#include <stack>
#include <list>
#include <queue>
#include <bitset>
//#include <iostream>
//#include <sstream>
using namespace std;
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define test_ fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> in <<<<<<<<<<<<<<<<<<<<")
#define deb(x) cerr << ">>>>>>>>>>>>>>>>>>>> " << #x << " = " << x << " <<<<<<<<<<<<<<<<<<<<\n"
#define debd(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %d <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define debs(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %s <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define debll(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %lld <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define deblf(x) fprintf(stderr, ">>>>>>>>>>>>>>>>>>>> %s = %lf <<<<<<<<<<<<<<<<<<<<\n", #x, x)
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ln puts("")
#define mems(a) memset(a, 0, sizeof(a))
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())
//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vll;
//bitmask
int onbit(int x, int pos) {x |= (1 << pos); return x;}
int offbit(int x, int pos) {x &= ~(1 << pos); return x;}
int test(int x, int pos) {return x & (1 << pos);}
int flip(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int onbitall(int x, int pos) {x = (1 << pos)-1; return x;}
//constants
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
//moves
const int dx1[] = {0, 1, 0, -1};
const int dy1[] = {1, 0, -1, 0};
const int dx2[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy2[] = {-1, 0, 1, -1, 1, -1, 0, 1};

int _get(int _x) {
  int ret = 0;
  while(_x) {
    ret += (_x % 10);
    _x /= 10;
  }
  return ret;
}

int main() {
//  freopen("input.in", "r", stdin);
  int n;
  sf("%d", &n);
  
  puts(n % _get(n) == 0 ? "Yes" : "No");
  
  return 0;
}


Measured memory_bytes: 128
a, b, m = map(int, input().split())
A = [int(n) for n in input().split()]
B = [int(n) for n in input().split()]

# 割引券を使った場合の最少額を求める
min_m = float('inf')
for ai, bi, c in [map(int, input().split()) for _ in range(m)]:
	if min_m > A[ai-1] + B[bi-1] - c:
		min_m = A[ai-1] + B[bi-1] - c

print(min(min(A)+min(B),min_m))

Measured memory_bytes: 62308
import itertools

n=int(input())
a=list(map(int,input().split()))
ans=0
r=0
cnt=0

for l in range(n):
    while r<n and (cnt^a[r]==cnt+a[r]):
        cnt+=a[r]
        r+=1
    
    ans+=r-l
    cnt^=a[l]


print(ans)

Measured memory_bytes: 91952
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
 
 
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-8;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

// ここから編集

void solve(){
  int N;cin >> N;
  vector<ll>a(N);
  REP(i,N)cin >> a[i];

  string s; cin >> s;
  vector<ll> b;
  for(int i=N-1; i>=0; i--){
    ll v = a[i];
    for(auto x:b) chmin(v, v^x);
    if(v){
      if(s[i] == '1'){
        cout << 1 << endl;
        return;
      }
      b.push_back(v);
    }
  }
  cout << 0 << endl;
  return;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    
    int t;
    cin >> t;
    while(t--){
      solve();
    }
    return 0;
}


Measured memory_bytes: 3580
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) {
		var sc = new java.util.Scanner(System.in);
		var n = sc.nextBigInteger();
		var output = "";
		for(;n.compareTo(BigInteger.valueOf(26))>0;) {
			var mod = n.subtract(BigInteger.ONE).mod(BigInteger.valueOf(26));
			output = Character.toString(mod.intValue() + 'a') + output;
			n = n.subtract(BigInteger.ONE).divide(BigInteger.valueOf(26));
		}
		output = Character.toString(n.intValue() + 'a' - 1) + output;

		System.out.println(output);
	}
}

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

long long lcm(long long n, long long m);

int main()
{
    long long n, m;
    long long l;
    int f = 1;
    string s, t;
    map<int, char>x;

    cin >> n >> m;
    cin >> s >> t;

    l = lcm(n, m);

    for (long long i = 0; i < max(n, m); i++) {
        
        long long tmp_n, tmp_m;
        tmp_n = (i * (l / n));
        tmp_m = (i * (l / m));

        if (i < n && x.count(tmp_n) == 0) x[tmp_n] = s[i];
        if (i < m && x.count(tmp_m) == 0) x[tmp_m] = t[i];

        if ((i < n && x[tmp_n] != s[i]) ||
            (i < m && x[tmp_m] != t[i])) {
            f = 0;
        }

    }

    if (f) {
        cout << l << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}

long long lcm(long long n, long long m)
{
    return (n * m / __gcd(n, m));
}


Measured memory_bytes: 8192
n,l = map(int,input().split())
if l>=0:
    print((n+2*l-1)*n//2-l)
elif n+l-1>=0:
    print((n+2*l-1)*n//2)
else:
    print((n + 2 * l - 1) * n // 2-(n+l-1))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define IOS {ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define endl "\n"
#define float long double
#define int long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fb(i, a, b) for(int i=a; i>=b; i--)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define LB lower_bound
#define UB upper_bound
#define g(t, n) get<n>(t)
#define fp(x, y) fixed<<setprecision(y)<<x
#define PI 3.141592653589793238462643383279502884
using namespace std;

const int M = (int)2e5+5;
const int mod = (int)1e9+7;

void solve()
{
	string s, t;
	cin>>s>>t;
	int n = s.size(), m = t.size(), ans = 1e5;
	f(i, 0, n)
	{
		if(i+m > n) break;
		int curr = 0;
		f(j, i, i+m)
		{
			if(s[j] != t[j-i]) curr++;
		}
		ans = min(ans, curr);
	}
	cout<<ans<<endl;
}

int32_t main()
{
    IOS
    int t = 1;
    // cin>>t;
    f(tno, 1, t+1)
    {
        // cout<<"Case #"<<tno<<": ";
        solve();
    }
    return 0;
}

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

using namespace std;

#define INF 210000000
#define int long long

int gcd(int a, int b) {
  int amari = a % b;
  int c = b;
  if (amari == 0) {
    return b;
  } else {
    return gcd(b, amari);
  }
}

int lcm(int a, int b) { return a * b / gcd(a, b); }

bool cmp(int a,int b){
		return a > b;
}

signed main() {
		int n;
		int t;
		cin >> n >> t;
		int ans = INF;
		for(int i=0;i<n;i++){
				int a,b;
				cin >> a >> b;
				if(b <=t && a < ans) ans = a;
		}
		if(ans == INF) cout << "TLE";
		else cout << ans;
}


Measured memory_bytes: 256
div = 10**9 + 7

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

dp = [[0] * (n+1) for _ in range(k+1)]
dp[0] = [1]*(n+1)

for i in range(1,k+1):
    for j in range(1, n+1):
        if(i <= a[j-1]):
            dp[i][j] = (dp[i-1][j] + dp[i][j-1])%div
        else:
            dp[i][j] = (dp[i-1][j] + dp[i][j-1] - dp[i - a[j-1] - 1][j -1])%div

print(dp[k][n] % div)

Measured memory_bytes: 130780
def print_list(r):
    for i in range(len(r)):
        if i != len(r)-1:
            print (r[i], end=' ')
        else:
            print(r[i])


n=int(input())
r=list(map(int,input().split()))
for i in range(0, len(r)):
        v = r[i]
        j = i-1
        while (j >= 0) & (r[j] > v):
            r[j+1] = r[j]
            j -= 1
        r[j+1] = v
        print_list(r)


Measured memory_bytes: 5980
a,b,c,x,y=map(int,input().split())
one = a*x+b*y
if x>y:
  two=2*c*y+a*(x-y)
else:
  two=2*c*x+b*(y-x)
three = 2*max(x,y)*c
print(min(one,two,three))

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
    char s[60],t[60];
    scanf("%s",s);
    strncpy(t,s,strlen(s)-8);
    t[strlen(s)-8]='\0';
    printf("%s\n",t);
	return 0 ;
}

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

int main()
{
    int a,b;
    cin >> a >> b;
    int k = b * 2;
    if( k >= a ){
        cout << 0 << endl;
    }
    else{
        cout << a - k << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
	int N,X,ans;
	cin >> N>>X;
	int m[110];
	for (int i = 0; i < N; i++) cin >> m[i];
	int min=m[0],M=0;
	for (int i = 0; i < N; i++) {
		if (min > m[i])min = m[i];
		M += m[i];
	}
	ans = N + (X - M) / min;
	cout << ans << endl;
}

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

using namespace std;

int main(){
    int k, s;
    scanf("%d %d", &k, &s);
    int ans = 0;
    int a = min(s, k);
    int b = max(0, s - k);
    if (a >= b) ans += (a - b + 1) * (s + 1) - (a + b) * (a - b + 1) / 2;
    a = min(k, s - k - 1);
    b = max(0, s - 2 * k);
    if (a >= b) ans += (a - b + 1) * (2 * k - s + 1) + (a + b) * (a - b + 1) / 2;

    printf("%d\n", ans);
}


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

using namespace std;

long long a,b,i;
int k;

int main()
{
    cin>>a>>b>>k;
    if(b-a+1>=2*k)
    {
        for(i=a;i<a+k;i++) cout<<i<<endl;
        for(i=b-k+1;i<=b;i++) cout<<i<<endl;
    }
    else
    {
        for(int i=a;i<=b;i++) cout<<i<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1

//{
#pragma GCC optimize ("O3","unroll-loops")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int n,ans;
vpint v;

main(){
	cin>>n;
	rep(i,n){
		int a,b;
		cin>>a>>b;
		v.pb({a,b});
	}
	rev(all(v));
	rep(i,n){
		int a,b;
		a=v[i].fi;b=v[i].se;
		a+=ans;
		ans+=(b-(a%b))*(!!(a%b));
	}
	dans;
}

Measured memory_bytes: 2420
#include <iostream>
#include <utility>
#define P pair<int,int>
#define U 1000
using namespace std;

int n;
P p[200][200];

bool solve(int x,int y, P org, int k){
  if( k> n*n ) return false;
  if( p[x][y].first==U )
    return false;
  if( p[x][y].first==org.first && p[x][y].second==org.second )
    return true;
  //  cout << "  s"<<x<<","<<y<< endl;

  int nx=p[x][y].first, ny=p[x][y].second;
  return solve( nx,ny,org,k+1 );
}
void loop(int x,int y){
  if( p[x][y].first==U ) return;
  int nx=p[x][y].first, ny=p[x][y].second;
  p[x][y].first = U;
  p[x][y].second = U;
  loop( nx,ny );
}

void pr(){
  for( int i=0;i<n;i++ ){
    for( int j=0;j<n;j++ ){
      if( p[i][j].first==U )
	cout << " *,*";
      else 
	cout << " " << p[i][j].first << "," << p[i][j].second;
    }
    cout << endl;
  }
}

int main(){

  while( cin>>n,n ){
    for( int i=0;i<n;i++ ){
      for( int j=0;j<n;j++ )
	cin >> p[j][i].first >> p[j][i].second;
    }
    //    cout << "------------------------------" << endl;
    //    pr(); cout << endl;

    int ans=0;
    for( int i=0;i<n;i++ ){
      for( int j=0;j<n;j++ ){
	if( p[i][j].first==U ) continue;

	if( solve( p[i][j].first,p[i][j].second,p[i][j],0 ) ){
	  loop(i,j); // erase loop
	  //	  pr();cout << " ans++ by " << i << " " << j << endl;
	  ans++;
	}else{
	  p[i][j].first=U; p[i][j].second=U;
	}

      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <map>
#include <algorithm>
#include <unordered_map>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
    int a;
    string s;

    cin >> a >> s;

    if (a >= 3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    }

    return 0;
}

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

using namespace std;

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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#ifdef Debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#else
#define dump(x)
#endif

int main(){
	string s;
	cin>>s;
	string a="",b="";
	rep(i,s.size()){
		if(s[i]=='A'||s[i]=='Z')a+=s[i];
	}

	rep(i,a.size()-1){
		if(a[i]=='A'&&a[i+1]=='Z')b+="AZ";
	}
	if(b.size()==0)cout<<"-1"<<endl;
	else cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

typedef unsigned long long ul;

const int MX = 55;
int n, k, a[MX], s, t, mk;
ul dp[1 << 18], res, c[MX][MX];

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> k >> s >> t;
	mk = s ^ t;

	forn (i, MX) {
		c[i][0] = 1;

		for (int j = 1; j <= i; j++)
			c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
	}

	forn (i, MX) {
		for (int j = 1; j <= n; j++)
			c[i][j] += c[i][j - 1];
	}

	forn (i, n) {
		cin >> a[i];

		if ((a[i] & t) != a[i] || (a[i] & s) != s) {
			a[i] = -1;
		} else {
			a[i] &= mk;
		}
	}

	if ((s & t) != s) {
		cout << 0 << endl;
		return 0;
	}

	forn (i, n)	{
		if (a[i] == -1) continue;

		int off = mk ^ a[i];

		memset(dp, 0, sizeof(dp));
		for (int j = i + 1; j < n; j++)
			if (a[j] != -1)
				dp[a[j] ^ off]++;

		forn (j, 18) forn (i, (1 << 18))
			if (!(i & (1 << j)))
				dp[i] += dp[i | (1 << j)];

		forn (i, (1 << 18)) {
			if (__builtin_popcount(i) & 1) {
				res -= c[dp[i]][min(dp[i], ul(k - 1))];
			} else {
				res += c[dp[i]][min(dp[i], ul(k - 1))];
			}
		}
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 5760
#include<stdio.h>
#include<stdlib.h>

int cmpnum(const void * n1, const void * n2)
{
    if(*(long *)n1 > *(long *)n2)
    {
        return 1;
    }
    else if(*(long *)n1 < *(long *)n2)
    {
        return -1;
    }
    else
    {
        return 0;
    }
    
}
int main(void)
{
    long int n,k,h[200001],i,j,sum = 0,a;
    scanf("%ld %ld",&n,&k);
    for(i = 0 ; i < n ; i++)
    {
        scanf("%ld",&h[i]);
    }
    if(n <= k)
    {
        printf("0\n");
    }
    else
    {
        qsort(h,n,sizeof(long),cmpnum);
        for(i = 0 ; i < n-k ; i++)
        {
            sum+=h[i];
        }
        printf("%ld\n",sum);
    }
    
    return 0;
}

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

int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  long long result = 1;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    if (a == 0) {
      result = 0;
      break;
    }
    if (result > 0) {
      if (a > (1000000000000000000 / result)) {
        result = -1;
      } else {
        result *= a;
      }
    }
  }

  cout << result << endl;
}


Measured memory_bytes: 3612
import itertools
import math
N = int(input())
l = []
for i in range(N):
    a,b = map(int,input().split())
    l.append([a,b])


t = list(itertools.permutations(range(N)))

# print(len(t))
def cal(T):
    res = 0
    # print(T)
    for i,j in zip(T,T[1:]):
        res += math.sqrt(((l[i][0]-l[j][0])**2)+(l[i][1]-l[j][1])**2)
        # print(res)
    return res
ans = 0
s = 0
for A in t:
    ans += cal(A)
    s+=1
print(ans/s)


Measured memory_bytes: 7972
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define MAX 1e6
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

void dfs(vector<ll>* edges,ll ind,ll val,ll* arr,bool* visited){
	visited[ind] = 1;
	arr[ind] = val;
	for(auto it:edges[ind]){
		if(!visited[it])
			dfs(edges,it,val,arr,visited);
	}
}
int main() 
{
	ll n,a,b;
	cin>>n>>a>>b;
	vector<ll> edges[n+1],edgesT[n+1];
	REP(i,0,a){
		ll x,y;
		cin>>x>>y;
		edges[x].push_back(y);
		edges[y].push_back(x);
	}
	REP(i,0,b){
		ll x,y;
		cin>>x>>y;
		edgesT[x].push_back(y);
		edgesT[y].push_back(x);
	}
	ll* arr = new ll[n+1]();
	bool* visited = new bool[n+1];
	REP(i,1,n+1) visited[i] = 0;

	ll val = 1;
	REP(i,1,n+1){
		if(!visited[i]){
			dfs(edges,i,val,arr,visited);
			val++;
		}
	}
	
	ll p[n+1] = {0};
	REP(i,1,n+1){
		p[arr[i]]++;
	}
	vector<ll> v;
	REP(i,1,n+1){
		ll sum = p[arr[i]] - 1;
		// cout<<sum<<" ";
		for(auto it:edges[i]){
			if(arr[it] == arr[i]) sum--;
		}
		for(auto it:edgesT[i]){
			if(arr[it] == arr[i]) sum--;
		}
		v.push_back(sum);
	}
	// cout<<endl;
	for(auto it:v) cout<<it<<" ";
		cout<<endl;
	return 0;
}



Measured memory_bytes: 15732
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N = I()
A = [I() for _ in range(N)]

ans = 0
for i in range(N):
    ans += A[i]//2
    A[i] -= 2*(A[i]//2)
    if A[i] == 1 and i < N-1 and A[i+1] >= 1:
        ans += 1
        A[i] = 0
        A[i+1] -= 1

print(ans)


Measured memory_bytes: 77848
fn read() -> Vec<String> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let vec: Vec<String> = s
        .trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

fn main() {
    let vec = read();
    let a = &vec[0].chars().last().unwrap();
    let b1 = &vec[1].chars().next().unwrap();
    let b2 = &vec[1].chars().last().unwrap();
    let c = &vec[2].chars().next().unwrap();
    if a == b1 && b2 == c {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

using namespace std; 

int main(){ 
  string s;
  cin>>s;
  int a,b;
  int n=s.size();
  for(int i=0;i<n;i++){
    if(s.at(i)=='A'){
      a=i;
      break;
    }
  }
  for(int i=n-1;i>=0;i--){
    if(s.at(i)=='Z'){
      b=i;
      break;
    }
  }
  cout<<b-a+1;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

typedef std::vector<std::vector<int>> graph;

int d[300000] = {};

void dijkstra(int s, int n, graph &g) {
  // (最短距離, 頂点)
  priority_queue<pair<int, int>, vector<pair<int, int>>,
                 greater<pair<int, int>>>
      q;

  fill(d, d + n, INT_MAX);
  d[s] = 0;
  q.push(make_pair(0, s));

  while (!q.empty()) {
    auto p = q.top();
    q.pop();

    int v = p.second;
    if (d[v] < p.first)
      continue;
    REP(i, g[v].size()) {
      auto e = g[v][i];
      if (d[e] > d[v] + 1) {
        d[e] = d[v] + 1;
        q.push(make_pair(d[e], e));
      }
    }
  }
}

int main() {
  int n, m;
  cin >> n >> m;
  graph g(n * 3);
  REP(i, m) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v + n);
    g[u + n].push_back(v + 2 * n);
    g[u + 2 * n].push_back(v);
  }
  int s, t;
  cin >> s >> t;
  s--;
  t--;

  dijkstra(s, n * 3, g);
  if (d[t] == INT_MAX) {
    cout << -1 << endl;
  } else {
    cout << d[t] / 3 << endl;
  }
}


Measured memory_bytes: 17792
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i % 10 != 0 ],default=0)
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
if(df == 0):
        print(sum)
else:
        print(sum-df)

Measured memory_bytes: 3064
def gcd(a,b):
  if b == 0:
    return a
  else:
    return gcd(b,a%b)    

n,ans=int(input()),1
A=list(map(int,input().split()))
gcd_l,gcd_r=[],[]
l,r=A[0],A[n-1]

for i in range(n-1):
  l,r=gcd(l,A[i]),gcd(r,A[n-i-1])
  gcd_l.append(l)
  gcd_r.append(r)

for i in range(n-2):
  v=gcd(gcd_l[i],gcd_r[n-3-i])
  if v > ans:
    ans = v

if gcd_l[n-2] > ans:
  ans=gcd_l[n-2]
if gcd_r[n-2] > ans:
  ans=gcd_r[n-2]
  
print(ans)

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

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

    ll N, M;
    cin >> N >> M;

    vector<ll> id(100010);
    vector<vector<Pll>> p(100010);
    rep (i, M) {
        ll P, Y;
        cin >> P >> Y;
        P--;
        p[P].push_back(Pll(Y, i));
    }

    rep (i, N) {
        sort(p[i].begin(), p[i].end());
        rep (j, p[i].size()) {
            id[p[i][j].second] = ll(i+1)*1000000 + j+1;
        }
    }

    cout << setfill('0') << right;
    rep (i, M) {
        cout << setw(12) << id[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 7808
//#include<bits/stdc++.h>
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
using namespace std;

#define ios ios::sync_with_stdio(false)
#define ll long long
#define pa pair<int,int>
#define mk make_pair
#define sc(n) scanf("%d",&n)
#define ss(s) scanf("%s",s)
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define of(i,a,b) for(int i=a;i>=b;i--)
#define mem(a,b) memset(a,b,sizeof a)
#define uint unsigned int
#define vr vector<int>
#define pi acos(-1)

const ll inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7.;
const ll N = 1e6 + 7;

int n, m, t;
int a[N];

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a + 1, a + n + 1);
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = i + 1; j <= n; j++)
		{
			int cnt = 0;
			for (int k = j + 1; k <= n; k++)
			{
				if (a[i] + a[j] <= a[k])
					break;
				if (a[i] + a[k] <= a[j] || a[j] + a[k] <= a[i])
					continue;
				cnt++;
			}
			ans += cnt;
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

int main() {
	int n, t, a, h[1005] = { 0 }, ans;;
	double min = INFINITY;
	cin >> n >> t >> a;
	for (int i = 1; i <= n; i++) {
		cin >> h[i];
		if (min > abs(t - h[i] * 0.006 - a)) {
			min = abs(t - h[i] * 0.006 - a);
			ans = i;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define long long long
#define ull unsigned long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define pb push_back
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define V vector
#define debug(X) cerr<< #X << " = " <<X << endl
#define debug2(X,Y) cerr<< #X << " = " <<X << ","<<#Y<<" = "<<Y<<endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar

using namespace std;

inline void read(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for (;((c<48 || c>57) && c != '-') ;c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
inline void writeln(int x){

         char buffor[21];
         register int i=0;
         int neg=0; if (x<0) {neg=1; x= -x;}
         do{
               buffor[i++]=(x%10)+'0';
               x/=10;
            } while(x);
           i--;
           if (neg) pc('-');
           while(i>=0) pc(buffor[i--]);
           pc('\n');
       }
const int N= (int) 1e5+10;
int n;
V<int> a[N];
int match[N];

void input()
{
    cin>>n;
    up(i,1,n-1)
    {
        int u,v; cin>>u>>v;
        a[u].pb(v); a[v].pb(u);
    }
}
void dfs(int u,int p)
{
    for (auto v: a[u])
		if (v!=p)
		{
			dfs(v,u);
		}
    if (u!=1 and !match[u] and !match[p] ) match[u]= match[p]= 1;
}
void solve()
{
    dfs(1,-1);
    up(i,1,n) if (!match[i])
    {
      cout<<"First"; return;
    };
    cout<<"Second";

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);// don't use when interactive
    #define TASK "tmp"
   // freopen(TASK".inp","r",stdin);
   // freopen(TASK".out","w",stdout);

    input();
    solve();

    return 0;
}


Measured memory_bytes: 6272
p case gets.to_i
when 400..599; 8
when 600..799; 7
when 800..999; 6
when 1000..1199; 5
when 1200..1399; 4
when 1400..1599; 3
when 1600..1799; 2
when 1800..1999; 1
end


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

int main(){
int n,c=0;
cin>>n;

for(int i=1;i<=9;i++){

    if(n%i==0){
        int x=n/i;
        if(x<10){

            c++;
            break;
        }
    }

}
if(c==1){
    printf("Yes");

}
else{
     printf("No");
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;

    vp ba(m);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        ba[i] = P(b, a);
    }
    sort(ba.begin(), ba.end());
    int now = 0;
    int ans = 0;
    rep(i, m) {
        int a = ba[i].se;
        int b = ba[i].fi;
        if (a <= now && now < b) continue;
        ans++;
        now = b-1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
typedef long long ll;
map<string,ll> mp;
string s;
int main()
{
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++)
    {
        cin>>s;
        mp[s]++;
    }
    ll temp=0;
    for(map<string,ll>::iterator it=mp.begin();it!=mp.end();it++)
    {
        temp=max(temp,it->second);
    }
    for(map<string,ll>::iterator it=mp.begin();it!=mp.end();it++)
    {
        if(it->second==temp) cout<<it->first<<endl;
    }
	return 0;
}


Measured memory_bytes: 18176
from collections import Counter
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
d = Counter(a)

for i in range(m):
    b, c = map(int, input().split())
    d[c] += b
key = list(d.keys())
key.sort(reverse = True)

ans = 0
for k in key:
    if n <= d[k]:
        ans += k*n
        break
    else:
        ans += k*d[k]
        n -= d[k]

print(ans)

Measured memory_bytes: 110116
#include<iostream>
#include<string>

using namespace std;

int main() {
	int a, b, c;	cin >> a >> b >> c;
	int answer = 3;
	if (a == b) {
		--answer;
	}
	if (b == c) {
		--answer;
	}
	if (c == a) {
		--answer;
	}
	if (answer == 0) {
		answer = 1;
	}
	cout << answer << endl;
	cin >> answer;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  long h, w;
  long sum;
  
  scanf("%ld", &h);
  scanf("%ld", &w);
  
  sum = (h * w + 1) / 2;
  
  if(h == 1L || w == 1L)
    sum = 1L;
  
  printf("%ld\n", sum);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <sstream>
#include <limits.h>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    
    //int a[n];
    std::vector<int> v;
    for(int i=0; i<n; i++){
        int tmp;
        cin >> tmp;
        v.push_back(tmp);
    }
    std::sort(v.begin(), v.end());
    
    int sum = 0;
    for(int i=0; i<k; i++){
        sum += v[i];
    }
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 3632
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]

point_list = [K-Q]*N

for i in range(Q):
  point_list[A[i]-1] += 1
for i in range(N):
  if point_list[i] <= 0:
    print("No")
  else:
    print("Yes")
  

Measured memory_bytes: 10472
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007


int main(){
	char s[303], t[303];
	scanf("%s%s", &s, &t);
	strcat(t, s);
	printf("%s\n", t);

	return 0;
}

Measured memory_bytes: 128
n, k = map(int, input().split())
arr = list(map(int, input().split()))
dp = [False] * (k + 1)

for i in range(k + 1):
    if not dp[i]:
        for a in arr:
            if i + a > k:
                break
            dp[i + a] = True

print("First" if dp[k] else "Second")


Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;

int main(){
    string s;
    cin >> s;
    vector<char> ans = {};
    for (int i=0;i<s.size();i++){
        if (s[i] == '0') ans.push_back('0');
        else if (s[i] == '1') ans.push_back('1');
        else if (s[i] == 'B') {
            if (!ans.empty())ans.pop_back();
        }
    }
    for (auto x:ans) cout << x;
    cout << endl;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    tmp = input[0].split(" ");
    //出力
    console.log(tmp[1] + tmp[0]);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
use proconio::input;

fn main() {
    input! {
        h: usize,
        n: usize,
        a: [usize; n]
    }

    solve(h, &a);
}

fn solve(h: usize, a: &[usize]) {
    let s = a.iter().sum::<usize>();

    match h.cmp(&s) {
        std::cmp::Ordering::Greater => println!("No"),
        _ => println!("Yes"),
    }
}


Measured memory_bytes: 3228
#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include<algorithm>
#include <sstream>
using namespace std;
long long inf=100000000000007;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
typedef pair<int,int>  P;
string alph("abcdefghijklmnopqrstuvwxyz");
struct edge{int to,cost;};
vector<edge> G[22];
vector<int> O[10];
P sg[10];
int d[1005][1005]={};
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
pair<int,double> s[1005];
int c=0;
int n,k;
int fi[1005][1005];
int ans[1005][1005]={};

signed main(){
    int n;cin>>n;int k;cin>>k;
    int num[200005]={};
    rep(i,n){
        int a;cin>>a;
        num[a]++;
    }
    sort(num,num+n);
    reverse(num,num+n);
    int to=0;
    rep(i,k){
        to+=num[i];
    }
    cout<<n-to<<endl;
    return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <cstdint>
#include <numeric>
#define INF 1000000000
#define LLINF 2000000000000000
#define MOD 1000000007
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
#define int long long

signed main(){
  int n;
  cin >> n;
  string ans(' ',10);
  int cnt = 0;
  while(1){
    n-=1;
    ans[cnt] ='a' + n%26;
    n/=26;
    cnt++;
    if(n==0)break;
  }
  LOOP(i,cnt){
    cout << ans[cnt-i-1];
  }
  // cout << ans << endl;
}


Measured memory_bytes: 3620
#include<cstdio>

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

using namespace std;

int main(){
	for(int cas=1,n,m;scanf("%d%d",&n,&m),n;cas++){
		int t=0;
		int win[21]={n};
		while(win[m]==0){
			int next[21]={};
			rep(i,m){
				next[i+1]+=win[i]/2;
				next[ 0 ]+=win[i]/2;
				next[ i ]+=win[i]%2;
			}
			rep(i,m+1) win[i]=next[i];
			t++;
		}
		printf("Case %d: %d\n",cas,t);
	}

	return 0;
}

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

const ll mod = 1e9+7;

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

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

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

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

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

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


const int MAX = 1000005;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}
long long COM(int n, int k){
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

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

    ll X, Y; cin >> X >> Y;
    COMinit();

    ll ans = 0;
    rep(a, X+1) if((X-a)%2==0 && (X-a)/2==Y-2*a) {
        ll b = Y-2*a;
        ans += COM(a+b, a);
        chmod(ans);
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

constexpr double ra = (180.0/M_PI);

int main(int argc, char **argv)
{
	double a, b, x; cin >> a >> b >> x;
	double PI = acos(-1.0);
	x /= a;
	std::cout << fixed << setprecision(10);
	if (2*x >= a*b)
		std::cout << atan(2*(a*b-x)/pow(a, 2)) * ra<< std::endl;
	else
		std::cout << atan(pow(b, 2)/(2*x)) * ra<< std::endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int n,k;
ll x[100100];

int main(){
	cin>>n>>k;
	int min=INF;
	REP(i,n)
		cin>>x[i];
	for(int i=0;i<=n-k;i++){
		int t=abs(x[i])+abs(x[i]-x[i+k-1]);
		int s=abs(x[i+k-1])+abs(x[i]-x[i+k-1]);
		t=min(t,s);
		min=min(min,t);
	}
	cout<<min<<endl;
	return 0;
}
	
	

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

using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0); 
	string str;
	cin>>str;
	if(str[(str.size())-1]=='s')
	cout<<str<<"es";
	else
	cout<<str<<"s";
	
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace  std;
typedef long long int ll;
typedef long double ld;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define rsz(a,n) a.resize(n)
#define test(t) ll t;cin>>t;while(t--)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define fillv(a,k) memset(a,k,sizeof(a))
#define filla(a,k,n) memset(a,k,sizeof(a[0])*n)
#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
#define sp cout<<" "
#define spaceprint(a,i,s,n) {forsn(i,s,n) { cout<<a[i]; sp;}}
#define lineprint(a,i,s,n) {forsn(i,s,n) {cout<<a[i]; ln;}}
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
#define all(c) c.begin(),c.end()
#define trav(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element)  (find(all(container),element) != container.end())// check the presence of element
//copy(from_begin, from_end, to_begin); copy function
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<string> vs;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
ll dp[1<<22];
ll n,k;
ll a[25][25];
ll b[200005];

void solve(ll k)
{
    ll n=bitcount(k);
    if(dp[k]!=-1)
    {
        return;
    }
    if(k==0)
    {
        dp[k]=1;
        // cout<<k<<" "<<dp[k]<<" ";
        // ln;
        return;
    }
    dp[k]=0;
    ll i=0;
    ll t=k;
    while(t>0)
    {
        if(t&1)
        {
            // cout<<t<<"k"<<k<<"n"<<n<<"i"<<i;
            // ln;
            if(a[i][n-1]==1)
            {
                // cout<<"enter"<<t;
                // ln;
                solve(k-(1<<i));
                dp[k]=(dp[k]+dp[k-(1<<i)])%MOD;
            }
        }
        i++;
        t=t/2;
    }
    // cout<<k<<" "<<dp[k]<<" ";
    // ln;


}
int main()
{
    ll n;
    cin>>n;
    ll i,j;
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            cin>>a[i][j];
        }
    }
    ll k=1<<n;
    k--;
    //cout<<k;
    fillv(dp,-1);
    solve(k);
    cout<<dp[k];


}


Measured memory_bytes: 33024