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

#define MAX 100000008
double dp[MAX][2];

int main() {
	int n,m,k;
	while(1){
		cin >> n >> m >> k;
		if(n==0) break;
		for(int i=0;i<n*m+5;i++) dp[i][0] = 0;
		for(int i=0;i<m;i++)
			dp[i][0]=1/(double)m;
		for(int i=1;i<n;i++)
		{
			for(int j=0;j<n*m;j++)
				dp[j][i%2]=0;
//			for(int j=i-1;j<m*(i-1);j++)
			for(int j=0;j<m*n;j++)
				for(int k=0;k<m;k++)
				{
					dp[j+k+1][i%2]+=dp[j][(i+1)%2]/m;
					//cout << dp[j+k+1][i%2] << endl;
				}
		}
		double ans=0;
		for(int i=0;i<n*m;i++)
		{
			if((i+1-k)<=0)
				ans+=1*dp[i][(n+1)%2];
			else
				ans+=(i+1-k)*dp[i][(n+1)%2];
		}
		cout << fixed << setprecision(10) << ans << endl;
	}
}


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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll n;
  cin >> n;

  cout << (n % 2 == 0 ? n : n * 2) << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define IOS cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define pb push_back
//odd day , even month
using namespace std;
long double arr[301][301][301];
long double fun(long double n,ll a, ll b, ll c){
	if(a<0||b<0||c<0){
		return 0;
	}
	if(a==0&&b==0&&c==0)
	return 0;
	if(arr[a][b][c]!=0){
		return arr[a][b][c];
	}else {
		arr[a][b][c]=(n/(a+b+c)) + (a*fun(n,a-1,b,c)+b*fun(n,a+1,b-1,c)+c*fun(n,a,b+1,c-1))/(a+b+c);
		return arr[a][b][c];
	}
}
int main() {
	IOS;
	ll n,a=0,b=0,c=0,x;
	cin>>n;
	for(int i=0; i<n; i++) {
		cin>>x;
		if(x==1)
			a++;
		else if(x==2)
			b++;
		else
			c++;
	}
	
	arr[1][0][0]=n;
	arr[0][1][0]=2*n;
	arr[0][0][1]=3*n;
	long double ans =fun(n,a,b,c);
	printf("%0.10Lf",ans);


}

Measured memory_bytes: 426368
// Submitted By Subhash Yadav
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) throws IOException {

		FastScanner sc = new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt();
		boolean ok=false;
		int a[][]=new int[n][2];
		for(int i=0;i<n;i++) {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		}

		System.out.println(ok?"Yes":"No");
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

}

Measured memory_bytes: 32888
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define itrep(it,v) for(auto it=(v).begin();it!=(v).end();it++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
using namespace std;

            
signed main(){
    string s;
    int a;
    cin>>s>>a;
    int b=s[0]-'0';
    for(int i=1;i<s.length();i+=2){
        if(s[i]=='+')b=b+(s[i+1]-'0');
        else b=b*(s[i+1]-'0');
    }
    stack<int> st;
    st.push(s[0]-'0');
    for(int i=1;i<s.length();i+=2){
        if(s[i]=='+')st.push(s[i+1]-'0');
        else{
            int t=st.top();
            st.pop();
            st.push(t*(s[i+1]-'0'));
        }
    }
    int c=0;
    while(!st.empty()){
        c+=st.top();
        st.pop();
    }
    if(b==a&&c==a)cout<<"U"<<endl;
    else if(b==a)cout<<"L"<<endl;
    else if(c==a)cout<<"M"<<endl;
    else cout<<"I"<<endl;
    return 0;
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>

#define IO std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);

#define MOD 1000000007
#define ull unsigned long long int
#define ll  long long int
#define MAX 100005

using namespace std;
using namespace __gnu_pbds;

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




int main() {

    IO
    //freopen("entrada.txt", "r", stdin);


    int n;
    cin >> n;
    ll cont=0;

    for (int x = 1; x <= n; x++) {
        if (x % 3 != 0 && x % 5 != 0)
            cont+=x;
    }

    cout << cont << "\n";

    return 0;
}


Measured memory_bytes: 3688
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int s[1010], p[1010], q[1010], r[1010];

int main()
{
	int n;
	int P, Q, R, C;
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> s[i] >> p[i] >> q[i] >> r[i];
		}
		cin >> P >> Q >> R >> C;

		int cnt = 0;
		for (int i = 0; i < n; i++) {
			int c = p[i] * 4 + q[i] * 9 + r[i] * 4;
			if (p[i] > P || q[i] > Q || r[i] > R || c > C) {
				cnt++;
				continue;
			}
			cout << s[i] << endl;
		}
		if (cnt == n)
			cout << "NA" << endl;
	}
	return 0;
}

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

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

    long long k = 100;
    long long ans = 1;
    while(1) {
        k += (k/100);
        if (k >= x) {
            cout << ans << endl;
            break;
        }
        ans++;
    }
}

