akhauriyash/Code-Regression huggingface dataset:
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	string S;
	cin >> S;

	if (S[0] == S[1] && S[1] == S[2] || S[1] == S[2] && S[2] == S[3])
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long li;

const int maxn = 2e5 + 10, maxlgn = 29;
int n, a[maxn], b[maxn], c[maxn];

int Solve(int x, int lower, int upper) {
  return lower_bound(c + 1, c + 1 + n, upper - x) -
    lower_bound(c + 1, c + 1 + n, lower - x);
}

int main(void) {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%d", a + i);
  for (int i = 1; i <= n; ++i)
    scanf("%d", b + i);

  int ans = 0;
  for (int l = 0; l < maxlgn; ++l) {
    int tmp = (1 << l), cnt = 0;
    for (int i = 1; i <= n; ++i) c[i] = b[i] % (tmp << 1);
    sort(c + 1, c + 1 + n);
    for (int i = 1, x; i <= n; ++i) {
      x = a[i] % (tmp << 1);
      cnt += Solve(x, tmp * 1, tmp * 2) % 2;
      cnt += Solve(x, tmp * 3, tmp * 4) % 2;
    }
    if (cnt & 1) ans |= (1 << l);
  }
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
const int maxn=100005;
int fir[maxn],no[2*maxn],se[2*maxn],st[2*maxn][20],lo[200005];
ll dep[maxn];
struct nod
{
    int to;
    ll cost;
};
int n,m,d1,d2;
vector<nod> g[maxn];
int cnt,sum;
void mkST()
{
    for(int i=1;i<=cnt;i++)st[i][0]=se[i];
    for(int j=1;(1<<j)<=cnt;j++)
        for(int i=1;i<=cnt-(1<<j)+1;i++)
            st[i][j]=min(st[i][j-1],st[i+(1<<(j-1))][j-1]);
}

void DFS(int u,int f,ll di)
{
    dep[u]=di;
    no[++sum]=u;
    int t=sum;
    se[++cnt]=t;
    fir[u]=cnt;
    for(auto p : g[u])
    {
        if(p.to==f)continue;
        DFS(p.to,u,di+p.cost);
        se[++cnt]=t;
    }
}

int find(int p,int q)
{
    if(p>q)swap(p,q);
    int j=lo[q-p+1];
    return min(st[p][j],st[q-(1<<j)+1][j]);
}

ll cal(int x,int y)
{
    int now=no[find(fir[x],fir[y])];
    return dep[x]+dep[y]-2*dep[now];
}
int main()
{
//freopen("input.txt", "r", stdin);
    lo[1]=0;
    for(int i=2;i<=200000;i++)lo[i]=lo[i>>1]+1;
    while(scanf("%d", &n) != EOF)
    {
        for(int i=0;i<=n;i++)g[i].clear(),dep[i]=0;
        cnt=sum=0;
        for(int i=1;i<=n-1;i++)
        {
            int x,y;
            ll z;
            scanf("%d%d%lld",&x,&y,&z);
            g[x].pb({y,z});g[y].pb({x,z});
        }
        DFS(1,0,0);mkST();
        int Q, K;
        cin >> Q >> K;
        while(Q--){
            int xx, yy;
            cin >> xx >> yy;
            cout << cal(xx,K) + cal(yy, K) << "\n";
        }

    }
    return 0;
}

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

using namespace std;

#define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define ull unsigned long long int

const int INF = 1e9 + 7;
const int N = 1e5+5;


int main() {

	IO;

	int n, m;
	cin >> n >> m;
	
	cout << (n == m ? "Yes" : "No");

}


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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

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

  int a,b;cin>>a>>b;
  if(a==b)cout<<a*2<<endl;
  else cout<<max(a,b)*2-1<<endl;

  return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    map<long long, long long> num;
    long long sum = 0;
    num[sum]++;
    for (int i = 0; i < N; i++) {
        sum += A[i];
        num[sum]++;
    }

    long long ans = 0;
    for (auto p = num.begin(); p != num.end(); p++) {
        ans += (p->second - 1) * p->second / 2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define ll long long int
#define fip(arr, si, en) for (ll i = si; i<en; i++){cin >> arr[i];}
#define fop(arr, si, en) for (ll i = si; i<en; i++){cout << arr[i] << " "; if(i==en-1) cout << endl;}
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>

using namespace std;

int min (int a, int b) {
	return a<b ? a : b;
}

int main() {
	std::ios::sync_with_stdio(false);
	int n; cin >> n;
	vi arr(n);
	fip(arr, 0, n);

	if (n == 1) {
		cout << 0;
		return 0;
	}
	if (n == 2) {
		cout << abs(arr[0] - arr[1]);
		return 0;
	}

	// vi dp(n);

	// dp[n - 1]
	int b = 0;
	// dp[n - 2]
	int a = abs(arr[n - 2] - arr[n - 1]);

	for (int i = n - 3; i >= 0; i--) {
		int t = min(a + abs(arr[i + 1] - arr[i]),
		            b + abs(arr[i + 2] - arr[i]));
		b = a;
		a = t;
	}
	cout << a;
}

Measured memory_bytes: 3716
package main

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

func solve() {
	h, n := getInt(), getInt()
	for i := 0; i < n; i++ {
		a := getInt()
		h -= a
	}

	ans := "Yes"
	if h > 0 {
		ans = "No"
	}
	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 2304
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n,q = map(int,input().split())
G = [[] for i in range(n)]
for i in range(n-1):  
  a,b = map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)

P = [0]*n
for i in range(q):
  p,x = map(int,input().split())
  P[p-1] += x
     
def dfs(v,pv):      
  for nv in G[v]:
    if nv != pv:
      P[nv] += P[v]
      dfs(nv,v)
        
dfs(0,0)
print(*P)

Measured memory_bytes: 230932
#include <bits/stdc++.h>
#define SZ(v) ((int)((v).size()))
using namespace std;
using ll = long long;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a,b,c;
	cin >> a >> b >> c;
	if ((a%2)*(b%2)*(c%2) == 0) cout << "0\n";
	else cout << min(a*b, min(b*c,a*c)) << "\n";
}


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

k = 0
while (k * (k + 1)) // 2 < N:
    k += 1

if (k * (k + 1)) // 2 == N:
    print ('Yes')
else:
    print ('No')
    exit()

k += 1
lst = [[] for _ in range(k)]
tmp = 1
# print ('k', k)
# print (lst)
for i in range(k - 1):
    for j in range(k - 1 - i):
        lst[i].append(tmp)
        lst[i + j + 1].append(tmp)
        tmp += 1

print (k)    
for i in lst:
    print (len(i), *i, sep = ' ')

Measured memory_bytes: 9496
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

string s;

void solve(){
    cin >> s;
    int n=s.length();
    rep(i,n){
        if (i%2==0){
            if (s[i]=='L') {
                cout << "No" << endl;
                return;
            }
        }
        else{
            if (s[i]=='R') {
                cout << "No" << endl;
                return;
            }
        }
    }
    cout << "Yes" << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 256
// Crt. 2019-12-02  21:00:55
#include <algorithm>
#include <iostream>
#include <cstdio>
#define N 502
using namespace std;

int n, x[N], ans[N * N], pos[N];

bool cmp(int a, int b) {
    return x[a] < x[b];
}

int main() {
#ifdef LOCAL_JUDGE
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n;
    for (int i = 1; i <= n; ++i) {
        scanf("%d", x + i);
        if (x[i] > n * n) return puts("No"), 0;
        pos[i] = i, ans[x[i]] = i;
    }

    sort(pos + 1, pos + n + 1, cmp);

    int nowpos = 1;
    for (int i = 1; i <= n; ++i) {
        int now = pos[i];
        for (int j = 1; j < now; ++j) {
            while (ans[nowpos]) ++nowpos;
            if (nowpos > x[now]) return puts("No"), 0;
            ans[nowpos] = now;
        }
    }

    for (int i = 1; i <= n; ++i) {
        int now = pos[i];
        for (int j = 1; j <= n - now; ++j) {
            while (ans[nowpos]) ++nowpos;
            if (nowpos < x[now]) return puts("No"), 0;
            ans[nowpos] = now;
        }
    }

    puts("Yes");
    for (int i = 1; i <= n * n; ++i)
        printf("%d ", ans[i]);

    return 0;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
int n, dp[100005][3]={0}, abc[3];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<3;j++)
			cin>>abc[j];
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + abc[0];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + abc[1];
		dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + abc[2];
	}
	int ans=0;
	for(int i=0;i<3;i++)
		ans=max(ans, dp[n][i]);
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,k;
	cin>>a>>b>>k;
	if(a<=k)
	{
		
		cout<<"0 ";
		if(b-(k-a)>0)cout<<b-(k-a);
		else cout<<0;
	}
	
	else cout<<a-k<<" "<<b;
	
	
	
	return 0;
 } 

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

