akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
 
#define rep(i,n) for(int i = 1; i <= n; i++)
 
#define MS   (15)
#define CM   (0)
#define TREE (1)
#define JUMP (2)
 
using namespace std;
 
int x, y;
int map[MS+1][MS+1];
int dp[MS+1][MS+1];
 
void check()
{
        rep(i,y-1) rep(j,x){
                if(map[i][j] == CM){
                        if(map[i+1][j] != TREE)  { dp[i+1][j]  +=dp[i][j]; }
                        if((j+1)<=x){
                                if(map[i+1][j+1]==CM){ dp[i+1][j+1]+=dp[i][j]; }
                        }
                        if((j-1)>=1){
                                if(map[i+1][j-1]==CM){ dp[i+1][j-1]+=dp[i][j]; }
                        }
                }
                if(map[i][j] == JUMP){
                        if(i+2 > y){
                                dp[y][j] += dp[i][j];
                        }
                        else if(map[i+2][j] != TREE){
                                dp[i+2][j]+=dp[i][j];
                        }
                }
        }
 
}
 
int main(void)
{
 
        while(cin >> x >> y && x){
                rep(i,y) rep(j,x){
                        cin >> map[i][j];
                }
 
                memset(dp, 0, sizeof(dp));
                
                rep(i,x)
                        if(map[1][i] != TREE){ dp[1][i]++; }
                
                check();
                
                int sum=0;
                
                rep(i,x){ sum += dp[y][i]; }
                
                cout << sum << endl;
                
        }
 
        return 0;
}

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

bool solve( const vector<int>& A, int i, int m ) {
	if( m == 0 ) {
		return true;
	}

	if( i >= A.size() ) {
		return false;
	}

	return solve( A, i+1, m ) || solve( A, i+1, m - A.at( i ) );
}

int main() {
	ios_base::sync_with_stdio( false );

	int n;
	cin >> n;

	vector<int> A( n );
	for( auto& v: A ) { cin >> v; }

	int q;
	cin >> q;

	for( int i = 0; i < q; ++i ) {
		int m;
		cin >> m;

		cout << (solve( A, 0, m ) ? "yes\n" : "no\n");
	}
}



Measured memory_bytes: 3224
#include <stdio.h>

bool binarySearch(int A[], int n, int key){
  int left = 0;
  int right = n;
  int mid;

  while (left < right) {
    mid = (left + right) / 2;
    if (key == A[mid]) {
      return true;
    }else if (key < A[mid]) {
      right = mid;
    }else if (key > A[mid]) {
      left = mid + 1;
    }
  }
  return false;
}



int main(int argc, char const *argv[]) {
  int n;
  int A[1000000];
  int q;
  int key;
  int sum = 0;

  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%d", &A[i]);

  scanf("%d", &q);
  for(int i = 0; i < q; i++){
    scanf("%d", &key);

    if (binarySearch(A, n, key)) {
      sum++;
    }
  }

  printf("%d\n", sum);
  return 0;
}

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

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

using namespace std;

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

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

  int res;
  if (b % a == 0) {
    res = a + b;
  } else {
    res = b - a;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
n, money = map(int, input().split())
ans = [-1, -1, -1]
flag = False

money = money // 1000

for i_1 in range(n+1):
  for j_5 in range(n - i_1 + 1):
    if (money - i_1 - j_5 * 5) == 10 * (n - i_1 - j_5):
      flag = True
      ans = [i_1, j_5, n - i_1 - j_5]
      
  if flag:
    break

print(ans[2], ans[1], ans[0])


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define go(i, a, n) for (ll i = a; i < (ll)n; i++)
#define gor(i, a, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define gos(i, a, n, step) for (ll i = a; i < (ll)n; i += step)
#define show(a) cout << a << '\n'
#define show2(a, b) cout << a << " " << b << '\n'
#define show3(a, b, c) cout << a << " " << b << " " << c << '\n'
#define show4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << '\n'
#define ull unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define mem(a, k) memset(a, k, sizeof(a))
#define answer(z, k) cout << "Case #" << z << ": " << k << endl;
#define ans(z) cout << "Case #" << z << ": "
auto t1 = chrono::high_resolution_clock::now();

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // ll t;
    // cin >> t;
    // while (t--)
    // {
    // }
    ll x;
    cin >> x;
    show(!(x & 1));
    auto t2 = chrono::high_resolution_clock::now();
    auto duration = chrono::duration_cast<chrono::milliseconds>(t2 - t1).count();
    clog << "Time taken = " << duration * 1.0 / 1000 << " seconds" << endl;
    return 0;
}


