akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
    for(auto &e:t) fill_v(e,v);
}

int main() {
  int l; cin >> l;
  string s; cin >> s;

  int n = 0, m = 0;
  for(const auto& c: s){
    if(c == '('){
      n++;
    } else {
      n--;
    }
    m = min(m, n);
  }

  REP(i, -m) s = '(' + s;
  REP(i, n-m) s = s + ')';

  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dp[100005][2];
signed main() {
    string L;
    cin >> L;
    dp[0][0] = 1;
    dp[0][1] = 2;
    for(int i = 1; i < L.size(); i++) {
        if(L[i] == '1') {
            dp[i][1] = dp[i-1][1]*2;
            dp[i][0] = dp[i-1][0]*3+dp[i-1][1];
            dp[i][1] %= mod;
            dp[i][0] %= mod;
        }
        else {
            dp[i][1] = dp[i-1][1];
            dp[i][0] = dp[i-1][0]*3%mod;
        }
    }
    cout << (dp[L.size()-1][0]+dp[L.size()-1][1])%mod << endl;
}


Measured memory_bytes: 5296
/*
 * main.c
 *
 *  Created on: 2019/04/27
 *      Author: family
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
    int A, B, T;
    int ans = 0;
    scanf("%d %d %d", &A, &B, &T);
    ans = (T/A) * B;
    printf("%d\n",ans);
    return 0;
}



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

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];


    if (find(ALL(a), 0)!=a.end()){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    // REP(i, n){
    //     if (LLONG_MAX/a[i]>ans) ans*=a[i];
    //     else {
    //         cout << -1 << endl;
    //         return 0;
    //     }
    // }
    ll mul_res;
    REP(i, n){
        if (__builtin_mul_overflow(ans, a[i], &mul_res)){
            cout << -1 << endl;
            return 0;
        }
      	else ans *= a[i];
    }
    if (ans <= ll(1e18)) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3992
#include <stdio.h>
#define N 200002

int a[N];

int read()
{
	char c;
	while((c = getchar()) < 48 || c > 57);
	int x = c - 48;
	while((c = getchar()) > 47 && c < 58) x = x * 10 + c - 48;
	return x;
}

void write(int x)
{
	if(x < 10){
		putchar(x + 48);
		return;
	}
	write(x / 10);
	putchar(x % 10 + 48);
}

int main()
{		
	int i, x, n, m1 = 0, m2 = 0;
		
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		x = a[i] = read();
		if(x > m1){
			m2 = m1;
			m1 = x;
		}
		else if(x > m2) m2 = x;
	}
	for(i = 0; i < n; i++){
		if(a[i] < m1) write(m1);
		else write(m2);
		puts("");
	}
			
	return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i,a[2000],s=0;;
    cin>>n>>k;
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(i=0;i<k;i++)
        s+=a[i];
    cout<<s<<endl;
}



Measured memory_bytes: 3640
n,m,x = map(int,input().split())
c=[0]*n
a=[[0]*m for _ in range(n)]

for i in range(n):
    c[i],*aa = map(int,input().split())
    a[i]=aa

ans=10**50
for i in range(2**n):
    bi = bin(i)[2:].zfill(n)
    skill = [sum(a[k][j] for k in range(n) if bi[k]=="1") for j in range(m)]
    if all(s>=x for s in skill):
        cand = sum( c[i] for i in range(n) if bi[i]=="1")
        if cand<ans:
            ans=cand
if ans==10**50:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 76824
//I_love_StarnyC     
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define fix  cout<<std::fixed;
#define mk make_pair
#define mod 1000000007
#define time  cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
#define IOS        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll dp[100005],vis[100005];
vector <ll> v[100005];
void dfs(ll z)
{   vis[z]=1;
    for(auto i:v[z])
    {
        if(!vis[i])
        dfs(i);
     dp[z]=max(dp[z],dp[i]+1);
    }
}
int main()
{  
    ll n,m;cin>>n>>m;
    while(m--)
    {
        int x,y;cin>>x>>y;
        v[x].pb(y);
    }
    for(int i=1;i<=n;i++)
       {if(vis[i]==0)
    dfs(i);}
    sort(dp, dp+100005);
    cout<<dp[100004];
}

Measured memory_bytes: 9344
#include <cstdio> 
#include <cstdlib> 
#include <cmath> 
#include <cstring> 
#include <climits> 
#include <cfloat> 
#include <map> 
#include <utility> 
#include <set> 
#include <iostream> 
#include <memory> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <sstream> 
#include <complex> 
#include <stack> 
#include <queue> 
#include <numeric>
#include <cassert>

#define FOR(i, min, max) for (int i = (min); i < (max); ++i) 
#define FORE(i, min, max) for (int i = (min); i <= (max); ++i) 
#define REP(i, n) for (int i = 0; i < (n); ++i) 
#define REPV(vec, i) for (int i = 0; i < (int)(vec.size()); ++i) 
#define FOR_EACH(vec, it) for (typeof((vec).begin()) it = (vec).begin(); it != (vec).end(); ++it)

using namespace std; 
static const double EPS = 1e-12; 
typedef long long ll; 

ll MOD=998244353;
inline ll add_m(ll a, ll b) { return (a + b) % MOD; }
inline ll sub_m(ll a, ll b) { return (a - b + MOD) % MOD; }
inline ll mul_m(ll a, ll b) { return (a * b) % MOD; }

ll pow_m(ll a, ll b) {
    ll r = 1LL;
    while(b) {
        if(b & 1LL)
            r = mul_m(r, a);
        a = mul_m(a, a);
        b >>= 1;
    }
    return r;
}

ll mem[3050];

int main(void)
{
    int N, S;
    cin >> N >> S;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    memset(mem, 0, sizeof(mem));
    mem[0] = 1;
    REP(i, N) {
        for (int s = S; s >= 0; --s) {
            mem[s] = add_m(mem[s], mem[s]);
            if (s-A[i] >= 0)
                mem[s] = add_m(mem[s], mem[s-A[i]]);
        }
    }
    cout << mem[S] << endl;
    
    return 0;
}


Measured memory_bytes: 3668
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;

int MOD = 1000000007;

ll dp[3010][3010] = {0};



signed main(){

    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a[i];

    for(ll j = 0;j < n;j++){
        for(ll i = 0;i+j < n;i++){
            ll l = i;
            ll r = i+j;
            if(j == 0){
                if((l+r)%2 == (n-1)%2){
                    dp[l][r] = a[i];
                }else{
                    dp[l][r] = -a[i];
                }
            }else if((l+r)%2 == (n-1)%2){
                dp[l][r] = max(dp[l][r-1]+a[r],dp[l+1][r]+a[l]);
            }else{
                dp[l][r] = min(dp[l][r-1]-a[r],dp[l+1][r]-a[l]);
            }
        }
    }
    cout << dp[0][n-1] << endl;
    // rep(i,n){
    //     rep(j,n){
    //         cerr << dp[i][j] << " ";
    //     }cerr << endl;
    // }

    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://dp.contest.atcoder.jp/tasks/dp_f

Measured memory_bytes: 70016
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535;

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

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if ((i >= 1 && i <= 9) ||
            (i >= 100 && i <= 999) ||
            (i >= 10000 && i <= 99999)) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())


# def f(n):
#     if n < 2:
#         return 1
#     return n * f(n - 2)

if N % 2 != 0:
    print(0)
    exit()

A = [0] * 30
m = 5
for i in range(1, 30):
    A[i] = N // m
    m *= 5
print(sum([a // 2 for a in A]))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c=0,s,d,i;
    scanf("%lld",&a);
  for(i=2;i<=a;i++)
  {
      if(i%3==0||i%5==0)
      {
          continue;
      }
      else c+=i;
  }
  printf("%lld\n",c+1);
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'

int main() {

   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);

  
   // ll t;  cin>>t; while(t--)
    {
        ll a,b;
        cin>>a>>b;
    ll ans=a*b;
    cout<<ans;
    }
	  

    return 0;
}

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

int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c;
  cin>>a>>b>>c;
  int sum=0;
  sum+=(a*100)+(b*10)+(c*1);
  //cout<<sum<<endl;
  if(sum%4==0) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
# coding: utf-8
def check(v):
    vs = str(v)
    length = len(vs)
    if length % 2 != 0:
        if vs[:length//2] == vs[length//2+1:][::-1]:
            return True
        else:
            return False
    else:
        if vs[:length//2] == vs[length//2:][::-1]:
            return True
        else:
            return False
A, B = map(int, input().split())
ans = 0
for v in range(A, B+1):
    # vs = str(v)
    # length = len(vs)
    # print(vs)
    # print(vs[:length//2], vs[length//2+1:][::-1])
    # break
    if check(v):
        # print(v)
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <string>
#include <time.h>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <utility>
#include <iostream>
#include <cmath>
#include <deque>

#define MOD 998244353
#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair

typedef long long ll;
using namespace std;
#define MAXN 1488228
ll x, y, n, m, k;
ll a[105][105], d[105][105];
int main() {
    cin >> n >> k;
    string s;
    cin >> s;
    string ans = s;
    char c ='z';
    for (int i = 0; i < n; i++) {
        c = min(c, s[i]);
    }
    if (k >= 15) {
        for (int i = 0; i < n; i++) {
            cout << c;
        }
        cout << endl;
        return 0;
    }
    string t = s;
    reverse(t.begin(), t.end());
    s.append(t);
    k--;
        ll cnt = 0, cur = 0;
        for (int i = 0; i < 2 * n; i++) {
            if (s[i] == c) {
                cur++;
            } else {
                cnt = max(cnt, cur);
                cur = 0;
            }
        }
        cnt = max(cnt, cur);
        ll lf = (cnt << k);
        if ((cnt << k) >= n) {
            for (int i = 0; i < n; i++) {
                cout << c;
            }
            cout << endl;
            return 0;
        }
        cur = 0;
        string ending = "";
        for (int i = 0; i < 2 * n; i++) {
            if (i + (n - lf) >= 2 * n) {
                break;
            }
            if (s[i] == c) {
                cur++;
            } else {
                cur = 0;
            }
            if (cur == cnt && i - cnt <= n) {
                string tmp;
                for (int j = i + 1; j <= i + (n - lf); j++) {
                    tmp.push_back(s[j]);
                }
                if (ending == "") {
                    ending = tmp;
                } else if (tmp < ending) {
                    ending = tmp;
                }
            }
        }
        for (int i = 0; i < lf; i++) {
            cout << c;
        }
        cout << ending << endl;
    return 0;
}

Measured memory_bytes: 256
// Problem : Anti-Division
// Contest : Virtual Judge - AtCoder
// URL : https://vjudge.net/problem/AtCoder-abc131_c
// Memory Limit : 1048 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")  // disable
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define lll __int128
#define lp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define vec(v, type, sz) vector<type> v(sz)
#define in(v) \
    for (auto &i : v) cin >> i
#define all(v) v.begin(), v.end()
#define prv(v)                         \
    for (auto i : v) cout << i << " "; \
    cout << "\n"
#define MOD 1000000007
#define INF 1000000000
#define INFL 1000000000000000000ll
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vi vector<int>
#define vl vector<ll>
#define vii(v, n, m, val) vector<vector<int>> v(n, vector<int>(m, val))
#define viii(v, i, j, k, val)        \
    vector<vector<vector<int>>> v(i, \
                                  vector<vector<int>>(j, vector<int>(k, val)))
#define pii pair<int, int>
#define pb push_back
#define file_io                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define testc   \
    int tcc;    \
    cin >> tcc; \
    for (int tc = 1; tc <= tcc; tc++)
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while (!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
    cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if (idx > 0)
        cerr << ", ";
    else
        cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss;
    ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef DB
#define debug(...) \
    debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//#define int ll

signed main() {
	fast_io;
	ll a,b,c,d; cin>>a>>b>>c>>d;
	ll tot=b-a+1;
	ll byc=b/c-(a-1)/c;
	ll byd=b/d-(a-1)/d;
	ll both=b/(lcm(c,d))-(a-1)/(lcm(c,d	));
	debug(byc,byd,both);
	cout<<tot-(byd+byc-both);
}
// code!=think
// least efficient code to get ac


Measured memory_bytes: 3628
import sys
from collections import defaultdict
N, M = map(int, sys.stdin.readline().split())
As = map(int, sys.stdin.readline().split())
s = 0
ss = defaultdict(int)
ss[0] = 1
for a in As:
    s += a
    ss[s % M] += 1
res = 0
for k, v in ss.items():
    res += v * (v-1) // 2
print(res)


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1000000007;

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

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, q, x, K;
string s, t;
// <------------- Implement Functions Here ----------> //

struct comp {
	bool operator() (const ll &a, const ll &b) const {
		if (abs(a - x) == abs(b - x)) {
			return a < b;
		}
		return abs(a - x) < abs(b - x);
	}
};

// <------------- Start of main() -------------------> //

void MAIN() {
	ll d,n;
	cin >> d >> n;
	if(n <= 99)
	cout<<(ll)(n*pow(100,d));
	else
	cout<<(ll)(101*pow(100,d));
	 
}


int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n;
string s, s2;
ll MOD = 1000000007;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> s >> s2;
	vector<int> v;
	int pos = 0;
	while (true) {
		if (pos < n-1 && s[pos] == s[pos+1]) {
			v.push_back(1);
			pos += 2;
		}
		else {
			v.push_back(0);
			pos++;
		}
		if (pos == n) break;
	}
	ll ret;
	if (v[0]) ret = 6;
	else ret = 3;
	
	for (int i = 1; i < v.size(); i++) {
		if (v[i-1] && v[i]) ret = ret * 3 % MOD;
		else if (!v[i-1]) ret = ret * 2 % MOD;
	}
	cout << ret << endl;
	return 0;
}

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

int main(){
    string S;
    string ans;
    int x,y;
    cin >> S;

    x = S.size() - 2;
    y = S.size() - 1;
    cout << S[0] << x << S[y] << endl;
    return 0;
}

Measured memory_bytes: 256
program squirrel_merchant
  implicit none
  integer(8) :: n, a(3), b(3)
  read(*,*) n
  read(*,*) a(:)
  read(*,*) b(:)
  call exchange(n,a,b)
  call exchange(n,b,a)
  write(*,'(i0)') n
  stop
contains
  subroutine exchange(n,x,y)
    implicit none
    integer(8), intent(inout) :: n, x(3), y(3)
    integer(8) :: dp(0_8:n), i
    dp = 0_8
    do i = 0_8, n
      dp(i) = i
      if (i.ge.x(1)) dp(i) = max(dp(i),dp(i-x(1))+y(1))
      if (i.ge.x(2)) dp(i) = max(dp(i),dp(i-x(2))+y(2))
      if (i.ge.x(3)) dp(i) = max(dp(i),dp(i-x(3))+y(3))
    end do
    n = maxval(dp)
    return
  end subroutine exchange
end program squirrel_merchant

Measured memory_bytes: 195584
menu = [int(input()) for _ in range(5)]
last = 10**18
last_menu = 0
num = -1
for i in range(len(menu)):
  if menu[i]%10 != 0:
    last = min(last, menu[i]%10)
  if last == menu[i]%10:
    num = i
if num >= 0:
  last_menu = menu.pop(num)

time = 0
for j in range(len(menu)):
  if menu[j]%10 == 0:
    time += menu[j]
  else:
    time += menu[j] + (10 - menu[j]%10)
time += last_menu

print(time)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define     ll              long long
#define     MAX             100000
#define     FI              freopen("input.txt","r",stdin)
#define     FO              freopen("output.txt","w",stdout)
#define     fast            ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define     sc(a)           scanf("%d",&a)
#define     sc2(a,b)        scanf("%d %d",&a,&b)


int main()
{
    string s,fnd;
    cin>>s>>fnd;
    size_t Find = s.find(fnd);
        while(Find!=string::npos)
        {
            cout<<Find<<"\n";
            Find = s.find(fnd,Find+1);
        }

    return 0;
}




Measured memory_bytes: 3900
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define show(a) cout<<""#a""<<" is "<<a<<endl;
#define shw(a,b)cout<<"-->"<<a<<" "<<b<<endl;
#define print(arr,xx)for(int i=0;i<xx;i++)cout<<arr[i]<<" \n"[i>=xx];
#define here cout<<"here\n"; 
int caseno=0;
#define print_case cout<<"Case "<<++caseno<<": ";
#define fout freopen("output.txt","w",stdout);
#define fin freopen("input.txt","r",stdin);
#define pb push_back
#define ll long long
const int primemod=1e9+7;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
const ll maxsize = 100000+9;
#define inf 1<<28
 ll n;
void solve(){
	string a, b;
	cin>>a>>b;
	bool ok=1;
	for(int i=0;i<a.size();i++){
		if(a[i]!=b[i])ok=0;
	}
	if(ok)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}
 
int main(){
	#ifndef ONLINE_JUDGE
 	fout	
 	fin
 	int kase=1; 	
 	while(kase--){
 	#endif     
 	///-----		
 	fastio
 	int T;
 	T=1;
 
 	while(T--){
 		 // if(solve())cout<<"Yes"<<endl;
 		 // else cout<<"No"<<endl;
 		solve();
 	}
 	///-----
 }
 
 #ifndef ONLINE_JUDGE
 }			
 #endif
 /*
9
1 2 3 4
*/

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7; 
const int N = 1e5+1; 
int n; 

vector<int> tree[N];
vector<int> white(N,0),black(N,0); 

void dfs(int node, int parent)
{ 
 
    long w_ways = 1, b_ways = 1; 
    for(int child: tree[node])
    {
        if(child != parent)
        {
            dfs(child,node);
            
            w_ways = w_ways * ( ( 0l +  white[child] + black[child] ) % mod ) % mod;
            b_ways = ( b_ways*white[child] ) % mod; 
            
        }
    }
    
    white[node] = w_ways;
    black[node] = b_ways; 
    
    
}


void solve()
{
       cin >> n;
       
       for(int i = 0 ; i < n-1; i ++)
       {
           int x,y; cin >> x >> y;
           
           tree[x].push_back(y);
           tree[y].push_back(x);
       }
       
       dfs(1,-1); 
       cout <<  ( white[1] + black[1] ) % mod ; 
}

int main()
{

	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);

	 solve();
	 return 0;
}