Measured memory_bytes: 3596
@n = gets.to_i
@d = gets.split.map(&:to_i)

@memo = Array.new(24)
@memo[0] = 1
def calc(i)
    if i == @n
        a = -24
        x = 24
        @memo.each_with_index do |e, j|
            next if !e
            x = [x, j - a].min
            a = j
        end
        [x, 24 - a].min
    else
        x = []
        y = @d[i]
        if !@memo[y]
            @memo[y] = 1
            x << calc(i+1)
            @memo[y] = nil
        end

        y = 24 - y
        if !@memo[y]
            @memo[y] = 1
            x << calc(i+1)
            @memo[y] = nil
        end

        x.empty? ? 0 : x.max
    end
end

p calc(0)

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

const int INF = 100100100;

int main(){
	int n,m,x;
	cin >> n >> m >> x;
	vector<int> c(n);
	vector<vector<int>> a(12,vector<int>(12));
	rep(i,n){
		cin >> c[i];
		rep(j,m) cin >> a[i][j];
	}
	int ans = INF;
	rep(is,1<<n){
		int cost = 0;
		vector<int> d(m);
		rep(i,n){
			if(is>>i&1){
				cost += c[i];
				rep(j,m) d[j] += a[i][j];
			}
		}
		bool ok = true;
		rep(j,m) if(d[j] < x) ok = false;
		if(ok) ans = min(ans,cost);
	}
	if(ans == INF) cout << -1 << endl;
	else cout << ans << endl;
}

Measured memory_bytes: 3636
function circle(part) {
  var
  m = part.length, i, j,
  part2 = [];
  
  for (i = 0; i < m; i++) part2[i] = [];
  
  for (i = 0; i < m; i++) {
    for (j = 0; j < m; j++) {
      part2[i][m - j - 1] = part[j][i];
    }
  }
  
  return part2;
}

function main() {
  var
  image, part, parts,
  checkFlag,
  DUMMY = 1000000,
  i, j, x, y, ax, ay, h, k, l, n, m, line;
  for (;;) {
    // 入力の処理
    line = input.shift().split(/\s+/).map(parseFloat);
    n = line[0]; m = line[1];
    if (n === 0 && m === 0) break;
    image = [];
    for (i = 0; i < n; i++) image.push(input.shift().split(/ +/).map(parseFloat));
    part = [];
    for (i = 0; i < m; i++) part.push(input.shift().split(/ +/).map(parseFloat));
    parts = [];
    for (i = 0; i < 4; i++, part = circle(part)) parts.push(part);
    
    // 全探索
    ax = ay = DUMMY;
    search:
    for (h = 0; h < 4; h++) {
      for (i = 0; i < n - m + 1; i++) {
        for (j = 0; j < n - m + 1; j++) {
          checkFlag = true;
          x = y = DUMMY;
          check:
          for (k = 0; k < m; k++) {
            for (l = 0; l < m; l++) {
              if (parts[h][k][l] === -1) continue;
              if (parts[h][k][l] !== image[i + k][j + l]) {
                checkFlag = false;
                break check;
              }
              if (x === DUMMY && y === DUMMY) {
                x = j + l + 1;
                y = i + k + 1;
              }
            }
          }
          
          if (checkFlag) {
            if (y < ay) {
              ay = y;
              ax = x;
            }
            if (y === ay && x < ax) {
              ax = x;
            }
          }
        }
      }
    }
    
    if (ax !== DUMMY && ay !== DUMMY) {
      console.log(ax + ' ' + ay);
    } else {
      console.log('NA');
    }
  }
}

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

Measured memory_bytes: 13920
#include <iostream>
#include <iomanip>
#include <string>
#include <limits.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <cstdlib>
#include <typeinfo>

using namespace std;

