akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public final class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int w = sc.nextInt();
        int[] weight = new int[n];
        int[] value = new int[n];
        for(int i=0; i<n; i++){
            weight[i] = sc.nextInt();
            value[i] = sc.nextInt();
        }
        long[][] dp = new long[n][w+1];
        for(int i=0; i<n; i++){
            dp[i][0] = 0;
        }
        // Arrays.fill(dp, 0);
        for(int i=0; i<n; i++){
            for(int j=1; j<w+1; j++){
                if(j>=weight[i]){
                    if(i==0)
                        dp[i][j] = value[i];
                    else{
                        // System.out.println(j);
                        dp[i][j] = Math.max(value[i]+dp[i-1][j-weight[i]],dp[i-1][j]);
                    }
                }else if(i-1>=0 && j-1>=0){
                    dp[i][j] = dp[i-1][j];
                }
            }
        }
        // for(int i=0; i<n; i++){
        //     for(int j=0; j<w+1; j++){
        //         System.out.print(dp[i][j]+" ");
        //     }
        //     System.out.println();
        // }
        System.out.println(dp[n-1][w]);
        sc.close();
    }
}

Measured memory_bytes: 127188
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
using namespace std;
namespace BM{
	#define MAXN0 300
	#define MAXN1 300
	#define MAXM 24000
	int n0,n1,m,ptr[MAXN0],next[MAXM],zu[MAXM];
	int to[MAXN0],fr[MAXN1],us[MAXN1],ze;
	void init(int _n0,int _n1){
		n0=_n0;n1=_n1;m=0;memset(ptr,~0,n0*4);
	}
	void ae(int u,int  v){
		next[m]=ptr[u];ptr[u]=m;zu[m]=v;++m;
	}
	int augment(int u){
		int i,v;
		for(i=ptr[u];~i;i=next[i])if(us[v=zu[i]]!=ze){
			us[v]=ze;
			if(!~fr[v]||augment(fr[v])){to[u]=v;fr[v]=u;return 1;}
		}
		return 0;
	}
	int solve(){
		memset(to,~0,n0*4);memset(fr,~0,n1*4);memset(us,~0,n1*4);
		int ret=0;
		for(ze=0;ze<n0;++ze)ret+=augment(ze);
		return ret;
	}
}
using namespace BM;
int x[1000];
int y[1000];
int r[1000];
int X[1000];
int Y[1000];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		for(int i=0;i<a;i++){
			scanf("%d%d%d",x+i,y+i,r+i);
		}
		for(int i=0;i<b;i++){
			scanf("%d%d",X+i,Y+i);
		}
		double left=0;
		double right=9999999;
		for(int i=0;i<100;i++){
			double M=(left+right)/2;
			init(a,b);
			for(int j=0;j<a;j++){
				for(int k=0;k<b;k++){
					if(M*r[j]>sqrt((x[j]-X[k])*(x[j]-X[k])+(y[j]-Y[k])*(y[j]-Y[k]))){
						ae(j,k);
					}
				}
			}
			if(solve()==b){
				right=M;
			}else left=M;
		}
		printf("%.10f\n",right);
	}
}

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

