akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define debug(output) cout<<#output<<"= "<<output<<endl
using ll = long long;
using lint = long long;
typedef pair<int,int> P;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  int n,k;cin>>n>>k;
  mcf_graph<lint,lint> g(n*2+2);
  lint MxCost=1e10;
  rep1(i,n){
      rep1(j,n){
          int a;cin>>a;
          g.add_edge(i,n+j,1,MxCost-a);
      }
  }
  rep1(i,n){
      g.add_edge(0,i,k,0);
      g.add_edge(i+n,2*n+1,k,0);
  }
  auto nxt=g;
  auto slope=g.slope(0,2*n+1);
  lint mx=0;lint FlowLimit=0;
  for(auto p:slope){
      if(mx<p.first*MxCost-p.second){
          mx=p.first*MxCost-p.second;
          FlowLimit=p.first;
      }
      //debug(mx);
      //debug(FlowLimit);
  }
  nxt.flow(0,2*n+1,FlowLimit);
  vector<string> t(n);
  rep(i,n){
      rep(j,n){
          t[i]+='.';
      }
  }
  auto edges=nxt.edges();
  cout<<mx<<"\n";
  for(auto e:edges){
      if(e.from==0||e.to==2*n+1)continue;
      if(e.flow==1){
          t[e.from-1][e.to-1-n]='X';
      }
  }
  rep(i,n)cout<<t[i]<<"\n";
  return 0;
}

Measured memory_bytes: 4128
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <functional>
#include <numeric>
#include <cassert>
#include <algorithm>
#include <functional>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)

#define huge 1000000007
typedef long long int ll;
ll gcd(ll a, ll b);
ll bur(ll N, ll X);
bool IsPrime(int num);

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll D = 0;
	ll P = 0;
	//ll T = 0;
	//ll M = 0;
	ll h[1000] = {};
	//ll b[100] = {};
	//ll c[100] = {};
	//ll d[100] = {};

	//ll v[3] = {};
	//ll *c, *s, *n;
	string S[50],T[50],U[52];
	ll count = 0;
	ll count2 = 0;
	float sum = 0;
	ll min = 1000000000000;
	ll max = 1;
	ll smax = 0;
	ll max2 = 0;
	ll smax2 = 0;
	int tmax = 0;
	int tmax2 = 0;
	//int flag = 0;
	char temp,head;
	//int is = 0;
	bool flag = false;
	
	//char p;

	ll all = 0;
	ll niku = 0;
	ll state = 2;
	bool down = true;
	

	//cin >> S;
	
	vector<pair<int,int>> ch(1000);
	
	

	cin >> A >> B >>C;
	
	count += B;

	if (A + B >= C)
		count += C;
	else
		count += (A+B+1);

	cout << count<< endl;
	

	//x = (ll *)malloc((N+1) * sizeof(ll));
	//c = (ll *)malloc((N) * sizeof(ll));
	//cin >> D >> G;
	//vector<pair<int,int>> tr(M);
	//vector<pair<int,int>> qes(Q);
	//sort(c.begin(), c.end());
	
	//cout << c[2] - c[1] << endl;

	
	/*A = N / 1000;
	N %= 1000;
	B = N / 100;
	N %= 100;
	C = N / 10;
	N %= 10;
	D = N;*/
	


	//cin >> N >> M;

	//vector<pair<int,int>> c(M);
	////vector<pair<int, int>> e(M);
	//vector<ll> d(M);

	//rep(i, 0, M) {
	//	cin >> c[i].first >> c[i].second;
	//	//e[i].first = c[i].first;
	//	//e[i].second = c[i].second;

	//}
	////sort(c.begin(), c.end());

	//

	//rep(i, 0, M) {

	//	
	//	
	//	rep(j, 0, M) {
	//		if (c[i].first == c[j].first && c[j].second < c[i].second) {
	//			d[i]++;
	//			//cout << j << endl;
	//		}
	//	}
	//	cout << std::setfill('0') << std::right << std::setw(6) << c[i].first;
	//	cout << std::setfill('0') << std::right << std::setw(6) << d[i]+1 << endl;
	//}

	return 0;

}

ll bur(ll N,ll X) {
	ll pan = 1;
	ll pat = 1;
	ll burg = 0;



	if (X > burg) {
		if (N == 0)
			return pat;


		burg += pan;
		burg += bur(N - 1, X);
		burg += pat;
		burg += bur(N - 1, X);
		burg += pan;


	}

	return burg;

}

ll gcd(ll a, ll b) {
	
	/* 自然数 a > b を確認・入替 */
	if (a<b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}
	ll x = b;
	ll y = a;
	/* ユークリッドの互除法 */
	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}


	return y/b*x;
}

bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                                                       \
    for(long long hoge = 0; (hoge) < (n); ++(hoge))                            \
    cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX / 2;