// n以下の数の2べきの最大のものが答え。

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

  int p[] = {1,2,4,8,16,32,64};

  if((p[0] <= n) && (n < p[1])) cout << p[0] << endl;
  if((p[1] <= n) && (n < p[2])) cout << p[1] << endl;
  if((p[2] <= n) && (n < p[3])) cout << p[2] << endl;
  if((p[3] <= n) && (n < p[4])) cout << p[3] << endl;
  if((p[4] <= n) && (n < p[5])) cout << p[4] << endl;
  if((p[5] <= n) && (n < p[6])) cout << p[5] << endl;
  if(p[6] <= n) cout << p[6] << endl;

  return 0;
}

Measured memory_bytes: 256
N,K = list(map(int,input().split()));
counter = 0;
if K == 0:
	print (N*N);

else:
	for i in range(N-K):
		counter += (N-i) - K;
	#print (counter)
	for i in range(K+1,N):
		a = N//i;
		#print (i,a)
		b = N%i;
		#print (i,b)
		if b >= K and b != 0:
			b = b;
		else:
			b = K - 1;

		counter += ( b - K + 1 ) + ( a - 1 )*( i - K ) 
		#print (i,counter)

	print (counter)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> num(100010, 0);
  ll t = 0;
  rep(i, n) {
    ll a;
    cin >> a;
    num[a]++;
    t += a;
  }
  int q, b, c;
  cin >> q;
  rep(i, q) {
    cin >> b >> c;
    t += (c - b) * num[b];
    num[c] += num[b];
    num[b] = 0;
    cout << t << endl;
  }

  return 0;
}