int main(int argc, char* argv[]){
  int h,w,count=0, i, j, k;
  int c[10][10];
  int a;
  cin >> h >> w;
  for(i=0; i<10; i++){
    for(j=0; j<10; j++){
      cin >> c[i][j];
    }
  }
  for(k=0; k<10; k++){
    for(i=0; i<10; i++){
      for(j=0; j<10; j++){
        if(c[i][j] > c[i][k] + c[k][j]){
          c[i][j] = c[i][k] + c[k][j];
        }
      }
    }
  }
  for(i=0; i<h; i++){
    for(j=0; j<w; j++){
      cin >> a;
      if(a != -1){
        count += c[a][1];
      }
    }
  } 

  cout << count << endl;;

  return 0;
}


Measured memory_bytes: 256
import sys

def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

N = [0] + LI2()
n = len(N)

dp1 = [0]*(n)
dp2 = [0]*(n)

# Nを N_1N_2…N_(n-1) と表す
# またf(a)をa円払うときの自分と店員が使う紙幣の枚数の和の最小値とする
# このとき、f(N_1…N_k) = min(f(N_1…N_(k-1))+N_k,f(N_1…(N_(k-1)+1))+10-N_k) が成立する
# ここで、dp1[i] = f(N_1…N_i),dp2[i] = f(N_1…(N_i+1)) と定めdpする

for i in range(n):
    if i == 0:
        dp2[i] = 1
    else:
        dp1[i] = min(dp1[i-1]+N[i],dp2[i-1]+10-N[i])
        dp2[i] = min(dp1[i-1]+N[i]+1,dp2[i-1]+9-N[i])

print(dp1[n-1])

Measured memory_bytes: 123560
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int x;
	rep(i,0,5){
		cin >> x;
		if(x == 0){
			cout << i + 1 << '\n';
			return 0;
		}
	}
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int r;
    cin >> r;
    cout << r*r << endl;



}


Measured memory_bytes: 256
S = input()

if S == 'SUN':
    print(7)
elif S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
elif S == 'SAT':
    print(1)


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

int main() {
    int k;
    int ans = 1;
    cin >> k;
    if (k % 2 == 0) {
        cout << -1 << endl;
        return 0;
    }
    else {
    //modkで考える
        int x = 7 % k;
        for (int i=0; i<k; i++) {
            if (x != 0) {
                x = (x * 10 + 7) % k;
                ans++;
            }
            else {
                cout << ans << endl;
                return 0;
            }
        }
        cout << -1 << endl;
        return 0;
    }
}

Measured memory_bytes: 3640
#include <stdlib.h>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  uint16_t r, D;
  uint64_t X;
  cin >> r >> D >> X;

  for (uint16_t i = 0; i < 10; ++i) {
    X = X * r - D;
    cout << X << endl;
  }

  return 0;
}


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