const ll MOD = 1e9 + 7;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    pair<ll, ll> AB[N];
    for(int i = 0; i < N; i++) {
        cin >> AB[i].first >> AB[i].second;
    }
    sort(AB, AB + N);
    priority_queue<ll> Q;
    ll ans = 0;
    int i = 0;
    for(int j = M; j >= 0; j--) {
        while(i < N && j + AB[i].first <= M) {
            Q.push(AB[i++].second);
        }
        if(!Q.empty()) {
            ans += Q.top();
            Q.pop();
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2936
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

long GCD(long a, long b) {
    if (b % a) return GCD(b % a, a);
    else return a;
}

long LCM(long a, long b) {
    return a / GCD(a, b) * b;
}

int main() {
    long a, b;
    while(cin >> a >> b) {
        cout << GCD(a,b) << " " << LCM(a,b) << endl;
    }
    return 0;
}

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

#define NIL NULL

struct node{
  int key;
  struct node *right;
  struct node *left;
  struct node *parent;
};

typedef struct node * Node;

Node root;

void insert(int k){

  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));

  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x; 
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }
  z->parent = y;
 
  if(y == NIL){
    root = z;
  }
  else if(z->key < y->key){
    y->left = z; 
  }
  else{
    y->right = z;
  }
}


Node treeMinimum(Node x){
  while(x->left != NIL)
    x = x->left;
  }

void inorder(Node x){
  if(x != NIL){
    inorder(x->left);
    printf(" %d",x->key);
    inorder(x->right);
  }

}
void preorder(Node x){

  if(x != NIL){
    printf(" %d",x->key);
    preorder(x->left);
    preorder(x->right);
  }
}

int main(){

  int n,i,x;
  char com[20];
  root = NIL;
  scanf("%d",&n);
 
for ( i = 0; i < n; i++ ){
    scanf("%s", com);
   
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
 }
 return 0;
}

Measured memory_bytes: 24040
N = int(input())
cnt = [0]*N
for x in range(1,100):
  for y in range(1,100):
    for z in range(1,100):
      s = x**2+y**2+z**2+x*y+y*z+z*x
      if s <= N:
        cnt[s-1] += 1     
for i in cnt:print(i)

Measured memory_bytes: 9256
import java.util.*;
 
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str1 = sc.next();
        String str2 = sc.next();
        String str3 = sc.next();
        
        str1 = str1.substring(0,1);
        str2 = str2.substring(0,1);
        str3 = str3.substring(0,1);
        
        str1 = str1.toUpperCase();
        str2 = str2.toUpperCase();
        str3 = str3.toUpperCase();
        
        System.out.println(str1+str2+str3);
    }
}

Measured memory_bytes: 39088
from collections import deque
dq = deque()
for mak in range(int(input())) :
    com = input().split()
    if   com[0] == 'insert'      : dq.appendleft(com[1])
    elif com[0] == 'deleteFirst' : dq.popleft()
    elif com[0] == 'deleteLast'  : dq.pop()
    else : 
        if com[1] in dq :
            dq.remove(com[1])
print(' '.join(dq))

Measured memory_bytes: 71692
#include <bits/stdc++.h>
using namespace std;
#define NDEBUG
#include <cassert>
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define clr(ar,val) memset(ar, val, sizeof(ar))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;
using ll = long long;
using Double = long double ;
using ull = unsigned long long;
using ii = pair<int,int>;
using llll = pair<ll,ll>;
using dd = pair<double,double>;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;
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; }
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
template<typename T, typename U>
void print1(T Array, U size) {
  for (int i = 0; i < size; i++) {
    cout << Array[i] << " ";
  }
  cout << endl;
}

template<typename T>
void print(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}
 
// ------------------------------------------------------------------------------------------
 
int a, b, c;
// vector<int> X;
signed main() {
  cin >> a >> b >> c;
  int d = b / a;
  if (d < c)
  {
      cout << d << endl;
  } else {
    cout << c << endl;
  }
 
  return 0;
}

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

int main()
{
    int n, m;
    int i, j, key;
    
    cin >> n >> m;
    
    int a[n], b[n], c[m], d[m], min[n], ans[n];
    
    for(i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    
    for(j = 0; j < m; j++) {
        cin >> c[j] >> d[j];
    }
    
    for(i = 0; i < n; i++) {
        
        min[i] = 500000000;
        
        for(j = 0; j < m; j++) {
            
            key = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if(key < min[i]) {
                min[i] = key;
                ans[i] = j+1;
            }
        }
        
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int a[105][105],n,A,B,flg;
char c[2]={'.','#'};
int main(){
  scanf("%d%d",&A,&B);
  if(A>B) swap(A,B), flg=1;
  A--;
  for(int i=1;i<=100&&B;i+=4)
    for(int j=1;j<=100&&B;j+=4){
      B--; for(int t=0;t<=2;t++) a[i][j+t]=a[i+1][j+t]=a[i+2][j+t]=1;
      if(A) a[i+1][j+1]=0, A--;
    }
  printf("100 100\n");
  for(int i=1;i<=100;i++){
    for(int j=1;j<=100;j++) putchar(c[a[i][j]^flg]);
    putchar('\n');
  }
  return 0;
}


Measured memory_bytes: 256
// 未解決

#include <bits/stdc++.h>

#include <iostream>
using namespace std;

#define EACH(i, a) for (auto &&i : a)
#define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RFOR(i, a, b) for (int i = (int)b - 1; i >= (int)a; --i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREPS(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(x) (x).begin(), (x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define debug(x) cout << #x << ": " << x << endl

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF (1L << 30)
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

template <class T>
void pv(T a, T b) {
  for (T i = a; i != b; ++i) cout << *i << " ";
  cout << endl;
}
template <class T>
void pvp(T a, T b) {
  for (T i = a; i != b; ++i)
    cout << "(" << i->first << ", " << i->second << ") ";
  cout << endl;
}
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;
}
int in() {
  int x;
  scanf("%d", &x);
  return x;
}

using ll = long long;
#define int ll

//**********

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

  int k, a, b;
  cin >> k;
  cin >> a >> b;
  if (a / k == b / k) {
    if (a % k == 0 || b % k == 0) {
      cout << "OK" << endl;
    } else {
      cout << "NG" << endl;
    }
  } else {
    cout << "OK" << endl;
  }

  return 0;
};


Measured memory_bytes: 3636
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        val m = sc.nextInt()
        val ls1 = mutableListOf<Int>()
        val hsn = hashSetOf<Int>()
        for (i in 0 until m) {
            val a = sc.nextInt()
            val b = sc.nextInt()
            if (a == 1) ls1.add(b)
            if (b == 1) ls1.add(a)

            if (a == n) hsn.add(b)
            if (b == n) hsn.add(a)
        }

        for (i in ls1.indices) {
            if(hsn.contains(ls1[i])){
                println("POSSIBLE")
                return
            }
        }

        println("IMPOSSIBLE")
    }
}