Measured memory_bytes: 3792
// Bismillahirrahmanirrahim
// AgriCoder IPB
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>
#include <cctype>
#include <cstdlib>
#include <utility>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <sstream>
#include <clocale>
#include <ctime>
#include <climits>
#include <cassert>
//#include <unordered_map>
using namespace std;

#define FOR(i, agri, coder) for (int i = (int)agri; i <= (int)coder; i++)
#define REP(agri,coder) for (int agri = 0; agri < (int)coder; agri++)
#define FOREACH(i,agricoder) for (typeof((agricoder).end()) i = (agricoder).begin(); i != (agricoder).end(); ++i)
//for (auto& it: agricoder)
#define RESET(agri,coder) memset(agri, coder, sizeof(agri))
#define pb push_back
#define mp make_pair
#define NL printf("==========================\n")
#define getchar_unlocked getchar // for codeforces

int arahbar[8] = {0,1,0,-1,1,1,-1,-1};
int arahkol[8] = {1,0,-1,0,1,-1,-1,1};
int kudabar[8] = {-2,-1,1,2, 2,1 , -1 ,-2};
int kudakol[8] = {1 ,2 ,2,1,-1,-2 , -2,-1};

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef unsigned int UNi;

template<typename T>
T getNum() {
   T res=0;
   char c;
   while(1)
   {
      c=getchar_unlocked();
      if(c==' ' || c=='\n') continue;
      else break;
   }
   bool negatif;
   if (c=='-') {
       negatif = true;
       res = 0;
   }
   else {
       res=c-'0';
       negatif = false;
   }
   while(1)
   {
      c=getchar_unlocked();
      if('0'<=c && c<='9') res=res*10 + c-'0';
      else break;
   }
   if (negatif) res*=-1;
   return res;
}

inline void boost() { //dont use with cstdio, dont use in interactives
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
}
//freopen("badmilk.in", "r", stdin);
//freopen("badmilk.out", "w", stdout);
//fclose(stdin);
//fclose(stdout);

#define INF 1000000000
#define EPS 1e-9
#define MAX_N 100005

// ================================  TEMPLATE ENDS HERE ================================================== //

