akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

#define lpsbd(i, s, b, d) for(size_t i = (s); i < (b); i+=(d))
#define lpsb(i, s, b) for(size_t i = (s); i < (b); i++)
#define lpn(i, n) for(size_t i = 0; i < (n); i++)
#define fa(i, x) for(auto &i: x)
#define vcd(t, n, d) vector<t>(n, d)
#define vc(t, n) vector<t>(n)
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

const ll MOD = 1000000007;

int main(void)
{
    int N;
    cin >> N;
    vector<int> p, ans;
    bool flag;
    lpsbd(i, 3, 55556, 2)
    {
        flag = true;
        fa(j, p)
        {
            if (i < j * 2) break;
            if (!(i % j))
            {
                flag = false;
                break;
            }
        }
        if (flag)
        {
            p.push_back(i);
            if (i % 10 == 3) ans.push_back(i);
        }
        if (ans.size() == N) break;
    }
    cout << ans[0];
    lpsb(i, 1, N) cout << " " << ans[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String key = sc.nextLine();
        String BREAKW="END_OF_TEXT";
        int count=0;
        String ans = "";
        while(true) {
            String str =sc.nextLine();
            if(str.equals(BREAKW))break;
            ans = ans +" "+str;
        }

        String word[] = ans.split(" ");
        for(int i=0;i<word.length;i++) {
        	if(word[i].equalsIgnoreCase(key))count++;
        }
         System.out.println(count);
        sc.close();
    }
}


Measured memory_bytes: 26068
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
    int a,b;
    cin >> a >>b;
    int k = int(a/0.08);
    int l = int(b/0.1);
    for(int i=min(k,l);i<=max(k,l)+10;i++){
        if(int(i*0.08)==a&&int(i*0.1)==b){cout<<i;return 0;}
    
    }
 
    cout << -1;
}

Measured memory_bytes: 256
S = input()
if len(S) < 4:
    print(0)
    exit(0)
dp = [0]*2019
dp[0] = 1
s = int(S[-1])
dp[s] = 1
ans = 0
for k in range(len(S)-2,-1,-1):
    s = int(S[k])*(pow(10,len(S)-k-1,2019)) + s
    s %= 2019
    dp[s] += 1
for e in dp:
    ans += e*(e-1)//2
print(ans)


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

#define int long long

using namespace std;



const int MAXN = 100 * 1000 + 123;












int n, q, z[MAXN];
vector<int> v;
map<int, int> mp;




int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	cin >> n >> q;
	v.push_back(n);
	for (int i = 0; i < q; i++) {
		int f;
		cin >> f;
		while (!v.empty() && v.back() >= f) v.pop_back();
		v.push_back(f);
	}
	reverse(v.begin(), v.end());
	mp[v[0]] = 1;
	for (int i = 0; i < (int)v.size(); i++) {
		int a = v[i];
		while (a > v.back()) {
			int tmp = *--upper_bound(v.rbegin(), v.rend() - i - 1, a);
			mp[tmp] += mp[v[i]] * (a / tmp);
			a %= tmp;
		}
		z[a] += mp[v[i]];
	}
	for (int i = MAXN - 2; ~i; i--) z[i] = z[i] + z[i + 1];
	for (int i = 1; i <= n; i++) cout << z[i] << '\n';
	return 0;
}