class MyScanner {
    private var ptr = 0
    private var l = listOf<String>()

    fun next(): String {
        while (l.size <= ptr) {
            l = readLine()!!.split(' ')
            ptr = 0
        }
        return l[ptr++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun list(): List<String> {
        ptr = l.size
        return readLine()!!.split(' ')
    }

    fun intList() = list().map { s -> s.toInt() }
    fun longList() = list().map { s -> s.toLong() }
    fun doubleList() = list().map { s -> s.toDouble() }

    fun array() = list().toTypedArray()
    fun intArray() = intList().toIntArray()
    fun longArray() = longList().toLongArray()
    fun doubleArray() = doubleList().toDoubleArray()
}


Measured memory_bytes: 68100
#include <stdio.h>

int main() {
    int N, M;
    scanf("%d%d", &N, &M);
    int x[100010] = {};
    for (int i = 0; i < M; i++) {
        int L, R;
        scanf("%d%d", &L, &R);
        x[L]++;
        x[R + 1]--;
    }
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        x[i] += x[i - 1];
        if (x[i] == M) ans++;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 512
/*
doge
░░░▄░░░░░░░░░░░░░░▄
░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌
░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐
░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌
░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌
░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐
░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌
░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌
▀▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒
*/
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <cassert>
#include <iomanip>
#include <random>

using namespace std;

#define ll long long
#define ld long double
#define null NULL

const ll INF = 1e18 + 228;


ll a[228228];


signed main() {
	int n;
	scanf("%d", &n);
	ll sum = 0LL;
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
		sum += a[i];
	}
	ll now = 0LL;
	ll minim = INF;
	for (int i = 1; i < n; ++i) {
		now += a[i];
		ll sec = sum - now;
		if (abs(now - sec) < minim) {
			minim = abs(now - sec);
		}
	}
	cout << minim << endl;
    return 0;
}













Measured memory_bytes: 1792
require 'pp'
n, m = gets.split.map(&:to_i)
a = []
b = []
n.times do
  a << gets.chomp.chars
end
m.times do
  b << gets.chomp.chars
end
# puts a.map(&:join).join("\n")
# puts
# puts b.map(&:join).join("\n")
# puts
arr = []
0.upto(n-1) do |i|
  0.upto(n-1) do |ii|
    # puts a[i..(b.size-1)].map{|x|x[ii..(b.size-1)]}.map(&:join).join("\n")
    next if (i + b.size-1) >= n || (ii + b.size-1) >= n
    arr << (a[i..(i + b.size-1)].map{|x|x[ii..(ii + b.size-1)]} == b)
  end
end
puts arr.any?{|x|x} ? 'Yes' : 'No'


Measured memory_bytes: 2300
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  string S,ans="AC";
  cin>>S;
  int N=S.size();
  bool flag=0;
  if(S[0]!='A')
    ans="WA";
  if('a'>S[1]||S[1]>'z')
    ans="WA";
  int count=0;
  rep(i,2,N-1){
    if(S[i]=='C'){
      count++;
      if(count==2){
        ans="WA";
        break;
        }
      }
    else if(S[i]<'a'||'z'<S[i]){
      ans="WA";
      break;
      }
    }
  if(count==0)
    ans="WA";
  if(S[N-1]<'a'||'z'<S[N-1])
    ans="WA";
  cout<<ans;
  }


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
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; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b;
	cin >> a >> b;
	ll tmpa = a, tmpb = b;
	rep(i, tmpa-1) {
		b += tmpb*pow(10, i+1);
	}
	rep(i, tmpb-1) {
		a += tmpa * pow(10, i+1);
	} 
	string s1 = to_string(a);
	string s2 = to_string(b);
	if (s1 == s2)return cout << s1 << endl,0;
	else if (s1 < s2)return cout << s1 << endl,0;
	else return cout << s2 << endl,0;
}

