akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

    int n = nextInt();
    int k = nextInt();
    int[] h = new int[n];

    for(int i=0;i<n;i++){
      h[i] = nextInt();
    }

    Arrays.sort(h);

    long ans = 0;

    for(int i=0;i<(n-k);i++){
      ans += h[i];
    }


    System.out.println(ans);

  }
  /*
    static String toSmall(String s){
      char c = s.charAt(0);
      //if(Character.isUpperCase(c)){
      if(c<=90){
        c += 32;
      }
      return String.valueOf(c);
    }
    static String toBig(String s){
      char c = s.charAt(0);
      //if(Character.isLowerCase(c)){
      if(c>=97){
        c -= 32;
      }
      return String.valueOf(c);
    }
  */

  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

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

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

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

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    string S;
    cin >> S;
    if(S.size() >= 4){
        if(S[0] == 'Y' && S[1] == 'A' && S[2] == 'K' && S[3] == 'I'){
            cout << "Yes" << endl;
            exit(0);
        }
    }
    cout << "No" << endl;
}

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

int main(){
  ll n,a,ans=1;
  vector<ll>x(3,-1);
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> a;
    ll count=0; 
    for(int j=0; j<3; j++){ 
      if(x[j]==a-1) count++;
    }
    if(x[0]==a-1)x[0]++;
    else if(x[0]!=a-1 && x[1]==a-1)x[1]++;
    else x[2]++;
    ans*=count;
    ans%=mod;
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 384
a,b,c=$<.map{|i|i.chomp.to_i}
g=3*c
puts [a,b,g-a-b].*(" ")
puts [-2*a-b-2*c+2*g,c,2*a+b+c-g].*(" ")
puts [a+b+2*c-g,g-b-c,g-a-c].*(" ")

Measured memory_bytes: 1788
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
         Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            int b = sc.nextInt();
            int x,y;
            x = a * b;
            y = 2*(a+b);
            System.out.println(x+" "+y);
           
}
}




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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    int n;
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    rep(i,n)
    {
        cin >> x[i];
        y[i] = x[i];
    }
    sort(y.begin(),y.end());
    int med = (y[n/2]+y[n/2-1])/2;
    rep(i,n)
    {
        if (x[i]<=med)
        {
            cout << y[n/2] << endl;
            continue;
        }
        if(x[i]>=med)
        {
            cout << y[n/2-1] << endl;
        }
    }

}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
//const ll MOD=998244353;

int main(){
  deque<char> deq;
  string S; cin>>S;
  int N=S.length();
  rep(i,N){
    deq.push_back(S[i]);
  }
  int Q; cin>>Q;
  int cnt=0;
  while(Q--){
    int x; cin>>x;
    if(x==1){
      cnt++;
      continue;
    }
    int F; cin>>F;
    char C; cin>>C;
    if(cnt%2){
      //反転
      if(F==1){
        deq.push_back(C);
      }else{
        deq.push_front(C);
      }
    }else{
      if(F==1){
        deq.push_front(C);
      }else{
        deq.push_back(C);
      }
    }
  }
  if(cnt%2) reverse(deq.begin(),deq.end());
  for(char c:deq) cout<<c;
  cout<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x ,n) for(int i = x; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    int ans = 111;
    rep(i,n){
        if(ans >= n){
            cout << ans;
            return 0;
        }
        ans +=111;
    }
}

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

#define T 100000
#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
  int n,t;
  int d[T+1], ans, now;
  
  cin >> n >> t;
  for (int i=0; i<=t; i++) d[i] = 0;
  for (int i=0; i<n; i++){
    int l,r;
    cin >> l >> r;
    d[l]++; d[r]--;
  }
  now = ans = d[0];
  for (int i=1; i<=t; i++){
    now += d[i];
    ans = MAX(ans, now);
  }
  cout << ans << endl;
    
  return 0;
}
  
  



Measured memory_bytes: 3484
#!/usr/bin/env python3
import sys
from math import log2

ROUND = 10 ** 5
LOG = 19#int(log2(ROUND))

def test():
    print(len(format(ROUND, "b")))

def main():
    #test()
    #return 


    S = input()
    #S = "R" * (10 ** 5 - 1) + "L"
    N = len(S)
    to = []
    for _ in range(LOG):
        l = [0] * N
        to.append(l)
    
    for i in range(N):
        to[0][i] = i + 1 if S[i] == "R" else i - 1
    
    for i in range(1, LOG):
        for j in range(N):
            to[i][j] = to[i - 1][to[i - 1][j]]

    ans = [0] * N
    for j in range(N):
        ans[to[LOG - 1][j]] += 1

    L = [str(i) for i in ans]
    print(" ".join(L))
    return


if __name__ == '__main__':
    main()

Measured memory_bytes: 29052
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