/**


*/




Measured memory_bytes: 17616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int x, a, b;
  cin >> x >> a >> b;
  a = abs(a-x);
  b = abs(b-x);
  cout << (a < b ? "A" : "B") << endl;

  return 0;
}

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

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ans=0;
	int i,j;
	int cnt=0;
	for(i=0;i<n;i++)
	{
		if(s[i]=='R')
			cnt++;
	}
	//cout<<cnt<<endl;
	i=0;j=cnt;
	while(1)
	{
		while(j<n && s[j]=='W')
			j++;
		while(i<n && s[i]=='R')
			i++;
		//cout<<i<<" "<<j<<endl;
		if(i>=n || j>=n)
			break;
		ans++;
		i++;
		j++;
	}
	cout<<ans<<"\n";
	return 0;
}

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

int main(void){
    int Tarou = 0;
    int Hanako = 0;
    int cards;
    string card1,card2;
    cin >> cards;
    for (int i = 0;i < cards;i++){
        cin >> card1 >> card2;
        if (card1.compare(card2) == 0) {
            Tarou += 1;
            Hanako += 1;
        }
        else if(card1.compare(card2) > 0) {
            Tarou += 3;
        }
        else {
            Hanako += 3;
        }
    }
    cout << Tarou << " " << Hanako << endl;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

ll pow2(ll b) {ll ret=1;rep(i,b) ret*=2;return ret;}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k,a,ans=0,s,t;cin>>n>>k;
  lvector digit(40,0),take_zero(40,0),max_(40,0),k_(40,0);
  rep(i,n) {
    cin>>a;
    rep(j,40) if((a>>j)&1) digit[j]++;
  }
  rep(i,40) {
    a=pow2(i);
    k_[i]+=((k>>i)&1)?(n-digit[i])*a:digit[i]*a;
    ans+=k_[i];
    take_zero[i]+=digit[i]*a;
    max_[i]+=max(digit[i],n-digit[i])*a;
  }
  rep(i,40) {
    if((k>>i)&1) {
      s=0,t=0;
      for(ll j=i+1;j<40;++j) s+=k_[j];
      for(ll j=0;j<i;++j) t+=max_[j];
      ans=max(ans,s+take_zero[i]+t);
    }
  }
  print(ans);
  return 0;
}

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