Measured memory_bytes: 3772
S = input()

txts = [S[0]]
for i in range(1, len(S)):
    new_txts = []
    for t in txts:
        new_txts.append(t+S[i])
        new_txts.append(t+'+'+S[i])
    txts = new_txts

results = 0
for t in txts:
    numbers = list(map(int, t.split('+')))
    results += sum(numbers)
print(results)

Measured memory_bytes: 3064
n,k=map(int,input().split())
p=[int(i)+1 for i in input().split()]

num=sum(p[:k])
tot=[num]
t_append=tot.append
for i in range(n-k):
  tmp=p[i+k]-p[i]
  num+=tmp
  t_append(num)
#print(tot)
print(max(tot)/2)  

Measured memory_bytes: 25188
#include <iostream>
#include <cmath>
#include <numeric>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M, std::vector<long long> A){
    int sum = accumulate(A.begin(), A.end(), 0);
    double threshold = (double)sum / (4.0 * (double)M);
    int t;
    if (floor(threshold) == threshold) t = (int)threshold - 1;
    else t = (int)threshold;

    int count = 0;
    REP(i, N) if (t < A[i]) count++;

    if (count >= M) cout << YES << '\n';
    else cout << NO << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


Measured memory_bytes: 3624
#include <string>
#include <iostream>
using namespace std;
int main(){
	int n, d;
	cin >> n >> d;
	if(n % (d * 2 + 1) != 0){
		cout << n / (d * 2 + 1) + 1 << endl;
	}else{
		cout << n / (d * 2 + 1) << endl;
	}
}

Measured memory_bytes: 256
def int_raw():
    return int(raw_input())
 
def words_raw():
    return raw_input().split()
 
def ints_raw():
    return map(int, words_raw())

A, B, K = ints_raw()
for delimiter in range(min(A, B), 0, -1):
	if A % delimiter == 0 and B % delimiter == 0:
		K -= 1
		if K == 0:
			print delimiter
			break


Measured memory_bytes: 2568
a = [int(input()) for _ in range(6)]
b = 0
m = 'Yay!'

if abs(a[0]-a[1]) > a[5]:
    m = ':('
elif abs(a[0]-a[2]) > a[5]:
    m = ':('
elif abs(a[0]-a[3]) > a[5]:
    m = ':('
elif abs(a[0]-a[4]) > a[5]:
    m = ':('
elif abs(a[1]-a[2]) > a[5]:
    m = ':('
elif abs(a[1]-a[3]) > a[5]:
    m = ':('
elif abs(a[1]-a[4]) > a[5]:
    m = ':('
elif abs(a[2]-a[3]) > a[5]:
    m = ':('
elif abs(a[2]-a[4]) > a[5]:
    m = ':('
elif abs(a[3]-a[4]) > a[5]:
    m = ':('

print(m)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}

#define pii pair<int,int>

int func(int n){
  return (n==0?0:func(n>>1)+(n&1) ); 
}