LL fpow(LL a, LL n, LL mod){
    LL x = 1;
    while(n > 0){
        if(n&1){
            x=x*a%mod;
        }
        a=a*a%mod;
        n >>= 1;
    }
    return x;
}


int main(){
    int n;cin >> n;
    map<vector<LL>, LL> ma;
    vector<LL> a(n),b(n);
    LL cnt = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        if(a[i] == 0 && b[i] == 0){
            cnt++;
            continue;
        }
        LL g = gcd(abs(a[i]), abs(b[i]));
        a[i] /= g, b[i] /= g;
        if((a[i] > 0 && b[i] > 0) || (a[i] < 0 && b[i] < 0)){
            auto e = vector<LL>({abs(a[i]), abs(b[i]), false});
            ma[e]++;
        }
        else if((a[i] < 0 && b[i] > 0) || (a[i] > 0 && b[i] < 0)){
            auto e = vector<LL>({abs(a[i]), abs(b[i]), true});
            ma[e]++;
        }
        else if(a[i] == 0){
            auto e = vector<LL>({0LL, 1LL, true});
            ma[e]++;
        }
        else if(b[i] == 0){
            auto e = vector<LL>({1LL, 0LL, true});
            ma[e]++;
        }
    }
    map<vector<LL>, bool> f;
    vector<P> v;
    for (int i = 0; i < n; i++) {
        if(a[i] == 0 && b[i] == 0) continue;
        vector<LL> e, re;
        if((a[i] > 0 && b[i] > 0) || (a[i] < 0 && b[i] < 0)){
            e = vector<LL>({abs(a[i]), abs(b[i]), false});
            re = vector<LL>({abs(b[i]), abs(a[i]), true});
        }
        else if((a[i] < 0 && b[i] > 0) || (a[i] > 0 && b[i] < 0)){
            e = vector<LL>({abs(a[i]), abs(b[i]), true});
            re = vector<LL>({abs(b[i]), abs(a[i]), false});
        }
        else if(a[i] == 0){
            e = vector<LL>({0LL, 1LL, true});
            re = vector<LL>({1LL, 0LL, true});
        }
        else if(b[i] == 0){
            e = vector<LL>({1LL, 0LL, true});
            re = vector<LL>({0LL, 1LL, true});
        }
        if(f[e] || f[re]) continue;
        f[e] = true, f[re] = true;
        LL s = ma[e];
        LL p = ma[re];
        v.pb(mp(s, p));
    }
    vector<LL> dp(v.size()+1,0);
    dp[0] = 1;
    LL sum = cnt;
    for (int i = 0; i < v.size(); i++) {
        sum += v[i].fs + v[i].sc;
        LL t1 = (fpow(2, v[i].fs, mod) - 1 + mod)%mod;
        LL t2 = (fpow(2, v[i].sc, mod) - 1 + mod)%mod;
        LL t = (t1 + t2 + 1)%mod;
        dp[i + 1] = dp[i] * t %mod;
    }
    assert(sum == n);
    cout << (dp[v.size()] - 1 + mod + cnt)%mod << endl;
    return 0;
}


Measured memory_bytes: 98280
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
long long arr[401];
int n;
long long dp[401][401];
long long f(int l,int r){
	if(l==r)return 0;
	long long &mi=dp[l][r];
	if(~mi)return mi;
	mi=1000000000000000000LL;
	for(int i=l;i<r;i++){
		mi=min(mi,f(l,i)+f(i+1,r)+arr[r]-arr[l-1]);
	}
	return mi;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	memset(dp,-1,sizeof dp);

	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>arr[i];
		arr[i]+=arr[i-1];
	}


		cout<<f(1,n)<<endl;

	return 0;
}

Measured memory_bytes: 1536
// 単一始点最短経路 ( ダイクストラ法 : 優先度付きキュー )
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

#include<queue>

using namespace std;