Measured memory_bytes: 9588
/*=============================================================================================================================/*
                                               Bismillahir Rahmanir Rahim

      _     ____  ___  ____   _   _  _         ___  ____   _         _     __  __
     / \   / ___||_ _|| __ ) | | | || |       |_ _|/ ___| | |       / \   |  \/  |
    / _ \  \___ \ | | |  _ \ | | | || |        | | \___ \ | |      / _ \  | |\/| |
   / ___ \  ___) || | | |_) || |_| || |___     | |  ___) || |___  / ___ \ | |  | |
  /_/   \_\|____/|___||____/  \___/ |_____|   |___||____/ |_____|/_/   \_\|_|  |_|

   _   __           __  __  __
  |_) (_  _  o__   /   (_  |_
  |_)o__)(_  || |  \__ __) |__

    ___                    _   _      _                _ _               __   ___                 _         _        _
   / __|_ _ ___ ___ _ _   | | | |_ _ (_)_ _____ _ _ __(_) |_ _  _   ___ / _| | _ ) __ _ _ _  __ _| |__ _ __| |___ __| |_
  | (_ | '_/ -_) -_) ' \  | |_| | ' \| \ V / -_) '_(_-< |  _| || | / _ \  _| | _ \/ _` | ' \/ _` | / _` / _` / -_|_-< ' \
   \___|_| \___\___|_||_|  \___/|_||_|_|\_/\___|_| /__/_|\__|\_, | \___/_|   |___/\__,_|_||_\__, |_\__,_\__,_\___/__/_||_|
                                                            |__/                           |___/


   FB: https://facebook.com/SIAsibul
   Gmail: asibulislam8@gmail.com

/*=============================================================================================================================*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vii;
typedef vector<pil> vil;
typedef vector<pli> vli;
typedef vector<pll> vll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,n) for(ll i=0;i<(n);i++)
#define f1(i,n) for(ll i=1;i<=(n);i++)
#define f2(i,a,n) for(ll i=(a);i<=(n);i++)
#define fr(i,n,a) for(ll i=(n);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))
#define nl "\n"


const int INF = 1e9 + 5;
const int MXN = 2e5 + 5;
const int MOD = 1e9 + 7;


void solve(){
    int n; cin >> n;
    string s; cin >> s;
    int r = 0;
    f0(i, n) r += s[i] == 'R';
    int ans = 0;
    f0(i, r) ans += s[i] == 'W';
    cout << ans;
}

int main(){
    ll t;
    //cin >> t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
 }


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

using namespace std;

long long solve(const vector<long long> data, int sign) {
    int n = data.size();
    vector<long long> a = data;
    
    long long result = 0;
    long long sum = 0;
    for(int i=0; i<n; i++) {
        long long k = (sum + a[i]) * sign;
        if(i%2!=0) {
            if(k <= 0) {
                result += 1 - k;
                a[i] += (1 - k) * sign;
            }
        }
        else {
            if(k >= 0) {
                result += 1 + k;
                a[i] -= (1 + k) * sign;
            }
        }
        sum += a[i];
    }
    
    return result;
    
}

int main(void){

    int n;
    cin >> n;
    vector<long long> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    
    cout << min(solve(a, 1), solve(a, -1)) << endl;

    return 0;
    
}


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

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}



int main()
 {  fast();
   int n,k;
   cin>>n>>k;
   int p[n];
   for(int i=0;i<n;i++)
   cin>>p[i];
   sort(p,p+n);
   int res=0;
   for(int i=0;i<k;i++)
   res+=p[i];
   cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 3616
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) //[l, r)
#define rep(i,n) REP(i,0,n)           //[0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showslr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i];}cerr<<endl //[l, r))

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}

void _DEBUG(){cerr<<endl;}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<",";_DEBUG(b...);}

template<typename T> inline void in(T &e){cin>>e;}
template<typename H,typename... T>void in(H &a, T&... b){in(a);in(b...);}
template<typename T> inline void out(T e){cout<<e<<endl;}
template<typename H,typename... T> void out(H a, T... b){out(a);out(b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int a,b,c;
int x;

int ans=0;

signed main(){
    io();
    in(a,b,c);
    in(x);

    rep(i,a+1){
        rep(j,b+1){
            rep(k,c+1){
                //show(i,j,k,500*i+100*j+50*k);
                if((500*i+100*j+50*k)==x){
                    ans++;
                }
            }
        }
    }

    out(ans);

    return 0;
}


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

int main() {
    int N, V[2]; cin >> N >> V[0] >> V[1];
    vector<vector<int>> G(N+1);
    for (int i = 0; i < N-1; i++) {
        int a, b; cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    vector<vector<int>> dist(2, vector<int>(N+1, -1));
    for (int i = 0; i < 2; i++) {
        queue<int> q;
        q.push(V[i]);
        dist[i][V[i]] = 0;
        while (!q.empty()) {
            int v = q.front(); q.pop();
            for (int u : G[v]) {
                if (dist[i][u] != -1) continue;
                q.push(u);
                dist[i][u] = dist[i][v] + 1;
            }
        }
    }

    int ans = 0;
    for (int i = 1; i <= N; i++) {
        if (G[i].size() == 1 && dist[0][i] < dist[1][i]) {
            ans = max(ans, dist[1][i] - 1);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 7040
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>
#include <bitset>
#include <fstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

#define INF 1000000007ll
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )
#define err(x) cerr << #x << " = " << x << endl;
#define SIZE 200010

char s[SIZE];
int pres[SIZE][26] = {0}, nxt[SIZE], len[SIZE], ch[SIZE];
vi pos[26];

int main() {
   scanf("%s", s);
   int l = strlen(s);
   ch[l] = 'a'; 
   len[l] = 1;
   len[l + 1] = 0;
   nxt[l] = l + 1;
   for (int i = 0 ; i < l ; ++i) {
      pos[s[i] - 'a'].PB(i);
   }
   for (int i = 0 ; i < 26 ; ++i) pos[i].PB(l);
   for (int i = l - 1 ; i >= 0 ; --i) {
      len[i] = ch[i] = INF;
      for (int j = 0 ; j < 26 ; ++j) {
         int e = pos[j].size() - 1, s = -1;
         while (e - s > 1) {
            int m = ((e + s) >> 1);
            if (pos[j][m] >= i) e = m;
            else s = m;  
         }
         int curr_len = len[pos[j][e] + 1] + 1;
         if (len[i] > curr_len) {
            len[i] = curr_len;
            nxt[i] = pos[j][e] + 1;
            ch[i] = j;
         }
      }
   }

   int curr = 0;
   while (curr <= l) {
      printf("%c", 'a' + ch[curr]);
      curr = nxt[curr];
   }
   printf("\n");

   return 0;
}

Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a[2][101],dp[2][101];
	int n,i,j;
	cin>>n;
	memset(dp,0,sizeof(dp));
	for(i=0;i<2;i++){
		for(j=0;j<n;j++){
			cin>>a[i][j];
		}
	}
	dp[0][0]=a[0][0];
	dp[1][0]=a[1][0]+a[0][0];
	for(i=1;i<n;i++){
		dp[0][i]=dp[0][i-1]+a[0][i];
	}
	for(i=1;i<n;i++){
		dp[1][i]=max(dp[0][i],dp[1][i-1])+a[1][i];
	}
	cout<<dp[1][n-1];
	return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
mod = 10**9+7
L = [0 for i in range(k+1)]
for i in range(k, 0, -1):
    t = pow(k//i, n, mod)
    cnt = 2
    while cnt*i <= k:
        t -= L[cnt*i]
        cnt += 1
    L[i] = t
ans = 0
for i in range(1,k+1):
    ans += i*(L[i]%mod)%mod
    ans %= mod
print(ans%mod)

Measured memory_bytes: 11096
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,coordinate = 0,count = 1;
    cin >> n >> x;
    for(int i = 0;i < n;i++)
    {
        int a;
        cin >> a;
        coordinate += a;
        if(coordinate <= x)
        {
            count++;
        }
    }
    cout << count;

    return 0;
}

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

using namespace std;

typedef long long ll;

int main()
{
    int n;
    cin >> n;
    vector<int> vec[n+1];
    for(int i = 0; i < n-1; i ++)
    {
        int x, y;
        cin >> x >> y;
        vec[x].push_back(y);
        vec[y].push_back(x);
    }
    vector<int> c(n), d(n+1, 0);
    for(int i = 0; i < n; i++) cin >> c[i];
    sort(c.rbegin(), c.rend());
    int ans = 0, k = 0;
  	queue<int> q;
  	q.push(1);
  	while(!q.empty()){
    	int top = q.front();
      	q.pop();
      	d[top] = c[k++]; 
      	ans += d[top];
      	for(auto x: vec[top])
        {
        	if(d[x] == 0)  q.push(x);
        }
    }	
  	cout << ans - c[0] << endl;
  	for(int i = 1; i <= n; i++) cout << d[i] << " " ;
}


Measured memory_bytes: 4300
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define pb push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define all(v) ALL(v)
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr double eps = 1e-14; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

double p;
constexpr int MN = 100001;
int N;
vector<pii> g[MN];

double poi;

double dfs1(int cur,int pre){
    double ret=0;
    for(int i=0;i<g[cur].size();i++){
        if(g[cur][i].first==pre) continue;
        ret += p*(double)(g[cur][i].second+dfs1(g[cur][i].first,cur));
    }
    return ret;
}

double dfs2(int cur,int pre){
    double ret=poi;
    for(int i=0;i<g[cur].size();i++){
        if(g[cur][i].first==pre) continue;
        ret += p*(g[cur][i].second+dfs2(g[cur][i].first,cur));
    }
    return ret;
}

int main(){
    cin >> p;
    cin >> N;
    rep(i,N-1){
        int x,y,c;cin>>x>>y>>c;
        x--;y--;
        g[x].pb(MP(y,c));
        g[y].pb(MP(x,c));
    }
    poi = dfs1(0,-1);
    cout << Double(dfs2(0,-1)) << endl;
}

Measured memory_bytes: 14912
import math
N = int(input())
S = input()

lst0 = [0]*N
lst1 = [0]*N
lst0[0] = 1
lst1[0] = 1
c = S.count('1')
m0 = int(S[-1])
m1 = int(S[-1])
for i in range(1, N):
    lst0[i] += (lst0[i-1]*2)%(c+1)
    if c == 1:lst1[i] = 0
    else: lst1[i] += (lst1[i-1]*2)%(c-1)
    m0 += lst0[i] * int(S[N - 1- i])
    m0 %= c+1
    m1 += (lst1[i] * int(S[N - 1 - i]))
    if c == 1: m1 = 0
    else: m1 %= c-1

memo = [0]*(N+1)

def calc(a):
    global ans, memo
    if a == 0: return ans
    ans += 1
    if memo[a] != 0:
        b = memo[a]
    else:
        b = bin(a).count('1')
        memo[a] = b
    return calc(a%b)
    
for i in range(N):
    if S[i] == '1':
        b = c - 1
        if b == 0: a = 0
        else: a = max((m1 - lst1[N - 1 - i])%b, (m1 - lst1[N - 1 - i]+ b)%b)
    else:
        b = c + 1
        a = (m0 + lst0[N - 1 - i])%b
    if b == 0: print(0)
    elif a == 0:print(1)
    else:
        ans = 1
        print(calc(a))

Measured memory_bytes: 26648
N = int(input())

t,x,y =[[],[],[]]

for i in range(N) :
	t_t, t_x, t_y = [int(i) for i in input().split()]
	t.append(t_t)
	x.append(t_x)
	y.append(t_y)

output = 'Yes'

p_t, p_x, p_y = [0,0,0]

for i in range(N) :
	time = t[i] - p_t
	dis_x = x[i] - p_x
	dis_y = y[i] - p_y
	time -= ( abs(dis_x) + abs(dis_y) )
	if ( time < 0 ) or ( time % 2 != 0 ) :
		output = 'No'
		break
	p_t = t[i]
	p_x = x[i]
	p_y = y[i]

print(output)

Measured memory_bytes: 11808
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(void)
{
    string s, t;
    cin >> s >> t;
    int ans = 1;
    for (int i = 0; s[i] != '\0'; i++)
    {
        if (s[i] != t[i])
        {
            ans = 0;
            break;
        }
    }
    cout << ((ans == 1) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>
                    int main(void){
                    long long int X,Y,i=1,ans=-2;
                    int nans=-1;
                    scanf("%lld",&X);
                    scanf("%lld",&Y);
                    if(X<Y) ans =X;
                    if(Y==1) {
                    printf("%d",nans);
                    return 0;
                   }
                    if(X>Y) {
                    if(X%Y!=0) ans = X;
                  }
                     if(ans!=-2) printf("%lld\n",ans);
                     else printf("%d",nans);
                    return 0;
                    }

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000

typedef long long LL;
typedef long double LD;

bool le(string &a,string &b){
  if(a.length()<b.length()) return true;
  if(a.length()>b.length()) return false;
  if(a<=b) return true;
  return false;
}

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> nd={0,2,5,5,4,5,6,3,7,6};
  vector<int> a(m);
  int mi=9;
  for(int i=0;i<m;i++){
    cin >> a[i];
    mi=min(mi,nd[a[i]]);
  }
  sort(all(a));
  int keta=n/mi;
  int ma,id;
  vector<vector<pair<int,int>>> dp(keta+1,vector<pair<int,int>>(n+1,{-1,-1}));
  dp[0][n]={0,0};
  for(int i=1;i<=keta;i++){
    for(int j=0;j<n-1;j++){
      ma=-1,id=-1;
      for(int k=0;k<m;k++){
        if(j+nd[a[k]]<=n){
          if(dp[i-1][j+nd[a[k]]].first!=-1){
            ma=a[k];
            id=j+nd[a[k]];
          }
        }
      }
      dp[i][j]={ma,id};
    }
  }
  string ans="";
  for(int i=keta;i>0;i--){
    if(dp[i][0].first!=-1){
      int now=0;
      for(int j=i;j>0;j--){
        ans+=to_string(dp[j][now].first);
        now=dp[j][now].second;
      }
      break;
    }
  }
  sort(all(a),greater<int>());
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 391168
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] arr = sc.next().toCharArray();
        int length = arr.length;
        int left = 0;
        int right = length - 1;
        while (left < right) {
            if (arr[left] != arr[right]) {
                System.out.println("No");
                return;
            }
            left++;
            right--;
        }
        left = 0;
        right = length / 2 - 1;
        while (left < right) {
            if (arr[left] != arr[right]) {
                System.out.println("No");
                return;
            }
            left++;
            right--;
        }
        left = (length + 3) / 2 - 1;
        right = length - 1;
        while (left < right) {
            if (arr[left] != arr[right]) {
                System.out.println("No");
                return;
            }
            left++;
            right--;
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 25428
function Main(input) {
  input = input.split("\n");
  const N = input[0];

  //string.matchを使った正規表現で文字列がすべてが大文字ならtrue
  const isUpperCase = str => {
  let arr = str.match(/^[A-Z]+$/)
  return arr ? true : false
  }
  console.log(isUpperCase(N) ? "A" : "a") 

}
// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

signed main() {
    int h, w;
    while (cin >> h >> w and h and w) {
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                if (i == 0 or j == 0 or i == h - 1 or j == w - 1) cout << '#';
                else cout << '.';
            }
            cout << endl;
        }
        cout << endl;
    }
}



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

int main()
{
	long long int i, n, ans=0, x, y;
	cin >> n;

	long long int a[n], b[n], c[n], val[n];

	for(i=0; i<n; i+=1)
		cin >> a[i];
	sort(a, a+n);
	for(i=0; i<n; i+=1)
		cin >> b[i];
	sort(b, b+n);
	for(i=0; i<n; i+=1)
		cin >> c[i];
	sort(c, c+n);

	for(i=0; i<n; i+=1)
	{
		x=b[i];
		y=upper_bound(c, c+n, x)-c;
		val[i]=n-y;
	}
	for(i=1; i<n; i+=1)
		val[i]+=val[i-1];

	for(i=0; i<n; i+=1)
	{
		x=a[i];
		y=upper_bound(b, b+n, x)-b;
		if(y==0)
			ans+=val[n-1];
		else
			ans+=val[n-1]-val[y-1];
	}

	cout << ans << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int n;cin>>n;
  int a[n];
  REP(i,n){
    cin>>a[i];
  }

  int ans = 0;
  int count = 0;
  REP(i,n){
    if(a[i] == count + 1){
      //やったー
      count++;
    }else{
      ans++;
    }
  }

  if(ans == n){
    cout<<-1<<endl;
  }else{
    cout<<ans<<endl;
  }

 

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;

int main()
{
    int n;
    char s[1024];

    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> s[i];
    }
    s[n] ='\n';

    int max_c = 0;
    for(int i = 1; i < n; i++) {
        set<char> s1, s2, r;
        for(int j = 0; j < i; j++) {
            s1.insert(s[j]);
        }
        for(int j = i; j < n; j++) {
            s2.insert(s[j]);
        }
        set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), inserter(r, r.end()));
        if(r.size() > max_c) {
            max_c = r.size();
        }
    }
    cout << max_c;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
int main(){
	int arr[3];
  int ans[3];
  for(int i=0;i<3;i++){
  	cin>>arr[i];  
  }
  ans[0]=arr[2];
  ans[1]=arr[0];
  ans[2]=arr[1];
  cout<<ans[0]<<" "<<ans[1]<<" "<<ans[2];
 
 
 
 
return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define rep1(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); i++)
#define get4(_1, _2, _3, _4, ...) _4
#define rep(...) get4(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
using namespace std;
typedef long long ll;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  sort(all(l));
  ll ans = 0;
  rep(i, n) {
    rep(j, i + 1, n) {
      int a = l[i];
      int b = l[j];
      int upper = n;
      int lower = j;
      while (upper - lower > 1) {
        int mid = (upper + lower) / 2;
        int c = l[mid];
        if (j == mid) continue;
        if (c < a + b) {
          lower = mid;
        } else {
          upper = mid;
        }
      }
      ans += lower - (j + 1) + 1;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int H, W;
char S[52][52];

void solve(){
	rep(i, H + 2)
		S[i][0] = S[i][W + 1] = '.';
	rep(i, W + 2)
		S[0][i] = S[H + 1][i] = '.';
	reps(i, H){
		reps(j, W){
			if(S[i][j] == '.'){
				int c = 0;
				rep(k, 8){
					if(S[i + dx[k]][j + dy[k]] == '#')
						c++;
				}
				S[i][j] = '0' + c;
			}
			cout << S[i][j];
		}
		cout << endl;
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> H >> W;
	reps(i, H)
		reps(j, W)
		cin >> S[i][j];
		solve();
	return 0;
}


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

using namespace std;

typedef long long int64;

const int64 mod = 1e9 + 7;

inline int64 modPow(int64 x, int64 n)
{
  if(n == 0) return (1);
  int64 ret = modPow(x, n / 2);
  (ret *= ret) %= mod;
  if(n & 1) (ret *= x) %= mod;
  return (ret);
}

inline int64 modInv(int64 a)
{
  return (modPow(a, mod - 2));
}

int main()
{
  int64 N, D, X;
  int64 dp[2001];
  int64 fact[2001];

  fact[0] = 1;
  for(int i = 1; i < 2001; i++) (fact[i] = fact[i - 1] * i) %= mod;


  while(cin >> N >> D >> X, N) {

    memset(dp, 0, sizeof(dp));
    dp[0] = 1;

    int64 ret = 0, now = 1;
    for(int64 i = 1; i <= min(D, N); i++) {
      // dp[i][j] := sum[k=j-X+1..j-1] dp[i - 1][k]
      for(int64 j = 1; j <= N; j++) (dp[j] += dp[j - 1]) %= mod;
      for(int64 j = N; j > 0; j--) {
        int64 sub = (j - X < 0 ? 
                     0 : dp[j - X]);
        dp[j] = (dp[j - 1] - sub + mod) % mod;
      }
      dp[0] = 0;
      (now *= (D - i + 1) % mod) %= mod;
      (ret += now * modInv(fact[i]) % mod * dp[N] % mod) %= mod;
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 3000
#include <algorithm>
#include <cctype>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  int A, B;
  string S;
  while (cin >> A >> B >> S) {
    bool ok = true;
    for (int i = 0; i < A; i++) ok &= !!isdigit(S[i]);
    ok &= S[A] == '-';
    for (int i = 0; i < B; i++) ok &= !!isdigit(S[A + i + 1]);
    cout << (ok ? "Yes" : "No") << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> dist;
vector<vector<int>> there;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int n;
void upd (int x, int y, int d) {
  dist[x][y] = d;
  d += there[x][y];
  for (int i = 0; i < 4; i++) {
    int xx = x + dx[i];
    int yy = y + dy[i];
    if (xx < 0 || xx >= n || yy < 0 || yy >= n || dist[xx][yy] <= d) continue;
    upd(xx, yy, d);
  }
}
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n;
  dist = vector<vector<int>>(n, vector<int>(n));
  there = vector<vector<int>>(n, vector<int>(n, 1));
  for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
    dist[i][j] = min({i, j, n - 1 - i, n - 1 - j});
  }
  vector<int> p(n * n);
  for (int i = 0; i < n * n; i++) {
    cin >> p[i];
    p[i]--;
  }
  int ans = 0;
  for (auto& k : p) {
    int x = k / n;
    int y = k % n;
    ans += dist[x][y];
    there[x][y] = 0;
    upd(x, y, dist[x][y]);
  }
  cout << ans << endl;
  return 0;
}

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

P f(int x){
	int a,b;
	a=x%10;
	while (x>=10){
		x/=10;
	}
	b=x;
	return (make_pair(b,a));
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
  cin>>n;
	//map(＜first,last>,num)
	map<P,int> mp;

	rep(i,n){
		P p=f(i+1);
	//	cout<<p.first<<' '<<p.second<<endl;
		mp[p]++;
	}
	int ans=0;
	rep(i,n){
		P p=f(i+1);
		P p1=make_pair(p.second,p.first);
		ans+=mp[p1];

	}

cout<<ans;
}


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

int main() {
  string s; cin >> s;
  int sn = s.size();
  string ans = "YES";
  if (sn == 1) {
    cout << ans << endl;
    return 0;
  }
  if (sn == 2 && s[0] != s[1]) {
    cout << ans << endl;
    return 0;
  }
  map<char,int> ms;
  rep(i,sn) ms[s[i]]++;
  int q = min(min(ms['a'], ms['b']), ms['c']);
  if (q == 0) {
    ans = "NO";
    cout << ans << endl;
    return 0;
  }
  for (auto a : ms) {
    int v = a.second;
    if (v - q > 1) {
      ans = "NO";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3764
t = gets.to_i

t.times do |i|
  a, b, c, d = gets.split.map{|s|s.to_i}
  zaiko = []

  if a < b or b > d
    puts "No"
  elsif b <= c
    puts "Yes"
  else
    g = b.gcd(d)
    if (b - g + a % g > c)
      puts "No"
    else
      puts "Yes"
    end
  end
end

Measured memory_bytes: 1916
/*                              _______                                _________
        |\     |         /\         |      |        /\        |\     |    |
        | \    |        /  \        |      |       /  \       | \    |    |
        |  \   |       /    \       |\-----       /    \      |  \   |    |
        |   \  |      /======\      | \          /======\     |   \  |    |     ====|
        |    \ |     /        \     |  \        /        \    |    \ |    |         |
        |     \|    /          \    |   \      /          \   |     \|    |_________|
    */
    #include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define pb push_back
    #define mk make_pair
    #define endl "\n"
    #define vi vector<ll>
    #define vb vector<bool>
    #define pii pair<ll,ll>
    #define ss second
    #define ff first
    #define vpii vector<pii>
    #define vvi vector<vi >
    #define vs vector<string>
    #define vvs vector<vs >
    #define all(x) x.begin(),x.end()
    #define mii map<int,int>
    #define rep(i,n) for(ll i=0;i<n;i++)
    #define per(i,n) for(ll i=n-1;i>=0;i--)
    #define rep1(i,n) for(ll i=1;i<=n;i++)
    #define per1(i,n) for(ll i=n;i>0;i--)
    #define repeat(i,start,n) for(ll i=start;i<n;i++)
    #define inp(arr,n) int arr[n];rep(i,n){ cin>>arr[i];}
    #define inp1(arr,n) ll arr[n+1];rep1(i,n){ cin>>arr[i];}
    #define print(a,n) for(ll i=0;i<n;i++){ cout<<a[i]<<" ";}
    #define print1(a,n) for(ll i=1;i<=n;i++){ cout<<a[i]<<endl;}
    #define M 1000000007
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        int t=1,T=1;
        //cin>>t;
        while(t--)
        {
            double l,temp,ans;
            cin>>l;
            temp=l/3;
            ans=temp*temp;
            ans=ans*temp;
            cout<<setprecision(13)<<ans;
        }

    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
 