int main(){
  int N; cin>>N;
  int a[20];
  int x[20][20];
  int y[20][20];
  for(int i=1;i<=N;i++){
    cin >>a[i];
    for(int j=1;j<=a[i];j++){
      cin >> x[i][j] >> y[i][j];
    }
  }
  int r = 0;
  for(int bits=1;bits<(1<<N);bits++){
    bool ok = true;
    for(int i=1;i<=N;i++){
      if(!((bits>>(i-1))&1)){continue;}
      for(int j=1;j<=a[i];j++){
        if(((bits>>(x[i][j]-1))&1) ^ y[i][j]) { ok = false;}
        if(!ok){break;}
      }
      if(!ok) break;
    }
    //cout << "ok:" << ok <<"\n";
    if(ok){ r = max(func(bits),r);}
  }
  cout << r;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;

map<int, int> prime_facter(ll n){
	map<int, int> res;
	for (ll i = 2; i*i <= n; i++){
		while (n%i == 0){
			++res[i];
			n /= i;
		}
	}
	if (n != 1)res[n] = 1;
	return res;
}

int main(){
	cin >> n;
	vector<ll> cnt(100,0);
	FOR(i,1,n){
		map<int,int> m = prime_facter(i+1);
		rep(j,100)cnt[j] += m[j];
	}
	sort(ALL(cnt));
	reverse(ALL(cnt));
	vector<ll> sum(1000,0);
	rep(i,cnt.size())sum[cnt[i]]++;
	for(int i = 999;i >= 0;i--)sum[i] += sum[i+1];
	ll ans = 0;
	ans += sum[4]*(sum[4]-1)/2*(sum[2]-2);
	ans += sum[14] * (sum[4]-1);
	ans += sum[24] * (sum[2]-1);
	ans += sum[74];
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main (void)
{
	int i;
	int a[100];
  	int n;
  
	scanf("%d", &n);
	for (i = 0; i < n; i++)
    {
		scanf("%d", &a[i]);
	}
	for (i = 0; i < n; i++) 
    {
		if (a[i] % 2 == 0 && a[i] % 3 != 0 && a[i] % 5 != 0)
        {
			puts("DENIED");
			return 0;
		}
	}
	puts("APPROVED");
	return 0;
}

Measured memory_bytes: 128
import sys,collections,math,random,fractions,bisect;sys.setrecursionlimit(10**7)
sr = sys.stdin.readline; P = print; P2 = lambda x: print(*x, sep="\n")
def I(i=0): t = [int(x)-i for x in sr().split()];return t if len(t) > 1 else t[0]
def S(): t = sr().split(); return t if len(t) > 1 else t[0]
L1,L2,L3,L4, = [],[],[],[]

H,A = I()
print(math.ceil(H/A))


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

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

void Main(){
	int a, b, c;
	cin >> a >> b >> c;
	cout << c << " " << a << " " << b << endl;
	return;
}

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

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

using namespace std;

int main (void) {
    int N, K;
    cin >> N >> K;
    int x[N];
    for ( int i=0; i<N; i++ )
        cin >> x[i];

    int ans = 0;
    for ( int i=0; i<N; i++ ) {
        if ( abs(x[i] - K) > x[i] )
            ans += x[i] * 2;
        else
            ans += abs(x[i] - K) * 2;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

l = inp()
print(pow(l/3,3))

Measured memory_bytes: 5120
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int k;
  cin >> k;
  if(k%2==0) {
    cout << k/2*k/2 << endl;
  }
  else {
    cout << k/2*(k/2+1) << endl;
  }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<ll> x(N), y(N), z(N);
  rep(i, 0, N) cin >> x[i] >> y[i] >> z[i];
  ll ans = 0;
  rep(i, 0, 8) {
    priority_queue<ll> Q;
    rep(j, 0, N) {
      ll tx = i & 1 << 0 ? x[j] : -x[j];
      ll ty = i & 1 << 1 ? y[j] : -y[j];
      ll tz = i & 1 << 2 ? z[j] : -z[j];
      Q.push(tx + ty + tz);
    }
    ll tmp = 0;
    rep(k, 0, M) {
      tmp += Q.top();
      Q.pop();
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N,K = map(int,raw_input().split())
src = []
for i in range(N):
  w,d = map(int,raw_input().split())
  src.append((w,d))
src.sort()

def enough(x):
  total = 0
  for w,d in src:
    if w > x: break
    total += (x-w)//d + 1
    if total >= K: return True
  return False

l = 0
r = 10**30
while r-l > 1:
  m = (l+r) // 2
  if enough(m):
    r = m
  else:
    l = m
print(r)

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
int W, H;
	cin >> H >> W;
	char field[500][500];
	fx(H) {
		string s;
		cin >> s;
		fy(W) {
			field[x][y] = s[y];
		}
	}

	ll ans = 0;
	bool flag[500][500] = { false, };
	fx(H) {
		fy(W) {
			if (field[x][y]=='#') {
				queue<int> whereX, whereY;
				whereX.push(x); whereY.push(y);
				ll white = 0, black = 0;
				while (!whereX.empty()) {
					int dx = whereX.front(), dy = whereY.front();
					whereX.pop(); whereY.pop();
					if (flag[dx][dy]) { continue; }
					flag[dx][dy] = true;

					if (dx-1>=0&&field[dx-1][dy]!=field[dx][dy]) {
						whereX.push(dx - 1); whereY.push(dy);
					}
					if (dx + 1 < H && field[dx + 1][dy] != field[dx][dy]) {
						whereX.push(dx + 1); whereY.push(dy);
					}
					if (dy - 1 >= 0 && field[dx][dy - 1] != field[dx][dy]) {
						whereX.push(dx); whereY.push(dy - 1);
					}
					if (dy + 1 < W && field[dx][dy + 1] != field[dx][dy]) {
						whereX.push(dx); whereY.push(dy + 1);
					}

					if (field[dx][dy] == '#') {
						black++;
						field[dx][dy] = '.';
					}
					else {
						white++;
					}

				}

				ans += black * white;

			}
		}
	}
	ce(ans)

    return 0;
}



Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
int main() {
	int a;
	cin >> a;
	for (int b = 0; b < a; b++) {
		int c[3];
		cin >> c[0] >> c[1] >> c[2];
		sort(c, c + 3);
		if (c[0] * c[0] + c[1] * c[1] == c[2] * c[2])puts("YES");
		else puts("NO");
	}
}

Measured memory_bytes: 2944
#include<stdio.h>                                                 
                                                                  
int main(void){                                                   
   int N,M;                                                       
   scanf("%d %d",&N,&M);                                          
   int data[N],i,sum,count;                                       
                                                                  
   sum = 0;                                                       
   for(i = 0; i < N; i++){                                        
      scanf("%d",&data[i]);                                       
      sum += data[i];                                             
   }                                                              
                                                                  
   count = 0;                                                     
   for(i = 0; i < N; i++){                                        
      if( data[i]*4*M >= sum){                                    
         count++;                                                 
      }                                                           
   }                                                              
   if( count < M){                                                
      printf("No");                                               
   } else {                                                       
      printf("Yes");                                              
   }                                                              
} 

Measured memory_bytes: 1728
n = list(map(int,input().split()))
q = int(input())
l = [[3,5,2,4],[4,1,6,3],[2,6,1,5],[5,1,6,2],[3,6,1,4],[4,2,5,3]]
for i in range(q):
    a, b = map(int,input().split())
    for j in range(6):
        if a == n[j]:
            c = j
        if b == n[j]:
            d = j
    e = d
    if c < d:
        e -= 1
    if c + d > 5:
        e -= 1
    print(n[l[c][e]-1])


Measured memory_bytes: 5600
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
#include<stdbool.h>
#define ms(l,n,s) memset(l,n,s)
#define m(l,n) (l*)malloc(n*sizeof(l))
void insert(int**,int,int,int);
void print(int**,int);
int main(){
  int n,u,k,v;
  int i,j;
  int **matrix;
  scanf("%d",&n);
  matrix=m(int*,(n+1));
  for(i=0;i<n+1;i++){
    *(matrix+i)=m(int,(n+1));
    ms(*(matrix+i),0,sizeof(int));
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      *(*(matrix+u)+v)=1;
    }
}
  print(matrix,n);
  return 0;
}
void print(int **matrix,int n){
  int i;
  int j;
  for(i=1;i<n+1;i++){
    for(j=1;j<n+1;j++)printf("%d%c",*(*(matrix+i)+j),j<n?' ':'\n');
  }
}



Measured memory_bytes: 2112
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;



public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		Card[] cards = new Card[n];
		for (int i=0;i<n;i++) {
			cards[i]=new Card();
			cards[i].id=i+1;
		}
		for (int i=0;i<n;i++) {
			cards[i].red=sc.nextInt();
		}
		for (int i=0;i<n;i++) {
			cards[i].blue=sc.nextInt();
		}
		
		int ans = -1;
		
		for (int i=0;i<(1<<n);i++) {
			ArrayList<Card> odd = new ArrayList<>();
			ArrayList<Card> even = new ArrayList<>();
			for (int j=0;j<n;j++) {
				cards[j].showing=((i>>j)%2!=0 ? cards[j].blue : cards[j].red);
				if ((i>>j)%2!=0 ^ j%2==0) {
					odd.add(cards[j]);
				} else {
					even.add(cards[j]);
				}
			}
			if (odd.size() != (n+1)/2) {
				continue;
			}
			odd.sort(Comparator.comparing((Card c) -> c.showing).thenComparing((Card c) -> c.id));
			even.sort(Comparator.comparing((Card c) -> c.showing).thenComparing((Card c) -> c.id));
			
			int last = 0;
			ArrayList<Card> combined = combine(odd,even,n);
			boolean ok = true;
			for (int j=0;j<n-1;j++) {
				if(combined.get(j).showing>combined.get(j+1).showing){
					ok=false;
					break;
				}
			}
			
			if (ok) {
				int count = 0;
				for (int j=0;j<n;j++) {
					for (int k=j+1;k<n;k++) {
						if(combined.get(j).id>combined.get(k).id) {
							count++;
						}
					}
				}
				if (ans==-1 || count<ans) {
					ans=count;
				}
			}
		}
		
		System.out.println(ans);
	}
	static ArrayList<Card> combine (ArrayList<Card> odd, ArrayList<Card>even, int n) {
		ArrayList<Card> ret = new ArrayList<>();
		for (int i=0;i<n;i++) {
			ret.add(i%2==0 ? odd.get(i/2) : even.get(i/2));
		}
		return ret;
	}
}

class Card {
	int id;
	int red;
	int blue;
	int showing;
}





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

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}
////////////////////////////////////////////////////////////
signed main() {
  int n;
  cin>>n;
  vector<int>a(n);
  vector<int>aa(n);
  rep(i,n){cin>>a[i];aa[i]=a[i];}
  vector<int>bit(61);
  rep(i,n){
    int count=0;
    while(a[i]>0){
      if(a[i]&1)bit[count]++;
      a[i]/=2;
      count++;
    }
  }
  int ans=0;
  rep(i,61){
    ans=(ans+(modpow(2,i)*(n-bit[i])%MOD*bit[i]%MOD))%MOD;
  }
  cout<<ans;
}


Measured memory_bytes: 7924
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

int main() {
	IN(int, n);
	vector<string> vs(n);
	cin >> vs;
	
	vector<array<int, 4>> va;
	RF(s, vs) {
		int mi = 0, sum = 0;
		RF(c, s) {
			sum += (c == '(' ? +1 : -1);
			setmin(mi, sum);
		}
		int a = mi, b = sum - mi;
		va.PB({ (sum > 0 ? +1 : -1), (sum > 0 ? a : b), a, b });
	}
	sort(RALL(va));
	
	int mi = 0, sum = 0;
	for(auto [x, y, a, b]: va) {
		sum += a;
		setmin(mi, sum);
		sum += b;
	}
	OUT(mi >= 0 && sum == 0 ? "Yes" : "No");
}


Measured memory_bytes: 51028
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] v = new int[n];
        ArrayList<Double> list = new ArrayList<Double>(); 
        for(int i = 0;i<v.length;i++) {
            v[i] = stdIn.nextInt();
            list.add((double)v[i]);
        }
        double a = 0;
        Collections.sort(list);
        //ArrayList<Double> list = new ArrayList<Double>();        
        while(list.size()!=1) {
            double b = list.get(0);
            double c = list.get(1);
            list.remove(0);
            list.remove(0);
            double d = (b+c)/2;
            //System.out.println(d);
            list.add(d);
            Collections.sort(list);
        }
        System.out.println(list.get(0));
        }
    }

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

