akhauriyash/Code-Regression huggingface dataset:
from itertools import product

N = int(input())

cnt = [0]*100000000

for x in range(1,N):
    flag=0
    for y in range(1,N):
        if x*y>=10**4:
            flag=1
            break
        for z in range(1,N):
            if flag==1:
                break
            elif x*z>=10**4 or y*z>=10**4:
                # flag=1
                break
            else:
                if x**2 + y**2 + z**2 + x*y + y*z + z*x <=10**4+1:
                    cnt[x**2 + y**2 + z**2 + x*y + y*z + z*x -1] += 1



for i in range(N):
    print(cnt[i])


Measured memory_bytes: 851040
#include<bits/stdc++.h>
using namespace std;
int main(){long long a[3],m=0,i;
cin>>a[0]>>a[1]>>a[2];sort(a,a+3);
for(i=0;i<2;i++){
    if(a[i]==a[i+1])
    m++;
}if(m==1)
cout<<"Yes";
else
cout<<"No";
    return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main(){
    ll A, B, T, ans = 0;
    cin >> A >> B >> T;
    for(ll i = A; i < T + 0.5; i += A){
        ans += B;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(i=0; i<n; i++)

int main(void)
{
	int x, u, k, j;
	scanf("%d", &x);
	k = x/500;
	u = k*1000;

	x -= 500*k;
	j = x/5;
	u += j*5;

	printf("%d", u);
	return 0;
}

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

const int N = 100005;

int n, m, u, v, cnt = 0, in[N], bit[N];
vector<int> adj[N];

void print(int u, int v)
{
    if (u == 0 || v == 0)
        return;
    cout << u << " " << v << '\n';
    bit[u] ^= 1;
}

void DFS(int u, int p = 0)
{
    in[u] = ++cnt;
    for (int &v : adj[u])
        if (v != p)
        {
            if (in[v] == 0)
                DFS(v, u);
            else if (in[v] > in[u])
                print(u, v);
        }
    if (bit[u])
        print(u, p);
    else
        print(p, u);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m;
    if (m & 1)
        return cout << -1, 0;
    while (m--)
    {
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    DFS(1);
}


Measured memory_bytes: 13952
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ff first
#define ss second
#define endl '\n'
#define MAX INT_MAX
#define MIN INT_MIN
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
#define pb push_back
#define sz(a) (int)((a).size())
#define all(a) a.begin(),a.end()
#define loopf(i,a,b) for(int i = a;i < b;i++)
#define loopb(i,a,b) for(int i = a;i >= b;i--)
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;


int32_t main()
{
    fast

   int test=1;
   //cin>>test;


  //while(test--)
  //{
  
    int n;
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++)
    {
      if(i%3 && i%5)sum+=i;
    }

    cout<<sum;

  //while loop ending
 // }
  

return 0;
}

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

#define MAX 2000

int main(){
  int n, i, j, a[20], dp[MAX+1], in;

  memset(dp,0,sizeof(dp));

  scanf("%d" ,&n);
  for(i = 0 ; i < n ; i++){
    scanf("%d" ,a + i);
  }

  dp[0] = 1;
  for(i = 0 ; i < n ; i++){
    for(j = MAX ; j >= 0 ; j--){
      if(dp[j] && j + a[i] <= MAX){
        dp[j + a[i]] = 1;
      }
    }
  }
  
  scanf("%d" ,&n);
  for(i = 0 ; i < n ; i++){
    scanf("%d" ,&in);
    if(dp[in]){
      puts("yes");
    }else{
      puts("no");
    }
  }

  return 0;
}


Measured memory_bytes: 2064
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
	int n;
	cin >> n;
	if(n<1000){
		cout << "ABC" << endl;
	}else{
		cout << "ABD" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <queue>
#include <stack>

using namespace std;

const int maxn = 1e5 + 5;

int dp[maxn][2];
int a[maxn];

int main(int argc, char const *argv[]) {
    int N; cin>>N;
    dp[0][0] = dp[0][1] = 1;
    for (int i = 1; i <= N; i ++) {
        scanf("%d", a + i);
        if (i == 1) a[0] = a[1];
        if (a[i] > a[i - 1]) {
            dp[i][0] = dp[i - 1][0];
            dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + 1;
        }
        else if (a[i] < a[i - 1]) {
            dp[i][1] = dp[i - 1][1];
            dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + 1;
        }
        else if (a[i] == a[i - 1]) {
            dp[i][0] = dp[i - 1][0];
            dp[i][1] = dp[i - 1][1];
        }
    }
    
    cout<<min(dp[N][0], dp[N][1])<<endl;
    
    return 0;
}

Measured memory_bytes: 1408
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same(self, x, y):
        return self.find(x) == self.find(y)
 
n,m = list(map(int,input().split()))
p = list(map(int,input().split()))
uft = UnionFind(n)

for _ in range(m):
    x,y = map(int, input().split())
    uft.unite(x,y)
count = 0
for i in range(n):
    if uft.same(i+1,p[i]): count += 1
 
print(count)

Measured memory_bytes: 13812
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

Int Abs(Int n){
	return (n>0)?n:-n;
}

int main() {
	Int n,k,kk,res;
	while(cin>>n,n){
		int i;
		res=0;
		for(k=1;n;k*=-10){
			kk=Abs(k);
			i=0;
			while(Abs(n)/kk%10){
				i++;
				n-=k;
			}
			res+=i*kk;
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;

int N, M;
vector<string> dp;
const int cost[] = {-1,2,5,5,4,5,6,3,7,6};
vector<long long> A;

string maxstr(string a, string b)
{
    if(a.length() < b.length())
    {
        return b;
    }
    else if (a.length() > b.length())
    {
        return a;
    }
    else
    {
        return (a < b ? b : a);
    }
}

int main()
{
    cin >> N >> M;
    dp.resize(N + 1);
    for (int i = 0; i < M; i++)
    {
        int a;
        cin >> a;
        A.push_back(a);
    }

    for (int i = 1; i <= N; i++)
    {
        for (int j = 0; j < M; j++)
        {
            int d = A[j];
            int c = cost[d];
            if (i - c >= 0)
            {
                if(dp[i - c] == "" && i - c != 0)
                {
                    continue;
                }
                string t = maxstr(dp[i - c] + to_string(d), to_string(d) + dp[i - c]);
                dp[i] = maxstr(dp[i], t);
                //cout << dp[i] << endl;
                //cout << "c = " << c << " i = " << i << endl;
            }
        }
    }
    cout << dp[N] << endl;

    return 0;
}


Measured memory_bytes: 27136
#include<bits/stdc++.h>
#define ll  long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 1000000000000000
#define mod 1000000007
#define ld long double
#define pll pair<ll,ll>
using namespace std;

int main()
{ 
	
fast;

ll h1,m1,h2,m2,k;
cin>>h1>>m1>>h2>>m2>>k;

ll v1=h1*60+m1,v2=h2*60+m2;

ll l1=v1,l2=v2-k;
cout<<l2-l1<<endl;

}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

int n;
vector<int> a;

int main () {
  cin >> n;
  a.resize(n);
  rep(i,n) cin >> a[i];

  sort(all(a));

  int m = a[n-1];
  int i = distance(a.begin(), lower_bound(all(a), m/2));
  if(i == n - 1 || abs(a[i] - m/2) > abs(a[i-1] - m/2)) i--;

  cout << m << " " << a[i] << endl;

  return 0;
}


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

using namespace std;

int main()
{
    int n,fo=0,tw=0,on=0;
    bool flag = 0;
    scanf("%d",&n);
    int i;long long a;
    for(i=0;i<n;i++){
        scanf("%lld",&a);
        if(a%4==0)fo++;
        else if (a%2==0)tw++;
        else on++;
    }
    if(on+(tw%2)>fo+1)printf("No");
    else printf("Yes");
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int i,n,m,sugo[1005],sai[1005],current=1;
    
    while(1){
        current=1;
        scanf("%d %d",&n,&m);
        if(n==0&&m==0)break;
        for(i=1;i<=n;i++)
            scanf("%d",&sugo[i]);
        for(i=1;i<=m;i++)
            scanf("%d",&sai[i]);
        
        for(i=1;i<=m;i++){
            if(current+sai[i]>=n)break;
            current+=sai[i];
            if (current+sugo[current]>=n)break;
            current+=sugo[current];
            
        }
        printf("%d\n",i);
    }
    return 0;
}

Measured memory_bytes: 608
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>
using namespace std;

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define llrp(i,n) for(long long i=0;i<n;i++)
#define llrep(i,m,n) for(long long i=m;i<=n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define vcin(a); rp(i,a.size()){cin>>a[i];}
#define vcout(a); rp(i,a.size()){cout<<a[i]<<endl;}
#define allchar(c) for(char c='a';c<='z';c++)

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef long long ll;
typedef string S;
typedef pair<int,int> P;
typedef queue<int> qi;

const int mod=1e9+7;

ll modpow(ll a,ll b,ll p){
    if(b==0){
        return 1;
    }elif(b%2==0){
        return modpow((a*a)%p,b/2,p);
    }else{
        return (a*modpow(a,b-1,p))%p;
    }
}

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

    cout << (n==7||n==5||n==3?"YES":"NO") << endl;
    return 0;
}

Measured memory_bytes: 256
n,a,b = map(int,input().split())
if n < 2:
    if a == b:
        print("1")
        exit()
    else:
        print("0")
        exit()
if a > b:
    print("0")
    exit()

ans = ((b * (n-1) + a) - (a * (n-1) + b)) + 1
print(ans)

Measured memory_bytes: 3060
n = int(input())
box = [list(map(int, input().split())) for i in range(n)]

li = list(sorted(box, key=lambda x: sum(x), reverse = True))

taka = []
aoki = []

for i in range(len(li)):
    taka.append(li[0][0])
    del li[0]
    if li == []:
        print(sum(taka) - sum(aoki))
        quit()
    aoki.append(li[0][1])
    del li[0]
    if li ==[]:
        print(sum(taka) - sum(aoki))
        quit()

Measured memory_bytes: 32992
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

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

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

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

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

    queue<P> que;
    que.emplace(0, 0);
    vector<int> dist(n, inf);
    dist[0] = 0;
    vector<int> ans(n, -1);
    while(que.size()){
        int cv, ccnt;
        tie(cv, ccnt) = que.front(); que.pop();

        for(auto nv : G[cv]){
            if(dist[nv] > dist[cv] + 1){
                dist[nv] = dist[cv] + 1;
                ans[nv] = cv;
                que.emplace(nv, dist[nv]);
            }
        }
    }

    cout << "Yes" << endl;
    for(int i=1; i<n; i++) cout << ans[i] + 1 << endl;

    return 0;
}

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

int main(){
    int n,m,c;
    cin >> n >> m >> c;
    vector<int> b(m);
    vector<vector<int>> a(n);
    int ans = 0;

    for(int i = 0; i < m; i++) cin >> b[i];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            int tmp;
            cin >> tmp;
            a[i].push_back(tmp);
        }
    } 
    for(int i = 0; i < n; i++){
        int can = c;
        for(int j = 0; j < m; j++){
            can += a[i][j]*b[j];
        }
        if(can > 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  //input
  int a, b;
  cin >> a >> b;

  //solve
  int ans;
  if (b % a == 0){
    ans = a + b;
  }else{
    ans = b - a;
  }

  //output
  cout << ans << endl;

  return 0;
}


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

using namespace std;

using ll = long long;

int main(){
    ll n;
    cin >> n;
    ll arr[n];
    for(ll i = 0 ; i < n; ++i){
        cin >> arr[i];
    }
    sort(arr, arr +  n);
    ll ans = 0;
    for(ll i = arr[n / 2 - 1]; i < arr[n / 2]; ++i){
        ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void Solve(int h,int w){
  int len=h*h+w*w;
  int result_h=h+1,result_w=std::max(w+1,result_h+1),result_len=result_h*result_h+result_w*result_w;
  for(int hi=1;hi<=150;hi++){
    for(int wi=hi+1;wi<=150;wi++){
      int temp_len=hi*hi+wi*wi;
      if(len==temp_len&&h<hi){
        if(temp_len<result_len){
          result_len=temp_len;
          result_h=hi;
          result_w=wi;
        }else if(temp_len==result_len&&hi<result_h){
          result_len=temp_len;
          result_h=hi;
          result_w=wi;
        }
      }else if(len<temp_len){
        if(temp_len<result_len){
          result_len=temp_len;
          result_h=hi;
          result_w=wi;
        }else if(temp_len==result_len&&hi<result_h){
          result_len=temp_len;
          result_h=hi;
          result_w=wi;
        }
      }
    }
  }

  cout<<result_h<<" "<<result_w<<endl;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  while(true){
    int h,w;
    cin>>h>>w;
    if(h==0&&w==0){
      break;
    }

    Solve(h,w);

  }

  return 0;
}



Measured memory_bytes: 3196
n,m=map(int,input().split())
p = []
for i in range(m):
    p1= list(map(int,input().split()))
    p.append(p1 + [i])
p2 = sorted(p,key=lambda x:(x[0],x[1]))
p3 = []
pref = 0
state = 0
for j in p2:
    if j[0] != pref:
        pref = j[0]
        state = 1
        p3.append([j[0],j[1],j[2],str(j[0]).rjust(6, '0')+str(state).rjust(6,'0')])
    else:
        state += 1
        p3.append([j[0],j[1],j[2],str(j[0]).rjust(6, '0')+str(state).rjust(6,'0')])
p3.sort(key = lambda x:(x[2]))
for i in p3:
    print(i[3])

Measured memory_bytes: 43824
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  int d = b - a - 1;
  if(d % 2 == 0){
    cout << "Borys" << endl;
  }else{
    cout << "Alice" << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main(){
  int n,i,j;bool ans = false;
  cin >> n;
  for(i=0;i<=25;i++){
    for(j=0;j<=14;j++){
      if(i*4+j*7==n) ans = true;
    }
  }
  cout << ((ans) ? "Yes":"No") << endl;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#if ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif
#define REP(i, k, n) for (signed long long int i = (signed long long int)(k); i < (signed long long int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rep1(i, n) REP(i, 1, n)
#define loop(n) rep(looping, n);
#define rREP(i, k, n) for (signed long long int i = (signed long long int)(n)-1; i >= k; i--)
#define rrep(i, n) rREP(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) std::sort(all(x))
#define REV(x) std::reverse(all(x))
#define UNIQUE(x) x.erase(std::unique(all(x)), x.end());
#define MAX(x) *std::max_element(all(x))
#define MIN(x) *std::min_element(all(x))
#define LOWitr(x, n) std::lower_bound(all(x), n)
#define UPRitr(x, n) std::upper_bound(all(x), n)
#define cii(x) int x; std::cin >> x
#define cill(x) signed long long int x; std::cin >> x
#define cis(x) std::string x; std::cin >> x
#define co(x) std::cout << x << "\n"
#define pb push_back
#define mp std::make_pair
#define F first
#define S second
#define truecheck assert
#define dump(x) if(DEBUG) std::cout<<#x<<" : "<<(x)<<"\n"
using std::cin;
using std::cout;
using std::string;
using std::min;
using std::max;
using std::abs;
using std::next_permutation;
template<class T>using V = std::vector<T>;
template<class T>using VV = std::vector<std::vector<T>>;
template<class T>using Q = std::queue<T>;
template<class T>using PQ = std::priority_queue<T>;
template<class T,class U>using P = std::pair<T, U>;
template<class T,class U>using M = std::map<T, U>;
template<class T,class U>using UM = std::unordered_map<T, U>;
using LL = signed long long int;
using VL = V<LL>;
using VVL = V<VL>;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f; //1061109567
const LL LLINF = 0x3f3f3f3f3f3f3f3fLL; //4557430888798830399
const double PI = M_PI;
template<class T,class U>inline LL min(T a, U b){return std::min((LL)a, (LL)b);}
template<class T,class U>inline LL max(T a, U b){return std::max((LL)a, (LL)b);}
template<class T,class U>inline bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>inline bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T>inline void vcin(T &v){for(auto&& i : v) std::cin >> i;}
template<class T>inline void dumpv(const T& v, std::ostream& os = std::cout){
    if(DEBUG){
        os<<"{";std::for_each(all(v),[&os](typename T::value_type p){os<<p<<',';});os<<"}\n";
    }
}

void Main(){
    cill(x);
    cill(y);
    LL min = x * 2;
    LL max = x * 4;
    if(min <= y && y <= max && y%2==0){
        co("Yes");
    }else{
        co("No");
    }
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3656
use std::io;

fn read() -> Vec<i32> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let x = read();
    if x[0]<x[1] && x[1]<x[2]{
        println!("Yes");
    }else{
        println!("No");
    }
    
    

    
}


Measured memory_bytes: 5024
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;



public class Main {

	public static class pair implements Comparable<pair> {
		int id;
		int ans;

		pair(int x, int y) {

			id = x;
			ans = y;

		}

		public pair() {

		}

		public int compareTo(pair o) {
			// TODO Auto-generated method stub

			return this.id - o.id;
		}
	}

//	static int mod = (int) 998244353.;
	static int mod=(int)1e9+7;
	static ArrayList<Integer> gr[];
	static int ar[][];
	static Scanner sc = new Scanner(System.in);
	static int pri[] = new int[(int) 1e6 + 5];
	static StringBuilder out = new StringBuilder();

	static long dp[];

	public static void main(String[] args) throws IOException {
		int t =1;// sc.nextInt();
		
		while (t-- > 0) {
			int n=sc.nextInt();
			int m=sc.nextInt();
			gr=new ArrayList[n];
			for(int i=0;i<n;i++) {
				gr[i]=new ArrayList<Integer>();
			}
			for(int i=0;i<m;i++) {
				int u=sc.nextInt();
				int v=sc.nextInt();
				u--;
				v--;
				gr[u].add(v);
			}
			dp=new long[n];
			
			for(int i=0;i<n;i++) {
				if(dp[i]==0)dp[i]=solve(i);
			}
			
			long max=Long.MIN_VALUE;
			for(int i=0;i<n;i++) {
				max=Math.max(dp[i], max);
			}
		System.out.println(max);
		}

	}
	
	static long solve(int pa) {
		if(dp[pa]!=0)return dp[pa];
		long ans=-1;
	    for(Integer ch:gr[pa]) {
	    	ans=Math.max(ans,solve(ch));
	    }
	    return dp[pa]=ans+1;
		
		
	}


}

Measured memory_bytes: 111108
#include<cstdio>
/// spade 0, hearts 1, clubs 2, diamonds 3

int main(){
    int n, rank;
    char suit[20];
    bool exists[52]={false};

    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%s %d", suit, &rank);
        if(suit[0]=='S') exists[0*13+rank-1] =true;
        else if(suit[0]=='H') exists[1*13+rank-1] =true;
        else if(suit[0]== 'C') exists[2*13+rank-1] =true;
        else if(suit[0]== 'D') exists[3*13+rank-1] =true;
    }

    for(int i=0; i<4; i++){
        for(int j=0; j<13;j++){
            if(i==0 && !exists[i*13+j]) printf("S %d\n", j+1);
            else if(i==1 && !exists[i*13+j]) printf("H %d\n", j+1);
            else if(i==2 && !exists[i*13+j]) printf("C %d\n", j+1);
            else if(i==3 && !exists[i*13+j]) printf("D %d\n", j+1);
        }
    }

    return 0;
}



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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  bool c = 1;
  n = (n - 1) / 2;
  for(int i = 0; i < n; i++) {
    if(s.at(i) != s.at(s.size() - 1 - i)) {
      c = 0;
      break;
    }
  }
  if(c) {
    int N;
    if(n % 2 == 1) N = (n - 1) / 2;
    else N = n / 2;
    for(int i = 0; i < N; i++) {
      if(s.at(i) != s.at(n - i - 1)) {
        c = 0;
        break;
      }
    }
  }
  if(c) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3632
'use strict'

function main(input) {
  let x = 1;
  const y = 1000000007
  input = input - 0
  for (let i = 1;i < input + 1;i++) {
    x = x * i;
    if (x > y) x = x % y;
  }
  console.log(x);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		boolean flag = true;
		int f = 0;
		int pre = A[0];
		int ans = 1;
		for(int i = 1; i < N; i++) {
			if(f == 0) {
				if(A[i] > pre) {
					f = 1;
				} else if(A[i] < pre) {
					f = -1;
				}
			} else if(f == 1) {
				if(A[i] < pre) {
					ans++;
					f = 0;
				}
			} else {
				if(A[i] > pre) {
					ans++;
					f = 0;
				}	
			}
			pre = A[i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 53200
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a[4],b[4],i,j;
  while(cin>>a[0]){
    int c,d;
    for(i=1;i<4;i++)cin>>a[i];
    for(c=d=i=0;i<4;i++)cin>>b[i];
    for(i=0;i<4;i++)for(j=0;j<4;j++){
      if(a[i]==b[j]){
        if(i==j)c++;
        else d++;
      }
    }
    cout<<c<<' '<<d<<endl;
  }
}

Measured memory_bytes: 3012
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <functional>
#include <array>

using namespace std;

int main(){
    int64_t A, B, K;
    cin >> A >> B >> K;

    int last = 0;
    for(int i = 0; i < K; ++i){
        if(A + i <= B){
            cout << A + i << endl;
            last = A + i;
        }
    }
    for(int i = 0; i < K; ++i){
        int po = B - K + 1 + i;
        if(last < po){
            cout << po << endl;
        }
    }
}

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

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

   if(s == "ABC") cout << "ARC" << endl;
   else cout << "ABC" << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
const long long mod = 1000000007;
const long long inf = 1145141919810;
typedef pair<int, int> P;
typedef pair<P, P> PP;
struct edge {int to, cost;};

signed main() {
	int a, b; cin >> a >> b;
	if (a + b == 15)cout << '+' << endl;
	else if (a*b == 15)cout << "*" << endl;
	else cout << "x" << endl;
}

Measured memory_bytes: 256
from math import sqrt

S=int(input())
if S==10**18:
    print(10**9,0,0,10**9,0,0)
else:
    q=int(sqrt(S))
    test=q*(q+1)-S
    if test>=0:
        print(0,0,q,1,test,q+1)
    else:
        print(0,1,q+1,0,-test,q+1)

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <iomanip>
#include <climits>
#include <cmath>
#include <queue>
#define ll long long int
#define MOD 1000000007
#define IOS ios::sync_with_stdio(false)  ;cin.tie()  ; cout.tie() ;
#define MAX 100001
using namespace std;


 int main(){
   IOS  ;
   ll ans  = 0 ;

   string s  ;
   cin>>s ;
  ll arr[127]  ;
  fill(arr , arr + 127 ,  0  ) ;

  arr[s[0]]++ ;

  for(int i  =  1 ;  i < s.length()   ;  ++i)
  {
      ans +=  i  - (arr[s[i]]) ;
      arr[s[i]]++;
  }
  cout<<ans + 1;
    return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <bits/stdc++.h>
#define ll long long

using namespace std;
ll a[100100],NextGreater[100100],LastGreater[100100],Log[2001000]
,SparseMax[400100][20],n;
stack < ll > S;

void BuildMax()
{
    for(ll j=1; j<=18; j++)
        for(ll i=1; i<=400000; i++)  SparseMax[i][j] = -1e18;
    for(ll i=1; i<=n; i++)  SparseMax[i][0] = a[i];
    for(ll j=1; j<=18; j++)
    {
        for(ll i=1; i<=n; i++)
        {
            SparseMax[i][j] = max(SparseMax[i][j-1], SparseMax[i + (1 << (j - 1))][j-1]);
        }
    }
}


void BuildLog()
{

    Log[1] = 0;
    for(ll i=2; i<=n; i++)  Log[i] = Log[i/2] + 1;
}

long long QueryMax(ll l, ll r)
{
    ll j = Log[r - l + 1];
    return max(SparseMax[l][j], SparseMax[r - (1 << j) +1][j]);
}

int main()
{
    cin >> n;
    for(ll i = 1; i<=n; i++)  cin >> a[i];
    for(ll i=1; i<=n; i++)
    {
        while(!S.empty() && a[S.top()]<a[i])
            NextGreater[S.top()] = i, S.pop();
        S.push(i);
    }
    while(!S.empty())  NextGreater[S.top()]=n+1,S.pop();
    NextGreater[n + 1] = n + 1;
    for(ll i=n; i>=1; i--)
    {
        while(!S.empty() && a[S.top()]<a[i])
            LastGreater[S.top()] = i, S.pop();
        S.push(i);
    }
    while(!S.empty())  LastGreater[S.top()]=0,S.pop();
    LastGreater[0] = 0;
    BuildLog();
    BuildMax();
    long long Ans = 0;
    for(ll i = 1; i<=n; i++)
    {
        ll L = LastGreater[i];
        ll R = NextGreater[i];
        ll Start = 1, End = L - 1, LeftSide = 0;
        while(Start <= End)
        {
            ll mid = (Start + End)/2;
            if(QueryMax(mid, L - 1) > a[i])  LeftSide = mid, Start = mid + 1;
            else  End = mid - 1;
        }
        Start = R + 1,End = n;
        ll RightSide = n + 1;
        while(Start <= End)
        {
            ll mid = (Start + End)/2;
            if(QueryMax(R + 1, mid) > a[i])  RightSide = mid, End = mid - 1;
            else  Start = mid + 1;
        }
        L = LastGreater[i] - LeftSide;
        R = NextGreater[i] - i;
        Ans+=a[i] * (R * L);
        L = i - LastGreater[i];
        R = RightSide - NextGreater[i];
        Ans+=a[i] * (R * L);
    }
    cout << Ans;
    return 0;
}


Measured memory_bytes: 67004
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

void work()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(abs(b-a)<abs(c-a))puts("A");
	else puts("B");
}

int main()
{
	work();
	return 0;
}


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

int main(){
	std::vector<int> waseda,keiou;
	int buffer;
	int waseda_point,keiou_point;
	for(int i=0;i<10;i++){
		std::cin >> buffer;
		waseda.push_back(buffer);
	}
	for(int j=0;j<10;j++){
		std::cin >> buffer;
		keiou.push_back(buffer);
	}
	
	std::sort(waseda.begin(),waseda.end(),std::greater<int>());
	waseda_point = waseda[0] + waseda[1] + waseda[2];
	std::sort(keiou.begin(), keiou.end() , std::greater<int>());
	keiou_point = keiou[0] + keiou[1] + keiou[2];
	std::cout << waseda_point << ' ' << keiou_point << std::endl;
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll n;
    cin>>n;
    string str="";
    while(n>0)
    {
        n-=1;
        str+='a'+(n%26);
        n/=26;

    }
    reverse(ALL(str));
    cout<<str<<endl;
    return;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 3576
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#define ll long long 
using namespace std;

ll T,a,b,c,d,n;
map<ll,ll> g;

ll f(ll n){
	if (g[n]==0&&n) g[n]=1e18; else return g[n];
	ll ans=1e18;
	if (d<1e18/n) ans=min(ans,d*n);
	ans=min(ans,f(n/2)+a+(n%2)*d);
	ans=min(ans,f(n/2+1)+a+(2-n%2)*d);
	ans=min(ans,f(n/3)+b+(n%3)*d);
	ans=min(ans,f(n/3+1)+b+(3-n%3)*d);
	ans=min(ans,f(n/5)+c+(n%5)*d);
	ans=min(ans,f(n/5+1)+c+(5-n%5)*d);
	g[n]=ans;
	return ans;
}

int main(){
	scanf("%lld",&T);
	while (T--){
		scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
		g.clear();
		g[0]=0,g[1]=d,g[2]=min(d*2,d+a);
		printf("%lld\n",f(n));
	}
}


Measured memory_bytes: 4472
#include <bits/stdc++.h>
using namespace std;
#define int long long int
void solve() {
    int n, k;
    cin >> n >> k;
    cout << n-k+1 << endl;
  	return ;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll a, b, c, n, m, x, y, z, w, h, ans, mx, mn;
string s, t;
vll dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};
string alphabet = "abcdefghijklmnopqrstuvwxyz";

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n){
        mll cnt;
        rep(i, 2, n + 1){
            ll tmp = i, j = 1;
            while(tmp > 1){
                j++;
                while(tmp % j == 0){
                    tmp /= j;
                    cnt[j]++;
                }
            }
        }
        ans = 1;
        each(i, cnt){
            ans *= i.second + 1, ans %= MOD;
        }
        print(ans);
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	string s;
		int cnt=0;
	cin>>s;

	int n=s.size();
	for(int i=0,j=(n+1)/2;i<(n-1)/2,j<=n;i++,j++)
	{
		if(s[i]==s[j])
		{
			cnt++;
		}
		else
		{
			continue;
		}
	}
	if(cnt==(n-1)/2)
	{
		cout<<"Yes";
		
	}
	else
	cout<<"No";
	//cout<<temp;
	/*for(int j=(n+1)/2;j<=n;j++)
	{
		s1+=s[j];
	}
	if(temp==s1)
	{
		cout<<s1;
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}*/
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main()
{
	int a,b,c;
	a = 2;
	c = 0;
	scanf("%d", &b);

	if (b % 2 == 0)
		printf("%d\n", b);
	else
	{
		c = b * a;
		printf("%d\n", c);
	}

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define REP(i,e) for (int i = 0; i != int(e); i++)
#define FORIT(i, A) for (auto i : A)
#define ISEQ(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << endl
#define SZ(x) ((int)(x).size())

int main(int argc, char const *argv[])
{
	stack<int> st;
	int i;
	while(scanf("%d", &i) != EOF)
	{
		if (i == 0)
		{
			printf("%d\n", st.top());
			st.pop();
		}
		else
		{
			st.push(i);
		}
	}
	return 0;
}

Measured memory_bytes: 3148
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

type pair struct {
	x, y int
	u    bool
}

type pairs []pair

var sw bool

func (p pairs) Len() int {
	return len(p)
}

func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if sw == true {
		return p[i].x < p[j].x
	} else {
		return p[i].y > p[j].y
	}
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()
	r := make(pairs, N)
	for i := 0; i < N; i++ {
		a, b := getInt(), getInt()
		r[i] = pair{a, b, false}
	}
	sort.Sort(r)
	b := make(pairs, N)
	for i := 0; i < N; i++ {
		x, y := getInt(), getInt()
		b[i] = pair{x, y, false}
	}
	sw = true
	sort.Sort(b)

	ans := 0
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			if r[j].u == true {
				continue
			}
			if b[i].y > r[j].y && b[i].x > r[j].x {
				r[j].u = true
				ans++
				break
			}
		}
	}
	out(ans)
}


Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

ll N, M;
ll frac[500005];
ll parti(ll i) {
  ll ue1 = frac[N], ue2 = frac[M];
  ll shita1 = 1, shita2 = 1, shita3 = 1;
  ll tmpshita1, tmpshita2, tmpshita3;
  ll h=mod-2, two;
  while(h>0) {
    two = 1;
    tmpshita1 = frac[i];
    tmpshita2 = frac[N-i];
    tmpshita3 = frac[M-N];
    while(2*two<h) {
      two *= 2;
      tmpshita1 *= tmpshita1;
      tmpshita2 *= tmpshita2;
      tmpshita3 *= tmpshita3;
      tmpshita1 %= mod;
      tmpshita2 %= mod;
      tmpshita3 %= mod;
    }
    h -= two;
    shita1 *= tmpshita1;
    shita2 *= tmpshita2;
    shita3 *= tmpshita3;
    shita1 %= mod;
    shita2 %= mod;
    shita3 %= mod;
  }
  return ue1*ue2%mod*frac[M-i]%mod*shita1%mod*shita2%mod*shita3%mod*shita3%mod;
}

int main() {
  frac[0] = 1;
  for(ll i=1;i<500005;++i) {
    frac[i] = frac[i-1]*i%mod;
  }
  cin>>N>>M;
  ll ans = 0;
  for(ll i=0;i<=N;++i) {
    if(i%2==0) ans += parti(i);
    else ans -= parti(i);
    ans = (ans+mod)%mod;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 7540
#include<bits/stdc++.h>
typedef long long ll; 
#define pb push_back
#define mp make_pair
#define mod 998244353
#define vi vector <ll>
using namespace std ; 
ll power(ll x,ll y,ll m)
{            //power(x,y)=x^y  %m;
	ll res=1%m;
	while(y)
	{
	    if(y&1)
	    res=(res*x)%m;
	    x=(x*x)%m;
	    y=(y>>1)%m;
	}
	return res;
}
ll mod_inverse(ll x,ll m)
{
	return power(x,m-2,m);
}
vector<vector<ll> >g;
int main ()
{
    ios_base :: sync_with_stdio ( false );
    cin.tie( NULL );
    cout.tie( NULL );
ll t = 1 ;
//cin>>t;
while (t--)  
{
 ll a,b,c;
 cin>>a>>b>>c;
 ll k;
 cin>>k;
 if(a<b && b<c)
 {
     cout<<"Yes"<<"\n";
     continue;
 }
 else
 {
    
     ll cnt=0;
      while(b<=a)
        {
            cnt++;
            b*=2;
        }
     
     if(cnt>k)
     {
         cout<<"No"<<"\n";
         continue;
     }
     else
     {
          ll ma=max(a,b);
         while(c<=ma)
     {
        cnt++;
        c*=2;
     }
       
         if(cnt>k)
     {
         cout<<"No"<<"\n";
         continue;
     }
     else
     {
         cout<<"Yes"<<"\n";
         continue;
     }
        
     }
 }
 
 
}
 

 return 0;
}

Measured memory_bytes: 3652
N=int(input())
A=list(map(int,input().split()))
if N%2:
    a=[None]*N
    b=[None]*N
    c=[None]*N
    a[0]=A[0]
    b[1]=A[1]
    c[2]=A[2]
    for i in range(2,N-2,2):
        a[i]=a[i-2]+A[i]
    for i in range(3,N,2):
        b[i]=max(a[i-3],b[i-2])+A[i]
    for i in range(4,N,2):
        c[i]=max(a[i-4],b[i-3],c[i-2])+A[i]
    print(max(a[-3],b[-2],c[-1]))
else:
    a=[None]*N
    b=[None]*N
    a[0]=A[0]
    for i in range(2,N,2):
        a[i]=a[i-2]+A[i]
    b[1]=A[1]
    for i in range(3,N,2):
        b[i]=max(a[i-3],b[i-2])+A[i]
    print(max(a[-2],b[-1]))

Measured memory_bytes: 36092
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll c[3][3];
  REP(i,3){
    REP(j,3){
      cin >> c[i][j];
    }
  }
  bool ans = true;
  if(c[0][0]-c[0][1]!=c[1][0]-c[1][1]||c[1][0]-c[1][1]!=c[2][0]-c[2][1]) ans = false;
  if(c[0][1]-c[0][2]!=c[1][1]-c[1][2]||c[1][1]-c[1][2]!=c[2][1]-c[2][2]) ans = false;
  if(c[0][0]-c[1][0]!=c[0][1]-c[1][1]||c[0][1]-c[1][1]!=c[0][2]-c[1][2]) ans = false;
  if(c[1][0]-c[2][0]!=c[1][1]-c[2][1]||c[1][1]-c[2][1]!=c[1][2]-c[2][2]) ans = false;
  if(ans){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
object Main extends App {

  import scala.io.StdIn._
  import scala.math._
  solve
  def solve: Unit ={
    val n = readLine.trim.toInt
    if (n == 0) return
    println(
      Array.tabulate(n / 4){_ ⇒ readLine.trim.toInt}.sum
    )
    solve
  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}


Measured memory_bytes: 44044
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int h, w;

int main(){
	while (cin >> h >> w&&h + w){
		bool f = 0;
		P ans;
		int now = INF;
		for (int i = 1; i < 150; i++){
			for (int j = 1; j < 150; j++){
				if (i >= j)continue;
				if (i*i + j*j == h*h + w*w){
					if (i == h&&j == w)continue;
					if (h < i){
						ans = P(i, j);
						f = 1;
					}
				}
				else if (i*i + j*j > h*h + w*w){
					if (now>i*i + j*j){
						ans = P(i, j);
						now = i*i + j*j;
					}
				}
				if (f)break;
			}
			if (f)break;
		}
		cout << ans.first << " " << ans.second << endl;
	}
}

Measured memory_bytes: 1156
N=int(input())
s=0
A=list(map(int,input().split()))
B=list(map(int,input().split()))
for j in range(N):
    A[j]-=1
    s+=B[j]
C=list(map(int,input().split()))
i=0
while i<N-1:
    if A[i]+1==A[i+1]:
        s+=C[A[i]]
    i+=1
print(s)

Measured memory_bytes: 38256
using System;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            while (true)
            {
                if (isPrime(x))
                {
                    Console.WriteLine(x);
                    break;
                }
                x++;
            }
        }

        static bool isPrime(long n)
        {
            if (n < 2) return false;
            if (n%2 == 0 && n != 2) return false;
            for (int i = 3; i < Math.Sqrt(n); i++)
            {
                if (n % i == 0) return false;
            }
            return true;
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define ll long long
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define INF = 1001001001
#define pi = acos(-1)
using namespace std;
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    int x,y; cin>>x>>y;

    for (int i = 0; i < 101; ++i) {
        for (int j = 0; j < 101; ++j) {
            if(i*2 + j*4 == y && i+j == x){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int N, P;
vector<int> p(1, 2);
const int kP = 1000002;
bool sieve[kP];

int main() {
  fill(sieve, sieve + kP, true);
  for (int i = 4; i < kP; i+=2) sieve[i] = false;
  for (int i = 3; i < kP; i+=2) {
    if (sieve[i]) {
      p.push_back(i);
      for (int j = i+i; j < kP; j+=i)
        sieve[j] = false;
    }
  }

  // rep(i,10) printf("{%d}", p[i]); puts("");
  
  while (scanf("%d%d", &N, &P), N != -1) {
    vector<int>::iterator bgn = upper_bound(p.begin(), p.end(), N);
    vector<int> subP;
    rep(i,100) {
      subP.push_back(*(bgn++));
    }
    vector<int> rs;
    rep(i,100) {
      for (int j = i; j < 100; ++j)
        rs.push_back(subP[i]+subP[j]);
    }
    sort(rs.begin(), rs.end());
    // rep(i,10) printf("{%d}", rs[i]); puts("");
    printf("%d\n", rs[P-1]);
  }
  return 0;
}

Measured memory_bytes: 2568
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

MAX_N=10**5+1
n,k=get_i
a=get_i
head=0
tail=0
len=0
cnt=0
ans=MAX_N
st=array(k+1,1,0)
loop do
  while tail<n and cnt<k
    if a[tail]<=k
      st[a[tail]]+=1
      if st[a[tail]]==1
        cnt+=1
      end
    end
    tail+=1
    len+=1
  end
  break if cnt<k
  if ans>len
    ans=len
  end
  if a[head]<=k
    st[a[head]]-=1
    if st[a[head]].zero?
      cnt-=1
    end
  end
  head+=1
  len-=1
end
if ans==MAX_N
  puts 0
else
  puts ans
end


Measured memory_bytes: 13768