akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;

template<class T>
T read()
{
    T value;
    std::cin >> value;
    return value;
}
 
template<class F>
void times_do(size_t n, F func)
{
    for(size_t i = 0; i < n; ++i) func();
}
 
template<class T>
vector<T> reads(size_t n)
{
    vector<T> a;
    a.reserve(n);
    times_do(n, [&](){
        a.push_back(read<T>());
    });
    return a;
}

template<class T>
map<T, int> prime_factor(T n) {
  map<T, int> ret;
  for(T i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main()
{
    const auto a = read<int64_t>();
    const auto b = read<int64_t>();
    const auto afs = prime_factor(a);
    const auto bfs = prime_factor(b);
    int count = 1;
    for(auto i : afs)
    {
        if(bfs.find(i.first) != bfs.end())
        {
            count++;
        }
    }
    cout << count << '\n';
    return 0;
}


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

#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

int main() {

    long long int n;
    cin >> n;

    vector< pair< long long int, long long int > > v;
    vector< pair< long long int, long long int > > vv;

    for ( long long int i = 0; i < n; i++ ) {
        string in;
        cin >> in;
        long long int cnt = 0;
        long long int sita = 0;
        for ( long long int i = 0; i < in.size(); i++ ) {
            if ( in[i] == '(' ) cnt++;
            if ( in[i] == ')' ) cnt--;
            sita = min( sita, cnt );
        }
        if ( cnt >= 0 ) {
            v.push_back( make_pair( -sita, cnt ) );
        } else {
            vv.push_back( make_pair( sita - cnt, cnt ) );
        }
    }

    sort( v.begin(), v.end() );
    sort( vv.begin(), vv.end() );

    long long int cnt = 0;
    for ( long long int i = 0; i < v.size(); i++ ) {
        if ( cnt < v[i].first ) {
            cout << "No" << endl;
            return 0;
        } else {
            cnt += v[i].second;
        }
    }
    for ( long long int i = 0; i < vv.size(); i++ ) {
        long long int sita = vv[i].first + vv[i].second;
        if ( cnt < -sita ) {
            cout << "No" << endl;
            return 0;
        } else {
            cnt += vv[i].second;
        }
    }

    if ( cnt == 0 ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;

}


Measured memory_bytes: 19068
/*" بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ -In the name of Allah."
   Never stop chasing!-MD.SOURAV.

   ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
   ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
   ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
   [███████████████████].░░░░░░░░░░░░░░
   ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░
*/

#include <bits/stdc++.h>


#define endl           "\n"
#define MAX            32000
#define F              first
#define S              second
#define sz(x)          x.size()
#define li             long int
#define gcd(a,b)       _gcd(a,b)
#define pb             push_back
#define mp             make_pair
#define asrt(a,n)      sort(a,a+n)
#define MOD 	       1000000007
#define ll             long long int
#define lcd(a,b)       (a*b)/gcd(a,b)
#define mp(x,y)        make_pair(x,y)
#define no             cout<<"NO"<<endl
#define yes            cout<<"YES"<<endl
#define f(i, a, n)     for(int i=a;i<n;i++)
#define test           int t;cin>>t;while(t--)
#define srt(v)         sort(v.begin() , v.end())
#define basrt(a,n)     sort(a,a+n, greater<int>())
#define deb(x)         cout << #x<< ": "<< x<< endl;
#define sumof(x)       accumulate(x.begin(),x.end(),0);
#define rsrt(v)        sort(v.begin(),v.end(),greater<int>())
#define enter(v,n)     for(ll i=0;i<n;i++){ll x;cin>>x;v.pb(x);}
#define unique(v)      v.erase(unique(v.begin(),v.end()),v.end())
#define start          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ignore         cin.ignore (std::numeric_limits<std::streamsize>::max(),'\n');



using namespace std;

double pi=3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664 ;
typedef vector<ll> vll;
typedef vector<int> vii;
typedef map<ll,ll> mllll;
typedef map<char,ll> mchll;
typedef map<string,ll> msll;
typedef vector<pair<ll,ll>> vpllll;
typedef vector<pair<int,int>> vpiiii;

template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v)
{
    os << '{';
    for (const auto &x : v) os << " " << x;
        return os << '}';
}

void solve()
{


     int n,m;
     cin>>n>>m;
     vector<set<int> >v(n);
     int a,b;
     for(int i=0;i<m;i++)
	 {
	 	cin>>a>>b;
	 	a--;
	 	b--;
	 	v[a].insert(b);
	 	v[b].insert(a);
	 }

	 int Max=INT_MIN;
	 vector<int>dist(n,0);
	 for(int i=0;i<n;i++)
	 {
	 	if(dist[i]==1)
		{
			continue;
		}
		queue<int>q;
		q.push(i);
		dist[i]=1;
		int sum=1;
		while(!q.empty())
		{
            int x=q.front();
            q.pop();
            for(auto &sex:v[x])
			{
				if(dist[sex]==1)
				{
					continue;
				}
				dist[sex]=1;
				sum++;
				q.push(sex);

			}
		}
		Max=max(Max,sum);
	 }
	 cout << Max << endl;

















}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll test_case=1;
    //cin>>test_case;
    while(test_case--)
	{
		solve();
	}

	return 0;
}

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

int main(void){
  int N;
  cin>>N;
  
  vector<int> H(N);
  
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  
  int ans=0;
  
  int Max=0;
  
  for(int i=0;i<N;i++){
    if(H[i]>=Max) ans++;
    Max=max(Max,H[i]);
  }
  
  cout<<ans<<endl;
  
  
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;
const int INF = 1001001001;
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; }

struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
 
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(2000005);

mint f2(int n,int k){
  return comb(n+k-1,k-1);
}

mint f(int n,int k){
  if(n==0 && k==0) return 1;
  return f2(n-k,k);
}

int main(){
  int n,k;
  cin >> n >> k;
  for(int i=1;i<=k;i++){
    mint blue = f(k,i);
    mint red = 0;
    {
      red += f(n-k,i-1);
      red += f(n-k,i)*2;
      red += f(n-k,i+1);
    }
    mint ans = red * blue;
    printf("%lld\n",ans.x);
  }
  return 0;
}

Measured memory_bytes: 34200
//g++ -std=c++11 -Wall -O2 -o main.exe main.cpp
//g++ -std=c++14 -Wall -O2 -o main.exe main.cpp
 
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <complex>
#include <numeric>
#include <queue>
#include <stack>
#include <tuple>
//最大公約数: gcd()
//最小公倍数: lcm()

#define ll long long int

using namespace std;

typedef tuple<int, int, int> tup;

template <typename T>
void sortasc(vector<T> &v){ //vectorを昇順にソート
    sort(v.begin(), v.end(), std::greater<int>());
    return;
}
 
template <typename T>
void sortdesc(vector<T> &v){ //vectorを降順にソート
    sort(v.begin(), v.end(), std::less<int>());
    return;
}

//------

bool pairCompare(const tup& firstElof, const tup& secondElof)
{
    return get<2>(firstElof) < get<2>(secondElof);
}

bool pairCompare2(const tup& firstElof, const tup& secondElof)
{
    return get<0>(firstElof) < get<0>(secondElof);
}

int N, M;
vector< tup > P; //P, Y

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

    int t1, t2;
    for(int i = 0; i < M; i++){
        cin >> t1 >> t2;
        P.push_back( tup(i, t1, t2) );
    }

    
    sort(P.begin(), P.end(), pairCompare);

    vector<int> index(M, -1), count(N + 1, 1);
    for(int i = 0; i < M; i++){
        index[get<0>(P[i])] = count[get<1>(P[i])]++;
    }

    sort(P.begin(), P.end(), pairCompare2);

    for(int i = 0; i < M; i++){
        printf("%06d%06d\n", get<1>(P[i]), index[i]);
    }

    return 0;
}