int main(){
  string s;
  string tmp,tmp2;
  cin >>s;
  int64_t ans=0,a=s.size();
  for(int64_t bit=0;bit<(1<<a-1);bit++){
    tmp="";
    for(int64_t j=0;j<a-1;j++){
      tmp+=s.at(j);
      if(bit>>j&1){
        tmp+="+";
      }
    }
    tmp+=s.at(a-1);
    tmp2="";
    for(int64_t i=0;i<tmp.size();i++){
      if(tmp.at(i)!='+'){
      	tmp2+=tmp.at(i);
      }
      else{
        ans+=stol(tmp2);
        tmp2="";
      }
      if(i==tmp.size()-1&&tmp2!="")
        ans+=stol(tmp2);
    }
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    A, B, K = map(int, readline().split())

    for i in range(K):
        if i % 2 == 0:
            if A % 2 == 1:
                A -= 1
            B += A // 2
            A //= 2
        else:
            if B % 2 == 1:
                B -= 1
            A += B // 2
            B //= 2
    print(A, B)


if __name__ == '__main__':
    main()


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    ll N,K; cin >> N >> K;
    vector<ll> A(N), B(N);
    ll mx=0;
    REP(i,N){
        cin >> A[i];
        B[i] = A[i];
        chmax(mx, abs(A[i]));
    }

    SORT(A);
    SORT(B); REVERSE(B);

    ll ans = 0;
    ll xl=-mx*mx, xr=-xl, X=(xl+xr)/2;
    while(xr-xl>1){
        ll tmp = 0;
        REP(i,N-1){
            ll l=-1, r=N, n=(l+r)/2;
            
            if(A[i] < 0){
                while(r-l>1){
                    if(A[i]*B[n] <= X) l = n;
                    else r = n;
                    n = (l+r)/2;
                }
            }
            else{
                while(r-l>1){
                    if(A[i]*A[n] <= X) l = n;
                    else r = n;
                    n = (l+r)/2;
                }
            }
            if(A[i] >= 0) tmp += max((ll)0,r-i-1);
            else tmp += min(N-i-1,r);
        }

        if(tmp < K) xl = X;
        else xr = X;
        X = (xl+xr)/2;
    }
    ans = xr;

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
import copy

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

ans = 0

for l in range(0,n+1):
    for r in range(0,n+1):
        if l+r > n or l+r > k or l+r==0:
            continue
        vc = copy.deepcopy(v)
        have = []
        ll = copy.deepcopy(l)
        rr = copy.deepcopy(r)
        while ll:
            tmp = vc.pop(0)
            have.append(tmp)
            ll -= 1
        while rr:
            tmp = vc.pop(-1)
            have.append(tmp)
            rr -= 1
        have.sort()
        kk = copy.deepcopy(k)
        while have[0] < 0 and kk-(l+r) > 0:
            tmp = have.pop(0)
            kk -= 1
            if not have:
                break
        ans = max(ans, sum(have))
print(ans)

Measured memory_bytes: 75788
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll n;
  cin >> n;
  vector<int> ans;
  while (n != 0) {
    int s;
    s = ((n % 2) + 2) % 2;
    debug(s);
    ans.emplace_back(s);
    n = (n-s)/(-2);
  }
  reverse(all(ans));
  rep(i,(int)ans.size()) cout << ans[i];
  if (ans.size() == 0) cout << 0;
  cout << endl;
  return 0;
}

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

int main(){
  ll N,M,K;
  cin >> N >> M >> K;
  vector<ll> A(N),B(M);
  for(ll i=0;i<N;i++){
    cin >> A[i];
  }
  for(ll i=0;i<M;i++){
    cin >> B[i];
  }
  ll sum=0;
  ll Anum=-1,Bnum=-1;
  for(ll i=0;i<N;i++){
    if(sum+A[i]>K){
      break;
    }
    sum+=A[i];
    Anum=i;
  }
  for(ll i=0;i<M;i++){
    if(sum+B[i]>K){
      break;
    }
    sum+=B[i];
    Bnum=i;
  }
  if(Anum+1==N && Bnum+1==M){
    cout << N+M << endl;
    return 0;
  }
  ll ans=Anum+Bnum+2;
  while(Anum!=-1){
    sum-=A[Anum];
    --Anum;
    for(ll i=Bnum+1;i<M;i++){
      if(sum+B[i]>K){
      break;
      }
      sum+=B[i];
      Bnum=i;
    }
    ans=max(ans,Anum+Bnum+2);
  }
  cout << ans << endl;
}

Measured memory_bytes: 6408
import java.util.Scanner;
import java.lang.Character;

public class Main {
    public static void main (String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            String s = sc.next();
            String res = "";
            char ch;            

            for (int i = 0; i < n; i++) {
                if (i == k - 1) {
                    ch = Character.toLowerCase(s.charAt(i));                
                }            
                else {
                    ch = s.charAt(i);
                }
                res += "" + ch;
            }
            System.out.println(res);
        }           
    }
}

Measured memory_bytes: 21204
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

l = inputIL()
l.sort()

if l == [5,5,7]:
  print("YES")
else:
  print("NO")