static const int MAX_N = 10000;
static const int INFTY = (1 <<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

class q_element
{
    public:
        // 各頂点のNo.と経路の値
        int vertex_num;
        int vertex_val;

        // コンストラクタ
        q_element(int a, int b)
        {
            vertex_num = a;
            vertex_val = b;
        };
};

// ">" のオーバーロード [ receive_val ] を基準に大小比較を行う
bool operator > (const q_element &q_element_1, const q_element &q_element_2)
{
    return q_element_1.vertex_val > q_element_2.vertex_val;
};

// q_elementクラスのオブジェクトを昇順にするためのキューの定義
std::priority_queue< q_element,
                     std::vector<q_element>,
                     std::greater<q_element> > pqEle;

// 隣接リストを作成する ( 頂点と重みの情報を格納する )
vector<q_element> v_Link[MAX_N + 1];

int n;

// ダイクストラ法を実施するメソッド( 優先度付きキュー )
int Dijkstra_priority_queue(int start_v);

int main(void)
{

    cin >> n;

    int k, c, u, v;
    q_element q_entity(0, 0);

    for(int i = 0; i < n; i++)
    {
        cin >> u >> k;

        for(int j = 0; j < k; j++)
        {
            cin >> v >> c;

            // 隣接リストの作成 ( 頂点と重みを設定する )
            q_entity.vertex_num = v;
            q_entity.vertex_val = c;

            v_Link[u].push_back(q_entity);
        }
    }

    // 優先度付きキューを用いたダイクストラ法
    Dijkstra_priority_queue(0);

    return 0;

}

// 優先度付きキューを用いたダイクストラ法を実施するメソッド
// start_v : スタートする頂点のNo.
int Dijkstra_priority_queue(int start_v)
{
    int u, v, minv;
    int d[MAX_N], p[MAX_N], color[MAX_N];

    for(int i = 0; i < n; i++)
    {
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }

    // 初期値の設定 ( 頂点 : 0 を開始点とする)
    d[start_v] = 0;
    color[start_v] = GRAY;
    // キューに要素を入れる
    pqEle.push( q_element(start_v, 0) );

    while( !pqEle.empty() )
    {

        // 最小の値を持つ頂点を取り出す ( キューの先頭 )
        u = pqEle.top().vertex_num;
        minv = pqEle.top().vertex_val;
        pqEle.pop();

        // 訪問完了
        color[u] = BLACK;

        for(int v_num = 0; v_num < v_Link[u].size(); v_num++)
        {
            // 隣接リストから接続している要素を取得する
            v = v_Link[u][v_num].vertex_num;

            if( color[v] != BLACK )
            {
                // u → v の経路の中で, vのコストが最小のものが見つかれば更新する
                if( d[v] > d[u] + v_Link[u][v_num].vertex_val )
                {
                    // コストの記録
                    d[v] = d[u] + v_Link[u][v_num].vertex_val;
                    // 頂点 v の親を記録する
                    p[v] = u;
                    // 訪問状態の記録
                    color[v] = GRAY;

                    // キューに要素を入れる
                    pqEle.push( q_element(v, d[v]) );
                }
            }
        }
    }

    // 結果の表示
    for(int i = 0; i < n; i++)
    {
        cout << i << " " << ( d[i] == INFTY ? -1 : d[i] ) << endl;
    }

    return 0;
}



Measured memory_bytes: 7712
//This Code was made by Chinese_zjc_.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <ctime>
// #include<windows.h>
#define int long long
#define double long double
using namespace std;
const double PI = acos(-1);
const double eps = 0.0000000001;
const int INF = 0x3fffffffffffffff;
int a[3], N, dp[3005];
signed main()
{
    ios::sync_with_stdio(false);
    cin >> a[0] >> a[1] >> a[2] >> N;
    dp[0] = 1;
    for (int i = 0; i < 3; ++i)
    {
        for (int j = N; j >= 0; --j)
        {
            for (int k = 1; k * a[i] <= j; ++k)
            {
                dp[j] += dp[j - k * a[i]];
            }
        }
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>

int main() {
    int A, B, C, K;
    scanf("%d %d %d %d", &A, &B, &C, &K);

    int ans = 0;
    for(int i = 0; i < K; i++) {
        if(A != 0) {
            A--;
            ans++;
        }else if(B != 0) {
            B--;
        }else if(C != 0) {
            C--;
            ans--;
        }
    }

    printf("%d\n", ans);
}

Measured memory_bytes: 1736
#include <iostream>
#include <algorithm>

using namespace std;

int v[5];

int main ()
{
  for(int i = 0; i < 5; i++)
  {
    cin >> v[i];
    if(v[i]== 0)
    {
      cout << i+1 << endl;
      break;
    }
  }

  return 0;
}

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

int main() {
  int64_t L,R;
  cin >> L >> R;
  int64_t min = 1000000000;
  
  for(int64_t i=L; i<R; i++){
    for(int64_t j=i+1; j<R+1; j++){
      if((i*j)%2019 < min){
        min = (i*j)%2019;
        if(min==0) break;
      }
    }
    if(min==0) break;
  }
  cout << min << endl;

}

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

inline void Swap(int *a, int *b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

void SelectionSort(int *a, size_t n, int *swapCount)
{
	int minj;
	for (int i = 0; i < n -1; i++)
	{
		minj = i;
		for (int j = i; j < n; j++)
		{
			if (a[j] < a[minj])
				minj = j;
		}
		
		if (i != minj)
		{
			Swap(&a[i], &a[minj]);
			//cout << "swap: a[" << i << "]=" << a[i] << ",a[" << minj << "]=" << a[minj] << endl;
			(*swapCount)++;
		}
	}
}

void Print(int *a, size_t n)
{
	for (int i = 0; i < n; i++)
	{
		cout << a[i];
		if (i == n-1)
			cout << endl;
		else
			cout << " ";
	}
}
int main()
{
	int swapCount = 0;
	int a[100] = {0};
	int n;
	
	cin >> n;
	
	int v;
	for (int i = 0; i < n; i++)
	{
		cin >> v;
		a[i] = v;
	}
	SelectionSort(a, n, &swapCount);
	Print(a, n);
	cout << swapCount << endl;
	return 0;
}

Measured memory_bytes: 1160
from enum import Enum
import sys
import math


A,B,DEGREE = map(int,input().split())

rad = math.radians(DEGREE)

S = A*B*math.sin(rad)/2.0
C = math.sqrt(A*A+B*B-2*A*B*math.cos(rad))
h = 2*S/A

print("%.10f %.10f %.10f"%(S,A+B+C,h))



Measured memory_bytes: 6424
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#pragma GCC optimize ("trapv")
using namespace std;

#define pii pair<int, int>
#define pll pair<long long, long long>
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define DEBUG 1
#define cerr if (DEBUG) cerr
#define test cerr << "hi\n";

//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//#define rand(l, r) uniform_int_distribution<long long>(l, r)(rng)
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> OST;

#define INF 0x3f3f3f3f3f3f3f3f
#define MAXN 200005
//#define MOD 998244353LL
#define MOD 1000000007LL

int n, m;
vector<pair<pii, int> > games;
int p[MAXN], col[MAXN];
vector<int> v[MAXN];

void join(int x, int y, int st) {
    x = p[x], y = p[y];
    if (x == y) return;
    if (v[x].size() < v[y].size())
        swap(x, y);
    while (v[y].size()) {
        int q = v[y].back();
        v[x].pb(q);
        p[q] = x;
        v[y].pop_back();
    }
}

int work(int go) {
    for (int i = 0; i < n; i++) {
        p[i] = i;
        v[i].clear();
        v[i].pb(i);
        col[i] = 0;
    }

    for (int i = 0; i < m; i++) {
        int u, v, st;
        u = games[i].fi.fi;
        v = games[i].fi.se;
        st = games[i].se;

        if (u == go or v == go)
            continue;

        if (p[u] != p[v]) {
            join(u, v, st);
        }
        else {
            if ((col[u]+st)%3 != col[v])
                return i;
        }
    }

    return -1;
}

int val[255];
int q;

void solve() {
    cin >> n >> q;
    iota(p+1, p+1+n, 1);
    for (int i = 0; i <= n; i++)
        v[i].pb(i);
    while (q--) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            join(u, v, 0);
        }
        if (t == 1) {
            cout << (p[u] == p[v]) << '\n';
        }
    }
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    auto start_time = clock();
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t = 1;
//    cin >> t;
    for (int no = 1; no <= t; no++) {
//        cout << "Case #" << no << ": ";
        solve();
    }

#ifdef LOCAL
    cerr << "TIME ELAPSED: " << double(clock() - start_time) / CLOCKS_PER_SEC << '\n';
#endif
}

Measured memory_bytes: 15276
st = input()
ans1 = 0
ans2 = 0
for i in range(len(st)):
  if i%2 == 0 and st[i] == '0':
    ans1 += 1
  if i%2 == 1 and st[i] == '1':
    ans1 += 1
  if i%2 == 0 and st[i] == '1':
    ans2 += 1
  if i%2 == 1 and st[i] == '0':
    ans2 += 1
    
print(min(ans1, ans2))

Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
typedef long long lint;
const int MOD = 1e9 + 7;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<lint> vi;
typedef vector<vi> vvi;
#define all(x) (x).rbegin(), (x).rend()
#define pb push_back
int main()
{
    lint n;
    cin >> n;
    vi v;
    rep(i, n)
    {
        lint a;
        cin >> a;
        v.push_back(a);
    }
    sort(all(v));
    vi len;
    rep(i, n - 1)
    {
        if (v[i] == v[i + 1])
        {
            len.push_back(v[i]);
            i++;
        }
    }
    if (len.size() >= 2)
    {
        cout << len[0] * len[1] << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 1908
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

ll get(ll a, ll b, ll x) {
  ll ans = floor((a * x * 1.0) / (b * 1.0)) - a * floor((x * 1.0) / b);
  return ans;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll a, b, n;
  cin >> a >> b >> n;
  ll ans = get(a, b, min(n, b - 1));
  cout << ans << endl;

  return 0;
}

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

using namespace std;
typedef long long ll;

int main(void)
{
  ll A,B,K;
  cin>>A>>B>>K;

  if(A-K>0){
    cout<<A-K << " "<<B<<endl;
  }
  else{
    if(A+B>K){
    cout<<0<<" "<<B-(K-A)<<endl;
    }
    else{
      cout<<0<<" "<<0<<endl;
    }
  }
  

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<unordered_map>
using namespace std;
int main(){
    int N;
    cin >> N;
    int B[110];
    int ans = 0;
    for(int i = 1;i <=N-1;i++){
        cin >> B[i];
    }
    ans += B[1];
    B[N] = 999999999;
    for(int i = 1;i <= N-1;i++){
        ans += min({B[i], B[i+1]});

    }

    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

ll gcd(ll a, ll b){
  if(b<a) swap(a, b);
  ll r = a % b;
  if(r==0) return b;
  while(r!=0) r = a % b, a = b, b = r;
  return a;
}
int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  ll s = 0;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      for(int k=1;k<=n;k++){
        s += gcd(gcd(i, j), k);
      }
    }
  }
  std::cout << s << '\n';
  return 0;
}


Measured memory_bytes: 3180
n = input()
n_len = len(n)

ans = 0
for i in range(n_len+1):
    curr_sum = 0
    for j in range(n_len):
        num = int(n[j])
        if j < i:
            curr_sum += num
        elif j == i:
            if num == 0: curr_sum = -10000000000
            curr_sum += (num-1)
        else:
            curr_sum += 9
    ans = max(ans, curr_sum)

print(ans)

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

using namespace std;
#define ll long long
int main() {
    //freopen("262144.in", "r", stdin);
    //freopen("262144.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    int ar[n];
    for(int i=0;i<n;i++){
        cin>>ar[i];
        if(i){
            ar[i]+=ar[i-1];
        }
    }
    int mn=INT32_MAX;
    for(int i=0;i<n;i++){
        mn=min(mn,abs((ar[n-1]-ar[i])-(ar[i])));
    }
    cout<<mn<<endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: str):
    B = [0]

    for i in range(len(N)):
        T = B[i] + int(N[i])

        B.append(T)

    A = B[len(N)] - B[0]

    if A % 9 ==0:
        return print(YES)
    else:
        return print(NO)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = next(tokens)  # type: str
    solve(N)

if __name__ == '__main__':
    main()


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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int x;
  cin >> x;

  int ans = 1;
  for(int i=2; i*i <= x+1; ++i) {
    int y = 1;
    while(y*i <= x) y *= i;
    chmax(ans, y);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import sys

x = []
i = 0
for line in sys.stdin:
    if i==0:
        lx = int(line)
    else:
        x.append([int(i) for i in line.split()])
    i = 1

rb = range(4)
rf = range(3)
rr = range(10)
rooms = [[[0 for i in rr] for j in rf]for k in rb]
for e in x:
    i,j,k,l = e
    rooms[i-1][j-1][k-1] += l

for i in rb:
    for j in rf:
        print '',
        for k in rr:
            print rooms[i][j][k],
        print
    if i<len(rb)-1: print '#' * 20

Measured memory_bytes: 4256
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
"""
全員が自分以外の全員のxorを把握しているので、全員の値を求めよ
nは偶数

桁ごとに独立に考える。
テストケースで検証すると、
その桁において1の数が偶数個の場合は、自分自身の桁の数字を入れる
奇数個の場合は、自分自身の桁の値をbit反転したものを入れる
ことが正解であることが分かる。
これを実装するだけ。
"""
n = int(readline())
lst1 = list(map(int,readline().split()))
res = 0
for i in lst1:
    res = res^i
ans = []
for i in lst1:
    ans.append(res^i)
print(*ans)

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

typedef long long ll;
int n, s, mn = 2e9;
int d[50][100005];
//void f(ll p) {
//	ll s = 0;
//	while (p > 0) {
//		s += p % 10;
//		p /= 10;
//	}
//	mn = min(mn, s);
//}
int f(int p, int q) {
	int i, mn = 2e9;
	if (p >= 50) return 2e9;
	if (q == 0 && p > 0) return p;
	if (d[p][q] != 0) return d[p][q];
	d[p][q] = 2e9;
	for (i = 0; i <= 9; i++) {
		mn = min(mn, f(p + i, (q * 10 + i) % n));
	}
	return d[p][q] = mn;
}
int main()
{
	ll i;
//	freopen ("input.txt", "r", stdin);
	cin >> n;
	cout << f(0, 0);
//	for (i = 1; i <= 50; i++) {
//		v[i][0] = 1;
//		for (j = 1; j <= n; j++) d[i][j] = 0;
//		for (j = i - 1; j >= 1; j--) {
//
//		}
//		if (f(0, 0, i)) break;
//	}
//	cout << i;
    return 0;
}



Measured memory_bytes: 243584
import sys
from queue import Queue  # put/get


def parse(file):
    height, width = map(int, file.readline().split())
    maze = []
    for y in range(height):
        row = file.readline().strip()
        maze.append(row)

    return height, width, maze


def main(height, width, maze):
    traversed = [(0, 0)]
    queue = Queue()  # get/put

    queue.put((0, 0, 0))

    nwhite = 0
    for r in maze:
        nwhite += r.count('.')

    while not queue.empty():
        (y, x, count) = queue.get()

        if (y, x) == (height - 1, width - 1):
            return nwhite - count - 1
        for ny, nx in ((y - 1, x), (y + 1, x), (y, x - 1), (y, x + 1)):
            if ny >= height or nx >= width or ny < 0 or nx < 0:
                continue
            if (ny, nx) in traversed:
                continue
            if maze[ny][nx] == '.':
                queue.put((ny, nx, count + 1))
                traversed.append((ny, nx))
    return -1


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))

Measured memory_bytes: 45160
#include <cstdio>
#include <cstring>
char s[100000];
int len;
int ans;
int main()
{
  scanf("%s",s);
  len=strlen(s);
  for(int i=0;i<len;i++){
    if(s[i]=='g') ans++;
	else ans--;
  }
  printf("%d",ans>>1);
  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int main(){
	long long N, M;
	cin >> N >> M;
	multimap<long long, long long> price;
	for(int i = 0; i != N; ++i){
		long long pr, sz;
		cin >> pr >> sz;
		price.insert({pr, sz});
	}
	long long ans = 0;
	for(auto it = price.begin(); it != price.end(); ++it){
		if(M <= 0)
			break;
		long long cur_sz = min(M, it->second);
		M -= cur_sz;
		ans += it->first * cur_sz;
	}
	cout << ans;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w;
	string a[102];
	cin>>h>>w;
	for(int i=0;i<h;i++){
	    cin>>a[i];
	}
	for(int i=0;i<w+2;i++){
	    cout<<"#";
	}
	cout<<endl;
	for(int i=0;i<h;i++){
	    cout<<"#"<<a[i]<<"#"<<endl;
	}
	for(int i=0;i<w+2;i++){
	    cout<<"#";
	}
	cout<<endl;
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000001
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

int main()
{
    fast
    // test
    {
        lli n;
        cin>>n;
        if(n%1000==0)
        {
            cout<<0;
        }
        else
        {
            lli ct=n/1000+1;
            ct=ct*1000;
            ct=ct-n;
            cout<<ct;
        }
    }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";




Measured memory_bytes: 3660
using System;

namespace rensyuu1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            int a = int.Parse(line[0]);
            int b = int.Parse(line[1]);
            //箱作り
            int[,] g = new int[a + 1, b + 1];
            //読み込み
            for (int i1 = 0; i1 < a; i1++)
            {
                string[] array = Console.ReadLine().Trim().Split(' ');
                for (int i2 = 0; i2 < b; i2++)
                {
                    g[i1, i2] = int.Parse(array[i2]);
                }
            }
            //右端の値
            for (int i3 = 0; i3 < a; i3++)
            {
                g[i3, b] = 0;
                for (int i4 = 0; i4 < b; i4++)
                {
                    g[i3, b] = g[i3, b] + g[i3, i4];
                }
            }
            //下端の値
            for (int i5 = 0; i5 <= b; i5++)
            {
                g[a, i5] = 0;
                for (int i6 = 0; i6 < a; i6++)
                {
                    g[a, i5] = g[a, i5] + g[i6, i5];
                }
            }
            //出力
            for (int i7 = 0; i7 <= a; i7++)
            {
                for (int i8 = 0; i8 <= b; i8++)
                {
                    if (i8 == 0)
                    {
                        Console.Write($"{g[i7, i8]}");
                    }
                    else
                    {
                        Console.Write($" {g[i7, i8]}");
                    }
                }
                Console.WriteLine();
            }
        }
    }
}


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

ll calc(string s) {
  int len = s.length();
  ll ret = stoll(s);
  for (int i = 1; i < len; i++) {
    ret += stoi(s.substr(0, i)) * pow(2, len - i - 1);
    ret += calc(s.substr(i, len - 1));
  }
  return ret;
}

int main()
{
  string s;
  cin >> s;
  cout << calc(s) << endl;

  return 0;
}

Measured memory_bytes: 4024
/*
 * drish1001
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>  
#include <iostream> 
using namespace __gnu_pbds; 
using namespace std;
#define     pb                 push_back
#define     mp                 make_pair
#define     ff                 first
#define     ss                 second
#define    MOD                1000000007
#define     pll                pair<ll,ll>
void        sorta(auto &v)     {sort(v.begin(),v.end());} 
void        sortd(auto &v)     {sort(v.begin(),v.end(), greater<>());} 
void        fast()            {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
typedef        long long        ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> magic; 

//all variables and functions be1ow this ..


int main()
{
		ll d, t, s;
		cin >> d >> t >> s;
		ll dd = t*s;
		if(dd<d)
			cout << "No" << endl;
		else
			cout << "Yes" << endl;
}


Measured memory_bytes: 3592
N, M, X = map(int, input().split())
Z = [[] for _ in range(N)]
for i in range(N):
    Z[i] = list(map(int, input().split()))


ans = -1
for i in range(pow(2, N)):
    cost = 0
    flag = [False for _ in range(M)]
    rikai = [0 for _ in range(M)]
    binary = format(i, '0{}b'.format(N))
    for index, value in enumerate(binary):
        if value == '1':
            cost += Z[index][0]
            for j in range(1, M+1):
                rikai[j -1] += Z[index][j]
                if rikai[j -1] >= X:
                    flag[j -1] = True
        if all(flag):
            if ans == -1:
                ans = cost
                continue
            ans = min(ans, cost)
print(ans)



Measured memory_bytes: 69448
#include "iostream"
#include "algorithm"
#include "string"

using namespace std;

const long long  int MOD = 1000000007;

int main(){
	long long int A,B,C,ans;
	cin>>A>>B>>C;
	ans=B/A;
	if(ans>C)ans=C;
	cout<<ans<<endl;
		return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	int a, b, c, i, j, k;
	bool valid = false;
	cin >> a >> b >> c;
	for (i = 1; i <= 1000; i++) {
		if ((a * i) % b == c)valid = true;
	}
	if (valid) cout << "YES";
	else cout << "NO";

	return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 10000007;
const int inf = 1001001001;


int main(void) {
  int n,x;
  cin >> n>> x;
  vi l(n);
  rep(i,n) cin >> l[i];
  int zahyou = 0;
  rep(i,n){
    zahyou += l[i];
    if(zahyou>x){
      cout << i+1 << endl;
      return 0;
    }
  }
  cout << n+1 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<stack>
#include<cmath>
#include<algorithm>
#include<map>
typedef long long ll;
using namespace std;
#define INF 0x3f3f3f3f
/**
*超时有可能是输入的问题
*注意边界
*仔细读题
*没思路试试逆向思维
**加油，奥利给！！！ 
**/
map<int,int>p;
/*struct knd{
	int x,y,z;
}s[200000];*/ 
string a;
int main()
{
	int m,n,i,j,t,k;
	int s1=0,s2=0,s3=0,s4=0;
	cin>>n;
	
	for(i=1;i<=n;i++)
	{
		cin>>a;
		if(a[0]=='A') s1++;
		if(a[0]=='W') s2++;
		if(a[0]=='T') s3++;
		if(a[0]=='R') s4++;
	 } 
	 printf("AC x %d\n",s1);
	 printf("WA x %d\n",s2);
	 printf("TLE x %d\n",s3);
	 printf("RE x %d\n",s4);
 } 

Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
int K,N,a[200000],dist=0,tmp=0,tmp_maxi,maxi=0;

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

    for(int i=0;i<N+1;i++) {
        if(i==0) tmp = a[0];

        if(i<N){ 
            tmp_maxi = a[i] - tmp;
            tmp = a[i];
        }
        else{
            tmp_maxi = K - tmp + a[0];
        }

        if(tmp_maxi >= maxi) {
            maxi = tmp_maxi;
        }
    }
    cout << K - maxi << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(){

    int a,b,d,r;
    double f,x,y;

    scanf("%d %d",&a,&b);

    d = a/b;
    r = a%b;
    x = a;
    y = b;
    f = x/y;
    printf("%d %d %.5f\n",d,r,f);

    return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <cstring>
#include <cmath>

using namespace std;

int main(){
    int n;
    cin >> n;
    int res[n+1];
    for(int i=1;i<=n;i++){
        int st;
        cin >> st;
        res[st]=i;
    }
    for(int i=1;i<=n;i++){
        cout << res[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

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

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

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

ll k, a[100];
ll n;

int main(){
	cin >> k;
	rep(i, 50) {
		a[i] = 49 + k / 50;
		if (i < 50 - k % 50)a[i] -= k % 50;
		else a[i] -= (k % 50 - 50);
	}
	cout << 50 << endl;
	rep(i, 50) {
		cout << a[i];
		if (i != 50 - 1)cout << " ";
	}
	cout << endl;
}

Measured memory_bytes: 256
import java.util.*

fun main(args : Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextDouble()
    val sqrt = Math.sqrt(n)

    val nLong = n.toLong()
    var current = sqrt.toLong()

    while (true) {
        if (nLong % current == 0L) {
            println(nLong / current + current - 2)
            break
        }
        current -= 1
    }

}

Measured memory_bytes: 31388
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,sum=1,p=1,l=1000000000000000000LL;
  int a[10000000];
  bool f=true,k=false;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum*=a[i];
    if(sum>l||sum<p){
      f=false;
    }
    if(a[i]==0) k=true;
    p=sum;
  }
  if(f||k) cout<<sum<<"\n";
  else cout<<"-1\n";
}


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

int main(){
    int a, b;
    cin >> a >> b;

    for(int i = 1; i <= 3; i++){
        if((a * b * i % 2) == 1){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
int main()
 {  ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
	
            int n;
            cin>>n;
            vector<int>s(n),s1(n);
            
            for(int i=0;i<n;i++) cin>>s[i];
            for(int i=0;i<n;i++) cin>>s1[i];
            int i=0;
            while(s[i]==s1[i]) i++;
            vector<int>&sx = (s[i]>s1[i])?s1:s;
            vector<int>&sy = (s[i]<s1[i])?s1:s;
          
        
            int c = -1;
            do{
                c++;
                if(sx==sy) break;
            }while(next_permutation(sx.begin(),sx.end()));
            cout<<c<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 1000002
#define TRUE 1
#define FALSE 0

int search(int *a, int n, int key){
  int left=0,right=n,mid;

  while(left<right){
    mid=(left+right)/2;
    if(a[mid]==key) return TRUE;
    else if(a[mid]>key) right=mid;
    else left=mid+1;
  }
  return FALSE;
}

int main(){
  int q,i,sum=0,a[N],n,key;

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

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(search(a,n,key)==TRUE) sum++;
  }

  printf("%d\n",sum);

  return 0;
}


Measured memory_bytes: 2136
N = int(input())
P = []
for i in range(N):
    s = [int(i) for i in input().split()]
    P.append(s)
L = []
for i in range(N-1):
    for j in range(i+1, N):
        l = (P[i][0] - P[j][0])**2 + (P[i][1] - P[j][1])**2
        L.append(l**0.5)
S = sum(L)
print(2*S/N)

Measured memory_bytes: 9416
function Main(input) {
	input = input.split("\n");
	var l1 = input[0].split(" ");
	var l2 = input[1].split(" ");
	var l3 = input[2].split(" ");

	var N = input[3];

	var hit = [];

	for(var i = 0; i < N; i++) {
		var val = parseInt(input[4+i]);

		for(var j = 0; j < 9; j++) {
			if(j < 3) {
				if((l1[j]) == val) {
					hit[j] = true;
				}
			} else if(j < 6) {
				if((l2[j%3]) == val) {
					hit[j] = true;
				}
			} else {
				if((l3[j%3]) == val) {
					hit[j] = true;
				}
			}
		}
	}

	var flag = false;

	for(var i = 0; i < 3; i++) {
		// 縦判定
		if(hit[i] == true) {
			if(hit[i+3] == true) {
				if(hit[i+6] == true) {
					flag = true;
					break;
				}
			}
		}

		// 横判定
		if(hit[i*3] == true) {
			if(hit[i*3 + 1] == true) {
				if(hit[i*3 + 2] == true) {
					flag = true;
					break;
				}
			}
		}

		// 斜判定
		if(i == 0 || i == 2) {
			if(hit[i] == true) {
				if(hit[4] == true) {
					if(hit[8 - i] == true) {
						flag = true;
						break;
					}
				}
			}
		}
	}

	if(flag) {
		console.log("Yes");
	} else {
		console.log("No");
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main()
{
	int n, j = 0;
	cin >> n;
	char a[n+1], b[n+1], s[2*n+1];
	scanf("%s%s", &a, &b);
	for(int i = 0; i < 2*n; i+=2)
	{
		s[i] = a[j];
		s[i+1] = b[j];
		j++;
		if(i+1 == 2*n-1) s[2*n] = '\0'; 
	} 
	cout << s;
	return 0;
}


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;

map< int, int > ret;

void prime_factor(int n) {
  for(int i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] += 1;
}

int count(int n){
  int c=0;
  for(auto p:ret){
    if(p.second>=n)c++;
  }
  return c;
}

int main(){
  int n;
  cin >> n;
  while(n>1){
    prime_factor(n);
    n--;
  }
  // for(auto p:ret){
  //   cout << p.first << " " << p.second << endl;
  // }
  cout << count(74) + count(24)*(count(2)-1) + count(14)*(count(4)-1) + count(4) * (count(4)-1) * (count(2)-2)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
#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>;

int main() {
    int a, b, c;
    cin >> a >> b >>c;

    int amari=a%b;

    if (amari==0) {
        cout << "NO" << endl;
        return 0;
    } else {
        rep(i,b) {
            if ((a*i)%b == c) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }

    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define endl '\n'
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define vi vector<int>
#define pi pair<int,int>
#define vii vector<pi>
#define size(a)  (int)(a.size())
#define fill(s,x,n) vector
 x(n); rep(i,0,n) cin>>x[i];
#define mod 1000000007
#define inf 1000000005
void solve(){
	string s,t;
	cin>>s>>t;
	int n = s.length();
    cout<<(t.substr(0,n)==s?"Yes":"No");

}
 

signed main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);  
    #endif
    */
	int test;
	//cin>>test;
	test=1;
	while(test--){
         solve();
         cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3588