akhauriyash/Code-Regression huggingface dataset:
# coding: utf-8

from fractions import Fraction
from collections import Counter, defaultdict

II = lambda: int(input())
MI = lambda: map(int, input().split())


def main():
    A, B, C, D, E, F = MI()
    A *= 100
    B *= 100

    water_ws = set()
    for a in range(F//A + 1):
        for b in range(F//B + 1):
            w = a * A + b * B
            if w <= F: water_ws.add(w)
    water_ws.remove(0)
    sugar_w_max = max([ww // 100 * E for ww in water_ws])
    sugar_ws = set()
    for c in range(sugar_w_max // C):
        for d in range(sugar_w_max // D):
            w = c * C + d * D
            if w <= sugar_w_max: sugar_ws.add(w)
    ans_w, ans_s = A, 0
    dens_max = -1
    for ww in water_ws:
        for sw in sugar_ws:
            dens = Fraction(sw, ww + sw)
            if ww + sw <= F and sw <= ww // 100 * E and dens > dens_max:
                ans_w = ww + sw
                ans_s = sw
                dens_max = dens
    print(ans_w, ans_s)


if __name__ == "__main__":
    main()


Measured memory_bytes: 5204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

int main()
{
  ll n; cin>>n;
  string s; cin>>s;
  string sl = s.substr(0, n);
  string sr = s.substr(n);
  map<pair<string, string>, ll> mpl;
  map<pair<string, string>, ll> mpr;
  for (int bits=0; bits<1<<n; bits++) {
    vector<string> al(2, "");
    for (int i=0; i<n; i++) {
      al[(bits>>i&1)].push_back(sl[i]);
    }
    reverse(al[1].begin(), al[1].end());
    mpl[make_pair(al[0], al[1])]++;
    vector<string> ar(2, "");
    for (int i=0; i<n; i++) {
      ar[(bits>>i&1)].push_back(sr[i]);
    }
    reverse(ar[1].begin(), ar[1].end());
    mpr[make_pair(ar[1], ar[0])]++;
  }
  ll ans = 0;
  for (auto v:mpl) {
    ans += v.second * mpr[v.first];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 89576
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int r,d,x;
    cin>>r>>d>>x;
    rep(i,0,10){
        cout<<r*x - d<<endl;
        x = r*x - d;
    }
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

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



Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    REP(i,k){
	int x,y;
	cin >> x >> y;
	if(x > (n+1)/2 && y > (n+1)/2){
	    int tx,ty;
	    tx = (n+1) - x;
	    ty = (n+1) - y;
	    x = tx;
	    y = ty;
	}else if( x > (n+1)/2){
	    x = (n+1) - x;
	}else if( y > (n+1)/2){
	    y = (n+1) - y;
	}
	if(x == 0) x = 1;
	if(y == 0) y = 1;
//	printf("x = %d y = %d\n",x,y);
	int ans = 0;
	int d =x-y;
	ans = y;
	if(d <= 0){
	    ans += d;
	}else{
	    if(y == 0 || (y != 0 && n-2*(y-1) >= d) ){
	    }else{
		ans += d;
	    }
	}
	ans = (ans%3);
	if(ans == 0) ans = 3;
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
def bmi(h,w)
  w/h/h
end
loop{
  n=gets.to_i
  break if n.zero?
  nums = Array.new
  diffs_from_bmi = Hash.new
  n.times{
    i,h,w = gets.split.map(&:to_i)
    diffs_from_bmi[i]=(22-bmi(h/100.0,w)).abs
    nums<<i
  }
  nums.sort!
  nums.sort!{|a,b| diffs_from_bmi[a]<=>diffs_from_bmi[b]}
  puts nums.shift
}

Measured memory_bytes: 14000
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int n, m;
  cin>>n>>m;
  int edge[n][n];
  int dist[n][n];

  REP(i, n)REP(j, n){
    edge[i][j]=-1;
    dist[i][j]=100000;
  }
  int a[m], b[m];
  int s, t, u;
  REP(i, m){
    cin>>s>>t>>u;
    --s;
    --t;
    edge[s][t]=u;
    edge[t][s]=u;
    dist[s][t]=u;
    dist[t][s]=u;
    a[i]=s;
    b[i]=t;
  }

  REP(k, n){
    REP(i, n){
      REP(j, n){
        dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
        dist[j][i] = dist[i][j];
      }
    }
  }
  int ans=m;

  /*
  REP(k, m){
    REP(i, n){
      int l = a[k];
      int r = b[k];
      if(dist[i][l] + edge[l][r] == dist[i][r] || dist[l][r]==edge[l][r]){
        --ans;
        break;
      }
    }
  }*/

  REP(k, m){
    REP(i, n){
      REP(j, n){
        int l = a[k];
        int r = b[k];
        //cout<<dist[i][l] + dist[r][j] + edge[l][r]<<" "<<dist[i][j]<<endl;
        if(dist[i][l] + dist[r][j] + edge[l][r] == dist[i][j]
          ||dist[l][r]==edge[l][r]){
          --ans;
          goto breakloop;
        }
      }
    }
    breakloop:
    continue;
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
using namespace std;
//const int maxn=200000+10;
const int INF=int(1e9)+10;
#define LL long long
const int maxn = 20;
int n, m, swaped[maxn];
bool used[maxn], ans;

string s[20];

bool check() {
	memset(used, false, sizeof(used));
	for(int i = 0; i < m; i ++) {
		if(used[i])
			continue;
		for(int j = 0; j < m; j ++) {
			bool cur = true;
			if(i == j || used[j])
				continue;
			for(int k = 0; k < n; k ++) {
				if(s[swaped[k]][i] != s[k][j]) {
					cur = false;
					break;
				}
			}
			if(cur) {
				used[i] = used[j] = true;
				break;
			}
		}
	}

	int cnt = 0, noused = -1;
	for(int i = 0; i < m; i ++)
		if(!used[i])
			cnt ++, noused = i;
	if((cnt >= 2 ) || (cnt && (m % 2 == 0)))
		return false;
	for(int i = 0; i < n; i ++)
		if(s[swaped[i]][noused] != s[i][noused])
			return false;
	return true;
}

void dfs(int u, int flag) {
	if(u == (n + 1) / 2) {
		if(check())
			ans = true;
		return;
	}

	for(int i = u; i < n; i ++) {
		if(swaped[i] == -1) {
			for(int j = i + 1; j < n; j ++) {
				if(swaped[j] >= 0)
					continue;
				swaped[i] = j;
				swaped[j] = i;
				dfs(u + 1, flag);
				swaped[i] = swaped[j] = -1;
			}
			if(flag) {
				swaped[i] = i;
				dfs(u + 1, false);
				swaped[i] = -1;
			}
			break;
		}
	}
}

int main() {
	scanf("%d%d", &n, &m);
	memset(swaped, -1, sizeof(swaped));
	for(int i = 0; i < n; i ++)
		cin >> s[i];
	if(n & 1)
		dfs(0, true);
	else
		dfs(0, false);
	printf(ans ? "YES" : "NO");
	return 0;
}

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

int main(){
    int N; cin >> N;
    vector<int> P(N);
    rep(i,N) cin >> P[i];
    rep(i,N) P[i]--;
    vector<int> idx(N);
    rep(i,N) idx[P[i]] = i;
    set<int> s;
    ll ans = 0;
    for(int x=N-1;x>=0;--x){
        int i = idx[x];
        ll c = 0;
        {
            s.insert(i);
            vector<int> l(2,-1);
            vector<int> r(2,N);
            {
                auto it = s.find(i);
                rep(j,2){
                    if(it == s.begin()) break;
                    --it;
                    l[j] = *it;
                }
            }
            {
                auto it = s.find(i);
                rep(j,2){
                    ++it;
                    if(it == s.end()) break;
                    r[j] = *it;
                }
            }
            vector<int> ls(2);
            ls[0] = i-l[0]; ls[1] = l[0]-l[1];
            vector<int> rs(2);
            rs[0] = r[0]-i; rs[1] = r[1]-r[0];
            c = (ll)ls[0]*rs[1] + (ll)ls[1]*rs[0];
        }
        ans += c*(x+1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);


		int n = sc.nextInt();
		int m = sc.nextInt();

		long total  = 0;

		for(int i = 0; i < m ; i++){
			total += sc.nextLong();
		}

		System.out.println(Math.max(-1, n - total));
	}

}


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

int main(){
  long long n, s, k;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  s = 10000000000;
  for(int i = 1; i < 100; i++){
    k = 0;
    for(int j = 0; j < n; j++){
      k = k + (a[j] - i) * (a[j] - i);
    }
    s = min(s, k);
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int llint;
int main(){
	llint x,y;
	cin>>x>>y;
	llint cnt=0;
	for(int i=0;x<=y;i++){
		x*=2;
		cnt=i + 1;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
mod = 10 ** 9 + 7
x = [i for i in range(N+1)]
y = [0] * (N + 2)
z = [0] * (N + 2)
for i in range(N+1):
    y[i + 1] = y[i] + x[i]
    z[i + 1] = z[i] + x[N-i]
# print(y)
# print(z)
ans = 0
for i in range(K, N+2):
    ans += z[i] - y[i] + 1
    ans %= mod
print(ans)

Measured memory_bytes: 38164
/***
	chauhan176's code

	DO WHATEVER IT TAKES!!!
	Nothing happens , nothing happens and then everything happens.
	But the thing is nothing happens in air:)-
***/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long int
#define fi first
#define se second
#define mod 1000000007
#define maxn 200005
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define stringio cin.ignore(256, '\n')  //to take string input after taking integer inputs
#define go_t int t;cin>>t;while(t--)
#define go_pt int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
typedef pair<ll,ll>pii;
const ll inf = 0x3f3f3f3f3f3f3f3fll;//4x10e18
const int infi = 100005;
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    //freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    //freopen("output.txt", "w", stdout);
    #endif

    fastio;
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    int pre=0;
    for(int i=1;i<s.size();i++)
    {
        if(s[i]==s[i-1])pre++;
    }
    cout<<min(n-1,pre + 2*k)<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ri register int
#define il inline
#define ll long long
using namespace std;
const int N=1e6+110;
const int MAXN=110;
const int inf=0x7fffffff;
const double eps=1e-8;
il int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(isdigit(ch))
	{
		x=(x<<3)+(x<<1)+ch-'0';
		ch=getchar();
	}
	return x*f;
}
int n,k;
ll ans;
int main()
{
	n=read(),k=read();
	int num1=n/k;
	ans+=1ll*num1*num1*num1;
	if(k%2==0)
	{
		int num=n/(k/2);
		ans+=1ll*(num-num1)*(num-num1)*(num-num1);
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def main():
    N = int(input())
    t = sum(int(s) for s in str(N))
    if N % t == 0:
        print(Yes)
    else:
        print(No)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4076
#include <stdio.h>
int main(){
	int n,m,i,a,dp[100002]={0};
	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++){scanf("%d",&a);dp[a]=-1;}
	dp[0]=1;
	dp[1]=(dp[1]==-1?-1:1);
	for(i=2;i<=n;i++){
		if(dp[i-1]==-1&&dp[i-2]==-1){printf("0");return 0;}
		else if(dp[i]<0)continue;
		else if(dp[i-1]==-1)dp[i]=dp[i-2];
		else if(dp[i-2]==-1)dp[i]=dp[i-1];
		else dp[i]=dp[i-1]+dp[i-2];
		dp[i]%=1000000007;
	}
	printf("%d",dp[n]);
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#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>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
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 << 30;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
char s[N], ret[N];

int n;
bool valid(int x) {
  if (ret[x] == 'W') {
    if (s[x] == 'o') {
      return ret[(x + n - 1) % n] != ret[(x + 1) % n];
    } else {
      return ret[(x + n - 1) % n] == ret[(x + 1) % n];
    }
  } else {
    if (s[x] == 'x') {
      return ret[(x + n - 1) % n] != ret[(x + 1) % n];
    } else {
      return ret[(x + n - 1) % n] == ret[(x + 1) % n];
    }
  }
}

int main() {
  bool found = false;
  scanf("%d%s", &n, s);
  for (int k = 0; k < 4; ++k) {
    ret[0] = (k & 1) ? 'W' : 'S';
    ret[1] = (k & 2) ? 'W' : 'S';
    for (int i = 2; i < n; ++i) {
      if (ret[i - 1] == 'W') {
        if (s[i - 1] == 'o') {
          ret[i] = 'W' + 'S' - ret[i - 2];
        } else {
          ret[i] = ret[i - 2];
        }
      } else {
        if (s[i - 1] == 'o') {
          ret[i] = ret[i - 2];
        } else {
          ret[i] = 'W' + 'S' - ret[i - 2];
        }
      }
    }
    if (valid(n - 1) && valid(0)) {
      found = true;
      break;
    }
  }
  if (!found) {
    puts("-1");
  } else {
    puts(ret);
  }
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int n,i;
    int b,f,r,p;
    int H[5][4][11];
    
    for(b=1; b<=4; b++){
        for(f=1; f<=3; f++){
            for(r=1; r<=10; r++){
                H[b][f][r] = 0;
            }
        }
    }
    
    scanf("%d",&n);
    for(i=0; i<n; i++){
        scanf("%d %d %d %d",&b, &f, &r, &p);
        H[b][f][r] += p;
    }
    
    for(b=1; b<=4; b++){
        for(f=1; f<=3; f++){
            for(r=1; r<=10; r++){
                printf(" %d",H[b][f][r]);
            }
            putchar('\n');
        }
        if(b<4)printf("####################\n");
    }

    return 0;
}



Measured memory_bytes: 2044
#include <cstdio>
long long n, x, s, d, a[100005];
int main() {
	scanf("%d%d%d", &n, &x, &a[0]);
	for(int i=1; i<n; i++) {
		scanf("%d", &a[i]);
		d = a[i] + a[i-1] - x;
		if(d>0) a[i]-=d, s+=d;
		if(a[i]<0) a[i-1]+=a[i], a[i]=0;
	}
	printf("%lld", s);
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define ma 1e9

int main(){
  int n,k;cin>>n>>k;
  vector<int> h(n);
  for(int i=0;i<n;i++)cin>>h[i];
  
  vector<int> ans(n,ma);
  ans[0]=0;
  for(int i=0;i<n-1;i++){
    for(int j=1;j<=k&&i+j<n;j++){
      ans[i+j]=min(ans[i+j],abs(h[i]-h[i+j])+ans[i]);
    }
  }
  
  cout<<ans[n-1]<<endl;
}

Measured memory_bytes: 1152
use proconio::*;
use proconio::marker::*;
use petgraph::unionfind::*;

fn run() {
    input! {
        n: usize,
        m: usize,
        e: [(Usize1, Usize1); m],
    }
    let mut u = UnionFind::new(n);
    let mut ans = n - 1;
    for (a, b) in e {
        if u.union(a, b) {
            ans -= 1;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 5724
#include <iostream>
using namespace std;
int main(){
    int N;
    string r,s1="",s2="";
    cin>>N;
    bool flag=true;
    while(s1.size()<N){
        if(flag)
        for(int k=0;k<4;k++){
            cout<<(s1+(k&1?'#':'.'))<<endl<<flush;
            cout<<(s2+(k&2?'#':'.'))<<endl<<flush;
            cin>>r;
            if(r=="end") return 0;
            if(r=="T"){
                s1=s1+(k&1?'#':'.');
                s2=s2+(k&2?'#':'.');
                break;
            }else if(k==3){
                flag=false;
                break;
            }
        }
        if(!flag)
        for(int k=0;k<4;k++){
            cout<<((k&1?'#':'.')+s1)<<endl<<flush;
            cout<<((k&2?'#':'.')+s2)<<endl<<flush;
            cin>>r;
            if(r=="end") return 0;
            if(r=="T"){
                s1=(k&1?'#':'.')+s1;
                s2=(k&2?'#':'.')+s2;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 724
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(cin.hasNext()){
			int[][]a = new int[10][10];
			String str = cin.next();
			for(int i = 0; i < 10; i++){
				a[0][i] = Integer.parseInt(str.substring(i, i+1));
			}
			int count=9;
			for(int i = 1; i < 10; i++){
				for(int j = 0; j < count; j++){
					a[i][j] = (a[i-1][j]+a[i-1][j+1])%10;
				}
			}
			System.out.println(a[9][0]);
		}
	}

}

Measured memory_bytes: 11000
#include <vector>
#include <iostream>
#include <map>
#include <algorithm>
#include <random>
#include <complex>
#include <unordered_map>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <bitset>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

ll gcd(ll a, ll b) {
    if (!a) return b;
    return gcd(b%a, a);
}
ll ext_gcd(ll a, ll b, ll &x, ll &y) {
    ll d = a;
    if (b) {
        d = ext_gcd(b, a%b, y, x);
        y -= a / b*x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}

int w, d, n, m, t, u, h;
int x, tu, th;
void init() {
    m = t-m%t;
    u = gcd(t, w+d), h = gcd(t, m);
    tu = t/u; th = t/h;
    ll xx, y;
    ext_gcd(m, t, xx, y);
    x = ((xx % th) + th) % th;
}
int solve() {
    init();
    int res = 0;
    int l = 0;

    int s = 0;
    int wud = w/u, wum = w%u;
    int hud = h/u, hum = h%u;
    int iud = 0, ium = 0;
    for (int i = 0; i < t; i += h) {
        if (s<n) {
            int k = iud - wud;
            if (ium < wum) k--;
            res += max(0, k - l);
            l = iud;
        }
        s += x;
        if (s >= th) s -= th;
        iud += hud;
        ium += hum;
        if (ium >= u) {
            iud++;
            ium -= u;
        }
    }
    res += max(0, (t-w)/u - l);
    return res;
}

int main() {
    cin >> w >> d >> n >> m >> t; w++; d--;
    printf("%.20f\n", 1.0 * solve() / tu);
    return 0;
}

Measured memory_bytes: 1172
n,m = map(int,input().split())
a = list(map(int,input().split()))

sum = 0
for i in range(len(a)):
    sum += a[i]

min_hyou = sum/(4*m)

count = 0
for i in range(len(a)):
    if a[i] >= min_hyou:
        count+=1
if count>=m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<stdio.h>
#include<algorithm>
using namespace std;
pair<pair<int,int> ,int> t[50];
int d[50][10];
char str[10];
int main(){
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c),a){
		for(int i=0;i<50;i++)t[i]=make_pair(make_pair(0,0),i+1);
		for(int i=0;i<50;i++)
			for(int j=0;j<10;j++)
				d[i][j]=0;
		for(int i=0;i<c;i++){
			int p,q,r;
			scanf("%d%d%d%s",&p,&q,&r,str);
			p--;q--;
			if(str[0]=='W')d[p][q]++;
			else{
				t[p].first.first--;
				t[p].first.second+=1200*d[p][q]+r;
			}
		}
		std::sort(t,t+a);
		for(int i=0;i<a;i++)printf("%d %d %d\n",t[i].second,-t[i].first.first,t[i].first.second);
	}
}

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

int read()
{
	int ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=false;
	if(ch=='-')
	{
		flag=true;
		ch=getchar();
	}
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10+ch-'0';
	return flag?-ans:ans;
}

long long rell()
{
	long long ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=false;
	if(ch=='-')
	{
		flag=true;
		ch=getchar();
	}
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10ll+(long long)(ch-'0');
	return flag?-ans:ans;
}

void write(int a)
{
	if(!a)
	{
		putchar('0');
		return;
	}
	static char ans[233];
	int n=0;
	for(;a;a/=10)ans[n++]=a%10+'0';
	for(;n;)putchar(ans[--n]);
}

void write(long long a)
{
	if(!a)
	{
		putchar('0');
		return;
	}
	static char ans[233];
	int n=0;
	for(;a;a/=10)ans[n++]=a%10+'0';
	for(;n;)putchar(ans[--n]);
}

int main()
{
	int n,x,y;
	scanf("%d%d%d",&n,&x,&y);
	if(x+y>n+1 || (long long)x*y<n)
	{
		puts("-1");
		return 0;
	}
	for(int i=n-x+1;i<=n;i++)printf("%d ",i);
	y--;
	for(int i=n-x,j;i;i=j-1)
	{
		j=i-i/y+1;
		y--;
		for(int k=j;k<=i;k++)printf("%d ",k);
	}
	puts("");
	return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
//#define sort(v,n) sort(v,v+n)
//#define vsort(v) sort(v.begin(),v.end())
//#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//

vector<int> v;

int main() {
	for (int i = 0; i < 5; i++) {
		int a; cin >> a;
		v.push_back(a);
	}
	sort(v.rbegin(), v.rend());
	for (int i = 0; i < 5; i++) {
		cout << v[i];
		if (i != 4)cout << " ";
	}
	cout << endl;
}

Measured memory_bytes: 3076
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello{
    public static void Main(){
        int count = 0;
        string s = Console.ReadLine();
        for(var i = 0;i < s.Length - 1;i++){
           if(s[i] != s[i + 1]){
               count++;
           }
       }
       Console.WriteLine(count);
    }
}


Measured memory_bytes: 11232
#include<iostream>
#include"math.h"
#include <cstdio> 
#include <iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string.h>
#include <sstream>  
#include <string>
using namespace std;
bool isprime(int x){
	if(x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;
	int i = 3;
	while (i <= sqrt(x)){
		if(x % i == 0) return false;
		i += 2;
	}
	return true;
}

int main(){
	int n,x;
	int count = 0;
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> x;
		getchar();
		if(isprime(x)) count++;
	}
	cout << count << endl;
}


Measured memory_bytes: 3092
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//                                                                              NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define testcases() ll t; cin>>t; while(t--)
#define debug cout<<"Hello\n";
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define debug4(w,x,y,z) cout<<#w<<" "<<w<<" "<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
	ll n;
	cin>>n;
	map<ll,ll> mp;
	for(ll i=2;i*i<=n;i++)
	{
		while(n%i==0)
        {
            ++mp[i];
            n/=i;
        }
	}
	if(n>1)
		++mp[n];
	ll sum = 0;
	vector<ll> v;
	for(ll i=1;i<=50;i++)
	{
		sum += i;
		v.pb(sum);
	}
	ll ans = 0;
	for(auto it: mp)
    {
        ans += upper_bound(all(v),it.se) - v.begin();
    }
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define ld long double
int n;
int main() {
    cin>>n;
    double p[n];
    for(int i=0;i<n;i++)
    cin>>p[i];
    double dp[2][2][n+1];
    memset(dp,0,sizeof dp);
    dp[0][0][1] = p[0];
    dp[0][1][0] = (1-p[0]);
    int flag=1;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            for(int k=0;k<2;k++)
            {
                if(!k)
                {
                    dp[flag][k][j+1] = p[i]*(dp[1-flag][k][j]+dp[1-flag][1-k][j]);
                }
                else
                {
                    dp[flag][k][j] = (1-p[i])*(dp[1-flag][k][j]+dp[1-flag][1-k][j]);
                }
            }
        }
        flag = 1-flag;
    }
    ld ans=0.0;
    for(int i=n/2+1;i<=n;i++)
    {
        for(int k=0;k<2;k++)
        {
            ans+=dp[1-flag][k][i];
        }
    }
    cout<<fixed<<setprecision(10)<<ans;
}


Measured memory_bytes: 3904
n = int(input())
a, b, c = ([int(i) for i in input().split()] for j in range(3))
pre = a[0]
ans = b[a[0]-1]
for i in range(1, n):
    ans += b[a[i]-1]
    if a[i] == pre+1:
        ans += c[pre-1]
    pre = a[i]
print(ans)

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

int main() {
  int N;
  cin >> N;
  
  int total = 0;
  
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    for (int j = l -1; j < r; j++) total++;
  }
  cout << total << endl;
}

Measured memory_bytes: 256
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=9e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  for(int i=0; i<s.size(); i++) {
    s[i]=(char)('A'+(s[i]-'A'+n)%26);
  }
  cout << s << endl;
}


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

int main()
{
	int a;
	int b[2000000];
	int c[2000000] = { 0 };

	cin >> a;

	for (int i = 0; i < a - 1; i++)
	{
		cin >> b[i];
		c[b[i]]++;
	}

	/*for (int j = 0; j < a; j++)
	{
		c[j]++;
	}*/

	for (int i = 1; i <= a; i++)
	{
		cout << c[i] << "\n";
	}
}

Measured memory_bytes: 12196
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int n;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(1){
        cin >> n;
        if(n == 0) break;
        vector<int> a, l(n);
        rep(i, 0, n){
            int m;
            cin >> m >> l[i];
            int tmp = 0;
            rep(j, 0, m){
                int s, e;
                cin >> s >> e;
                s -= 6; e -= 6;
                rep(k, s, e) tmp += (1 << k);
            }
            a.push_back(tmp);
        }
        int dp[1 << 16] = {};
        for(int mask = 0; mask < (1 << 16); mask++){
            rep(i, 0, n){
                if((mask & a[i]) == 0){
                    chmax(dp[mask | a[i]], dp[mask] + l[i]);
                }
            }
        }
        int ans = 0;
        rep(i, 0, 1 << 16) chmax(ans, dp[i]);
        cout << ans << endl;
    }
}


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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 9223372036854775807
#define MOD 1000000007

int main(void){

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    while(c){
        c -= b;
        if (c <= 0){
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if(a<=0){
            cout << "No" << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3632
N = int(input())
Alist = list(map(int, input().split()))
for i in range(N):
    if Alist[i] % 2 == 0:
        if Alist[i] % 3 != 0 and Alist[i] % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int32_t main()
{
	//freopen("input.txt", "r", stdin);
	IOS;
	
	int a, b, c, k;
	cin >> a >> b >> c >> k;

	while(k--) {
		if(a >= b) b *= 2;
		else c *= 2;
		// cout << a << " " << b << " " << c << endl;
	}

	if(c > b && b > a) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 3648
n, m= map(int,input().split())

le = [0]*n
for i in range(n):
    le[i] = list(map(int, input().split())) #ABCが数字の場合これで一発



p = []
for i in range(n):
    p+= le[i][1:]

cnt = 0

for i in range(1,m+1):
    if p.count(i)==n:
        cnt +=1


print(cnt)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h,w;
    while(true){
    cin>>h>>w;
    if((h==0)&&(w==0))
        break;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cout<<"#";
        }
        cout<<"\n";
    }
    cout<<"\n";
}
}



Measured memory_bytes: 3036
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    string s;
    cin >> s;
    rep(i, s.size()){
      if(s[i] == ',')cout << ' ';
      else cout << s[i];
    }
    puts("");

/*/

//*/ break;
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define int long long

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

struct Data {
    int start;
    int len;
    int v;
    Data(int start, int len, int v) : start(start), len(len), v(v) {}
};

int dp[45][45]; // dp[i][j] := j??????????????§????§??????????i???????????????????????§???

signed main()
{ // #define int long long ?????????????????§scanf???????????¨???????????????????????\?????????????????????
    int N, M, L; cin >> N >> M >> L;

    vector<Data> kamoku;

    rep(i, M) {
        int d, a, k, t; cin >> d >> a >> k >> t;
        --a;

        kamoku.PB(Data(a + d * N, k, t));
    }

    for (int i = 1; i <= L; ++i) {
        for (int j = 0; j < M; ++j) {
            Data da = kamoku[j];

            for (int k = da.start; k >= 0; --k) {
                chmax(dp[i][da.start + da.len], dp[i - 1][k] + da.v);
            }
        }
    }

    cout << *max_element(dp[L], dp[L] + 45) << endl;
}

Measured memory_bytes: 1224
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner input = new Scanner(System.in);
		float n = input.nextFloat();
		 
		System.out.println(Math.PI * 2 *n);
	}
}


Measured memory_bytes: 37420
using System;
using System.Text;
class Program {
  static void Main(string[] args) {
    
    StringBuilder sb = new StringBuilder();
    sb.Append(Console.ReadLine());
    sb.Append("***");
    string S = sb.ToString();
    int N = S.Length - 3;

    string[] A = new string[2] {"dream","erase" };
    int pos = 0;
    bool ok = true;
    while (pos < N) {
      int a = S[pos] == 'd' ? 0 : 1;

      int i = 0;
      while (i < 5 && S[pos + i] == A[a][i]) ++i;

      if (i != 5) {
        ok = false;
        break;
      }

      pos += 5;
      if (a == 0 && S[pos] == 'e' && S[pos+1] == 'r' && S[pos+2] != 'a') {
        pos += 2;
      } else
      if (a == 1 && S[pos] == 'r') {
        ++pos;
      }
    }

    if (ok) {
      Console.WriteLine("YES");
    } else {
      Console.WriteLine("NO");
    } 
  }  
}


Measured memory_bytes: 13220
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b,c;
    char d,e;
    cin>>a>>d>>b>>e>>c;
    if(b>=5){
        cout<<"TBD"<<endl;
    }
    else{
        cout<<"Heisei"<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int N; cin>>N;
  double ans = 0.5;
  if(N%2 != 0) {
    ans = (N/2+1)/(double)N;
  }
  printf("%0.8f\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    string s[2];rep(i,0,1)cin>>s[i];
    rep(i,0,s[0].size()-1){
        if(s[0][i]==s[1][i]){
            
        }else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    
    return 0;
}




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

long long gcd(long long x, long long y) {
    if(y == 0) return x;
    return gcd(y,x%y);
}

long long lcm(long long x, long long y) {
    if(x == 0 || y == 0) return 0;
    return x / gcd(x,y) * y;
}

int main(){
    int n;
    cin >> n;
    int a;
    vector<bool> d(1000000001);
    for(int i = 0; i < n; i++){
        cin >> a;
        d[a] = !d[a];
    }
    int cnt = 0;
    for(int i = 0; i < 1000000001; i++){
        if(d[i]) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 122368
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <string>
using namespace std;

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

  vector<int> heights;
  vector<vector<int>> paths(n);

  for (int i = 0; i < n; i++) {
    int h;
    cin >> h;
    heights.push_back(h);
  }

  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;

    paths[a - 1].push_back(b - 1);
    paths[b - 1].push_back(a - 1);
  }

  int count = 0;
  for (int i = 0;i < n; i++) {
    int l = paths[i].size();
    int height = heights[i];
    bool flag = true;
    for (int j = 0; j < l; j++) {
      if (height <= heights[paths[i][j]]) { flag = false; break; }
    }

    if (flag) count++;
  }

  cout << count << endl;
}

Measured memory_bytes: 8748
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>

int main()
{
    long n;
    std::cin >> n;
    std::vector<long> a;
    for (int i = 0; i < n; i++) {
        long b;
        std::cin >> b;
        a.push_back(b);
    }
    std::sort(a.begin(), a.end());
    std::cout << a[n - 1] << " ";
    long ans = a[0];
    double cnt = a[n - 1] / 2.0;
    for (auto c : a) {
        if ((cnt > c ? cnt - c : c - cnt) < (cnt > ans ? cnt - ans : ans - cnt)) {
            ans = c;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 2032
#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector<int>v1;
    int a,b,i,j,k,l,m,n,ans=0;
    cin >> n >> m;
    int h[n];
    vector<bool>c;
    c.assign(n,0);
    for(i=0; i<n; i++)
    {
        cin >> h[i];
    }
    for(i=0; i<m; i++)
    {
        cin >> a >> b;
        a--;
        b--;
        if(h[a]<h[b])
        {
            c[a]=1;
        }
        else if(h[a]>h[b])
        {
            c[b]=1;
        }
        else
        {
            c[a]=c[b]=1;
        }
    }
    for(i=0; i<n; i++)
    {
        if(c[i]==0)
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4032
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    char b; cin>>b;
    if(b =='A') cout<<'T'<<endl;
    if(b =='T') cout<<'A'<<endl;
    if(b =='C') cout<<'G'<<endl;
    if(b =='G') cout<<'C'<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
   
class Main {
    static int[] aArrays = new int[20];
    static int gIndex = 0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            aArrays[i] = sc.nextInt();
            gIndex++;
        }
        int q = sc.nextInt();
        int[] mArrays = new int[200];
        int index = 0;
        for (int i = 0; i < q; i++) {
            mArrays[i] = sc.nextInt();
            index++;
        }
           
        for (int i = 0; i < index; i++) {
            if (isMatch(0, 0, mArrays[i])) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        }
           
    }
       
    public static boolean isMatch(int j, int S, int T) {
            if (S == T) {
                return true;
            }
            for (int i = j; i < gIndex; i++) {
                if (isMatch(i + 1, S + aArrays[i], T)) {
                    return true;
                }
            }
            return false;
        }
}


Measured memory_bytes: 26832
/*痛みを受け取れ，痛みを知れ*/
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 6e5 + 5;

int main()
{
	//freopen("in.txt", "r", stdin);
	int a, b, c;
	while (cin >> a >> b >> c)
	{
		int t = (int)ceil(a*1.0 / b);
		cout << t * c << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define pr std::pair<ll,ll>
#define fir first
#define sec second
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
ll mid;
std::vector<pr>f[131113];
int ls[131113],lw[131113],rs[131113],rw[131113];
void Merge(int A,int B,std::vector<pr>&F){
	int i=0;
	for(pr _:f[A]){
		ll a=_.fir,b=_.sec;
		while(i<f[B].size()-1&&b+f[B][i+1].fir<=mid)++i;
		if(i<f[B].size()&&b+f[B][i].fir<=mid){
			ll d=f[B][i].sec;
			F.emplace_back(a,d);
			F.emplace_back(d,a);
		}
	}
}
void dfs(int x){
	f[x].clear();
	if(!ls[x]){f[x].emplace_back(0,0);return;}
	dfs(ls[x]),dfs(rs[x]);
	if(f[ls[x]].size()>f[rs[x]].size())std::swap(ls[x],rs[x]),std::swap(lw[x],rw[x]);
	for(pr&i:f[ls[x]])i.fir+=lw[x],i.sec+=lw[x];
	for(pr&i:f[rs[x]])i.fir+=rw[x],i.sec+=rw[x];
	Merge(ls[x],rs[x],f[x]);
	std::sort(f[x].begin(),f[x].end());
	pr lst(-1,9e18);
	for(pr&i:f[x])
		if(i.sec>=lst.sec)i.fir=9e18;
		else lst=i;
	std::sort(f[x].begin(),f[x].end());
	while(!f[x].empty()&&f[x].back().fir==9e18)f[x].pop_back();
}
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi();
	for(int i=2;i<=n;++i){
		int fa=gi(),w=gi();
		if(ls[fa])rs[fa]=i,rw[fa]=w;
		else ls[fa]=i,lw[fa]=w;
	}
	ll l=0,r=n*131072ll;
	while(l<r){
		mid=(l+r)>>1;
		dfs(1);
		if(!f[1].empty())r=mid;
		else l=mid+1;
	}
	printf("%lld\n",l);
	return 0;
}


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

int main(){

    int H, W;
    int a[500][500];
    cin >> H >> W;
    for( int i = 0; i < H; i++ ){
        for( int j = 0; j < W; j++){
            cin >> a[i][j];
        }
    } 


    vector<int> record;
    for( int i = 0; i < H; i++ ){
        for( int j = 0; j < W; j++){
            if( i != H-1 || j != W-1 ){
                if( a[i][j] % 2 != 0 && j == W-1 ){
                    a[i][j]--;
                    a[i+1][j]++;
                    record.push_back( i );
                    record.push_back( j );
                    record.push_back( i+1 );
                    record.push_back( j );
                }else if( a[i][j] % 2 != 0 ){
                    a[i][j]--;
                    a[i][j+1]++;
                    record.push_back( i );
                    record.push_back( j );
                    record.push_back( i );
                    record.push_back( j+1 );
                }
            }
        }
    }

    cout << record.size()/4 << endl;
    for( int i = 0; i < record.size()/4; i++ ){
        for( int j = 0; j < 4; j++ ){
            if( j == 3 ) cout << record[i*4+j] + 1 << endl;
            else cout << record[i*4+j] + 1 << " ";
        }
    }

    return 0;

}

Measured memory_bytes: 5104