akhauriyash/Code-Regression huggingface dataset:
#include <set>
#include <queue>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define debug(x) cerr<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();ll f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}

int n;
ll a[200020],su[200020];
int main() {
	read(n);
	for(int i=1;i<=n;i++){
		read(a[i]);
		su[i] = su[i-1]+a[i];
	}
	ll ans = 1e18;
	for(int i=1;i<n;i++){
		ans = min(ans,max(su[i],su[n]-su[i])-min(su[i],su[n]-su[i]));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int M = scan.nextInt();
        long answer = (long) Math.pow(2, M) * (1900*M + 100 * (N-M));
        System.out.println(answer);
    }
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 1050,inf=0x3f3f3f3f;
int n,m;char s[N][N];
int dis[N][N],f,r;Pii q[N*N];
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int main() {
	read(n);read(m);rep(i,1,n)scanf("%s",s[i]+1);
	rep(i,1,n)rep(j,1,m)dis[i][j]=inf;
	rep(i,1,n)rep(j,1,m)if(s[i][j]=='#')dis[i][j]=0,q[r++]=Pii(i,j);
	while(f!=r){
		int x=q[f].fi,y=q[f].se;f++;
		rep(i,0,3){
			int nx=x+dx[i],ny=y+dy[i];
			if(nx>=1&&nx<=n&&ny>=1&&ny<=m&&dis[nx][ny]>dis[x][y]+1){
				dis[nx][ny]=dis[x][y]+1;q[r++]=Pii(nx,ny);
			}
		}
	}
	int res=0;rep(i,1,n)rep(j,1,m)umax(res,dis[i][j]);cout<<res;
	return 0;
}


Measured memory_bytes: 13952
#include <bits/stdc++.h>
using namespace std;
#define vl vector <long long>
#define lli long long
 
vl st;
 
void update(int v,int i,int l,int r,lli val){
    if(l>r)return;
    if(l==r){
        st[v]=val;
    }
    else{
    int mid=(l+r)/2;
    if(i<=mid)update(2*v,i,l,mid,val);
    else update(2*v+1,i,mid+1,r,val);
    st[v]=max(st[2*v],st[2*v+1]);
    }
}
 
lli  query(int v,int ll,int rr,int l,int r){
    if(ll>rr)return 0;
    if(l==ll&&r==rr){
        return st[v];
    }
    else{
    int mid=(l+r)/2;
    lli left=query(2*v,ll,min(mid,rr),l,mid);
    lli right=query(2*v+1,max(mid+1,ll),rr,mid+1,r);
    return max(left,right);
    }
}
 
int main() {
    int n;
    cin>>n;
    st.assign(4*n+1,0);
    vl vec(n,0);
    vector <pair<lli,int>> svec(n);
    vl val(n,0);
    for(int i=0;i<n;i++){
        cin>>vec[i];
        svec[i].first=vec[i];
        svec[i].second=i;
    }
    for(int i=0;i<n;i++){
        cin>>val[i];
    }
    sort(svec.begin(),svec.end());
    map<lli,int>ind;
    for(int i=0;i<n;i++)ind[svec[i].first]=i;
    lli ans=0;
    for(int i=n-1;i>=0;i--){
        int index=ind[vec[i]];
        lli mx=query(1,index+1,n-1,0,n-1);
        lli value=mx+val[i];
        //cout<<value<<" "<<i<<" "<<mx<<" "<<index<<endl;
        if(ans<value)ans=value;
        update(1,index,0,n-1,value);
    }
    cout<<ans<<endl;
}

// copied solution

Measured memory_bytes: 25344
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        List<Integer> listS = Arrays.stream(br.readLine().split(" "))
                .map(Integer::parseInt)
                .collect(Collectors.toList());
        int q = Integer.parseInt(br.readLine());
        List<Integer> listT = Arrays.stream(br.readLine().split(" "))
                .map(Integer::parseInt)
                .collect(Collectors.toList());

        int count = 0;
        for (int i = 0; i < q; i++) {
            int t = listT.get(i);
            for (int j = 0; j < n; j++) {
                if (listS.get(j) == t) {
                    count++;
                    break;
                }
            }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 33364
N, M = map(int,input().split())

if M == 0:
  print(0,0)
  exit()
  
a = [0]*(N + 1)
p = [0]*(N + 1)
wa = [0]*(N + 1)

for i in range(M):
  P, S = input().split()
  P = int(P)
  if S == "WA":
    wa[P] += 1
  elif a[P] == 0:
    a[P] += 1
    p[P] = wa[P]

print(sum(a),sum(p))

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

#define int long long

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string s; cin >> s;
    int ans = 0;

    for(int b = 0; b < (1 << s.length()-1); b++)
    {
        string t;
        REP(i, (int)s.length()) 
        {
            t.pb(s[i]);
            if(b & (1 << i)) t.pb('+');
        }
        t.pb('+');

        int val = 0;
        REP(i, (int)t.length())
        {
            if(t[i] == '+') 
            {
                ans += val;
                val = 0;
            }
            else
            {
                val *= 10;        
                val += t[i] - '0';
            }
        }
    }
    cout << ans << endl;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    ll n,a,b,ans=0;
    cin>>n>>a>>b;
    vector<ll> p(n);
    ll low=0,mid=0,high=0;
    for(int i = 0; i < n; i++)
    {
        cin>>p[i];
        if(p[i]<=a) low++;
        else if(b<p[i]) high++;
        else mid++;
    }
    ans = min(low,min(mid,high));

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

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve{
public:
    void input(){

    }
    void solve(){
        input();
        int N,A,B;
        cin >> N >> A >> B;
        int max_v = min(A,B);
        int min_v = max(0,A + B - N);
        cout << max_v << " " << min_v << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
X, N = map(int, input().split())
li = [i for i in map(int, input().split())]
k = 0
ans = 1000
while X-k >= 0 or X + k <= N:
    if X - k not in li:
        ans = X - k
        break
    if X+k not in li:
        ans = X+k
        break
    k += 1
print(ans)

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

#define _GLIBCXX_DEBUG

int main() {
  int N;
  cin >> N;

  vector<uint64_t> Lucas(N+1);

  Lucas.at(0) = 2LL;
  Lucas.at(1) = 1LL;
  for(int i = 2; i <= N; i++) {
    Lucas.at(i) = Lucas.at(i-1) + Lucas.at(i-2);
  }

  cout << Lucas.back() << endl;

}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;

typedef long long ll;


int main(){
	ll n;
	cin>>n;
	ll x=sqrt(n);
	printf("%lld",x*x);
	
	return 0;
} 
	
	
	

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run() {
		long n, min = Long.MAX_VALUE;
		Scanner scan = new Scanner(System.in);
		n = scan.nextLong();
		for (int i = 0; i < 5; i++)
			min = Math.min(min, scan.nextLong());
		if (min == 1)
			System.out.println(5 + (n / min) - 1);
		else
			System.out.println(5 + (n / min));
	}
    public static void main(String[] args) {
    	new Main().run();
    }
}


Measured memory_bytes: 23380
n = int(input())
red = [list(map(int, input().split())) for i in range(n)]
red.sort(key=lambda x:x[1], reverse=True)
blue = [list(map(int, input().split())) for i in range(n)]
blue = sorted(blue)
ans = 0
for x_b, y_b in blue:
  for x_r, y_r in red:
    if x_r < x_b and y_r < y_b:
      red.remove([x_r, y_r])
      ans += 1
      break
print(ans)


Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 305;

int H, W, D;
int Q;
struct Point {
	int x, y;
	Point () {}
	Point (int _x, int _y) {
		x = _x; y = _y;
	}
}PP[MaxN * MaxN];
int dis[MaxN * MaxN];

int Consum(Point A, Point B) {
	return abs(A.x - B.x) + abs(A.y - B.y);
}

int main()
{
	while(scanf("%d %d %d", &H, &W, &D) != EOF)
	{
		memset(dis, 0, sizeof(dis));
		for(int i = 1; i <= H; i++) {
			for(int j = 1; j <= W; j++) {
				int p;
				scanf("%d", &p);
				PP[p] = Point(i, j);
			}
		}
		for(int i = D + 1; i <= H * W; i++)
			dis[i] = dis[i - D] + Consum(PP[i], PP[i - D]);
		scanf("%d", &Q);
		while(Q--) {
			int L, R;
			scanf("%d %d", &L, &R);
			printf("%d\n", dis[R] - dis[L]);
		}
	}
	return 0;
}

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

int a[111],b[111];

int d,g;

int dp[11][2*11111111];
int check(int i,int sum) {

        if(sum<=0) return 0;
        if(i>d) return 10000;
        if(~dp[i][sum]) return dp[i][sum];
        int res=INT_MAX,r;


        for(int j=0;j<=a[i];j++) {
                r=100*j*i;
                if(j==a[i]) r+=b[i];

                res=min(res,j+check(i+1,sum-r));
        }
        return dp[i][sum]=res;

}

int main() {



       cin >> d >> g;
        memset(dp,-1,sizeof dp);
        for(int i=1;i<=d;i++) cin >> a[i] >> b[i];

        cout << check(1,g) << endl;






}


Measured memory_bytes: 955136
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;

int main(){
    int N; cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    vector<ll> An(N+1, 0);
    rep(i, N) An[A[i]]++;
    ll all = 0;
    for(int i=1; i<=N; ++i){
        all += An[i]*(An[i]-1)/2;
    }
    rep(i, N){
        ll ans = all;
        ans -= An[A[i]]*(An[A[i]]-1)/2;
        ans += (An[A[i]]-1)*(An[A[i]]-2)/2;
        cout << ans << endl;
    }
 }


Measured memory_bytes: 5760
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	a := nextInts(n)
	s := sum(a)

	ans := abs(sum(a[0:n/2]) - sum(a[n/2:n]))
	for i, t := 0, 0; i < n-1; i++ {
		t += a[i]
		s -= a[i]
		if dif := abs(s - t); dif < ans {
			ans = dif
		}
	}

	puts(ans)
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

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

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func sum(a []int) int {
	ret := 0
	for _, v := range a {
		ret += v
	}
	return ret
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}


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

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

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

/*** MOD CALCULATION ***/

const int MOD = 1e9+7;
// const int MOD = 998244353;
const int MAX = 2'000'005;

ll addM(ll a, ll b){
	return ((a % MOD) + (b % MOD)) % MOD;
}

ll mulM(ll a, ll b){
	return ((a % MOD) * (b % MOD)) % MOD;
}

ll powM(ll a, ll b){
	if(b == 0) return 1;
  	else if(b == 1) return a % MOD;
  	else if(b%2==0) return mulM(powM(a, b/2), powM(a, b/2));
  	else return mulM(a, mulM(powM(a, (b-1)/2), powM(a, (b-1)/2)));
}

// b^{-1} = b^{p-2} (mod p)
// a/b = a*b^{p-2} (mod p)
ll divM(ll a, ll b){ 
  	return mulM(a, powM(b, MOD-2));
}

// n!, (n!)^{-1} のテーブル作成
ll fac[MAX], finv[MAX], inv[MAX];
void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    rep3(i,2,MAX-1){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COMB(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

/*** MOD CALCULATION ここまで ***/

void Main(){
    int n; cin >> n;
    ll ans = powM(10, n);
    ans = addM(ans, MOD - powM(9, n));
    ans = addM(ans, MOD - powM(9, n));
    ans = addM(ans, powM(8, n));
    cout << ans << endl;
    return;
}

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

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

int r;

int main () {
	cin >> r;
	if (r<1200){
		cout << "ABC" << endl;
	} else if ((r>=1200)&&(r<2800)){
		cout << "ARC" << endl;
	} else if (r>=2800){
		cout << "AGC" << endl;
	}
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    ans = 0
    step = K if K % 2 else K // 2

    for a in range(step, N + 1, step):
        l = a // K + 1
        r = (N + a) // K
        if r >= l:
            ans += (r - l + 1) ** 2

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9136
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    auto S = sread();
    long ans;
    foreach (c; S)
        ans += c == '1';
    writeln(ans);
}


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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int dx,dy;
  dx = c - a;
  dy = d - b;
  cout << c - dy << " " << d + dx << " " << a - dy << " " << b + dx << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000



int main(){
	
	vector<string> V = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
	string s;
	cin>>s;
	
	for(int i=0;i<7;i++){
		if(s==V[i]){
			cout<<7-i<<endl;
			return 0;
		}
	}
	
	return 0;
	
}


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

using namespace std;

void solve() {
    int D, T, S;
    cin >> D >> T >> S;

    int t = D/S;
    if(t < T) cout << "Yes\n";
    else if(t == T) {
        if(D%S == 0) cout << "Yes\n";
        else cout << "No\n";
    } else cout << "No\n";
}

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

    solve();
    return 0;    
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> b;
    for(int i=0; i<n; i++){
        cin>>a[i];
    }   

    if(n % 2 == 0){
        for(int i=0; i<n; i++){
            if(i % 2 == 0){
                b.insert(b.end(),a[i]);   
            }
            else{
                b.insert(b.begin(),a[i]);
            }
        }
    }

    else {
        for(int i=0; i<n; i++){
            if(i % 2 == 1){
                b.insert(b.end(),a[i]);   
            }
            else{
                b.insert(b.begin(),a[i]);
            }
        }
    }

    for(int i=0; i<n; i++){
        cout<<b[i]<<" ";
    }

    cout<<endl;

    return 0;
}

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

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << ": " << arg1 << " |";
	__f(comma + 1, args...);
}


int main() {
	int N, K, ans = 0;
	cin >> N >> K;
	for (int i = 0; i < N; i++)
	{
		int tem; cin >> tem;
		if (tem >= K) ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
package main

import (
    "fmt"
)

func main() {
    var bs []byte
    fmt.Scan(&bs)
    bf := bs[0:2]
    af := bs[2:4]
    if isMM(bf) {
        if isMM(af) {
            fmt.Println("AMBIGUOUS")
        } else {
            fmt.Println("MMYY")
        }
    } else {
        if isMM(af) {
            fmt.Println("YYMM")
        } else {
            fmt.Println("NA")
        }
    }

}

func isMM(bs []byte) bool {
    if bs[0] == '0' {
        if bs[1] == '0' {
            return false
        }
        return true
    }
    if bs[0] == '1' {
        switch bs[1] {
        case '0', '1', '2':
            return true
        }
    }
    return false
}


Measured memory_bytes: 512
#include<stdio.h>

int main()
{
int A,B,C,D;
scanf("%d %d %d %d",&A,&B,&C,&D);
while(A!=0 && C!=0)
{
C-=B;
if(C<=0)
break;
A-=D;
if(A<=0)
break;
}
if(A>0)
printf("Yes\n");
else
printf("No\n");
return 0;
}

Measured memory_bytes: 1644
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _20200528kensyu
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int C = int.Parse(input[2]);
            int D = int.Parse(input[3]);

            //高橋君のインスタンス
            Duelist duelist1 = new Duelist();
            duelist1.Name = "高橋";
            duelist1.HP = A;
            duelist1.Attack = B;

            //青木君のインスタンス
            Duelist duelist2 = new Duelist();
            duelist2.Name = "青木";
            duelist2.HP = C;
            duelist2.Attack = D;

            while (true)
            {
                duelist2.HP -= duelist1.Attack; //高橋君が青木君に攻撃
                if (duelist2.HP <= 0)
                {
                    Console.WriteLine("Yes");
                    break;
                }

                duelist1.HP -= duelist2.Attack; //青木君が高橋君に攻撃
                if (duelist1.HP <= 0)
                {
                    Console.WriteLine("No");
                    break;
                }
            }

            Console.Read();

        }
    }

    class Duelist //名前、HP、攻撃力
    {
        public string Name;
        public int HP;
        public int Attack;
    }

}




Measured memory_bytes: 27256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>
#include <bitset>

//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//std::cout << std::fixed << std::setprecision(10)
//std::ios::sync_with_stdio(false);
constexpr long long MOD = 1000000007;

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

int main()
{
  long long x;
  std::string s;
  std::cin >> x >> s;
  long long y = (s[0]-'0')*100 + (s[2]-'0')*10 + (s[3]-'0');
  long long z = x * y;
  std::cout << z / 100 << std::endl;
  return 0;
}



Measured memory_bytes: 3604
#include <stdio.h>
int main(){
	int n,i,j,m,f;
	char a[256],b[256],x;
	while(1){
	scanf("%d ",&n);
	if(n==0){
		break;
        }

	for(i=0;i<n;i++){
		scanf("%s %s ",&a[i],&b[i]);
	}
	
	scanf("%d ",&m);
	for(i=0;i<m;i++){
		scanf("%s",&x);
		f=0;
		for(j=0;j<n;j++){
		 if(x==a[j]){
			printf("%c",b[j]);
			f=1;
			break;
		 }
	    }
	 if(f==0){
	    printf("%c",x);
	 }
	}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1008
#define rep(i,n) for (int i=0;i<(n);i++)
#include<iostream>
using namespace std;

int main(){
	int m,n;
	string a[51],b[51];
	cin >> n >> m;
	rep(i,n) cin >>a[i];
	rep(i,m) cin >>b[i];

	bool exist = false;
	for(int i=0;i<=n-m;i++){
		for(int j=0;j<=n-m;j++){
				bool match = true;
				for(int y=0;y<m;y++){
					for(int x=0;x<m;x++){
						if(a[i+y][j+x]!=b[y][x]) match=false;
						continue;
					}
				}
				if(match) exist=true;
		}
	}

	cout << ((exist) ? "Yes\n":"No\n");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<sstream>
#include<chrono>
#include<algorithm>
#include<functional>
#include<cstdlib>
#include<numeric>
#include<queue>
#include<stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
constexpr double PI = 3.14159265358979323846;

int main()
{
	int a, b, c, d = 0;
	cin >> a >> b >> c >> d;
	while (true) {
		c -= b;
		if (c <= 0)
		{
			std::cout << "Yes" << std::endl;
			break;
		}
		a -= d;
		if (a <= 0) {
			std::cout << "No" << std::endl;
			break;
		}
	}

}

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

int main(){
  vector<int> d(3);
  for (int i=0; i<3; i++){
    cin >> d[i];
  }
  sort(d.begin(), d.end());
  int cnt=0;
  while(d[1]!=d[2]){
    d[1]++;
    d[0]++;
    cnt++;
  }
  if ((d[2]-d[0])%2==1){
    while(d[2]-d[0]!=1){
      d[0] += 2;
      cnt++;
    }
    cnt += 2;
  } else if ((d[2]-d[0])%2==0){
    while(d[0]!=d[2]){
      d[0] += 2;
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
	int k, n;
	cin >> k >> n;
	vector<int> a(n);
	for (auto& i : a) cin >> i;
	vector<int> diff(n);
	for (int i = 1; i < n; ++i) {
		diff[i - 1] = a[i] - a[i - 1];
	}
	diff[n - 1] = k - a.back() + a[0];
	for (int i = 0; i < n - 1; ++i) {
		diff.push_back(diff[i]);
	}
	int sum = 0;
	--n;
	for (int i = 0; i < n; ++i) {
		sum += diff[i];
	}
	int res = sum;
	for (int i = 0; i + n < diff.size(); ++i) {
		sum -= diff[i];
		sum += diff[n + i];
		res = min(res, sum);
	}
	cout << res << '\n';
	return 0;
}

Measured memory_bytes: 2560
h, w = map(int, input().split())
c = [0]*10
for i in range(10):
  c[i] = [int(x) for x in input().split()]

for _ in range(10):
  for i in range(10):
    for j in range(10):
      for k in range(10):
        c[i][j] = min([c[i][j], c[i][k]+c[k][j]])

ans = 0
for i in range(h):
  a = [int(x) for x in input().split()]
  for j in range(w):
    if a[j] == -1:
      continue
    else:
      ans += c[a[j]][1]

print(ans)

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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> dct;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define pi 3.14159265

bool compare(pll a, pll b){
    return a.first*b.second<a.second*b.first;
}

const int mod = 1e9+7;
const ll inf = ll(1e18);

ll modexp(ll x,ll n){
    if(n==0)return 1;
    if(n%2==0)return modexp((x*x)%mod,n/2);
    return (x*modexp((x*x)%mod,n/2))%mod;
}

int main(){
    //clock_t tm = clock();
    fastio;
    int n,k=0,m,x,t=0;string s;
    cin>>n>>m;
    vi vis(n+1,-1),a(n+1,0);
    f(i,0,m){
        cin>>x>>s;
        if(s=="WA"){
            if(vis[x]==-1){
                a[x]++;
            }
        }
        else{
            vis[x]=1;
        }
    }
    f(i,1,n+1) {
        if (vis[i] == 1) {
            k++;
            t+=a[i];
        }
    }
    cout<<k<<" "<<t<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()

{
    int n, k, mx(0), c(0), res;

    cin >> n;

    if (n == 1)

        cout << "1";

    else {

        for (int i = 2; i <= n; i += 2) {

            k = i;

            c = 0;

            while (1) {

                if (k & 1)

                    break;

                k /= 2;

                ++c;
            }

            if (c > mx) {

                mx = c;

                res = i;
            }
        }

        cout << res;
    }

    cout <<  endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
char op;
int a,b;

do{

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


if(op=='+'){
printf("%d\n",a+b);
} else if(op=='-'){
printf("%d\n",a-b);
} else if(op=='*'){
printf("%d\n",a*b);
} else if(op=='/'){
printf("%d\n",a/b);
}
;}
while(op!='?');

return 0;
}

Measured memory_bytes: 600
N = int(input())
ans = 0

def check_five(N):
    count = 0
    i = 5
    exp = 1
    while True:
        divided = N // i
        if divided == 0:
            break
        count += divided
        exp += 1
        i = 5 ** exp
    return count

if N % 2 == 0:
    ans = check_five(N//2)
else: 
    ans = 0

print(ans)

Measured memory_bytes: 3064
n=97
def c(i,j,k):print('<',i,j,k)
def a(i,j,k):print('+',i,j,k)
def m(i,j,k):
	for t in range(59):
		a(k,k,k)
		for s in range(t+1):
			if t-30<s<30:a(i+t-s,j+s,98);c(n,98,99);a(k,99,k)
def d(x,i,j):
	for t in range(30):
		a(j+t-1,j+t-1,j+t)
		a(j+t,n,j+t)
		for s in range(j+t,j+29):a(s,s,s+1)
		c(j+29,x,i+t)
		a(j+t-1,j+t-1,j+t)
		a(j+t,i+t,j+t)
print(3933)
a(0,1,n)
c(2,n,n)
a(0,n,3)
a(1,n,4)
d(3,5,36)
d(4,36,67)
m(5,36,2)

Measured memory_bytes: 9292
#include<iostream>

using namespace std;

bool map[1000000]={};
int f(int n){
  return ((n%2==0)?  n/2 : 3*n+1);
}

int main(){
  int s;
  cin>>s;
  int cnt=1;

  map[s]=true;
  int next;
  while(true){
    cnt++;
    next=f(s);
    if(map[next]){
      cout<<cnt<<endl;
      return 0;
    }
    map[next]=true;
    s=next;
  }
}


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

using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e5 + 5;
const ll MOD = 1e9+7;

int parent[N];

int gcd(int a, int b) { 
    if (a == 0) 
        return b;  
    return gcd(b%a, a);  
} 
   
int lcm(int a, int b) {  
    return (a*b)/gcd(a,b);  
} 

ll pow(ll x, ll y, ll p) {
    if(y == 0) return 1;
    ll res = 1;
    x %= p;
    if(x == 0) return 0LL;
    while(y > 0) {
        if(y & 1) res = (res*x) % p;
        y >>= 1;
        x = (x*x) % p;
    }
    return res;
}

int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}

void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    ll res = 1LL;
    for(int i=0;i<n;i++) cin >> a[i];
    sort(a.begin(), a.end());
    if(a[n-1] == 0 && k % 2 == 1) {
        cout << 0 << endl;
        return;
    }
    if(a[n-1] < 0 && k % 2 == 1) {
        for(int i=n-k;i<n;i++) {
            res *= a[i];
            res = (res + MOD) % MOD;
        }
        res = (res + MOD) % MOD;
        cout << res << endl;
        return;
    }
    int l = 0, r = n - 1;
    if(a[n-1] > 0 && k % 2 == 1) {
        res = a[r];
        k--;
        r--;
    }
    if(k % 2 == 0) {
        k /= 2;
        for(int i=0;i<k;i++) {
            ll x = a[l] * a[l+1];
            ll y = a[r] * a[r-1];
            if(x > y) {
                res = x % MOD * res % MOD;
                l += 2;
            }
            else {
                res = y % MOD * res % MOD;
                r -= 2;
            }
        }
    }
    res = (res + MOD) % MOD;
    cout << res << endl;
    return;
} 

int main()
{
    IOS
    //int t;
    //cin >> t;
    //while(t--) 
    solve();
    return 0; 
}


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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

ll po(ll a, ll b) {
  ll res = 1;
  for(int i=0;i<b;++i) {
    res *= a;
  }
  return res;
}

int digit(ll n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);
  string s; cin >> s;
  ll dig = (int)(s.size());
  ll n = stoll(s);
  vector<ll> a = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};

  ll sz = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1;

  ll ma = 0;
  ll ans = 0;
  for(int i=0;i<sz;++i) {
    ll now = 0;
    for(int j=0;j<dig;++j) {
      now += a[j] * po(10, dig-j-1);
    }
    // cout << now << endl;
    
    ll diff = min(abs(n - now), po(10, dig) - abs(n - now));
    // printv(a);
    if(diff > ma) {
      ma = diff;
      ans = now;
    }
    next_permutation(a.begin(), a.end());
  }
  if(dig != digit(ans)) {
    cout << 0;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3200
#pragma GCC optimized(2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);

    ll n,max=0;cin>>n;string str;
    set<string> s;map<string,int> mp;
    set<string>::iterator it;
    for(int i=1;i<=n;i++){
        cin>>str;
        if(!s.count(str)){
             s.insert(str);
        }
        mp[str]++;
        if(mp[str]>max) max=mp[str];
    }
    for(it=s.begin();it!=s.end();it++){
        if(mp[*it]==max){
            cout<<*it<<endl;
        }
    }
}

Measured memory_bytes: 33280
N = int(input())
a = [int(i) for i in input().split()]
A = sum(a)
b = [int(i) for i in input().split()]
B = sum(b)
def cost(n):
    if n == 0:
        return [0, 0]
    elif n < 0:
        return [0, -n]
    elif n > 0 and n % 2 == 0:
        return [n//2, 0]
    else:
        return [(n+1)//2, 1]

K = B - A
PC = 0
MC = 0
for i in range(N):
    c = cost(b[i] - a[i])
    PC += c[0]
    MC += c[1]
if PC <= K and MC <= K and ((K-PC)*2 == (K-MC)):
    print("Yes")
else:
    print("No")


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

using namespace std;
typedef long long ll;
const ll mx = 10000007;
const ll mod = 1e9 + 7;
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))

int main() {
     ll n, t;
     cin >> n >> t;
     for (ll i = 0; i <= n; i++) {
        for (ll j = 0; j <= n; j++) {
            if(((((i * 4) + (j * 2)) == t) || ((i*2) + (j * 4) == t ))&& (i + j == n)) {
                cout << "Yes" << endl;
                return 0;
            }
        }
     }
     cout << "No" << endl;

    return 0;
}




Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e9;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200005;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};

vector<vector<bool>> mat(705,vector<bool>(705,1));
vector<vector<ll>> g(705);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,a,b;
    cin >> n >> m;
    rep(i,m){
        cin >> a >> b;
        a--;
        b--;
        mat[a][b] = 0;
        mat[b][a] = 0;
    }
    rep(i,n){
        rep(j,n){
            if (i == j) continue;
            if (mat[i][j]) g[i].push_back(j);
        }
    }
    vector<ll> col(n,-1);
    vector<vector<bool>> dp(n+1,vector<bool>(n+1,0));
    ll now = 0;
    dp[0][0] = 1;
    rep(i,n){
        if (col[i] != -1) continue;
        col[i] = 0;
        queue<P> q;
        q.push(P(i,0));
        ll w = 1,b = 0;
        while(!q.empty()){
            ll v,c;
            tie(v,c) = q.front();
            c = 1-c;
            q.pop();
            for (ll u:g[v]){
                if (col[u] != -1){
                    if (col[u] != c){
                        PRINT(-1);
                        return 0;
                    }
                }
                else{
                    col[u] = c;
                    if (c == 0) w++;
                    else b++;
                    q.push(P(u,c));
                }
            }
        }
        w = abs(w-b);
        rep(i,n+1){
            if (dp[now][i]){
                dp[now+1][i+w] = 1;
                dp[now+1][abs(i-w)] = 1;
            }
        }
        now++;
    }
    rep(i,n+1){
        if (dp[now][i]){
            ll s = (n-i)/2;
            PRINT(s*(s-1)/2+(s+i)*(s+i-1)/2);
            break;
        }
    }
}


Measured memory_bytes: 6144
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<sstream>
#include<iomanip>
#define forn(i,n) for(int (i)=0;i<(n);i++)
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int MAXN=100005;
const int INF=2147483647;
const ll LINF=9223372036854775807;
const ll Mod=1000000007;
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int n;
ll a[200005],sum,ans;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	forn(i,n)
	{
		cin>>a[i];
		sum+=a[i];
		sum%=Mod;
	}
	forn(i,n)
	{
		sum-=a[i];
		if(sum<0)sum+=Mod;
		ans+=a[i]*sum;
		ans%=Mod;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 5128
n = int(input())
s = input()

l = list(s)

value = 0
app_s = 0

for j in range(0,n):
    i = l[j]
    if i == "(":
        value = value + 1
    else:
        value = value - 1
        if -app_s > value:
            app_s = -value

if app_s > 0:
    for j in range(0,app_s):
        s = "(" + s

value = value + app_s

if value > 0:
    for j in range(0,value):
        s = s + ")"

print(s)

    





Measured memory_bytes: 3064
n,m = (int(i) for i in input().split())
lr = [[int(i) for i in input().split()] for i in range(m)]

max_l = 0
min_r = lr[0][1]

for l,r in lr:
    max_l = max(l,max_l)
    min_r = min(r,min_r)

if min_r-max_l+1 > 0:
    print(min_r-max_l+1)
else:
    print(0)

Measured memory_bytes: 60248
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
#define Vi vector<int>
#define Vl vector<long long>
#define pb(a) push_back(a)

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000001;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};


int main() {

	string s,t;
	cin>>s;
	cin>>t;
	rep(i,s.size()){
		if(s[i]!=t[i]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;

	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    int n=a.size();
    int m=b.size();
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            if(i==0 || j==0) dp[i][j]=0;
            else if(a[i-1]==b[j-1]) dp[i][j]=dp[i-1][j-1]+1;
            else dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
        }
    }
   string ans="";
   int r=n,c=m;
   while(r>0 && c>0)
   {
       if(a[r-1]==b[c-1])
       {
           ans+=a[r-1];
           r--;
           c--;
       }
       else
       {
           if(dp[r][c]==dp[r-1][c]) r--;
           else  c--;
       }
   }
   reverse(ans.begin(),ans.end());
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
char s[5];
int main(){
    scanf("%s", s+1);    
    int ans = 0;
    for(int i=1;i<=3;i++){
        ans |= (1<<(s[i]-'A'));
    }
    if(ans == 3) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
from heapq import heappush, heappop

def readinput():
    n,m=map(int,input().split())
    a=[]
    b=[]
    for i in range(n):
        ai,bi=map(int,input().split())
        a.append(ai)
        b.append(bi)
    return n,m,a,b

def main(n,m,a,b):
    jobList=[]
    for i in range(10**5+1):
        jobList.append([])
    for i in range(n):
        jobList[a[i]].append(b[i])

    goodjobs=[]
    earn=0
    for d in range(1,m+1):
        for job in jobList[d]:
            heappush(goodjobs,-job)
        #print(goodjobs)
        if len(goodjobs)>0:
            earn+=heappop(goodjobs)
    return -earn

if __name__=='__main__':
    n,m,a,b=readinput()
    ans=main(n,m,a,b)
    print(ans)


Measured memory_bytes: 28776
N = int(input())
A = list(map(int, input().split()))

M = N * (N + 1) // 2
d, m = divmod(sum(A), M)

def no():
  print("NO")
  exit()

if m != 0:
  no()

cnt = 0
for i in range(N):
  t = A[i - 1] - A[i]
  t += d
  if t < 0:
    no()
  dd, mm = divmod(t, N)
  if mm != 0:
    no()
  cnt += dd

if cnt == d:
  print("YES")
else:
  no()

Measured memory_bytes: 85392
#include<stdio.h>
int main(void)
{
        int a,b,c,d;

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

        if((a<1||b<1||c<1)||(100<a||100<b||100<c))
                printf("正しい値を入力してください\n");
        else
                d = ( a * b) / 2;
        printf("%d\n",d);
        return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <limits>
#include <algorithm>
using namespace std;


void trace(int A[], int N)
{
  int i;
  for(i = 0; i < N-1; i++) cout << A[i] << " ";
  cout << A[i];
  cout << endl;
}

/*
@param int A : 配列
@param int N : 配列の要素数
*/
void bubbleSort(int A[], int N)
{
  int cnt = 0;
  int flag = 1;
  while(flag)
  {
    flag = 0;
    for(int j = N-1; j > 0; j--)
    {
      if(A[j] < A[j-1])
      {
        swap(A[j], A[j-1]);
        cnt++;
        flag = 1;
      }
    }
  }
  trace(A, N);
  cout << cnt << endl;
}


int main(int argc, char const *argv[]) {
  int array[100];
  int N;
  cin >> N;
  for(int i = 0; i < N; i++) cin >> array[i];

  bubbleSort(array, N);

  return 0;
}


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

#define FIO    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

void solve()
{
	string s;
	cin>>s;
	long long int sum=0, i=0;
	while(i<s.length())
	{
		sum+=(s[i]-'0');
		i++;
	}
	if(sum%9)
		cout<<"No";
	else
		cout<<"Yes";
	return;
}

int main()
{    
    FIO;

    int t=1;
    // cin>>t;
    while(t--)
    	solve();

    return 0;
}


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

using namespace std;

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

int main(){
    string str;cin>>str;
    int res=0;
    REP(i,(int)str.length()){
        if(str[i]=='1'){
            res++;
        }
    }
    cout<<res<<endl;
    return 0;
}


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

#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;

// @@ !! LIM()

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

  cpp_int a, b, c; cin >> a >> b >> c;
  if (c < a + b) {
    cout << "No\n";
    return 0;
  }
  cpp_int x = (a + b) * c * 2 + a * b * 4;
  cpp_int y = c * c + (a + b) * (a + b);
  cout << (x < y ? "Yes\n" : "No\n");

  return 0;
}



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

int n, l;

int main(){
	cin >> n >> l;
	if (0 < l) cout << (n-1)*(2*l+n)/2;
	else if (l+n-1 < 0) cout << (n-1)*(2*l+n-2)/2;
	else cout << n*(2*l+n-1)/2;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long 
int calc(int i,int j,int k)
{
		return i*i+j*j+k*k+i*j+i*k+j*k;
}	
signed main()
{
		int n;
		cin>>n;
		int dp[10010]={0};
		for(int i=1;calc(i,1,1)<=n;++i)
				for(int j=1;calc(i,j,1)<=n;++j)
						for(int k=1;;++k)
						{
								int x=calc(i,j,k);
								if(x<=n)
										++dp[x];
								else
										break;
						}
		for(int i=1;i<=n;++i)
				cout<<dp[i]<<endl;




		return 0;
}



Measured memory_bytes: 3700
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
        int a = sc.nextInt();
        String op = sc.next();
        int b = sc.nextInt();
        int ans;
      
        if(op.equals("+")){
          ans = a + b;
        }else{
          ans = a - b;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35612
unittest
{
	assert( [ "4", "2 2 1 3" ].solve == 7 );
	assert( [ "7", "1 1 1 1 1 1 1" ].solve == 6 );
}



import std.algorithm;
import std.container;
import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	as.sort!( ( x, y ) => y < x );
	
	if( as.length == 1 ) return 0;
	if( as.length == 2 ) return as[ 0 ];
	
	auto ans = 0L;
	auto rbt = redBlackTree!( ( x, y ) => y < x, true )( as[ 0 ] );
	foreach( a; as[ 1 .. $ ] )
	{
		auto m = rbt.front;
		rbt.removeFront;
		
		rbt.insert( a );
		rbt.insert( a );
		ans += m;
	}
	return ans;
}


Measured memory_bytes: 25868
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 998244353;
const ll LINF = 1e18;

int main() {
  IOS;
  int n,k; cin >> n >> k;
  vector<int> l(k),r(k);
  REP(i,k) cin >> l[i] >> r[i];

  vector<ll> dp(n+1), dpsum(n+1);
  // マス1から始まるため dp[1] = 1 にする
  dp[1] = 1;
  dpsum[1] = 1; // dpの累積和

  for (int i = 2; i <= n; i++) {
    REP(j,k) {
      int li = max(i-r[j], 1);
      int ri = i-l[j];
      if (ri < 0) continue;

      dp[i] += dpsum[ri] - dpsum[li-1];
      if (dp[i] < 0) dp[i] += MOD;
      else dp[i] %= MOD;
    }
    dpsum[i] = (dpsum[i-1]+dp[i]) % MOD;
  }
  COUT(dp[n]);
  return 0;
}

Measured memory_bytes: 6360
n,m=map(int,input().split())
a=[]
while True:
    try:
        for i in range(n):
            a.append(list(map(int,input().split())))
        b=[int(input()) for j in range(m)]
        for k in range(n):
            q=a[k]
            w=0
            for l in range(m):
                w+=b[l]*q[l]
            print(w)
        
    except:
        break;


Measured memory_bytes: 5984