akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BAnOddProblem solver = new BAnOddProblem();
        solver.solve(1, in, out);
        out.close();
    }

    static class BAnOddProblem {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.readIntArray(n);

            int answer = 0;
            for (int i = 0; i < n; i++) {
                if (i % 2 == 0 && a[i] % 2 == 1)
                    answer++;
            }
            out.println(answer);
        }

    }

    static class InputReader {
        public final BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] readIntArray(int n) {
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = nextInt();
            }
            return x;
        }

    }
}



Measured memory_bytes: 25616
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int first = sc.nextInt();
    int ans = 1;
    
    for(int i=0;i<N-1;i++){
      int a = sc.nextInt();
      if(a >= first){
        ans++;
        first = a;
      }
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 22740
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cctype>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;
const int maxn = 1e6+7;

int main(){
	int n;
	cin>>n;
	if(n==1){
		cout<<"1"<<endl;
	}
	else if(n>=2&&n<4){
		cout<<"2"<<endl;
	}
	else if(n>=4&&n<8){
		cout<<"4"<<endl;
	}
	else if(n>=8&&n<16){
		cout<<"8"<<endl;
	}
	else if(n>=16&&n<32){
		cout<<"16"<<endl;
	}
	else if(n>=32&&n<64){
		cout<<"32"<<endl;
	}
	else if(n>=64&&n<=100){
		cout<<"64"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#素数を判定するプログラム
import math

n = int(input())
count = 0

for loop in range(n):
    a = int(input())
    flag = True
    if a == 1:
        flag = False
    elif a == 2:
        flag = True
    else:
        if a % 2 == 0:
            flag = False
        for j in range(3, int(math.sqrt(a))+1, 2):
            if a % j == 0:
                flag = False
    if flag:
        count += 1

print(count)



Measured memory_bytes: 5668
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char a[101000];
    long long k,m,n;
    cin>>a;
    n=strlen(a);
    for(int i=0;i<n;i++)
    {
        if(a[i]=='e')
        {
            if(a[i+1]=='r'&&a[i+2]=='a'&&a[i+3]=='s'&&a[i+4]=='e')
            {
                if(a[i+5]=='r')
                {
                    i+=5;
                }
                else
                {
                    i+=4;
                }
            }
        }
        else if(a[i]=='d')
        {
            if(a[i+1]=='r'&&a[i+2]=='e'&&a[i+3]=='a'&&a[i+4]=='m')
            {
                if(a[i+5]=='e'&&a[i+6]=='r'&&a[i+7]=='a'&&a[i+8]=='s'&&a[i+9]=='e')
                {
                    i+=4;
                }
                else
				{
				    if(a[i+5]=='e'&&a[i+6]=='r')
				    {
                        i+=6;
                    }
                    else
                    {
                        i+=4;
                    }
                }
            }
        }
        else
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <tuple>
#include <vector>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
using ll	= long long;
using ull	= unsigned long long;
using ld	= long double;
using pii	= pair<int,int>;
using pll	= pair<ll,ll>;
using vi	= vector<int>;
using vb	= vector<bool>;
using vc	= vector<char>;
using vvi	= vector<vi>;
using vvb	= vector<vb>;
using vpii	= vector<pii>;
using vpll	= vector<pll>;
using vll	= vector<ll>;
using vull	= vector<ull>;
using vvll	= vector<vll>;
#define ever (;;)
#define f first
#define s second
#define pb emplace_back
#define sz size()
#define graph vector<vertex>
#define deg(X) (int)G[X].e.size()
#define INF 1234567890
#define INFll 2000000000000000000
#define maxe(X, Y) if((Y) > (X)) (X) = (Y)
#define mine(X, Y) if((Y) < (X)) (X) = (Y)
#define rep(i, begin, end) for(__typeof(end) i = (begin); i < (end); ++i)
#define repr(i, begin, end) for(__typeof(end) i = (begin)-1; i >= (end); --i)
#define bend(X) X.begin(), X.end()
pii operator+(const pii& A, const pii& B) { return {A.f+B.f, A.s+B.s}; }
pii operator-(const pii& A, const pii& B) { return {A.f-B.f, A.s-B.s}; }
pii operator-(const pii& A) { return {-A.f, -A.s}; }

//
// END OF DEFINES
//

struct vertex {
	vi e;
	ll B = 1;
	ll W = 1;
};

constexpr ll mod = 1e9+7;
int n;
graph G;

bool in() {
	scanf("%d", &n);
	G.resize(n);
	rep(i, 1, n) {
		int a, b;
		scanf("%d %d", &a, &b);
		--a; --b;
		G[a].e.pb(b);
		G[b].e.pb(a);
	}
	
	return true;
}

ll dfs(int v, int p) {
	for(int u : G[v].e)
		if(u != p) {
			dfs(u, v);
			G[v].W = (G[v].W * (G[u].W+G[u].B))%mod;
			G[v].B = (G[v].B * G[u].W)%mod;
		}
}

ll solve() {
	
	dfs(0, 0);
	
	return (G[0].B + G[0].W)%mod;
	
	return -INF;
}

int main() {
	int noOfTests = 1;
	//scanf("%d", &noOfTests);
	
	while(noOfTests --> 0) {
		if(!in()) {
			printf("popsute wejscie\n");
			continue;
		}
		ll result = solve();
		if(result == ll(-'t'))
			printf("TAK\n");
		else if(result == ll(-'n'))
			printf("NIE\n");
		else if(result != -INF)
			printf("%lld\n", result);
	}
	
	return 0;
}


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

using namespace std;
typedef unsigned long long ull;

int n, t;
int A[MAX], B[MAX];
int dp1[MAX][MAX];//dp1[i1[j]:1~i番目まででj分以内で完食できる最大値
int dp2[MAX][MAX];//dp2[i][j]:i~n番目まででj分以内で完食できる最大値

int main(){
  cin >> n >> t;
  rep(i, n){
    cin >> A[i+1] >> B[i+1];
  }
  memset(dp1,0, sizeof(dp1));
  memset(dp2,0, sizeof(dp2));
  for(int i=1; i<=n-1; i++){
    for(int j=1; j<=t-1; j++){
      if(j-A[i]<0){
        dp1[i][j]=dp1[i-1][j];
        continue;
      }
      dp1[i][j]=max(dp1[i-1][j-A[i]]+B[i],dp1[i-1][j]);
    }
  }
  for(int i=n; i>=2; i--){
    for(int j=1; j<=t-1; j++){
      if(j-A[i]<0){
        dp2[i][j]=dp2[i+1][j];
        continue;
      }
      dp2[i][j]=max(dp2[i+1][j-A[i]]+B[i],dp2[i+1][j]);
    }
  }

  int ans=0;
  for (int i=1; i<=n; i++){
    for(int j=0; j<=t-1; j++){
      ans=max(ans, dp1[i-1][j]+dp2[i+1][t-1-j]+B[i]);
    }
  }
  cout << ans << endl;

  /*
  rep(i,n+1){
    rep(j,t){
      cout << dp1[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
  rep(i,n+1){
    rep(j,t){
      cout << dp2[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
  */
  return 0;
}


Measured memory_bytes: 70784
a=input()
b=input()
dp=[[0 for j in range(len(b)+1)] for i in range(len(a)+1)]
for i in range(len(a)):
    for j in range(len(b)):
        if a[i]==b[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])
s1=a
s2=b

# print(dp[len(s1)][len(s2)])
x=len(a)
y=len(b)
res=''
# print(dp[len(a)][len(b)])
while x>0 and y>0:
    if a[x-1]==b[y-1]:
        res+=a[x-1]
        x-=1
        y-=1
    elif dp[x][y]==dp[x-1][y]:
        x-=1
    elif dp[x][y]==dp[x][y-1]:
        y-=1
print(res[::-1])
        
    


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

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vint ans(n,-1);
    REP(i,m){
        int s,c;
        cin >> s >> c;
        if(ans[s-1]==-1||ans[s-1]==c){
            ans[s-1]=c;
        }else{
            cout << -1 << endl;
            return 0;
        }
    }
    if(n==1){
        if(ans[0]==-1){
            cout << 0 << endl;
        }else{
            cout << ans[0] << endl;
        }
    }else{
        if(ans[0]==0){
            cout << -1 << endl;
            return 0;
        }else if(ans[0]==-1){
            cout << 1;
        }else{
            cout << ans[0];
        }
        REP(i,n-1){
            if(ans[i+1]==-1){
                cout << 0;
            }else{
                cout << ans[i+1];
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import Data.Bool
import Data.Maybe

main :: IO ()
main = do
  [a,b] <- readInts
  print . showAnswer $ solve (a,b)

type Input  = (Int, Int)
type Output = Int

solve :: Input -> Output
solve (a,b) = if a <= b then a else a-1

showAnswer :: Output -> Answer
showAnswer = Number

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

data Answer
  = YesNo Bool
  | YESNO Bool
  | AB Bool
  | Number Int
  | String String
  | Compare Ordering
  | Compare2 Ordering

instance Show Answer where
  show (YesNo b)    = bool "No" "Yes" b
  show (YESNO b)    = bool "NO" "YES" b
  show (AB b)       = bool "B"  "A" b
  show (Number i)   = show i
  show (String s)   = s
  show (Compare o)  = ordering "<" "=" ">" o
  show (Compare2 o) = ordering "Right" "Balanced" "Left" o

ordering :: a -> a -> a -> Ordering -> a
ordering lt eq gt o = case o of
  LT -> lt
  EQ -> eq
  GT -> gt

Measured memory_bytes: 380
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    ll a,b,c=0,d=0,k=0,n,h,w,m,ans=0;
    string s,s2;
    cin >> s;
    bool f=true;

    rep(i,s.size()){
        if(i%2==0){
            if((s[i]=='R'||s[i]=='U'||s[i]=='D')){
            }
            else {
                f = false;
            }
            
        } 
        else {
            if(s[i]=='L'||s[i]=='U'||s[i]=='D'){
            }
            else {
                f =false;
            }
        }
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int A=stdIn.nextInt();
		long B=stdIn.nextLong();
		long N=stdIn.nextLong();
		long max=0;
		int cout=0;
		if(B>N){
			System.out.println(A*N/B);
			System.exit(0);
		}
		for(long i=B-1;i<=N&&cout<100000;i+=B){
			long x=(A*i/B)-(A*(i/B));
			if(x>max)
				max=x;
			else
				cout++;
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 35924
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    ll h[n] = {};
    bool good[n] = {};
    vector<int> edges[n];
    for(int i=0;i<n;++i)
    {
        cin >> h[i];
        good[i] = true;
    }

    for(int i=0;i<m;++i)
    {
        int u, v;
        cin >> u >> v;
        u--; v--;
        if(h[u] == h[v])
        {
            good[u] = false;
            good[v] = false;
        }else if(h[u] > h[v])
        {
            good[v] = false;
        }else{
            good[u] = false;
        }
    }

    int ret = 0;
    for(int i=0;i<n;++i)
    {
        if(good[i]) ret++;
    }
    cout << ret << endl;

}

Measured memory_bytes: 6840
def main():
    N = int(input())
    A = [0] + list(map(int, input().split()))
    B = [0] * (N + 1)
    ans = []
    for i in range(N,0,-1):
        B[i] = A[i]
        j = 2
        while i * j < (N + 1):
            B[i] ^= B[i * j]
            j += 1
        
        if B[i] % 2 == 1:
            ans.append(i)

    print(len(ans))
    print(*ans)
        





if __name__ == "__main__":
    main()

Measured memory_bytes: 73052
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout <<" "<<kbrni;cout<<endl

using namespace std;

typedef pair<int,int>P;

template<class V> class segtree {
private:
	int n;
	vector<V> node;

public:
	void update(int k,int a)
	{
		//????????????
		k += n-1;
		node[k] = a;
		//?????????????????´??°
		while(k>0){
			k = (k-1)/2;
			node[k] = min(node[2*k+1],node[2*k+2]);
		}
	}
	V query(int a,int b,int k=0,int l=0,int r=-1)
	{
		if(r < 0) r = n;
		if(r <= a || b <= l){
			return INT_MAX;
		}
		if(a <= l && r <= b){
			return node[k];
		}else{
			V vl = query(a,b,2*k+1,l,(l+r)/2);
			V vr = query(a,b,2*k+2,(l+r)/2,r);
			return min(vl,vr);
		}
	}
	segtree(int sz,int val)
	{
		n = 1;
		while(n < sz){
			n *= 2;
		}
		node.resize(2*n-1);
		rep(i,2*n-1){
			node[i] = val;
		}
	}
	segtree(vector<V> v)
	{
		int sz = (int)v.size();
		n = 1;
		while(n < sz){
			n *= 2;
		}
		node.resize(2*n-1);
		rep(i,n){
			update(i,v[i]);
		}
	}
};

int main()
{
	int n,q;
	cin >> n >> q;
	segtree<int> sg(n,INT_MAX);
	rep(i,q){
		int x,y,z;
		cin >> x >> y >> z;
		if(x){
			cout << sg.query(y,z+1) << "\n";
		}else{
			sg.update(y,z);
		}
	}
	return 0;
}

Measured memory_bytes: 3880
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <string>
#define endl '\n'
#define ll long long

using namespace std;


int main(void)
{
	cin.tie(NULL); ios_base::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	if (a + b >= 10)
		cout << "error";
	else
		cout << a + b;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int k,ans,n,a[1000005];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>k>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	int r=a[n]-a[1];
	int l=k-(a[2]-a[1]);
	ans=min(r,l);
	int res;
	for(int i=2;i<n;i++){
		r=k-(a[i]-a[i-1]);
		l=k-(a[i+1]-a[i]);
		res=min(l,r);
		ans=min(res,ans);
	}
	r=k-(a[n]-a[n-1]);
	l=a[n]-a[1];
	res=min(l,r);
	ans=min(ans,res);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		long K = sc.nextLong();
		long X = sc.nextLong();

		sc.close();

		if (K * 500 >= X) {
			out.println("Yes");
		} else {
			out.println("No");
		}

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e5 + 5;

int n;
int a[N];

int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 0; i <= n; i++)
		cin >> a[i];
	if(n == 0)
	{
		if(a[0] == 1)
			cout << 1;
		else
			cout << -1;
		return 0;
	}
	if(a[0] != 0)
	{
		cout << -1;
		return 0;
	}
	for(int i = 1; i <= 30; i++)
	{
		if(a[i] > (1LL << i))
		{
			cout << -1;
			return 0;
		}
	}
	vector<int> v;
	int ans = 1, cnt = 0;
	for(int i = 1; i <= n; i++)
		cnt += a[i];
	int cur = 2;
	for(int i = 1; i <= n; i++)
	{
		if(cur < a[i])
		{
			cout << -1;
			return 0;
		}
		ans += min(cur, cnt);
		cnt -= a[i];
		cur -= a[i];
		cur *= 2;
		cur = min(cur, (int)1e15);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 4368
H, W = map(int, input().split())
L = []
for i in range(H):
    S = list(input())
    L.append(S)

for i in range(H):
    for j in range(len(L[i])):
        if L[i][j] == '.':
            cnt = 0
            for k in range(-1, 2):
                for l in range(-1, 2):
                    if ((i+k) < H) and ((j+l) < len(L[i])) and ((j+l) >= 0) and ((i+k) >= 0):
                        if L[i+k][j+l] == '#':
                            cnt += 1
            L[i][j] = str(cnt)

for i in range(len(L)):
    print(''.join(L[i]))

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

 

int main()
{
   int a, b;     
   cin >> a >> b;
   
   if (a == b)
      cout << "a == b" << endl;
   else if(a > b)
      cout << "a > b" << endl;
   else
      cout << "a < b" << endl;
   
   return 0;
}


Measured memory_bytes: 3080
#include <iostream>

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main()
{
  int cnt = 0;
  string S;
  cin >> S;
  int len = S.length();

  for(int i = 1; i < len; i++) {
    if(S[i] != S[i - 1]) {
      cnt++;
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 512
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323846
inline void rd(double &x){
  scanf("%lf",&x);
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned x){
  int s=0;
  char f[10];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned long long x){
  int s=0;
  char f[21];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(double x){
  printf("%.15f",x);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
inline void wt_L(string &x){
  int i=0;
  for(i=0;x[i]!='\0';i++){
    putchar_unlocked(x[i]);
  }
}
double A;
double B;
double X;
int main(){
  rd(A);
  rd(B);
  rd(X);
  X /= A;
  if(X >= A*B/2){
    wt_L((atan2(A*B-X,A*A/2)) * 180 / PI);
    wt_L('\n');
  }
  else{
    wt_L((PI/2-atan2(X,B*B/2)) * 180 / PI);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20191027-1

// --- original code ---
// double A, B, X;
// {
//   rd(A,B,X);
//   X /= A;
//   wt( (if[X >= A*B/2, atan2(A*B-X,A*A/2), PI/2-atan2(X,B*B/2)]) * 180 / PI );
// }


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

int main() {
	int i;
    l1 L[100];
	L[0] = 2;
	L[1] = 1;
	int N;
	cin >> N;
	if (N == 0) {
		cout << L[0] << endl;
	}
	else if (N == 1) {
		cout << L[1] << endl;
	}
	else {
		for (i = 2;i <= N;i++) {
			L[i] = L[i - 1] + L[i - 2];
		}
		cout << L[N] << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#define il inline
#define N 2001
using namespace std;

int n,ans=1e9;
int to[N+N],nx[N+N],head[N],sze;
int s[N],f[N],dis[N],Tsze[N];

il void add(int u,int v)
{
	to[++sze]=v,nx[sze]=head[u],head[u]=sze;
	to[++sze]=u,nx[sze]=head[v],head[v]=sze;
}

il void dfs(int u,int fa)
{
	int i,v,mx=0;
	for (Tsze[u]=s[u],i=head[u]; i; i=nx[i])
	{
		if ((v=to[i])==fa) continue;
		dfs(v,u),Tsze[u]+=Tsze[v],dis[u]+=dis[v]+=Tsze[v];
		if (dis[mx]<=dis[v]) mx=v;
	}
	if (!mx) return;
	if (dis[u]>=2*dis[mx]) f[u]=dis[u]/2;
    else f[u]=dis[u]-dis[mx]+min(f[mx],(2*dis[mx]-dis[u])/2);
}

int main()
{
	scanf("%d\n",&n);
	int i,j,u,v;
	for (i=1; i<=n; i++) s[i]=getchar()^48;
	for (i=1; i<n; i++) scanf("%d%d",&u,&v),add(u,v);
	
	for (i=1; i<=n; i++)
	{
		for (j=1; j<=n; j++) dis[j]=Tsze[j]=f[j]=0;
		dfs(i,0);
		if (dis[i]&1^1) if (2*f[i]>=dis[i]) ans=min(ans,dis[i]/2);
	}
	if (ans==1e9) puts("-1");
	else printf("%d",ans);
	
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readInteger()
    val dp = Array(n + 1) { Array(3) { 0 } }
    for (i in 0 until n) {
        val (a, b, c) = readIntegerList()
        dp[i + 1][0] = Math.max(dp[i][1], dp[i][2]) + a
        dp[i + 1][1] = Math.max(dp[i][0], dp[i][2]) + b
        dp[i + 1][2] = Math.max(dp[i][0], dp[i][1]) + c
    }
    println(dp[n].max())
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


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

int main() {
    int n; cin >> n;
    int a[n], b[n], c[n-1];
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }
    rep(i, n) cin >> b[i];
    rep(i, n-1) cin >> c[i];
    int ans = 0;
    rep(i, n) {
        int tmp = b[a[i]];
        if (i > 0 && a[i-1]+1 == a[i]) tmp += c[a[i-1]];
        ans += tmp;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
K = int(input())
ans = 0
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            ans += gcd(gcd(a, b), c)
print(ans)

Measured memory_bytes: 77040
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

constexpr uint64_t THRESHOLD = 1000000000000000000;

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

  vector<uint64_t> values(N, 0);
  
  for (size_t i = 0; i < N; ++i) {
    cin >> values[i];
    if (values[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  uint64_t prod = 1;
  for (size_t i = 0; i < N; ++i) {
    double capacity = THRESHOLD / prod;
    if (capacity < values[i]) {
      cout << "-1" << endl;
      return 0;
    }
    prod *= values[i];
  }
  
  cout << prod << endl;

  return 0;
}


Measured memory_bytes: 4052
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
 
		int A = sc.nextInt();
		int B = sc.nextInt();
		int H = sc.nextInt();
		int M = sc.nextInt();
		
		int pass_time = H*60 + M;
      	
		double a = ((double)360/60/12 * (double)pass_time) % 360;
		double b = (360/60 * pass_time) % 360;
 
		double ans = Math.sqrt(A*A + B*B -2*A*B*Math.cos(Math.toRadians(Math.abs(a-b))));
 
		System.out.println(ans);
    }
}


Measured memory_bytes: 36120
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(void) {
    int h,w;
    cin >> h >> w;
    vector< vector<int> > v (h, vector<int>(w) );
    REP(i,h){
        REP(j,w){
            v[i][j]=0;
        }
    }
    REP(i,h){
        string s;
        cin >> s;
        REP(j,w){
            if (s[j]=='#') {
                if (i!=0) {
                    v[i-1][j]++;
                    if (j!=0) {
                        v[i-1][j-1]++;
                    }
                    if (j!=w-1) {
                        v[i-1][j+1]++;
                    }
                }
                if (j!=0) {
                    v[i][j-1]++;
                }
                if (j!=w-1) {
                    v[i][j+1]++;
                }
                if (i!=h-1) {
                    v[i+1][j]++;
                    if (j!=0) {
                        v[i+1][j-1]++;
                    }
                    if (j!=w-1) {
                        v[i+1][j+1]++;
                    }
                }
                v[i][j] += 9;
            }
        }
    }
    REP(i,h){
        string s = "";
        REP(j,w){
            if (v[i][j] >= 9) {
                s += "#";
            } else {
                s += to_string(v[i][j]);
            }
        }
        cout << s << endl;
    }
    return 0;
}


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

int main(){
  int K,X;cin>>K>>X;
  int cnt=X-K+1;
  
  while(cnt<X+K){
    cout<<cnt<<" ";
    cnt++;
  }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define INF 1e7
#define dsec 86400

using namespace std;
typedef long long int ll;
typedef tuple<int,int,int> tii;
typedef tuple<long long int,long long int,long long int> tll;
typedef tuple<double,double,double> tdd;



int main()
{
   ll N; cin >> N;
   cout << N*(N-1)/2 << endl;
}

Measured memory_bytes: 3608
import sys
input = sys.stdin.buffer.readline

class UnionFind:
    __slots__ = ["data"]
    
    def __init__(self, n=0):
        self.data = [-1]*(n+1)
    
    def root(self, x):
        if self.data[x] < 0:
            return x
        self.data[x] = self.root(self.data[x])
        return self.data[x]
    
    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x != y:
            if self.data[x] < self.data[y]:
                self.data[x] += self.data[y]
                self.data[y] = x
            else:
                self.data[y] += self.data[x]
                self.data[x] = y
    
    def same(self, x, y):
        return self.root(x) == self.root(y)
    
    def size(self, x):
        return -self.data[self.root(x)]


def main():
    n, m = map(int, input().split())
    p = list(map(int, input().split()))
    uf = UnionFind(n)
    for _ in range(m):
        x, y = map(int, input().split())
        uf.unite(x, y)
    cnt = 0
    for i in range(1, n+1):
        if uf.same(i, p[i-1]):
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

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

using namespace std;

signed main() {
  int N;
  cin >> N;
  vector<int> h(N);
  for(auto& i : h) cin >> i;

  vector<int> dp(N);
  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);
  for(int i=2;i<N;i++) dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
  cout << dp[N-1] << endl;
}


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

public class Main
{

	static OutputStream outputStream = System.out;
	static PrintWriter out = new PrintWriter(outputStream);

	
	
	public static void main(String[] Rohan)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		String[] s1=br.readLine().split(" ");

		int q=Integer.parseInt(s1[1]);


		String s=br.readLine();

		int n=Integer.parseInt(s1[0]);

		int[] a=new int[n];


		for(int i=1;i<n;i++)
		{
			if(s.charAt(i)=='C' && s.charAt(i-1)=='A')
				a[i]++;
		}
		for(int i=1;i<n;i++) a[i]+=a[i-1];

		for(int i=0;i<q;i++)
		{
			s1=br.readLine().split(" ");
			int l=Integer.parseInt(s1[0]),r=Integer.parseInt(s1[1])-1;

			if(l>r) out.println(0);

			else
			{
				out.println(a[r]-a[l-1]);
			}
		}

		
		out.close();
		

	}
}

Measured memory_bytes: 51056
#include <stdio.h>

static int *A;

int merge(int *A, int left, int mid, int right) {
  static int count = 0;
  int n1 = mid - left;
  int n2 = right - mid;
  int L[n1 + 1], R[n2 + 1];
  for (int i = 0; i < n1; i++)
	L[i] = A[left + i];
  for (int i = 0; i < n2; i++)
    R[i] = A[mid + i];

  L[n1] = 999999999;
  R[n2] = 999999999;
  int i = 0, j = 0;
  for (int k = left; k < right; k++) {
    if (L[i] <= R[j]) {
	  A[k] = L[i];
	  i++;
	} else {
	  A[k] = R[j];
	  j++;
	}
	count++;
  }
  return count;
}
	
int merge_sort(int *A, int left, int right){
  int count;
  if (left + 1 < right) {
	int mid = (left + right)/2;
	merge_sort(A, left, mid);
	merge_sort(A, mid, right);
	count = merge(A, left, mid, right);
  }
  return count;
}

void print(int *A, int n) {
  for (int i = 0; i < n; i++) {
	printf((i != n - 1 ? "%d " : "%d\n"), *(A + i));
  }
}

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

  int count = merge_sort(A, 0, n);

  print(A, n);
  printf("%d\n", count);

  return 0;
}



Measured memory_bytes: 5640
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int maxNum = sc.nextInt();
    int over = sc.nextInt();
    int under = sc.nextInt();

    int ans = 0;

    for(int num=1; num<=maxNum ; num++){
        String numStr = String.valueOf(num);
        if(numStr.length() == 1){
            int incNum = Integer.parseInt(numStr);
            if(incNum >= over && incNum <= under){
                ans += num;
            } 
        }else {
            int plusNum = 0;
            for(char charNum : numStr.toCharArray()){
                plusNum += Integer.parseInt(String.valueOf(charNum));
            }
            if(plusNum >= over && plusNum <= under){
                ans += num;
            }
        }
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class AStillTBD {
public:
	void solve(istream& in, ostream& out) {
        string s; in >> s;
        if(s[5] > '0' || s[6] > '4'){
            out << "TBD" << endl;
        }else{
            out << "Heisei" << endl;
        }

	}
};

int main() {
	AStillTBD solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
// #include <numeric>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector<vector<ll>> vvint;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())


typedef struct{
  ll pos;
  ll depth;
} data;
//
// struct Node{
//
// }



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

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// int binary_search(int key){
//  //isOKを満たす要素のうち最小のインデックスを返す。（要ソート）
//   int left = -1;
//   int right = N;
//
//   while(right - left > 1){
//     int mid = left + (right - left)/2;
//
//     if(isOK(mid, key)) right=mid;
//     else left=mid;
//   }
//
//   return right;
// }

// ll gcd(ll m, ll n){
//   if(m<n) swap(m,n);
//   if(n==0) return m;
//   return gcd(n, m%n);
// }



int main() {



  ll N,K;
  cin>>N>>K;

  cout << N-K+1 << endl;


}

















//


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n,A[100],j,v;
  cin>>n;
  for(int i = 0; i<n ; i++){
      cin>>A[i];
  }
  for(int i = 0; i<n; i++){
      v = A[i];
      j = i-1;
      while(j>=0&&A[j]>v){
          A[j+1]=A[j];
          j--;
      }
          A[j+1]=v;
      for(int k = 0; k<n-1; k++){
          cout << A[k] << " ";
      }
      cout << A[n-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 3088
#include <stdio.h>
// 0<=x<=1e9
int somadigitos(const char *s){
	int soma = 0, i = 0;
	while(s[i] != '\0')
		soma += s[i++]-'0';//ascii to int
	return soma;
}
int main(){
	int x;
	char xs[12];
	scanf("%d", &x);
	sprintf(xs, "%d", x);
	if(x %somadigitos(xs) == 0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}


Measured memory_bytes: 128
function Main(input) {
  lines = input.split('\n')
  a = lines[0] * 1
  s = lines[1]
  if (a >= 3200) {
      console.log(s)
  } else {
      console.log('red')
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 21064
#include<iostream>
using namespace std;
int main() {

    int i,j;
    int n,m;
    int round;
    int point_a, point_b;
    int a,b;
    
    while(1) {
        point_a = 0;
        point_b = 0;
        cin >> round;
        if(round == 0) break;
        for(i=0; i<round; i++) {
            cin >> a >> b;
            if( a > b ) {
                point_a += a + b;
            } else if(a < b) {
                point_b += a + b;
            } else {
                point_a += a;
                point_b += b;                
            }
        }
        cout << point_a << " " << point_b << endl;
    }
    

}

Measured memory_bytes: 1164
N = gets.to_i
As, Bs, Cs = readlines.map{|l| l.split.map(&:to_i).sort}
INF = 1E10.to_i

As << INF; Cs << INF
puts Bs.inject(0){|s, b| s + As.bsearch_index{|a| a >= b} * (N - Cs.bsearch_index{|c| c > b})}

Measured memory_bytes: 25568
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.max
import kotlin.math.min

fun main(args: Array<String>) {

    // IO Templates
    val br = BufferedReader(InputStreamReader(System.`in`))
    val out = PrintWriter(System.out)

    val (n, k) = br.readLine()!!.split(' ').map { it.toInt() }

    val maxVal = 300010
    val sgt = SegmentTree(maxVal)

    for (i in 0 until n){
        val ai = br.readLine()!!.toInt()
        sgt.update(ai, sgt.query(ai - k, ai + k + 1) + 1)
    }

    out.println(sgt.query(0, maxVal))

    out.flush()
}

/**
 * セグメント木
 *
 * @property n_ セグ木のオリジナルのサイズ
 * @property n セグ気の葉の数
 * @property tree セグ木本体
 */
class SegmentTree(
    val n_: Int
) {

    // companionにしても良いが、提出環境でバグる可能性があるのでこのまま
    private val INF: Long = 1_000_000_000_000_000_000L
    private val MOD: Long = 998_244_353L

    var n = 1
    var tree = longArrayOf()

    init {
        n = 1
        while (n < n_) {
            n *= 2
        }

        tree = LongArray(2 * n - 1) { 0L }
    }

    /**
     * 値の更新
     *
     * @param index 更新するインデックス
     * @param x 更新する値
     */
    fun update(index: Int, x: Long) {
        var cnt = index + n - 1
        tree[cnt] = x
        while (cnt > 0){
            cnt = (cnt - 1) / 2
            tree[cnt] = max(tree[cnt * 2 + 1], tree[cnt * 2 + 2])
        }
    }

    /**
     * [begin, end)で評価値の取得
     *
     * @param begin 区間初め（閉区間）
     * @param end 区間終わり（開区間）
     * @return 区間の評価値
     */
    fun query(begin: Int, end: Int) = query_sub(begin, end, 0, 0, n)

    /**
     * 評価値取得用のサブクエリ
     *
     * @param begin 元の区間の初め（閉区間）
     * @param end 元の区間の終わり（開区間）
     * @param index 今見ているノードの位置
     * @param left tree[index]が表す区間の左端（閉区間）
     * @param right tree[index]が表す区間の右端（開区間）
     * @return 区間の評価値
     */
    fun query_sub(begin: Int, end: Int, index: Int, left: Int, right: Int): Long {
        return if (right <= begin || end <= left) { // 範囲外なら考えない
            0L
        } else if (begin <= left && right <= end) { // 範囲内なので自身の値を返す
            tree[index]
        } else { // 一部区間が被る時
            val vl = query_sub(begin, end, index * 2 + 1, left, (left + right) / 2)
            val vr = query_sub(begin, end, index * 2 + 2, (left + right) / 2, right)
            max(vl, vr)
        }
    }
}

Measured memory_bytes: 63012
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<ll>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;


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

    int ans = 0;
    while(x <= y){
        x *= 2;
        ans++;
    }

    cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  int r = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    r += a - 1;
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

char a[101][101];

int main(void){
	int h,w;
	
	
	cin>>h>>w;
	
for(int i=0;i<=h+1;i++)
		for(int j=0;j<=w+1;j++)
				a[i][j]='#';
	
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
				cin>>a[i][j];
	
	for(int i=0;i<=h+1;i++){
		for(int j=0;j<=w+1;j++)
				cout<<a[i][j]<<"";
		puts("");
	}
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class Program{
    static void Main(string[] args){
        string s = Console.ReadLine();
        bool a = Enumerable.Range(0, s.Length-2)
        .Select(i => s.Substring(i, 3))
        .Any(str => str[0] == str[1] && str[1] == str[2]);
        string ans = a ? "Yes" : "No";
        Console.WriteLine(ans);
    }
}


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int X;
const int N = 6;
const int M = 100000;
vector<bool> dp(M, false);
vector<int> value = {100, 101, 102, 103, 104, 105};

bool check(int i){
	bool tmp = false;
	REP(j,N){
		if(dp[i-value[j]]) tmp = true;
	}
	return tmp;
}

int main(void){

	cin >> X;

	dp[0] = true;
	REP(i,N) dp[value[i]] = true;

	FOR(i,106,X+1){
		if(check(i)) dp[i] = true;
	}

	if(dp[X]) cout << 1 << endl;
	else cout << 0 << endl;

	


	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<cstring>
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define ll long long
//#define ll unsigned long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define eps 1e-6
#define PI acos(-1)
#define mysetit multiset<ll>::iterator
#define mymsetit multiset<ll>::iterator
#define mymapit map<ll,ll>::iterator
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define lowbit(x) (x&(-x))
#define mp make_pair
#define pb push_back
#define si size()
#define E exp(1.0)
#define fixed cout.setf(ios::fixed)
#define fixeds(x) setprecision(x)
using namespace std;
inline ll read(){ll s=0,w=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;}void put1(){ puts("Yes") ;}void put2(){ puts("No") ;}
void debug(){printf("我在这里\n");}
void put3(){ puts("-1"); }ll qpf(ll a, ll b, ll p)
{ll ret = 0;while(b){if(b & 1) ret = (ret + a) % p;
a = (a + a) % p;b >>= 1;}return ret % p ;}
ll qp(ll a, ll n, ll p)
{ll ret = 1;while(n){if(n & 1) ret = qpf(ret, a, p);a = qpf(a, a, p);
n >>= 1;}return ret % p ;}
//θ=acos(L/2R);

const int manx=3e5+5;

ll f[manx],s[manx],cnt[manx];
ll find(ll x){
    if(x==f[x]) return x;
    else return f[x]=find(f[x]);
}
int main(){
    ll n=read(),m=read(),k=read();
    for(int i=1;i<=n;i++) f[i]=i,s[i]=1;
    for(int i=1;i<=m;i++){
        ll u=read(),v=read();
        cnt[u]++,cnt[v]++;
        ll fu=find(u),fv=find(v);
        if(fu==fv) continue;
        f[fv]=fu,s[fu]+=s[fv];
    }
    for(int i=1;i<=k;i++){
        ll u=read(),v=read();
        ll fu=find(u),fv=find(v);
        if(fu==fv) cnt[u]++,cnt[v]++;
    }
    for(int i=1;i<=n;i++){
        printf("%lld ",s[find(i)]-cnt[i]-1);
    }
    return 0;
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

const int INF = 1e18;
int xm[2]={0, 1}, ym[2]={1, 0};

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

    V(string) G(H);
    rep(i, H) cin >> G[i];

    vvi dis(H, vi(W, INF));
    dis[0][0] = (G[0][0]=='.' ? 0 : 1);
    /*vvi visited(H, vi(W, 0));
    queue<P> q;
    q.push(P(0, 0));
    
    while(!q.empty()) {
        P p = q.front();
        q.pop();
        int y=p.fi, x=p.se;
        rep(i, 2) {
            int ny=y+ym[i], nx=x+xm[i];
            if(ny>=H || nx>=W) continue;
            if(visited[ny][nx]==15) continue;
            visited[ny][nx]++;
            int temp;
            if(G[ny][nx]=='#') {
                temp = dis[y][x] + (G[y][x]=='.' ? 1 : 0);
            } else {
                temp = dis[y][x];
            }
            dis[ny][nx] = min(dis[ny][nx], temp);
            q.push(P(ny, nx));
        }
    }*/

    rep(y, H) {   
        rep(x, W) {
            char n = G[y][x];
            if(x+1<W) {
                char t = G[y][x+1];
                dis[y][x+1] = min(dis[y][x+1], dis[y][x]+(n=='.'&&t=='#' ? 1 : 0));
            }
            if(y+1<H) {
                char t = G[y+1][x];
                dis[y+1][x] = min(dis[y+1][x], dis[y][x]+(n=='.'&&t=='#' ? 1 : 0));
            }
        }
    }

    cout << dis[H-1][W-1] << endl;

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;
ll L,R,d;
void input();

void solve(){
    cout<<R/d - (L-1)/d<<"\n";
}

void Clear(){

}

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

    input();
    solve();
    Clear();
}

void input(){
    cin>>L>>R>>d;
}


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

int main() {
  long long n, m;
  cin >> n >> m;
  int a[m];
  long long sum = 0;
  for (int i = 0; i < m; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  if (sum <= n) {
    cout << n - sum << endl;
    return 0;
  } else {
    cout << -1 << endl;
    return 0;
  }
  return 0;
}

Measured memory_bytes: 3772
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>

using ll = long long;
using ull = unsigned long long;

using namespace std;

ull digit_minus(ll x) {
  if (x == 0 || x == 1) return (ull)x;
  ull res = 0;
  bool minus = x < 0;
  ull one = 1;
  if (minus) {
    ull sum = 2;
    for (res = 1; sum < abs(x) ; res += 2, sum += (one << res)) ;
  }else {
    ull sum = 1;
    for (res = 0; sum < x; res += 2, sum += (one << res)) ;
  }
  ull y = one << res;
  return y | digit_minus(x - y * (minus? -1 : 1));
}

int main()
{
  ll n;
  cin >> n;
  ull x = digit_minus(n);
  string res;
  ull one = 1;
  if (x == 0) {
    cout << 0 << endl;
    return 0;
  }
  while (x > 0) {
    res = ((x & one) ? "1" : "0") + res;
    x /= 2;
  }
  cout << res << endl;
//  cout << "11000101011001101110100010101" << endl;
  return 0;
}


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

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

  sum = 0;
  for ( int i = 1; i*a <= t ; i++ ) {
    sum += b;
  }

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
#define DIV0 1000000007
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'
/*

*/
int main()
{
    int N,K;
    cin >> N >> K;
    int LR[N][2];
    REP(i,K) cin >> LR[i][0] >> LR[i][1];
    ll mmm = 998244353;
    vector<ll> DP(N+1);
    vector<ll> DPsum(N+1);
    DP[1] = 1;
    DPsum[1] = 1;
    for(int i = 2; i <= N; i++){
        REP(j,K){
            //where come from?
            int li = i-LR[j][1];//min
            int ri = i-LR[j][0];//max
            if(ri < 0) continue;
            li = max(li,1);
            DP[i] = ((DP[i]+(DPsum[ri]-DPsum[li-1])%mmm)+mmm)%mmm;
        }
        //累積和の更新
        DPsum[i] = (DPsum[i-1]+DP[i])%mmm;
    }
    fin(DP[N]);
    return 0;
}

Measured memory_bytes: 6056