int main(void){
   char s[3];
   for(int i=0;i<3;i++){
      cin>>s[i];
   }
   int count=0;
   for(int i=0;i<3;i++){
      if(s[i]=='1') count++;
   }
   cout<<count<<endl;
   return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include "utils.cpp"
#define itr iterator
#define psb push_back
#define mkp make_pair
#define mkt make_tuple
#define fi first
#define se second
#define T tuple
#define E exit(0)
#define F function
#define V vector
#define pii pair<int, int>
#define tiii tuple<int, int, int>
#define ll long long
#define S string
#define bt cerr << "line " << __LINE__ << endl
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define MOD int(1e9 + 7)
#define INF (INT_MAX / 2)
using namespace std;

S ss;
int main() {
	cin >> ss;
	if (ss[2] == ss[3] && ss[4] == ss[5]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

using namespace std;

class Dice{
    public:
        int dice[6];
        int buf;
        void north(){
            buf = dice[0];
            dice[0] = dice[1];
            dice[1] = dice[5];
            dice[5] = dice[4];
            dice[4] = buf;
        }
        void south(){
            buf = dice[0];
            dice[0] = dice[4];
            dice[4] = dice[5];
            dice[5] = dice[1];
            dice[1] = buf;
        }
        void east(){
            buf = dice[0];
            dice[0] = dice[3];
            dice[3] = dice[5];
            dice[5] = dice[2];
            dice[2] = buf;
        }
        void west(){
            buf = dice[0];
            dice[0] = dice[2];
            dice[2] = dice[5];
            dice[5] = dice[3];
            dice[3] = buf;
        }

       void rotate_R(){
            buf = dice[4];
            dice[4] = dice[2];
            dice[2] = dice[1];
            dice[1] = dice[3];
            dice[3] = buf;
        }
}; 

int main(){
    Dice d;
    Dice d2;
    for(int i=0; i<6; i++){
        cin >> d.dice[i];
    }
    for(int i=0; i<6; i++){
        cin >> d2.dice[i];
    }
    
    for(int j=0; j<6; j++){
        if(d.dice[0] == d2.dice[j]){
            if(j == 0) break;
            if(j == 1) d2.north();
            if(j == 2) d2.west();
            if(j == 3) d2.east();
            if(j == 4) d2.south();
            if(j == 5){
                d2.north();
                d2.north();
            }
        }
    }
    
    int flg = 0;
    int cnt=0;
    for(int l=0; l<4; l++){
        cnt=0;
        d2.rotate_R();
        for(int i=0; i<6; i++){
            if(d.dice[i] == d2.dice[i]) cnt++;
        }
        if(cnt == 6){
            flg = 1;
            break;
        }           
    }
    if(flg == 0){
        for(int l=0; l<4; l++){
            cnt=0;
            d2.north();
            for(int i=0; i<6; i++){
                if(d.dice[i] == d2.dice[i]) cnt++;
            }
            if(cnt == 6){
                flg = 1;
                break;
            }           
        }
    }

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

Measured memory_bytes: 3088
#include <iostream>

int main(){
 int N;
 std::cin>>N;
 
 int a=N%10;
 if(a==2||a==4||a==5||a==7||a==9)
  std::cout<<"hon\n";
 else if(a==0||a==1||a==6||a==8)
  std::cout<<"pon\n";
 else
  std::cout<<"bon\n";

}

Measured memory_bytes: 3580
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
ll BASE_NUM = 1000000007;

int main()
{
  // 整数の入力

  double A, B, H, M;
  cin >> A >> B >> H >> M;
  double theta = 2.0 * M_PI * (H + M / 60) / 12 - 2.0 * M_PI * M / 60;
  double d = sqrt(A * A + B * B - 2 * A * B * cos(theta));
  cout << fixed << setprecision(12) << d << endl;
  return 0;
}

Measured memory_bytes: 4228
import math
n, m = map(int, input().split())
if n%2 == 1:
    for i in range(m):
        print(i+1, n-i)
else:
    for i in range(min(m, math.floor(int(n/4)))):
        print(i+1, n-i)
    for i in range(max(0, m-math.floor(int(n/4)))):
        print(i+1+min(m, math.floor(int(n/4))), n-i-min(m, math.floor(int(n/4)))-1)

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

using namespace std;

int a, b, c, k, ans;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	cin >> a >> b >> c >> k;

	ans += min(k, a);
	k -= min(k, a);
	k -= min(k, b);
	ans -= min(k, c);

	cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
using namespace std;
int main()
{
  string S;
  cin >> S;
  bool ans = true;
  //1
  if (S[0]!='A') ans = false;
  
  //2
  int Ccnt = 0;
  for  (int i = 2; i <= S.length()-2; i++) {
    if (S[i]=='C') Ccnt++;
  }
  if (Ccnt!=1) ans = false;
  
  //3
  int CpCnt = 0;
  for (int i = 0; i < S.length(); i++) {
    if (('A'<= S[i]) && (S[i] <= 'Z')) CpCnt++;
  }
  if (CpCnt != 2) ans = false;
  
  if (ans) cout << "AC" << endl;
  else cout << "WA" << endl;
  return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<char> s(n);
    for (int i = 0; i < n; i++){
        cin >> s.at(i);
    }

    if(n%2==1){
        cout << "No" << endl;
        return 0;
    }

    // vector<char> half(n/2);
    for(int i=0; i < n/2; i++){
        if(s[i + n/2] != s[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int n;
int d[310][310], a[310][310];

void init(int n){
   rep(i, 0, n){
       rep(j, 0, n){
           d[i][j] = INF;
           if(i == j) d[i][j] = 0;
       }
   }
}

void warshall_floyd(){
   rep(k, 0, n){
       rep(i, 0, n){
           rep(j, 0, n){
               d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
           }
       }
   }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    rep(i, 0, n){
        rep(j, 0, n){
            cin >> d[i][j];
            a[i][j] = d[i][j];
        }
    }
    warshall_floyd();
    bool f = true;
    rep(i, 0, n){
        rep(j, 0, n){
            if(d[i][j] != a[i][j]) f = false;
        }
    }
    if(f == false){
        cout << -1 << endl;
        return 0;
    }
    int ans = 0;
    rep(i, 0, n){
        rep(j, i + 1, n){
            bool g = true;
            rep(k, 0, n){
                if(a[i][j] == a[i][k] + a[k][j] && k != i && k != j) g = false; 
            }
            if(g) ans += a[i][j];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;




int main(int,  char **)
{
#ifdef LOCAL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	int x, y;
	scanf("%d%d", &x, &y);
	
	int ans = 2 + abs(x) + abs(y);

	for (int s = 0; s <= 1; s++)
		for (int e = 0; e <= 1; e++)
		{
			int nx = (s ? -x : x);
			int ny = (e ? -y : y);
			if (nx > ny) continue;
			int cans = s + e + ny - nx;
			ans = min(ans, cans);
		}
	printf("%d\n", ans);


	return 0;
}



Measured memory_bytes: 384
import Control.Applicative
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

solve :: Int -> Int -> String -> String -> Int
solve n m ss ts
    | all (\(q, r) -> B.index bs q == B.index bt r) (zip qs rs)
        = lcm'
    | otherwise = -1
  where
    lcm' = lcm n m
    bs = B.pack ss
    bt = B.pack ts
    sx = lcm' `div` n
    tx = lcm' `div` m
    qs = [0, tx .. n - 1]
    rs = [0, sx .. m - 1]

main = do
    [n, m] <- fmap read . words <$> getLine :: IO [Int]
    ss <- getLine
    ts <- getLine
    print $ solve n m ss ts

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

int main(){
    ll n,m,k,v;
    cin >> n >> m >> k;
    vector<ll> s1, s2;
    s1.push_back(0), s2.push_back(0);
    for(int i=0;i<n;i++) {
        cin >> v;
        s1.push_back(s1.back() + v);
    }
    for(int i=0;i<m;i++) {
        cin >> v;
        s2.push_back(s2.back() + v);
    }
    ll best = 0;
    // i amount on s1
    int j = m; // j on s2
    int res = 0;
    for(int i=0;i<=n;i++) {
        while(j>0 && s2[j] + s1[i] > k) {
            j--;
        }
        if(s2[j] + s1[i] <= k) {
            res = max(res, i+j);
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 7952
#include<iostream>
#include<cstdio>

using namespace std;

#define maxn 300010
typedef long long ll;
ll n,sum[maxn],xsum[maxn],ans;

inline int readin(){
    int x=0,s=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')s=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*s;
}

int main(){
    n=readin();
    for(int i=1,x;i<=n;++i){
	x=readin();
	sum[i]=sum[i-1]+1ll*x;
	xsum[i]=xsum[i-1]^x;
    }
    for(int i=1,j=1;i<=n;++i){
	while(sum[i]-sum[j-1]!=(xsum[i]^xsum[j-1]))++j;
	ans+=1ll*(i-j+1);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3840
#include<stdio.h>

int main(){
int A,B,C;

scanf("%d%d%d",&A,&B,&C);
if(A<=13||A>=1||B<=13||B>=1||C<=13||C>=1){
 if(A+B+C>=22)
    printf("bust");
else
    printf("win");
}

}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline
N = int(input())
x = list(map(int, input().split()))
mod = 10 ** 9 + 7

class Factorial:
  def __init__(self, n, mod):
    self.f = [1]
    for i in range(1, n + 1):
      self.f.append(self.f[-1] * i % mod)
    self.i = [pow(self.f[-1], mod - 2, mod)]
    for i in range(1, n + 1)[: : -1]:
      self.i.append(self.i[-1] * i % mod)
    self.i.reverse()
  def factorial(self, i):
    return self.f[i]
  def ifactorial(self, i):
    return self.i[i]
  def combi(self, n, k):
    return self.f[n] * self.i[n - k] % mod * self.i[k] % mod

f = Factorial(N, mod)
res = 0
t = [0] * (N + 1)
for i in range(N):
  t[i + 1] = t[i] * (i + 1) + f.factorial(i) % mod
  t[i + 1] %= mod
#print(t)
for i in range(N - 2, -1, -1):
  res += (x[i + 1] - x[i]) * t[i + 1] * f.factorial(N - 1) % mod * f.ifactorial(i + 1) % mod
  res %= mod
print(res)

Measured memory_bytes: 63128
N = int(input())
SP = [list(map(str,input().split())) for _ in range(N)]


for i in range(N):
  SP[i][1] = int(SP[i][1]) * (-1)
sortedSP = sorted(SP)

for i in range(N):
  print(SP.index(sortedSP[i])+1)

Measured memory_bytes: 3060
#include<set>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int b[100],m,n,o;
  set<pair<int,pair<int,int> > > a;
  set<pair<int,pair<int,int> > >::iterator it;
  while(cin>>m>>n>>o&&m+n+o){
    for(i=0;i<m;i++)
      b[i]=i;
    a.clear();
    for(i=0;i<n;i++){
      int p,q,r;
      cin>>p>>q>>r;
      a.insert(make_pair(p,make_pair(q-1,r-1)));
    }
    for(it=a.begin();it!=a.end();it++)
      swap(b[(*it).second.first],b[(*it).second.second]);
    cout<<b[o-1]+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 940
#include <iostream>
#include <string>
#include <stack>
#include <cctype>

using namespace std;

#define DEBUG(x) cerr << #x << " = " << x << endl

int main() {
    while(true) {
        string line; getline(cin, line);
        if(line == ".") break;
        stack<char> s;
        bool valid = true;
        for(int i = 0; i < (int)line.length(); i++) {
            char c = line[i];
            if(c == '(' || c == '[') s.push(c);
            else if(c == ')') {
                if(s.empty() || s.top() != '(') valid = false;
                else s.pop();
            }
            else if(c == ']') {
                if(s.empty() || s.top() != '[') valid = false;
                else s.pop();
            }
        }
        valid &= s.empty();
        cout << (valid ? "yes" : "no") << endl;
    }
}

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

int n;
int m;
vector<int> s;
vector<int> c;

bool ok(string str) {
    int len = str.length();
    if (len != n) return false;
    for (int i = 0; i < m; ++i) {
        if (str[s[i]] != (char)(c[i] + '0')) return false;
    }
    return true;
}


int main() {
    cin >> n >> m;
    s.resize(m);
    c.resize(m);
    for (int i = 0; i < m; ++i) {
        cin >> s[i] >> c[i];
        s[i]--;
    }

    for (int i = 0; i < 1000; ++i) {
        if (ok(to_string(i))) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
/* You are being watched. */


//~ while (clock() <= 69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")

using namespace std;

//~ #include <ext/pb_ds/assoc_container.hpp>
//~ #include <ext/pb_ds/tree_policy.hpp>
//~ using namespace __gnu_pbds;
//~ template <typename T>
//~ using ordered_set =
  //~ tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) (x).begin(), (x).end()
#define show(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
//using li = __int128;
//using uli = unsigned __int128;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

void solve() {
  int n; cin >> n;
  vector <ll> a(n);
  for(auto &x : a) cin >> x;
  ll xr = 0;
  for(int i = 2; i < n; i++) xr ^= a[i];
  ll sum = a[0] + a[1];
  
  if(sum % 2 != xr % 2) {
    print(-1);
    return;
  }
  
  // a[0] ^ a[1] = xr ... (1)
  // we know,
  // a[0] + a[1] = a[0] ^ a[1] + 2 * a[0] & a[1]
  // a[0] + a[1] = xr + 2 * a[0] & a[1] (from (1))
  // (a[0] & a[1]) = (a[0] + a[1] - xr) / 2
  
  ll ando = (sum - xr) / 2ll;
  if((ando > a[0]) or (ando & xr)) {
    print(-1);
    return;
  }
  for(int i = 45; i >= 0; i--) {
    if(!((xr >> i) & 1)) continue;
    if((ando | (1LL << i)) > a[0]) continue;
    ando |= (1LL << i);
  }
  if(ando == 0) ando = a[0] + 1;
  print(a[0] - ando);
}

int main() {
  int t; t = 1;
  while(t--) solve();
}




Measured memory_bytes: 3572
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    k = int(input())
    print(a[k-1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <stack>
#include <queue>
#include <vector>
#define MAX_N 100
#define INF 10000000

using namespace std;

//総和
/*
int t_sum(int x) {
	int sum = 0;
	while (x > 0) {
		sum += x % 10;
		x = x / 10;
	}
	return sum;
}
*/

int n;
int a[200000];

void solve() {
	if (n < 1200) cout << "ABC" << endl;
	else if (n < 2800) cout << "ARC" << endl;
	else cout << "AGC" << endl;
}

int main() {
	cin >> n;
	solve();
	return 0;
}

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

#define REP(i, n) for(int64_t i = 0; i < n; i++)
#define REPR(i, n) for(int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for(int64_t i = m; i < n; i++)
#define FORR(i, m, n) for(int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
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;}
const ll INF= 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

ll n,a,b;

int main(){
    cin >> n >> a >> b;
    if(a==0){
        cout << 0 << endl;
        return 0;
    }
    ll q = n/(a+b);
    if(q==0)
    {
        if(n<a)
        {
            cout << n << endl;
        }
        else
        {
            cout << a << endl;
        }
        
    }
    else
    {
        ll t = n-q*(a+b);
        cout << (q*a+((t-a<=0)?t:a)) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
		int b = sc.nextInt();
      	if(b < 10) a = a * 10 + b;
        else if(b < 100) a = a * 100 + b;
      	else a = a * 1000 + b;
        System.out.println((int)Math.sqrt(a) * (int)Math.sqrt(a) == a ? "Yes" : "No");
    }
}


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

int main(){
    int h, w, a, b;
    cin >> h >> w >> a >> b;

    rep(i,h){
        rep(j,w){
            if((i<b && j<a) || (i>=b && j>=a)){
                cout << 0;
            }
            else{
                cout << 1;
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 1280
M, D = map(int, input().split())

ans = 0
for m in range(1, M + 1):
    for d in range(1, D + 1):
        d10, d1 = d // 10, d % 10
        if d1 >= 2 and d10 >= 2 and d1 * d10 == m:
            ans += 1

print(ans)


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

int main(){
  int S,h,s,m;
  cin >>S;
  h=S/3600;
  S-=h*3600;
  s=S/60;
  S-=s*60;
  m=S;
  printf("%d:%d:%d\n",h,s,m);
}



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

int main() {
    int n;
    scanf("%d", &n);
    vector<int> dp(3);
    for (int day = 0; day < n; ++day) {
        vector<int> new_dp(3, 0);
        vector<int> c(3);
        for (int i = 0; i < 3; ++i) {
            scanf("%d", &c[i]);
        }
        for (int i = 0; i < 3; ++i) {
            for (int j = 0; j < 3; ++j) {
                if (i != j) {
                    new_dp[j] = max(new_dp[j], dp[i] + c[j]);
                }
            }
        }
        dp = new_dp;
    }
    printf("%d\n", max(max(dp[0], dp[1]), dp[2]));

}

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

int main(void)
{
	int W,H,x,y,r;
	
	cin >> W >> H >> x >> y >> r;
	
	if((W <= x) || (x <= 0)) {
		cout << "No" << endl;
	} else if((H <= y) || (y <= 0)) {
		cout << "No" << endl;
	}else if((x + r <= W) && (x + r >= 0)) {
		if((y + r <= H) && (y + r >= 0) ) {
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	} else {
		cout << "No" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <map>
#include <cstdlib>
#define INF (1000000007)
#define rep(i,N) for(ll i=0;i<N;i++)
#define rep2(i,j,k) for(ll i=j; i<k;i++)
typedef long long int ll;
using namespace std;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using vs=vector<string>;
using vvs=vector<vector<string>>;

template <typename T>
void print(T v){
    for(size_t i=0;i<v.size();i++){
        cout<<i<<": "<<v[i]<<endl;}
}

template <typename T>
void print2(T v){
    for(size_t i=0;i<v.size();i++){
        cout<<i<<": ";
        for(size_t j=0;j<v[0].size();j++){
            cout<<v[i][j]<<" ";
        }
        cout<<endl;
    }
}

template <typename T>
T slice(T v,ll left,ll right){
    T ret(0);
    copy(v.begin()+left,v.begin()+right,back_inserter(ret));
    return ret;
}

int main(){
    ll A,B;
    cin>>A>>B;
    ll ans=max(2*A-1,2*B-1);
    ans=max(ans,A+B);
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

typedef long long ll;

int a[10][2];
char c;

int main(){
    while(cin>>c){
	a[0][0]=c-'0';
	for(int i=1;i<10;i++){cin>>c;a[i][0]=c-'0';}
	for(int i=0;i<9;i++){
	    for(int j=0;j<9-i;j++){
		a[j][(i+1)%2]=(a[j][i%2]+a[j+1][i%2])%10;
	    }
	}
	cout<<a[0][1]<<endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
#define PI 3.14159265358979323846264338327950L

int main() {
	int N;
	cin >> N;
	int A[2 * 100000];
	memset(A, 0x00, sizeof(A));
	for (int ii = 0; ii < N - 1; ii++) {
		int temp;
		cin >> temp;
		A[temp - 1] += 1;
	}
	for (int ii = 0; ii < N; ii++) {
		cout << A[ii] << endl;
	}
	return 0;
}

Measured memory_bytes: 4364
function main (input){
  const args  = input.split('');
  const s1 = parseInt(args[0],10);
  const s2 = parseInt(args[1],10);
  const s3 = parseInt(args[2],10);
  
  const sum = s1 + s2 + s3 ;
  
  console.log(sum);
}
 
 const input = require('fs').readFileSync('/dev/stdin', 'utf8');
 
 main (input);

Measured memory_bytes: 22832
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	int[] d = new int[n];
    	for(int i = 0;i < n; i++) {
    		d[i] = sc.nextInt();
    	}
    	
    	int ans = 0;
    	for(int i = 0; i < n; i++) {
    		for(int j = i + 1; j < n; j++) {
    			ans = ans + d[i] * d[j];
    		}
    	}
    	
    	System.out.println(ans);

	}

}


Measured memory_bytes: 20948
#include<stdio.h>
int main(){
  int n,d[101],i,j,sum=0;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&d[i]);
  }
  for(i=0; i<n-1; i++){
    for(j=i+1; j<n; j++){
      sum+=d[i]*d[j];
    }
  }
  printf("%d\n",sum);
  return 0;

}

Measured memory_bytes: 128
#include<stdio.h>
main(){
    int a,b,i;
    char op;
    
    for(i=1;i<1000;++i){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+'){
            printf("%d\n",a+b);
        }
        else if(op=='-'){
            printf("%d\n",a-b);
        }
        else if(op=='*'){
            printf("%d\n",a*b);
        }
        else if(op=='/'){
            printf("%d\n",a/b);
        }
        else if(op=='?'){
            break;
            
        }
        
    }
    return 0;
}


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

int main(){
    int N, A, B, C;
    cin >> N >> A >> B >> C;
    int Di[N];
    int nA = A, nC = C;
    int cal = C / A;
    for(int i = 0; i < N; i++){
        cin >> Di[i];
    }
    sort(Di, Di + N, greater<int>());
    for(int i = 0; i < N; i++){
        if(cal <= (nC + Di[i]) / (nA + B)){
            nC += Di[i];
            nA += B;
            cal = nC / nA;
        }else{
            break;
        }
    }
    cout << cal << endl;
    return 0;
}

Measured memory_bytes: 1176
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			while(sc.hasNext()) {
				String str = sc.nextLine();
				str = str.replace('.', ',');
				str = str.replace(',', ' ');
				String[] tokens = str.split(" ");
				int count = 0;
				
				for(int i=0; i<tokens.length; i++) {
					int n = tokens[i].length();
					
					if(n>=3 && n<=6) {
						if(count > 0) System.out.print(" ");
						System.out.print(tokens[i].substring(0,n));
						count++;
					}
				}
				if(count > 0) System.out.println();
			}
		}
	}
}


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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;
typedef vector<unordered_map<lli,lli>> graph;

lli n;
mat a;
vll ans;
int main(){
  cin >> n;
  a = mat(n+1,vll(2));
  for(lli i = 1;i <= n;i++){
    cin >> a[i][0];
    a[i][1] = -i;
  }
  ans = vll(n+1);
  sort(a.begin(),a.end(),greater<vll>());
  lli m = n;
  for(lli i = 0;i < n;i++){
    m = min(m,-a[i][1]);
    ans[m] += (i+1)*(a[i][0]-a[i+1][0]);
  }
  for(lli i = 1;i <= n;i++) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 7296
//In the name of God
#include <bits/stdc++.h>
using namespace std;

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

const ll maxn = 2e5 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e15;

#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second

ll n, ans, a[maxn], l[maxn], r[maxn];

bool check(ll x, ll d){
    while(x > 1){
        d--;
        x = (x + 1) >> 1;
    }
    return (d >= 0);
}

int main(){
    fast_io;

    cin >> n;
    for(ll i = 0; i <= n; i++){
        cin >> a[i];
        r[i] = l[i] = a[i];;
    }
    for(ll i = n; i > 0; i--){
        l[i - 1] += (l[i] + 1) / 2;
        r[i - 1] += r[i];
        if(r[i] == 0 || !check(l[i], i)){
            cout << -1;
            return 0;
        }
    }
    if(l[0] > 1 || r[0] == 0){
        cout << -1;
        return 0;
    }
    r[0] = 1;
    for(ll i = 0; i <= n; i++){
        ans += r[i];
        r[i] -= a[i];
        r[i + 1] = min(r[i + 1], r[i] * 2);
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 6020
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <ctime>
#include <queue>
#include <sstream>
#include <utility>
#include <bitset>

using namespace std;

#define MP make_pair 
#define PB push_back 
#define MOD (1000000007) 
#define eps 1e-8

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

int n,m;
ll ans;

ll fact(int x)
{
	if(x==1) return 1;
	return ((ll)x*fact(x-1))%MOD;
}

int main()
{
	cin>>n>>m;
	if(n>m) swap(n,m);
	if(m-n>1) 
	{
		cout<<0;
		return 0;
	}
	ans=(fact(n)*fact(m))%MOD;
	if(n==m)cout<<(ans*2ll)%MOD; else cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
ll n,a,b;
const int nmax = 100000;
vll h(nmax);
bool enough(ll t){
    ll ab = 0;
    REP(i,n){
        ll hp = h[i];
        hp -= t*b;
        if(hp>0){
            ab+=(hp-1)/(a-b)+1;
        }
    }
    bool ret = true;
    if(ab>t){
        ret = false;
    }
    return ret;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> a >> b;
    //vll h(n);
    ll sum = 0;
    REP(i,n){
        ll tmp;
        cin >> tmp;
        h[i]=tmp;
        sum+=h[i];
    }
    ll ok = (sum-1)/b+1;
    ll ng = -1;
    while(abs(ok-ng)>1){
        ll mid = (ok+ng)/2;
        if(enough(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 1024
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	if a+b == 3 {
		fmt.Println(3)
	} else {
		if a > b {
			fmt.Println(a - b)
		} else {
			fmt.Println(b - a)
		}
	}
}


Measured memory_bytes: 512
#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,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int conv(char x) {
        switch(x) {
        case 'r':
                return 0;
        case 's':
                return 1;
        case 'p':
                return 2;
        }
}

int main() {
        int n, k, p[3];
        string t;
        cin >> n >> k >> p[0] >> p[1] >> p[2] >> t;

        int ans = 0;
        vector<bool> m(n, false);

        auto win = [&](char c) {
                return (conv(c) + 2) % 3;
        };

        REP(i, n) {
                if (i < k || t[i - k] != t[i] || !m[i - k]) {
                        ans += p[win(t[i])];
                        m[i] = true;
                }
        }

        cout << ans << endl;

        return 0;
}


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

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

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

int main(){
    int N; cin >> N;
    vector<int> x( N );
    REP( i, N ) cin >> x[i];
    auto t = x;
    sort( ALL( t ) );

    int l = t[N / 2 - 1];
    int r = t[N / 2];

    REP( i, N ){
        if( x[i] <= l ) cout << r << endl;
        else cout << l << endl;
    }

}


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

ans = []
res = 0
for i in range(N):
    if i%2==0:
        res += A[i]
    else:
        res -= A[i]

ans.append(res)

for i in range(1,N):
    res = 2*A[i-1]-ans[-1]
    ans.append(res)

print(*ans)

Measured memory_bytes: 95384
//https://atcoder.jp/contests/abc088/tasks/abc088_b


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

  int n, ans;
  cin >> n;


  vector<int> a(n);
  rep(i,n) {
    cin >> a.at(i);
  }

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

  int A = 0;
  int i;
  rep(i,n) {
    if (i %2 == 0) {
    A+=a.at(i);
    }
  }


  int B = 0;
  rep(i,n) {
    if (i %2 == 1) {
    B+=a.at(i);
    }
  }

  ans = A-B;
  cout << ans << endl; 

 return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);

    while (a > 0 && c > 0)
    {
        c -= b;
        if (c <= 0)
        {
            printf("Yes\n");
            break;
        }
        a -= d;
        if (a <= 0)
        {
            printf("No\n");
            break;
        }
    }

    return 0;
}

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

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

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  ll n, k;
  cin >> n >> k;

  vll a(n);
  rep(i, n) cin >> a[i];

  ll l = 1, r = 1e9 + 10;
  while (l < r) {
    ll c = (l + r) / 2;
    ll cnt = 0;
    rep(i, n) {
      cnt += (a[i] + c - 1) / c;
      cnt--;
    }

    if (cnt <= k) {
      r = c;
    } else {
      l = c + 1;
    }
  }

  cout << l << endl;

  return 0;
}


Measured memory_bytes: 4772
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  if(s.substr(0,4)=="YAKI") cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Main {

    public static void main(String[] args) throws IOException {
        ReaderA.init(System.in);
        long x = ReaderA.nextLong();
        long y = ReaderA.nextLong();
        if (x % y == 0) System.out.println(-1);
        else System.out.println(x);
    }
}

/**
 * Reader class based on the article at "https://www.cpe.ku.ac.th/~jim/java-io.html"
 */
class ReaderA {
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    static void init(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    //    Get a whole line.
//    static String line() throws IOException {
//        return reader.readLine();
//    }
//
//    static double nextDouble() throws IOException {
//        return Double.parseDouble(next());
//    }
}



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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

using namespace std;

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

	map<string, int> card = {};
	rep (i, 0, n) {
		string tmp;
		cin >> tmp;
		card[tmp]++;
	}

	cin >> m;

	rep (i, 0, m) {
		string tmp;
		cin >> tmp;
		card[tmp]--;
	}

	int res = 0;
	for (pair<string, int> p : card)
		res = max(p.second, res);

	cout << res << endl;

	return 0;
}

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

using namespace std;

int main() {
  int d, n;
  cin >> d >> n;
  switch (d) {
  case 0:
    if (n!=100) cout << n << endl;
    else cout << n + 1 << endl;
    break;
  case 1:
    if (n!= 100) cout << n * 100 << endl;
    else cout << (n+1) * 100 << endl;
    break;
  case 2:
    if (n!=100) cout << n * 10000 << endl;
    else cout << (n+1) * 10000 << endl;
    break;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 200'000;
const int LOGN = 18;

int n, m, k;

void solve(int test)
{
  cin >> n >> k;
  if (k == 1) {
    cout << "0\n";
  }
  else {
    cout << n - k << '\n';
  }
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(){
  char r[5], a[5];
  int h, b, i, j;

  while(scanf("%s%s", r, a) && strcmp(r, "0") != 0 && strcmp(a, "0") != 0){
    h = b = 0;
    for(i = 0; i < 4; ++i){
      for(j = 0; j < 4; ++j){
        if(r[i] == a[j]){
          if(i == j) h++;
          else b++;
        }
      }
    }
    printf("%d %d\n", h, b);
  }
  return 0;
}

Measured memory_bytes: 540
/**
  @file c.cpp
  @title C - 755
  @url https://atcoder.jp/contests/abc114/tasks/abc114_c
**/

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)

int ret = 0;

void dfs(int now, const int N) {
  string S = to_string(now);
  if (1 <= now && now <= N
      && S.find("3") != string::npos
      && S.find("5") != string::npos
      && S.find("7") != string::npos) {
    // cout << S << endl; //debug
    ret++;
  }

  if (0 <= now && now <= N) {
    now = now * 10;
    dfs(now + 3, N);
    dfs(now + 5, N);
    dfs(now + 7, N);
  }
}

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

  dfs(0, N);
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
const int MAXN = 3e5 + 5;
int n, result = MAXN;
string s;
int west[MAXN], east[MAXN];

int westsum(int x, int y) {
	return west[y] - west[x - 1];
}

int eastsum(int x, int y) {
	return east[y] - east[x - 1];
}

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

	cin >> n >> s;
	if (n == 1) {
		cout << 1 << "\n";
		return 0;
	}
	s = '#' + s;
	west[0] = east[0] = 0;
	for (int i = 1; i <= n; i++) {
		west[i] = west[i - 1] + (s[i] == 'W');
		east[i] = east[i - 1] + (s[i] == 'E');
	}

	result = min(result, eastsum(2, n));
	result = min(result, westsum(1, n - 1));
	for (int i = 2; i < n; i++)
		result = min(result, westsum(1, i - 1) + eastsum(i + 1, n));

	cout << result << "\n";
	return 0;
}


Measured memory_bytes: 3056
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl;
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ');
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
//cout << fixed << setprecision(10);

int main () {
  int k, x;
  cin >> k >> x;
  int total = k*500;
  cout << (total>=x?"Yes":"No") << endl;
  return 0;
}

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


int main(){
    int n;
    cin >> n;
    bool ok = false;
    for(int i = 1;i < 10;i++){
        for(int j = 1;j < 10;j++) if(i*j == n)ok = true;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;
int main(void){
    int n =0, x=0;
    int j =0, d=0;
    cin >> n >> x;
    vector<int>L(n, 0);
    rep(i, n) cin >> L[i];
    while(d<= x and j <= n-1){
        d += L[j];
        //cout << d << endl;
        j+=1;
    }
    if (d>x){
        cout << j << endl;
    }else{
        cout << j+1 << endl;
    }
    
}

Measured memory_bytes: 256
import sys, re
from math import ceil, floor, sqrt, pi, factorial#, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    s = s_input()

    count = 0
    for bit in list(product([0,1], repeat=len(s)-1)):
        eval_s = s[0]
        for i in range(len(bit)):
            if bit[i] == 1:
                eval_s += '+'
            eval_s += s[i+1]
        count += eval(eval_s)

    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 62572
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int ak,oak;

main(){
	int n,a,b;
	string s;
	cin>>n>>a>>b>>s;
	debug(n,a,b,s);
	rep(i,n){
		if((s[i]=='a')&&(a+b>ak)){
			dump("Yes");
			ak++;
		}else if((s[i]=='b')&&(a+b>ak)&&(b>oak)){
			dump("Yes");
			oak++;
			ak++;
		}else dump("No");
	}
}

Measured memory_bytes: 896