Measured memory_bytes: 63980
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define pb(v) push_back(v)
#define mp(x, y) make_pair(x, y)
#define fi first
#define se second
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using P = pair<int ,int>;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int k; cin >> k;
    ll ans = 0;
    FOR(i, 1, k+1) FOR(j, 1, k+1) FOR(l, 1, k+1) {
        ans += gcd(gcd(i, j), l);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3608
n = gets.to_i
coins = gets.split.map(&:to_f)
dp = Array.new(n+1){Array.new(n+1, 0.0)}
dp[0][0] = 1.0
coins.each.with_index(1) do |p, i|
  dp_cur, dp_prev = dp[i], dp[i-1] # TLE対策
  (0..i).each do |j|
    dp_cur[j] += dp_prev[j-1] * p if j > 0
    dp_cur[j] += dp_prev[j] * (1 - p)
  end
end
puts dp[n][(n+1)/2..-1].inject(:+)


Measured memory_bytes: 198652
#include<iostream>
#include<queue>
#include<string>
using namespace std;
struct node{
	string name;
	int time;
};
int main(){
	int n,q;
	cin>>n>>q;
	node now;
	queue<node> queue;
	for(int i=0;i<n;i++){
		cin>>now.name>>now.time;
		queue.push(now);
	}
	int elaps=0,c;
	while(!queue.empty()){
		node p=queue.front();
		queue.pop();
		c=min(q,p.time);
		p.time-=c;
		elaps+=c;
		if(p.time>0){
			queue.push(p);
		}else{
			cout<<p.name<<" "<<elaps<<endl;
		}
	}
	return 0;
} 


Measured memory_bytes: 6312
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nxy = readln.split.to!(int[]);
    auto N = nxy[0];
    auto X = nxy[1]-1;
    auto Y = nxy[2]-1;

    auto G = new int[][](N, N);
    auto memo = new int[](N);
    void run(int i, int p, int n) {
        if (memo[i] < n) return;
        if (memo[i] < N) G[i][memo[i]] -= 1;
        memo[i] = n;
        G[i][n] += 1;
        if (i > 0 && p != i-1) run(i-1, i, n+1);
        if (i < N-1 && p != i+1) run(i+1, i, n+1);
        if (i == X && p != Y) run(Y, i, n+1);
        if (i == Y && p != X) run(X, i, n+1);
    }
    foreach (i; 0..N) {
        memo[] = int.max;
        run(i, -1, 0);
    }
    auto rr = new int[](N);
    foreach (i; 0..N) {
        foreach (j; 1..N) {
            rr[j] += G[i][j];
        }
    }
    foreach (r; rr[1..$]) writeln(r/2);
}

Measured memory_bytes: 18556
#include <stdio.h>

int main (void)
{
    long long N,a[5];
    int i;
    scanf("%lld %lld %lld %lld %lld %lld",&N,&a[0],&a[1],&a[2],&a[3],&a[4]);
    long long min = a[0];
    for (i = 1; i < 5; i ++)    {
        if(min > a[i]) min = a[i];
    }
    printf("%lld",(N+min-1)/min+4);
    return 0;
}

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

// 各桁の和を計算する関数
int Digits(int n, int i) {
  int ans = 0;
  int j = 0;
  do{
    ans = n % 10;
    n /= 10;
    j++;
  } while (j == i);
  
 return ans;
  }
 


int main(){
int a,b;
cin >> a >> b;
int count = 0;

for (int i = a; i <= b; i++)
{
  string num = to_string(i);
  if (num.at(0) == num.at(4) && num.at(1) == num.at(3))
  {
    count++;
  }
  
}



cout << count << endl;



}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {


		String s = nextString();
		int[] alph = new int[]{0,0,0};

		for(int i=0;i<s.length();i++){
			alph['c'-s.charAt(i)]++;
		}
		String ans = "NO";
		Arrays.sort(alph);
		if(Math.abs(alph[0]-alph[1])<=1 && Math.abs(alph[0]-alph[2])<=1&&Math.abs(alph[1]-alph[2])<=1){
			ans="YES";
		}
		System.out.println(ans);
	}



	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 23508