int a[200005], b[200005];
long long ca[200005], cb[200005];
 
int main()
{
    int n, m, k,ans;
    scanf("%d%d%d",&n, &m, &k);
    ca[0] = 0, cb[0] = 0;
    long long asum = 0, bsum = 0;
    for(int i = 0; i < n; i++){
    	scanf("%d",&a[i]);
    	asum += a[i];
    	ca[i+1] = asum;
    }
    for(int i = 0; i < m; i++){
    	scanf("%d",&b[i]);
    	bsum += b[i];
    	cb[i+1] = bsum;
    }
    int hi = m + n, lo = 0, mid;
    while(hi - lo > 3){
    	mid = (hi + lo)/2;
    	int flag = 0;
    	for(int i = 0; i <= mid; i++){
    		if((mid-i) > m) continue;
    		else if(i > n) break;
    		else{
    			if(ca[i] + cb[mid-i] <= k) flag++;
    		}
    	}
    	if(flag == 0) hi = mid;
    	else lo = mid;
    	ans = mid;
    }
    for(int i = hi; i >= lo; i--){
    	int flag = 0;
    	for(int j = 0; j <= i; j++){
    		if(i-j > m) continue;
    		else if(j > n) break;
    		else{
    			if(ca[j]+cb[i-j] <= k) flag++;
    		}
    	}
    	ans = i;
    	if(flag > 0) break;
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 8312
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 100000
void inarray(int a[], int n){
    for(int i = 0; i < n; i++) cin >> a[i];
}

int main(){
    int k,n; cin >> k >> n;
    int a[n+1]; int ans = k;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    int dis = INT_MIN;
    for(int i = 2; i <= n; i++){
        dis = max(dis, a[i]-a[i-1]);
    }
    dis = max(dis, k-a[n] + a[1]);
    cout << ans-dis << endl;
    return 0;
}

Measured memory_bytes: 1024
fun main(args : Array<String>) {
    readLine()!!
    val students = readLine()!!.split(" ").map { it.toInt() }

    val result = Beginner20190928C.exec(students)

    println(result.joinToString(" ") { it.toString() })
}


object Beginner20190928C {
    fun exec(students : List<Int>) : List<Int> {
        return students
            .mapIndexed { index, it -> index + 1 to it }
            .sortedBy { it.second }
            .map { it.first }
    }
}

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

int main()
{


        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX;
        long long x=0,y=0,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr; string str,ttr,ntr;

        scanf("%lld",&n); m=1000;

        for(i=1;i<=n;i++)
        {
            scanf("%lld",&a);

            if(i>1)
            {
                if(x==0)
                {
                    if(p<a){  d=p; x=1;   }
                }
                else
                {
                    if(p>a)
                    {
                        g=m/d; h=m%d; r=g*p; m=r+h;

                        x=0;
                    }
                }
            }

            p=a;

        }

        if(x==1)
        {
             g=m/d; h=m%d; r=g*a; m=r+h;
        }


        printf("%lld\n",m);




    return 0;
}





Measured memory_bytes: 3792
def b(x, y, z):
    flag = False
    if (z < x + y) and (y < z + x) and (x < z + y):
        if (x != y) and (y != z) and (x != z):
            flag = True
    return flag
cnt = 0
N = int(input())
L = list(map(int, input().split()))
for i in range(N):
    x = L[i]
    for j in range(i + 1, N):
        y = L[j]
        for k in range(j + 1, N):
            z = L[k]
            if b(x, y, z):
                cnt += 1
print(cnt)

Measured memory_bytes: 9212
import math
import itertools
import numpy as np

def solve():
    a, b, c, x, y = map(int, input().split())
    case1 = a * x + b * y
    case2 = x * 2 * c + max(0, (y - x) * b)
    case3 = max(0, (x - y) * a) +  y * 2 * c
    case4 = max(x, y) * 2 * c
    print(min(case1, case2,case3,case4))
    return 0

if __name__ == "__main__":
    solve()


Measured memory_bytes: 20520
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<pii> vii;
typedef priority_queue<piii, vector<piii>, greater<piii> > pque;

const int MOD = 1e9+7;
const int INF = 1e9;
const int dy[4] = {0, 1, 0, -1}, dx[4] = {1, 0, -1, 0};
const int MAX_NW = 50;

int H, W, map[MAX_NW][MAX_NW];
int sum_black, ans;
string field[MAX_NW];

bool check(int y, int x) {
  return (0<=y && y<H) && (0<=x && x<W);
}

int main() {
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    cin >> field[i];
  }
  
  sum_black = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      map[i][j] = INF;
      if (field[i][j] == '#') sum_black++;
    }
  }
  map[0][0] = 0;
  pque que;
  que.push(MP(0, MP(0, 0)));
  while (!que.empty()) {
    piii tmp = que.top(); que.pop();
    int y = tmp.S.F, x = tmp.S.S, dist = tmp.F;
    for (int i = 0; i < 4; i++) {
      int ny = y + dy[i], nx = x + dx[i];
      if (!check(ny, nx) || field[ny][nx]=='#' || map[ny][nx]!=INF) continue;
      map[ny][nx] = dist + 1;
      que.push(MP(map[ny][nx], MP(ny, nx)));
    }
  }
  if (map[H-1][W-1] == INF) {
    ans = -1;
  } else {
    ans = H * W - sum_black - map[H-1][W-1] - 1;
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define MAX 100

int N;
ll ans = 0;
ll ct = 0, ca = 0;

ll T[1001], A[1001];

int main() {
  cin >> N;
  rep(i,N) scanf("%lld %lld", &T[i], &A[i]);

  ct = T[0]; ca = A[0];

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

    ll x,y;
    x = ((ct % T[i]) > 0) ? (ct / T[i]) + 1 : ct / T[i];
    y = ((ca % A[i]) > 0) ? (ca / A[i]) + 1 : ca / A[i];


    ll n = max(x,y);

    ct = n * T[i]; ca = n * A[i];
  }

  ans = ct + ca;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<string> S(N);
  rep(i,N) cin>>S[i];

  map<string,int> mp;
  rep(i,N) mp[S[i]]++;

  int ma=0;
  rep(i,N) ma=max(ma,mp[S[i]]);

  vector<string> ans;
  rep(i,N){
    if(ma==mp[S[i]]){
      mp[S[i]]=0;
      ans.push_back(S[i]);
    }
  }
  sort(ans.begin(),ans.end());

  rep(i,ans.size()) cout<<ans[i]<<endl;

  return 0;
}