const ll MOD =998244353;
 
// a^n MOD を計算する
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}
 
// a^{-1} MOD を計算する
ll modinv(ll a) {
    return modpow(a, MOD - 2);
}
 
const int MAX = 510000;
ll 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;
    }
}
 
ll com(int n, int r)
{
    if(n<r)
        return 0;
    if(n<0 || r<0)
        return 0;
    
    return fac[n]*(finv[r]*finv[n-r]%MOD)%MOD;
}
 
 
int N, M ,K;
 
ll solve(int nn)
{
    return com(N-1,N-nn)*((M*modpow(M-1, nn-1))%MOD)%MOD;
}
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    comInit();
    cin >> N >> M >> K;
 
    ll ans = 0;
    rep(i, K+1)
    {
        ans+=solve(N-i);
        ans%=MOD;
    }
 
    cout << ans%MOD << endl;
 
 
 
 
 
 
    return 0;
}
 

Measured memory_bytes: 15560
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>

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

using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    string s;
    cin >> s;
    
    int n = s.length();
    int ans[n];
    rep(i, n) ans[i] = 0;
    // from left
    int evens = 0, odds = 0;
    for(int i = n - 1; i >= 0; --i) {
        swap(odds, evens);
        if (s[i] == 'L') evens++;
        else {
            ans[i+1] += odds;
            ans[i] += evens;
            odds = 0;
            evens = 0;
        }
    }
    // from right
    odds = 0;
    evens = 0;
    for (int i = 0; i < n; ++i) {
        swap(odds, evens);
        if (s[i] == 'R') evens++;
        else {
            ans[i] += evens;
            ans[i-1] += odds;
            odds = 0;
            evens = 0;
        }
    }
    rep(i, n) printf("%d%c", ans[i], i+1==n ? '\n' : ' ');
    return 0;
}


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