#include<stdio.h>
int main(void)
{
    int h=0,m=0,s=0,z;
	scanf("%d",&z);
	m=z/60;
	s=z%60;
	h=m/60;
	m=m%60;
	
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

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

using namespace std;
using ll = long long;
#define rep(i,n) for (int i = 0; i < (int)n; i++)

int main(){
  string s,t;
  cin >> s >> t;

  int a,b;
  cin >> a >> b;

  string u;
  cin >> u;
  if (u == s) a--;
  else if (u == t) b--;

  cout << a << " " << b << endl;
}


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

vector<vector<int>> g;
vector<int> o;
map<int, int> ad;
vector<ll> c;

int main(){
	string s, t;
	cin >> s >> t;
	vector<vector<ll>> a(26, vector<ll>(0));
	rep(i, s.size()){
		a.at(s.at(i) - 'a').push_back(i);
	}
	rep(i, 26) a.at(i).push_back(1000000);
	ll k = -1;
	ll km = 0;
	ll ans = 0;
	string test = "";
	test += s.at(0);
	rep(i, t.size()){
		if(a.at(t.at(i) - 'a').at(0) == 1000000){
				cout << -1 << endl;
				return 0;
		}
	}
	rep(i, t.size()){
		km = k;
		k++;
		ll l = lower_bound(a.at(t.at(i) - 'a').begin(), a.at(t.at(i) - 'a').end(), k) - a.at(t.at(i) - 'a').begin();
		if(a.at(t.at(i) - 'a').at(l) != 1000000){
			k = a.at(t.at(i) - 'a').at(l);
			ans += k-km;
//			test += s.substr(km, k);
		}else{
			k = 0;
			ll l = lower_bound(a.at(t.at(i) - 'a').begin(), a.at(t.at(i) - 'a').end(), k) - a.at(t.at(i) - 'a').begin();
			k = a.at(t.at(i) - 'a').at(l);
			ans += s.size() - (km+1);
			ans += k+1;
//			test += s.substr(km);
//			test += s.substr(0, k);
		}
//		cout << ans << endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1724
import itertools

def calc(p1, p2):
  tmp = (p1[0] - p2[0])**2 + (p1[1] - p2[1])**2
  return tmp ** 0.5

n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]

dists = [[0 for _ in range(n)] for _ in range(n)]
for row in range(n):
  for col in range(n):
    dists[row][col] = calc(p[row], p[col])

count = 0
dist_sum = 0
for v in itertools.permutations(range(n), n):
  for i in range(len(v)-1):
    dist_sum += dists[v[i]][v[i+1]]
  count += 1

print(dist_sum/count)

Measured memory_bytes: 9368
# include<bits/stdc++.h>
using namespace std;
const int maxn=55;

int h,w;
char data[maxn][maxn];
int go[8][2]={1,0,-1,0,0,1,0,-1,-1,-1,1,-1,-1,1,1,1};

int main ()
{
    while(~scanf("%d%d", &h, &w)){
        for(int i=1;i<=h;i++){
            scanf("%s", data[i]+1);
        }
        for(int i=1;i<=h;i++){
            for(int j=1;j<=w;j++){
                if(data[i][j]=='.'){
                    data[i][j]='0';
                    for(int k=0;k<8;k++){
                        if(data[i+go[k][0]][j+go[k][1]]=='#')data[i][j]++;
                    }
                }
            }
        }
        for(int i=1;i<=h;i++){
            printf("%s\n", data[i]+1);
        }
    }
    return 0;
}


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

int main() {
  int N, total = 0;
  cin >> N;

  // ここにプログラムを追記
  for (int i = 0; i < N; i++) {
    int st, ed;
    cin >> st >> ed;
    total += (ed - st + 1);
  }
  cout << total << endl;
}

Measured memory_bytes: 256
import math
def eratosthenes(n):
    prime_list = []
    num_list=[i for i in range(2, n+1)]
    limit = math.sqrt(n)
    while True:
        if limit <= num_list[0]:
            return prime_list + num_list
        prime_list.append(num_list[0])
        num_list = [e for e in num_list if e % num_list[0] != 0]

ls = eratosthenes(100000)
ls2 = []
count = [0 for i in range(100000)]
j = 0
for i in range(ls[-1]):
    if i == ls[j]:
        j += 1
        if (i+1)//2 in ls:
            count[i] = 1
            
            
for i in range(1,len(count)):
    count[i]  = count[i]+count[i-1]
    
Q = int(input())
for i in range(Q):
    l, r = map(int, input().split())
    print(count[r]-count[l-1])

Measured memory_bytes: 13256
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

ll a,k,mod = 1e9+7;
vec<ll> m;



int main() {
    fast;
    cin>>a>>k;
    m = vec<ll>(a);
    for(int q=0; q<a; q++) cin>>m[q];
    sort(m.begin(), m.end());
    vec<vec<ll>> dp(a, vec<ll>(k+1)), ps(a, vec<ll>(k+1));
    for(int q=0; q<=m[0]; q++) dp[0][q] = 1;
    for(int q=0; q<=k; q++) ps[0][q] = dp[0][q] + (q ? ps[0][q-1] : 0);
    for(int q=1; q<a; q++){
        for(int w=0; w<=k; w++){
            dp[q][w] = mod + ps[q-1][w] - (w-m[q]-1<0 ? 0 : ps[q-1][w-m[q]-1]);
            dp[q][w]%=mod;
        }
        for(int w=0; w<=k; w++){
            ps[q][w] = dp[q][w] + (w ? ps[q][w-1] : 0);
            ps[q][w] %= mod;
        }
    }
    cout<<dp[a-1][k];
}

Measured memory_bytes: 157552
import itertools

N = int(input())
towns = [i for i in range(N)]

coordinates = {}
for i in range(N):
    tmp = list(map(int, input().split()))
    coordinates[i] = tmp

paths = list(itertools.permutations(towns, N))
distance = 0

for i in range(len(paths)):
    for j in range(N - 1):  # 街j, j+1の距離を加えていく
        town_now = paths[i][j]
        town_next = paths[i][j+1]
        distance += ((coordinates[town_now][0] - coordinates[town_next][0]) ** 2 +
                     (coordinates[town_now][1] - coordinates[town_next][1]) ** 2) ** (1/2)

avg_distance = distance / (len(paths))
print(avg_distance)


Measured memory_bytes: 81116
import math

def combinations_count(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,k = map(int,input().split())
mod = 10**9 + 7

for i in range(1,k+1):
	if n-k+1 < i:
		print(0)
		continue
	ans = combinations_count(n-k+1,i) % mod
	ans *= combinations_count(k-1,i-1) % mod
	print(ans%mod)


Measured memory_bytes: 66264
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if (n <= 1) {
		    System.out.println(1);
		    return;
		}
		long prepre = 1;
		long pre = 1;
		for (int i = 2; i <= n; i++) {
		    long x = prepre + pre;
		    prepre = pre;
		    pre = x;
		}
		System.out.println(pre);
	}
	
}



Measured memory_bytes: 26180
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  string n;
  cin >> n;

  int c = 0;
  rep(i, 0, 3) {
    if (n.substr(i,1) == "1") c++;
  }
  pr(c);

  return 0;
}


