akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
    int i,j;
    int n;
    string s;
    cin >> s;
    if(s[0]=='9' || s[1] == '9')cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */
 
    //#pragma comment(linker, ack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    
    #define TRACE
    
    #ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
      cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    #else
    #define trace(...)
    #endif
    
    #define rep(i, n)    for(ll i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(ll i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    //#define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    // #define te    
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 100100;

    void solve() {
        ll n, ind = 0;
        cin >> n;
        ll x[n], y[n], h[n];
        rep(i, n){
            cin >> x[i] >> y[i] >> h[i];
            if(h[i] > 0) ind = i;
        } 
        rep(xi, 101) rep(yi, 101){
            ll check = 1;
            ll hei = h[ind] + abs(xi - x[ind]) + abs(yi - y[ind]);
            rep(i, n) if( max(0ll, hei - abs(xi - x[i]) - abs(yi - y[i])) != h[i] ) {
                //cout << xi << " " << yi << " " << i << endl;
                check = 0;
            }
            if(check) {
                cout << xi << " " << yi << " " << hei << endl;
                return;
            }
        }
    }
 
    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
       // ll ti;   cin >> ti;  while(ti--)
      solve();
      return 0;
    } 

Measured memory_bytes: 256
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(D)]
G /= 100
C = 2e3
N = len(pc)
for i in range(2 ** N):
    p = 0
    c = 0
    for j in range(N):
        if i >> j & 1:
            p += pc[j][0] * (j + 1) + pc[j][1] / 100
            c += pc[j][0]
    if p >= G:
        C = min(c, C)
        continue
    for j in range(N-1, -1, -1):
        if not i >> j & 1:
            for k in range(pc[j][0] - 1):
                p += j + 1
                c += 1
                if p >= G:
                    break
        if p >= G:
            break
    if p >= G:
        C = min(c, C)
        continue

print(C)

Measured memory_bytes: 3064
#include<stdio.h>

#define N 2000001
#define MAX 10000

int A[N], B[N], C[MAX];

int main(void){
    int n;
    for(int i=0; i<MAX; i++){
        C[i]=0;
    }
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d", &A[i+1]);
        C[A[i+1]]++;
    }
    for(int i=1; i<MAX; i++){
        C[i]+=C[i-1];
    }
    for(int j=1; j<=n; j++){
        B[C[A[j]]]=A[j];
        C[A[j]]--;
    }
    for(int i=1; i<n; i++){
        printf("%d ",B[i]);
    }
    printf("%d\n",B[n]);

    return 0;

}




Measured memory_bytes: 17432
#include<stdio.h>
int a[100001],b[100001];
int main(void)
{
	int i,n,m;
	scanf("%d",&n);
	for(i=1;i<=n;i++) b[i]=0;
	for(i=1;i<=n;i++) scanf("%d",&a[i]);
	i=1;
	m=0;
	b[i]=1;
	while(1){
		if(i==2){
			printf("%d\n",m);
			break;
		}
		if(m==n){
			printf("-1\n");
			break;
		}
		if(b[i]==1){
			b[i]=0;
			b[a[i]]=1;
			i=a[i];
		}
		m++;
	}
	return 0;
}

Measured memory_bytes: 896
#include <cstdio>
#include <vector>

const int MN = 200005;

int N, X, Y, Ans;
std::vector<int> G[2][MN];

int par[MN], dep[MN];
void DFS0(int u, int p) {
	dep[u] = dep[par[u] = p] + 1;
	for (int v : G[1][u]) if (v != p) DFS0(v, u);
}

void DFS1(int u, int p, int d) {
	int win = 0;
	Ans = std::max(Ans, dep[u]);
	for (int v : G[0][u]) if (v != p) {
		if (u == par[v] || v == par[u] || u == par[par[v]] || v == par[par[u]] || par[u] == par[v]) {
			if (d + 1 < dep[v]) DFS1(v, u, d + 1);
		} else { win = 1; break; }
	}
	if (win) Ans = N;
}

int main() {
	scanf("%d%d%d", &N, &X, &Y);
	for (int o = 0; o < 2; ++o)
		for (int i = 1, x, y; i < N; ++i)
			scanf("%d%d", &x, &y),
			G[o][x].push_back(y),
			G[o][y].push_back(x);
	dep[0] = -1, DFS0(Y, 0);
	DFS1(X, 0, 0);
	printf("%d\n", Ans == N ? -1 : 2 * Ans);
	return 0;
}

Measured memory_bytes: 36492
#include<stdio.h>
int main(){
  char s[100001];
  scanf("%s",s);
  int a=1,b=0;
  while(s[a]!='\0'){
    if(s[a-1]!=s[a]){
      b++;
    }
    a++;
  }
  printf("%d",b);
  return 0;}

