akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define BUF (100005)
#define ll long long 


ll N, K;
ll A[BUF];
ll b[50];
ll k[50];
ll a[50];

vector<ll> v;

int main(void){
	cin >> N >> K;
	for(int i=1;i<=N;i++) cin >> A[i];

	for(int i=1;i<=N;i++){
		for(int j=0;j<50;j++){
			if((A[i]>>j)&1) b[j]++;
		}
	}


	ll ans = 0;
	for(int j=50;j>=0;j--){
		if((ans|(1LL<<j))<=K && (b[j]<N-b[j])) {
			ans+=(1LL<<j);
			//cout << j << " ";
		}
	}
	//cout << ans;
	ll ret = 0;
	for(int i=1;i<=N;i++){
		ret += A[i]^ans;
	}

	cout << ret << endl;
	return 0;
}


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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

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

#define MAX_V 100000

#define MOD 1000000007L
#define INF 2147483647

signed main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (((a + b) * h) / 2) << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;
 
vector<long long int> divisor(long long int n) {
    vector<long long int> res;
    for (long long int i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            if (i * i != n) res.push_back(n / i);
        }
    }
    sort(begin(res), end(res));
    return res;
}
long long int gcd(long long int l, long long int r) {
    if (l > r)return gcd(r, l);
    else {
        if (r%l) {
            return gcd(l, r%l);
 
        }
        else {
            return l;
        }
    }
}
int main() {
    int N; cin >> N;
    vector<long long int>ns(N);
    for (int i = 0; i < N; ++i) {
        cin >> ns[i];
    }
    long long int a =  gcd(ns[0], ns[1]);
    if (N == 3) {
        a =  gcd(a, ns[2]);
    }
    auto v(divisor(a));
    for (auto n : v) {
        cout << n << endl;
    }
    return 0;
}


Measured memory_bytes: 3156
N,W = map(int, input().split())
weight = []
value = []
for i in range(N):
    w,v = map(int, input().split())
    weight.append(w)
    value.append(v)
 
inf=float("inf")
dp=[[-inf for i in range(W+1)] for j in range(N+1)]
for i in range(W+1): dp[0][i]=0
 
for n in range(N):
    for w in range(W+1):
        if w>=weight[n]:
            dp[n+1][w] = max(dp[n][w-weight[n]]+value[n], dp[n][w])
        else:
            dp[n+1][w] = dp[n][w]
 
 
print(dp[N][W])

Measured memory_bytes: 313524
#include<stdio.h>
int main(void)
{
	float a,b;
	int l1,l2,l3,l4;
	int r1,r2,r3,r4;
	l1=l2=l3=l4=0;
	r1=r2=r3=r4=0;
	while(scanf("%f %f",&a,&b)!=EOF){
		if(a>=1.1){
			l1++;
		}
		else if(a>=0.6){
			l2++;
		}
		else if(a>=0.2){
			l3++;
		}
		else if(a<0.2){
			l4++;
		}
		if(b>=1.1){
			r1++;
		}
		else if(b>=0.6){
			r2++;
		}
		else if(b>=0.2){
			r3++;
		}
		else if(b<0.2){
			r4++;
		}
	}
	printf("%d %d\n%d %d\n%d %d\n%d %d\n",l1,r1,l2,r2,l3,r3,l4,r4);
	return 0;
}

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

int main() {
    int A[3][3];
    rep(i, 3) rep(j, 3) cin >> A[i][j];

    bool flag = true;
    int B[3];
    rep(i, 3) B[i] = A[0][i];
    rep(i, 3) {
        int sa = B[0] - A[i][0];
        rep(j, 3) {
            if (A[i][j] != B[j] - sa)
                flag = false;
        }
    }

    rep(i, 3) B[i] = A[i][0];
    rep(i, 3) {
        int sa = B[0] - A[0][i];
        rep(j, 3) {
            if (A[j][i] != B[j] - sa)
                flag = false;
        }
    }

    flag ? cout << "Yes" : cout << "No";
    cout << endl;

    return 0;
}

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

dp = [0 for i in range(N)]
onedp = [0 for i in range(N)]
seconddp = [0 for i in range(N)]

for i in range(N-1):
    if onedp[i]<seconddp[i]:
        dp[i]=onedp[i]
    else:
        dp[i]=seconddp[i]
    if i!=N-2:
        seconddp[i+2]=dp[i]+abs(h[i+2]-h[i])
    onedp[i+1]=dp[i]+abs(h[i+1]-h[i])
    if i==0:
        seconddp[1]=onedp[1]

if onedp[N-1]<seconddp[N-1]:
    dp[N-1]=onedp[N-1]
else:
    dp[N-1]=seconddp[N-1]
print(dp[N-1])