Measured memory_bytes: 256
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
	int a, b, n;
	cin >> n >>a >>b;
	if(n==1) cout << "Hello World" << endl;
	else cout << a + b << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

class P
{
    static void Main()
    {
        Console.ReadLine();
        int[] ABC = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int status = 0;
        int last = 0;
        int res = 1;
        foreach (var item in ABC)
        {
            switch (status)
            {
                case 0:
                if (last != 0 && last != item)
                {
                    if (last > item) status = -1;
                    if (last < item) status = 1;
                }
                break;
                case 1:
                if (last > item)
                {
                    status = 0;
                    res++;
                }
                break;
                case -1:
                if (last < item)
                {
                    status = 0;
                    res++;
                }
                break;
            }
            last = item;
        }
        Console.WriteLine(res);
    }
}

Measured memory_bytes: 19680
#include <cstring>
#include <cstring>
#include <vector>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <set>
#include <cstring>
#include <unordered_set>
#include <algorithm>
using namespace std;
typedef long long ll;
const int INF = 1e9;

int arr[1000005];
int chk[1000005];

int func(int n)
{
	if (n % 2 == 0)return n / 2;
	else return 3 * n + 1;

}

int main()
{
	int s;
	cin >> s;
	arr[1] = s;
	for (int i = 2; i <= 1000000; i++)
		arr[i] = func(arr[i - 1]);
	for (int i = 1; i <= 1000000; i++) {
		if (chk[arr[i]]) {
			cout << i;
			return 0;
		}
		chk[arr[i]]++;
	}
		

}

Measured memory_bytes: 6016
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
const string YES = "Yes";
const string NO = "No";
void solve(long long N, long long M, long long K){
  map<ll,bool> can;
  for (int i = 0; i <= N; i++) {
    for (int l = 0; l <= M; l++) {
      ll x = (i*M)-(l*i)+(N-i)*l;
      can[x] = true;
    }
  }
  cout << (can[K]?YES:NO) << endl;
}

int main(){
    long long N;
	scanf("%lld",&N);
	long long M;
	scanf("%lld",&M);
	long long K;
	scanf("%lld",&K);
    solve(N, M, K);
}


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