Measured memory_bytes: 28404
#include <stdio.h>

int content(int* a, int n){
	for(int j = 0; j < n - 1; j++){
		printf("%d ", a[j]);
	}
	printf("%d\n",a[n - 1]);
	return 0;
}

int main(void)
{
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	content(a, n);
	for(int i = 1; i < n; i++){
		int v = a[i];
		int j = i- 1;
		while(j >= 0 && a[j] > v){
			a[j + 1] = a[j];
			j--;
			a[j + 1] = v;
		}
		content(a, n);
	}
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll mod=998244353;
int main()
{
	ios;
	string s;
	int n,a=0,b=0,c=0,d=0;
	cin>>n;
	while(n--)
	{
		cin>>s;
		if(s=="AC") a++;
		else if(s=="WA") b++;
		else if(s=="TLE") c++;
		else d++;
	}
	cout<<"AC x "<<a<<"\n";
	cout<<"WA x "<<b<<"\n";
	cout<<"TLE x "<<c<<"\n";
	cout<<"RE x "<<d<<"\n";
	return 0;
}


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

//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define pb push_back
#define endl '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;
typedef set<int> si;
const ll mod = 1e9 + 7;
const ll modl=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/

int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
          int n;
          cin>>n;
          if(n>=30)cout<<"Yes"<<endl;
          else cout<<"No"<<endl;
   }
   }
















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