int main()

{

    int n,ch;

    cin>>n;

    for (int i=0;i<n;i++)

    {

      cin>>ch;

      if (ch%2==0)

      if (ch%3!=0 && ch%5!=0)

      {

          cout<<"DENIED";

          return 0;

      }

    }

    cout<<"APPROVED";

    return 0;

}

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

int main(){
    ll n;cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    int odd=0;
    for(int i=0;i<n;i++){
        if(arr[i]&1) odd++;
    } 
    cout<<(odd&1?"NO\n":"YES\n");                
}

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

int main() {
	int cnt = 0;
	string W, T;

	cin >> W;
	
	for (int i = 0; i < W.size(); i++) {
		W[i] = toupper(W[i]);
	}

	while(1) {
		cin >> T;
		if (T == "END_OF_TEXT")
			break;
		for (int i = 0; i < T.size(); i++) {
			T[i] = toupper(T[i]);
		}
		if (W == T)
			cnt++;
	} 

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1192
import math
import fractions
import copy
#以下てんぷら
def j(q):
    if q==1: print("YES")
    elif q == 0:print("NO")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


n = ip()                                     #入力整数1つ
#m,n= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
a =[]
for i in range(n):
    a.append(input().split())
    a[i][1] = 100-int(a[i][1])
b = copy.copy(a)
a.sort()
for i in range(n):
    print(b.index(a[i])+1)

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

ll comb(ll n,ll k){
    ll ret = 1;
    for(ll i = n; i > n-k;--i) {
        ret *= i;
        ret /= (n+1-i);
    }
    return ret;
}
int main(){
    ll n,a,b; cin >> n >> a >> b;
    vector<ll> v(n);
    for(ll i = 0; i < n; ++i) cin >> v[i];
    sort(v.rbegin(),v.rend());
    ll sum = 0;
    for(ll i = 0; i < a; ++i) sum += v[i];
    cout << fixed << setprecision(10) << sum*1.0/a  << endl;

    ll left = -1, right = 0;
    for(ll i = 0; i < n;++i){
        if(v[i] == v[a-1] && left == -1) left = i;
        if(v[i] == v[a-1]) right = i;
    }
    if(left != 0) cout << comb(right-left+1,a-left) << endl;
    else {
        ll ans = 0;
        for(ll i = a;i <= min(right+1,b);++i){
            ans += comb(right+1,i);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3800
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#define mop 1000000007

using namespace std;

static const int MAX = 9;
int G[MAX][MAX] = {};
int main() {
    
    int n,m;
    cin >> n >> m;
    for (int i = 0;i<m;i++){
        int a,b;
        cin >> a >> b;
        G[a][b] = 1;
        G[b][a] = 1;
    }
    vector <int> v;
    for (int i=1;i<=n;i++){
        v.push_back(i);
    }
    long long ans = 0;
    do{
        for (int i=1;i<n;i++){
            if(i==1 and v[0] != 1){
                goto Next;
            }
            if(G[v[i]][v[i-1]] != 1){
                goto Next;
            }
        }
        ans += 1;
        
        Next:
        ;
    }while(next_permutation(v.begin(),v.end()));
    cout << ans << endl;
}

Measured memory_bytes: 256
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  if (t.size() == s.size() + 1 && t.substr(0, n) == s) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main()
{
	// 入力
	int r, D, x;
	cin >> r >> D >> x;
	
	// 答え
	int answer = x;
	// 出力
	for (int i = 0; i < 10; i++)
	{
		answer = r * answer - D;
		cout << answer << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define WIDTH 6
#define HEIGHT 12

enum { YET, ALREADY };

int del( void );
int search( int, int );
int search_body( int, int, char );
void fall( void );

typedef struct {
	char color;
	int state;
} FIELD;

FIELD field[ WIDTH + 2 ][ HEIGHT + 2 ];
const int dx[ 4 ] = { -1, 0, 1, 0 }, dy[ 4 ] = { 0, -1, 0, 1 };

int stack[ WIDTH * HEIGHT ];
int sp;

int main( void ) {
	int n, x, y, chain;

	for ( scanf( "%d", &n ); n--; printf( "%d\n", chain ) ) {
		for ( y = 1; y <= HEIGHT; y++ )
			for ( x = 1; x <= WIDTH; x++ ) {
				scanf( " %c", &field[ x ][ y ].color );
				field[ x ][ y ].state = YET;
			}

		for ( chain = 0; del(); fall(), chain++ ) ;
	}

	return 0;
}

int del( void ) {
	int x, y, del = 0;

	for ( y = 1; y <= HEIGHT; y++ )
		for ( x = 1; x <= WIDTH; x++ )
			if ( field[ x ][ y ].color != '.' && field[ x ][ y ].color != 'O' && field[ x ][ y ].state == YET ) {
				sp = 0;
				if ( search( x, y ) >= 4 ) {
					while ( sp-- )
						field[ stack[ sp ] / ( HEIGHT + 2 ) ][ stack[ sp ] % ( HEIGHT + 2 ) ].color = '.';

					del = 1;
				}
			}

	return del;
}

int search( int x, int y ) {
	return search_body( x, y, field[ x ][ y ].color );
}

int search_body( int x, int y, char color ) {
	int i, sum;

	stack[ sp++ ] = x * ( HEIGHT + 2 ) + y;
	field[ x ][ y ].state = ALREADY;

	sum = 0;
	for ( i = 0; i < 4; i++ ) {
		int nx = x + dx[ i ], ny = y + dy[ i ];

		if ( field[ nx ][ ny ].state == YET && ( field[ nx ][ ny ].color == color || field[ nx ][ ny ].color == 'O' ) )
			if ( field[ nx ][ ny ].color == 'O' )
				stack[ sp++ ] = nx * ( HEIGHT + 2 ) + ny;
			else
				sum += search_body( nx, ny, color );
	}

	return sum + 1;
}

void fall( void ) {
	int x, y;

	for ( x = 1; x <= WIDTH; x++ ) {
		int cnt = 0;

		for ( y = HEIGHT; y > 0; y-- )
			if ( field[ x ][ y ].color == '.' )
				cnt++;
			else {
				field[ x ][ y + cnt ].color = field[ x ][ y ].color;
				field[ x ][ y + cnt ].state = YET;
			}

		for ( y = cnt; y > 0; y-- )
			field[ x ][ y ].color = '.';
	}
}

Measured memory_bytes: 596
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> pii;

int main()
{
  char str[100000]={};
  char moji[10][6]={"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
  int i;
  int n;

  cin>>n;
  rep(i,n){
    cin>>str;
    int len=strlen(str);
    int j=0;
    while(j<len){
      int num=0;
      while(str[j]!='0'){
	j++;
	num++;
      }
      if(j==0){
	j++;
	continue;
      }
      int a=str[j-1]-'0';
      if(a==1)
	cout<<moji[1][(num-1)%5];
      else if((a>1 && a<7)|| a==8)
	cout<<moji[a][(num-1)%3];
      else if(a==7 || a==9)
	cout<<moji[a][(num-1)%4];
      j++;
    }
    cout<<endl;
  }
}

Measured memory_bytes: 3140
#include<cstdio>
 
using namespace std;
 
const int N=2e5+10;
const long long mod=1e9+7ll, inf=0x7fffffffll;
 
 
struct EDGE {
    int y, nex;
} edge[N<<5];
 
int c[N], head[N], mih[N], tot[N], cnt, n;
long long w[N], C1[N], C2[N], min[N], X, Y, ans;
bool vis[N];
 
inline void add(int x,int y) {
    edge[++cnt].y=y;
    edge[cnt].nex=head[x];
    head[x]=cnt;
}
 
long long fast_pow(long long a,long long b) {
    long long ans=1,base=a;
    while(b) {
        if(b&1) ans=(ans*base)%mod;
        base=(base*base)%mod, b>>=1;
    }
    return ans;
}
 
inline void Prepare() {
    C1[0]=1;
    for(int i=1; i<=n; i++) C1[i]=(C1[i-1]*i)%mod, min[i]=inf;
    C2[n]=fast_pow(C1[n],mod-2);
    for(int i=n; i>=1; i--)C2[i-1]=(i*C2[i])%mod;
}
 
void dfs(int x) {
    vis[x]=true;
    for(int i=head[x]; i; i=edge[i].nex) if(!vis[edge[i].y]) dfs(edge[i].y);
}
 
long long C(long long n,long long k){
    return(((C1[n]*C2[n-k])%mod)*C2[k])%mod;
}
 
int main() {
    scanf("%d%lld%lld", &n, &X, &Y); Prepare();
    for(int i=1; i<=n; i++) scanf("%d%lld", &c[i], &w[i]);
    for(int i=1; i<=n; i++) if(min[c[i]]>w[i]) mih[c[i]]=i, min[c[i]]=w[i];
    for(int i=1; i<=n; i++) if(w[i]+min[c[i]]<=X&&i!=mih[c[i]]) add(i,mih[c[i]]), add(mih[c[i]],i);
    int fmin=inf, smin=inf;
    int first=0, second=0;
    for(int i=1; i<=n; i++) if(w[i]<fmin) fmin=w[i], first=i;
    for(int i=1; i<=n; i++) if(w[i]<=smin&&c[i]!=c[first]) smin=w[i], second=i;
    for(int i=1; i<=n; i++)
        if(i!=first) {
            if(c[i]!=c[first]&&w[i]+w[first]<=Y) add(i, first), add(first, i);
            if(second&&c[i]!=c[second]&&w[i]+w[second]<=Y) add(i, second), add(second, i);
        }
    dfs(first), cnt=0;
    for(int i=1; i<=n; i++) if(vis[i]) cnt++, tot[c[i]]++; ans=1;
    for(int i=1; i<=n; i++) if(tot[i]) ans=(ans*C(cnt, tot[i]))%mod, cnt-=tot[i];
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 16512
using System;

namespace testes
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            bool flag = false;

            long A;
            double B = N;
            A = (long)Math.Sqrt(B) + 1;
            

            long ansA = 0, ansB = 0;
            for(long i = A; i > 0; i--)
            {
                if(N % i == 0)
                {
                    ansA = i;
                    ansB = N / i;
                    flag = true;
                    break;
                }
            }

            //Console.WriteLine($"{ansA}, {ansB}");
            if (flag) Console.WriteLine(ansA + ansB - 2);
            else Console.WriteLine("No");
        }
    
    
        /*
        public static int pow(int a, int b)
        {
        }
        
        public static int LIS(int[] c)
        {
            // 部分数列和
            int count = 1;
            int N = c.Length;
            int[] array = new int[N];
            array[0] = c[0];

            for (int i = 1; i < N; i++)
            {
                //for (int p = 0; p < N; p++) Console.Write($"{array[p]},");
                // Console.WriteLine("");
                if (array[count - 1] < c[i])
                {
                    array[count] = c[i];
                    count++;
                    continue;
                }
                for (int j = count - 2; j >= 0; j--)
                {
                    if (array[j] < c[i])
                    {
                        array[j + 1] = c[i];
                        break;
                    }
                }
                if (array[0] > c[i]) array[0] = c[i];
            }
            return count;
        }
        public static void Rotation(char[] array, int l, int r)
        {


        }

    */


    }


}

/*
int a, b, c;
int a = int.Parse(Console.ReadLine()); 
string[] str = Console.ReadLine().Split(' ');
int b = int.Parse(str[0]);  
int c = int.Parse(str[1]);
string S = Console.ReadLine();
char[] C = new char[N];
C = S.ToCharArray();
Console.Write("改行なし a = {0} b = {1} c = {2}", a, b, c)//改行なし出力
Console.WriteLine("改行あり a = {0} b = {1} c = {2}", a, b, c);//改行付き出力

string[] str = Console.ReadLine().Split(' ');
int[] a = new int[N];
for(int i = 0; i < N; i++) a[i] = int.Parse(str[i]);
 */


Measured memory_bytes: 13140