Measured memory_bytes: 16072
var
 n,i,j,t,s:longint;
 a:array[0..200] of longint;
begin
 readln(n);
 n:=n*2;
 for i:=1 to n do read(a[i]);
 for i:=1 to n-1 do
  for j:=i+1 to n do
   if a[i]>a[j] then begin t:=a[i];a[i]:=a[j];a[j]:=t; end;
 for i:=1 to n div 2 do s:=s+a[i*2-1];
 writeln(s);
end.

Measured memory_bytes: 128
// Example program
#include <bits/stdc++.h>
using namespace std;
long long q[4];
double gq[4];
long long d;
long long n;

int main()
{
       double k=0.25;
    for(long long i=0;i<4;i++)
    {
        cin>>q[i];
        gq[i]=k;
        k*=2;
    }
    cin>>n;
    d=(n/gq[0])*q[0];
        d=min(d,(long long)(n/gq[1])*q[1]);
    d=min(d,(long long)(n*q[2]));
    d=min(d,((long long)((n/2)*q[3])+((long long)(n%2)*q[2])));
    d=min(d,((long long)((n/2)*q[3])+((long long)(n%2)*q[1]*2)));
     d=min(d,((long long)((n/2)*q[3])+((long long)(n%2)*q[0]*4)));
    cout<<d;
}


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

int main(void){
  int h, w;
  cin >> h >> w;
  string a[h];
  for(int i = 0; i < h; i++) cin >> a[i];
  int num = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(a[i][j] == '#') num++;
    }
  }
  if(num == h + w - 1) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}


Measured memory_bytes: 256
solve tp hp [] = show tp ++ " " ++ show hp
solve tp hp ([t,h]:xs)
	| t > h = solve (tp+3) hp xs
	| t < h = solve tp (hp+3) xs
	| otherwise = solve (tp+1) (hp+1) xs

main = getContents >>= putStrLn . solve 0 0 . map words . tail . lines

Measured memory_bytes: 4100
#include <iostream>

using namespace std;

int main(){
  int x[100010],D,r;
  cin >> r >> D >> x[0];
  for(int i = 0; i < 10; i++){
    x[i + 1] = r * x[i] - D;
    cout << x[i+1] << endl;
  }
  return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        for (int i = s.length() - 1; i > 0; i--) {
            if (i % 2 > 0) {
                i--;
            }
            String ss = s.substring(0, i);
            String p1 = ss.substring(0, i / 2);
            String p2 = ss.substring(i / 2, i);
            if (p1.equals(p2)) {
                System.out.println(ss.length());
                return;
            }
        }
    }
}