Measured memory_bytes: 384
import sys
from collections import defaultdict
input = sys.stdin.readline
h,w,m=map(int, input().split())
hd=[0 for i in range(h+1)]
wd=[0 for i in range(w+1)]
hw=defaultdict(int)
hmax=0
wmax=0
for i in range(m):
    h0,w0=map(int, input().split())
    hd[h0]+=1
    hmax=max(hmax,hd[h0])
    wd[w0]+=1
    wmax=max(wmax,wd[w0])
    hw[(h0,w0)]+=1

max_h_list=[]
max_w_list=[]
for k in range(h+1):
    if hd[k]==hmax:
        max_h_list.append(k)

for k in range(w+1):
    if wd[k]==wmax:
        max_w_list.append(k)

ans=float('inf')

for x in max_h_list:
    for y in max_w_list:
        if hw[(x,y)]==1:
            ans=min(ans,1)
        else:
            ans=min(ans,0)
            break
print(hmax+wmax-ans)


Measured memory_bytes: 183404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll s;
	cin>>s;
	ll x[3]={},y[3]={0,1};
	x[1]=1e9;
	y[2]=(s+x[1]-1)/x[1];
	x[2]=x[1]*y[2];
	x[2]-=s;
	for(int i=0;i<3;++i)
		cout<<x[i]<<" "<<y[i]<<" ";
	return 0;
}

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

using namespace std;

typedef unsigned long long int ull;

int main() {
  ios::sync_with_stdio(false); cin.tie(); cout.tie();
  ull A, B, N, X;
  cin >> A >> B >> N;

  X = min(B-1, N);

  cout << ((ull)(A*X/B) - (ull)((A * (ull)(X/B)))) << endl;
  
  return 0;
}


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

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N, A;
	cin >> N;
	vector<int> v(N);
	rep(i, N) {
		cin >> A;
		v[i] = A;
	}
	int i = 0, result = 0;
	while (v[i] % 2 == 0) {
		v[i] /= 2;
		i++;
		if (i == N - 1) {
			result++;
			i = 0;
		}
	}
	cout << result << "\n";
}

Measured memory_bytes: 256
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
P = 0
N = int(input())
ans = 0
mp =[]
for i in range(N):
	a = int(input())
	mp.append([])
	for j in range(a):
		(s,t) = (int(i) for i in input().split(" "))
		mp[-1].append([s-1,t])
#print(mp)
for P in range(1 << N):
	p_num = P
	pp = []
	for i in range(N):
		pp.append(p_num&1)
		p_num >>= 1
	p_len = sum(pp)
	##print(pp)
	ch = True
	for i in range(N):
		for info in mp[i]:
			if pp[i]==1 and (pp[info[0]] != info[1]):
				ch = False
				break
	#print(ch)
	if ch and p_len > ans:
		ans = p_len
print(ans)


Measured memory_bytes: 4332
#include <iostream>
#include <vector>

using namespace std;