#define int long long

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
 
using namespace std;

int32_t main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int w=tx-sx;
    int h=ty-sy;

    REP(i, w){
        cout << "R";
    }

    REP(i, h){
        cout << "U";
    }

    REP(i, w){
        cout << "L";
    }

    REP(i, h+1){
        cout << "D";
    }

    REP(i, w+1){
        cout << "R";
    }

    REP(i, h+1){
        cout << "U";
    }

    cout << "L";

    cout << "U";

    REP(i, w+1){
        cout << "L";
    }

    REP(i, h+1){
        cout << "D";
    }

    cout << "R";

    cout << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
????????°?????????????´¢
"""
s = input().strip()
p = input().strip()
ret = "No"
for i in range(len(s)):
    if p in s:
        ret = "Yes"
        break
    # ?????????????????????????????????????????????push pop??????????????£??????
    s = s[1:] + s[0] # ????????????????????°????????????????????????

print(ret)

Measured memory_bytes: 7488
#include<iostream>
using namespace std;
int main()
{
  
  int a[200005],n,k;
  cin>>n>>k;
  for(int i=1;i<=n;i++)
  {
      cin>>a[i];
  }
  for(int i=1;i<=n-k;i++)
  {
      if(a[i]/a[i+k]>0)
      cout<<"No"<<endl;
      else
      {
          cout<<"Yes"<<endl;
      }
      
  }
  
    return 0;
}



Measured memory_bytes: 3916
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void c_p_c()
{
	ios_base::sync_with_stdio(0); 
	cin.tie(0);
	cout.tie(0);
/*
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
*/
}

int32_t main()
{
	c_p_c();
	int n,k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	int dp[n];
	memset(dp,0,sizeof(dp));
	//int sum=inf;
	dp[0]=0;
	
	dp[1]=abs(arr[1]-arr[0]);
	
	for(int i=2;i<n;i++)
	{
		//dp[i]=min((dp[i-2]+abs(arr[i]-arr[i-2])),(dp[i-1]+abs(arr[i]-arr[i-1])));
		dp[i]=INT_MAX;
		for(int j=i-1;j>=(i-k) && j>=0;j--)
		{
			dp[i]=min(dp[i],(dp[j]+abs(arr[i]-arr[j])));
		}
	}
	
	cout<<dp[n-1]<<endl;
	
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
int n,m,x,y,b[100010];
bool a[100010];
int main(){
    scanf("%d%d",&n,&m);
    a[1]=1;
    for (int i=1; i<=n; i++)
        b[i]=1;
    for (int i=1; i<=m; i++){
        scanf("%d%d",&x,&y);
        if (a[x]==1){
            a[y]=1;
            if (b[x]==1) a[x]=0;
        }
        b[y]++;
        b[x]--;
    }
    int sum=0;
    for (int i=1; i<=n; i++)
        sum+=a[i];
    printf("%d\n",sum);
}

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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

int main(){
    string x;
    cin >> x;

    if(x.size()<3){
        cout << 0 << endl;
        return 0;
    }
    string t = x.substr(x.size() - 2);
    string e = x.substr(0,x.size()-2);
    int time = atoi(e.c_str());
    int m = atoi(t.c_str());
    if(time*5<m){
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3556
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw3(15,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,14) pw3[i]=3*pw3[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N,M; cin>>N>>M;
    ll ans=0;
    ll tmp=min(M/2,N);
    ans+=tmp;
    ans+=(M-tmp*2)/4;
    cout<<ans<<endl;
}


Measured memory_bytes: 3580
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    ll x = tx - sx;
    ll y = ty - sy;
    rep(i, x) {
        cout << "R";
    }
    rep(i, y) {
        cout << "U";
    }
    rep(i, x) {
        cout << "L";
    }
    rep(i, y+1) {
        cout << "D";
    }
    rep(i, x+1) {
        cout << "R";
    }
    rep(i, y+1) {
        cout << "U";
    }
    cout << "L";
    cout << "U";
    rep(i, x+1) {
        cout << "L";
    }
    rep(i, y+1) {
        cout << "D";
    }
    cout << "R" << endl;
    re0;
}

Measured memory_bytes: 256
#include<stdio.h>
int N,Q,X[10005],i,t,r=0;
int main()
{
    scanf("%d",&N);
    for(i=0;i<N;i++)
        scanf("%d",X+i);
    for(scanf("%d",&Q);Q--;)
    {
        scanf("%d",&t);
        for(i=0;i<N;i++)
            if(X[i]==t)
            {
                r++;
                break;
            }
    }
    return !printf("%d\n",r);
}


Measured memory_bytes: 2132
#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> pint;

signed main()
{   
    int N,K; cin>>N>>K;
    
    int Max=(N-1)*(N-2)/2;
    if(K>Max){
        cout<<-1<<endl;
        return 0;
    }

    vector<pint> ans;
    for(int i=2;i<=N;i++){
        ans.push_back(pint(1,i));
    }
    int rest=Max-K;
    for(int i=2;i<=N-1;i++){
        for(int j=i+1;j<=N;j++){
            if(rest>0){
                ans.push_back(pint(i,j));
                rest--;
            }
        }
    }
    cout<<ans.size()<<endl;
    for(pint p:ans){
        cout<<p.first<<' '<<p.second<<endl;
    }
}

Measured memory_bytes: 512
#include <iostream>

int main(void)
{
  std::string s[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

  std::string input;

  std::cin >> input;

  if (input == "SUN") {
    std:: cout << "7";
  } else if (input == "MON") {
    std:: cout << "6";
  } else if (input == "TUE") {
    std:: cout << "5";
  } else if (input == "WED") {
    std:: cout << "4";
  } else if (input == "THU") {
    std:: cout << "3";
  } else if (input == "FRI") {
    std:: cout << "2";
  } else if (input == "SAT") {
    std:: cout << "1";
  }

  return 0;
}


Measured memory_bytes: 256
parseInt(x) = parse(Int, x)

function main()
	a,b = map(parseInt, split(readline()))
	count = 0
	for i in a:b
		a = div(i,10000)
		b = div(i%10000,1000)
		c = div(i%1000,100)
		d = div(i%100, 10)
		e = i%10
		if a==e && b == d
			count += 1
		end
	end
	println(count)
end

main()

Measured memory_bytes: 177144
object Main extends App {
  val in            = new java.util.Scanner(System.in)
  val n, a, b, c, d = in.nextInt
  val s             = in.next

  // 岩が 2 マス続いている時は飛び越えることはできない
  // スタート地点より前とゴール地点より後の岩は考慮しない

  // すぬけ a -> c
  // ふぬけ b -> d
  // 人物を追い越す必要がある場合は人物を追い越すために 3 マス必要
  // スタート地点より前とふぬけがゴールした後の空白は考慮しない
  // (ふぬけのゴール後に空白があっても戻ることができないため)

  println(if (s.substring(a - 1, if (c > d) c else d).contains("##")) {
    "No"
  } else {
    if (c > d) {
      if (s.substring(b - 2, d + 1).contains("...")) {
        "Yes"
      } else {
        "No"
      }
    } else {
      "Yes"
    }
  })
}


Measured memory_bytes: 29592
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		System.out.println(a == b ? c : b == c ? a : b);
	}
}

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

typedef long long ll;

const int M = (int)1e4;
const int N = (int)1e4;
const int inf = 0x3f3f3f3f;
const ll mod = (ll)1e9 + 7;

bool vis[M + 5];

int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int n, k; scanf("%d %d", &n, &k);
    for(int i = 1, d; i <= k; ++i)
    {
        scanf("%d", &d);
        for(int j = 1, a; j <= d; ++j) scanf("%d", &a), vis[a] = 1;
    }
    int cnt = 0; for(int i = 1; i <= n; ++i) cnt += !vis[i];
    printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 3828
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;
struct edge { ll from; ll to; ll cost; };


vector<vector<int>>red;
vector<vector<int>>blue;

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

	rep(i, 0, n) {
		int a, b;
		cin >> a >> b;
		red.pb({a,b,0});
	}
	rep(i, 0, n) {
		int c, d;
		cin >> c >> d;
		blue.pb({c,d});
	}

	sort(all(blue));

	int ans = 0;
	rep(i, 0, n) {
		pair<int, int>temp = {-1,-1};
		rep(j, 0, n) {
			if (blue[i][0] > red[j][0] && blue[i][1] > red[j][1] && red[j][2] == 0) {
				if (temp.first < red[j][1])temp = {red[j][1],j};
			}
		}
		if (temp.first != -1) {
			ans++;
			red[temp.second][2] = 1;
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
  int N; cin >> N;
  vector<int> L(N,0); for (int i = 0; i < N; i++) cin >> L.at(i);
  int counter = 0;
  for (int i = 0; i < N; i++){
    int li = L.at(i);
    for (int j = i+1; j < N; j++){
      int lj = L.at(j);
      for (int k = j+1; k < N; k++){
        int lk = L.at(k);
        if (li < lj+lk && lj < li+lk && lk < li+lj && li != lj && lj != lk && lk != li) counter++;
      }
    }
  }
  cout << counter << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,m,d; cin>>n>>m>>d;
	double ret=(m-1.)/n;
	if(d) ret=2.*(n-d)/n/n * (m-1);
	cout<<setprecision(10)<<fixed<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 256