Measured memory_bytes: 20820
#include<bits/stdc++.h>
#define MAX 5000005
#define ll long long 
using namespace std;
inline int read() {
                                 int x=0, tmp=1;
                               char ch=getchar();
                            //233333333333333333333333
                          while( (ch<'0') || (ch>'9') ){
                         if(ch=='-')tmp=-1; ch=getchar();}
                          while( (ch>='0')&&(ch<='9') ){
                            x=x*10+ch-'0';ch=getchar();
                               }//233333333333333
                                 return (x*tmp);
}
#define MOD 998244353
void add(int &x,int y){x+=y;if(x>=MOD)x-=MOD;}
ll jc[5005],jv[5005],inv[5005],n,k,tot[5005];
ll C(int n,int m){
    return jc[n]*jv[m]%MOD*jv[n-m]%MOD;
}
int main(){
    int k=read(),n=read();
    jc[0]=jv[0]=inv[0]=inv[1]=1;
    for(int i=1;i<=n+k;++i){
        if(i!=1)inv[i]=inv[MOD%i]*(MOD-MOD/i)%MOD;
        jc[i]=jc[i-1]*i%MOD;
        jv[i]=jv[i-1]*inv[i]%MOD;
    }
    for(int i=1;i<=k;++i) tot[i+1]+=1,tot[i+k+1]-=1;
    for(int i=1;i<=k+k;++i)tot[i]+=tot[i-1];
    for(int i=2;i<=k+k;++i){
        int pos=(tot[i]+1)/2,ans=0;
        for(int j=0,d=1;j<=pos&&j+j<=n;++j,d=MOD-d)
            add(ans,1ll*d*C(pos,j)%MOD*C(n-2*j+k-1,k-1)%MOD);
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

a.sort()
prev = gcd(a[0], a[1])
#print(prev)
for i in range(2, n):
    g = gcd(a[i], prev)
    if g < prev:
        prev = g

print(prev)


Measured memory_bytes: 62704
#include <iostream>
#include <queue>

using namespace std;

int main() {
    int n, x;
    cin >> n >> x;
    if (x == 1 || x == 2 * n - 1) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    deque<int> ret;
    for (int i = 1; i < 2 * n; i++)ret.push_back(i);
    while (ret[n - 1] != x) {
        ret.push_front(ret[n * 2 - 2]);
        ret.pop_back();
    }
    for (auto x:ret)cout << x << endl;
    return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <utility>
#include <stack>
using namespace std;

int main()
{
  int n, m;
  int mat[10][10] = {0};
  cin >> n >> m;
  for (int i = 0; i < m; ++i)
  {
    int a, b;
    cin >> a >> b;
    mat[a][b] = mat[b][a] = 1;
  }

  int end = 0;
  for (int i = 1; i <= n; ++i)
  {
    end = end | (1 << i);
  }

  stack<pair<int, int>> stack; // (今いる場所, 到達した場所)
  stack.push(make_pair(1, 1 << 1));
  int count = 0;
  while (!stack.empty())
  {
    auto p = stack.top();
    stack.pop();

    if ((p.second & end) == end)
    {
      // 全部通った
      count++;
      continue;
    }

    for (int i = 1; i <= n; ++i)
    {
      // 今いるところに連結していて、まだ移動していない場所なら移動する
      if (mat[p.first][i] > 0 && (p.second & (1 << i)) == 0)
      {
        stack.push(make_pair(i, p.second | (1 << i)));
      }
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
3.times do
    h1, m1, s1, h2, m2, s2 =  gets.split.map(&:to_i)
    d = 3600 * (h2 - h1) + 60 * (m2 - m1) + (s2 - s1)
    printf("%d %d %d\n", d / 3600, d % 3600 / 60, d % 60)
end


Measured memory_bytes: 6872
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
signed main() {
	int X, Y;
	string ans;
	cin >> X >> Y;
	ans = abs(X - Y) > 1 ? "Alice" : "Brown";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] a = new int[N];
        int[] ab = new int[3 * N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
            ab[i] = a[i];
        }
        for (int i = N; i < 2 * N; i++) {
            ab[i] = a[i - N] - 1;
        }
        for (int i = 2 * N; i < 3 * N; i++) {
            ab[i] = a[i - 2 * N] + 1;
        }
        Arrays.sort(ab);
        long c = 1;
        long ans = 0;
        for (int i = 1; i < 3 * N; i++) {
            if (ab[i] == ab[i - 1]) {
                c++;
            } else {
                ans = Math.max(ans, c);
                c = 1;
            }
        }
        ans = Math.max(ans, c);
        System.out.println(ans);
    }
}


Measured memory_bytes: 51876
#include<cstdio>
#include<algorithm>
int n;
char S[300100];
long long ans=0x3f3f3f3f3f3f3f3f,a[300100];
long long calc(long long x){
	return (x-1)-a[x-1]+a[n]-a[x];
}
int main(){
    scanf("%d",&n);
    scanf("%s",S+1);
    for(int i=1;i<=n;i++)
    	a[i]=a[i-1]+(S[i]=='E');
    for(int i=1;i<=n;i++)
    	ans=std::min(ans,calc(i));
    printf("%lld\n",ans);
}

Measured memory_bytes: 5800
#include<iostream>
#include<vector>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
using namespace std;
int vector_finder(vector<int> vec, int number) {        //数値判定
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
int a_1(int a) {										//素数判定
	int x = 0;
	for (int i = 2; i < a; i++) {
		if (a % i == 0)x++;
	}
	if (x == 0) {
		return 0;//素数であるとき
	}
	if (x != 0) {
		return 1;//素数でないとき
	}
}
int gcd(int a, int b) {
	if (a < b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}
int main() {
	char s;
	cin >> s;
	if (isupper(s))cout << "A" << endl;
	else cout << "a" << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main() {
    int n, k;
    scanf("%d %d", &n, &k);
    long long int data[200000] = {0};
    for (int i = 0; i < n; i++) {
        scanf("%d", &data[i]);
    }
    bool fr = false;
    for (int j = k - 1; j < n; j++) {
        if (!fr) {
            fr = true;
            continue;
        }
        if (data[j] > data[j - k]) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int N, M, D; cin >> N >> M >> D;
    cout << fixed << setprecision(12);
    cout << (double)(D == 0 ? N : 2.0 * (N - D)) * (M - 1) / N / N << endl;
    return 0;
}

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

int main() {
  ll n, k;
  cin >> n >> k;

  ll ans = n;
  ans = min(ans, n % k);
  ans = min(ans, abs(n % k - k));

  ANS(ans);
  return 0;
}


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

public class Main {
    int n;
    int[] ps;

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

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        ps = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            ps[i] = sc.nextInt();
        }
        solve();
    }

    void solve() {
        boolean[] bads = new boolean[n + 1];
        for (int i = 1; i <= n; i++) {
            if (ps[i] == i) {
                bads[i] = true;
            }
        }
        int count = 0;
        for (int i = 1; i < n; i++) {
            if (ps[i] == i) {
                swap(ps, i, i + 1);
                count++;
            }
        }
        if (ps[n] == n) {
            count++;
        }
        System.out.println(count);
    }

    void swap(int[] ps, int i, int j) {
        int temp = ps[i];
        ps[i] = ps[j];
        ps[j] = temp;
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 34244
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n;
     cin>>n;
    while(1){
        int k=0;
    for(int i=2;i<n;i++){
        if(n%i==0){
            k++;
        }
    }
    if(k!=0){
        n++;
    }
    else{
        break;
    }

}
cout<<n;
	return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef double ld;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}
ll gcd(ll a,ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< MOD >;
long long modpow(long long a, long long n, long long mod=MOD) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
	init();
	ll N,M;cin>>N>>M;
	vector<ll>s[M];
	vector<ll>k(M);
	for(int i=0;i<M;i++){
		cin>>k[i];
		for(int j=0;j<k[i];j++){
			ll _s;cin>>_s;_s--;
			s[i].push_back(_s);
		}
	}
	vector<ll>p(M);
	for(int i=0;i<M;i++){
		cin>>p[i];
	}
	
	ll ans=0;
	
	for(int i=0;i<pow(2,N);i++){
		bool isOK=true;
		for(int j=0;j<M;j++){
			//light
			ll count=0;
			for(int a=0;a<k[j];a++){
				if(i>>s[j][a]&1)count++;
			}
			if(count%2!=p[j])isOK=false;
		}
		if(isOK)ans++;
	}
	cout<<ans<<endl;
}


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

int main() {
  int n;
  cin >> n;
  int num[n];
  int num_count[n];
  for (int i = 0; i < n; i++) {
    num_count[i] = 0;
  }

  int max_num = 0;
  bool flag_d0_is_zero = true;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (i == 0 && x != 0) {
      flag_d0_is_zero = false;
    }
    num[i] = x;
    num_count[x]++;
    max_num = max(x, max_num);
  }
  if (num_count[0] != 1 || !flag_d0_is_zero) {
    cout << 0 << endl;
    return 0;
  }

  long long count_num = 1;
  for (int i = 1; i < n; i++) {
    count_num *= num_count[num[i] - 1];
    count_num = count_num % 998244353;
  }
  cout << count_num << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
 
int main(){
  double n,k;
  cin>>n>>k;
  double ans=0;
  for(int i=1;i<=n;i++){
    double dd=1/n;
    int h=i;
    while(h<k){
      h*=2;
      dd/=2.0;
    }
    ans+=dd;
  }
  cout << fixed << setprecision(10);
  cout<<ans<<endl;
}
  


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

using namespace std;

int main() {
    int maxn = -1000001;
    int minn = 1000001, tmp, n;
    long long int sum = 0;
    
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &tmp);
        sum += tmp;
        maxn = max(maxn, tmp);
        minn = min(minn, tmp);
    }
    printf("%d %d %lld\n", minn, maxn, sum);
    return 0;
}



Measured memory_bytes: 3216
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i, j, k;
		int trmp[][];
		trmp = new int[4][13];
		
		String egara[] = { "S", "H", "C", "D" };
		
		int n = scan.nextInt();
		String x="0";
		int y=0;int card;
		for (k = 1; k <= n; k++) {
			x = scan.next();
			y = scan.nextInt();
if(x.equals(egara[0])){
	card=0;
	trmp[card][y-1]=9999;
}else if(x.equals(egara[1])){
	card=1;
	trmp[card][y-1]=9999;
	}else if(x.equals(egara[2])){
		card=2;
		trmp[card][y-1]=9999;
		}else {
			card=3;
			trmp[card][y-1]=9999;
			}


		}
		for (j = 0; j < 4; j++) {
			for (i = 0; i < 13; i++) {

				if (trmp[j][i]!=9999) {

					System.out.println(egara[j] + " " + (i+1));
				}

			}
		}

	}

}

Measured memory_bytes: 26152
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b+c==max({a,b,c})*2)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
/*
Author - Vedant Daigavane
*/

#include<bits/stdc++.h>

#define pb push_back
#define vi vector<int>
#define nl cout<<endl;
#define vc vector<char>
#define ll long long int
#define w(t)  while(t!=0)
#define daigavane int main()
#define vii vector<vector<int>>
#define ul unsigned long long int
#define f(i,s,n) for(int i=s;i<=n;i++)
using namespace std;

daigavane
{
    ll a;
    cin>>a;
    a+=((a*a)+(a*a*a));
    cout<<a;
}

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

int main()
{
  string s;
  cin >> s;
  
  string t;
  for(int i = 0; i < static_cast<int>(s.size()); i++){
    if( (i % 2) == 0){
      t += s.at(i);
    }
  }
  
  cout << t << endl;
}

Measured memory_bytes: 3596
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N, K, C := sc.nextInt(), sc.nextInt(), sc.nextInt()
	S := sc.nextStr()
	L := make([]int, N)
	R := make([]int, N)
	for i := 0; i < N; i++ {
		L[i] = -1
		R[i] = -1
	}
	for i, count := 0, 0; i < N && count < K; {
		if S[i] == 'o' {
			L[i] = count
			count++
			i += C + 1
		} else {
			i++
		}
	}
	for i, count := N-1, K-1; i >= 0 && count >= 0; {
		if S[i] == 'o' {
			R[i] = count
			count--
			i -= C + 1
		} else {
			i--
		}
	}
	for i := 0; i < N; i++ {
		if L[i] != -1 && R[i] != -1 && L[i] == R[i] {
			fmt.Fprintln(wtr, i+1)
		}
	}
}


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

int minCostDP(int *arr, int n){
    int *dp=new int[n+1];
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(arr[2]-arr[1]);
    for(int i=3;i<=n;i++){
        dp[i]=min((abs(arr[i]-arr[i-1]) + dp[i-1]),(abs(arr[i]-arr[i-2])+dp[i-2]));
    }
    return dp[n];
}

int main(){
	int n;
  	cin>>n;
  	int *arr=new int[n+1];
    for(int i=1;i<=n;i++){
    	int h;
      	cin>>h;
      	arr[i]=h;
    }
    
    int *dp=new int[n+1];
    memset(dp,-1,sizeof(dp[0])*(n+1));
    
    cout<< minCostDP(arr,n)<<endl;
    return 0;
}

Measured memory_bytes: 1024
my $N =  <STDIN>;
chomp ($N);
my @A;
foreach (split(/ /o, <STDIN>)) {
  chomp($_);
  push(@A, $_) if ($_ ne '');
}
my $i = 0;
my $t = 0;
my $k = 1;
foreach my $a (sort {$a <=> $b} @A) {
  if ($i == 0) {
    $t += $a;
  } else {
    $t += $k*$a;
    $k = $k * 2;
  }
  $i++;
}
print $t/$k;

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

using namespace std;
using ll = long long;
using vec = vector<int>;

#define rep(i, n)  for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define Sort(a)    sort(a.begin(), a.end())
#define gSort(a)   sort(a.begin(), a.end(), greater<int>())
#define pout(n, a) cout << fixed << setprecision(n) << (a)
#define Cast(dig, n) static_cast<std::bitset<(dig)>>(n)

const int INF = 2147483647;
const ll  MOD = 1000000007;

int main() {
    string s, t;
    cin >> s;
    cin >> t;

    for(int i = 0; i < s.length(); ++i) {
        if(s[i] != t[i]) {
            cout << "No";
            return 0;
        }
    }

    cout << "Yes";
    return 0;
}

Measured memory_bytes: 3624
// C++のテンプレート
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main(void){
    int five=0,seven=0,temp;
    for(int i=0;i<3;i++){
        cin >> temp;
        if(temp == 5)
            five++;
        if(temp == 7)
            seven++;
    }
    if(five==2&&seven==1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

int main()
{
	int n;
	cin >> n;
	int a[9] = {};
	REP(i, n){
		int tmp;
		cin >> tmp;
		if (tmp < 400) a[0]++;
		else if (tmp < 800) a[1]++;
		else if (tmp < 1200) a[2]++;
		else if (tmp < 1600) a[3]++;
		else if (tmp < 2000) a[4]++;
		else if (tmp < 2400) a[5]++;
		else if (tmp < 2800) a[6]++;
		else if (tmp < 3200) a[7]++;
		else a[8]++;
	}

	int count = 0;
	REP(i, 8) if (a[i]) count++;

	if (count) cout << count << " ";
	else cout << 1 << " ";

	cout << count + a[8] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
const long long int INF = INT64_MAX;
const long long int Mod = 1000000007;
using ll = long long int; /*long long int は64bit*/
using vi = vector<int>;using Vi = vector<long long int>;using matrix = vector<vector<ll> >;using Pair = pair<ll,ll>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(long long int i=0;i<N;i++) 
#define rev(i,N) for(long long int i=N-1;i>=0;i--) /*N-1からスタート*/
#define np nullptr
template<class T,class T2>bool chmax(T &former, const T2 &b) { if (former<=b) { former=b; return true; } return false; }
template<class T,class T2>bool chmin(T &former, const T2 &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; } /*sqrt(x)は平方根*/
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) /*降順↓でVをソート*/
#define fill(x,num) memset(x,num,sizeof(x));
template<class T1,class T2>bool p_compare(const pair<T1,T2> fir,const pair<T1,T2> sec){ return fir.second < sec.second; }
bool p_comp(const Pair fir,const Pair sec){return p_compare<ll,ll>(fir,sec);}
template<class T1,class T2>bool pcompare(pair<T1,T2> fir,pair<T1,T2> sec){ return !p_comp(fir,sec); }
bool pcomp(const Pair fir,const Pair sec){return pcompare<ll,ll>(fir,sec);}
/*sort(all(v),p_compare<ll,ll> 又は p_comp)で↑ソート , pcompは↓ソート*/

//////////////////////////^^ *Emile ^^^//////////////////////////////////////////////////////
//Snipet -> Caps Lock

ll a,b;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>a>>b;
    if(b%a==0){
        cout<<b+a<<endl;
    }else{
        cout<<b-a<<endl;
    }
    return 0;
}

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

int main(){
	int n, m;
	cin >> n >> m;
	vector<int> problems;
	vector<string> responses;
	set<int> s,ac;
	int correct=0,penalty=0;
	for(int i = 0; i<m;i++){
		string response;
		int problem;
		cin >> problem >> response;
		problems.push_back(problem);
		responses.push_back(response);
		if(response == "AC") ac.insert(problem);
	}
	for(int i = 0; i<m;i++){
		string response;
		int problem;
		problem = problems[i];
		response = responses[i];
		if (response == "WA") {
			if (s.count(problem) == 0 && ac.count(problem)) penalty++;
		}
		else if (response == "AC") {
			if (s.count(problem) == 0) {correct++; s.insert(problem);}
		}
	}
	cout << correct << " " << penalty;
	
 }


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

int dp[111111];

int solve(int n) {
  if(n == 0) return 0;
  if(dp[n] > 0) return dp[n];

  int ret = INF;
  ret = min(ret, solve(n-1) + 1);
  for(int i = 6; i <= n; i *= 6) ret = min(ret, solve(n-i) + 1);
  for(int i = 9; i <= n; i *= 9) ret = min(ret, solve(n-i) + 1);
  return dp[n] = ret;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  out(solve(n));
  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int n[3];
    cin >> n[0] >> n[1] >> n[2];
    sort(n, n+3);
    int diff = n[2] - n[0] + n[2] - n[1];
    if (diff & 1) cout << (diff + 3) / 2 << endl;
    else cout << diff / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,ans;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    int dp[n];
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        ans=INT_MAX;
        for(int j=i-1;j>=0&&j>=i-k;j--)
        ans=min(dp[j]+abs(a[i]-a[j]),ans);
      dp[i]=ans;
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024
<?php
/*
	AOJ 0158
	title:
	@kankichi573
*/

while(fscanf(STDIN,"%d",$n) && $n)
{
	$count=0;
	while($n > 1)
	{
		if($n%2)
			$n = 3*$n+1;
		else
			$n/=2;	
		++$count;
	}
	fprintf(STDOUT,"%d\n",$count);
}
return(0);

?>

Measured memory_bytes: 6564
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  ll n; cin >> n;
  if(n%2){
    cout << 0 << endl;
    return 0;
  }
  
  n /= 2;
  
  ll res = 0;
  while(n){
    res += n/5;
    n /= 5;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 384
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,m = li()
xy = []

ins = [0]*n
graph = [[] for _ in range(n)]

dp = [0]*n
for _ in range(m):
    x,y = li_()
    ins[y] += 1
    graph[x].append(y)
    
stack = []
for i in range(n):
    if ins[i] == 0:
        stack.append(i)

while stack:
    nex_stack = []
    for point in stack:
        for nexp in graph[point]:
            dp[nexp] = max(dp[nexp], dp[point]+1)
            ins[nexp] -= 1
            if ins[nexp] == 0:
                nex_stack.append(nexp)
                
    stack = nex_stack
    
print(max(dp))
            

Measured memory_bytes: 59424
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int l,r,d; cin>>l>>r>>d;
	int cnt=0;
	for(int i = l; i <= r; i++){
		if(i%d==0) cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int arr[110];
	int n;
	cin>>n;
	int sum = 0;
	for (int i = 0; i < n; ++i){
		cin>>arr[i];
		sum += arr[i];
	}
	if(sum %10 != 0){
		cout<<sum<<endl; return 0;
	}
	sort(arr, arr + n);
	int i = 0;
	while(arr[i] % 10 == 0 && i < n)
		i++;
	if(i != n)
		cout<<sum - arr[i]<<endl;
	else
		cout<<0<<endl;
	return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x, y) CPP_CAT_I(x, y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x, y) x##y

#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'017LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define M5 100007
#define M9 1000000000

// util {{{
#define FOR(i, start, end) for (i64 i = (start), CPP_CAT(i, xxxx_end) = (end); i < CPP_CAT(i, xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f, c, ...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ##__VA_ARGS__); })(c))
#define ll long long int
#define VI vector<int>
template <typename C>
i64 SIZE(const C &c)
{
    return static_cast<i64>(c.size());
}

template <typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {})
{
    if (comp(xmax, x))
    {
        xmax = x;
        return true;
    }
    return false;
}

template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {})
{
    if (comp(x, xmin))
    {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit
{
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit()
    {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

bool isOK(int mid, double key)
{
}

int binary_search(double key)
{
    int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = 2000000000;
    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1)
    {
        int mid = left + (right - left) / 2;

        if (isOK(mid, key))
            right = mid;
        else
            left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}

bool isKaibun(string st)
{
    bool ans = true;
    int n = st.length();
    REP(i, n / 2)
    {
        if (st[i] != st[n - i - 1])
        {
            return false;
        }
    }
    return true;
}

int toInt(char a)
{
    return a - '0';
}

int gcd(int a, int b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

int lcm(int a, int b)
{
    return a * b / gcd(a, b);
}

void solve()
{
    int N, M;
    cin >> N;
    if (N == 0)
    {
        cout << 1;
    }
    else
    {
        cout << 0;
    }
}

signed main()
{

    solve();

    return 0;
}


Measured memory_bytes: 3608
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<sys/time.h>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
inline int ri()
{
	register int x=0;register bool f=0;register char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}
	while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();};
	return f?-x:x;
}
void wi(int x)
{
	if(x<0)	x=-x,putchar('-');
	if(x>9)	wi(x/10);
	putchar('0'+x%10);
}
const int N=1e5+7;
char str[N];
int main()
{
	scanf("%s",str+1);
	int n=strlen(str+1),i,ans=n,rev=0;
	for(i=1;i<=n;i++)	str[i]-='0';
	for(i=1;i<=n;i++)
	{
		if(str[i]^rev)
		{
			if(i-1>n-i+1)
			{
				ans=min(ans,i-1);
			}
			else
			{
				rev^=1;
				ans=min(ans,n-i+1);
			}
		}
	}
	wi(ans);
	return 0;
}


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

int main(void){

    int n, m;

    cin >> n >> m;

    int min = 100000000;
    int max = 0;
    for(int i=0; i<m; i++) {
        pair<int, int> lr;
        cin >> lr.first >> lr.second;
//        if(lr.first<min) min = lr.first;
        if(lr.first>max) max = lr.first;
        if(lr.second<min) min = lr.second;
//        if(lr.second>max) max = lr.second;
    } 
    
    int result;
    if(((min-max)+1)<0) result = 0;
    else result = (min-max)+1;
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cassert>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<tuple>
#include<numeric>
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef ll int__;
#define rep(i,j) for(int__ i=0;i<(int__)(j);i++)
#define repeat(i,j,k) for(int__ i=(j);i<(int__)(k);i++)
#define all(v) v.begin(),v.end()

template<typename T>
ostream& operator << (ostream &os , const vector<T> &v){
    rep(i,v.size()) os << v[i] << (i!=v.size()-1 ? " " : "\n"); return os;
}

template<typename T>
istream& operator >> (istream &is , vector<T> &v){
    rep(i,v.size()) is >> v[i]; return is;
}

#ifdef DEBUG
void debug(){ cerr << endl; }
#endif
template<class F,class...R>
void debug(const F &car,const R&... cdr){
#ifdef DEBUG
    cerr << car << " "; debug(cdr...);
#endif
}


bool solve(){
    int W, H; cin >> W >> H;
    int N; cin >> N;
    vector<int> P(N); cin >> P;
    int x[2] = {0, 0}, y[2] = {0, 1};
    int dx[2] = {1, 1}, dy[2] = {};

    int ans = 0;
    for(int p : P){
        x[p] += dx[p];
        y[p] += dy[p];
        if(y[p] == p and x[p] == W-1-p) dx[p] =  0, dy[p] = 1;
        if(x[p] == W-1-p and y[p] == H-1-p) dx[p] = -1, dy[p] = 0;

        if(x[0] == x[1] and abs(y[0] - y[1]) == 1) ans++;
        if(y[0] == y[1] and abs(x[0] - x[1]) == 1) ans++;
        debug("x", x[p], "y", y[p]);
    }
    
    cout << ans << endl;
        
    return false;
}

int main(){
    ios::sync_with_stdio(false);
    while(solve());
    return 0;
}

Measured memory_bytes: 3168
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <stack>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,P> PP;
int r,c,n;
bool flag[2];
P p[100001][2];
vector<P> query;

int calc(int x,int y){
	if(y==0){
		return x;
	}else if(x==r){
		return r+y;
	}else if(y==c){
		return r+c+r-x;
	}else{
		return r+c+r+c-y;
	}
}

bool on_board(P p){
	if(p.first!=0 && p.first!=r){
		if(p.second!=0 && p.second!=c)return false;
	}
	return true;
}

int main(void){
	scanf("%d%d%d",&r,&c,&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&p[i][0].first,&p[i][0].second);
		scanf("%d%d",&p[i][1].first,&p[i][1].second);
		if(on_board(p[i][0]) && on_board(p[i][1])){
			int v1=calc(p[i][0].first,p[i][0].second);
			int v2=calc(p[i][1].first,p[i][1].second);
			if(v1>v2)swap(v1,v2);
			query.push_back(P(v1,v2));
		}
	}
	sort(query.begin(),query.end());
	bool res=true;
	stack<int> sta;
	for(int i=0;i<query.size();i++){
		while(sta.size()){
			int s=sta.top();
			if(s<query[i].first)sta.pop();
			else break;
		}
		if(sta.size()){
			int s=sta.top();
			if(s<query[i].second)res=false;
		}
		sta.push(query[i].second);
	}
	printf("%s\n",res?"YES":"NO");
	return 0;
}


Measured memory_bytes: 2936
import scala.math.{min,max}

object Main {
  val sc = new java.util.Scanner(System.in)
  def main(args: Array[String]) {
    val pa = List(sc.nextInt, sc.nextInt, sc.nextInt)
    val ju = List(sc.nextInt, sc.nextInt)
    var m = 10000
    for(i <- 0 until 3; j <- 0 until 2) {
      m = min(m, pa(i) + ju(j) - 50)
    }
    println(m)
  }
}

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

int main(){
    string s,t;cin >> s >> t;
    int result = 0;
    for (int i=0;i<s.size();i++){
        if (s[i] == t[i]){
            result++;
        }
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
const int INF = 1001001001;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define re0 return 0
#include<string.h>
int npr(int n , int r){//nPr
    r = n - r;
    int sum = 1;
    int i;
    for (i=n;i>=r+1;i--)sum*=i;
    return sum;
}
int gcd(int a, int b) {//最大公約数
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {//最小公倍数
    return a * b / gcd(a, b);
}
int digsum(int n) {//桁和
    int res = 0;
    while(n > 0) {
        //res += n%10;
        //　↑をres++;にすれば桁数
         res++;
        n /= 10;
    }
    return res;
}
bool isPrime(int x){//素数判定
    if(x==1)return 0;
    if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i++)if(x%i==0)return 0;
    return 1;
}
/*bit全探索
for (int bit = 0; bit < (1<<N); ++bit) {
}
if (bit & (1 << i)) {
}
*/


int main(void){
    ll n,d;
    cin >> n >> d;
    int cnt=0;
    long double dis;
    rep(i,n){
        ll x,y;
        cin >> x >> y;
        dis = sqrt((x*x)+(y*y));
        if(dis<=d){
            cnt++;
        }
    }
    cout << cnt <<endl;
    return 0;
}




Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
    double area = 0.0;
    double x[20], y[20];
    int n = 0;
    char ch;

    while (cin >> x[n] >> ch >> y[n])
        n++;
    x[n] = x[0];
    y[n] = y[0];
    n++;

    for (int i = 0; i < n; i++)
        area += x[i] * y[i + 1] - x[i + 1] * y[i];

    cout << setiosflags(ios::fixed) << setprecision(6);
    cout << abs(area  / 2.0) << endl;
}

Measured memory_bytes: 1288
#include<bits/stdc++.h>
using namespace std;
int cmp(int a,int b)
{
	return a>b; 
}
int sum=0;
int f[4];
int main()
{
	cin>>f[1]>>f[2]>>f[3];
	sort(f+1,f+4,cmp);
	if((f[1]+f[2]+f[3])%2==0)
	{
		int b=0;
		if(f[1]%2==1)
			f[1]++,f[2]++,sum++;
		for(int i=2;i<=3;i++)
		{
			int s=f[1]-f[i];
			if(s%2==1 && b==0)
				sum++,b++;
			sum+=s/2;
		}
	}
	else
	{
		int b=0;
		if(f[1]%2==0)
			f[1]++,f[2]++,sum++;
		for(int i=2;i<=3;i++)
		{
			int s=f[1]-f[i];
			if(s%2==1 && b==0)
				sum++,b++;
			sum+=s/2;
		}
	}
	cout<<sum<<endl;
return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int INF = (int)1e9 + 7;

int main() {
    int n;
    while (cin >> n, n) {
        vector<int> a(n);
        for (auto &ai: a) cin >> ai;
        sort(begin(a), end(a));
        int mi = INF;
        for (int i = 0; i + 1 < n; i++) mi = min(mi, a[i + 1] - a[i]);
        cout << mi << endl;
    }
    return 0;
}



Measured memory_bytes: 3068