int main() {
	LL A,B,C;
	cin >> A >> B >> C;
	if ( (A&1) or (B&1) or (C&1) ) {
		printf("0\n");
		return 0;
	}
	if (A==B and B==C) {
		printf("-1\n");
		return 0;
	}
	int ans = 0;
	while ( (!(A&1)) and (!(B&1)) and (!(C&1)) ) {
		int Abaru = (B>>1) + (C>>1);
		int Bbaru = (A>>1) + (C>>1);
		int Cbaru =  (A>>1) + (B>>1);
		A = Abaru; B = Bbaru; C = Cbaru;
		ans++;
	}
	printf("%d\n",ans);

	return 0;
}
//Alhamdulillahirabbilalamin


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  while (true) {
    int a, b; cin >> a >> b;
    if (a == 0 && b == 0) break;
    cout << min(a, b) << ' ' << max(a, b) << endl;
  }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    if (!A.at(i)) return cout << 0 << "\n", 0;
  }
  long ans = 1;
  for (int i = 0; i < N; i++) {
    if ((long double) ans * A.at(i) > 1e18) return cout << -1 << "\n", 0;
    ans *= A.at(i);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 4032
// abc048_b
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  ll a,b,x;
  cin>>a>>b>>x;
  if (a%x==0) cout<<b/x-a/x+1<<endl;
  else cout<<(b/x)-(a/x)<<endl;
  return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;


int main() {
    int n;
    cin >> n;
    map<int, int> seconds;
    int sum = 0;
    rep(i, n) {
        int t;
        cin >> t;
        seconds[i] = t;
        sum += t;
    }
    int m;
    cin >> m;

    rep(i, m) {
        int p;
        int x;
        cin >> p >> x;
        p--;
        cout << (sum - seconds[p] + x) << endl;

    }


}

Measured memory_bytes: 256
s = str(input())
t = str(input())
c = list()
for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        if t[j] == s[i+j]:
            cnt = cnt + 1
        else:
            continue
    c.append(cnt)
print(len(t)-max(c))

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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    ll D, T, S;
    cin >> D >> T >> S;
    if (D <= T * S) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

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

int main() {
    string a, b, c; cin >> a >> b >> c;
    int aa = 0, bb = 0, cc = 0; char curr = 'a';
    while(true) {
        if (curr == 'a') {if (aa == a.size()) {cout << "A" << endl; return 0;} curr = a[aa]; aa++; }
        else if (curr == 'b') {if (bb == b.size()) {cout << "B" << endl; return 0;} curr = b[bb]; bb++; }
        else if (curr == 'c') {if (cc == c.size()) {cout << "C" << endl; return 0;} curr = c[cc]; cc++; }
    }
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ld long double
#define mem(a,b) memset(a,b,sizeof(a) )
#define M 4000010
#define md 1000000007

ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}
/*inline ll add(ll a,ll b){return (a+b)%md;}
inline ll mul(ll a,ll b){return (a*b)%md;}
ll f[M],iv[M];
ll C(ll n,ll r){return mul(f[n],mul(iv[r],iv[n-r]));}
void prep_fac(){
    f[0]=1;
    rep(i,1,M)f[i]=mul(i,f[i-1]);
    iv[M-1]=power(f[M-1],md-2,md);
    for(ll i=M-2;i>=0;--i)iv[i]=mul(i+1,iv[i+1]);
}*/



int main()
{
	IOS;
	int n;cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		ll x;
		cin>>x;
		if(i%2&&x%2)
		ans++;
	}
	cout<<ans;
}



Measured memory_bytes: 3608
#include <stdio.h>

#define MAX	( 1000000 )

void setPrimeFlag( void );
int getNumOfPrime( int number );
int primeFlag[MAX];

int main( void )
{
	int n;
	while( scanf( "%d", &n ) != EOF )
	{
		setPrimeFlag();
		printf( "%d\n", getNumOfPrime( n ) );
	}
	
	return (0);
}

int getNumOfPrime( int number )
{
	int i;
	int ans = 0;
	
	for( i = 0; i <= number; i++ )
	{
		if( primeFlag[i] == 1 )
		{
			ans++;
		}
	}
	return (ans);
}

void setPrimeFlag( void )
{
	int i;
	int j;
	
	primeFlag[0] = -1;
	primeFlag[1] = -1;
	
	for( i = 2; i < MAX; i++ )
	{
		if( primeFlag[i] == 0 )
		{
			primeFlag[i] = 1;
			for( j = i + i; j < MAX; j += i )
			{
				primeFlag[j] = -1;
			}
		}
	}
}