int findSumOfDigits(int n) {
  int sum=0;
  while (n>0) {
    sum += n%10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N;
  cin >> N;
  int num=findSumOfDigits(N);
  if(N%num==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

using namespace std;

typedef long long ll;

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

	int a, b;
	cin >> a >> b;

	for(int i = 0; i <= 100000; i++){
		if(i * 8 / 100 == a && i * 10 / 100 == b){
			cout << i << endl;
			return 0;
		}
	}

	cout << -1 << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
int main(){
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll ans1, ans2;
    if(A % D == 0){
        ans1 = A / D;
    }
    else{
        ans1 = A / D + 1;
    }
    if(C % B == 0){
        ans2 = C / B;
    }
    else{
        ans2 = C / B + 1;
    }
    //cout << ans1 << ans2 << endl;
    if(ans1 >= ans2){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

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

int main()
{
	int a, b;

	scanf("%d%d", &a, &b);
	if (a < b) printf("a < b\n");
	else if (a > b) printf("a > b\n");
	else printf("a == b\n");
	return 0;
}

Measured memory_bytes: 580
#include <stdio.h>
#include <stdlib.h>
int main (){
int a,b,c,k;
 scanf ("%d%d%d",&a,&b,&c);
k= abs( b-c );
if (a<k){
printf ("%d",k-a);
}
  else{
  printf ("0");
  }
  return 0;
}

Measured memory_bytes: 128
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def print_ans(B):
    for b in B:
        b.sort(key=lambda l: int(l))
        print(" ".join(b))



def main():
    S = input().strip()
    T = input().strip()
    print("Yes" if S == T[:len(S)] else "No")


if __name__ == "__main__":
    main()



Measured memory_bytes: 9832
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    print(int(input())**2)
if __name__ == '__main__':
    main()

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll N=1e5+8;
const ll MOD=1e9+7;
const ll inf=1e18+6;
const ll M=2000;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(20);
    cout << fixed;
    string s;
    cin>>s;ll c=0;
    for(auto i: s)
    {
        if(i=='+') c++;
        else c--;
    }
    cout<<c;
}


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

int main() {
	int n; cin >> n; long double d; cin >> d; int cnt = 0; for (int i = 0; i < n; i ++) {
		long double x, y; cin >> x >> y; long double dist = sqrt(x*x+y*y); if (dist <= d) cnt++; 
	} cout << cnt << endl;
}

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

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

const int INF = 1e9 + 7;

using namespace std;

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

	int n, k;
	cin >> n >> k;

	vector<int> mp(200001, 0);
	rep (i, 0, n) {
		int tmp;
		cin >> tmp;
		mp[tmp]++;
	}

	sort(mp.begin(), mp.end(), greater<int>());
	int res = 0;
	rep (i, k, n) {
		res += mp[i];
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 1152
import java.util.Scanner;
class Main{

	public static void main(String[] args){
Scanner sc = new Scanner(System.in);

int t;
t = sc.nextInt();
int h;
int m;
int s;

h = t/3600;
m = (t-(h*3600))/60;
s = t-((h*3600)+(m*60));
System.out.println(h+":"+m+":"+s);
    }
}

Measured memory_bytes: 26276
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
typedef long long ll;
int comb2(int n){
  if(n<2){
    return 0;
  }else{
    return n*(n-1)/2;
  }
}
int main() {
  cout << fixed << setprecision(10);
  ll n;
  cin >> n ;
  vector<int> a(n);
  vector<int> p(n,0);
  rep(i,n){
    cin >> a.at(i);
    p.at(a.at(i)-1)++;
  }
  ll sum = 0;
  rep(i,n){
    ll r = p.at(i);
    sum+=r*(r-1)/2;
  }
  rep(i,n){
    ll r = p.at(a.at(i)-1);
    cout << sum-r*(r-1)/2+(r-1)*(r-2)/2 << endl;
  }
}


Measured memory_bytes: 4096
#include<iostream>
#include<string.h>


using namespace std;
 
int main(){
  string s;
  cin>>s;
  
  if(s == "ABC"){
  	cout<<"ARC"<<endl;
  	return 0;
  }
  if(s == "ARC"){
  	cout<<"ABC"<<endl;
  	return 0;
  }

  }

Measured memory_bytes: 3116
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
#define INF 1e10
using namespace std;
template<typename T> void cmin(T &a, T b) { a = min(a, b); }
template<typename T> void cmax(T &a, T b) { a = max(a, b); }

signed main() {
  vector<int> a(5);
  rep(i, 5) cin >> a[i];
  sort(all(a));

  int ans = INF;
  do {
    int tmp = 0;
    rep(i, 5) {
      if (tmp % 10 != 0) tmp += 10 - tmp % 10;
      tmp += a[i];
    }
    cmin(ans, tmp);
  } while (next_permutation(all(a)));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    string s;
    cin >> n >> s;
    int l = s.size();
    if(l<=n) {
        cout << s;
    }
    else {
      for(int i = 0; i < l-n; i++) {
        s.pop_back();
      }
        for(int i = 0; i < 3; i++) {
            s.push_back('.');
        }
        cout << s;
    }
}

Measured memory_bytes: 3632
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,x = li()
a = list(li())

mins = [ai for ai in a]
a = a+a

ans = 10**18
for k in range(n):
    for i in range(n,2*n):
        mins[i-n] = min(mins[i-n], a[i-k])
        
    ans = min(ans, sum(mins) + x*k)
    
print(ans)

Measured memory_bytes: 3188
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();

        int whole = H * W;
        int black = H * w + h * W - h * w; 
        int white = whole - black;
        
        System.out.println(white);
    }
}


Measured memory_bytes: 21844