struct pos{
	int x;
	int y;
};

int main(){
	int w, h;
	while(1){
		cin >> w >> h;
		if(w == 0 || h == 0) break;

		int marine[52][52];
		for(int i = 0; i < 52; i++){
			for(int j = 0; j < 52; j++){
				marine[i][j] = 0;
			}
		}

		for(int i = 1; i <= h; i++){
			for(int j = 1; j <= w; j++){
				cin >> marine[i][j];
			}
		}

		stack<pos> st;
		int island = 0;
		for(int i = 1; i <= h; i++){
			for(int j = 1; j <= w; j++){
				//島を探す
				if(marine[i][j] == 1){
					pos p;
					p.y = i;
					p.x = j;
					st.push(p);
					marine[i][j] = 0;
					while(!st.empty()){
						pos p1 = st.top();
						st.pop();
						int x1[] = {-1,  0, 1, 0, -1,  1, 1, -1};
						int y1[] = {0 , -1, 0, 1, -1, -1, 1,  1};
						for(int k = 0; k < 8; k++){
							p = p1;
							p.y += y1[k];
							p.x += x1[k];
							if(marine[p.y][p.x] == 1){
								st.push(p);
								marine[p.y][p.x] = 0;
							}
						}
					}
					island++;
				}


			}
		}

		cout << island << endl;
	}
}