Measured memory_bytes: 4500
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n, k;
    cin >> n >> k;
    int ans = 0;
    int tmp = n;
    while (tmp > 0){
       tmp = tmp / k;
       ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
#define inputv(v, n)                                                           \
    vl v;                                                                      \
    rep(i, n) {                                                                \
        ll x;                                                                  \
        cin >> x;                                                              \
        v.push_back(x);                                                        \
    }
bool chmin(ll& a, ll& b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll& a, ll& b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    cin >> n >> k;
    inputv(A, n);

    rep(i, k) {
        a += A[i] + 1;
    }

    ans = a;
    rep(i, n - k) {
        a += A[i + k] - A[i];
        ans = max(ans, a);
    }

    cout <<  setprecision(10)<<double(ans) / 2 << endl;
}


Measured memory_bytes: 2420
N = int(input())
S = input()

dic = {('S','S','o'):'S', ('S','S','x'):'W', ('S','W','o'):'W', ('S','W','x'):'S', \
       ('W','S','o'):'W', ('W','S','x'):'S', ('W','W','o'):'S', ('W','W','x'):'W'}

cnd = ['SS', 'SW', 'WS', 'WW']

for h in cnd:
  rlt = h
  l = dic[(h[0],h[1],S[0])]
  for i in range(1,N-1):
    rlt += dic[(rlt[i], rlt[i-1], S[i])]
  if l == rlt[-1] and dic[(rlt[-1], rlt[-2], S[-1])] == rlt[0]:
    print(rlt)
    exit()

print(-1)

Measured memory_bytes: 168500
#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;

template <typename T> inline bool chkmin(T &x,T y){ return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y){ return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;

int a[N];

inline int read(){
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-')ch = getchar();
	if(ch == '-')flag = -1,ch = getchar();
	while(isdigit(ch))x = (x << 3) + (x << 1) + ch - '0',ch = getchar();
	return x * flag;
}

int main(){
	int n = read(),k = read();
	For(i,1,n)a[i] = read();
	int ans = INF;
	For(i,1,n - k + 1){
		if((a[i] > 0) == (a[i + k - 1] > 0))ans = min(ans,max(abs(a[i + k - 1]),abs(a[i])));
		else ans = min(ans,min(abs(a[i]),abs(a[i + k - 1])) + a[i + k - 1] - a[i]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
import java.util.*;
import java.io.*;

public class Main 

{ 

	 static FastReader sc=new FastReader(); 
	 static double c(long a,long b) {
		 return Math.sqrt((a*a+b*b));
	 }
	  public static void main(String[] args) 
    {
    	int n = i();
        int m = i();
        long A[]=new long[n];
        long B[]=new long[n];
        for(int i=0;i<n;i++) {
        	A[i]=Math.abs(i());
        	B[i]=Math.abs(i());
        }
        int c=0;
        for(int i=0;i<n;i++) {
        	
        	if(c(A[i],B[i])<=m) {
        		c++;
        	}
        }
        System.out.println(c);
		
    }
      	
        	
			
	
	
		
   static void input(int A[]) {
	   for(int i=0;i<A.length;i++) {
		   A[i]=sc.nextInt();
	   }
   }
     static int i() {
    	 return sc.nextInt();
     }
     static String s() {
    	 return sc.next();
     }
     static long l() {
    	 return sc.nextLong();
     }  
        static void shuffleArray(int[] arr){
        int n = arr.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            int tmp = arr[i];
            int randomPos = i + rnd.nextInt(n-i);
            arr[i] = arr[randomPos];
            arr[randomPos] = tmp;
        }   
}
  
        
        
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
} 



Measured memory_bytes: 58336
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n;
    cin >>n;
    
    if (3 > n) cout << 0 << endl;
    else cout << n/3 << endl;
    
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    char[]ss = S.toCharArray();

    int all = 0;
    for(int i=0; i<S.length(); i++) {
        all += ss[i]-48;
        
    }        
        if(all%9==0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
    }
}
}


Measured memory_bytes: 40432
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = a - 1; i >= b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,K;
    cin >> N >> K;
    vP p(N);
    rep(i,N){
        cin >> p[i].second >> p[i].first;
    }
    sort(p.begin(),p.end(),greater<P>());
    set<int> type;
    multiset<int> kaburi;
    unsigned long long res=0,ans=0;
    rep(i,N){
        if(i<K){
            if(type.count(p[i].second)){
                kaburi.insert(p[i].first);
                res+=p[i].first;
            }
            else{
                type.insert(p[i].second);
                res+=p[i].first;
            }
        }
        else{
            if(type.count(p[i].second)){
                continue;
            }
            else{
                int x=*kaburi.begin();
                res-=x;
                if(kaburi.size()==0)continue;
                kaburi.erase(kaburi.find(x));
                res+=p[i].first;
                type.insert(p[i].second);
            }
        }
        chmax(ans,res+type.size()*type.size());
    }
    cout << ans << '\n';
}/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/


Measured memory_bytes: 9248
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	IOS;
	int n;
	cin >> n;
	vector<int> table(n + 1, 0);
	table[0] = 1;
	vector<int> a = { 100,101,102,103,104,105 };
	REP(i, n) {
		if (table[i]) {
			REP(j, a.size()) {
				int t = i + a[j];
				if (t < n + 1) {
					table[t] = 1;
				}
			}
		}
		
	}
	put(table[n]);
	return 0;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef long long ll;
typedef long long ll;
//typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX / 100;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("~/Downloads/02.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
const double PI = 3.14159265358979323846;

typedef pair<ll, ll> P;


string to_upper(string str) {
    int diff = 'a' - 'A';
    for (int i = 0; i < str.size(); i++) {
        char c = str[i];
        if ('A' <= c && c <= 'Z') {
            c += diff;
            str[i] = c;
        }
    }
    return str;
}


int main() {

    int n;
    cin >> n;


    vector<P> matrix_list(n);
    rep(i, n) cin >> matrix_list[i].first >> matrix_list[i].second;

    vector<ll> p(n + 1, 0);
    p[0] = matrix_list.front().first;
    rep(i, n) p[i + 1] = matrix_list[i].second;

    vector<vector<ll> > dp(n + 1, vector<ll>(n + 1, 0));


    for (int l = 2; l <= n; l++) {  // 行列の個数
        for (int i = 1; i <= n - l + 1; i++) {
            int j = i + l - 1;
            ll min_cost = INF;
            for (int k = i; k < j; k++) {
                if (k == i) min_cost = dp[i][k] + dp[k + 1][j] + p[i - 1] * p[k] * p[j];
                else min_cost = min(min_cost, dp[i][k] + dp[k + 1][j] + p[i - 1] * p[k] * p[j]);
            }
            dp[i][j] = min_cost;
        }
    }

    cout << dp[1][n] << endl;
}



Measured memory_bytes: 3180
#include<bits/stdc++.h>
const int INF=1e9+5;
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
  cin>>a[i];
  int dp[n];
  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);
  for(int i=2;i<n;i++)
  {
      int check;
      dp[i]=INF;
      if(i-k<0)
      check=0;
      else
        check=i-k;
    for(int j=i-1;j>=check;j--)
    {
       dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));

    }
  }
  cout<<dp[n-1]<<endl;
  return 0;
}


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