int main () {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    int ans_w = 0, ans_s = 0;
    for (int w = 0; w <= F; w += 100) {
        for (int s = 0; s <= F; s ++) {
            if (w + s <= F && 100 * s <= E * w) {
                bool flag = true;
                bool flag1 = false, flag2 = false;
                for (int c = 0; c*C <= s; c ++) {
                    if ((s - c*C) % D == 0) flag1 = true;
                }   
                int ww = w / 100;
                for (int a = 0; a*A <= ww; a ++) {
                    if ((ww - a*A) % B == 0) flag2 = true;
                }   
                if (flag1 && flag2) {
                    if (s * ans_w >= w * ans_s) {
                        ans_w = w;
                        ans_s = s;
                    }   
                }   
            }   
        }   
    }   
    cout << ans_s+ans_w << ' ' << ans_s << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

void makePrimeNumber(int N, vector<bool>& prime)
{
    prime.assign(N+1, true);
    prime [0] = prime[1] = false;
    for(int i=2; i*i<=N; i++){
        if(prime[i]){
            for(int j=i; i*j<=N; j++){
                prime[i*j] = false;
            }
        }
    }
}

int main()
{
    const int MAX = 1000000;

    vector<bool> prime;
    makePrimeNumber(MAX, prime);

    vector<int> num(MAX+1, 0);
    for(int i=1; i<=MAX; ++i){
        num[i] = num[i-1];
        if(prime[i])
            ++ num[i];
    }

    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        int ret = -n;
        for(int i=0; i<n; ++i){
            int p, m;
            cin >> p >> m;
            int a = max(1, p-m);
            int b = min(MAX, p+m);
            ret += num[b] - num[a-1];
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	long long H,W;
	long long s1,s2,s3,ans,sc;
	ans=10000000;
	cin>>H>>W;
	for(long long i=1;i<H;i++){
		s1 = W*i;
		s2 = (H-i)*(W/2);
		s3 = (H-i)*(W-(W/2));
		sc = max(abs(s1-s2),abs(s2-s3));
		sc = max(sc,abs(s1-s3));
		ans = min(sc,ans);
	}
	for(long long i=1;i<H;i++){
		s1 = W*i;
		s2 = ((H-i)/2)*W;
		s3 = (H-i-((H-i)/2))*W;
		sc = max(abs(s1-s2),abs(s2-s3));
		sc = max(sc,abs(s1-s3));
		ans = min(sc,ans);
	}
	


	for(long long i=1;i<W;i++){
		s1 = H*i;
		s2 = (W-i)*(H/2);
		s3 = (W-i)*(H-(H/2));
		sc = max(abs(s1-s2),abs(s2-s3));
		sc = max(sc,abs(s1-s3));
		ans = min(sc,ans);
	}
	for(long long i=1;i<H;i++){
		s1 = H*i;
		s2 = ((W-i)/2)*H;
		s3 = (W- i -((W-i)/2))*H;
		sc = max(abs(s1-s2),abs(s2-s3));
		sc = max(sc,abs(s1-s3));
		ans = min(sc,ans);
	}

	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 1 << 25;

struct SegmentTree {
  int n;
  vector<int> dat;
  SegmentTree(const vector<int> &init) {
    n = 1;
    while (n < init.size()) n *= 2;
    dat.resize(2 * n - 1, INF);
    for (int i = 0; i < init.size(); i++) {
      dat[i + n - 1] = init[i];
    }
    for (int i = n - 2; i >= 0; i--) {
      dat[i] = min(dat[i * 2 + 1], dat[i * 2 + 2]);
    }
  }
  int query(int a, int b, int k, int l, int r) const {
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return dat[k];
    int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return min(vl, vr);
  }
  int query(int a, int b) const { return query(a, b, 0, 0, n); }
};

struct Enclosure {
  int s, t, a, b, v;
  bool operator<(const Enclosure &other) const { return v > other.v; }
};

int main() {
  int N;
  while (cin >> N) {
    vector<int> p(N);
    for (int i = 0; i < N; i++) {
      cin >> p[i];
    }
    vector<int> even, odd;
    map<int, int> mp;
    for (int i = 0; i < N; i++) {
      if (i % 2 == 0) {
        even.push_back(p[i]);
      } else {
        odd.push_back(p[i]);
      }
      mp[p[i]] = i;
    }
    SegmentTree evenRMQ(even), oddRMQ(odd);
    auto findSmallestPair = [&](int s, int t) {
      const SegmentTree &rmq1 = s % 2 == 0 ? evenRMQ : oddRMQ;
      const SegmentTree &rmq2 = s % 2 == 0 ? oddRMQ : evenRMQ;
      int a = mp[rmq1.query(s / 2, t / 2)];
      int b = mp[rmq2.query((a + 1) / 2, (t + 1) / 2)];
      return make_pair(a, b);
    };
    auto newEnclosure = [&](int s, int t) {
      auto ps = findSmallestPair(s, t);
      return Enclosure{s, t, ps.first, ps.second, p[ps.first]};
    };
    priority_queue<Enclosure> pq;
    pq.push(newEnclosure(0, N));
    while (!pq.empty()) {
      auto e = pq.top();
      pq.pop();
      cout << p[e.a] << " " << p[e.b] << " ";
      if (e.s < e.a) {
        pq.push(newEnclosure(e.s, e.a));
      }
      if (e.a + 1 < e.b) {
        pq.push(newEnclosure(e.a + 1, e.b));
      }
      if (e.b + 1 < e.t) {
        pq.push(newEnclosure(e.b + 1, e.t));
      }
    }
    cout << endl;
  }
  return 0;
}


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

int main(){
	int N;
	int r=0;
	int b=0;
	string s;
	cin>>N;
	cin>>s;
	for(int i=0;i<N;++i){
		if(s[i]=='R')r++;
		else b++;
	}
	if(r>b)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	mochis := make([]int,n)
	for i := 0; i < n; i++ {
		var d int
		fmt.Scan(&d)
		mochis[i] = d
	}
	sort.Sort(sort.Reverse(sort.IntSlice(mochis)))

	ans := 1
	tmp := mochis[0]
	for i := 1; i < len(mochis); i++ {
		if tmp <= mochis[i] {
			continue
		}
		tmp = mochis[i]
		ans++
	}

	fmt.Println(ans)
}

Measured memory_bytes: 512
#include <cstdio>
#include <cmath>
#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
#include <ctime>
#include <set>
#include <sstream>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
int x,y;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>x>>y;
	if(x%y==0)
		printf("-1\n");
	else
		printf("%d\n",x);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<numeric>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

void printAns(int a) { cout << a << endl; }

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

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

ll INF = 10000000;
ll mod = 1000000007;//10^9+7


ll multi(ll A,ll B, ll M){
    ll L;
    if(A%M==0){L=A/M;}else{L=A/M+1;}
    ll R=B/M;
    return R-L+1;
}

ll lcm(ll a, ll b){
    if(a<b){ll tmp=a;a=b;b=tmp;}
    ll x=a*b;
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return x/b;
}

//番号ズレ注意！！
int main() {
    ll A,B,C,D;
    cin>>A>>B>>C>>D;
    cout<<B-A+1-multi(A,B,C)-multi(A,B,D)+multi(A,B,lcm(C,D));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

ll x, y, ans;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> x >> y;
    while (x <= y) {
        x *= 2;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
mx = 0
for i in range(1, int(M**0.5)+1)[::-1]:
    if M % i == 0 and M // i >= N:
        mx = max(mx, i)
    if M % i == 0 and i >= N:
        mx = max(mx, M//i)
print(mx)

Measured memory_bytes: 38896
#include <bits/stdc++.h>
#define ll long long int
#define M 1000000007

using namespace std;

const int mxN=1e3,mxX=1e5;

int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    int dp[n];
    for(int i = 0; i<n; i++)
        cin>>a[i];
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    for(int i = 1; i<n; i++)
    {
        dp[i] = INT32_MAX;
        for(int j = max(i-k,0); j<i; j++)
            dp[i] = min(dp[i],(dp[j]+abs(a[i]-a[j]))); 
    }
    // for(int i = 0; i<n; i++)
    //     cout<<dp[i]<<" ";
    // cout<<endl;
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 4408
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

struct items{
    ll t, v;
};
static const ll MAX = 100001;

bool asc( const items& left, const items& right ) {
    return left.v == right.v ? left.t >= right.t : left.v >= right.v;
}
int main() {
    

    ll n,k;
    cin >> n >> k;
    vector <items> lis, rem;//lis: 原数据;
	//rem:第一个值中除m值外的其他值 
    vector <ll> memo;//没有使用的过的m值 
    ll exist[MAX] = {};//标记 
    ll eachmax[MAX] = {};//每项最大 
    for (ll i=0;i<n;i++){
        items p;
        cin >> p.t >> p.v;
        lis.push_back(p);
    }
    sort(lis.begin(), lis.end(), asc);
   // reverse(lis.begin(), lis.end());
    ll per = 0;
    for(ll i=0;i<n;i++){
        if(eachmax[lis[i].t] < lis[i].v){
            eachmax[lis[i].t] = lis[i].v;
        }
    } 
    ll numt = 0;
    for(ll i=0;i<k;i++){//计算第一个值 
        per += lis[i].v;
        if(exist[lis[i].t] == 0){//没用过的种类+1 
            numt++;
        }else{
            rem.push_back(lis[i]);
			//其他数据另存，准备替换 
        }
        exist[lis[i].t] = 1;
    }
    reverse(rem.begin(), rem.end());
    ll ans = 0;
    if(ans < per + numt*numt){
        ans = per + numt*numt;
    }
    for (ll i=0;i<n;i++){//统计没有使用过的m值 
        if(exist[i] == 0 and eachmax[i] > 0){
            memo.push_back(eachmax[i]);
        }
    }
    sort(memo.begin(), memo.end());
    reverse(memo.begin(), memo.end());
    
    //替换 
    for(ll i = 0;i<min(memo.size(), rem.size());i++){
        per -= rem[i].v;
        per += memo[i];
        numt++;
        if(ans < per + numt*numt){
            ans = per + numt*numt;
        }
    }
    cout << ans << endl;
}




Measured memory_bytes: 5104
# encoding: utf-8
S = input()

words = S.replace("d", " d").lstrip().split()

ans = "NO"
for word in words:
    word_tmp = word
    while len(word_tmp) > 0:
        if word_tmp[-6:] == "eraser":
            word_tmp = word_tmp[:-6]
        elif word_tmp[-5:] == "erase":
            word_tmp = word_tmp[:-5]
        elif word_tmp[-7:] == "dreamer":
            word_tmp = word_tmp[:-7]
        elif word_tmp[-5:] == "dream":
            word_tmp = word_tmp[:-5]
        else: break
    else:
        continue
    break
else: ans = "YES"

print(ans)

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N,a=0;
	cin>>N;
	for(int i=1;i<=N;i++)
	{
		int j=10,b=0;
		while(1)
		{
			b++;
			if(i/j==0) break;
			j*=10;
		}
		if(b%2==1) a++;
	}
	cout<<a;
	return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())
a = set([1, 3, 5, 7, 8, 10, 12])
b = set([4, 6, 9, 11])
c = set([2])

if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include <iostream>
 
using namespace std;
 
int main()
{
    int n, s, t, c, p, f;
    cin >> n;
     
    while(n--){
        s = f = t = 0;
        for(int i = 0; i < 10; i++){
            cin >> p;
            if(p < s && p < t){
                f = 1;
            } else if(p > s){
                s = p;
            } else if(p > t){
                t = p;
            } else {
                f = 1;
            }
        }
        if(f == 0){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
     
    return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>

int main(){
int i,j,c,n,m;
static int a[100][100],b[100];

scanf("%d%d",&n,&m);

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

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

for(i=0;i<n;i++){
c = 0;
for(j=0;j<m;j++)
c += a[i][j] * b[j];
printf("%d\n",c);
}

return 0;
}

Measured memory_bytes: 640
primes = [2]

def is_prime(num):
    root = num ** 0.5
    for prime in primes:
        if root < prime:
            break
        if num % prime == 0:
            return False
    return True

def create_primes(primes, max):
    for i in range(primes[-1] + 1,max):
        if is_prime(i):
            primes += [i]

create_primes(primes, 10000)

n = int(input())
count = 0
for _ in range(n):
    num = int(input())
    count += 1 if is_prime(num) else 0
print(count)

Measured memory_bytes: 6848
#include <bits/stdc++.h>
#define maxn 205
#define MP make_pair
#define PB push_back
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define forn(i, n) fore(i, 0, n)

#define sz(a) int((a).size())

using namespace std;

mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
// shuffle(begin, end, rnd), rnd() % n

typedef long long ll;
typedef pair<int, int> PII;

const ll modulo = 1000000007ll;
ll factorial[maxn];
ll revfac[maxn];
vector<int> S;

PII gcd(ll a, ll b){
    if(b == 0) return {1LL, 0LL};
    PII q = gcd(b, a % b);
    return {q.second, q.first - q.second * (a / b)};
}

ll mul(ll a, ll b) {
    return (a*b)%modulo;
}

ll myPow(ll num, ll k) {
    ll ans = 1ll;
    while (k != 0ll) {
        if (k & 1ll)
            ans = mul(ans, num);
        num = mul(num, num);
        k >>= 1;
    }
    return ans;
}

ll reverse(ll num){
    PII tmp = gcd(num,modulo);
    return ((tmp.first % modulo) + modulo) % modulo;
}

ll C(ll a, ll b){
    if (a < b)
        return 0;
    return (factorial[a]*reverse((factorial[b]*factorial[a-b]) % modulo)) % modulo;
}

ll state[maxn][100005];

ll cnt(int x, int len) {
    if (x == 0 || len == 0)
        return x;

    if (state[len][x] != -1)
        return state[len][x];

    ll ans = 0ll;
    for (int i = 0; i < len; ++i) {
        // if (S[i] > x) {
        //     ans += ((factorial[len] * revfac[i]) % modulo) * cnt(x, i);
        //     ans %= modulo;
        //     break;
        // }
        ans += ((factorial[len-1] * revfac[i]) % modulo) * cnt(x % S[i], i);
        ans %= modulo;
    }
    state[len][x] = ans % modulo;

    return state[len][x];
}

int main() {
    factorial[0] = 1ll;
    revfac[0] = 1ll;
    for (int i = 1; i < maxn; ++i) {
        factorial[i] = (factorial[i-1] * i) % modulo;
        revfac[i] = reverse(factorial[i]) % modulo;
    }
    for (int i = 0; i < maxn; ++i) {
        for (int j = 0; j < 100005; ++j)
            state[i][j] = -1;
    }

    int N, X;
    cin >> N >> X;
    int s;
    forn (i, N) {
        cin >> s;
        S.PB(s);
    }
    sort(S.begin(), S.end());
    ll ans = 0ll;
    if (S[0] == 1) {
        printf ("0\n");
        return 0;
    }
    ans = cnt(X, N);

    printf ("%lli\n", ans);

    return 0;
}



Measured memory_bytes: 160384
#include <bits/stdc++.h>      
#define pb push_back 
#define fr first 
#define sc second
#define len(s) s.size()
#define MOD 1000000007
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define f(i,a,n) for(int i=a;i<n;i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef map<int,int> mii; 

void solve() {
	
}

int main() {

    /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif  */
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;

    //int n,q;
    //cin>>n>>q;
    //while(n--) { solve(); }
    string s,t;
    cin>>s>>t;
    if(len(s)+1!=len(t)) cout<<"No";
    else {
    	for(int i=0;i<len(s);i++) if(s[i]!=t[i]) {
    		cout<<"No";
    		return 0;
		}
		cout<<"Yes";
	}
    return 0 ;
}

Measured memory_bytes: 3616
#include<stdio.h>
 
#define N 101
 
int num,M[N][N];
int color[N],d[N],f[N],T;
 
void visit(int);
 
int main(){
  int i,j,v,next,k;
 
  scanf("%d",&num);
 
  for(i=0;i<num;i++){
    color[i] = 0;
      for(j=0;j<num;j++){
    M[i][j] = 0;;
      }
  }
     
  for(i = 0;i<num;i++){
    scanf("%d %d",&v,&k);
    for(j=0;j<k;j++){
      scanf("%d",&next);
      M[v-1][next-1] = 1;
    }
  }
  for(i = 0;i<num;i++){
    if(color[i]==0)visit(i);
  }
 
  for(i=0;i<num;i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }
  return 0;
}
 
void visit(int u){
 
  int i;
  color[u]=1;
  d[u]=++T;
  for(i=0;i<num;i++){
    if(M[u][i] == 0)continue;
      if(color[i] == 0)visit(i);
    }
    
    
  color[u] = 2;
  f[u] = ++T;
}
  


Measured memory_bytes: 2108
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <bitset>
#include <stack>
#include <deque>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 2345;
const LL MOD = 998244353;
char s[MAXN];
LL dp[2 * MAXN][2 * MAXN];
bool visit[2 * MAXN][2 * MAXN];
LL inv[2 * MAXN], fac[2 * MAXN];

LL dfs(int x, int y, int N) {
   if (x + y == N) {
      LL tmp = (fac[x + y] * inv[x]) % MOD;
      return (tmp * inv[y]) % MOD;
   }
   int cur = (x + y + 1);
   if (s[cur] == '0') x += 2;
   else if (s[cur] == '1') x++, y++;
   else y += 2;
   if (visit[x][y]) return dp[x][y];
   visit[x][y] = 1;
   LL sum = 0;
   if (x >= 1) sum = dfs(x - 1, y, N);
   if (y >= 1) sum = (sum + dfs(x, y - 1, N)) % MOD;
   return dp[x][y] = sum;
}


void init() {
     inv[0] = fac[1] = inv[1] = 1;
     for (int i = 2; i < MAXN * 2; i++) {
         LL tmp = (-(MOD / i) * inv[MOD % i]) % MOD;
         tmp += (tmp / MOD + 1) * MOD;
         inv[i] = tmp;
     }
     for (int i = 2; i < MAXN * 2; i++) inv[i] = (inv[i - 1] * inv[i]) % MOD;
     for (int i = 2; i < MAXN * 2; i++) fac[i] = (fac[i - 1] * i) % MOD;
}

int main() {
    init();
    scanf("%s", s + 1);
    int N = strlen(s + 1);
    printf("%lld\n", dfs(0, 0, N));
    return 0;
}


Measured memory_bytes: 86400
# -*- coding: utf-8 -*-
import math
import sys
input = sys.stdin.readline


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))

    total = 0
    for i in range(m):
        total += a[i]

    if n - total >= 0:
        print(n - total)
    else:
        print(-1)


if __name__ == '__main__':
    main()


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

#define forn(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vii;


int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);	
        ll n,w;
        cin>>n>>w;
        vector<ll> dp(w+1);
        forn(i,n){
            ll weight,value;
            cin>>weight>>value;
            for(int i=w-weight;i>=0;i--){
                dp[i+weight]=max(dp[i+weight],dp[i]+value);
            }
        }
        ll ans=0;
        for(int i=1;i<=w;i++){
            ans=max(ans,dp[i]);
        }
        cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

vector<ll> x;
vector<ll> x2;

ll N, M;

int main(){
    cin >> N >> M;
    for(int i = 1; i*i <= M; i++){
        if(i * i == M){
            x.push_back(i);
        }
        else if(M % i == 0){
            x.push_back(i);
            x2.push_back(M/i);
        }
    }

    for(int i = x2.size()-1; i >= 0; i--){
        x.push_back(x2[i]);
    }

    int res=1;
    for(int i = x.size()-1; i >= 0; i--){
        if(x[i]*N <= M){
            res = x[i];
            break;
        }
    }

    cout << res << 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;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1)res=res*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}

int main(){
    int n,k;
    cin>>n>>k;
    ll ans=0;
    for(int i=1;i<=k;++i){
        int t=k/i;
        vector<ll> num(t+1,0);
        for(int j=t;j>=1;--j){
            num[j]=modpow(t/j,n);
            for(int x=j+j;x<=t;x+=j){
                num[j]=(num[j]-num[x])%mod;
            }
        }
        ans=(ans+num[1]*i)%mod;
    }
    ans=(ans+mod)%mod;
    cout<<ans<<endl;
}


Measured memory_bytes: 4024
//Decision's template
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<set>
using namespace std;

#define maxn 100000
#define INF 10000007
#define MOD 1000000007
#define mst(s,k) memset(s,k,sizeof(s))

typedef long long ll;

struct Edge{
    int from,to,dist;
    Edge(int u,int v,int d):from(u),to(v),dist(d){}
};

/*-------------------------------template End--------------------------------*/

double ans = 0.0,tmp;
string type;
int n;

int main(){
	cin>>n;
	for(int i = 1;i<=n;i++){
		cin>>tmp>>type;
		if(type == "JPY") ans += tmp;
		else ans += 380000.0 * tmp;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import math
N = int(input())
A_array = list(map(int, input().split()))

A_array.sort()

ans = 0

if A_array[0] == 1:
    if N >= 2 and A_array[1] != 1 or N == 1:
        print(1)
    else:
        print(0)
    exit()


ng_array = [0] * (10 ** 6)


for i, a in enumerate(A_array):
    if i != 0 and a == A_array[i - 1]:
        continue
    j = 2
    while a * j <= 10 ** 6:
        ng_array[a * j - 1] = 1
        j += 1


for i in range(N):
    a = A_array[i]
    if i != 0:
        if A_array[i] == A_array[i - 1]:
            continue
    if i != N - 1:
        if A_array[i] == A_array[i + 1]:
            continue
    if ng_array[a-1] == 0:
        ans += 1
print(ans)


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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> vec1;
    vector<int> vecn;
    REP(i,m){
        int a,b;
        cin >> a >> b;
        if(a==1)vec1.push_back(b);
        if(b==n)vecn.push_back(a);
    }
    sort(vec1.begin(),vec1.end());
    sort(vecn.begin(),vecn.end());
    int index = 0;
    for(int i=0;i<vec1.size();i++){
        for(int j=index;j<vecn.size();j++){
            if(vec1[i]==vecn[j]){
                COUT("POSSIBLE");
                return 0;
            }
            if(vec1[i]>vecn[j]){
                index = j;
            }
            if(vec1[i]<vecn[j]) break;
        }
    }
    COUT("IMPOSSIBLE");
    return 0;
}  


Measured memory_bytes: 1276
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	k := intScanner()
	as := make([]int, n)
	for i := 0; i < n; i++ {
		as[i] = intScanner() - 1
	}
	p := make([]int, n)
	for i := 0; i < n; i++ {
		p[i] = -1
	}
	p[0] = 0
	temp := 0
	for i := 1; ; i++ {
		if k <= n {
			temp = as[temp]
			k--
			if k == 0 {
				fmt.Println(temp + 1)
				break
			}
		} else {
			temp = as[temp]
			if p[temp] == -1 {
				p[temp] = i
				k--
			} else {
				k--
				k %= i - p[temp]
				if k == 0 {
					fmt.Println(temp + 1)
					break
				}
			}
		}
	}
}


Measured memory_bytes: 6440