Measured memory_bytes: 1232
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

ll fifth_pow(ll a){
    ll aa = a * a;
    return aa * aa * a;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll x; cin >> x;

    reps(a, 1, 120){
        ll apow = fifth_pow(a);
        reps(b, -119, 120){
            // cout << a << " " << b << " " << apow - fifth_pow(b) << endl;
            if(apow - fifth_pow(b) == x){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3620
//master
import java.io.*;
import java.util.*;
public class Main {
    static int[][] memo;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        HashSet<String> set = new HashSet<>();
        for(int i = 0; i<n; i++) set.add(sc.next());
        p(set.size());
    }

    public static <T> void p(T message) {
        System.out.println(message);
    }

    public static <T> void pe(T message) {
        System.err.println(message);
    }

    public static <T> void pp(T message) {
        System.out.print(message);
    }
    
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 60788
def main():
    n, m = map(int, input().split())
    xyz = [list(map(int, input().split())) for _ in [0] * m]
    g = [[] for _ in [0] * n]
    for x,y,z in xyz:
        g[x - 1].append(y - 1)
        g[y - 1].append(x - 1)
    v = [False] * n
    cnt=0
    for i in range(n):
        if v[i]:
            continue
        cnt+=1
        q = [i]
        v[i]=True
        while q:
            j = q.pop()
            for k in g[j]:
                if v[k] == False:
                    q.append(k)
                    v[k]=True                
    print(cnt)
main()

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

namespace Test
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().solve();
        }

        public void solve()
        {
            int n = int.Parse(ReadLine());
            if(dfs(n)) WriteLine("Yes");
            else WriteLine("No");
        }

        static bool dfs(int total){
            if(total==0) return true;
            if(total<0) return false;
            return dfs(total-4) || dfs(total-7);
        }
    }
}

Measured memory_bytes: 13140
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] strargs = null;
		int[][] iTable;
		
		strargs = br.readLine().split("\\s+");
		int x = Integer.parseInt(strargs[0]);
		int y = Integer.parseInt(strargs[1]);
		
		iTable = new int[x + 1][y + 1];
		
		for (int i = 0; i < x; i++) {
			strargs = br.readLine().split("\\s+");
			for (int j = 0; j < y; j++) {
				iTable[i][j] = Integer.parseInt(strargs[j]);
				iTable[i][y] += iTable[i][j];
				iTable[x][j] += iTable[i][j];
			}
			iTable[x][y] += iTable[i][y];
		}
		
		for(int i = 0; i < x + 1; i++) {
			for(int j = 0; j < y + 1; j++) {
				System.out.print(iTable[i][j]);
				if (j != y) System.out.print(" ");
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 33688
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    ll N, M;
    cin >> N >> M;

    ll ans = 0;
    ans += min(N, M / 2);
    M = max(0LL, M - 2 * N);
    ans += M / 4;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    ll x, y;
    cin >> x >> y;
    ll ans = 0, now = x;
    while (now <= y) {
        now *= 2;
        ans++;
    }
    cout << ans << "\n";
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	int n, k, q;
	cin >> n >> k >> q;
	vector<int> a(n);

	if (k > q)
	{
		for(int i = 0; i < n; ++i) cout<< "Yes" << endl;
		return;
	}

	for(int i = 0; i < q; ++i)
	{
		int input;
		cin >> input; input--;
		a[input]++;
	}

	for(const auto& ia : a)
	{
		cout << (k - q + ia > 0  ? "Yes" : "No") << endl;
	}
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3704
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

int digit_sum(int num){
    if(num==0) return 0;
    return num%10+digit_sum(floor(num/10));
}

int main(){
    int A,B,count=0;
    cin>>A>>B;
    for(int i=A;i<=B;i++){
        string a=to_string(i);
        string b=a;
        reverse(b.begin(),b.end());
        if(a==b){
            count++;
        }
    }
    cout <<count<<endl;
    return 0;
}

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

int main(){
  int n ,temp2[1100];
  string S[1100];

  while(1){
    cin>>n;

    if(n == 0) break;

    for(int i = 0; i < n; i++){
      int count = 0;
      cin>>S[i];
      while(S[i][count] == '.'){S[i][count] = ' ';count++;}
      if(count){S[i][count-1] = '+';}
	temp2[i] = count;
    }
    
    for(int i = 0; i < n; i++){
      int f = 0;
      for(int j = i+1; j < n; j++){
	if(temp2[i] > temp2[j]) break;
	if(temp2[i] == temp2[j]){
	  f = j - i;
	  break;
	}
      }
      if(f >= 2){
	for(int j = 1; j < f; j++){
	  S[i+j][temp2[i]-1] = '|';
	}
      }
      
      cout<<S[i]<<endl;
      
    }
  }
  
  return 0;
}



Measured memory_bytes: 3788
using System;
using System.Collections.Generic;
public class ProCon
{
    public static void Main(){     
        //string[] line1 =　Console.ReadLine().Split(' ');
        string line = Console.ReadLine();
        double L = long.Parse(line);
        double volume = 0.00;
        volume = (L/3)*(L/3)*(L/3);
        Console.WriteLine(volume);
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
int lower_bound(int from, int until, const std::vector<long long int>& vec, const long long int target) {
	while (from < until) {
		auto mid = (from + until) / 2;
		if (vec[mid] < target) from = mid + 1;
		else until = mid;
	}
	return until;
}
int main(){
	int n; std::cin >> n;
	std::vector<long long int> numbers(n + 1, 0);
	for (auto i = 1; i <= n; ++i) {
		int a; std::cin >> a;
		numbers[i] = numbers[i - 1] + a;
	}
	long long int min_diff = LLONG_MAX;
	for (auto mid = 2; mid < numbers.size() - 2; ++mid) {
		auto left = lower_bound(1, mid, numbers, numbers[mid] / 2);
		auto min_left = std::max(std::min(numbers[left], numbers[mid] - numbers[left]), std::min(numbers[left - 1], numbers[mid] - numbers[left - 1]));
		auto max_left = std::min(std::max(numbers[left], numbers[mid] - numbers[left]), std::max(numbers[left - 1], numbers[mid] - numbers[left - 1]));
		auto right = lower_bound(mid, numbers.size(), numbers, (numbers.back() - numbers[mid]) / 2 + numbers[mid]);
		auto min_right = std::max(std::min(numbers.back() - numbers[right], numbers[right] - numbers[mid]), std::min(numbers.back() - numbers[right - 1], numbers[right - 1] - numbers[mid]));
		auto max_right = std::min(std::max(numbers.back() - numbers[right], numbers[right] - numbers[mid]), std::max(numbers.back() - numbers[right - 1], numbers[right - 1] - numbers[mid]));
		auto diff = std::max(max_left, max_right) - std::min(min_left, min_right);
		if (min_diff > diff) min_diff = diff;
	}
	std::cout << min_diff << std::endl;
}



Measured memory_bytes: 1920
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
	long N, D;
	long *X;
	long *Y;
	int ans;
	scanf("%ld", &N);
	scanf("%ld", &D);


	X = malloc((1 + N) * sizeof(long));
	Y = malloc((1 + N) * sizeof(long));
	ans = 0;
	for(int i = 1; i <= N; i++)
	{
		scanf("%ld", &X[i]);
		scanf("%ld", &Y[i]);
		if (X[i] * X[i] + Y[i] * Y[i] <= D * D)
			ans++;
	}
	printf("%d\n", ans);

	return (0);
}


Measured memory_bytes: 4856