akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
using namespace std;

int main()
{
  int n,m;
  for(;cin>>n>>m;)
    {
      int a[n];
      for(int i=0;i<n;i++)
	cin>>a[i];
      int cnt[n];
      int ans=0;
      int anscnt=0;
      memset(cnt,0,sizeof(cnt));
      for(int i=0;i<m;i++)
	{
	  int b;
	  cin>>b;
	  for(int j=0;j<n;j++)
	    {
	      if(a[j]<=b)
		{		  
		  cnt[j]++;
		  if(cnt[j]>anscnt)
		    {
		      anscnt=cnt[j];
		      ans=j+1;
		    }
		  break;
		}
	    }
	}
      cout<<ans<<endl;
    }
}

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

int main() {
    std::string S;
    std::cin >> S;
    int n = S.length();

    int l = 0, maxl = 0;
    for (int i = 0; i < n; ++i) {
        if (S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C'){
            ++l;
        } else {
            maxl = std::max(maxl, l);
            l = 0;
        }
    }
    std::cout << std::max(maxl, l) << '\n';
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
 
int main() {

    string s;
    cin>>s;
    int n=s.size();

    int c0=0,c1=0;
    rep(i,n) {
        if(s[i]=='0')   c0++;
        else    c1++;   
    }
    int ans=2*min(c1,c0);
    cout<<ans<<endl;
 
 return 0;
}

Measured memory_bytes: 512
def main():
  N, Y = list(map(int, input().split()))
  for i in range(N+1):
    for j in range(N+1-i):
      k = N-i-j
      if Y == (10000*i + 5000*j + 1000*k):
        print(i, j, k)
        return
  print(-1, -1, -1)


if(__name__ == '__main__'):
  main()

Measured memory_bytes: 9020
/******
Author:Ashraful Fuad Mehmet
University of Asia Pacific
date :07 Feb 2020
problem : https://codeforces.com/problemset/problem/639/B
*******/

#include<bits/stdc++.h>
#define input freopen("input.txt","r",stdin);
#define all(x) (x).begin(), (x).end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

typedef long long ll;
int tc,cs=1,n,m,len;
void debug();
const int N=405;
template<class T> inline T sqr(const T &x)
{
  return x*x;
}/// end

ll dp[205][4][3];
 string s;
ll digitDP(int idx,int cnt,int flag)
{
 if(idx>=len)return cnt==n;

 if(cnt>n)return 0;

 ll ans=0;
  int p=s[idx]-'0';
  int l=p;
  if(flag){
    l=9;p=99;
  }

  ll &ret=dp[idx][cnt][flag];

  if(-1!=ret)
  {
   // cout<<"memo"<<endl;
    return ret;
  }

 
  for(int i=0;i<=l;++i)
  {
    int f=1;
    if(!flag&&i==l)f=0;
    if(i==0)
    {
      ans+=digitDP(idx+1,cnt,f);
    }
    else ans+=digitDP(idx+1,cnt+1,f);
  }

  return ret=ans;

}/// end func

void brain_fry()
{
 
 cin>>s;
 cin>>n;
 len=s.size();
  
  memset(dp,-1,sizeof dp);
 ll ans=digitDP(0,0,0);
 cout<<ans<<endl;
}// end func
int main()
{
  // input
  fastio
  brain_fry();
  // debug();
  return 0;
}
void debug()
{
  cout<<"Debug goes here"<<endl;
}

Measured memory_bytes: 256
/*	MASTER HAS FAILED MORE TIMES
	THAN BEGINNER HAS EVER TRIED
*/

#include <bits/stdc++.h>

using namespace std;

#define endl            '\n'
#define mem(a, n)       memset(a, n, sizeof(a))
#define repeat(n)       for(int i=0; i<n; i++)
#define Unique(n)       (n).erase(unique(all(n)), (n).end())
#define isPowerOfTwo(n) (n && !(n & (n - 1)))
#define NumofDigits(n)  ((int)log10(n)+1)
#define all(a)          a.begin(), a.end()

unsigned long long pow(long long base, long long power);

long long gcd(long long a, long long b){ return a%b ? gcd(b, a%b) : b; }
long long lcm(long long a, long long b){ return a*b/gcd(a, b); }

void quicken(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

/*
    Special functions:
        find_by_order(k) --> returns iterator to the kth largest element counting from 0
        order_of_key(val) --> returns the number of items in a set that are strictly smaller than our item
*/

int main(){
    quicken();

    long long n, ans=LLONG_MAX; cin >> n;
    for(int i=1; i<=sqrt(n); i++)
        if(!(n%i))
            ans = min(ans, i+n/i-2);

    cout << ans;

    return 0;
}

unsigned long long pow(long long base, long long power){
    if(power==0) return 1;
    if(power==1) return base;

    unsigned long long ans = pow(base, power/2);
    ans *= ans; /// ans = (ans%mod)*(ans%mod);

    if(power&1) return ans*base; /// (ans%mod)*(base%mod);
    return ans;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<int>A(N);
  for(int &a:A)cin>>a;
  sort(A.begin(),A.end(),greater<int>());
  map<int,int>m;
  int ans=0;
  for(int a:A){
    if(m.count(a)&&m[a]>0)m[a]--,ans++;
    else m[(1<<(32-__builtin_clz(a)))-a]++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 10368
#include<stdio.h>
#include<stdlib.h>
struct node{   
  int key;
  struct node *parent;
  struct node *right;
  struct node *left;
};
typedef struct node *Node;
Node T;
#define NIL NULL;
void Insert(int);
void Preorder(Node);
void Inorder(Node);
int main()
{
  int n,i,key;
  char S[7];  
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%s",S);
    if(S[0]=='i'){
      scanf("%d",&key);
      Insert(key);
    }
    else{
      Inorder(T);
      printf("\n");
      Preorder(T);
      printf("\n");
       
    }
  }
  return 0;
}
 
void Insert(int key)
{
  Node y,x,z;
  y=NIL;
  x=T;
  z=malloc(sizeof(struct node));
  z->key=key;
  z->left=NIL;
  z->right=NIL;
  while(x!=NULL){
    y=x;
    if( z->key < x->key )x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NULL){
    T=z;
  }
  else if(z->key<y->key){
      y->left=z;
  }
  else{
    y->right=z;
  }
}
 
void Preorder(Node T)
{
  printf(" %d",T->key);
  if(T->left!=NULL){
    Preorder(T->left);
  }
  if(T->right!=NULL){
    Preorder(T->right);
  }
    
}
void Inorder(Node T)
{
  if(T->left!=NULL && T->right!=NULL){
    Inorder(T->left);
    printf(" %d",T->key);
    Inorder(T->right);
   
  }
  if(T->left!=NULL && T->right==NULL){
   Inorder(T->left);
     printf(" %d",T->key);  
  }
   
  if(T->right!=NULL && T->left==NULL){
  printf(" %d",T->key);
 Inorder(T->right); 
   
  }
  if(T->left==NULL && T->right==NULL)printf(" %d",T->key);
  
}


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

using namespace std;

int main() {
	int n, x, k=0;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> x;
		if(((i+1)%2) + (x%2) == 2) k++;
	}
	cout << k << '\n';
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll LINF = 1001002003004005006LL;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int n, k; cin >> n >> k;
    vector<int> a(n); 
    rep(i,n) cin >> a[i];
    
    rep(i,n-k) {
        if (a[i]<a[i+k]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

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

double calc(double d){
  double res = 2 * d / sqrt(2);
  double y = (int)d;
  if(sqrt(y*y+1)>=d)res=max(res,y+1);
  return res;
}

int main(){
  double d;
  cin>>d;
  double ans = calc(d);
  printf("%.10f\n",ans);		 
  return 0;
}

Measured memory_bytes: 3284
#include<iostream>
using namespace std;
int a,b[20];
int main()
{

    int n,m,c;
    cin>>n>>m>>c;
    int num=0;
    for(int i=0;i<m;i++)
    {
				cin>>b[i];
    }
    for(int i=0;i<n;i++)
    {
        int sum=0;
				for(int i=0;i<m;i++)
        {
						cin>>a;
						sum+=a*b[i];
        }
        if(sum+c>0) num++;
    }
    cout<<num<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
 using namespace std;
 set<int> a[26];
 string temp;
 int main()
 {
 	int n,op,pos,l,r,m;
 	cin>>n;
	cin>>temp;
	char ch;
	for(int i=0;i<temp.size();i++) a[temp[i]-'a'].insert(i+1);
	scanf("%d",&m);
	while(m--){
		scanf("%d",&op);
		if(op==1){
			cin>>pos>>ch;
			a[temp[pos-1]-'a'].erase(pos);
			temp[pos-1]=ch;
			a[temp[pos-1]-'a'].insert(pos);
		}
		else{
			cin>>l>>r;
			int num=0;
			for(int i=0;i<26;i++){
				set<int>::iterator it;
				it=a[i].lower_bound(l);
				if(it!=a[i].end()&&*it<=r) num++;
			}
			cout<<num<<endl;
		}
	}
	return 0;
 }

Measured memory_bytes: 26244
from collections import defaultdict as dd

h,w,n=map(int,input().split())
d=dd(int)
c={i:0 for i in range(10)}

for _ in range(n):
    a,b=map(int,input().split())
    for i in range(3):
        for j in range(3):
            if a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:
                d[(a-i,b-j)]+=1

d=dict(d)
v=0
for i in d.values():
    c[i]+=1
    v+=1
c[0]=(h-2)*(w-2)-v

for i in range(10):
    print(c[i])


Measured memory_bytes: 216068
function main(input) {
	const x = input;
	var t = 1;
	for(b=2;b<=1000;b++){
		for(p=2;p<=1000;p++){
			var a = Math.pow(b, p);
			if(a > x){
				a = 0;
				break;
			}
			if(a>t){
				t = a;
			}
		}
		if(a > x){
			break;
		}
	}
	console.log(t);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int d_x[4] = { -1,0,1,0 };
int d_y[4] = { 0,1,0,-1 };

int t[4][4];
int level = 0;

int countpath() {
	int ret = 0;
	int tmp;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			if (t[i][j] != 0) {
				tmp = t[i][j] - 1;
				ret += abs(tmp / 4 - i) + abs(tmp % 4 - j);
			}
		}
	}
	return ret;
}

bool check(int depth, int pre, int px, int py) {
	int w = countpath();
	if (w + depth > level) return false;
	if (w == 0)return true;
	int dx, dy;
	for (int i = 0; i < 4; i++) {
		if (abs(i - pre) != 2) {
			dx = px + d_x[i];
			dy = py + d_y[i];
			if (dx < 0 || dx == 4 || dy < 0 || dy == 4) continue;
			swap(t[dx][dy], t[px][py]);
			if (check(depth + 1, i, dx, dy)) return true;
			swap(t[dx][dy], t[px][py]);
		}

	}
	return false;
}

void solution(int px, int py) {
	for (level = 0;; level++) {
		if (check(0, 9, px, py)) {
			cout << level << endl;
			return;
		}
	}
}

int main() {
	int px, py;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> t[i][j];
			if (t[i][j] == 0) {
				px = i;
				py = j;
			}
		}
	}
	solution(px, py);
	return 0;
}

Measured memory_bytes: 3100
#include <iostream>

using namespace std;

int main() {
    long long X, A, B;
    cin >> X >> A >> B;

    long long d = B - A;
    if (d <= 0) {
        cout << "delicious" << endl;
    } else if (d <= X) {
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void){
    int a[3][3];
    int n,i,k,j;
    int b[100]={0},c[3][3]={0};

    for(i=0;i<3;i++){
        scanf("%d %d %d",&a[0][i],&a[1][i],&a[2][i]);
    }
    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%d",&b[i]);
    }
    for(i=0;i<n;i++){
        for(j=0;j<3;j++){
            for(k=0;k<3;k++){
                if(a[j][k]==b[i]){
                    c[j][k]=1;
                }
            }
        }
    }
    if(c[0][0]==1&&c[0][1]==1&&c[0][2]==1){
        printf("Yes\n");
    } else if(c[1][0]==1&&c[1][1]==1&&c[1][2]==1){
        printf("Yes\n");
    } else if(c[2][0]==1&&c[2][1]==1&&c[2][2]==1){
        printf("Yes\n");
    } else if(c[0][0]==1&&c[1][0]==1&&c[2][0]==1){
        printf("Yes\n");
    } else if(c[0][1]==1&&c[1][1]==1&&c[2][1]==1){
        printf("Yes\n");
    } else  if(c[0][2]==1&&c[1][2]==1&&c[2][2]==1){
        printf("Yes\n");
    } else  if(c[0][0]==1&&c[1][1]==1&&c[2][2]==1){
        printf("Yes\n");
    } else  if(c[0][2]==1&&c[1][1]==1&&c[2][0]==1){
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}

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

int main(){
  
  vector <int> A(3);
  
  for (int i=0; i<3; i++)
    cin >> A.at(i);
  
  int n_5 = 0;
  int n_7 = 0;
  
  for (int i=0; i<3; i++){
    
    if(A.at(i) == 5)
      n_5++;
    
    else if(A.at(i) == 7)
      n_7++;
      
  }
  
  if(n_5 == 2 && n_7 == 1)
    cout << "YES" << endl;
  
  else
    cout << "NO" << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
int N, M;
void func()
{
    cin >> N >> M;
    vector<vector<int>> land(N + 1, vector<int>(0));
    rep(i, 0, M)
    {
        int a, b;
        cin >> a >> b;
        land[a].push_back(b);
        land[b].push_back(a);
    }
    bool v[N + 1] = {};
    queue<int> q;
    q.push(1);
    v[1] = true;
    int cnt = 0;
    while (cnt++ <= land[1].size())
    {
        int y = q.front();
        v[y] = true;
        q.pop();
        rep(i, 0, land[y].size())
        {
            int tmp = land[y][i];
            if (tmp == N)
            {
                cout << "POSSIBLE" << endl;
                return;
            }
            if (!v[tmp])
            {
                q.push(tmp);
            }
        }
    }
    cout << "IMPOSSIBLE" << endl;
}
int main()
{
    func();
}

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

int main(){
  int x; cin>>x;
  int ans=x;
  for(int i=x; i<1000000000; ++i){
    bool flg=true;
    for(int j=2; j<=sqrt(i); ++j)
      if(i%j==0){flg=false; break;}
    if(flg){ans=i; goto end;}
  }

  end:
  cout<<ans<<endl;
}

Measured memory_bytes: 256
[X,Y] = list(map(int,input().split()))
output = 0

Z = X+Y

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

if (Z%3==0)and(Z/3<=X)and(Z/3<=Y):
    T = int(Z/3)
    S = abs(int(Z/3)-min(X,Y))
    output = combination(T,S, mod=10**9+7)

print(output)

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

class BIT{
    public:
    int size;
    vector<ll> tree;
    
    void set(int n){
        size = n;
        tree = vector<ll>(n+1, 0);
        return;
    }
    
    void add(int n, ll a) {
        int x = n;
        while (x <= size){
            tree[x] += a;
            x += (x & -x);
        }
        return;
    }
    
    ll getsum(int n) {
        int x = n;
        ll sum = 0;
        while (x > 0) {
            sum += tree[x];
            x -= (x & -x);
        }
        return sum;
    }
    
};

int main() {
    int N, Q;
    scanf("%d %d", &N, &Q);
    vector<int> c(N+1, 0);
    for (int i = 1; i <= N; i++) scanf("%d", &c[i]);
    vector<int> pre(N+1, -1);
    vector<pair<pair<int, int>, int>> event;
    for (int i = 1; i <= N; i++) {
        if (pre[c[i]] == -1) {
            pre[c[i]] = i;
            continue;
        }else {
            event.push_back({{pre[c[i]], i}, -1});
            pre[c[i]] = i;
        }
    }
    for (int i = 0; i < Q; i++) {
        int l, r;
        scanf("%d %d", &l, &r);
        event.push_back({{l, r}, i});
    }
    sort(event.begin(), event.end(), [](auto x, auto y){if (x.first.first != y.first.first) return x.first.first > y.first.first;
                                                        else return x.second < y.second;});
    vector<int> ans(Q, 0);
    BIT bit;
    bit.set(N+5);
    for (auto e : event) {
        int idx = e.second;
        if (idx == -1) {
            bit.add(e.first.second, 1);
        }else {
            ans[idx] = e.first.second - e.first.first+1;
            ans[idx] -= bit.getsum(e.first.second);
        }
    }
    for (int i = 0; i < Q; i++) {
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 24496
import sys, fractions
from collections import defaultdict
from copy import deepcopy
import itertools
input = sys.stdin.readline
# 文字列の場合は普通のinput()を使うか下を使う
# input = sys.stdin.readline().rstrip()


A, B = map(int, input().split())
gcd = fractions.gcd(A, B)
ans = A * B // gcd
print(ans)



Measured memory_bytes: 66156
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define ll long long
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  in(a),in(b)
#define in3(a,b,c)  in2(a,b),in(c)
#define in4(a,b,c,d)  in2(a,b),in2(c,d)
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
ll read(){
    ll f=1,x=0;char c=getchar();
    while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
    return x*f;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 100010
#define inf 0x7fffffff
/*------------------------------------------------------------*/
bool check(int x){
	FOR(i,2,sqrt(x))
		if(x%i==0)return 0;
	return 1;
}
char c[100][100];
ll pow(ll a,ll b){
	FOR(i,1,b)a*=2;
	return a;
}
int main(){
	int x,y;
	in2(x,y);
	if(y>=x)out(x);
	 else out(x-1); 
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>

#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define abs(x)		(((x) < 0)? (-1*(x)) : (x))

using namespace std;

int N,H;

int main() {
	int i,x=0;
	int a,max;
	
	cin >> N >> H;

	vector<int> b(N);

	for ( i = 0; i < N; i++ ) {
		cin  >> a >> b[i]; 
		max = MAX(a,max);
	}
	
	sort(b.begin(), b.end());
	reverse(b.begin(), b.end());
	
	for (i=0;i<N;i++) {
		if (max < b[i] && H > 0) {
			H -= b[i];
			x++;
		} else break;
	}
	
	while ( H  > 0 ) {
		H -= max;
		x++;
	}
	
	cout << x << endl;

	return 0;
}


Measured memory_bytes: 640
N = int(input())
lst = list(map(int, input().split()))

if 0 in lst:
    print("0")
    quit()

res = 1
for a in lst:
    res = res*a
    if res > 1000000000000000000:
        print("-1")
        quit()
    else:
        pass

print(res)


Measured memory_bytes: 21684
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		sc.close();
		int cnt = 0;
		for(int x = 0; x <= K; x++) {
			for(int y = 0; y <= K; y++) {
				int t = S - x - y;
				if(t >= 0 && t <= K) {
					cnt++;
				}
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 23124
#include <iostream>

using namespace std;
typedef long long ll;
ll a[200010],dp1[200010][2],dp2[200010][2];
int main(){
    int i,n;
    cin >> n;
    for(i=0;i<n;i++) cin >> a[i];
    dp1[0][0] = dp1[0][1] = 0;
    dp2[n][0] = dp2[n][1] = 0;
    for(i=2;i<=n;i+=2){
        dp1[i][0] = dp1[i - 2][0] + a[i - 2];
        dp1[i][1] = max(dp1[i - 2][0],dp1[i - 2][1]) + a[i - 1];
    }
    for(i=n - 2;i>=0;i-=2){
        dp2[i][0] = dp2[i + 2][0] + a[i + 1];
        dp2[i][1] = max(dp2[i + 2][0],dp2[i + 2][1]) + a[i];
    }
    if(n%2==0){
        cout << max(dp1[n][0],dp1[n][1]) << endl;
    }else{
        ll ans = -10000000000000000;
        for(i=0;i<n;i+=2){
            ans = max(ans,max(dp1[i][0],dp1[i][1]) + max(dp2[i + 1][0],dp2[i + 1][1]));
        }
        cout << ans << endl;
    }
}

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

int main() {
    int n;long himax = 0;
    cin >> n;
    vector<long> h(n);
    string ans = "Yes";

    for (int i = 0; i < n; i++) {
        cin >> h.at(i);
    }
    for (int i = 0; i < n; i++) {
        himax = max(h.at(i), himax);
        if (h.at(i) < himax-1) {
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 998244353LL
#define INF 1000000000000000LL

using namespace std;

// Binary Indexed Tree (Fenwick Tree)
// https://youtu.be/lyHk98daDJo?t=7960
template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] = (d[i]+x)%MOD;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x = (x+d[i])%MOD;
    }
    return x%MOD;
  }
};

int main(){
  int n,k;cin>>n>>k;
  vector<pi>lr(k);
  rep(i, k)cin>>lr[i].first>>lr[i].second;

  BIT<ll> bit(220000);
  bit.add(1, 1);
  bit.add(2, -1);

  rep1(i, n){
    ll cv = bit.sum(i)%MOD;
    rep(j, k){
      int l=lr[j].first;
      int r = lr[j].second;
      l = i+l;
      r = i+r+1;

      if(l>n+1)continue;
      if(r>n)r=n+1;

      bit.add(l, cv);
      bit.add(r, -cv);
    }
  }

  ll result = bit.sum(n);
  while(result<0)result+=MOD;
  cout<<result%MOD<<endl;

  return 0;
}

Measured memory_bytes: 5080
#include<iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
int main(){
  int N, M, B[100000];
  cin >> N >> M;
  vector<pair<unsigned long, int>> A(N);
  for(int i=0; i<N; i++){
    unsigned long f;
    cin >> f >> B[i];
    A[i] = make_pair(f, i);
  }
  sort(A.begin(), A.end());
  unsigned long cnt = 0, ans = 0, n = 0;
  cnt += B[A[n].second];
  while(cnt < M){
    ans += B[A[n].second] * A[n].first;
    n++;
    cnt += B[A[n].second];
  }
  ans += (M-(cnt-B[A[n].second]))*A[n].first;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2176
import scala.io._
object Main {
	def main(args: Array[String]) {
		val input = Source.fromInputStream(System.in)
		val lines = input.getLines.toSeq

		var DX = lines(1).split(" ").map(_.toInt)
		var A = lines.drop(2).map(_.toInt)
		var res = 0

		A.foreach{
			c =>
			var i = 1
			while((i * c) + 1 <= DX(0)) i += 1
			res += i
		}
		println(res + DX(1))
	}
}

Measured memory_bytes: 25520
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long Inf = (long) 1e18;
		int VV = 100010;
		long[] dp = new long[VV];
		for(int i=0;i<VV;i++) dp[i] = Inf;
		
		dp[0] = 0;
		for(int i=0;i<N;i++){
			long w = We[i];
			int v = V[i];
			for(int j=VV-1;j>=0;j--){
				if(j + v < VV){
					dp[j + v] = Math.Min(dp[j + v], dp[j] + w);
				}
			}
		}
		
		long ans = 0;
		for(int i=0;i<VV;i++){
			if(dp[i] <= W){
				ans = i;
			}
		}
		Console.WriteLine(ans);
	}
	int N;
	long W;
	long[] We;
	int[] V;
	public Sol(){
		var d = ria();
		N = d[0]; W = d[1];
		We = new long[N];
		V = new int[N];
		for(int i=0;i<N;i++){
			d = ria();
			We[i] = d[0];
			V[i] = d[1];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13244
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define LL long long
template<class T> inline void chmax(T & a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

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

	map<char, int> dict;
	for (char i = 'a'; i <= 'z'; i++){
		dict[i] = 0;
	}

	rep(i, s.size()) {
		dict[s[i]]++;
	}

	for (auto &kv:dict)
	{
		if (kv.second == 0) {
			cout << kv.first << endl;
			return 0;
		}
	}

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


Measured memory_bytes: 512
#include <stdio.h>
#define BLACK 2
#define GRAY 1
#define WHITE 0
#define N 100
#define INF 100000

int G[N][N],n;

int prim(void){
  int i,v,u,sum=0;
  int d[N],color[N],p[N],minv;
  
  for(i=0;i<n;i++){
    d[i]=INF;
    p[i]=-1;
    color[i]=WHITE;
  }
  
  d[0]=0;
  
  while(1){
    u=-1;
    minv=INF;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && d[i]<minv){
	u=i;
	minv=d[i];
      } 
    }
    if(u==-1) break;
    color[u]=BLACK;
    
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && G[u][v]!=INF){
	if(d[v]>G[u][v]){
	  d[v]=G[u][v];
	  p[v]=u;
	  color[v]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(p[i]!=-1) sum+=G[i][p[i]];
  }

  return sum;
}

int main(){
  int i,j,e;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&e);
      if(e==-1) G[i][j]=INF;
      else G[i][j]=e;
    }
  }

  printf("%d\n",prim());

  return 0;
}



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

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

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   int gcd(int a,int b){return b?gcd(b,a%b):a;};

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

const ll MAX_N = 2e5;
const ll MAX_digit = 28;
ll N;
ll a[MAX_N];
ll b[MAX_N];

ll xor_digit(ll k){
    //(1 << k)の位に注目したときに, N^2個のXORがいくつになるか
    //O(N log N)で計算できる
    ll ak[MAX_N];
    ll bk[MAX_N];
    ll X = 1 << k;


    REP(i, N){
        ak[i] = (a[i] & (2 * X - 1));
        bk[i] = (b[i] & (2 * X - 1));
    }
    sort(ak, ak + N); sort(bk, bk + N);

    ll ans = 0;
    REP(i, N){
        ans += 
        lower_bound(bk, bk + N, 2 * X - ak[i]) - lower_bound(bk, bk + N, X - ak[i])
        + lower_bound(bk, bk + N, 4 * X - ak[i]) - lower_bound(bk, bk + N, 3 * X - ak[i]);
    }
    ans %= 2;
    return ans;
}

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

    //input
    cin >> N;
    REP(i, N){
        cin >> a[i];
    }
    REP(i, N){
        cin >> b[i];
    }
    
    ll ans = 0;
    REP(k, MAX_digit + 2){
        ans += (1 << k) * xor_digit(k);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    int n = s.size()-2;
    vector<int> b;
    rep(i,n){
        string l = s.substr(i,3);
        int num = stoi(l);
        b.pb(abs(num - 753));
    }
    sort(b.begin(),b.end());
    cout << b[0] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<ctime>
#include<set>
#include<queue>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);++(i))
#define fd1(i,n) for ((i)=(n);(i)>=1;--(i))
#define fz0g(i,n) for ((i)=0;(i)<=(n);++(i))
#define fd0g(i,n) for ((i)=(n);(i)>=0;--(i))
#define fz0k(i,n) for ((i)=0;(i)<(n);++(i))
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;--(i))
#define fz(i,x,y) for ((i)=(x);(i)<=(y);++(i))
#define fd(i,y,x) for ((i)=(y);(i)>=(x);--(i))
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
using namespace std;
int n,i,j,a[200005],nxt[200005],f[200005],vis[200005];
long long m;
set<int> pos[200005];
vector<int> v;
void solve(int x)
{
	if(vis[x]){
		while(vis[x]){
			vis[v.back()]=0;
			v.pop_back();
		}
	}
	else{
		vis[x]=1;
		v.push_back(x);
	}
}
int main()
{
	scanf("%d%lld",&n,&m);
	fz1(i,n){
		scanf("%d",&a[i]);
		pos[a[i]].insert(i);
	}
	/*if(n==1){
		if(m&1)cout<<a[1]<<endl;
		return 0;
	}*/
	fz1(i,n){
		set<int>::iterator it=pos[a[i]].upper_bound(i);
		if(it==pos[a[i]].end()){f[i]++;it=pos[a[i]].begin();}
		nxt[i]=(*it)+1;if(nxt[i]>n){f[i]++;nxt[i]=1;}
	}
	fd1(i,n){
		if(!f[i]){
			f[i]+=f[nxt[i]];
			nxt[i]=nxt[nxt[i]];
		}
	}
	int cnt=0,x=1;
	do
	{
		cnt+=f[x];
		x=nxt[x];
	}
	while(x!=1);
	m--;
	m%=cnt;
	x=1;
	while(m>=f[x]){
		m-=f[x];
		x=nxt[x];
	}
	for(i=x;i<=n;i++){
		solve(a[i]);
	}
	while(m--){
		fz1(i,n){
			solve(a[i]);
		}
	}
	fz0k(i,v.size()){
		printf("%d%c",v[i],(i+1==v.size()?'\n':' '));
	}
	return 0;
}

Measured memory_bytes: 24312
#include<iostream>
using namespace std;
int main (void) {
	string s; cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '1') {
			s[i] = '9';
		}
		else {
			s[i] = '1';
		}
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, l, r ) for(register int i = l; i <= r; ++ i)
using namespace std;
inline int read()
{
	char cc = getchar(); int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = (cn << 1) + (cn << 3) + cc - '0'; cc = getchar();}
	return flus * cn;
}
const int N = 10010;
signed main()
{
	int a[4];
	a[1] = read();
	a[2] = read();
	a[3] = read();
	sort(a + 1, a + 4);
	if(a[1] == a[2])
	{
		if(a[3] != a[1])
		{
			printf("Yes\n");
			return 0;
		}
		else printf("No\n");
		return 0;
	}
	else if(a[2] == a[3])
	{
		if(a[1] != a[2])
		{
			printf("Yes\n");
			return 0;
		}
		else printf("No\n");
		return 0;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        int k = Integer.parseInt(scanner.nextLine());
        String[] line = scanner.nextLine().split(" ", n);

        int result = 0;
        for (int i = 0; i < n; i++) {
            int x = Integer.parseInt(line[i]);
            result += 2 * Math.min(x, k - x);
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    ll X;
    cin>>X;
    ll counter=0;
    ll a=X/500;
    counter+=a*1000;
    X-=a*500;
    ll b=X/5;
    counter+=b*5;
    cout<<counter<<endl;
}

Measured memory_bytes: 256
n = int(input())
S = list(map(int,input().split()))
cnt = 0
for i in range(1,n-1,1):
    temp = [S[i-1],S[i],S[i+1]]
    temp.sort()
    #print(temp)
    if temp[1] == S[i]:
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
/*
 * Bad Move
 * Code be weshen zyk :'(
 */
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/STACK:1024000000,1024000000")

#include <bits/stdc++.h>

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

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define S second
#define F first
#define pb push_back

using ii = pair<int, int>;
using ll = long long;
using db = long double;

const int N = 3e5 + 5, K = 205, MOD = 998244353;
const ll MX = 1e15;
const int blkSz = 320;
int fast(int b, int e) {
	if (!e)
		return 1;
	if (e & 1)
		return 1ll * b * fast(b, e - 1) % MOD;
	return fast(1ll * b * b % MOD, e >> 1);
}
ll F[N], iF[N];
ll C(int n, int k){
	if(k > n)
		return 0;
	return F[n] * iF[k] % MOD * iF[n-k] % MOD;
}
int main() {
#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#endif

	ll n, a, b, k;
	cin >> n >> a >> b >> k;

	F[0] = iF[0] = 1;
	for (int i = 1; i < N; i++) {
		F[i] = F[i - 1] * i % MOD;
		iF[i] = fast(F[i], MOD - 2);
	}

	ll ans = 0;

	for (ll i = 0; i <= n && i * a <= k; i++) {
		if ((k - i * a) % b == 0) {
			ans += C(n, i) * C(n, (k - i * a) / b) % MOD;
			if(ans >= MOD)
				ans -= MOD;
		}
	}

	cout << ans << '\n';

	return 0;
}


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

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

int main(){
  int A, B; cin >> A >> B;
  if(13 <= A) cout << B << endl;
  else if(6<= A && A <= 12) cout << B/2 << endl;
  else cout << 0 << endl;
}

    


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin >> n;
  int odd = (n+2-1)/2;
  
  double ans = double(odd)/n;
  
  printf("%.10f",ans);
}

Measured memory_bytes: 256
from collections import deque
n,m = map(int,input().split())
p = list(map(int,input().split()))
route = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    route[a].append(b)
    route[b].append(a)
visit = [False for i in range(n+1)]
atumari = []
for i in range(1,n+1):
    if visit[i]:
        continue
    visit[i] = True
    kar = set([i])
    d = deque()
    d.append(i)
    while d:
        now = d.popleft()
        for j in route[now]:
            if not visit[j]:
                visit[j] = True
                kar.add(j)
                d.append(j)
    atumari.append(kar)
ans = 0
for i in range(len(atumari)):
    for j in atumari[i]:
        if p[j-1] in atumari[i]:
            ans += 1
print(ans)
        

Measured memory_bytes: 56104
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    long long N,A,B; cin >> N >> A >> B;
    if(A > B) cout << 0 << endl;
    else if(A == B) cout << 1 << endl;
    else if(N < 2) cout << 0 << endl;
    else{
        cout << (B-A)*(N-2)+1 << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
#define INF (1<<29)

int main(){
	int n, t, ans=0;
	vector<int> a;
	cin >> n;
	for(int i=0;i<2*n;i++){
		cin >> t;
		a.push_back(t);
	}
	sort(a.begin(),a.end());
	for(int i=0;i<n;i++)ans+=a[2*i];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N=int(input())
P=list(map(int, input().split()))
Q=list(map(int, input().split()))

import itertools
import numpy as np

X=np.array(list(itertools.permutations(list(range(1,N+1)))))

pp=""
for p in P:
    pp+=str(p)
qq=""
for q in Q:
    qq+=str(q)
for i in range(len(X)):
    y=""
    for x in X[i]:
        y+=str(x)
    if y==pp:
        a=len(X)-i
    if y==qq:
        b=len(X)-i
print(abs(a-b))
        

Measured memory_bytes: 21452
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long n;
	cin>>n;
	long long Min=1e18;
	for(long long i=1;i<=sqrt(n);i++) {
		if(n%i==0) {
			Min=min(Min,i+n/i-2);
		}
	}
	cout<<Min;
	return 0;
}

Measured memory_bytes: 256
def g(x, y, z):
    return x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x


N = int(input())
count = [0] * (N + 1)
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            cur = g(x, y, z)
            if cur <= N:
                count[cur] += 1
for i in range(1, N + 1):
    print(count[i])


Measured memory_bytes: 69532
#include <bits/stdc++.h>  // This will work only for g++ compiler.

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define sz(a) int((a).size())


using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

void fast()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
void solve()
{
    ll x;
    cin >> x;
    ll res = (x==0)?1:0;
    cout << res << endl ;
}
int main()
{
  fast();
  solve();

return 0;
}


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

int main(void){
  int A, B, C;
  cin >> A >> B >> C;
  int tmp = A * C;
  if(A <= B){
    if(B < tmp){
      tmp = B / A;
    }else{
      tmp = C;
    }
  }else{
    tmp = 0;
  }
  cout << tmp <<"\n";
  return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include <cstdio>

#include <algorithm>
#define ll long long
#define mx 9*1000000000LL*1000000000

using namespace std;
    int n; string s;
int main(){
    cin>>n>>s;	string res = string(n+1, 'S');
    for(int i=0; i<=1; i++){
	if(i)res[0]='W'; else res[0] = 'S';
	for(int j=0; j<=1; j++){
	    if(j)res[1]='W'; else res[1]='S';
	    for(int k=2; k<=n; k++){
		if(s[k-1]=='o' && res[k-1]=='S' || s[k-1]=='x' && res[k-1]=='W'){
		    res[k] = res[k-2];
		}else{
		    if(res[k-2]=='W')res[k]='S'; else res[k]='W';
		}
	    }
	    if(res[n]==res[0] ){
		if(s[0]=='o'){
		    if(res[0]=='S' && res[n-1]!=res[1])continue;
		    if(res[0]=='W' && res[n-1]==res[1])continue;
	    
		}else{
		    if(res[0]=='S' && res[n-1]==res[1])continue;
		    if(res[0]=='W' && res[n-1]!=res[1])continue;
		}
		cout<<res.substr(0,n); exit(0);
	    }
	}
    }
    cout<<"-1\n";
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;


/*
辺を切り離した時の頂点の総和を高速に計算できないといけない
*/

struct D{
	ll a,b,c,id;
};
bool operator<(const D &lhs, const D &rhs){//全順序を定めないと，{1,0,0}=={1,1,0}
	if(lhs.c < rhs.c){
		return true;
	}else if(lhs.c == rhs.c){
		if(lhs.id < rhs.id){
			return true;
		}
	}
	return false;
}

ll n,m,ans=0,use[100010]={},y[100010];
vector<ll> x(100010),v[100010],id[100010];
vector<D> cand;
D edge[100010];

struct UnionFind{
	int n;
	vector<ll> sum,r,p;
	UnionFind(){}
	UnionFind(int sz):n(sz),r(sz,1),p(sz,0){iota(p.begin(),p.end(),0);sum=x;}
	int find(int x){
		return (x==p[x]?x:p[x]=find(p[x]));
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	void unite(int x,int y){
		x=find(x);y=find(y);
		if(x==y) return;
		if(r[x]<r[y]) swap(x,y);
		r[x]+=r[y];
		sum[x]+=sum[y];
		p[y]=x;
	}
	ll energy(int x){
		return sum[find(x)];
	}
};

int main(void){
	cin>>n>>m;
	reg(i,1,n)cin>>x[i];
	reg(i,1,m){
		ll a,b,c;
		cin>>a>>b>>c;
		edge[i]={a,b,c,i};
		v[a].push_back(b);
		v[b].push_back(a);
		id[a].push_back(i);
		id[b].push_back(i);
		y[i]=c;
	}
	//
	sort(edge+1,edge+1+m);
	UnionFind f(n+1);
	//
	reg(i,1,m){
		f.unite(edge[i].a,edge[i].b);
		ll sum = f.energy(edge[i].a);
		if(sum>=edge[i].c)cand.push_back(edge[i]);
		// cout<<sum<<endl;
		// printf("%lld,%lld,%lld\n",edge[i].a,edge[i].b,edge[i].c);
	}
	irep(i,cand.size()){
		if(use[cand[i].id]==0){
			//y[cand[i]]以下の辿れる辺全部使う
			queue<ll> Q;
			Q.push(cand[i].a);
			Q.push(cand[i].b);
			use[cand[i].id]=1;
			while(!Q.empty()){
				ll p = Q.front();Q.pop();
				rep(j,v[p].size()){
					if(use[id[p][j]]==0 && y[id[p][j]]<=y[cand[i].id]){
						use[id[p][j]]=1;
						Q.push(v[p][j]);
					}
				}
			}
		}
	}
	reg(i,1,m)if(use[i]==0)ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 25076
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
typedef complex<double> Point;
#define X real()
#define Y imag()
const double EPS = 1e-9;
#define EQ(n,m) (abs((n)-(m)) < EPS)

double dot(Point a, Point b) {
	return a.X*b.X + a.Y*b.Y;
}

double cross(Point a, Point b) {
	return a.X*b.Y - a.Y*b.X;
}

int crossform(Point p0,Point p1,Point p2,Point p3){
	if(EQ(cross(p0-p1,p2-p3),0))return 2; //Parallel
	if(EQ(dot(p0-p1,p2-p3),0))return 1; //Orthogonal
	return 0;
}

int main(void){
	int q;
	cin>>q;
	rep(i,q){
		double x0,y0,x1,y1,x2,y2,x3,y3;
		cin>>x0>>y0>>x1>>y1>>x2>>y2>>x3>>y3;
		cout<<crossform({x0,y0},{x1,y1},{x2,y2},{x3,y3})<<endl;
	}
	return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
 
#define mo 1000000007
#define inf 1e18
#define rep(i, s, n) for (ll i = s; i < n; i = i + 1)
#define rrep(i,s,n) for(ll i=s;i>=n;i--)

ll mod(ll n) { return (n % (ll)mo + (ll)mo)%(ll)mo;}


int main(){

	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll m1 = max(a*c,a*d);
	ll m2 = max(b*c,b*d);
	ll m = max(m1,m2);
	cout<<m;
	

	
	
}

Measured memory_bytes: 3512
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static int K,N;
	static int mod =1000000007;
	public static void main(String[] args) {
		String S=sc.next();
		int v[]=new int[200];
		boolean x=true;
		for(int i=0;i<S.length();i++){
			if(v[S.charAt(i)]!=0) {
				x=false;
				break;
			}else {
				v[S.charAt(i)]=1;
			}
		}
		if(x)p("yes");
		else p("no");
		
		}

	
	//static ArrayList<Integer> cc = new ArrayList<>(10001);
	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define DEBUG 0 
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

ll counter(ll num){
    return (num*(num-1))/2;
}
int main(){
    ll n;
    cin>>n;
    ll a[200000]={};
    ll b[200000]={};
    rep(i,n){
        cin>>a[i];
        a[i]--;
        b[a[i]]++;
    }
    ll sum=0;
    rep(i,n){
        sum+=counter(b[i]);
    }
    ll ans=0;
    rep(i,n){
        ans=sum-counter(b[a[i]])+counter(b[a[i]]-1);
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 5760
#include <iostream>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  if(111-n >= 0)
    cout << 111 << endl;
  else if(222-n >=0)
    cout << 222 << endl;
  else if(333-n >=0)
    cout << 333 << endl;
  else if(444-n >=0)
    cout << 444 << endl;
  else if(555-n >=0)
    cout << 555 << endl;
  else if(666-n >=0)
    cout << 666 << endl;
  else if(777-n >=0)
    cout << 777 << endl;
  else if(888-n >=0)
    cout << 888 << endl;
  else
    cout << 999 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
//C에서 함수 처음 만들어 써봄.. 재밌당 ㅋㅋㅋㅋㅋ

int main(void)
{
    int c=1;
int check3(int i)
{
    if (i%3 == 0)
    {
        printf(" %d",c);
        return 0;
    }
    else{return 1;}
}
void include3(int i)
{
    if (i%10 == 3)
    {
        printf(" %d",c); /* printf 할때 그 함수 안에서 c를 사용 가능하게 하기 위해서
                            main함수 안에 모든 함수를 넣고 제일 처음 c 를 선언해놓음. */
        return;
    }
    i = i/10;
    if (i)
    {
        include3(i);
    }
}
int n;
    scanf("%d",&n);
    for (;c<=n;c++)
    {
        int i = c;
        if (check3(i))
        {
            include3(i);
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2080