Measured memory_bytes: 3444
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#N = int(input())
s = str(input())

ans = ""
for i in range(len(s)) :
  if (i+1) % 2 != 0 :
    ans += s[i]
print (ans)


Measured memory_bytes: 133512
ans=0

h,w,m=map(int,input().split())
d=list()
from collections import defaultdict
r=defaultdict(int)
c=defaultdict(int)
r=[0]*(h+1)
c=[0]*(w+1)
for i in range(m):
  a,b=map(int,input().split())
  d+=(a,b),
  r[a]+=1
  c[b]+=1
R=max(r)
C=max(c)

x=0
nr=r.count(R)
nc=c.count(C)
for i in range(m):
    a,b=d[i]
    if r[a]==R and c[b]==C:
        x+=1

ans=R+C
if x==nr*nc:
    ans-=1
print(ans)


Measured memory_bytes: 104644
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    if (n % digitsum(n) == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

int main() {
  string n;
  cin >> n;
  int sum = 0;
  bool x = false;
  for(int i = 0; i < n.size(); i++) {
    sum += n.at(i) - 48;
  }
  if(sum % 9 == 0) x = true;
  if(x) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

 ll Euclid(ll m,ll n){
    ll a=min(m,n);
    ll b=max(m,n);
    if(b%a==0){
      return a;
    }else{
      ll c=b%a;
      Euclid(a,c);
    }
  }

int main(){
  ll m,n;
  cin>>m>>n;
  ll a,b,c;
  c=Euclid(m,n);
  a=m/c;
  b=n/c;
  ll d=a*b*c;
  cout<<d<<endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<cmath>
#include<cctype>
#include<stack>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 1000+10;
int main()
{
	int n, l;
	while (cin >> n >> l)
	{
		string s[105];
		for (int i = 0; i < n; i++)
			cin >> s[i];
		sort(s + 0, s + n);
		for (int j = 0; j < n; j++)
			cout << s[j];
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x;
  cin>>x;
  bool c=0;
  for(int n=x;!c;n++){
    c=1;
    for(int i=2;i<n;i++)
      if(n%i==0)
        c=0;
    if(c)
      cout<<n<<endl;
  }
}

Measured memory_bytes: 256
x, y = map(int, input().split())

turu_all = 2 * x
a = y - turu_all
kame = a / 2
turu = x - kame

if x == turu + kame:
    ans = "Yes"
    if turu < 0 or kame < 0 or a%2 != 0:
        ans = "No"

print(ans)

Measured memory_bytes: 9168
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int [n+1];
    for(int i=0;i<=n;i++)
      a[i]=sc.nextInt();
    long ans=0;
    for(int i=0;i<n;i++){
      int x=sc.nextInt();
      long min=Math.min(x, a[i]);
      ans += min;
      x-=min;
      min=Math.min(x, a[i+1]);
      a[i+1] -= min;
      ans += min;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 64400
import std.stdio, std.conv, std.string, std.algorithm, std.array;

void main()
{
        int n, m;

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

        int[] map;
        map.length=n;

        for (int i = 0; i < m; i++) {
                int from, to;
                scanf("%d %d", &from, &to);

                from--;
                to--;

                map[from]++;
                map[to]++;
        }

        foreach(routenum; map) {
                writeln(routenum);
        }

}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int a = in.nextInt();
        int b = in.nextInt();
        int t = in.nextInt();
        out.println((t/a)*b);
    }
    
    /************* SOLUTION ENDS HERE **********/
}

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

using namespace std;

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

  string w;cin>>w;
  int c[30]={0};
  for(int i=0;i<(int)w.length();i++){
      c[w[i]-'a']++;
  }
  bool flag=true;
  for(int i=0;i<30;i++)if(c[i]%2) flag=false;
  if(flag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

class edge;

class vertex{
    public:
        vector<edge*> edges;
        int color;
        vertex(int _color){
            color = _color;
        }
};

class edge{
    public:
        vertex *to;
        edge(vertex *_to){
            to = _to;
        }
};

class list_node{
    public:
        list_node *prev,*next;
        vertex *data;
        list_node(list_node *_prev,list_node *_next,vertex *_data){
            prev = _prev;
            next = _next;
            data = _data;
        }
};

class list{
    public:
        list_node *back,*front;
        list(){
            back = new list_node(0,0,0);
            front = new list_node(0,back,0);
            back->prev = front;
        }
        list_node *get_first(){
            return front->next;
        }
        list_node *get_last(){
            return back->prev;
        }
        void push_back(vertex *data){
            list_node *node = back->prev;
            node->next = new list_node(node,back,data);
            back->prev = node->next;
        }
        bool isEmpty(){
            if(front->next == back) return true;
            return false;
        }
};

int bfs(list l){
    int count = 0;
    list *L = new list[10000];
    L[0] = l;
    int i = 0;
    while(true){
        if(L[i].isEmpty()) break;
        for(list_node *j = L[i].get_first(); j != L[i].back; j = j->next){
            vertex *v = j->data;
            for(int k = 0; k < v->edges.size(); k++){
                vertex *to = v->edges[k]->to;
                if(to->color) continue;
                to->color = 1;
                L[i+1].push_back(to);
            }
        }
        count++;
        i++;
    }
    return count;
}

int main(){
    int H,W,color;
    string str;
    cin >> H >> W;
    list l;
    vertex *A[H+2][W+2];
    for(int i = 0; i <= H+1; i++){
        if(i != 0 && i != H+1) cin >> str;
        for(int j = 0; j <= W+1; j++){
            if(i  == 0 || j == 0 || i == H+1|| j == W+1){
                A[i][j] = new vertex(1);
            }else{
                if(str[j-1] == '.') color = 0;
                else color = 1;
                A[i][j] = new vertex(color);
            }
        }
    }

    for(int i = 1; i <= H; i++){
        for(int j = 1; j <= W; j++){
            if(A[i][j]->color) l.push_back(A[i][j]);
            A[i][j]->edges.push_back(new edge(A[i-1][j]));
            A[i][j]->edges.push_back(new edge(A[i][j+1]));
            A[i][j]->edges.push_back(new edge(A[i+1][j]));
            A[i][j]->edges.push_back(new edge(A[i][j-1]));
        }
    }

    cout << bfs(l)-1 << endl;
    
}

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

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

int main() {
    int N; cin >> N;
    int A[N];
    rep(i, N) cin >> A[i];
    sort(A, A + N);
    int ans = 0;
    rep(i, N){
        ans = gcd(A[i], ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    bool flag = false;
    int cnt = 0;
    int ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        while(a[i]%2 == 0){
            a[i] /= 2;
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
fn read() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let q: Vec<i32> = read()
        .trim()
        .split(' ')
        .map(|x| x.parse().unwrap())
        .collect();
    let n = q[0] as u32;
    let abc = vec![q[1], q[2], q[3]];
    let ls: Vec<i32> = (0..n).map(|_| read().trim().parse().unwrap()).collect();

    let mut ans: i32 = 10000000;
    for permute in 0..(4_usize.pow(n)) {
        let mut mp = 0;

        let mut abc_connect = vec![0; 3];
        let mut r = permute;
        for &l in ls.iter() {
            mp += 10;
            match r % 4 {
                i if i < 3 => abc_connect[i] += l,
                _ => mp -= 10,
            }
            r /= 4;
        }
        if abc_connect.iter().any(|&x| x == 0) {
            continue;
        }

        mp += (0..3).map(|k| (abc[k] - abc_connect[k]).abs()).sum::<i32>() - 30;
        ans = std::cmp::min(ans, mp);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

bool ng(int N, vector<int> &D){
    bool ret = false;
    while(N > 0){
        int a = N % 10;
        rep(i, D.size()){
            if(a == D[i]) {
                ret = true;
                break;
            }
        }
        N /= 10;
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    int K;
    cin >> N >> K;
    vector<int> D(K);
    rep(i, K) cin >> D[i];
    
    while(ng(N, D)){
        N++;
    }
    
    cout << N << endl;
    
    return 0;
}

Measured memory_bytes: 256
package main
import (
    "fmt"
)
    
func main(){
    var R, G, B, N int
    fmt.Scan(&R, &G, &B, &N)
    var ans int
    for i, hoge:=0, 0;R*i<=N;i++{
        hoge = N-R*i
        for hoge>=0{
            if hoge%B ==0 || hoge==0{
                ans++
            }
            hoge -= G
        }
    }
    fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<int> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n;
vll sx,sy,tx,ty;
map<lli,int> m;
mat mt;

lli xf,xt;
lli yf,yt;
lli ans = 0;

int main(){
    cin >> n;
    sx = sy = tx = ty = vll(n);
    for(lli i = 0;i < n;i++) cin >> sx[i] >> sy[i] >> tx[i] >> ty[i];
    for(lli i = 0;i < n;i++){
        m[sx[i]] = 0;
        m[sy[i]] = 0;
        m[tx[i]] = 0;
        m[ty[i]] = 0;
    }
    lli k = 0;
    for(auto itr = m.begin();itr != m.end();itr++){
        itr->second = k++;
    }
    mt = mat(k+1,vector<int>(k+1));
    for(lli i = 0;i < n;i++){
        mt[m[sx[i]]][m[sy[i]]]++;
        mt[m[sx[i]]][m[ty[i]]]--;
        mt[m[tx[i]]][m[sy[i]]]--;
        mt[m[tx[i]]][m[ty[i]]]++;
    }
    for(lli i = 0;i < k;i++) for(lli j = 0;j < k;j++) mt[i][j+1] += mt[i][j];
    for(lli j = 0;j < k;j++) for(lli i = 0;i < k;i++) mt[i+1][j] += mt[i][j];
    /*
    for(lli i = 0;i < k;i++){
        for(lli j = 0;j < k;j++){
            cout << mt[i][j];
        }
        cout << endl;
    }
    */
    for(auto itr = m.begin();;){
        xf = itr->first;
        itr++;
        if(itr == m.end()) break;
        xt = itr->first;
        for(auto jtr = m.begin();;){
            yf = jtr->first;
            jtr++;
            if(jtr == m.end()) break;
            yt = jtr->first;
            if(mt[itr->second-1][jtr->second-1]){
                ans += (xt-xf)*(yt-yf);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 253928
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

using namespace std;
typedef long long ll;
const int maxn = 100005;

int n,a[maxn],L[maxn],R[maxn];
int gcd(int x,int y){
  if(y==0)return x;
  return gcd(y, x%y);
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
#endif
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  L[0]=a[0];
  for(int i=1;i<n;i++){
    L[i]=gcd(L[i-1],a[i]);
  }
  R[n-1] = a[n-1];
  for(int i=n-2;i>=0;i--){
    R[i]=gcd(R[i+1],a[i]);
  }
  int ret = 0;
  for(int i=0;i<n;i++){
    if(i==0)ret=max(ret, R[i+1]);
    else if(i==n-1)ret=max(ret, L[i-1]);
    else ret=max(ret, gcd(L[i-1],R[i+1]));
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <iostream>
#define int long long
using namespace std;
int t, n, k, x[100000], d[99999];
int solve(){
    for(int i=0; i<n-1; i++){
        d[i] = x[i+1] - x[i];
    }
    sort(d,d+n-1);
    int w = 0;
    for(int i=0; i<k-1 && i<n-1; i++){
        w += d[n-2-i];
    }
    return x[n-1] - x[0] - w;
}
void get(){
    cin >> n >> k;
    for(int i=0; i<n; i++){
        cin >> x[i];
    }
}
signed main(){
    cin >> t;
    for(int i=0; i<t; i++){
        get();
        cout << solve() << endl;
    }
}


Measured memory_bytes: 4584
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace C_test_For_Atcorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var a = cin.Read;
            WriteLine(a.Count(x=>x == '1'));
        }
    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue inputStream;

        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return (string)inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return (string)inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }

}


Measured memory_bytes: 11220
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int loopNum = scanner.nextInt();
		for (int i = 0; i < loopNum; i++) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			int c = scanner.nextInt();

			if (isTriangle(a, b, c)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}

	private static boolean isTriangle(int a, int b, int c) {
		if ((a + b + c) % 4 != 0 && (a + b + c) % 12 != 0) {
			return false;
		}

		if (a >= b && a >= c) {
			return a * a == b * b + c * c;
		} else {
			if (b >= c) {
				return b * b == a * a + c * c;
			} else {
				return c * c == a * a + b * b;
			}
		}
	}
}

Measured memory_bytes: 23400
n=gets.to_i
ans=1
flag=0
a=gets.chomp.split.map(&:to_i)
n.times do |i|
  if flag==0 then
    ans=ans*a[i]
    if ans>1000000000000000000||ans<0 then
      ans=0
      flag=1
    end
  else
    if a[i]==0 then
      flag=0
    end
  end
end
if flag==1 then
  puts -1
else 
  p ans
end



Measured memory_bytes: 23592
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define END system("PAUSE");return 0
int n, m, x, y, a[111111];
signed main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> x >> y;
		a[x - 1]++, a[y - 1]++;;
	}
	rep(i, n) {
		if (a[i] % 2) {
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	END;
}


Measured memory_bytes: 1272
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <ctime>
#include <unordered_map>
#include <iomanip>
#include <complex>
#include <cassert>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define deb(a) cerr<< #a << "= " << (a)<<"\n";

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef complex<double> base;
typedef vector<int> vi;
typedef pair<int,int> pii;

template<class T> ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream; }
ll fpow(ll x, ll p, ll m){ll r=1; for (;p;p>>=1){ if (p&1) r=r*x%m; x=x*x%m; } return r;}
ll inv(ll a, ll b){ return a<2 ? a : ((a-inv(b%a,a))*b+1)/a %b; }
int gcd(int a, int b){ if (!b) return a; return gcd(b,a%b);}
ll gcd(ll a, ll b){ if (!b) return a; return gcd(b,a%b);}

ll N,t[120000][2],T; bool f[120000];
ll L;

string s; ll root=0;

ll val=0;

void ins(ll &nod, ll p, string &s){
	if (nod==0)
		nod=++T;
	
	if (p==s.length()){
		f[nod]=1;
		return;
	}
	
	ins(t[nod][s[p]-'0'],p+1,s);
}

void addv(ll d){
	ll b=(d&-d);
	
	val^=b;
}

void dfs(ll nod, ll d){
	if (f[nod]) return;
	
	int i;
	for (i=0; i<2; i++)
		if (t[nod][i]==0){
			ll id=L-d-1;
			addv(id+1);
		}
		else dfs(t[nod][i],d+1);
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> L;
	
	int i;
	for (i=1; i<=N; i++){
		cin >> s;
		ins(root,0,s);
	}
	
	dfs(root,0); bool ans=0;
	if (val!=0) ans=1;
	
		
	cout << (ans ? "Alice\n" : "Bob\n");
	return 0;
}


Measured memory_bytes: 6736
#include <stdio.h>

int main()
{
	int n=0;
	scanf("%d",&n);
	int _4m=0,_2m=0,_1m=0;	
	for(int i=0;i<n;i++)
	{
		int input=0;
		scanf("%d",&input);
		if(input&1)
		{
			_1m++;
		}
		else if(input%4==0)
		{
			_4m++;
		}
		else
		{
			_2m++;
		}
	}
	if(_1m>_4m+1||(_1m==_4m+1&&_2m!=0)) printf("No\n");
    else printf("Yes\n");
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll a, b;
        in >> a >> b;
        string ans = "";
        if ((a < 0 && 0 < b) || a == 0 || b == 0) {
            ans = "Zero";
        }
        else if (0 < a) {
            ans = "Positive";
        }
        else {
            if ((b - a + 1) % 2 == 0) {
                ans = "Positive";
            }
            else {
                ans = "Negative";
            }
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 256
while True:
    count = 0
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break

    for i in range(1, n + 1):
        for j in range(i+1, n + 1):
            for k in range(j+1, n + 1):
                if x == (i + j + k):
                    count += 1
    print(count)


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

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) return 0;

    int magic[n][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
	magic[i][j] = -1;
      }
    }

    magic[n / 2 + 1][n / 2] = 1;
    int x = n / 2 + 1;
    int y = n / 2;
    for (int i = 2; i <= n * n; i++) {
      x++;
      y++;
      if (y >= n) y = 0;
      else if (y < 0) y = n - 1;
      if (x >= n) x = 0;
      else if (x < 0) x = n - 1;

      while (magic[x][y] != -1) {
	x++;
	y--;
	if (x >= n) x = 0;
	if (y < 0) y = n - 1;
      }
      magic[x][y] = i;
    }

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
	printf("%4d", magic[i][j]);
      }
      putchar('\n');
    }
  }
}

Measured memory_bytes: 3120
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>

using namespace std;

using uif=uint_fast64_t;

int main(void){

  vector<uif> a(4);
  for(uif i=0;i<4;i++){
    cin>>a[i];
  }

  sort(a.begin(),a.end());

  if(a[0]==1 && a[1] == 4 && a[2] == 7 && a[3] == 9){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;

  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>

using namespace std;

int hei[1005];

int main(void)
{
	int n,t,a; scanf("%d %d %d",&n,&t,&a);
	for(int i=0;i<n;i++)
		scanf("%d",&hei[i]);
	a *= 1000; t *=1000; int ans; int mn = 1000000000;
	for(int i=0;i<n;i++)
	{
		if(mn>abs(t-6*hei[i]-a))
		{
			ans=i;
			mn = abs(t-6*hei[i]-a);
		}
	}
	printf("%d",ans+1);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <math.h>
using namespace std;

int main(int argc, const char * argv[]) {
    double n,k;
    cin >> n >> k;
    int ans;
    double d = (double)((n - 1) / (k - 1));
    ans = (int)ceil(d);
    cout << ans << endl;
}



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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >
int ans = 1;
int n, k;
void dfs(int now, int jisuu, vector<vec>& tree, vector<bool>& used) {
    used[now] = true;
    ans *= (k - jisuu) > 0 ? (k - jisuu) : 0;
    ans %= MOD;

    int sz = tree[now].size();
    int kai = 0;
    rep (i, sz) {
        if (not used[tree[now][i]]) {
            kai++;
            dfs(tree[now][i], (jisuu > 0 ? kai + 1 : kai), tree, used);
        }
    }
}

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    cin >> n >> k;
    vector<vec> tree(n + 1, vec());
    vector<bool> used(n + 1);
    int a, b;
    rep (i, n - 1) {
        cin >> a >> b;
        tree[a].pb(b);
        tree[b].pb(a);
    }
    dfs(1, 0, tree, used);
    print(ans % MOD);

    return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    bool a[4];
    a[0]=a[1]=a[2]=a[3]=true;
    int ans=0;
    char s[100];
    for(int i=0;i<n;i++)
    {
        scanf("%s",s);
        if(s[0]==' ') continue;
        char c=s[0];
        if(c=='G'&&a[0]) a[0]=false,ans++;
        if(c=='P'&&a[1]) a[1]=false,ans++;
        if(c=='Y'&&a[2]) a[2]=false,ans++;
        if(c=='W'&&a[3]) a[3]=false,ans++;
    }
    if(ans==3) printf("Three\n");
    else printf("Four\n");
    return 0;
}


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

int main() {
  string n, result = "No";
  
  cin >> n;
  
  for (int i = 0; i < n.size(); i++) {
    if (n[i] == '7') {
      result = "Yes";
      break;
    }
  }
  
  cout << result << endl;
}


Measured memory_bytes: 3628
A1 = 0
B1, B2, B3 = map(int, input().split())
C1, C2, C3 = map(int, input().split())
D1, D2, D3 = map(int, input().split())
flag = 0
if not( C2-B2 == C1-B1 and C3-B3 == C1-B1 and C2-B2 == C3-B3):
    flag = 1
if not( D2-B2 == D1-B1 and D3-B3 == D1-B1 and D2-B2 == D3-B3):
    flag = 1
print("Yes" if flag == 0 else "No")

Measured memory_bytes: 9120
#include<stdio.h>
int main() {
  double xa, ya, ra, xb, yb, rb, r;
  int N, s;
  scanf("%d", &N);
  for (s = 0; s < N; s ++) {
    scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
    r = (xa - xb) * (xa - xb) + (ya - yb) * (ya - yb);
    if (r > ra * ra + 2 * ra * rb + rb * rb) printf("0\n");
    else if (r >= ra * ra - 2 * ra * rb + rb * rb) printf("1\n");
    else {
      if (ra > rb) printf("2\n");
      else printf("-2\n");
    }
  }
  return 0;
}

Measured memory_bytes: 620
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

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

int main(){
    int n,k,s;
    cin >> n >> k >> s;

    rep(i,n){
        if(i < k){
            cout << s << " ";
        }else{
            if(s != 1e9)
                cout << s + 1 << " ";
            else 
                cout << 1 << " ";
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1280
N, M = map(int, input().split())
A = [[0 for _ in range(M)] for _ in range(N)]
for i in range(N):
  A[i] = [int(x) - 1 for x in input().split()]
S = [[0, i] for i in range(M)]
for a in A:
  S[a[0]][0] += 1
minmax = N
for _ in range(M - 1):
  _S = sorted(S, reverse=True)
  s = _S[0][1]
  minmax = min(S[s][0], minmax)
  S[s][0] = -1
  for a in A:
    if S[a[0]][0] > 0:
      continue
    while S[a[0]][0] < 0:
      a.pop(0)
    S[a[0]][0] += 1
print(minmax)

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

int main(){
    
    ios_base::sync_with_stdio(NULL);
    int n;
    cin>>n;
    int arr[n];
    long xoor=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        xoor ^= arr[i];
    }
    for(int i=0;i<n;i++){
        cout<<(arr[i]^xoor)<<" ";
    }

}

Measured memory_bytes: 4368
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<ll, ll> ii;

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void File()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
	/*freopen("output.txt", "w", stdout);
	freopen("pyramid.in", "r", stdin);*/
#endif
}
void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
	//File();
}
const double pi = 2 * acos(0.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 1e5 + 15;
int dx[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };
int dy[8] = { 0, 0, 1, -1, 1, -1, -1, 1 };

int n, k;
vector<pair<int, int>>v;
ll dp[100][nn];
ll solve(int idx, int w)
{
	if (idx >= n)
		return 0;
	ll &ret = dp[idx][w];
	if (~ret)
		return ret;
	ret = solve(idx + 1, w);
	if (w >= v[idx].first)
		ret = max(ret, solve(idx + 1, w - v[idx].first) + v[idx].second);
	return ret;
}
int main()
{
	fast();
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back(mk(x, y));
	}
	memset(dp, -1, sizeof(dp));
	cout << solve(0, k) << endl;
	return 0;
}

Measured memory_bytes: 78464
/*
Miles Morales : When will I know I'm ready?
Peter B. Parker : You won't. It's a leap of faith. That's all it is, Miles. A leap of faith.
*/
//KEEP IT SIMPLE STUPID
/*#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define print(o) for(auto it=(o).begin();it!=(o).end();it++) cout<<*it<<" ";
#define vll vector<ll>
#define pb push_back
#define FOR(n) for(ll i=0;i<=n;i++)
#define FORd(n) for(ll i=n;i>=0;i--)
#define FORrd(a,b) for(ll i=a;i>=b;i--)
#define FORr(a,b) for(ll i=a;i<=b;i++)
#define all(x) (x).begin(),(x).end()
#define FIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define ff first
#define ss second
#define w(t) ll t;cin>>t;while(t--)

int main()
{
    ll n,m;
    cin>>n>>m;
    string s(n,'.');
    for(ll i=0;i<m;i++)
    {
        ll j;
        char c;
        cin>>j>>c;
        j--;
        if(j>n-1)
        {
            cout<<-1<<'\n';
            return 0;
        }
        if(s[j]!='.')
        {
            if(s[j]!=c)
            {
                cout<<-1<<'\n';
                return 0;
            }
        }
        else{
            if(j==0&&n>=2)
            {
                if(c=='0')
                {
                    cout<<-1<<'\n';
                    return 0;
                }
            }
            s[j]=c;
        }
    }
    for(ll i=1;i<n;i++)
    {
        if(s[i]=='.')
            s[i]='0';
    }
    if(s[0]=='.')
    {
        if(n>=2)
            s[0]='1';
        else{
            s[0]='0';
        }
    }
    cout<<s;
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 256
n = int(input())
m = list(map(int, input().split()))
s = list(map(int, input().split()))
atk = 0
for i, e in enumerate(s):
    rem = e
    am = m[i]
    am2 = m[i+1]
    m[i] = max(0, am - rem)
    rem -= am - m[i]
    m[i+1] = max(0, am2 - rem)
    rem -= am2 - m[i+1]
    atk += e - rem
print(atk)

Measured memory_bytes: 19156
N = int(input())
L = [0,0,0,0]
S = N*[0]
for i in range(N):
    S[i] = input()
    if S[i]=="AC":
        L[0]+=1
    elif S[i]=="WA":
        L[1]+=1
    elif S[i]=="TLE":
        L[2]+=1
    else:
        L[3]+=1
print(f"AC x {L[0]}")
print(f"WA x {L[1]}")
print(f"TLE x {L[2]}")
print(f"RE x {L[3]}")

Measured memory_bytes: 16184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto a = (b); (a) < (c); ++(a))
#define F0R(a, b) FOR (a, 0, (b))
#define CEIL(a, b) ((a) + (b)-1) / (b)
template <class T>
bool ckmin(T& a, const T& b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
  if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << mt(__VA_ARGS__) << "] "
template <typename T>
struct IsC {
  template <typename C>
  static char test(typename C::const_iterator*);
  template <typename C>
  static int test(...);
  static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
  static const bool value = false;
};
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream&, const C&);
template <typename T1, typename T2>
ostream& operator<<(ostream&, const pair<T1, T2>&);
template <typename... T> using TS = tuple_size<tuple<T...>>;
template<size_t idx, typename... T>
typename enable_if<TS<T...>::value == idx + 1, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return o << ", " << get<idx>(t) << ')';
}
template<size_t idx, typename... T>
typename enable_if<0 < idx && idx + 1 < TS<T...>::value, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << ", " << get<idx>(t), t);
}
template<size_t idx = 0, typename... T>
typename enable_if<1 < TS<T...>::value && !idx, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << '(' << get<idx>(t), t);
}
template<typename T>
ostream& operator<<(ostream& o, const tuple<T>& t) {
  return o << get<0>(t);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p) {
  return o << mt(p.fi, p.se);
}
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(
    ostream& o, const C& c) {
  o << '[';
  for (auto it = c.cbegin(); it != c.cend(); ++it)
    o << *it << (next(it) != c.cend() ? ", " : "");
  return o << ']';
}
template <typename T>
void tprint(vector<vector<T>>& v, size_t width = 0, ostream& o = cerr) {
  if (!DEBUG) return;
  for (const auto& vv : v) {
    for (const auto& i : vv) o << setw(width) << i;
    o << endl;
  }
}

void solve() {
    int x;
    cin >> x;
    if(x >= 30)
        cout << "Yes\n";
    else
        cout << "No\n";
}

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

    int tc = 1;
    FOR(i, 1, tc + 1) {
        //cout << "Case #" << i << ": ";
        solve();
    }
}



Measured memory_bytes: 3656
/*
 * main.c
 *
 *  Created on: 2019/02/24
 *      Author: family
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int a[9] = {111, 222, 333, 444, 555, 666, 777, 888, 999};

int main()
{
	int n = 0;
	int i = 0;
	scanf("%d",&n);

	for(i = 0; i < 9; i++) {
		if (n <= a[i]) {
			break;
		}
	}
	printf("%d\n", a[i]);
	return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    cout << "Christmas";
    for (int i = 0; i < 25 - n; i++)
    {
        cout << " Eve";
    }

    /* code */
    return 0;
}


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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

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

  if ( a >= 13 ) cout << b << endl;
  else if ( a <= 5 ) cout << 0 << endl;
  else cout << b/2 << endl;
  
  return 0;
}


Measured memory_bytes: 256