Measured memory_bytes: 256
from collections import deque

q = int(input())

L = deque()
pointer = 0

for i in range(q):
    query = input().split()

    if query[0] == "0":
        L.appendleft(int(query[1]))
    elif query[0] == "1":
        pointer += int(query[1])
        L.rotate(-int(query[1]))
    else:
        L.popleft()
L.rotate(pointer)
for i in L:
    print(i)


Measured memory_bytes: 21668
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        long total = 0;

        int cc = c + c;
        int ab = a + b;
        int aa = a + a;
        int bb = b + b;
        while (x > 0 || y > 0) {

            if (x > 0 && y > 0) {
                if (cc < ab) {
                    total += cc;
                } else {
                    total += ab;
                }
                x -= 1;
                y -= 1;
            } else if (x > 0) {
                if (cc < a) {
                    total += cc;
                } else {
                    total += a;
                }
                x -= 1;
            } else {
                if (cc < b) {
                    total += cc;
                } else {
                    total += b;
                }
                y -= 1;
            }

        }

        System.out.println(total);

    }
}


Measured memory_bytes: 21844
using System;
using System.Text;
using System.Collections.Generic;
namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            Dictionary<string, string> pattern = new Dictionary<string, string> {
                { "A", "1100000011"                },
                { "B", "1000000010000000100000001" },
                { "C", "1111"                      },
                { "D", "1000000110000001"          },
                { "E", "11000000011"               },
                { "F", "100000001100000001"        },
                { "G", "110000011"                 },
                
            };
            string input;
            while((input = Console.ReadLine()) != null) {
                StringBuilder figure = new StringBuilder(input);
                for(int i=0; i < 7; ++i) {
                    figure.Append(Console.ReadLine());
                }
                Console.ReadLine();
                foreach(var item in pattern) {
                    if(figure.ToString().Contains(item.Value)) {
                        Console.WriteLine(item.Key);
                        break;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 6160
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000; 
int main(){
	int R[MAX],n;
	cin >> n ;
	for ( int i = 0 ; i<n ;i++) cin >> R[i];
	
	int minv = R[0];
	int maxv = -2000000000;
	
	for ( int i = 1; i<n ; i++){
		maxv = max(maxv,R[i]-minv);
		minv = min(minv , R[i]);
	}
	cout << maxv <<endl;
	 
   	return 0;
}

Measured memory_bytes: 3824
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int FindRoad(const vector<vector<int> >& road, int x, int y);

int h,w;
int n;
int dummy = 0;
int result = 0;

int main(void) {
  int x,y;
  vector<vector<int> > road(18,vector<int>(18));
  cin >> w >> h;
  while(w != 0 && h != 0) {
    cin >> n;
    for(int i = 0; i < n; i++) {
      cin >> x >> y;
      road[x][y] = 1;
    }
    cout << FindRoad(road,1,1) << endl;
    for(int x = 0; x < 18; x++) {
      for(int y = 0; y < 18; y++) {
        if(road[x][y] == 1)
          road[x][y] = 0;
      }
    }
    result = 0;
    cin >> w >> h;
  }
  return 0;
}

int FindRoad(const vector<vector<int> >& road, int x, int y) {
  if( (x - 1 == w || y - 1 == h) || road[x][y] == 1) return 0;
  if( x == w && y == h) { result++; return result; }
  dummy = FindRoad( road, x, y + 1);
  dummy = FindRoad( road, x + 1, y);
  return result;
}

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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

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

ll F[510][510];
ll H, W;

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


int main(int argc, char **argv)
{
	cin >> H >> W;
	REP(h, H)REP(w, W)
		cin >> F[h][w];


	ll h{0}, w{0};
	ll dh{1}, dw{1};
	bool is_to{false};
	vector<vector<ll>> rv;
	
	while (true)
	{
		if (F[h][w]&1)
		{
			is_to ^= true;
		}

		ll nh = h + dh;
		ll nw;
		
		if (nh < 0 || nh >= H)
		{
			dh *= -1;
			nw = w + dw;
			nh = h;

			if (nw >= W) break;
		}
		else
		{
			nw = w;
		}

		if (is_to)
		{
			vector<ll> tmp{h, w, nh, nw};
			rv.push_back(tmp);
		}

		h = nh;
		w = nw;
	}

	std::cout << rv.size() << std::endl;

	for (auto &v : rv)
	{
		REP(i, 4)
			std::cout << (i?" ":"") << 1+v[i];
		std::cout << std::endl;
	}
}


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

#define repr(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define irepr(i,a,b) for(int i=a, i##_len=(b); i>=i##_len; --i)
#define irep(i,n) for(int i=n; i>=0; --i)

#define printline(str) cout << str << "\n"

#define lint long long


template<size_t nDigits, int mod>
struct Mod{
  int surplus[nDigits][10];
  constexpr Mod():surplus(){
    surplus[0][0]=0;
    surplus[0][1]=1%mod;
    for( size_t i = 0; i < 10; ++i){
      surplus[0][i] = i%mod;
    }
    for(size_t i = 1; i < nDigits; ++i){
      surplus[i][0] = 0;
      surplus[i][1] = (10*surplus[i-1][1])%mod;
      for( size_t j = 2; j < 10; ++j){
        surplus[i][j] = (j*surplus[i][1])%mod;
      }
    }
  }
};

constexpr auto numMod13 = Mod<100000, 13>();

constexpr int maxInt = 1000000000 + 7;

array<lint, 100000*100> memo;

lint f(int digits, int mod, int nums[]){
  if( memo[digits*100+mod] != -1){
    return memo[digits*100+mod];
  }
  if( digits == 0){
    if( nums[digits] == -1){
      rep(i,10){
        if( i%13 == mod){
          return memo[digits*100+mod] = 1;
        }
      }
      return 0;
    }else{
      if( nums[digits]%13 == mod){
        //printline(digits << " " << nums[digits] << " " << mod);
        return memo[digits*100+mod] = 1;
      }
      return memo[digits*100+mod] = 0;
    }
  }
  if( nums[digits] == -1){
    lint ret = 0;
    rep(i,10){
      ret += f(digits-1, (13 + mod-numMod13.surplus[digits][i])%13, nums)%maxInt;
      ret %= maxInt;
    }
    return memo[digits*100+mod] = ret;
  }else{
    return memo[digits*100+mod] = f(digits-1, (13 + mod-numMod13.surplus[digits][nums[digits]])%13, nums)%maxInt;
  }
}



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int numS[100000];
  int N = S.size();;
  irep(i, N-1){
    if( S[i] == '?'){
      numS[N-1-i] = -1;
    }else{
      numS[N-1-i] = (int)(S[i] - '0');
    }
  }
  fill(memo.begin(), memo.end(), -1);
  printline(f(N-1, 5, numS));
}

Measured memory_bytes: 86864
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

const int MAX = 5100000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

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

int main(){
  int n; cin >> n;
  vector<vector<pii>> G(n);

  rep(i,n) {
    int a; cin >> a;
    rep(j,a) {
      int x,y; cin >> x >> y;
      x--;
      G[i].pb(mp(x,y));
    }
  }
  

  int ans = 0;
  rep(bit,(1<<n)){
    int cnt = 0;
    bool ok = true;
    rep(j,n){
      if(bit & (1 << j)){
        cnt++;
        for(auto c : G[j]) {
          int x = c.first;
          int y = c.second;
          if((bit & (1 << x))){
            //if(bit == 4) printf("%d %d %d\n", j, x, y);
            if(y == 0) ok = false;
          }
            
          else if(y == 1){
            //if(bit == 4) printf("%d %d %d\n", j, x, y);
            if(y == 1) ok = false; 
          }
        }
      }
    }
    //if(cnt == 1 && ok) cout << bit << endl;
    if(ok) chmax(ans, cnt);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
if __name__ == "__main__":
    K = int(input())
    A, B = list(map(int, input().split()))
    flag = False
    for i in range(A, B+1):
        if i % K == 0:
            flag = True
            break
    if flag:
        print('OK')
    else:
        print('NG')



Measured memory_bytes: 9108
#include<bits/stdc++.h>
#define MAX 100005
#define pb push_back
#define mp make_pair
#define pii pair<long long,long long>
#define read(a) scanf("%d",&a)
#define p1(a) cout<<"Check "<<a<<endl;
#define p2(a,b) cout<<"Check "<<a<<' '<<b<<endl;
#define p3(a,b,c) cout<<"Check "<<a<<' '<<b<<' '<<c<<endl;
#define fo(i,n) for(i=0;i<n;i++)
#define ll long long
#define clr(a) memset(a,0,sizeof(a))
#define MOD 10000000000
#define INF 10000000000000;

using namespace std;

int n,cp;
ll cost[MAX];
int weight[MAX];
ll dp[105][MAX];

ll f(){
    for(int i=1;i<=n;i++){
        for(int j=1;j<=cp;j++){
            if(weight[i-1]<=j){
                dp[i][j]=max(dp[i-1][j],cost[i-1]+dp[i-1][j-weight[i-1]]);
            }
            else dp[i][j]=dp[i-1][j];
        }
    }
    return dp[n][cp];
}

int main()
{
    cin>>n>>cp;
    for(int i=0;i<n;i++){
        scanf("%d%lld",&weight[i],&cost[i]);
    }
    for(int i=0;i<=cp;i++){
        dp[0][i]=0;
    }
    for(int i=0;i<=n;i++){
        dp[i][0]=0;
    }
    ll ans=f();

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 80128
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	public static void main(String[] args) {
		int a=scan.nextInt();
		System.out.println("ABC"+a);
	}
}


Measured memory_bytes: 23764
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Main main = new Main();
        // for (int i = 1; i < 30; i++) {
        // for (int j = 1; j < 30; j++) {
        // int ans = main.solveEachB(i, j);
        // int debugAns = solveDebug(i, j);
        // if (ans != debugAns) {
        // System.out.printf("%s:%s:%s:%s\n", i, j, ans, debugAns);
        // }
        // }
        // }
        new Main().solveB();
    }

    private static int solveDebug(int x, int y) {
        int you = x * y;
        int count = 0;
        boolean[] secondUsableCounts = new boolean[you];

        for (int i = 1; i < you; i++) {
            if (i == x) continue;
            for (int j = you; j >= 1; j--) {
                if (j == y) continue;
                if (i * j < you && !secondUsableCounts[j]) {
                    count++;
                    secondUsableCounts[j] = true;
                    break;
                }
            }
        }

        return count;
    }

    private void solveB() {

        try (Scanner sc = new Scanner(System.in);) {
            int q = sc.nextInt();
            for (int i = 0; i < q; i++) {
                long x = sc.nextLong();
                long y = sc.nextLong();
                long result = solveEachB(x, y);
                System.out.println(result);
            }

        }

        // System.out.println(Math.pow(sqrt, 2));
    }

    private long solveEachB(long x, long y) {
        long sum = x * y;

        long sqrt = (int) Math.sqrt(sum);
        if (Math.pow(sqrt, 2) == sum) {
            sqrt--;
        }
        long result = sqrt * 2;
        if (sqrt * (sqrt + 1) >= sum) {
            result--;
        }
        if (sqrt >= x) result--;
        if (sqrt >= y && x != y) result--;

        return result;
    }

    private void solveA() {

        List<Integer> list = new ArrayList<>();
        try (Scanner sc = new Scanner(System.in);) {
            list.add(sc.nextInt());
            list.add(sc.nextInt());
            list.add(sc.nextInt());
        }
        Collections.sort(list);
        int min = list.get(0);
        int middle = list.get(1);
        int max = list.get(2);
        int count = 0;

        while (min != middle || middle != max) {
            for (int i = 0; i < 2; i++) {
                min++;
                if (min > middle) {
                    int tmp = middle;
                    middle = min;
                    min = tmp;
                }
                if (min > max) {
                    int tmp = max;
                    max = min;
                    min = tmp;
                }
            }
            count++;
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 23252
#include<iostream>
#include<bits/stdc++.h>
#include<climits>

#define forn(x,n,s) for(int i = x; i < n; i += s )
#define forr(x,n,s) for(int i = x; i>=n; i -= s)

using namespace std;

void go(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  #ifndef ONLINE_JUDGE
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
  #endif
}

int main(){
    go();

    // code here
    int x,y;cin>>x>>y;
    forn(0,x+1,1){
        int b = x - i;
        if((2*i + 4*b)==y){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}






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

int roster[5][5][20];

int main() {

    int n, b, f, r, v;

    std::cin >> n;

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

        std::cin >> b >> f >> r >> v;

        roster[b][f][r] += v;
    }

    for ( int i = 1; i <= 4; i++ ) {

        if ( i > 1 ) {
            std::cout << "####################" << std::endl;
        }

        for ( int j = 1; j <= 3; j++ ) {

            for ( int k = 1; k <= 10; k++ ) {

                std::cout << " " << roster[i][j][k];
            }

            std::cout << std::endl;
        }
    }

    return 0;
}



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

using namespace std;

int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int dp[n][20];
    for(int i=0;i<20;i++){
        dp[0][i]=-1;
    }
    for(int i=1;i<n;i++){
        for(int j=0;j<20;j++){
            dp[i][j]=dp[i-1][j];
            if(a[i-1]&(1<<j)){
                dp[i][j]=i-1;
            }
        }
    }
    long long ans=0ll;
    int left=-1;
    for(int i=0;i<n;i++){
        for(int j=0;j<20;j++){
            if(a[i]&(1<<j)){
                left=max(left,dp[i][j]);
            }
        }
        ans+=i-left+0ll;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 19996
from itertools import combinations_with_replacement
n,m,q = map(int,input().split())
ans = -1
li = [tuple(map(int,input().split())) for i in range(q)]
for K in combinations_with_replacement(range(1,m+1),n):
    s = 0
    for a,b,c,d in li:
        a -= 1
        b -= 1
        if K[b]-K[a] == c:
            s += d
    ans = max(ans,s)
print(ans)

Measured memory_bytes: 9128
def main():
    A = input().split()
    l = []
    operator = None
    for character in A:
        if character in ["+", "-", "*"]:
            if character == "+":
                l.append(l.pop()+l.pop())
            elif character == "-":
                l.append(-l.pop()+l.pop())
            else:
                l.append(l.pop()*l.pop())
        else:
            l.append(int(character))
    print(l[0])




if __name__ == "__main__":
    import os
    import sys
    if len(sys.argv) > 1:
        if sys.argv[1] == "-d":
            fd = os.open("input.txt", os.O_RDONLY)
            os.dup2(fd, sys.stdin.fileno())
            main()
    else:
        main()

Measured memory_bytes: 7772
#include<iostream>
#include<string>

using namespace std;

int N;

void dfs(string s, char mx){
  if(s.size()==N){
    cout << s << endl;
  }else{
    for(char c = 'a'; c<=mx;c++){
      dfs(s+c, ((c==mx)?mx+1:mx));
    }
  }
}

int main(){
  cin >>N;
  dfs("",'a');
  return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int ans = n / 1.08;
    if(floor(ans * 1.08) == n)
     cout << (ans) ;
    else if(floor((ans + 1) * 1.08) == n)
      cout << ans + 1 << '\n';
      
    else
     cout << ":(";
}

Measured memory_bytes: 256
w,a,b=map(int,input().split())

if a==b:
  print(int(0))
elif a>b:
  if b+w>=a:
    print(int(0))
  else:
    print(int(a-b-w))
else:
   if a+w>=b:
    print(int(0))
   else:
    print(int(b-a-w))

Measured memory_bytes: 3060
#include <stdio.h>
#include <math.h>

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main() {
  int i;
  int candy[3];
  for(i = 0; i < 3; i++) {
    scanf("%d", &candy[i]);
  }
  qsort(candy, 3, sizeof(int), asc);
  if(candy[2] == candy[0] + candy[1]) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }
#define ll long long

int factors(int x){
    int ans = 0;
    for(int i = 1; i*i <= x; i++){
        if(x%i == 0){
            int first = i;
            int second = x/i;
            if(first != second){
                ans += 2;
            }else{
                ans += 1;
            }
        }
    }
    return ans;
}
    

void test_case(){
    int n;
    cin >> n;
    long long ans = 0;
    for(int c = 1; c <= n - 1; c++){
        ans += factors(n - c);
    }
    
    cout << ans << endl;
   
} 


int main(){
    
    int t = 1;
    //cin >> t;
    for(int i = 0; i < t; i++)
        test_case();
    
    return 0;
} 


 


Measured memory_bytes: 3632
using System;
using System.Linq;

public class AtCoder_157_C
{
    public static void Main()
    {
        //var exStdIn = new System.IO.StreamReader( "input.txt" );
        //System.Console.SetIn( exStdIn );

        int[] line1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int n = line1[0];
        int m = line1[1];

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

        bool err = false;

        for (int i = 0; i < m; i++)
        {
            int[] line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int s = line[0] - 1;
            int c = line[1];
            if (ans[s] != -1 && ans[s] != c)
            {
                err = true;
            }
            ans[s] = c;
        }

        if (ans[0] == 0 && n > 1)
        {
            err = true;
        }

        if (err)
        {
            Console.WriteLine(-1);
            return;
        }

        int val = 0;
        int keta = 1;
        for (int i = n - 1; i >= 0; i--)
        {
            if (ans[i] == -1)
            {
                if (i == 0 && n > 1)
                {
                    val += keta;
                }
            }
            else
            {
                val += ans[i] * keta;
            }
            keta *= 10;
        }

        Console.WriteLine(val);
    }
}


Measured memory_bytes: 13268
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,k,ctr=0;
    cin>>a>>b>>c>>k;
    while(b<=a)
    {
        b*=2;
        ctr++;
    }
    while(c<=b)
    {
        c*=2;
        ctr++;
    }
    if(ctr<=k)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


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

int main(){
  int n; ll m; cin >> n >> m;
  vl a(n); rep(i,n) cin >> a[i];
  vl s(n+1); rep(i,n) s[i+1] = s[i] + a[i];

  // mapを使って累積和の剰余類ごとに集計
  map<ll,ll> C;
  rep(i,n+1) {
    s[i] %= m;
    C[s[i]]++;
  }

  ll ans = 0LL;
  for(auto c : C) {
    ll num = c.second;
    ans += num*(num-1LL)/2LL;
  }

  cout << ans << endl;
}


Measured memory_bytes: 5760
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
  #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl "\n"
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
   string s;
   cin>>s;
   set<char> v;
   for(auto it:s)v.insert(it);
   cout<<(v.find('9')==v.end()?"No":"Yes")<<endl;
}
int32_t main(){
   IOS;
   solve();
   //debug();
  #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
  #endif	
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
using namespace std;
/*階乗*/
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

/* ユークリッドの互除法 最大公約数*/
/*ll gcd(ll a, ll b) {
	ll r;
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
*/


/*最小公倍数*/
/*
ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}
*/

/*二点間の距離*/
double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}
/*
ll solve(ll i,ll m,vector<ll>t,ll n){
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    
    
    cout<<i+1<<" "<<m<<endl;
    cout<<i+1<<" "<<m-t[i]<<endl;
    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);
    return res;
}
*/

//小数点12桁
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll>>p;
    for(ll i=0;i<m;i++){
        ll s,t;
        cin>>s>>t;
        p.push_back(make_pair(s,t));
    }
    vector<ll>a(n,10);
    sort(p.begin(),p.end());
    ll s,t=-1;
    for(ll j=0;j<m;j++){
        if(t!=p[j].first){
            a[p[j].first-1]=p[j].second;
            t=p[j].first;
            s=p[j].second;
        }
        else if(t==p[j].first&&s!=p[j].second){
            cout<<-1<<endl;
            exit(0);
        }
    }
    if(n>=2&&a[0]==0){
        cout<<-1<<endl;
        exit(0);
    }
    if(n==1&&(a[0]==0||a[0]==10)){
        cout<<0<<endl;
        exit(0);
    }
    for(ll i=0;i<n;i++){
        if(i==0&&a[i]==10){
            a[i]=1;
        }
        else if(a[i]==10){
            a[i]=0;
        }
    
    }
    for(ll i=0;i<n;i++){
        cout<<a[i];
    }
    cout<<endl;




    
    
}

Measured memory_bytes: 256
a, b, k = [int(x) for x in input().split(" ")]

if a + b == k or a + b < k or (a == 0 and b == 0):
  print(0, 0)
elif a + b > k and a >= k:
  print(a-k, b)
elif a + b > k and a < k:
  print(0, a+b-k)

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

int main (void){
    int a, b;
    cin >> a >> b;
    if(a == b){
        cout << a << endl;
    }else if((a % 2) == (b % 2)){
        cout << (a + b) / 2 << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}



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

using namespace std;

#define PI 3.1415926535897932

int main(){
    int mod=1000000007;
    int n,m;
    char op[1];
    scanf("%d %c %d",&n,&op,&m);
    printf("%d\n",op[0]=='+'?n+m:n-m);

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int A,B,flg=0;
  scanf("%d %d",&A,&B);
  for(int i = 1 ; i <= 1009 ; i++){
    if(floor(i*0.08) == A && floor(i*0.1) == B){
      printf("%d",i);
      flg++;
      break;
    }
  }
  if(flg == 0){
    printf("-1");
  }
  return 0;
}


Measured memory_bytes: 128
let rec arr_string str =
        let length = String.length str in
        match length with
        | 0 -> []
       | len ->
                let first = String.sub str 0 1 in
                let rest = String.sub str 1 (len - 1) in
                (String.get first 0) :: (arr_string rest)
                
let rec sum ls = match ls with
    | [] -> 0
    | (x::xs) -> x + (sum xs)            
                
let eval ch = match ch with
    | '+' -> 1
    | '-' -> -1
    | _ -> 0
    
let () =
    let line = read_line () in
    let arr = arr_string line in
    print_endline (string_of_int (sum (List.map eval arr)))

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

int main(){
  int64_t N;
  cin >> N;
  int64_t ans=0;
  for(int i=1;i<=N;i++){
    int64_t n=N/i;
    ans+=(1+n)*n/2*i;
  }
  cout << ans << endl;
  return 0;
}


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

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main(){
	ll n;
	cin >> n;
	int t[n],a[n];
	FOR(i,n){
		cin >> t[i]>>a[i];
	}
	ll sol=t[0]+a[0];
	ll i=1;
	ll maxt=t[0];
	ll maxa=a[0];
	while(i < n){
		ll j=(sol % (t[i]+a[i])==0 )?sol/(t[i]+a[i]):sol/(t[i]+a[i])+1 ;
		ll j1= (maxt%t[i]==0)? maxt/t[i]:maxt/t[i]+1;
		ll j2= (maxa%a[i] ==0)? maxa/a[i] : maxa/a[i]+1;
		j=max(j,j1);
		j=max(j1,j2);
		
		
		sol=j*(t[i]+a[i]);
		maxt=j*t[i];
		maxa=j*a[i];
		//cout << sol <<" " << maxt <<" "<<maxa<<"\n";
		i++;
	}
	cout << sol;
	return 0;
}


Measured memory_bytes: 256
from itertools import product


def main(a, b, c, x):
    ans = 0
    for i, j, k in product(range(a + 1), range(b + 1), range(c + 1)):
        if 500 * i + 100 * j + 50 * k == x:
            ans += 1

    print(ans)


if __name__ == "__main__":
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

    main(a, b, c, x)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
string S[1000]; int  n, p[5] = { 5,12,17,24,31 };
int main() {
	while (true) {
		cin >> n; if (n == 0)break;
		for (int i = 0; i < n; i++)cin >> S[i];
		for (int i = 0; i < n; i++) {
			int cnt = 0, sum = 0;
			for (int j = i; j < n; j++) {
				if (cnt >= 5)continue;
				sum += S[j].size();
				if (p[cnt] == sum)cnt++;
			}
			if (cnt == 5) { cout << i + 1 << endl; break; }
		}
	}
	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>

using namespace std;

int main() {
    int A[3];

    for (int i = 0; i < 3; i++) {
        cin >> A[i];
    }

    set<int> value;
    for (int i = 0; i < 3; i++) {
        value.insert(A[i]);
    }

    cout << value.size() << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int timenow = 0;
        int n = sc.nextInt();
        int q = sc.nextInt();
        String[] names = new String[n];
        int[] times = new int[n];
        LinkedList<Integer> queue = new LinkedList<Integer>();
        for (int i = 0; i < n; i++){
            names[i] = sc.next();
            times[i] = sc.nextInt();
            queue.add(i);
        }
        while (queue.size()!=0){
            int p = queue.poll();
            if (times[p]>q) {
                times[p] -= q;
                queue.add(p);
                timenow += q;
            } else {
                timenow += times[p];
                System.out.println(names[p]+" "+timenow);
            }
        }
    }
}

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

int n,A[50];
int solve( int i, int m){
  if(m==0) return 1;
  if(i>=n) return 0;
  int res= (solve(i+1,m)||solve(i+1,m-A[i]));
  return res;
}

    
int main() {
  int q,M,i;
  cin>>n;
  for (i=0;i<n;i++) cin >>A[i];
  cin>>q;
  for (i=0;i<q;i++){
    cin>>M;
    if(solve(0,M)) cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}



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

int main() {
  int a,b;
  cin >> a >> b;
  if(a*b%2==0)
  cout<< "Even" <<endl;
  else
  cout<< "Odd" <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ms(x,y) memset(x, y, sizeof(x))
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

const LL MOD = 998244353;

void run_case() {
    int n; cin >> n;
    vector<pll> a(n), sta;
    vector<LL> dp(n+1);
    for(auto &x: a) cin >> x.first >> x.second;
    sort(a.begin(), a.end());
    sta.emplace_back(n, 3e9);
    dp[n] = 1;
    for(int i = n-1; i >= 0; --i) {
        while(sta.back().second < a[i].first + a[i].second) sta.pop_back();
        dp[i] += dp[sta.back().first];
        sta.emplace_back(i, a[i].first);
        dp[i] = (dp[i] + dp[i+1]) % MOD;
    }
    cout << dp[0];
}


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cout.flags(ios::fixed);cout.precision(9);
    //int t; cin >> t;
    //while(t--)
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 7156
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, M, C;
    cin >> N >> M >> C;
    int B[M];
    int table[N][M];
    for (int j = 0; j < M; j++) cin >> B[j];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cin >> table[i][j];
        }
    }

    int ret = 0;
    for (int i = 0; i < N; i++) {
        int tmp = C;
        for (int j = 0; j < M; j++) {
            tmp += table[i][j] * B[j];
        }
        if (tmp > 0) ret++;
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	sl:= split(s)

	n := len(sl)
	c := (n-1)/2
	abc := strings.Join(sl[0:c],"")
	d := (n+3)/2
	def := strings.Join(sl[d-1:n],"")
	if abc == Reverse(abc) {
		if abc== Reverse(def) {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func Reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}


Measured memory_bytes: 640
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var mn=(Arr.shift()).split(" ").map(Number);
var S=[];
for(var i=0;i<mn[0];i++){
   var arr=(Arr.shift()).split(" ").map(Number);
   var sum=arr.reduce(function(a,b){return a+b;});
   S.push(sum);
}
console.log(Math.max.apply(null,S));

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

int main(){
    int H,W;
    cin >> H >> W ;

    vector<string> vec(H);
    
    for(int i=0;i<H;i++){
          cin >> vec.at(i);
    }

    for(int i=0;i<W+2;i++){
        cout << '#'; 
    }
    cout << endl;

    for(int i=0;i<H;i++){
        cout << '#' << vec.at(i) << '#' << endl;
    }

    for(int i=0;i<W+2;i++){
        cout << '#'; 
    }
    cout << endl;
}

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

tlist = [True]*M
for i in range(N):
  alist = list(map(int,input().split()))[1:]
  
  llist = [False]*M
  for a in alist:
    llist[a-1] = True
  for j in range(M):
    if not llist[j]:
      tlist[j] = False
      
#print(tlist)
print(tlist.count(True))


Measured memory_bytes: 3060
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> L >> N >> M >> K;
	vector<vector<long long int>>dp(L + 1, vector<long long int>(1 << 17));
	dp[0][0] = 1;
	for (int i = 0; i < L; i++) {
		for (int j = 0; j < 1 << 17; j++) {
			for (int k = 1; k <= 10; k++) {
				int nx = j << k;
				nx &= (1 << (N + M + K)) - 1;
				nx |= 1 << (k - 1);
				if ((nx >> (K - 1)) & 1 && (nx >> (M + K - 1)) & 1 && (nx >> (N + M + K - 1)) & 1)continue;
				dp[i + 1][nx] += dp[i][j];
				dp[i + 1][nx] %= MOD;
			}
		}
	}
	long long int ans = 1;
	for (int i = 0; i < L; i++) {
		ans *= 10;
		ans %= MOD;
	}
	for (auto i : dp.back()) {
		ans -= i;
		ans += MOD;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 43392
#include <stdio.h>
int main(void)
{
	int n, a, i, max, min;
	
	long sum;
	
	i = 1;
	
	scanf("%d", &n);
	
	scanf("%d", &a);
	
	max = min = sum = a;
	
	while(i < n){
		scanf("%d", &a);
		
		sum += a;
		
		if(max < a){
				max = a;}
		if(min > a){
				min = a;}
		
		i++;}
		
		printf("%d %d %ld\n", min, max, sum);
		
	return 0;
}


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

using namespace std;
typedef long double ld;


int main()
{
    ld l;
    cin >> l;
    ld ans = 0;
    ld o = l/3;

    ld t = o;

    ld th = l - t - o;
    ans = th * t * o;

    cout << fixed << setprecision(10) << ans << endl;



}


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

int main()
{
    int n, k;

    cin >> n >> k;
    int arr[n];

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

    int reqN = sizeof(arr) / sizeof(arr[0]);

    sort(arr, arr + reqN);

    int sum = 0;

    for (int i = 0; i < k; i++)
    {
        sum += arr[i];
    }

    cout << sum;

    return 0;
}

Measured memory_bytes: 3636
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = "YES";
		boolean flg = true;
		int to = s.length();
		while(flg){
		    if(to-5 >= 0){
		        String t = s.substring(to-5, to);
		        if(t.equals("dream") || t.equals("erase")){
		            to -= 5;
		            continue;
		        }
		    }
		    if(to-6 >= 0){
		        String t = s.substring(to-6, to);
		        if(t.equals("eraser")){
		            to -= 6;
		            continue;
		        }
		    }
		    if(to-7 >= 0){
		        String t = s.substring(to-7, to);
		        if(t.equals("dreamer")){
		            to -= 7;
		            continue;
		        }
		    }
		    flg = false;
		    if(to != 0) result = "NO";
		}
		
		// 出力
		System.out.println(result);
	}

	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 26580
#!/usr/bin/env python
# coding: utf-8

# In[21]:


H,W = map(int, input().split())
A = []
for _ in range(H):
    A.append(input())


# In[ ]:


cnt = 0
for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            cnt += 1
if cnt == H+W-1:
    print("Possible")
else:
    print("Impossible")



Measured memory_bytes: 9092
#include <stdio.h>
int main(){
  int x,y,count,ans=0;
  scanf("%d %d",&x,&y);
  for (int i=0;i<(x+1);i++){
    count=2*i+4*(x-i);
    if(count == y){
      ans=ans+1;
    }
  }
  if(ans!=0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
}

Measured memory_bytes: 1628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 10000000099
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  ll X, Y, Z;
  cin >> X >> Y >> Z;
  cout << Z << " " << X << " " << Y;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
	int N;
	
	cin >> N;
	for (int i = 1; i <= 9; i++) {
		if (N % i == 0) {
			int m = N / i;
			if (m <= 9) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256