akhauriyash/Code-Regression huggingface dataset:
$input = <>;
@inputs = split(//, $input);
@check;
for (0..26) {
    $check[$_] = 0;
}

for $i (@inputs) {
    $count = 0;
    for('a'..'z') {
        if ($i eq $_) {
            $check[$count] = 1;
            last;
        }
        $count++;
    }
    if ($al) {
        last;
    }
}

$count = 0;
for (0..26) {
    if ($check[$_] == 0) {
        $count2 = 0;
        for('a'..'z') {
            if ($count == $count2) {
                print $_;
                exit(0);
            }
            $count2++;
        }
    }
    $count++;
}
print "None";

Measured memory_bytes: 8448
import math

k = int( input() )
out_sum = 0

# a==b and b==c
for a in range(1, k+1):
    out_sum += a

# a==b and b!=c
for a in range(2, k+1):
    for b in range(1, a):
        out_sum += 6 * math.gcd(a,b)

# a!=b and b!=c
for a in range(3, k+1):
    for b in range(2, a):
        for c in range(1, b):
            out_sum += 6 * math.gcd( a, math.gcd(b,c) )

print( out_sum )

Measured memory_bytes: 9188
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	int H, W; cin >> H >> W;
	vector<string> a(H);
	REP(i,H) cin >> a[i];

	REP(i,W+2) cout << '#';
	cout << endl;

	REP(i,H){
		a[i] = '#' + a[i] + '#';
		cout << a[i] << endl;
	}

	REP(i,W+2) cout << '#';
	cout << endl;


	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file 
//#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define pb push_back
#define ff first
#define ss second
#define ii insert
#define ld long double
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define ppb pop_back
#define nuenxfiu ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define TT int testcases;cin>>testcases;while(testcases--)
#define mk make_pair
#define MAX ((int)2e9+17)
#define mod ((int)1e9+7)
#define MOD 1000003
//int fact[1000007]={0};
#define N (int)1e6+10
int fpow(int n, int k, int p = mod) {int r = 1; while(k > 0) {if (k & 1) r = r * n%p; n = n * n%p; k = k >> 1;} return r;}
int expo(int x,int y){ int res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
int sub(int a, int b) {return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b) {return ((a%mod)*(b%mod) + mod)%mod;}
int inv(int x) {return expo(x, mod-2);}
using namespace std;



void solve()
{
	int a[5];
	
	for(int i=0;i<5;i++)
	cin>>a[i];
	
	for(int i=0;i<5;i++)
	{
		if(a[i]==0)
		{
		cout<<i+1<<endl;
		return ;
		}
	}
}
signed main()
{
    
	nuenxfiu
	//TT
	solve();
     return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <stdbool.h>
#define rep(i, n) for(int i = 0; i < n; ++i)

bool flag[4000000];

int main(void) {
  int i, j, k, n;
  scanf("%d", &n);
  rep(i, 4000000) flag[i] = false;
  rep(i, n) {
    int a, b;
    scanf("%d%d", &a, &b);
    a += b;
    if(!flag[a]) flag[a] = true;
    else {
      for(j = a; i < 4000000; ++j) {
        if(flag[j]) flag[j] = false;
        else {
          flag[j] = true;
          break;
        }
      }
    }
    /*rep(j, 9) printf("%d ", flag[j] ? 1 : 0);
    printf("\n");*/
  }
  rep(i, 4000000) if(flag[i]) printf("%d 0\n", i);
  return 0;
}


Measured memory_bytes: 6652
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;

int main(void)
{
    long long a, b, x;
    cin >> a >> b >> x;

    long long pa = a / x;
    long long qa = a % x;

    long long pb = b / x;

    long long ans = pb - pa;

    if(qa == 0)
    {
        ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3572
import heapq
n, h = map(int, input().split())

hq = []
nmax = 0
for i in range(n):
    a, b = map(int,input().split())
    nmax = max(nmax, a)
    heapq.heappush(hq, -b)
heapq.heappush(hq, -nmax)

ans = 0
while h > 0:
    d = -heapq.heappop(hq)
    if d == nmax:
        ans+=max(0, (h+nmax-1)//nmax)
        break
    else:
        h -= d
        ans+=1
print(ans)

Measured memory_bytes: 12836
"""
https://atcoder.jp/contests/abc127/submissions/5620648
"""
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bc = [list(map(int, input().split())) for _ in range(m)]

bc.sort(reverse=True, key=lambda x:x[1])

i = 0
for b,c in bc:
    for j in range(i, min(n, i+b)):
        if a[j] < c:
            a[j] = c
    i = i+b
print(sum(a))


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

/*	ASCII Code of A=65
  	ASCII Code of a=97	*/

#define kill(N) cout<<N<<'\n';
int N,K;

int main(){
	cin>>N;
	if(N%1000==0){
		kill(0);
	}else{
		kill(1000-(N%1000));
	}
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

    int r;
    cin>>r;

    cout<<fixed<<setprecision(4)<<r*2*M_PI<<endl;

    return 0;
}


Measured memory_bytes: 3780
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;

int main(){
    int N; 
    cin >> N;
    vector<int> D(N);
    map<int, int> d_cnt;
    for(int i = 0; i < N; ++i){
        cin >> D[i];
        d_cnt[D[i]]++;
    }
    int M; 
    cin >> M;
    vector<int> T(M);
    map<int, int> t_cnt;
    for(int i = 0; i < M; ++i){
        cin >> T[i];
        t_cnt[T[i]]++;
    }
    
    for(int i = 0; i < M; ++i){
        if(d_cnt[T[i]] < t_cnt[T[i]]){
            cout << "NO\n";
            return 0;
        }
    }
    
    cout << "YES\n";
}

Measured memory_bytes: 20608
#include <iostream>
#include <map>
#include <cmath>
#define INF 10000000000
using namespace std;

int memo[300][20][20][20];
 
int R(int i, int S, int A, int C, int M){
  if(memo[i][S][A][C] != -1) return memo[i][S][A][C];
  if(i == 0) return S;
  return memo[i][S][A][C] = (A * R(i-1, S, A, C, M) + C) % M;
}
 
int O(int i, int I, int M, int S, int A, int  C){
  return (I + R(i, S, A, C, M)) % M;
}
 
int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  int I[300];
  int I_[300];
  for(int i = 0; i < 300; i++)
    for(int j = 0; j < 20; j++)
      for(int k = 0; k < 20; k++)
        for(int l = 0; l < 20; l++)
          memo[i][j][k][l] = -1;
  while(cin >> N, N){
    for(int i = 0; i < N; i++) cin >> I[i];
 
    int ansS = -1, ansA = -1, ansC = -1, M = 256;
    double entropy = INF;
    for(int S = 0; S <=15; S++){
      for(int A = 0; A <= 15; A++){
        for(int C = 0; C <= 15; C++){
          double H = 0;
          map<int, int> occurence;
          for(int i = 0; i < N; i++){
            I_[i] = O(i+1, I[i], M, S, A, C);
            if( occurence.find(I_[i]) == occurence.end() ){
              occurence[I_[i]] = 1;
            }else{
              occurence[I_[i]] += 1;
            }
          }
 
          for(map<int, int>::iterator it = occurence.begin(); it != occurence.end(); it++){
            H -= ((*it).second / (double)N) * log((*it).second / (double)N);
          }
          //entropy = min(entropy, H);
          if(abs(entropy - H) < 0.00001){
            if(ansS > S){
              ansS = S;
              ansA = A;
              ansC = C;
            }else if(ansS == S){
              if(ansA > A){
                ansS = S;
                ansA = A;
                ansC = C;
              }else if(ansA == A){
                if(ansC > C){
                  ansS = S;
                  ansA = A;
                  ansC = C;
                }
              }
            }
          }
          else if(entropy > H){
            entropy = H;
            ansS = S; ansA = A; ansC = C;
          }
        }
      }
    }
    cout << ansS << " " << ansA << " " << ansC << endl;
  }
}

Measured memory_bytes: 12720
#include<iostream>
#include<queue>
using namespace std;
struct task{
    string name;
    int time;
};
int main()
{
    int n,q;
    int curr=0;
    cin>>n>>q;
    task tasks[n];
    queue <task>qu;
    for(int i=0;i<n;i++)
    {
        cin>>tasks[i].name>>tasks[i].time;
        qu.push(tasks[i]);
    }
    while(!qu.empty())
    {
        task head=qu.front();
        if(head.time<=q)
        {
            cout<<head.name<<" "<<head.time+curr<<endl;
            curr=curr+head.time;
            qu.pop();
        }
        else
        {
            curr=curr+q;
            head.time=head.time-q;
            qu.push(head);
            qu.pop();
        }
    }
    return 0;
}



Measured memory_bytes: 7104
#include <iostream>

using namespace std;

int main(){
    int a[5];
    int k;
    for(int  i = 0;i < 5;i++){
        cin >> a[i];
    }
    cin >> k;
    for(int i = 1;i < 5;i++){
        a[i] -= a[0];
        if(a[i] > k){
            cout << ":(" << endl;
            return 0;
        }
    }
    cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define rep(i,a,n) for(ll i = a ; i <=n;++i)
#define sf(n) scanf("%lld",&n)
#define pf(n) printf("%lld\n",n)
#define bug printf("bug\n")


int main()
{

    ll x , y ;
    sf(x);sf(y);

    ll a = x , i = 1;
    if((x%y) == 0)  {cout <<-1<<endl; return 0;}
    while(true){
        a*=i;
        if((a%x) == 0 && (a%y) != 0)
        {
            pf(a);
            break;

        }
        ++i;



}

return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main() {
  char *buf=(char*)malloc(sizeof(char) * 20000);
 
  scanf("%[^\n]", buf);
  char* cur = buf;
  int length = strlen(buf);
 
  char l1[] = "dream";
  char l2[] = "dreamer";
  char l3[] = "erase";
  char l4[] = "eraser";
  int a1 = 5;
  int a2 = 7;
  int a3 = 5;
  int a4 = 6;
 
  while (length > 0) {
    if (strstr(cur, l4) == cur) {
      length -= a4;
      if(length <= 0) {
        break;
      }
      cur = cur + a4;
    } else if (strstr(cur, l3) == cur) {
      length -= a3;
      if(length <= 0) {
        break;
      }
      cur = cur + a3;
    } else if (strstr(cur, "dreamerase") == cur) {
      length -= a1;
      if(length <= 0) {
        break;
      }
      cur = cur + a1;
    } else if (strstr(cur, l2) == cur) {
      length -= a2;
      if(length <= 0) {
        break;
      }
      cur = cur + a2;
    } else if (strstr(cur, l1) == cur) {
      length -= a1;
      if(length <= 0) {
        break;
      }
      cur = cur + a1;
    } else {
      break;
    }
  }
 
  if (length == 0) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
 
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int x;
	cin >> x;
	bool flag = false;
	for(int i=-1000;i<=1000;i++)
	{
		for(int j=-1000;j<=1000;j++)
		{
			//cout << i << " " << j << endl;
			if(pow(i, 5)-pow(j, 5)==x)
			{
				flag = true;
				cout << i << ' ' << j << endl;
				break;
			}
		}
		if(flag) break;
	}
	return 0;
}

Measured memory_bytes: 4100
/* 
 * Project: AtCoder Beginners Contest 153 B - Common Raccoon vs Monster
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/07/02
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <stdio.h>
#include <algorithm>
#include <numeric>
using namespace std;

int h;
int n;
int a[100000];

void solve() {

    if (h - accumulate(a, a+n, 0) <= 0)
        printf("Yes\n");
    else
        printf("No\n");
}

int main() {

    scanf("%d", &h);
    scanf("%d", &n);
    for (int i=0;i<n;i++) {
        scanf("%d", &a[i]);
    }

    solve();

}

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

vector<int> d;
vector<vector<int>> e;
vector<int> counter;

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

  d.resize(n);
  e.resize(n);
  counter.resize(n);

  for(int i=0; i<n-1; ++i){
    int a, b; cin >> a >> b;
    e[a-1].push_back(b-1);
  }

  while(Q--){
    int p, x; cin >> p >> x;
    counter[p-1] += x;
  }

  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int v = q.front(); // キューから先頭頂点を取り出す
    q.pop();

    // v から辿れる頂点をすべて調べる
    for (int nv : e[v]) {
        if (d[nv] != 0) continue; // すでに発見済みの頂点は探索しない

        // 新たな白色頂点 nv について距離情報を更新してキューに追加する
        d[nv] = 1;
        counter[nv] += counter[v];
        q.push(nv);
    }
  }

  for(auto ans : counter){
    cout << ans << endl;
  }
}


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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  sort(A.begin(), A.end());
  int maxn = A[N - 1];
  int minn = abs(A[N - 1] - 2 * A[0]);
  int pos  = 0;
  for (int i = 1; i < N - 1; i++) {
    int tmp = abs(A[N - 1] - 2 * A[i]);
    if (minn < tmp) break;
    minn = tmp;
    pos  = i;
  }
  cout << A[N - 1] << " " << A[pos] << '\n';
  return 0;
}


Measured memory_bytes: 640
class BinaryIndexedTree:
    def __init__(self, n):
        self.a = [0] * (n + 1)
        self.n = n

    def add(self, i, x):
        while i <= self.n:
            self.a[i] += x
            i += i & -i

    def sum(self, i):
        ret = 0
        while i > 0:
            ret += self.a[i]
            i -= i & -i
        return ret


class Solve:
    def __init__(self, n):
        self.n = n
        self.p = BinaryIndexedTree(n + 1)
        self.q = BinaryIndexedTree(n + 1)

    def add(self, s, t, x):
        t += 1
        self.p.add(s, -x * s)
        self.p.add(t, x * t)
        self.q.add(s, x)
        self.q.add(t, -x)

    def get_sum(self, s, t):
        t += 1
        return self.p.sum(t) + self.q.sum(t) * t - \
               self.p.sum(s) - self.q.sum(s) * s

    def dump(self):
        print(*(self.get_sum(i, i) for i in range(self.n + 1)))


n, q = map(int, input().split())
st = Solve(n)
buf = []
for _ in range(q):
    query = input().split()
    if query[0] == '0':
        st.add(*map(int, query[1:]))
    else:
        buf.append(st.get_sum(*map(int, query[1:])))
print('\n'.join(map(str, buf)))

Measured memory_bytes: 21504
import java.util.Scanner;

public class Main{

	static final Scanner	s	=new Scanner(System.in);

	public static void main(String args[]){
		input();
		solve();
	}

	private static void input(){
	}

	private static void solve(){
		int a=s.nextInt(),b;
		char op=s.next().charAt(0);
		b=s.nextInt();
		System.out.println(op=='+'?a+b:a-b);
	}
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner io = new Scanner(System.in);
		long H = io.nextLong();
		long W = io.nextLong();
		long sum = H*W;
		
		if(sum%3==0){
			System.out.println(0);
			return;
		}
		long ans = Long.MAX_VALUE;
		long x,y,z,max,min;
		for(int i=1;i<H;i++){
			x = W*i;
			y = (H-i)*(W/2);
			z = sum - x -y;
			max = Math.max(x,Math.max(y, z));
			min = Math.min(x,Math.min(y, z));
			ans = Math.min(ans,max-min);
			y = (H-i)/2*W;
			z = sum - x -y;
			max = Math.max(x,Math.max(y, z));
			min = Math.min(x,Math.min(y, z));
			ans = Math.min(ans,max-min);
		}
		for(int i=1;i<W;i++){
			x = H*i;
			y = (W-i)*(H/2);
			z = sum - x -y;
			max = Math.max(x,Math.max(y, z));
			min = Math.min(x,Math.min(y, z));
			ans = Math.min(ans,max-min);
			y = (W-i)/2*H;
			z = sum - x -y;
			max = Math.max(x,Math.max(y, z));
			min = Math.min(x,Math.min(y, z));
			ans = Math.min(ans,max-min);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22100
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define INF 2000000000

int parent(int);
int left(int);
int right(int);
void maxheapify(int);
void maxheapinsert(int);
void heapincreasekey(int,int);
int heapextractmax(void);


int A[1000000];
int H=0;

int main(){
  int i;
  int key;
  char order[10];
  
  while(1){
    scanf("%s",order);
    if(strcmp(order,"insert")==0){
      scanf("%d",&key);
      maxheapinsert(key);
    }
    if(strcmp(order,"extract")==0){
      printf("%d\n",heapextractmax());
    }
    if(strcmp(order,"end")==0){
      break;
    }
  }
  return 0;
}
int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return (2*i+1);
}
void maxheapify(int i){
  int l,r;
  int swap,largest;
  l=left(i);
  r=right(i);
  if(l<=H && A[l]>A[i]) largest=l;
  else largest=i;
  if(r<=H && A[r]>A[largest]) largest=r;
  if(largest!=i){
    swap=A[i];
    A[i]=A[largest];
    A[largest]=swap;
    maxheapify(largest);
  }
}
void maxheapinsert(int key){
  H++;
  A[H]=-INF;
  heapincreasekey(H,key);
}
void heapincreasekey(int i,int key){
  int swap;
  if(key<A[i]) printf("new key is smaller than current key\n");
  A[i]=key;
  while(i>1 && A[parent(i)]<A[i]){
    swap=A[i];
    A[i]=A[parent(i)];
    A[parent(i)]=swap;
    i=parent(i);
  }
}
int heapextractmax(void){
  int max;
  if(H<1) printf("heap underflow\n");
  max=A[1];
  A[1]=A[H];
  H--;
  maxheapify(1);
  return max;
}



Measured memory_bytes: 5628
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

int main(){
    int H, W;
    int h, w;
    cin >> H >> W;
    cin >> h >> w;
    int ans = H * W - (h * W + w * H - h * w);
    cout << ans << endl;


}


Measured memory_bytes: 256
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
template<typename T> ll min(ll a, const T&& b) { return a < b ? a : b; }
template<typename T> ll min(const T&& a, ll b) { return a < b ? a : b; }
template<typename T> ll max(ll a, const T&& b) { return a > b ? a : b; }
template<typename T> ll max(const T&& a, ll b) { return a > b ? a : b; }
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

ll query(ll u, ll v) {
  cout << "? " << u+1 << " " << v+1 << endl;
  ll res; cin >> res;
  return res;
}
void output(vector<ll> ans) {
  each(x, ans) ++x;
  cout << "! " << ans << endl;
}

void solve() {
  ll n, s, t; cin >> n >> s >> t; --s, --t;
  set<P> ord;
  ord.insert(P(0, s));
  ll len = query(s, t);
  ord.insert(P(len, t));
  rep(i, n) {
    if (i == s || i == t) continue;
    ll pos = query(s, i);
    if (pos > len) continue;
    if (pos + query(i, t) == len) {
      auto it = ord.lower_bound(P(pos, -linf));
      if (it->first == pos) continue;
      P nxt = *it;
      P prv = *prev(it, 1);
      if (query(prv.second, i) + query(i, nxt.second) == nxt.first - prv.first) {
        ord.insert(P(pos, i));
      }
    }
  }
  vector<ll> ans;
  each(p, ord) {
    ans.pb(p.second);
  }
  output(ans);
}



Measured memory_bytes: 4652
a = input()
if a == 'SUN':
  print(7)
elif a == 'MON':
  print(6)
elif a == 'TUE':
  print(5)
elif a == 'WED':
  print(4)
elif a == 'THU':
  print(3)
elif a == 'FRI':
  print(2)
else:
  print(1)
 

Measured memory_bytes: 2940
#include<cstdio>
#include<string>
#include<queue>
using namespace std;

int main()
{
    char com[20];
    
    priority_queue<int> PQ;
    while(1)
    {
        scanf("%s",com);
        if(com[0]=='i') {
            int key;
            scanf("%d",&key);
            PQ.push(key);
        }
        else if(com[1]=='x')
        {
            printf("%d\n",PQ.top());
            PQ.pop();
        }
        else if(com[0]=='e')
        {
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 6532
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;
const ll LINF=1e18;

ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}

int main(){
    ll a,b;
    cin>>a>>b;
    cout<<a/gcd(a,b)*b<<endl;
}

Measured memory_bytes: 256
require 'set'
a=gets.split(" ").map{|e| e.to_i}
ks=Set.new((1..1000).map{|e| e*e})
arr=[]
ans=0
a[0].times{|i|
	arr<<(gets.split(" ").map{|e| e.to_i})
	(arr.size-1).times{|j|
		# arr.size
		l=0
		a[1].times{|k|
			l+=(arr[i][k]-arr[j][k])**2
		}
		if ks.member?(l)==true
			ans+=1
		end
	}
}
p ans

Measured memory_bytes: 2044
#include <stdio.h>

main(){
  int n;


  while(1){
    if(scanf("%d", &n)==EOF) break;
    switch(n){
    case 1:
      printf("1\n");
      break;
    case 2:
      printf("2\n");
      break;
    case 3:
      printf("6\n");
      break;
    case 4:
      printf("24\n");
      break;
    case 5:
      printf("120\n");
      break;
    case 6:
      printf("720\n");
      break;
    case 7:
      printf("5040\n");
      break;
    case 8:
      printf("40320\n");
      break;
    case 9:
      printf("362880\n");
      break;
    case 10:
      printf("3628800\n");
      break;
    case 11:
      printf("39916800\n");
      break;
    case 12:
      printf("479001600\n");
      break;
    case 13:
      printf("6227020800\n");
      break;
    case 14:
      printf("87178291200\n");
      break;
    case 15:
      printf("1307674368000\n");
      break;
    case 16:
      printf("20922789888000\n");
      break;
    case 17:
      printf("355687428096000\n");
      break;
    case 18:
      printf("6402373705728000\n");
      break;
    case 19:
      printf("121645100408832000\n");
      break;
    case 20:
      printf("2432902008176640000\n");
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int n, m;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    map<int, int> mp;
    for (int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        mp[x]++;
    }
    for (int i = 0; i < m; ++i)
    {
        int b, c;
        cin >> b >> c;
        mp[c] += b;
    }
    auto it = mp.rbegin();
    ll sol = 0;
    for (int i = 0; i < n; ++i)
    {
        if (it->second == 0)
            ++it;
        --it->second;
        sol += it->first;
    }
    cout << sol;
}


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  ll n;
  cin >> n;
  vector<ll> trans(5);
  scan(trans);

  ll m = *min_element(all(trans));
  ll t = (n / m) + bool(n % m);
  put(t + 4);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

template <class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

signed main() {
    int n, l;
    cin >> n >> l;

    int eat = INF;
    int sum = 0;
    for (int i=0;i<n;i++) {
        int cnd = l + i;
        sum += cnd;
        if (abs(cnd) < abs(eat)) eat = cnd;
    }

    int ans = sum - eat;
    cout << ans << endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused_imports)]
 
// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }
 
// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};
 
// Functions
 
// Main
fn main(){
    input!{
        W: u64,
        H: u64,
        X: u64,
        Y: u64,
    }
    let s = ((W*H) as f64)/2.0;
    let b = if X*2==W && Y*2==H{1}else{0};
    println!("{} {}", s, b);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a,b,c,d,count;
  a=0;b=0;c=0;d=0;
    char e;
  count =0;
  	string s;
  	cin>>a>>b>>c;
if(a+b>=c)
  cout<<"Yes"<<endl;
else
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, y;
int m = -1, f = -1, t = -1;
int main()
{
    cin >> n >> y;
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= n - i; j++)
        {
            if (i * 10000 + j * 5000 + (n - i - j) * 1000 == y)
            {
                m = i;
                f = j;
                t = (n - i - j);
            }
        }
    }
    cout << m << " " << f << " " << t << endl;
    return 0;
}

Measured memory_bytes: 256
def make_divisors(n: int) -> list:
    """自然数nの約数を列挙したリストを出力する
    計算量: O(sqrt(N))
    入出力例: 12 -> [1, 2, 3, 4, 6, 12]
    """
    divisors = []
    for k in range(1, int(n ** 0.5) + 1):
        if n % k == 0:
            divisors.append(k)
            if k != n // k:
                divisors.append(n // k)
    divisors = sorted(divisors)
    return divisors


def solve(val):
    res = []
    for i in range(n):
        tmp = a[i] % val
        if tmp == 0:
            continue
        res.append(a[i] % val)
    res = sorted(res)
    if not res:
        return True
    l_val = 0
    for i in range(len(res)):
        l_val += res[i]
        if l_val > k:
            l_pos = i - 1
            break
    else:
        return True
    r_val = 0
    for i in range(l_pos + 1, len(res)):
        r_val += val - res[i]
    return r_val <= k
            
      
        
    
n, k = map(int, input().split())
a = list(map(int, input().split()))

sum_a = sum(a)
div = make_divisors(sum_a)
ans = 0
for i in div:
    if solve(i):
        ans = max(ans, i)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b&&b==c)  cout<<"No";
    else if(a!=b&&b!=c&&c!=a)   cout<<"No";
    else    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
def add(in1, in2):
    return [a + b for a, b in zip(in1, in2)]
 
def split(ar, k, w):
    a = 0
    if max(max(ar)) > k:
      return -1
    tm = ar[0]
    for i in range(1, w):
        tm = add(tm, ar[i])
        if max(tm) > k:
            a += 1
            tm = ar[i]
    return a        
 
h, w, k = map(int, input().split())
s = [[int(i) for i in input()] for j in range(h)]
ans = h+w
 
for i in range(2**(h-1)):
    data = []
    temp = s[0]
    sp = bin(i+2**h)[4:]
    if ans < sp.count("1"):
        continue
    for j in range(1, h):
        if sp[j-1] == "0":
            temp = add(temp, s[j])
        else:
            data.append(temp)
            temp = s[j]
    data.append(temp)
    ans_ = split([list(x) for x in zip(*data)], k, w)
    if ans_ == -1:
        continue
    ans_ += sp.count("1")
    if ans > ans_:
        ans = ans_
print(ans)



Measured memory_bytes: 50752
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;

    while(cin>>s)
    {

    int l=s.size(),cnt=0;

    for(int i=0;i<l-1;i++)
    {
        if(s[i]==s[i+1])
            cnt=1;
    }
    if(cnt==1)
        cout<<"Bad"<<endl;
    else
        cout<<"Good"<<endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
#include<functional>
#include<bits/stdc++.h>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long int n; 
	double m=1,s=0, x;
    cin>>n;
    while(n--)
    {
    	cin>>x;
    	s+=(1/x);
	}
	printf("%.14lf\n", 1/s);
	//cout<<1/s<<endl;
    
    return 0;
}

Measured memory_bytes: 256
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
war = "War"
x_max = max(x)
y_min = min(y)

for i in range(Y+1):
	if X < i <= Y:
		if x_max < i:
			if y_min >= i:
				war = "No War"
print(war)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Yuan Lei
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task1000 solver = new Task1000();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task1000 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            s = s.substring(0, s.length() - 8);
            out.println(s);
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public boolean hasNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    final String line = reader.readLine();
                    if (line == null) return false;
                    tokenizer = new StringTokenizer(line);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return true;
        }

        public String next() {
            if (hasNext()) return tokenizer.nextToken();
            return null;
        }

    }
}



Measured memory_bytes: 21460
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n,c;
  while(cin>>n,n){
    vector<int> ret(4);
    vector<vector<int> > in(n,vector<int>(5,0));
    int e[3] = {4,9,4};
    rep(i,n){
      rep(j,4){
	cin>>in[i][j];
	if(j != 0)in[i][4] += in[i][j] * e[j-1];
      }
    }
    rep(i,4){
      cin>>ret[i];
    }
    vector<int> ary;
    rep(i,n){
      bool judge = true;
      rep(j,4){
	if(in[i][j+1] > ret[j])judge = false;
      }
      if(judge)ary.pb(in[i][0]);
    }
    rep(i,ary.size())cout<<ary[i]<<endl;
    if(ary.size()==0)cout<<"NA"<<endl;
  }
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    char s[100],t[100];
    cin >> s >> t;
    if((int)strlen(s)+1 != (int)strlen(t)){
        cout << "No" << endl;
    }
    rep(i,strlen(s)){
        if(s[i] == t[i]){
            continue;
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3636
def g(a, b):
    while b:
        a, b = b, a%b
    return a
n = int(input())
a = list(map(int, input().split()))
ans = a[0]*a[1]/g(a[0],a[1])
for i in a[2:]:
    ans = ans*i/g(ans,i)
print(int(ans))


Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define INF (1e18)
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} //最大公約数

int main(){   
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> ans;
    ll v2 = N/2;
    if(v2 % 2 == 1){
        v2++;
    }
    ll idx = 0;
    ll n = 0;
    while(idx < v2){
        if(n % 3 == 0){
            n++;
        }else{
            ans.push_back(2*n);
            idx++;
            n++;
        }
    }
    ll v3 = N - v2;
    ll ss = 0;
    rep(i,0,v3){
        ans.push_back(3*(i+1));
        ss += 3 * (i+1);
    }
    if(ss % 2 == 1){
        ans[N-1] += 3;
    }
    if(N == 3){
        print("2 5 63");
    }else{
        printa(ans, N);
    }
    // bool ok = true;
    // rep(i,0,N){
    //     ll sum = 0;
    //     rep(j,0,N){
    //         if(i == j) continue;
    //         sum += ans[j];
    //     }
    //     if(gcd(ans[i], sum) == 1) ok = false;

    //     print2(sum, gcd(ans[i], sum));
    // }
    // if(!ok) print("invalid");


}


Measured memory_bytes: 640
n = int(input())
a = ['null']
a += list(map(int,input().split()))
b = ['null'] + [0 for _ in range(n)]
for i in range(n):
  k = n - i
  d = n // k
  xor = 0
  for di in range(1,d+1):
    xor ^= b[di * k]
  b[k] = a[k] ^ xor
c = []
csum = 0
for i in range(1,n+1):
  if b[i] == 1:
    c.append(str(i))
    csum += 1
print(csum)
print(' '.join(c))

Measured memory_bytes: 17708
import numpy as np
from numba import njit
INF = 10**12


@njit
def main(N, K, H):
    dp = [INF]*(N)
    dp[0] = 0
    for i in range(N):
        for s in range(K):
            if i-s-1 < 0:
                break
            dp[i] = min(dp[i], dp[i-s-1] + abs(H[i-s-1] - H[i]))
    print(dp[-1])


if __name__ == '__main__':
    N, K = (int(i) for i in input().split())
    H = np.array([int(i) for i in input().split()], dtype=np.int32)
    main(N, K, H)


Measured memory_bytes: 112348
def main():
    N = int(input())
    L = list(map(int, input().split()))
    A, S = [0] * (N+1), [0] * (N+1)
    for i in range(N):
        A[i+1] = A[i] ^ L[i]
        S[i+1] = S[i] + L[i]
    res, l = 0, 1
    for r in range(1, N+1):
        while (S[r] - S[l-1]) != (A[r] ^ A[l-1]):
            l += 1
        res += r-l+1
    print(res)
  
if __name__ == "__main__":
    main()


Measured memory_bytes: 77900
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        x: i32, a: i32, b: i32,
    }

    if (b - a) <= 0 {
        println!("delicious");
    } else if ( b - a) <= x {
        println!("safe");
    } else {
        println!("dangerous");
    }
}


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

#define int long long
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); i++)  
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rap(i,a,n) for (int i = a; i < (n); i++) 
#define rrap(i,n,a) for (int i = (n)-1; i >= a; i--) 
#define LL_MAX 9223372036854775807

typedef vector<int> vi;  
typedef pair<int,int> ii;  
typedef vector<ii> vii;  
typedef list<int> li;  
typedef unordered_map<int,int> mii;

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

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int k;
    cin >> k;

    int sum = 0;
    
    rap(i,1,k+1) {
        rap(j,1,k+1) {
            rap(l,1,k+1) {
                sum += gcd(gcd(i,j),l);
            }
        }
    }

    cout << sum << '\n';


    return 0;
    //compile: g++ -std=c++14 -O2 -Wall NAME.cpp -o NAME
}


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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;



void solve(){

    string s, t;
    cin >> s >> t;

    rep(i,0,sz(s)){
        if(s[i] != t[i]) {
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";

    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


Measured memory_bytes: 3848
<?php
// D
fscanf(STDIN, '%d', $n);
$primes = primesArr(55555);
foreach ($primes as $p) {
    if ($p % 5 === 1) $ans[] = $p;
    if (count($ans) === $n) break;
}
echo implode(' ', $ans);

/**
 * 素数列挙（エラトステネスのふるい）
 * $maxまでの整数のうち素数のみを格納した配列を返す
 */
function primesArr($max)
{
    $is_prime = isPrimeArr($max);
    $res = [];
    for ($i = 1; $i <= $max; $i++) {
        if ($is_prime[$i]) $res[] = $i;
    }
    return $res;
}

/**
 * 素数判定（エラトステネスのふるい）
 * $maxまでの整数が素数かどうかboolを格納した配列を返す
 */
function isPrimeArr($max)
{
    $arr = array_fill(0, $max + 1, true);
    $arr[0]  = $arr[1] = false;
    $rmax = (int) floor(sqrt($max));
    for ($i = 2; $i <= $rmax; $i++) {
        for ($j = 2 * $i; $j <= $max; $j += $i) {
            $arr[$j] = false;
        }
    }
    return $arr;
}

Measured memory_bytes: 6776
import java.util.Scanner;

class Main{
    
    public static void main(String[] args){
        
        Scanner sc =new Scanner(System.in);
        
        int a[]=new int[26];
        
        while(sc.hasNextLine()){
        
        String S = sc.nextLine();
        
        for(int i = 0; i < S.length(); i++) {
        
		 char c = S.charAt(i);
		 
		 if('a'<= c&&c<='z')
          a[c-'a']++;
          
          if('A'<= c&&c<='Z')
          a[c-'A']++;
         
         }
         
         }
            
        for(int i=0;i<26;i++)    
        System.out.printf("%c : %d\n",'a'+i,a[i]);
}
}


Measured memory_bytes: 26344
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	private final static byte MASK_RIGHT = 0x0F; //右4bit数値化用マスク
	private final static int STRIP_LENGTH = 10; //短冊1行の長さ
	private static int[] punchTape = new int[100]; //10*10の方眼紙を短冊にしてくっつけた紙テープ

	public static void main(String[] args) throws Exception {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 256);
		String sLine;
		while ((sLine = reader.readLine()) != null) {
			droppingInk(sLine.charAt(0) & MASK_RIGHT, sLine.charAt(2) & MASK_RIGHT, sLine.charAt(4) & MASK_RIGHT);
		}
		calcResult();
	}

	/**
	 *都合の良い滴下
	 */
	private static void droppingInk(int x, int y, int size) {
		sinking(x, y - 1);
		sinking(x - 1, y);
		sinking(x, y);
		sinking(x + 1, y);
		sinking(x, y + 1);
		if (size == 1) {
			return;
		}

		sinking(x - 1, y - 1);
		sinking(x + 1, y - 1);
		sinking(x - 1, y + 1);
		sinking(x + 1, y + 1);
		if (size == 2) {
			return;
		}

		sinking(x, y - 2);
		sinking(x - 2, y);
		sinking(x + 2, y);
		sinking(x, y + 2);
	}

	/**
	 * 床は汚さないようにする
	 */
	private static void sinking(int x, int y) {
		if (x >= 0 && x < 10 && y >= 0 && y < 10) {
			punchTape[x * STRIP_LENGTH + y]++;
		}
	}

	/**
	 *紙の染みを数え、損害を報告する
	 */
	private static void calcResult() {
		int white = 0;//綺麗な部分
		int max = 0;//一番ひどい汚れ
		for (int i = 0; i < 100; i++) {
			if (punchTape[i] == 0) {
				white++;
			} else if (punchTape[i] > max) {
				max = punchTape[i];
			}
		}
		System.out.println(white);
		System.out.println(max);
	}
}

Measured memory_bytes: 16848
N = int(input())
A = [0]+[int(x) for x in input().split()]+[0]
dist = []
for ind,i in enumerate(A[:-1]):
    dist.append(abs(A[ind+1]-i))
ans0 = sum(dist)
for i in range(N):
    if(i==0):
        print(ans0 - dist[0]-dist[1] + abs(A[2]-A[0]))
    else:
        print(ans0 - (dist[i]+dist[i+1]) + abs(A[i+2]-A[i]))

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

using namespace std;

#define ll long long
#define F first
#define S second
#define ii pair < int , int >

const int N=1;

int main()
{

    string s;
    cin>>s;
    int ans=0;
    int n=s.size();
    for(int i=0;i<n;i++){
        if(s[i] != s[n-1-i]){
            ans++;
            s[i]=s[n-1-i];
        }
    }
    printf("%d",ans);
    }


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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	// debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, left, right)  (a).begin()+(left),(a).begin()+(right)	// left to (right-1)


int main() {
	int n;
	cin >> n;
	FOR(i, 1, 50000) {
		int komi = i * 1.08;
		if (komi == n) {
			pv(i);
			return 0;
		}
	}
	cout << ":(" << endl;
	return 0;
}

Measured memory_bytes: 3592