int main(){
vector<int> wait(5), loss(5);
int total_wait = 0;
int max_loss = 0;
int max_loss_indx = 0;
for (int i = 0; i < 5; i++) {
    cin >> wait[i];
    loss[i] = (wait[i] + 9)/10*10 - wait[i];
    total_wait += wait[i] + loss[i];
    max_loss = max(max_loss, loss[i]);
    if (max_loss == loss[i]) {
        max_loss_indx = i;
    }
}

cout << total_wait - loss[max_loss_indx] << endl;
}

Measured memory_bytes: 256
n_a_b = list(map(int,input().split()))

ans = 0
plus = 0

for i in range(0,n_a_b[0]+1,1):
    num = i
    for j in range(5):
        plus = plus + num % 10
        num = int(num /10) 
        if i < 0:
            break

    if  n_a_b[1] <= plus and plus <= n_a_b[2]:
        ans = ans + i

    plus = 0

print(ans)

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

int main(){
	vector<int> num(3);
	for(int i=0; i<3; i++){
		cin >> num.at(i);
	}
	sort(num.begin(), num.end());
	if(num.at(0)==5 && num.at(1)==5 && num.at(2)==7){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
}


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

typedef long long ll;
const int MAXM = (1 << 15) + 5, MAXN = 20;
const int mod = 1e9 + 7;
 
inline void inc(int &x, int y) { x += y; if (x >= mod) x -= mod; }
 
int f[MAXM], bit2[MAXM], n, G[MAXN], m;
 
int main()
{
	cin >> n >> m;
	bit2[0] = 1; f[0] = 1;
	for (int i = 1; i <= m; i ++) bit2[i] = (bit2[i - 1] << 1) % mod;
	for (int i = 1, x, y; i <= m; i ++) cin >> x >> y, --x, --y, G[x] |= 1 << y;
	for (int S = 1; S < (1 << n); S ++) if ((S & 1) == (S >> 1 & 1))
		for (int U = S; U; U = U - 1 & S) if ((U & 1) == (U >> 1 & 1))
		{
			int ways = 1;
			ll T = (S ^ U);
			for (int i = 0; i < n; i ++) if (S >> i & 1)
			{
				if (U >> i & 1) ways = 1LL * ways * bit2[__builtin_popcount(G[i] & T)] % mod;
				else ways = 1LL * ways * (bit2[__builtin_popcount(G[i] & U)] - 1) % mod;
			}
			f[S] = (f[S] + 1LL * f[T] * ways % mod) % mod;
		}
	return printf("%d\n", (bit2[m] - f[(1 << n) - 1] + mod) % mod), 0;
}

Measured memory_bytes: 3848
d={}
n=int(input())
for i in range(n):
    s=input()
    if s in d: d[s]+=1
    else:      d[s] =1
n=int(input())
for i in range(n):
    s=input()
    if s in d: d[s]-=1
ans=chk=0
for i in d:
    ans=max(ans,d[i])
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <algorithm>    
#include <vector>       
#include <set>
#include <utility>  
#include <cstring>
#include <stdio.h>
#include <limits.h>
#include <queue>
#include <algorithm> 
#define MAX_DOUBLE  40000000000.0 
#include <math.h> 
#include <unistd.h>

using namespace std;

long long mod = 1e9 + 7;

vector<vector<int> > vec;

bool been[100010];

pair<long long, long long> fun(int a){
//	cout<<a<<endl;
	been[a] = true;
	
	long long black = 1;
	long long white = 1;
	
	for(int i = 0; i<vec[a].size(); i++){
		int p = vec[a][i];
		if(been[p]) continue;
		
		pair<long long, long long >tmp = fun(p);
		black *= tmp.first;
		white *= (tmp.first + tmp.second);
		
		black = black % mod;
		white = white % mod;
	}
	
	return make_pair(white, black);
}

int main(){
	int n;
	cin>>n;
	
	vec.resize(n);
	
	for(int i = 0; i<n-1; i++){
		int a,b;
		cin>>a>>b;
		vec[a-1].push_back(b-1);
		vec[b-1].push_back(a-1);
	}
	
	pair<long long, long long> res = fun(0);
	
	cout<<(res.first + res.second) % mod;
}


Measured memory_bytes: 9984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(v,n) FOR(v,0,n)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;
const ll INFLL = 1e18;
template<class T,class U>ostream&operator<<(ostream &os,const pair<T,U> &p){
    os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T>ostream&operator<<(ostream &os,const vector<T> &v){
    ITR(i,v)os<<*i<<(i==end(v)-1?"":" ");return os;}
//------------------------------------------------------------------------------

int main(int argc, char const *argv[]) {
    string s;
    cin>>s;
    vector<int> count(26,0);
    FORE(c,s) count[c-'a']++;
    FORE(x,count) {
        if(x&1) {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
import javax.xml.crypto.Data;
    import java.math.BigDecimal;
    import java.util.*;
    import java.io.*;

    public class Main {

        public static void main(String[] args) throws IOException {

            //入力
            //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            FastScanner sc = new FastScanner();
            int n = sc.nextInt();

            //出力
            int[] a = new int[4];
            for (int i = 3; i >= 0 ; i--) {
                a[i] = n % 10;
                n /= 10;
            }
            if ((a[0] == a[1] && a[1] == a[2])
                    || (a[1] == a[2] && a[2] == a[3])) System.out.println("Yes");
            else System.out.println("No");
        }

    }


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


Measured memory_bytes: 21076
#!/usr/bin/ruby
a=[]
gets.to_i.times{
	s,n=gets.split
	if s=='insert'
		a.unshift(n.to_i)
	elsif s=='delete'
		a.length.times{|i|if a[i]==n.to_i then a.delete_at(i);break end}
	elsif s=='deleteFirst'
		a.shift
	else
		a.pop
	end
}
puts a*' '

Measured memory_bytes: 20696
n, k = map(int, input().split())
t = [[int(x) for x in input().split()] for _ in range(n)]
#print(t)
n = 0
for i in range(k+1):
    #1 ~ k
    flag = True
    for j in t:
        if i not in j[1:]:
            flag = False
    if flag == True:
        n += 1
print(n)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
bool vis[BITLE(19)];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vi A(BITLE(n));
  for(auto &a:A)cin>>a;
  sort(ALL(A),greater<ll>());
  priority_queue<ll> slime[2];
  slime[0].push(A[0]);
  bool ans=true;
  vis[0]=true;
  for(int i=0;i<n;i++){
    ll num=BITLE(i);
    ll cnt=0;
    ll now=slime[i%2].top();
    for(int j=0;j<BITLE(n);j++){
      if(vis[j])continue;
      if(now<=A[j])continue;
      // cout<<now<<endl;
      slime[i%2].pop();
      slime[(i+1)%2].push(A[j]);
      slime[(i+1)%2].push(now);
 vis[j]=true;
      if(!slime[i%2].empty())
	now=slime[i%2].top();
      else break;
     
    }
    if(!slime[i%2].empty()){cout<<"No"<<endl;return 0;}
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 5800
n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
c=0
for i in range(n-2):
  for j in range(i+1,n-1):
    u=l[i]-l[j]
    if l[j+1]<=u:
      break
    ok=j+1
    ng=n
    while ng-ok>1:
      center=(ok+ng)//2
      if l[center]>u:
        ok=center
      else:
        ng=center
    c+=ng-j-1
print(c)    

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

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

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;
  vector<ll> a(3 * N);
  REP(i, 3 * N) { cin >> a.at(i); }
  sort(a.begin(), a.end(), greater<ll>());
  ll ans = 0ll;
  for (int i = 1; i < 2 * N; i += 2) {
    ans += a.at(i);
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
  int N,M,q;
  cin >> N >> M;
  q = floor(M/N);
  for (int i = 0; i < q; i++) {
    if (M%(q-i)==0) {
      cout << q-i << endl;
      break;
    }
  }
}


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

using namespace std;

int main() {
    string S;
    cin >> S;

    size_t len = S.size();
    const char* s = S.c_str();

    int diff = 99999999;
    for (int i = 0; i < len - 2; ++i) {
        int num = 100 * (s[i] - '0') + 10 * (s[i + 1] - '0') + (s[i + 2] - '0');
        int d = abs(753 - num);
        if (d < diff) {
            diff = d;
        }
    }
    cout << diff << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <set>

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef long long ll;
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define rep(i, n) for(int i = 0; i < n; ++i) 
#define foreach(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it) 

#define TRACE(x...) x
#define watch(x) TRACE(cout << #x" = " << x << endl)
#define watcharr(i, x) TRACE(cout << #x" = "); rep(i, sz(x)) cout << x[i] << " "; cout << endl

int main() {
	
	ifstream infile("input.in");
	if(infile.good()) cin.rdbuf(infile.rdbuf());
	
    int N, K;
    cin >> N >> K;

    vector<int> v(N, 0);

    int c, a;
    rep(i, K) {
        cin >> c;
        rep(j, c) cin >> a, v[a-1]++;
    }

    int ret = count_if(all(v), [] (int i) {
        return i == 0;
    });

    cout << ret << endl;

	if(infile.good()) infile.close();
	return 0;
	
}



Measured memory_bytes: 3608
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,a,ans=0;
  map<int,int> m;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a;
    m[a]++;
  }
  for(auto p:m) {
    if(p.second%2) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4992
#include <iostream>
using namespace std;
static const int MAX = 1000;

void trace(int *a, int n) {
    for (int i = 0; i < n-1; i++) {
        cout << a[i] << " ";
    }
    cout << a[n-1] << endl;
}

void insertionSort(int *a, int n) {
    for (int i = 1; i < n; i++) {
        int v = a[i];
        int j = i - 1;
        while (j >= 0 && a[j] > v) {
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        trace(a, n);
    }
}

int main() {    
    int a[MAX], n;

    cin >> n;
    
    for (int i = 0; i < n; i++) cin >> a[i];
    trace(a, n);
    insertionSort(a, n);

    return 0;
}



Measured memory_bytes: 3056
fun main(args: Array<String>) {
    val (n, m) = readLongList()

    val ans = when {
        n == 1L && m == 1L -> 1L
        n == 1L && m > 1L -> m - 2L
        n > 1L && m == 1L -> n - 2L
        else -> (n - 2L) * (m - 2L)
    }
    println(ans)
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)


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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

bool isPrime (int n) {
    for (int i = 2; i*i <= n; i++) {
        if (n%i == 0) return false;
    }
    return true;
}

int main()
{
    FAST_IO;

    int x; cin >> x;
    while (true) {
        if (isPrime(x)) {
            cout << x << endl;
            return 0;
        }
        x++;
    }

    return 0;
}


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

int main()
{
  int n; cin >> n;
  int digit = 1;
  
  int n_copy = n;
  while((int) (n_copy / pow(10,digit))){
    digit ++;
  }
  
  //cout << digit << endl;
  
  int ans;
  if (digit % 2 == 0){
    for ( int d = 1; d < digit; d+= 2){
      //cout << 9 * pow(10, d-1) << endl;
      ans += 9 * pow(10, d-1);
    }
  } else {
    for ( int d = 1; d < digit; d+= 2){
      //cout << 9 * pow(10, d-1) << endl;
      ans += 9 * pow(10, d-1);
    }
    //cout << n - pow(10, digit-1) + 1 << endl;
    ans += n - pow(10, digit-1) + 1;
  }
    
  cout << ans << endl;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	int max_x = X, min_y = Y;

	rep(i, N) {
		int x; cin >> x;
		max_x = max(max_x, x);
	}
	rep(i, M) {
		int y; cin >> y;
		min_y = min(min_y, y);
	}

	if (max_x < min_y) cout << "No War" << endl;
	else cout << "War" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int a = cin.nextInt();
        int b = cin.nextInt();
        int x = cin.nextInt();
        if (x < a || x > a + b) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
}


Measured memory_bytes: 22868
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

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

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

    vector< vector<char> >mine(H,vector<char>(W));

    for(int i = 0;i<H;i++){
        for(int j = 0; j < W; j++){
            cin>>mine[i][j];
        }
    }

    for(int i=0;i<H;i++){
        for(int j = 0; j < W;j++){
            if(mine[i][j] == '.'){
                int bom = 0;
                for(int k=0;k<8;k++){
                    if(i+dy[k] >= 0 && i+dy[k] < H && j+dx[k] >=0 && j+dx[k] < W){
                        if(mine[i+dy[k]][j+dx[k]] == '#') bom++;
                    }
                    
                }
                mine[i][j] = char(bom+'0');
            }
        }
    }

    for(int i = 0;i<H;i++){
        for(int j = 0; j < W; j++){
            cout<<mine[i][j];
        }
        cout<<endl;
    }

}

Measured memory_bytes: 256
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
struct Data{
    char c;
    int n;
};

Data a[1000020];

int dp[1000020];
int main(void){

    string str;
    cin>>str;

    char ch = 'A';
    int num = 1;
    int t = -1;
    for(int i = 0;i < str.size();i++){
        if(ch == str[i]){
            a[t].n++;
        }
        else{
            ch = str[i];
            t++;
            a[t].c = ch;
            a[t].n = 1;
        }
    }
    t++;
    int ans = 0;
    for(int i = 0;i < t;i++){
        switch(a[i].c){
            case 'J':
                dp[i] = a[i].n;
                break;
            case 'O':
                if(i>0){
                    if(a[i-1].c == 'J' && a[i-1].n >= a[i].n)dp[i] = a[i].n;
                }
                break;
            case 'I':
                if(i>0){
                    if(a[i-1].c == 'O' && dp[i-1] <= a[i].n)dp[i] = dp[i-1],ans = max(ans,dp[i]);
                }
                break;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 13988
n,a,b = map(int,input().split())
x = list(map(int,input().split()))
ans = 0

for i in range(n-1):
  if a*(x[i+1]-x[i]) > b:
    ans = ans+b
  else:
    ans = ans+a*(x[i+1]-x[i])
    
print(ans)

Measured memory_bytes: 15020
#include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define F first
#define S second
using namespace std;
#define mod 1000000007


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int ac=0; int wa=0; int tle=0; int re=0;
    int n; cin>>n;
    for(int i=0;i<n;i++){
        string s; cin>> s;
        if(s.compare("AC")==0) ac++;
        else if(s.compare("TLE")==0)tle++;
        else if(s.compare("WA")==0) wa++;
        else if(s.compare("RE")==0) re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
	ll a, b, c;
	cin>>a>>b>>c;
	ll ans = INT_MAX;
	if(a%2 == 0 || b%2 == 0 || c%2 == 0) {
		cout<<0<<"\n";
	} else {
		ans = min(a*b, min(b*c, a*c));
		cout<<ans<<"\n";
	}
	return 0;
}

Measured memory_bytes: 256